Changeset 196


Ignore:
Timestamp:
Feb 12, 2010, 7:56:06 PM (13 years ago)
Author:
jahn
Message:

Sample selection of the query controller: added buttons for subgroup selection, controller changes for passing on subselections, and some JS for selecting the checkboxes. The actual function of the checkboxes has to be clearified. When I check only subject, should the parent subject also be ticked? Or should it be the other way round? Plenty needs to be done in this step of the query still.

Location:
trunk/grails-app
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/SearchableController.groovy

    r193 r196  
    2121 * Basic web interface for Grails Searchable Plugin
    2222 *
    23  * @author Maurice Nicholson
     23 * @author Adem and Jahn
    2424 */
    2525class SearchableController {
     
    2828    def selectsample = {
    2929
     30            println "in selectsample: "
     31            params.each{println it}
     32
     33            // prepare showing all studies selected in the previous view
     34            def selectedStudies = []
     35            def selectedStudyIds = params['selectedStudyIds']
     36
     37            if(selectedStudyIds!=null)
     38            {
     39                 def list = selectedStudyIds.findAll(/(\d)+/)
     40                 selectedStudies = list.collect{ dbnp.studycapturing.Study.get(it) }
     41            }
     42            else
     43            {
     44                 def tmpList = []
     45                 def studyList = dbnp.studycapturing.Study.list()
     46                 selectedStudyIds = []
     47                 params.each{ key,values->
     48                     if (values=="on")  tmpList.add(key)
     49                 }
     50
     51                 for (i in studyList)
     52                     if (tmpList.contains(i.getId().toString()))
     53                     {
     54                         selectedStudyIds.add(i.id)
     55                         selectedStudies.add(i)
     56                     }
     57           }
     58
     59
     60
     61        // subgroups
     62        // provide list of subgroups depending on the type of subgrouping
     63        // selected by the user
     64        def subgroups = []
     65        def submitButton = params["submit"]  // this button's value determines the kind of subgrouping
     66
     67        switch(submitButton)
     68        {
     69             case "Subject Groups":
     70                  render(params)
     71                  render("Subject Groups")
     72                  subgroups=["subject group 1","subject group 2"]
     73                  render(view:"selectsample",model:[selectedStudies:selectedStudies,selectedStudyIds:selectedStudyIds,subgroups:subgroups])
     74                  break
     75             case "Event Groups":
     76                  render("Event Groups")
     77                  subgroups=["event group 1","event group 2"]
     78                  render(view:"selectsample",model:[selectedStudies:selectedStudies,selectedStudyIds:selectedStudyIds,subgroups:subgroups])
     79                  break
     80             case "Starting Time Groups":
     81                  render("Starting Time Groups")
     82                  subgroups=["time group 1","time group 2"]
     83                  render(view:"selectsample",model:[selectedStudies:selectedStudies,selectedStudyIds:selectedStudyIds,subgroups:subgroups])
     84                  break
     85             case ">> Execute and continue with biomarker selection":
     86                  render("Starting Time Groups")
     87                  break
     88             case "<< Back to study selection":
     89                  break
     90        }
     91        render(view:"selectsample",model:[selectedStudies:selectedStudies,selectedStudyIds:selectedStudyIds,subgroups:subgroups])
    3092    }
     93
     94
     95
    3196    /**
    3297     * Index page with search form and results
     
    60125        render("unindexAll done")
    61126    }
     127
     128
     129    def subjectGroups = { render ("hello") }
     130
     131
    62132}
  • trunk/grails-app/views/searchable/index.gsp

    r194 r196  
    8787            <tr>
    8888              <td>
    89               <input type="checkbox" name="${result.title}" id="${result.title}">
     89              <input type="checkbox" name="${result.id}" id="${result.title}">
    9090              </td>
    9191              <td>
  • trunk/grails-app/views/searchable/selectsample.gsp

    r194 r196  
    44      <title>Generic Study Capture Framework - Query studies</title>
    55      <meta name="layout" content="main" />
     6      <g:setProvider library="jquery"/>
     7      <script src = ${createLinkTo(dir: 'js/jquery_combobox', file: 'ui.core.js')}></script>
     8      <script src = ${createLinkTo(dir: 'js/jquery_combobox', file: 'ui.combobox')}></script
    69    </head>
    710
     
    1114  <br>
    1215
    13    <% def tmpList = [] %>
    14     <% studyList = dbnp.studycapturing.Study.list() %>
    15 <% def selectedStudies = [] %>
    1616
    17 <% params.each{key,values-> %>
    18     <% if (values=="on"){ %>
    19       <% tmpList.add(key) %>
    20     <%  } }%>
     17  <g:form action="selectsample" url >
    2118
    22   <% for (i in studyList) {%>
    23     <% if (tmpList.contains(i.getTitle())) { %>
    24       <% selectedStudies.add(i) %>
    25      <% }} %>
    26    
     19
     20   <br> <%= params %>
     21   <br> <%= selectedStudyIds.each{ println it } %>
     22   <br> <%= subgroups%>
     23   <input type="hidden" name="selectedStudyIds" value="${selectedStudyIds}"   </div>
     24
     25
    2726  <% if (selectedStudies.size()>0) {%>
    2827       <table >
    29 
    3028         <tr>
    3129           <td></td>
     
    3634           <td><b> Sample Material </b></td>
    3735           <td><b> Duration </b></td>
     36           <g:if test="${subgroups.size>0}"> <td><b> Subgroups </b></td> </g:if>
    3837         </tr>
    39      <g:each in="${selectedStudies}" status="j" var="studyIns">
     38
     39  <g:each in="${selectedStudies}" status="j" var="studyIns">
    4040  <tr>
    41   <td> <input type="checkbox" name="${studyIns.title}" id="${studyIns.title}"> </td>
     41  <td> <input type="checkbox" name="${studyIns.title}" id="${studyIns.title}" class="checkbox1${studyIns.id}"> </td>
    4242          <td> ${studyIns.title} </td>
    43          
    44         </tr>
     43  </tr>
     44
     45
     46
    4547  <g:each in ="${studyIns.events}" var="events">
    4648        <tr>
    4749          <td></td><td></td>
    48           <td> <input type="checkbox" name="${events.subject.name}" id="${events.subject.name}">
    49   ${events.subject.name} </td>
     50          <td> <input type="checkbox" name="${studyIns.id}.${events.subject.name}" id="${events.subject.name}" class="checkbox2${studyIns.id}" >
     51               ${events.subject.name} </td>
    5052          <td> ${studyIns.samplingEvents} </td>
    5153          <td> ${studyIns.samplingEvents.samples.name}</td>
    5254          <td> ${studyIns.samplingEvents.samples.material}</td>
    5355          <td> ${events.getDurationString()}</td>
     56
     57          <g:if test="${subgroups.size>0}">
     58          <td> <select id="demo">
     59              <g:each in ="${subgroups}" var="p">
     60                  <option value = "${p}"> "${p}" </option>
     61              </g:each>
     62          </select> </td>
     63          </g:if>
    5464        </tr>
    5565     </g:each>
    56      </g:each>
     66
     67
     68    </g:each>
    5769       
    58        </table>
    59 <%}%>
     70     </table>
    6071
    61        <% if (selectedStudies.size()==0) {%>
    62     Please select studies to query samples.
     72
     73
     74    <g:each in="${selectedStudies}" status="j" var="studyIns">
     75        <% def cb1 = '\'.checkbox1' + studyIns.id + '\''  %>
     76        <% def cb2 = '\'.checkbox2' + studyIns.id + '\''  %>
     77        <script>
     78              $(${cb1}).click(function () {
     79                  if($(this).attr("checked")==true)
     80                     $(${cb2}).attr("checked", "checked");
     81                  });
     82              $(${cb2}).click(function () {
     83                  if($(this).attr("checked")==false)
     84                         $(${cb1}).attr("checked", false);
     85                  });
     86        </script>
     87    </g:each>
     88
     89
     90
     91  <%}%>
     92
     93
     94     Infer subgroups:
     95    <INPUT TYPE=submit name=submit Value="Subject Groups">
     96    <INPUT TYPE=submit name=submit Value="Event Groups">
     97    <INPUT TYPE=submit name=submit Value="Starting Time Groups">
     98
     99    <% if (selectedStudies.size()==0) { %>
     100    <br> Please select studies to query samples.
    63101    <% } %>
    64102
     
    67105    <INPUT TYPE=submit name=submit Value=">> Execute and continue with biomarker selection">
    68106
     107    </g:form>
     108
     109
     110
    69111  </body>
    70112</html>
Note: See TracChangeset for help on using the changeset viewer.