Changeset 201
- Timestamp:
- Feb 16, 2010, 3:13:09 PM (13 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/SearchableController.groovy
r198 r201 27 27 28 28 def selectsample = { 29 30 31 // produce error message here if studies don't contain samples! 32 // redirect back or use error 33 29 34 30 35 println "in selectsample: " … … 80 85 81 86 // testing: 82 // there is a lack of data in the mockup 83 // as long as there are no groups in the boot start,87 // there is a lack of data in the mockup (subject groups are still missing) 88 // as long as there are no groups in the boot script, 84 89 // we use this 85 90 subgroups = studyGroups.size()<=0 ? 86 ["subject group 1","subject group 2"] : studyGroups91 ["subject group 1","subject group 2"] : studyGroups 87 92 88 93 render(view:"selectsample",model:[selectedStudies:selectedStudies,selectedStudyIds:selectedStudyIds,subgroups:subgroups]) 89 94 break 95 90 96 case "Event Groups": 91 render("Event Groups") 92 subgroups=["event group 1","event group 2"] 97 def eventGroups = [] 98 if(selectedStudies!=null) 99 { 100 selectedStudies.each{ study -> 101 println study.id 102 println study.samplingEvents.each{ eventGroups.add(it) } 103 } 104 } 105 subgroups=eventGroups 93 106 render(view:"selectsample",model:[selectedStudies:selectedStudies,selectedStudyIds:selectedStudyIds,subgroups:subgroups]) 94 107 break 108 95 109 case "Starting Time Groups": 110 111 def timeGroups = [] 112 if(selectedStudies!=null) 113 { 114 selectedStudies.each{ study -> 115 println study.samplingEvents.each{ 116 def timeDiff = it.getPrettyDuration( study.startDate, it.startTime ) 117 if( !timeGroups.contains(timeDiff) ) timeGroups.add(timeDiff) 118 } 119 } 120 } 121 subgroups=timeGroups 96 122 render("Starting Time Groups") 97 subgroups=["time group 1","time group 2"]98 123 render(view:"selectsample",model:[selectedStudies:selectedStudies,selectedStudyIds:selectedStudyIds,subgroups:subgroups]) 99 124 break 125 100 126 case ">> Execute and continue with biomarker selection": 101 127 render("Starting Time Groups") -
trunk/grails-app/domain/dbnp/studycapturing/Event.groovy
r197 r201 83 83 } 84 84 85 86 def String toString() { 87 return eventDescription ? eventDescription.name : "" 88 } 89 85 90 } -
trunk/grails-app/views/searchable/selectsample.gsp
r199 r201 20 20 <br> <%= params %> 21 21 <br> <%= selectedStudyIds.each{ println it } %> 22 <br> <b> Subgroups </b>: 22 23 <br> <%= subgroups%> 23 24 <input type="hidden" name="selectedStudyIds" value="${selectedStudyIds}" </div> 24 25 26 <% showSubgroups = (subgroups.size()>0) %> 27 <g:if test="${selectedStudies.size()>0}"> 25 28 26 <% if (selectedStudies.size()>0) {%>27 29 <table > 28 30 <tr> … … 34 36 <td><b> Sample Material </b></td> 35 37 <td><b> Start Time </b></td> 36 <g:if test="${subgroups.size>0}"> <td><b> Subgroups </b></td> </g:if> 38 <g:if test="${showSubgroups}"> <td><b> Subgroups </b></td> </g:if> 39 <g:else> <td><b> Selection </b></td> </g:else> 37 40 </tr> 38 41 39 <g:each in="${selectedStudies}" status="j" var="studyIns"> 40 <tr> 41 <td> <input type="checkbox" name="${studyIns.title}" id="${studyIns.title}" class="checkbox1${studyIns.id}"> </td> 42 <td> ${studyIns.title} </td> 43 </tr> 42 43 <g:each in="${selectedStudies}" status="j" var="studyIns"> 44 <tr> 45 <td> <input type="checkbox" name="${studyIns.title}" id="${studyIns.title}" class="checkbox1_${studyIns.id}"> </td> 46 <td> ${studyIns.title} </td> 47 </tr> 44 48 45 49 46 50 47 <g:if test="${studyIns.samplingEvents.size ()>0}" > 48 <g:each in ="${studyIns.samplingEvents}" var="event"> 49 <g:each in ="${event.samples}" var="sample"> 50 <tr> 51 <td></td><td></td> 52 <td> <input type="checkbox" name="${studyIns.id}.${event.subject.name}" id="${event.subject.name}" class="checkbox2${studyIns.id}" > 53 ${event.subject.name} </td> 54 <td> ${studyIns.samplingEvents} </td> 55 <td> ${sample.name}</td> 56 <td> ${sample.material}</td> 57 <td> ${event.getPrettyDuration( studyIns.startDate, event.startTime)} </td> 51 <g:if test="${studyIns.samplingEvents.size ()>0}" > 52 <g:each in ="${studyIns.samplingEvents}" var="event"> 53 <% def firstRow = true %> 54 <g:each in ="${event.samples}" var="sample"> 55 <tr> 56 <td></td><td></td> 58 57 59 <g:if test="${subgroups.size>0}"> 60 <td> <select id="demo"> 61 <g:each in ="${subgroups}" var="p"> 62 <option value = "${p}"> "${p}" </option> 63 </g:each> 64 </select> </td> 65 </g:if> 66 </tr> 67 </g:each> 68 </g:each> 69 </g:if> 58 <td> 59 <g:if test="${firstRow}"> 60 <% firstRow=false %> 61 <input type="checkbox" name="${studyIns.id}.${event.subject.name}" id="${event.subject.name}" class="checkbox2_${studyIns.id}_${event.subject.id}" > 62 ${event.subject.name} 63 </g:if> 64 </td> 65 66 <td> ${event.eventDescription.name} </td> 67 <td> ${sample.name}</td> 68 <td> ${sample.material}</td> 69 70 <td> ${event.getPrettyDuration( studyIns.startDate, event.startTime)} </td> 71 72 <td> 73 <g:if test="${showSubgroups}"> 74 <select id="demo"> 75 <g:each in ="${subgroups}" var="p"> 76 <option value = "${p}"> "${p}" </option> 77 </g:each> 78 </select> 79 </g:if> 80 <g:else> 81 <input type="checkbox" name="${studyIns.id}.${event.subject.id}.${sample.id}" id="${event.subject.name}" class="checkbox3_${studyIns.id}_${event.subject.id}_${sample.id}" > 82 </g:else> 83 </td> 84 85 </tr> 86 </g:each> 87 </g:each> 88 </g:if> 70 89 71 90 72 <g:else>73 <tr>74 <td></td> <td>Study does not cotain any samples. </td>75 <td></td> <td></td> <td></td> <td></td> <td></td>76 <g:if test="${subgroups.size>0}"> <td></td> </g:if>77 </tr>78 </g:else>79 </g:each>91 <g:else> 92 <tr> 93 <td></td> <td>Study does not cotain any samples. </td> 94 <td></td> <td></td> <td></td> <td></td> <td></td> 95 <g:if test="${showSubgroups}"> <td></td> </g:if> 96 </tr> 97 </g:else> 98 </g:each> 80 99 81 </table>100 </table> 82 101 83 102 84 103 85 <g:each in="${selectedStudies}" status="j" var="studyIns"> 86 <% def cb1 = '\'.checkbox1' + studyIns.id + '\'' %> 87 <% def cb2 = '\'.checkbox2' + studyIns.id + '\'' %> 88 <script> 89 $(${cb1}).click(function () { 90 if($(this).attr("checked")==true) 91 $(${cb2}).attr("checked", "checked"); 92 }); 93 $(${cb2}).click(function () { 94 if($(this).attr("checked")==false) 95 $(${cb1}).attr("checked", false); 96 }); 97 </script> 98 </g:each> 104 <g:each in="${selectedStudies}" status="j" var="studyIns"> 105 <g:each in ="${studyIns.samplingEvents}" var="event"> 106 <g:each in ="${event.samples}" var="sample"> 107 <% def cb1 = '\'.checkbox1_' + studyIns.id + '\'' %> 108 <% def cb2 = '\'.checkbox2_' + studyIns.id + '_' + event.subject.id + '\'' %> 109 <% def cb3 = '\'.checkbox3_' + studyIns.id + '_' + event.subject.id + '_' + sample.id + '\'' %> 110 <script> 111 $(${cb1}).click(function () { 112 if($(this).attr("checked")==true) { 113 $(${cb2}).attr("checked", "checked"); 114 $(${cb3}).attr("checked", "checked"); 115 } }); 116 $(${cb2}).click(function () { 117 if($(this).attr("checked")==true) 118 $(${cb3}).attr("checked", true); 119 else 120 $(${cb1}).attr("checked", false); 121 }); 122 $(${cb3}).click(function () { 123 if($(this).attr("checked")==false) { 124 $(${cb1}).attr("checked", false); 125 $(${cb2}).attr("checked", false); 126 } }); 127 </script> 128 </g:each> 129 </g:each> 130 </g:each> 99 131 100 <%}%>101 132 133 </g:if> 134 135 136 <br> 137 138 <script> 139 function checkAll(value){ 140 var list = document.getElementsByTagName("input"); 141 for(i=0; i<list.length; i++) 142 { 143 if(list[i].type=="checkbox") 144 { 145 list[i].checked=value; 146 } 147 } 148 } 149 </script> 150 151 152 Select samples: 153 <input type="button" name="CheckAll" value="All" onClick="checkAll(true)"> 154 <input type="button" name="UncheckAll" value="None" onClick="checkAll(false)"> 102 155 103 156 Infer subgroups: … … 105 158 <INPUT TYPE=submit name=submit Value="Event Groups"> 106 159 <INPUT TYPE=submit name=submit Value="Starting Time Groups"> 160 <br> 161 162 163 107 164 108 165 <% if (selectedStudies.size()==0) { %>
Note: See TracChangeset
for help on using the changeset viewer.