Changeset 1961
- Timestamp:
- May 6, 2013, 3:21:02 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.reggie/trunk/resources/libprep/lib_registration.jsp
r1934 r1961 127 127 Main.show('goregister'); 128 128 129 var libInfo = getStoredInfo(frm.bioplate.value); 130 if (libInfo) 131 { 132 if (debug) Main.debug(JSON.stringify(libInfo)); 133 var failed = document.getElementById('outcomeFailed').checked 134 135 if (libInfo.libDate) 136 { 137 frm.libDate.value = libInfo.libDate; 138 libDateOnChange(); 139 } 140 if (!failed) 141 { 142 if (libInfo.wellTable.id && libInfo.wellTable.path) 143 { 144 lastPrefix = 'welltable'; 145 setFileCallback(libInfo.wellTable.id, libInfo.wellTable.path); 146 } 147 if (libInfo.caliperGxd.id && libInfo.caliperGxd.path) 148 { 149 lastPrefix = 'calipergxd'; 150 setFileCallback(libInfo.caliperGxd.id, libInfo.caliperGxd.path); 151 } 152 if (libInfo.caliperPdf.id && libInfo.caliperPdf.path) 153 { 154 lastPrefix = 'caliperpdf'; 155 setFileCallback(libInfo.caliperPdf.id, libInfo.caliperPdf.path); 156 } 157 if (libInfo.qubitCsv.id && libInfo.qubitCsv.path) 158 { 159 lastPrefix = 'qubitcsv'; 160 setFileCallback(libInfo.qubitCsv.id, libInfo.qubitCsv.path); 161 } 162 } 163 if (libInfo.libOperator) frm.libOperator.value = libInfo.libOperator; 164 if (libInfo.libComments) 165 { 166 frm.libComments.value = libInfo.libComments; 167 libDateOnChange(); 168 } 169 } 170 129 171 Main.show('step.2.section'); 130 172 frm.libDate.focus(); … … 183 225 Main.addClass(frm.libComments, 'required'); 184 226 Main.hide('filesSection'); 227 } 228 else 229 { 230 Main.removeClass(frm.libComments, 'required'); 231 Main.show('filesSection'); 185 232 } 186 233 } … … 350 397 { 351 398 if (!step2IsValid()) return; 352 var frm = document.forms['reggie'];353 354 399 355 400 Main.hide('goregister'); 356 401 Main.hide('gocancel'); 357 402 403 var frm = document.forms['reggie']; 404 var libPlateId = parseInt(frm.bioplate.value, 10); 358 405 var submitInfo = {}; 359 submitInfo.bioplate = parseInt(frm.bioplate.value, 10);406 submitInfo.bioplate = libPlateId; 360 407 361 408 Main.addClass(document.getElementById('step.2.section'), 'disabled'); … … 366 413 if (!failed) 367 414 { 415 saveToLocalStorage(libPlateId); 368 416 submitInfo.wellTableCsv = parseInt(frm['welltable.id'].value, 10); 369 417 submitInfo.caliperGxd = parseInt(frm['calipergxd.id'].value, 10); … … 420 468 return false; 421 469 } 470 else 471 { 472 removeFromLocalStorage(libPlateId); 473 } 422 474 423 475 Main.show('gorestart'); 476 } 477 478 479 /** 480 Save as much information as possible about the library registration. 481 The information is stored in the localStorage() 482 under the key 'reggie.libplate.<id>.info' where 483 <id> is the ID of the library plate. 484 */ 485 function saveToLocalStorage(libPlateId) 486 { 487 if (window.localStorage) 488 { 489 var frm = document.forms['reggie']; 490 var libInfo = new Object(); 491 libInfo.id = libPlateId; 492 libInfo.libDate = frm.libDate.value; 493 libInfo.wellTable = { id: frm['welltable.id'].value, path: frm['welltable.path'].value }; 494 libInfo.caliperGxd = { id: frm['calipergxd.id'].value, path: frm['calipergxd.path'].value }; 495 libInfo.caliperPdf = { id: frm['caliperpdf.id'].value, path: frm['caliperpdf.path'].value }; 496 libInfo.qubitCsv = { id: frm['qubitcsv.id'].value, path: frm['qubitcsv.path'].value }; 497 libInfo.libProtocol = frm.libProtocol.value; 498 libInfo.libOperator = frm.libOperator.value; 499 libInfo.libComments = frm.libComments.value; 500 501 window.localStorage.setItem('reggie.libplate.' + libPlateId + '.info', JSON.stringify(libInfo)); 502 if (debug) 503 { 504 Main.debug(libPlateId + ': ' + window.localStorage.getItem('reggie.libplate.' + libPlateId + '.info')); 505 } 506 } 507 } 508 509 function removeFromLocalStorage(libPlateId) 510 { 511 if (!window.localStorage) return; 512 if (debug) Main.debug('removeFromLocalStorage:' + libPlateId); 513 window.localStorage.removeItem('reggie.libplate.' + libPlateId + '.info'); 514 } 515 516 function getStoredInfo(libPlateId) 517 { 518 if (!window.localStorage) return null; 519 try 520 { 521 var stored = window.localStorage.getItem('reggie.libplate.' + libPlateId + '.info'); 522 if (debug) Main.debug(stored); 523 return stored ? JSON.parse(stored) : null; 524 } 525 catch (e) 526 { 527 Main.debug('Could not load stored information for tube ' + tubeId + ': ' + e); 528 } 424 529 } 425 530 … … 554 659 name="calipergxd.path" value="" 555 660 size="50" onkeypress="doOnEnter(event, function(){document.getElementById('btnCaliperGxd').click()})" 556 onblur="caliperGxdFileOnChange()"557 661 ></td> 558 662 <td style="padding-left: 4px;"><base:button … … 579 683 name="caliperpdf.path" value="" 580 684 size="50" onkeypress="doOnEnter(event, function(){document.getElementById('btnCaliperPdf').click()})" 581 onblur="caliperPdfFileOnChange()"582 685 ></td> 583 686 <td style="padding-left: 4px;"><base:button
Note: See TracChangeset
for help on using the changeset viewer.