Changeset 557


Ignore:
Timestamp:
Jun 11, 2010, 3:50:48 PM (13 years ago)
Author:
duh
Message:
  • fixed issues with templates not refreshing properly in the wizard after editting them in the templateEditor
  • tried to centralize some functionality
  • dev version of samples
Location:
trunk/grails-app
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/studycapturing/WizardController.groovy

    r544 r557  
    218218                        }
    219219                        on("refresh") {
     220                                println ".refreshing...."
    220221                                flash.values = params
    221222
    222223                                // handle study data
    223224                                this.handleStudy(flow, flash, params)
     225
     226                                // force refresh of the template
     227                                if (flow.study.template) {
     228                                        flow.study.template.refresh()
     229                                }
    224230
    225231                                // remove errors as we don't want any warnings now
     
    233239                                // handle study data
    234240                                this.handleStudy(flow, flash, params)
     241
     242                                // force refresh of the template
     243                                if (flow.study.template) {
     244                                        flow.study.template.refresh()
     245                                }
    235246
    236247                                // remove errors as we don't want any warnings now
     
    285296                        on("refresh") {
    286297                                flash.values = params
     298
     299                                // refresh templates
     300                                flow.subjectTemplates.each() {
     301                                        it.value.template.refresh()
     302                                }
     303
    287304                                success()
    288305                        }.to "subjects"
     
    409426                                // handle study data
    410427                                this.handleEvents(flow, flash, params)
     428
     429                                // refresh event templates
     430                                flow.eventTemplates.each() {
     431                                        it.value.template.refresh()
     432                                }
     433
     434                                // refresh flow template
     435                                if (flow.event.template) flow.event.template.refresh()
     436
     437                                // remove errors as we don't want any warnings now
     438                                flash.errors = [:]
     439                        }.to "events"
     440                        on("refresh") {
     441                                flash.values = params
     442
     443                                // handle study data
     444                                this.handleEvents(flow, flash, params)
     445
     446                                // refresh templates
     447                                flow.eventTemplates.each() {
     448                                        it.value.template.refresh()
     449                                }
     450
     451                                // refresh flow template
     452                                if (flow.event.template) flow.event.template.refresh()
    411453
    412454                                // remove errors as we don't want any warnings now
     
    581623                        onRender {
    582624                                flow.page = 6
    583                                 flow.bla = "samples"
     625
     626                                flow.samples = []
    584627
    585628                                // iterate through eventGroups
     
    595638
    596639                                                                println sampleName
     640                                                                flow.samples[ flow.samples.size() ] = [
     641                                                                        sample          : new Sample(
     642                                                                                parentSubject: subject,
     643                                                                                parentEvent: event,
     644                                                                                name: sampleName
     645                                                                        ),
     646                                                                    name                : sampleName,
     647                                                                        eventGroup      : eventGroup,
     648                                                                        event           : event,
     649                                                                        subject         : subject
     650                                                                ]
    597651                                                        }
    598652                                                }
     
    600654                                }
    601655
     656                                println flow.samples
     657
    602658                                success()
    603659                        }
     
    607663                        on("next") {
    608664                                success()
    609                         }.to "confirm"
     665                        }.to "samples"
    610666                        on("quickSave") {
    611667                                success()
     
    10131069        }
    10141070
    1015 
    10161071        /**
    10171072         * groovy / java equivalent of php's ucwords function
  • trunk/grails-app/domain/dbnp/data/Term.groovy

    r540 r557  
    3030                return name
    3131        }
     32
     33        /**
     34         * Return all terms for a string of comma separated ontology ncboId's.
     35         * @see Ontology.groovy
     36         * @param ontologies
     37         * @return
     38         */
     39        def giveAllByOntologies( ontologies ) {
     40                // this method does not seem to work (see taglibrary:termSelect)
     41                // i'll try to get it working later, or delete this altogether
     42                // - Jeroen
     43                def data = []
     44                def terms = []
     45
     46                // got a string?
     47                if (ontologies instanceof String) {
     48                        // split the ontologies string
     49                        ontologies.split(/\,/).each() { ncboId ->
     50                                // trim the id
     51                                ncboId.trim()
     52
     53                                // fetch all terms for this ontology
     54                                def ontology = Ontology.findAllByNcboId(ncboId)
     55
     56                                // does this ontology exist?
     57                                if (ontology) {
     58                                        ontology.each() {
     59                                                data[ data.size() ] = it
     60                                        }
     61                                }
     62                        }
     63
     64                        ontologies = data
     65                }
     66
     67                // iterate through ontologies
     68                ontologies.each() { ontology ->
     69                        Term.findAllByOntology( ontology ).each() { term ->
     70                                terms[ terms.size() ] = term
     71                        }
     72                }
     73
     74                // sort alphabetically
     75                terms.sort()
     76        }
    3277}
  • trunk/grails-app/taglib/dbnp/studycapturing/WizardTagLib.groovy

    r546 r557  
    601601                        // sort alphabetically
    602602                        from.sort()
    603                        
     603
    604604                        // define 'from'
    605605                        attrs.from = from
  • trunk/grails-app/views/wizard/pages/_samples.gsp

    r539 r557  
    2222        </span>
    2323
    24        
    25 
     24        <g:if test="${samples}">
     25                <div class="table">
     26                <g:each var="sampleData" in="${samples}">
     27                        ${sampleData}
     28                        <div class="row">
     29                                <!-- wizard:templateColumns class="column" id="1" entity="${sampleData['sample']}" //-->
     30                                <!-- div class="column"><wizard:templateSelect entity="${sampleData.sample}" /></div //-->
     31                        </div>
     32                </g:each>
     33                </div>
     34        </g:if>
    2635
    2736</wizard:pageContent>
Note: See TracChangeset for help on using the changeset viewer.