Changeset 1359
- Timestamp:
- May 13, 2011, 10:44:34 AM (11 years ago)
- Location:
- extensions/net.sf.basedb.reggie/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.reggie/trunk/resources/consentform.jsp
r1354 r1359 134 134 // This wizard will only allow 'Yes' option on the consent form 135 135 enableConsentOption('consent.yes', true); 136 setInputStatus('consent', 'This case isalready exists.', 'valid');136 setInputStatus('consent', 'This case already exists.', 'valid'); 137 137 Main.showInline('morehelp.yes'); 138 138 Main.show('gocancel'); … … 254 254 else 255 255 { 256 if (!Dates.isDate(consentDate, 'yyyy-MM-dd')) 256 // Auto-fill the date if it's only given with 4(MMdd) or 6(yyMMdd) digits. 257 consentDate = autoFillDate(consentDate); 258 frm.consentDate.value = consentDate; 259 260 if (!Dates.isDate(consentDate, 'yyyyMMdd')) 257 261 { 258 262 setInputStatus('consentDate', 'Not a valid date', 'invalid'); … … 353 357 <td class="status" id="consentDate.status"></td> 354 358 <td class="help"> 355 <span id="consentDate.message" class="message" style="display: none;"></span>(YYYY -MM-DD)359 <span id="consentDate.message" class="message" style="display: none;"></span>(YYYYMMDD or MMDD) 356 360 </td> 357 361 </tr> -
extensions/net.sf.basedb.reggie/trunk/resources/persinfo.jsp
r1342 r1359 304 304 if (samplingDate != '' || samplingTime != '') 305 305 { 306 if (!Dates.isDate(samplingDate, 'yyyy-MM-dd')) 306 // Auto-fill the date if it's only given with 4(MMdd) or 6(yyMMdd) digits. 307 samplingDate = autoFillDate(samplingDate); 308 frm.samplingDate.value = samplingDate; 309 310 samplingTime = autoFillTime(samplingTime); 311 frm.samplingTime.value = samplingTime; 312 313 if (!Dates.isDate(samplingDate, 'yyyyMMdd')) 307 314 { 308 315 setInputStatus('samplingDate', 'Not a valid date', 'invalid'); … … 311 318 if (frm.rnaLaterDate.value == '') frm.rnaLaterDate.value = samplingDate; 312 319 313 if (!Dates.isDate(samplingDate + ' ' + samplingTime, 'yyyy -MM-dd HH:mm'))320 if (!Dates.isDate(samplingDate + ' ' + samplingTime, 'yyyyMMdd HHmm')) 314 321 { 315 322 if (samplingDate != '') setInputStatus('samplingDate', 'Not a valid time', 'invalid'); … … 333 340 if (rnaLaterDate != '' || rnaLaterTime != '') 334 341 { 335 if (!Dates.isDate(rnaLaterDate, 'yyyy-MM-dd')) 342 // Auto-fill the date if it's only given with 4(MMdd) or 6(yyMMdd) digits. 343 rnaLaterDate = autoFillDate(rnaLaterDate); 344 frm.rnaLaterDate.value = rnaLaterDate; 345 346 rnaLaterTime = autoFillTime(rnaLaterTime); 347 frm.rnaLaterTime.value = rnaLaterTime; 348 349 if (!Dates.isDate(rnaLaterDate, 'yyyyMMdd')) 336 350 { 337 351 setInputStatus('rnaLaterDate', 'Not a valid date', 'invalid'); 338 352 return; 339 353 } 340 rnaLaterTimestamp = Dates.parseString(rnaLaterDate + ' ' + rnaLaterTime, 'yyyy -MM-dd HH:mm');354 rnaLaterTimestamp = Dates.parseString(rnaLaterDate + ' ' + rnaLaterTime, 'yyyyMMdd HHmm'); 341 355 if (rnaLaterTimestamp == null) 342 356 { … … 351 365 if (samplingDateIsValid && rnaLaterTimestamp) 352 366 { 353 var samplingTimestamp = Dates.parseString(frm.samplingDate.value + ' ' + frm.samplingTime.value, 'yyyy -MM-dd HH:mm');367 var samplingTimestamp = Dates.parseString(frm.samplingDate.value + ' ' + frm.samplingTime.value, 'yyyyMMdd Hmm'); 354 368 if (samplingTimestamp && rnaLaterTimestamp.getDate() != samplingTimestamp.getDate()) 355 369 { … … 526 540 if (thisCaseSamplingDate != null) 527 541 { 528 frm.samplingDate.value = thisCaseSamplingDate.substring(0, 10);529 frm.samplingTime.value = thisCaseSamplingDate.substring( 11, 16);542 frm.samplingDate.value = thisCaseSamplingDate.substring(0, 8); 543 frm.samplingTime.value = thisCaseSamplingDate.substring(9, 13); 530 544 samplingDateTimeOnChange(); 531 545 } 532 546 if (thisCaseRNALaterDate != null) 533 547 { 534 frm.rnaLaterDate.value = thisCaseRNALaterDate.substring(0, 10);535 frm.rnaLaterTime.value = thisCaseRNALaterDate.substring( 11, 16);548 frm.rnaLaterDate.value = thisCaseRNALaterDate.substring(0, 8); 549 frm.rnaLaterTime.value = thisCaseRNALaterDate.substring(9, 13); 536 550 rnaLaterDateTimeOnChange(); 537 551 } … … 936 950 onkeypress="focusOnEnter(event, 'rnaLaterDate')" onblur="samplingDateTimeOnChange()"></td> 937 951 <td class="status" id="samplingDate.status"></td> 938 <td class="help"><span id="samplingDate.message" class="message" style="display: none;"></span>Date+time of surgical removal (YYYY -MM-DD, HH:MM)</td>952 <td class="help"><span id="samplingDate.message" class="message" style="display: none;"></span>Date+time of surgical removal (YYYYMMDD, HHMM)</td> 939 953 </tr> 940 954 <tr id="rnaLaterDateSection" valign="top"> … … 945 959 onblur="rnaLaterDateTimeOnChange()"></td> 946 960 <td class="status" id="rnaLaterDate.status"></td> 947 <td class="help"><span id="rnaLaterDate.message" class="message" style="display: none;"></span>Date+time of pathology handling (YYYY -MM-DD, HH:MM)</td>961 <td class="help"><span id="rnaLaterDate.message" class="message" style="display: none;"></span>Date+time of pathology handling (YYYYMMDD, HHMM)</td> 948 962 </tr> 949 963 <tr id="reasonIfNoSpecimenSection" valign="top"> -
extensions/net.sf.basedb.reggie/trunk/resources/reggie.js
r1342 r1359 133 133 location.href = location.href; 134 134 } 135 136 /** 137 Autofill a date-string. 138 The supplemented date-string will have the format yyyyMMdd when it's returned. 139 If the short-date in format MMdd is larger the current date, the year before will be used. 140 141 @param shortDate Date in format 'MMdd' or in 'yyMMdd' 142 */ 143 function autoFillDate(shortDate) 144 { 145 var fullDateString = shortDate; 146 147 var currentDate = new Date(); 148 var currentYear = currentDate.getFullYear(); 149 if (shortDate.length == 4 && Dates.isDate(shortDate, 'MMdd')) 150 { 151 var month = parseInt(shortDate.substring(0,2)); 152 var date = parseInt(shortDate.substring(2)); 153 if ((month > (currentDate.getMonth()+1)) || 154 ( (month == (currentDate.getMonth()+1)) && (date > currentDate.getDate())) ) 155 { 156 currentYear--; 157 } 158 fullDateString = currentYear+shortDate; 159 } 160 else if (shortDate.length == 6 && Dates.isDate(shortDate, 'yyMMdd')) 161 { 162 var year = parseInt(shortDate.substring(0,2)); 163 fullDateString = ((2000+year)>currentYear ? "19" : "20") + fullDateString; 164 } 165 return fullDateString; 166 } 167 168 function autoFillTime(shortTime) 169 { 170 171 var fullTimeString = shortTime; 172 if (shortTime.length==3) 173 { 174 fullTimeString = "0"+shortTime; 175 } 176 return fullTimeString; 177 } -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/ConsentFormServlet.java
r1354 r1359 79 79 // ... case annotations 80 80 theCase.loadAnnotations(dc, "consent", Reggie.ANNOTATION_CONSENT, null); 81 DateToStringConverter dateConverter = new DateToStringConverter(new SimpleDateFormat("yyyy -MM-dd"));81 DateToStringConverter dateConverter = new DateToStringConverter(new SimpleDateFormat("yyyyMMdd")); 82 82 theCase.loadAnnotations(dc, "consentDate", Reggie.ANNOTATION_CONSENT_DATE, dateConverter); 83 83 … … 151 151 Number caseId = (Number)jsonCase.get("id"); 152 152 String consent = Values.getStringOrNull((String)jsonCase.get("consent")); 153 StringToDateConverter dateConverter = new StringToDateConverter(new SimpleDateFormat("yyyy -MM-dd"));153 StringToDateConverter dateConverter = new StringToDateConverter(new SimpleDateFormat("yyyyMMdd")); 154 154 Date consentDate = dateConverter.convert((String)jsonCase.get("consentDate")); 155 155 AnnotationType consentType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_CONSENT, true); -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/PersonalRegistrationServlet.java
r1341 r1359 129 129 AnnotationType samplingDateType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_SAMPLING_DATETIME, true); 130 130 AnnotationType rnaLaterDateType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_RNALATER_DATETIME, true); 131 DateToStringConverter dateConverter = new DateToStringConverter(new SimpleDateFormat("yyyy -MM-dd HH:mm"));131 DateToStringConverter dateConverter = new DateToStringConverter(new SimpleDateFormat("yyyyMMdd HHmm")); 132 132 for (SpecimenTube tube : specimenTubes) 133 133 { … … 351 351 AnnotationType rnaLaterType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_RNALATER_DATETIME, true); 352 352 353 StringToDateConverter dateConverter = new StringToDateConverter(new SimpleDateFormat("yyyy -MM-dd HH:mm"));353 StringToDateConverter dateConverter = new StringToDateConverter(new SimpleDateFormat("yyyyMMdd HHmm")); 354 354 Date samplingDate = dateConverter.convert((String)jsonCase.get("samplingDate")); 355 355 Date rnaLaterDate = dateConverter.convert((String)jsonCase.get("rnaLaterDate")); … … 422 422 AnnotationType rnaLaterType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_RNALATER_DATETIME, true); 423 423 424 StringToDateConverter dateConverter = new StringToDateConverter(new SimpleDateFormat("yyyy -MM-dd HH:mm"));424 StringToDateConverter dateConverter = new StringToDateConverter(new SimpleDateFormat("yyyyMMdd HHmm")); 425 425 Date samplingDate = dateConverter.convert((String)jsonCase.get("samplingDate")); 426 426 Date rnaLaterDate = dateConverter.convert((String)jsonCase.get("rnaLaterDate"));
Note: See TracChangeset
for help on using the changeset viewer.