- Timestamp:
- 05/10/14 13:45:03 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/www/viewer/index.js
r17816 r17819 204 204 } 205 205 206 function setFileChecks() 207 { 208 var list = document.getElementById("file").data; 209 if (!list) 210 return; 211 212 var file = document.getElementById("file").value; 213 var drs = document.getElementById("drsfile"); 214 215 var hasDrs = list[file]&2; 216 var hasCal = list[file]&4; 217 var isMC = list[file]&8; 218 219 if (!hasDrs || isMC) 220 $('#drsfile').prop('checked', false); 221 if (!hasCal || isMC) 222 $('#calibrated').prop('checked', false); 223 224 $('#calibrated').prop('disabled', !hasCal && !drs.checked && !isMC); 225 $('#drsfile').prop('disabled', !hasDrs && !isMC); 226 $('#montecarlo').prop('checked', isMC); 227 } 228 206 229 function disableControls(disabled) 207 230 { … … 219 242 220 243 if (disabled) 244 { 221 245 $('#calibrated').prop('disabled', true); 246 $('#drsfile').prop('disabled', true); 247 } 222 248 else 223 { 224 var list = document.getElementById("file").data; 225 if (list) 226 { 227 var file = document.getElementById("file").value; 228 $('#calibrated').prop('disabled', !list[file]); 229 } 230 } 249 setFileChecks(); 231 250 } 232 251 … … 333 352 function onFileSelect(event, ui) 334 353 { 335 var list = document.getElementById("file").data; 336 var file = ui.item.value; 337 338 $('#calibrated').prop('disabled', !list[file]); 339 if (!list[file]) 340 $('#calibrated').prop('checked', false); 341 342 document.getElementById("event").value = 0; 354 setFileChecks(); 343 355 onSubmit(ui.item.value); 344 356 } … … 360 372 { 361 373 alert("ERROR[0] - Decoding answer:\n"+e); 374 debug(result); 362 375 return; 363 376 } … … 505 518 } 506 519 507 function onDataReceived(r c)520 function onDataReceived(result) 508 521 { 509 522 var err = document.getElementById("error"); … … 515 528 //dbg.appendChild(pre); 516 529 530 var rc; 517 531 try 518 532 { 519 rc = JSON.parse(r c);533 rc = JSON.parse(result); 520 534 if (!rc) 521 535 return; … … 524 538 { 525 539 alert("ERROR[1] - Decoding answer:\n"+e); 540 debug(result); 526 541 return; 527 542 } … … 530 545 var file = rc.file; 531 546 532 document.getElementById("event").max = file.numEvents ;547 document.getElementById("event").max = file.numEvents-1; 533 548 var el = document.getElementById("numevents"); 534 549 if (el.firstChild) … … 734 749 735 750 var calibrated = document.getElementById("calibrated"); 736 var calib = !calibrated.disabled && calibrated.checked; 737 var event = document.getElementById("event").value; 738 var pixel = document.getElementById("pixel").value; 739 var source1 = editor1.getValue(); 740 var source2 = editor2.getValue(); 751 var drsfile = document.getElementById("drsfile"); 752 var montecarlo = document.getElementById("montecarlo"); 753 var ismc = montecarlo.checked; 754 var calib = !calibrated.disabled && calibrated.checked; 755 var drs = !drsfile.disabled && drsfile.checked; 756 var event = document.getElementById("event").value; 757 var pixel = document.getElementById("pixel").value; 758 var source1 = editor1.getValue(); 759 var source2 = editor2.getValue(); 741 760 742 761 var uri = "file="+file+"&event="+event+"&pixel="+map[pixel]; … … 746 765 if (calib) 747 766 uri += "&calibrated=1"; 767 if (drs) 768 uri += "&drsfile=1"; 769 if (ismc) 770 uri += "&montecarlo=1"; 748 771 749 772 $.ajax({
Note:
See TracChangeset
for help on using the changeset viewer.