Changeset 2243
- Timestamp:
- Feb 21, 2014, 1:42:15 PM (9 years ago)
- Location:
- extensions/net.sf.basedb.reggie/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.reggie/trunk/resources/sampleproc/histology_score.jsp
r2134 r2243 35 35 36 36 <script language="JavaScript"> 37 var debug = 0;37 var debug = false; 38 38 var currentStep = 1; 39 39 var selectedSample; … … 80 80 81 81 // Save the first GoodStain sample so we can select it later 82 if (sample.GoodStain && firstGoodSample == null)82 if (sample.GoodStain) 83 83 { 84 firstGoodSample = sample;84 if (firstGoodSample == null) firstGoodSample = sample; 85 85 } 86 86 … … 287 287 className += ' good-stain'; 288 288 } 289 else 290 { 291 if (getGoodStainedSampleForLocation(sample.well.location) == null) 292 { 293 className += ' warning'; 294 } 295 } 289 296 290 297 if (sample.ScoreTotal == null) … … 313 320 var td = document.getElementById(sample.heGlassId+'-'+sample.well.location); 314 321 td.className = className; 322 } 323 324 function getGoodStainedSampleForLocation(location) 325 { 326 // Find sample on given location that has GoodStain annotation 327 for (var glassNo = 0; glassNo < heGlass.length; glassNo++) 328 { 329 var glass = heGlass[glassNo]; 330 for (var sampleNo = 0; sampleNo < glass.samples.length; sampleNo++) 331 { 332 var sample = glass.samples[sampleNo]; 333 if (sample.well.location == location && sample.GoodStain) 334 { 335 return sample; 336 } 337 } 338 } 339 return null; 315 340 } 316 341 … … 357 382 { 358 383 frm.good_stain.checked = true; 359 frm.good_stain.disabled = true;360 384 } 361 385 else 362 386 { 363 387 frm.good_stain.checked = false; 364 frm.good_stain.disabled = false;365 388 } 366 389 … … 478 501 var frm = document.forms['reggie']; 479 502 480 // Reset GoodStain on other samples on same location 503 var goodSample = getGoodStainedSampleForLocation(selectedSample.well.location); 504 if (goodSample != null && goodSample != selectedSample) 505 { 506 // Reset the current GoodStain sample 507 goodSample.GoodStain = null; 508 saveToLocalStorage(goodSample); 509 } 510 511 selectedSample.GoodStain = frm.good_stain.checked ? true : null; 512 saveToLocalStorage(selectedSample); 513 514 // Repaint samples on current location 481 515 for (var glassNo = 0; glassNo < heGlass.length; glassNo++) 482 516 { … … 488 522 if (sample.well.location == selectedSample.well.location) 489 523 { 490 sample.GoodStain = null;491 524 setSampleClassName(sample); 492 saveToLocalStorage(sample);493 525 } 494 526 } 495 527 } 496 497 selectedSample.GoodStain = frm.good_stain.checked ? true : null;498 frm.good_stain.disabled = true;499 setSampleClassName(selectedSample);500 saveToLocalStorage(selectedSample);501 528 } 502 529 … … 797 824 display: inline-block; 798 825 border: 1px solid #A0A0A0; 799 margin: 1em ;826 margin: 1em 1em 0.5em 1em; 800 827 width: 20em; 801 828 background: #E8E8E8; … … 904 931 { 905 932 background-image: url('../images/score-complete.png'); 933 } 934 935 .he-table td.warning 936 { 937 background-image: url('../images/warning.png'); 906 938 } 907 939 … … 1030 1062 <div id="he-glass-container" style="display: none;"> 1031 1063 1064 </div> 1065 <div style="margin-left: 1em; margin-bottom: 0.5em;"> 1066 <base:icon image="warning.png" /> = No GoodStain sample for that location 1032 1067 </div> 1033 1068 -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/HistologyServlet.java
r2242 r2243 4 4 import java.io.PrintWriter; 5 5 import java.util.Date; 6 import java.util.HashSet; 6 7 import java.util.List; 7 8 import java.util.Set; … … 31 32 import net.sf.basedb.core.Item; 32 33 import net.sf.basedb.core.ItemQuery; 34 import net.sf.basedb.core.ItemSubtype; 33 35 import net.sf.basedb.core.MeasuredBioMaterial; 34 36 import net.sf.basedb.core.PlateGeometry; … … 829 831 JSONArray jsonHeGlass = (JSONArray)jsonReq.get("heGlass"); 830 832 833 Set<Sample> histologyItems = new HashSet<Sample>(); 834 831 835 // Update scores on samples 832 836 for (int sampleNo = 0; sampleNo < jsonSamples.size(); ++sampleNo) … … 849 853 he.setDescription(Values.getStringOrNull((String)jsonSample.get("comments"))); 850 854 855 // Get parent Histology item for later checking of good stains 856 histologyItems.add((Sample)he.getParent()); 857 851 858 if (Boolean.TRUE.equals(scoreComplete)) 852 859 { … … 885 892 } 886 893 894 // Check flagged histology items 895 int numFlagged = 0; 896 int numUnflagged = 0; 897 BioMaterialList flaggedHistology = BiomaterialList.FLAGGED_HISTOLOGY.load(dc); 898 for (Sample histology : histologyItems) 899 { 900 String flag = (String)Annotationtype.FLAG.getAnnotationValue(dc, histology); 901 902 ItemQuery<Sample> heQuery = histology.getChildSamples(); 903 Subtype.STAINED.addFilter(dc, heQuery); 904 heQuery.include(Reggie.INCLUDE_IN_CURRENT_PROJECT); 905 boolean hasGoodStain = false; 906 for (Sample stained : heQuery.list(dc)) 907 { 908 if (Boolean.TRUE.equals(Annotationtype.GOOD_STAIN.getAnnotationValue(dc, stained))) 909 { 910 hasGoodStain = true; 911 break; 912 } 913 } 914 915 if (hasGoodStain) 916 { 917 if (flag != null) 918 { 919 // Remove the flag 920 numUnflagged++; 921 Annotationtype.FLAG.setAnnotationValue(dc, histology, null); 922 flaggedHistology.remove(histology); 923 } 924 } 925 else 926 { 927 if (flag == null) 928 { 929 // Flag the histology since it has no good stain and is not already flagged 930 numFlagged++; 931 Annotationtype.FLAG.setAnnotationValue(dc, histology, Histology.FLAG_NO_GOOD_STAIN); 932 flaggedHistology.add(histology); 933 } 934 } 935 936 } 937 938 if (numFlagged > 0) 939 { 940 jsonMessages.add(numFlagged + " items added to Flagged histology list."); 941 } 942 if (numUnflagged > 0) 943 { 944 jsonMessages.add(numUnflagged + " items removed from Flagged histology list."); 945 } 946 887 947 dc.commit(); 888 948 }
Note: See TracChangeset
for help on using the changeset viewer.