Changeset 314 for trunk


Ignore:
Timestamp:
Mar 25, 2010, 3:16:57 PM (13 years ago)
Author:
jahn
Message:

Empty shell for Query workflow.

Location:
trunk/grails-app
Files:
8 added
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/query/QueryController.groovy

    r247 r314  
    2929    def searchableService
    3030
    31     def selectsample = {
     31    def index = {
     32        redirect( action:'pages')
     33    }
     34
     35    def pagesFlow = {
     36       
     37        onStart {
     38                println "starting"
     39        }
    3240
    3341
    34             // produce error message here if studies don't contain samples!
    35             // redirect back or use error
     42        mainPage {
     43
     44             render( view:'/query/mainPage')
    3645
    3746
    38             println "in selectsample: "
    39             params.each{println it}
    40 
    41             // prepare showing all studies selected in the previous view
    42             def selectedStudies = []
    43             def selectedStudyIds = params['selectedStudyIds']
    44 
    45             if(selectedStudyIds!=null)
    46             {
    47                  def list = selectedStudyIds.findAll(/(\d)+/)
    48                  selectedStudies = list.collect{ dbnp.studycapturing.Study.get(it) }
    49             }
    50             else
    51             {
    52                  def tmpList = []
    53                  def studyList = dbnp.studycapturing.Study.list()
    54                  selectedStudyIds = []
    55                  params.each{ key,values->
    56                      if (values=="on")  tmpList.add(key)
    57                  }
    58 
    59                  for (i in studyList)
    60                      if (tmpList.contains(i.getId().toString()))
    61                      {
    62                          selectedStudyIds.add(i.id)
    63                          selectedStudies.add(i)
    64                      }
    65            }
     47             onRender {
     48                println "done randering index"
     49             }
    6650
    6751
    68         // subgroups
    69         // provide list of subgroups depending on the type of subgrouping
    70         // selected by the user
    71         def subgroups = []
    72         def submitButton = params["submit"]  // this button's value determines the kind of subgrouping
     52             on("next") {
     53                println "clicked next in sample"
     54             } .to 'study'
    7355
    74         switch(submitButton)
    75         {
    76              case "Subject Groups":
    77                   render(params)
    78                   render("Subject Groups")
    79                   def studyGroups = []
    80                   if(selectedStudies!=null)
    81                   {
    82                      selectedStudies.each{ study ->
    83                          study.groups.each{ group -> studyGroups.add[group] }
    84                      }
    85                      println "study groups: "
    86                      studyGroups.each{x-> println x}
    87                   }
     56        }       
    8857
    89                   // testing:
    90                   // there is a lack of data in the mockup (subject groups are still missing)
    91                   // as long as there are no groups in the boot script,
    92                   // we use this
    93                   subgroups = studyGroups.size()<=0 ?
    94                        ["subject group 1","subject group 2"] : studyGroups
    9558
    96                   render(view:"selectsample",model:[selectedStudies:selectedStudies,selectedStudyIds:selectedStudyIds,subgroups:subgroups])
    97                   break
     59        study {
     60             render( view:'_study')
    9861
    99              case "Event Groups":
    100                   def eventGroups = []
    101                   if(selectedStudies!=null)
    102                   {
    103                     selectedStudies.each{ study ->
    104                          println study.id
    105                          println study.samplingEvents.each{ eventGroups.add(it) }
    106                     }
    107                   }
    108                   subgroups=eventGroups
    109                   render(view:"selectsample",model:[selectedStudies:selectedStudies,selectedStudyIds:selectedStudyIds,subgroups:subgroups])
    110                   break
     62             on("next") {
     63                println "clicked next in sample"
     64             } .to 'sample'
    11165
    112              case "Starting Time Groups":
    113 
    114                   def timeGroups = []
    115                   if(selectedStudies!=null)
    116                   {
    117                     selectedStudies.each{ study ->
    118                          println study.samplingEvents.each{
    119                              def timeDiff = it.getPrettyDuration( study.startDate, it.startTime )
    120                              if( !timeGroups.contains(timeDiff) ) timeGroups.add(timeDiff)
    121                          }
    122                     }
    123                   }
    124                   subgroups=timeGroups
    125                   render("Starting Time Groups")
    126                   render(view:"selectsample",model:[selectedStudies:selectedStudies,selectedStudyIds:selectedStudyIds,subgroups:subgroups])
    127                   break
    128 
    129              case ">> Execute and continue with biomarker selection":
    130                   render("Starting Time Groups")
    131                   break
    132              case "<< Back to study selection":
    133                   break
    13466        }
    135         render(view:"selectsample",model:[selectedStudies:selectedStudies,selectedStudyIds:selectedStudyIds,subgroups:subgroups])
    136     }
    13767
    13868
    13969
    140     /**
    141      * Index page with search form and results
    142      */
    143     def results = {
    144         if (!params.q?.trim()) {
    145             return [:]
    146         }
    147         try {
    148             return [searchResult: searchableService.search(params.q, params)]
    149         } catch (SearchEngineQueryParseException ex) {
    150             return [parseException: true]
    151         }
     70        sample {
     71             render( view:'_sample')
     72
     73             on("next") {
     74                println "clicked next in sample"
     75             } .to 'biomarker'
     76
     77        }
     78
     79
     80
     81        biomarker {
     82             render( view:'_biomarker')
     83
     84             on("next") {
     85                println "clicked next in sample"
     86             } .to 'group'
     87
     88        }
     89
     90
     91        group {
     92             render( view:'_group')
     93
     94             on("next") {
     95                println "clicked next in sample"
     96             } .to 'result'
     97
     98        }
     99
     100
     101
     102        result {
     103             render( view:'_result')
     104
     105        }
     106
     107
     108
     109
     110
     111
     112
     113
     114
     115
     116
     117
     118
    152119    }
    153120
    154 
    155     /**
    156      * Index page with search form and results
    157      */
    158     def index = {
    159     }
    160 
    161 
    162     /**
    163      * Perform a bulk index of every searchable object in the database
    164      */
    165     def indexAll = {
    166         Thread.start {
    167             searchableService.index()
    168         }
    169         render("bulk index started in a background thread")
    170     }
    171 
    172     /**
    173      * Perform a bulk index of every searchable object in the database
    174      */
    175     def unindexAll = {
    176         searchableService.unindex()
    177         render("unindexAll done")
    178     }
    179 
    180 
    181     def subjectGroups = { render ("hello") }
    182 
    183 
    184121}
  • trunk/grails-app/views/query/mainPage.gsp

    r303 r314  
    1111    <body>
    1212
    13     <div id="tabs">
    14       <ul>
    15         <li><a href="#tab-simple">Simple query</a></li>
    16       </ul>
    17       <div id="tab-simple">
    18         <g:form url="[action:'results',controller:'query',params: 'q']">
    19           <input type="hidden" name="targetUri" value="${targetUri}" />
    20           <label class="grey" for="q">Search for:</label>
    21           <input class="field" type="text" name="q" id="q" size="40" />
    22           <input type="submit" name="submit" value="Query"/>
    23         </g:form>
    24         <p>
    25         <n:isNotLoggedIn>
    26         <small>To query private studies, please login above.</small>
    27         </n:isNotLoggedIn>
    28         </p>
    29       </div>
     13aaaaaaa
    3014
    31     </div>
     15
     16
     17<div id="wizard" class="wizard">
     18        <h1>Create a new study</h1>
     19        <g:form action="pages" name="wizardForm" id="wizardForm">
     20        <g:hiddenField name="do" value="" />
     21                <div id="wizardPage">
     22                        <wizard:ajaxFlowRedirect form="form#wizardForm" name="next" url="[controller:'query',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" />
     23                </div>
     24        </g:form>
     25</div>
     26
     27
     28
     29
    3230  </body>
    3331</html>
Note: See TracChangeset for help on using the changeset viewer.