Changeset 389


Ignore:
Timestamp:
Apr 28, 2010, 4:28:39 PM (14 years ago)
Author:
duh
Message:
  • reverted changes of revisions 386, 387 and 388 as they completely broke the repository (you need to get cake now! ;)
  • committed development version of modified study capture wizard (works until events)
Location:
trunk
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/conf/BootStrap.groovy

    r386 r389  
    4747                                accession: '9606'
    4848                        ).with { if (!validate()) { errors.each { println it} } else save()}
    49 
    50                         def bloodTerm = new Term(
    51                                 name: 'Portion of blood',
    52                                 ontology: speciesOntology,
    53                                 accession: '9670'
    54                         ).with { if (!validate()) { errors.each { println it} } else save()}
    55 
    5649
    5750                        // Create a few persons, roles and Affiliations
     
    142135                        ).with { if (!validate()) { errors.each { println it} } else save()}
    143136                       
     137                        def bloodTerm = new Term(
     138                                name: 'Portion of blood',
     139                                ontology: humanBodyOntology,
     140                                accession: '9670'
     141                        ).with { if (!validate()) { errors.each { println it} } else save()}
    144142
    145143                        def c57bl6Term = new Term(
     
    443441                                name: 'Compound', type: TemplateFieldType.STRING,
    444442                                listEntries: [new TemplateFieldListItem(name:'Vehicle'),new TemplateFieldListItem(name: 'Leptin')]))
    445                         .with { if (!validate()) { errors.each { println it} } else save()}
    446 
    447                         def bloodSamplingEventTemplate = new Template(
    448                                 name: 'Blood extraction', entity: dbnp.studycapturing.Event)
    449                         .addToFields(sampleDescriptionField)
    450                         .addToFields(new TemplateField(
    451                                 name: 'Sample volume', type: TemplateFieldType.FLOAT))
    452                         .with { if (!validate()) { errors.each { println it} } else save()}
    453 
    454                         def fastingTreatmentTemplate = new Template(
    455                                 name: 'Fasting treatment', entity: dbnp.studycapturing.Event)
    456                         .addToFields(sampleDescriptionField)
    457                         .addToFields(new TemplateField(
    458                                 name: 'Fasting period', type: TemplateFieldType.STRING))
    459443                        .with { if (!validate()) { errors.each { println it} } else save()}
    460444
     
    516500                        exampleStudy.save()
    517501
    518 
    519                         /* Test output of fields things */
    520                         println "-----------------------------"
    521                         print "Diet domain fields: "
    522                         println exampleStudy.giveDomainFields().join( ", " )
    523 
    524                         print "Diet template fields: "
    525                         println exampleStudy.giveTemplateFields().join( ", " )
    526 
    527                         print "Diet all fields: "
    528                         println exampleStudy.giveFields().join( ", " )
    529 
    530                         println "-----------------------------"
    531 
    532502                        println ".adding NuGO PPSH example study..."
    533503                        def exampleHumanStudy = new Study(
     
    545515
    546516                        def evLF = new Event(
    547                                 template: dietTreatmentTemplate,
    548                                 startTime: Date.parse('yyyy-MM-dd','2008-01-07'),
    549                                 endTime: Date.parse('yyyy-MM-dd','2008-01-14')
     517                                template: dietTreatmentTemplate
    550518                        )
    551519                        .with { if (!validate()) { errors.each { println it} } else save()}
    552520
     521                        evLF.setStartTime(Date.parse('yyyy-MM-dd','2008-01-07'))
     522                        evLF.setEndTime(Date.parse('yyyy-MM-dd','2008-01-14'))
     523
    553524                        evLF.setFieldValue( 'Diet','10% fat (palm oil)' )
    554525                        evLF.save(flush:true)
     
    558529
    559530                        def evHF = new Event(
    560                                 template: dietTreatmentTemplate,
    561                                 startTime: Date.parse('yyyy-MM-dd','2008-01-07'),
    562                                 endTime: Date.parse('yyyy-MM-dd','2008-01-14')
     531                                template: dietTreatmentTemplate
    563532                        )
     533                        .setStartTime( Date.parse('yyyy-MM-dd','2008-01-07'))
     534                        .setEndTime( Date.parse('yyyy-MM-dd','2008-01-14'))
    564535                        .setFieldValue( 'Diet','45% fat (palm oil)' )
    565536                        .with { if (!validate()) { errors.each { println it} } else save()}
    566537
    567538                        def evBV = new Event(
    568                                 template: boostTreatmentTemplate,
    569                                 startTime: Date.parse('yyyy-MM-dd','2008-01-07'),
    570                                 endTime: Date.parse('yyyy-MM-dd','2008-01-14')
     539                                template: boostTreatmentTemplate
    571540                        )
     541                        .setStartTime( Date.parse('yyyy-MM-dd','2008-01-07'))
     542                        .setEndTime( Date.parse('yyyy-MM-dd','2008-01-14'))
    572543                        .setFieldValue( 'Compound','Vehicle' )
    573544                        .with { if (!validate()) { errors.each { println it} } else save()}
    574545
    575546                        def evBL = new Event(
    576                                 template: boostTreatmentTemplate,
    577                                 startTime: Date.parse('yyyy-MM-dd','2008-01-07'),
    578                                 endTime: Date.parse('yyyy-MM-dd','2008-01-14')
    579                         )
     547                                template: boostTreatmentTemplate
     548                        )
     549                        .setStartTime( Date.parse('yyyy-MM-dd','2008-01-07'))
     550                        .setEndTime( Date.parse('yyyy-MM-dd','2008-01-14'))
    580551                        .setFieldValue( 'Compound','Leptin' )
    581552                        .with { if (!validate()) { errors.each { println it} } else save()}
     
    686657
    687658                        def x=1
    688                         12.times {
     659                        40.times {
    689660                                def currentSubject = new Subject(
    690661                                        name: "A" + x++,
     
    713684                                */
    714685
    715                                 if (x > 9)      { HFBL1.addToSubjects(currentSubject).save() }
    716                                 else if (x > 6) { HFBV1.addToSubjects(currentSubject).save() }
    717                                 else if (x > 3)  { LFBL1.addToSubjects(currentSubject).save() }
    718                                 else             { LFBV1.addToSubjects(currentSubject).save() }
    719 
    720                         }
    721 
    722                         // Also add some human subjects
    723                         2.times {
    724                                 def currentSubject = new Subject(
    725                                         name: "H" + x++,
    726                                         species: humanTerm,
    727                                         template: humanTemplate,
    728                                 )
    729                                 .setFieldValue("Gender", "Male")
    730                                 //.setFieldValue("Genotype", c57bl6Term)
    731                                 .setFieldValue("Age (years)", 27)
    732                                 .setFieldValue("Height", 1.5)
    733                                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
    734 
    735                                 exampleStudy.addToSubjects(currentSubject)
    736                                 .with { if (!validate()) { errors.each { println it} } else save()}
    737 
    738                                 // Add subject to appropriate EventGroup
    739                                 /*
    740                                 if (x > 70) { HFBL4.addToSubjects(currentSubject).save() }
    741                                 else if (x > 60) { HFBV4.addToSubjects(currentSubject).save() }
    742                                 else if (x > 50) { LFBL4.addToSubjects(currentSubject).save() }
    743                                 else if (x > 40) { LFBV4.addToSubjects(currentSubject).save() }
    744                                 else if (x > 30) { HFBL1.addToSubjects(currentSubject).save() }
     686                                if (x > 30) { HFBL1.addToSubjects(currentSubject).save() }
    745687                                else if (x > 20) { HFBV1.addToSubjects(currentSubject).save() }
    746688                                else if (x > 10) { LFBL1.addToSubjects(currentSubject).save() }
    747689                                else             { LFBV1.addToSubjects(currentSubject).save() }
    748                                 */
    749 
    750                                 if (x == 0)      { HFBL1.addToSubjects(currentSubject).save() }
    751                                 else             { LFBV1.addToSubjects(currentSubject).save() }
    752690
    753691                        }
    754 
    755692
    756693                        // Add EventGroups to study
     
    774711                        .save()
    775712                       
     713                        /*
    776714                        println 'Adding PPSH study'
    777715
     
    781719                                code:"PPSH",
    782720                                researchQuestion:"How much are fasting plasma and urine metabolite levels affected by prolonged fasting ?",
     721                                description:"Human study",
    783722                                ecCode:"unknown",
    784723                                startDate: Date.parse('yyyy-MM-dd','2009-01-01')
     
    786725
    787726                        def fastingEvent = new Event(
    788                             template: fastingTreatmentTemplate,
    789                             startTime: Date.parse('yyyy-MM-dd','2008-01-14' ),
    790                             endTime: Date.parse('yyyy-MM-dd','2008-01-14' )
    791                         )
    792                         .setFieldValue( 'Fasting period','8h' )
    793                         .with { if (!validate()) { errors.each { println it} } else save()}
     727                                        startTime: Date.parse('yyyy-MM-dd','2008-01-14'),
     728                                        endTime: Date.parse('yyyy-MM-dd','2008-01-14'),
     729                                        eventDescription: fastingTreatment,
     730                                        parameterStringValues: ['Fasting period':'8h']);
    794731
    795732                        def bloodSamplingEvent = new SamplingEvent(
    796                             template: bloodSamplingEventTemplate,
    797                             startTime: Date.parse('yyyy-MM-dd','2008-01-14' ),
    798                             endTime: Date.parse('yyyy-MM-dd','2008-01-14' )
    799                         )
    800                         .setFieldValue( 'Sample volume',4.5F )
    801                         .with { if (!validate()) { errors.each { println it} } else save()}
     733                                        startTime: Date.parse('yyyy-MM-dd','2008-01-14'),
     734                                        endTime: Date.parse('yyyy-MM-dd','2008-01-14'),
     735                                        eventDescription: bloodSamplingEventDescription,
     736                                        parameterFloatValues: ['Sample volume':4.5F]);
    802737
    803738                        def rootGroup = new EventGroup(name: 'Root group');
     
    806741                        rootGroup.save()
    807742
    808                         def y = 1
    809                         11.times {
    810                           def currentSubject = new Subject(
    811                                   name: "" + y++,
    812                                   species: humanTerm,
    813                                   template: humanTemplate).setFieldValue("Gender", (boolean) (x / 2) ? "Male" : "Female").setFieldValue("DOB", new java.text.SimpleDateFormat("dd-mm-yy").parse("01-02-19" + (10 + (int) (Math.random() * 80)))).setFieldValue("Age (years)", 30).setFieldValue("Height", Math.random() * 2F).setFieldValue("Weight (kg)", Math.random() * 150F).setFieldValue("BMI", 20 + Math.random() * 10F).with { if (!validate()) { errors.each { println it} } else save()}
    814 
    815                           rootGroup.addToSubjects currentSubject
    816                           rootGroup.save()
    817 
    818                           def currentSample = new Sample(
    819                                   name: currentSubject.name + '_B',
    820                                   material: bloodTerm,
    821                                   parentSubject: currentSubject,
    822                                   parentEvent: bloodSamplingEvent);
    823 
    824                           humanStudy.addToSubjects(currentSubject).addToSamples(currentSample).with { if (!validate()) { errors.each { println it} } else save()}
    825                       }
    826 
    827                       humanStudy.addToEvents(fastingEvent)
    828                       humanStudy.addToSamplingEvents(bloodSamplingEvent)
    829                       humanStudy.addToEventGroups rootGroup
    830                       humanStudy.save()
     743            def y = 1
     744            11.times {
     745              def currentSubject = new Subject(
     746                      name: "" + y++,
     747                      species: humanTerm,
     748                      template: humanTemplate).setFieldValue("Gender", (boolean) (x / 2) ? "Male" : "Female").setFieldValue("DOB", new java.text.SimpleDateFormat("dd-mm-yy").parse("01-02-19" + (10 + (int) (Math.random() * 80)))).setFieldValue("Age (years)", 30).setFieldValue("Height", Math.random() * 2F).setFieldValue("Weight (kg)", Math.random() * 150F).setFieldValue("BMI", 20 + Math.random() * 10F).with { if (!validate()) { errors.each { println it} } else save()}
     749
     750              rootGroup.addToSubjects currentSubject
     751              rootGroup.save()
     752
     753              def currentSample = new Sample(
     754                      name: currentSubject.name + '_B',
     755                      material: bloodTerm,
     756                      parentSubject: currentSubject,
     757                      parentEvent: bloodSamplingEvent);
     758
     759
     760              humanStudy.addToSubjects(currentSubject).addToSamples(currentSample).with { if (!validate()) { errors.each { println it} } else save()}
     761          }
     762
     763          humanStudy.addToEvents(fastingEvent)
     764          humanStudy.addToSamplingEvents(bloodSamplingEvent)
     765          humanStudy.addToEventGroups rootGroup
     766          humanStudy.save()
     767
    831768                        // Add clinical data
    832769
     
    856793                        lipidAssay.addToMeasurements ldlMeasurement
    857794                        lipidAssay.addToMeasurements hdlMeasurement
    858                        
     795
    859796                        def lipidAssayInstance = new dbnp.clinicaldata.ClinicalAssayInstance(
    860797                                assay: lipidAssay
     
    878815
    879816                        // Add assay to study capture module
     817
    880818                        def clinicalModule = new AssayModule(
    881819                                name: 'Clinical data',
     
    896834                        lipidAssayRef.save()
    897835
    898                         humanStudy.addToAssays(lipidAssayRef);
    899 
    900                         // Add some sample assay
    901                         // Add assay to study capture module
    902                         def dummyModule = new AssayModule(
    903                                 name: 'Dummy data',
    904                                 type: AssayType.CLINICAL_DATA,
    905                                 platform: 'other type of measurement platform',
    906                                 url: 'http://localhost:8080/gscf'
    907                         ).with { if (!validate()) { errors.each { println it} } else save()}
    908 
    909                         def dummyAssayRef = new Assay(
    910                                 name: 'Test assay',
    911                                 module: dummyModule,
    912                                 externalAssayId: lipidAssayInstance.id
    913                         ).with { if (!validate()) { errors.each { println it} } else save()}
    914 
    915                         humanStudy.addToAssays(dummyAssayRef);
    916 
     836                        humanStudy.addToAssays(lipidAssayRef);
    917837                        humanStudy.save()
     838*/
    918839                }
    919840        }
  • trunk/grails-app/controllers/dbnp/studycapturing/WizardController.groovy

    r383 r389  
    242242                                flow.page = 4
    243243
    244                                 if (!flow.events) {
    245                                         flow.events = []
    246                                 }
    247 
     244                                if (!flow.event) flow.event = new Event()
     245                                if (!flow.events) flow.events = []
    248246                                if (!flow.eventGroups) {
    249247                                        flow.eventGroups = []
    250248                                        flow.eventGroups[0] = new EventGroup(name: 'Group 1')   // 1 group by default
    251249                                }
    252 println flow.events
    253                         }
     250                        }
     251                        on("switchTemplate") {
     252                                flash.values = params
     253
     254                                // handle study data
     255                                this.handleEvents(flow, flash, params)
     256
     257                                // remove errors as we don't want any warnings now
     258                                flash.errors = [:]
     259                        }.to "events"
    254260                        on("add") {
     261                                /*
    255262                                def startTime   = (params.get('startTime')) ? params.startTime = new Date().parse("d/M/yyyy HH:mm", params.get('startTime').toString()) : null
    256263                                def endTime             = (params.get('endTime')) ? new Date().parse("d/M/yyyy HH:mm", params.get('endTime').toString()) : null
     
    295302                                        error()
    296303                                }
     304                                */
     305                                flash.values = params
     306
     307                                // handle study data
     308                                this.handleEvents(flow, flash, params)
     309
     310                                // validate event object
     311                                if (flow.event.validate()) {
     312                                        //flow.events[ flow.events.size() ] = flow.event
     313                                        success()
     314                                } else {
     315                                        flash.errors = [:]
     316                                        this.appendErrors(flow.event, flash.errors)
     317                                        error()
     318                                }
    297319                        }.to "events"
    298320                        on("deleteEvent") {
     
    502524        }
    503525
     526
     527        /**
     528         * re-usable code for handling event form data in a web flow
     529         * @param Map LocalAttributeMap (the flow scope)
     530         * @param Map localAttributeMap (the flash scope)
     531         * @param Map GrailsParameterMap (the flow parameters = form data)
     532         * @returns boolean
     533         */
     534        def handleEvents(flow, flash, params) {
     535                // got an event in the flash scope?
     536                if (!flow.event) flow.event = new Event()
     537
     538                // if a template is selected, get template instance
     539                def template = params.remove('template')
     540                if (template instanceof String && template.size() > 0) {
     541                        params.template = Template.findByName(template)
     542                } else if (template instanceof Template) {
     543                        params.template = template
     544                } else {
     545                        params.template = null
     546                }
     547
     548                // set template
     549                if (params.template) flow.event.template = params.template
     550println flow.event.template
     551println params
     552               
     553                // update event instance with parameters
     554                params.each() { key, value ->
     555                        try {
     556                                flow.event.setFieldValue(key, value)
     557                                println "has "+key
     558                        } catch (Exception e) {
     559                                println "does NOT have "+key
     560                        }
     561                        /*
     562                        if (flow.event.hasProperty(key)) {
     563println "has property " +  key
     564                                flow.event.setProperty(key, value);
     565                        }
     566                        */
     567                }
     568        }
     569
    504570        /**
    505571         * re-usable code for handling study form data in a web flow
  • trunk/grails-app/domain/dbnp/studycapturing/Event.groovy

    r388 r389  
    1515class Event extends TemplateEntity implements Serializable {
    1616
    17         Date startTime
    18         Date endTime
    19        
    2017        static constraints = {
    2118                startTime(nullable: true)
     
    2825        }
    2926       
     27        Date getStartTime() {
     28                getFieldValue('Start time')
     29        }
    3030
    31         List<DomainTemplateField> giveDomainFields() {
    32                 [ new TemplateField(
    33                             name: 'startDate',
    34                             type: TemplateFieldType.DATE),
    35                         new TemplateField(
    36                             name: 'endDate',
    37                             type: TemplateFieldType.DATE) ];
     31        def setStartTime(Date value) {
     32                if (value != null) {
     33                        setFieldValue('Start time',value)
     34                }
     35                return this
     36        }
     37
     38        Date getEndTime() {
     39                getFieldValue('End time')
     40        }
     41
     42        def setEndTime(Date value) {
     43                if (value != null) {
     44                        setFieldValue('End time',value)
     45                }
     46                return this
     47        }
     48
     49        Map giveDomainFields() {
     50                return ['startTime':TemplateFieldType.DATE,'endTime':TemplateFieldType.DATE]
    3851        }
    3952
  • trunk/grails-app/domain/dbnp/studycapturing/Sample.groovy

    r388 r389  
    1616        // a member that describes the quantity of the sample? --> should be in the templates
    1717
    18         List<DomainTemplateField> giveDomainFields() {
    19                 [ new TemplateField(
    20                             name: 'name',
    21                             type: TemplateFieldType.STRING),
    22                         new TemplateField(
    23                             name: 'material',
    24                             type: TemplateFieldType.ONTOLOGYTERM) ];
     18        Map giveDomainFields() {
     19                return ['name':TemplateFieldType.STRING,'material':TemplateFieldType.ONTOLOGYTERM]
    2520        }
    2621
  • trunk/grails-app/domain/dbnp/studycapturing/Study.groovy

    r386 r389  
    2323        //String ecCode
    2424
    25         List<DomainTemplateField> giveDomainFields() {
    26                 [ new TemplateField(
    27                             name: 'title - niet opslaan!',
    28                             type: TemplateFieldType.STRING),
    29                         new TemplateField(
    30                             name: 'startDate',
    31                             type: TemplateFieldType.DATE) ];
     25        Map giveDomainFields() {
     26                return ['title':TemplateFieldType.STRING,'startDate':TemplateFieldType.DATE]
    3227        }
    3328
  • trunk/grails-app/domain/dbnp/studycapturing/Subject.groovy

    r388 r389  
    1616        Term species
    1717
    18         List<DomainTemplateField> giveDomainFields() {
    19                 [ new TemplateField(
    20                             name: 'name',
    21                             type: TemplateFieldType.STRING),
    22                         new TemplateField(
    23                             name: 'species',
    24                             type: TemplateFieldType.ONTOLOGYTERM) ];
     18        Map giveDomainFields() {
     19                return ['name':TemplateFieldType.STRING,'species':TemplateFieldType.ONTOLOGYTERM]
    2520        }
    2621}
  • trunk/grails-app/domain/dbnp/studycapturing/TemplateEntity.groovy

    r386 r389  
    349349
    350350        /**
    351         * Return all fields defined in the underlying template and the built-in
    352         * domain fields of this entity
     351        * Return all templated fields defined in the underlying template of this entity
    353352        */
    354353        def List<TemplateField> giveFields() {
    355                 return this.giveDomainFields() + this.giveTemplateFields();
    356         }
    357 
    358         /**
    359         * Return all templated fields defined in the underlying template of this entity
    360         */
    361         def List<TemplateField> giveTemplateFields() {
    362354                return this.template.fields;
    363355        }
    364356
     357        def List<TemplateField> giveSystemFields() {
     358                return systemFields;
     359        }
     360       
     361
    365362        /**
    366363         * Return all relevant 'built-in' domain fields of the super class
    367          * @return List with DomainTemplateFields
    368          * @see DomainTemplateField
     364         * @return key-value pairs describing the built-in fields, with the names as keys and type (as TemplateFieldType) as values
    369365         */
    370         abstract List<DomainTemplateField> giveDomainFields()
    371 
     366        abstract Map giveDomainFields()
    372367        /*def giveDomainFields() {
    373368                def fieldSet = [:];
  • trunk/grails-app/taglib/dbnp/studycapturing/WizardTagLib.groovy

    r383 r389  
    209209         */
    210210        def baseElement = {inputElement, attrs, help ->
    211 println ".rendering " + inputElement + " with name " + attrs.get('name')
     211println ".rendering [" + inputElement + "] with name [" + attrs.get('name') + "] and value [" + ((attrs.value) ? attrs.get('value').toString() : "-") + "]"
    212212                // work variables
    213213                def description = attrs.remove('description')
     
    599599                // got result?
    600600                if (attrs.from.size() > 0) {
     601                        // transform all values into strings
     602                        def from = []
     603                        attrs.from.each { from[ from.size() ] = it.toString() }
     604                        attrs.from = from
     605                        attrs.value = (attrs.value) ? attrs.value.toString() : ''
     606
     607                        // output select element
    601608                        out << select(attrs)
    602609                } else {
     
    682689                def renderType  = attrs.remove('renderType')
    683690                def entity              = (attrs.get('entity'))
     691                println entity
     692                println entity.class
     693                println entity instanceof TemplateEntity
    684694                def template    = (entity && entity instanceof TemplateEntity) ? entity.template : null
    685695                def inputElement= null
  • trunk/grails-app/views/sandbox/index.gsp

    r386 r389  
    3737                <td>Type</td>
    3838        </tr>
     39        <g:each in="${subject.giveDomainFields()}" var="field">
     40            <tr>
     41                    <td>Domain field</td>
     42                        <td>${field.key}</td>
     43                         <td>${field.value}</td>
     44                </tr>
     45        </g:each>
    3946        <g:each in="${subject.giveFields()}" var="field">
    4047            <tr>
  • trunk/grails-app/views/study/list.gsp

    r386 r389  
    55    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    66    <meta name="layout" content="main" />
    7     <g:set var="entityName" value="${message(code: 'study.label', default: 'Study')}" />
    8     <title><g:message code="default.list.label" args="[entityName]" /></title>
     7  <g:set var="entityName" value="${message(code: 'study.label', default: 'Study')}" />
     8  <title><g:message code="default.list.label" args="[entityName]" /></title>
    99</head>
    1010<body>
     
    1212  <g:form action="list_extended">
    1313
     14  <div class="nav">
     15    <span class="menuButton"><a class="home" href="${createLink(uri: '/')}">Home</a></span>
     16    <span class="menuButton"><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></span>
     17  </div>
    1418  <div class="body">
    1519    <h1><g:message code="default.list.label" args="[entityName]" /></h1>
     
    1822    </g:if>
    1923
    20     <div class="list">
    21       <table>
    22           <thead>
    23               <tr>
    24                   <th></th>
    25                   <g:sortableColumn property="title" title="${message(code: 'study.title.label', default: 'Title')}" />
    26                   <th>Subjects</th>
    27                   <th>Events</th>
    28                   <th>Assays</th>
    29               </tr>
    30           </thead>
    31           <tbody>
    32           <g:each in="${studyInstanceList}" var="studyInstance" status="i" >
    33               <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
     24      <g:each in="${studyInstanceList}" var="studyInstance">
     25        <br>
     26        <table>
     27          <tr>
     28            <td width="50"></td>
     29            <td colspan="3">
     30              <center><b>${studyInstance.title}</b></center>
     31            </td>
     32          </tr>
     33          <tr>
     34            <td>
    3435
    35                   <td><input type="checkbox" name="${studyInstance.title}" id="${studyInstance.title}"></td>
     36              <input type="checkbox" name="${studyInstance.title}" id="${studyInstance.title}"></td>
    3637
    37                   <td><g:link action="show" id="${studyInstance.id}">${fieldValue(bean: studyInstance, field: "title")}</g:link></td>
     38            <td width="150">
     39          <g:link action="show" id="${studyInstance.id}">
     40${message(code: 'study.id.label', default: 'Id')} :
     41${fieldValue(bean: studyInstance, field: "id")}</g:link></td>
    3842
    39                   <td>
    40                     <g:if test="${studyInstance.subjects.species.size()==0}">
    41                       -
    42                     </g:if>
    43                     <g:else>
    44                       <g:each in="${studyInstance.subjects.species.unique()}" var="currentSpecies" status="j">
    45                         <g:if test="${j > 0}">, </g:if>
    46                         <%= studyInstance.subjects.findAll { return it.species == currentSpecies; }.size() %>
    47                         ${currentSpecies}
    48                       </g:each>
    49                     </g:else>
    50                   </td>
     43        <td width="300">
     44<b>${message(code: 'study.template.label', default: 'Template')} </b>:
     45${fieldValue(bean: studyInstance, field: "template")}</td>
    5146
    52                   <td>
    53                     <g:if test="${studyInstance.giveEventTemplates().size()==0}">
    54                       -
    55                     </g:if>
    56                     <g:else>
    57                       ${studyInstance.giveEventTemplates().name.join( ', ' )}
    58                     </g:else>
    59                   </td>
     47<td >
     48<b>${message(code: 'study.subjects.label', default: 'Subjects')} </b>:
     49${studyInstance.subjects.size()} subjects</td>
    6050
    61                   <td>
    62                     <g:if test="${studyInstance.assays.size()==0}">
    63                       -
    64                     </g:if>
    65                     <g:else>
    66                       ${studyInstance.assays.module.platform.unique().join( ', ' )}
    67                     </g:else>
    68                   </td>
     51        </tr>
     52        <tr>
     53          <td></td>
     54          <td >
     55<b>${message(code: 'study.owner.label', default: 'Owner')} </b>:
     56${fieldValue(bean: studyInstance, field: "owner")}</td>
    6957
    70               </tr>
     58          <td >
     59<b>Assays </b>:
     60        <g:each in="${studyInstance.assays}" var="assay">
     61          ${assay.name}
     62        </g:each>
     63          </td>
     64
     65          <td><b> Samples </b>:
     66          <g:each in="${studyInstance.assays.samples}" var="samples">
     67          ${samples.name}
    7168          </g:each>
    72           </tbody>
    73       </table>
    74     </div>
    75     <div class="buttons">
    76         <span class="button"><g:link controller="wizard" class="create" action="index"><g:message code="default.new.label" args="[entityName]" /></g:link></span>
    77     </div>
     69          </td>
     70
     71
     72        </tr>
     73        <g:if test="${studyInstance.fieldExists( 'Description' )}">
     74        <tr>
     75          <td></td>
     76          <td colspan="3">
     77            <b>${message(code: 'study.description.label', default: 'Description')} </b>:
     78            ${studyInstance.getFieldValue( 'Description' )}
     79           
     80          </td>
     81        </tr>
     82        </g:if>
     83        </table>
     84      </g:each>
     85   
    7886    <div class="paginateButtons">
    79         <g:paginate total="${studyInstanceTotal}" prev="&laquo; Previous" next="&raquo; Next" />
    80         <br>
    81         <INPUT TYPE=submit name=submit Value="Compare selected studies">
     87      <g:paginate total="${studyInstanceTotal}" />
     88      <br>
     89      <INPUT TYPE=submit name=submit Value="Compare selected studies">
    8290    </div>
    8391  </div>
  • trunk/grails-app/views/study/show.gsp

    r386 r389  
    4949            </g:if>
    5050            <g:else>
    51               ${studyInstance.giveEventTemplates().name}
     51             ${studyInstance.giveEventTemplates().name}
    5252            </g:else>
    5353          <br>
  • trunk/grails-app/views/wizard/pages/_events.gsp

    r383 r389  
    1717<wizard:pageContent>
    1818        <span class="info">
    19                 <span class="title">Define all events and their duration that occur in your study</span>
    20                 In the previous screen you defined the unique event types, in this screen you need to define
    21                 all events of a specific event type that occur in time. Select the type of event, and the
    22                 start and stop time of an event. As it is frequently the case that <i>sets</i> of events act
    23                 upon (groups of) subjects, you can define event groups, and add events to a particular group.<br/>
    24                 <i>Note that you can edit multiple events at once by selecting multpiple rows by either
    25                 ctrl-clicking them or dragging a selection over them.</i>
     19                <span class="title">Define all events that occur in your study</span>
     20                Bla bla bla we need a good help text here ;)
    2621        </span>
    2722
    28         <wizard:templateElement name="template" description="Template" value="${values?.template}" entity="${dbnp.studycapturing.Event}" addDummy="true" >
     23        <wizard:templateElement name="template" description="Template" value="${event?.template}" entity="${dbnp.studycapturing.Event}" addDummy="true" ajaxOnChange="switchTemplate" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" afterSuccess="onWizardPage()" >
    2924                The template to use for this study
    3025        </wizard:templateElement>
    31         <wizard:timeElement name="startTime" description="Start Time" error="startTime" value="${values?.startTime}">
    32                 The start time of the study
    33         </wizard:timeElement>
    34         <wizard:timeElement name="endTime" description="End time" error="endTimee" value="${values?.endTime}">
    35                 The end time of the study
    36         </wizard:timeElement>   
    37         <wizard:buttonElement name="add" value="Add" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" afterSuccess="onWizardPage()"/>
     26        <g:if test="${event?.template}"><wizard:templateElements entity="${event}" /></g:if>
     27        <g:if test="${event?.template}"><wizard:buttonElement name="add" value="Add" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" afterSuccess="onWizardPage()"/></g:if>
     28<% /*
    3829<g:if test="${events}">
    3930        <g:each var="event" status="i" in="${events}">
     
    4233                        <div class="firstColumn">#</div>
    4334                        <div class="firstColumn"></div>
    44                         <div class="column">start</div>
    45                         <div class="column">end</div>
    46                         <div class="column">duration</div>
     35                        <div class="column">Template</div>
    4736                        <wizard:templateColumnHeaders template="${event.template}" class="column" />
    4837                        <g:if test="${eventGroups}"><g:each var="eventGroup" status="g" in="${eventGroups}">
     
    6150                                <wizard:ajaxButton name="delete" src="../images/icons/famfamfam/delete.png" alt="delete this event" class="famfamfam" value="-" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" before="\$(\'input[name=do]\').val(${i});" afterSuccess="onWizardPage()" />
    6251                        </div>
    63                         <div class="column"><g:formatDate format="dd/MM/yyyy hh:mm" date="${event.startTime}" /></div>
    64                         <div class="column"><g:formatDate format="dd/MM/yyyy hh:mm" date="${event.endTime}" /></div>
    65                         <div class="column">${event.getShortDuration()}</div>
     52                        <div class="column">${event.template}</div>
    6653                        <wizard:templateColumns id="${i}" entity="${event}" template="${event.template}" name="event${i}" class="column" />
    6754                        <g:if test="${eventGroups}"><g:each var="eventGroup" status="j" in="${eventGroups}">
     
    7865        </div>
    7966        </g:each>
     67*/ %>
    8068<% /*
    8169        <div class="table">
     
    123111                <div class="slider"></div>
    124112        </div>
     113</g:if>
    125114 */ %>
    126 </g:if>
    127115       
    128116</wizard:pageContent>
  • trunk/grails-app/views/wizard/pages/_study.gsp

    r359 r389  
    3131                The start date of the study
    3232        </wizard:dateElement>
    33         <wizard:templateElements entity="${study}" />
    34 
     33        <g:if test="${study}"><wizard:templateElements entity="${study}" /></g:if>
    3534</wizard:pageContent>
  • trunk/web-app/css/wizard.css

    r362 r389  
    77    display: block;
    88    border: 1px solid #006DBA;
    9     background-color: #EEE;
     9    background-color: #f8feff;
    1010    padding: 10px;
    1111    font-size: 10px;
  • trunk/web-app/css/wizard.min.css

    r356 r389  
    1 .wizard{display:block;padding-top:10px;}.wizard .info{display:block;border:1px solid #006DBA;background-color:#EEE;padding:10px;font-size:10px;margin:10px 0 10px 0;}.wizard .info .title{color:#006DBA;font-size:14px;font-weight:normal;display:block;margin-bottom:5px;padding-left:20px;background:url(../images/icons/famfamfam/information.png) no-repeat center left;}.wizard .info .todo{color:#006DBA;font-size:14px;font-weight:normal;display:block;margin-bottom:5px;padding-left:20px;background:url(../images/icons/famfamfam/wrench.png) no-repeat center left;}.wizard .info .known{color:#006DBA;font-size:14px;font-weight:normal;display:block;margin-bottom:5px;padding-left:20px;background:url(../images/icons/famfamfam/eye.png) no-repeat center left;}.wizard .famfamfam{width:16px;height:16px;}.wizard .spinner{background:url(../images/spinner.gif) no-repeat left top;width:16px;height:16px;display:none;}.wizard .sliderContainer{display:block;margin-top:10px;width:150px;}.wizard .tabs{display:block;padding-bottom:2px;border-bottom:2px solid #006DBA;width:100%;}.wizard .tabs ul{list-style-type:none;padding:0;font-size:10px;margin:0;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:10px;height:20px;width:100%;}.wizard .tabs img{border:0;}.wizard .tabs li{float:left;margin:0;height:20px;float:left;display:block;text-align:center;text-decoration:none;color:#006DBA;background:#CCC;font-weight:bold;}.wizard .tabs .content{padding:0 10px 0 10px;display:inline;border:0;}.wizard .tabs .active{background-color:#006DBA!important;color:#fff!important;}.wizard .tabs .arrow{position:inherit;margin-top:0;margin-bottom:0;display:inline;}.wizard .content{display:block;padding-bottom:10px;border-bottom:2px solid #006DBA;}.wizard .navigation{display:block;color:#666;font-size:10px;}.wizard .prevnext{cursor:pointer;color:#006DBA;background-color:transparent;border:none;}.wizard .element .input .isExample{color:#006DBA;background-color:transparent;border:0;input:disabled;}.wizard .element{display:block;}.wizard .element .description{display:inline-block;font-size:11px;width:250px;word-wrap:break-word;}.wizard .element .input{display:inline;}.wizard .error{background:url(../images/icons/famfamfam/exclamation.png) no-repeat 230px 4px;}.wizard .element .input input{vertical-align:top;border:1px solid #CCC;margin:2px 0;padding:2px 4px;}.wizard .element .input input:focus,select:focus,textarea:focus{border:1px solid #B2D1FF;}.wizard .element .helpIcon{display:inline-block;margin-top:4px;background:url(../images/icons/famfamfam/help.png) no-repeat left top;width:16px;height:16px;}.wizard .element .helpContent{display:none;}.wizard .element .help{vertical-align:top;display:inline-block;}.wizard .element .help .icon{margin-top:4px;background:url(../images/icons/famfamfam/help.png) no-repeat left top;width:16px;height:16px;}.wizard .element .help .content{display:none;}.wizard .table{display:block;border:1px solid #575a5d;background-color:#ebf7fc;margin-top:10px;font-size:11px;overflow:hidden;white-space:nowrap;}.wizard .table .header{display:block;background-color:#006DBA;color:#fff;font-weight:bold;width:auto;height:32px;line-height:32px;}.wizard .column{display:inline-block;padding:2px 4px;width:120px;}.wizard .firstColumn{display:inline-block;padding:2px 4px;width:20px;}.wizard .table .row{display:block;height:32px;border-top:1px solid #8e908f;width:auto;}.wizard .table .row input,.wizard .table .row select{background-color:#fff;}.wizard .table .ui-selected{background-color:#ffab7b;}.wizard .table .ui-selecting{background-color:#f2e3bc;}.wizard .table .row .warning{color:red;font-size:8px;height:10px;}.wizard .table .row .error{background-color:#ffb0b7;}.wizard .table input[type=text],.wizard .table select{border:1px solid #8e908f;margin:2px 0;padding:2px 4px;background-color:transparent;width:100px;}.wizard .table .header input[type=text],.wizard .table .header select,.wizard .table .header button{border:1px solid #8e908f;margin:2px 0;padding:2px 4px;background-color:#fff;width:75px;}.wizard .table .highlight,.wizard .table .highlight input,.wizard .table .highlight select{background-color:#006DBA;color:#fff;}.wizard .table .highlight input,.wizard .table .highlight select{background-color:#6e99d4;color:#fff;}.wizard .bigbutton{background:url(../images/wizard/big-button.jpg) no-repeat left top;border:0;width:454px;height:53px;color:#fff;font-size:18pt;}.wizard .bigbutton:hover{color:#000;}.wizard .bigtext{color:#006dba;font-weight:normal;font-size:24px;margin:.8em 0 .3em 0;display:block;width:100%;text-align:center;}.wizard option.addTerm{background:url(../images/icons/famfamfam/add.png) no-repeat left top;background-color:#666;padding-left:18px;height:16px;color:#c9e39c;font-weight:bold;}
     1.wizard{display:block;padding-top:10px;}.wizard .info{display:block;border:1px solid #006DBA;background-color:#f8feff;padding:10px;font-size:10px;margin:10px 0 10px 0;}.wizard .info .title{color:#006DBA;font-size:14px;font-weight:normal;display:block;margin-bottom:5px;padding-left:20px;background:url(../images/icons/famfamfam/information.png) no-repeat center left;}.wizard .info .todo{color:#006DBA;font-size:14px;font-weight:normal;display:block;margin-bottom:5px;padding-left:20px;background:url(../images/icons/famfamfam/wrench.png) no-repeat center left;}.wizard .info .known{color:#006DBA;font-size:14px;font-weight:normal;display:block;margin-bottom:5px;padding-left:20px;background:url(../images/icons/famfamfam/eye.png) no-repeat center left;}.wizard .famfamfam{width:16px;height:16px;}.wizard .spinner{background:url(../images/spinner.gif) no-repeat left top;width:16px;height:16px;display:none;}.wizard .sliderContainer{display:block;margin-top:10px;width:150px;}.wizard .tabs{display:block;padding-bottom:2px;border-bottom:2px solid #006DBA;width:100%;}.wizard .tabs ul{list-style-type:none;padding:0;font-size:10px;margin:0;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:10px;height:20px;width:100%;}.wizard .tabs img{border:0;}.wizard .tabs li{float:left;margin:0;height:20px;float:left;display:block;text-align:center;text-decoration:none;color:#006DBA;background:#CCC;font-weight:bold;}.wizard .tabs .content{padding:0 10px 0 10px;display:inline;border:0;}.wizard .tabs .active{background-color:#006DBA!important;color:#fff!important;}.wizard .tabs .arrow{position:inherit;margin-top:0;margin-bottom:0;display:inline;}.wizard .content{display:block;padding-bottom:10px;border-bottom:2px solid #006DBA;}.wizard .navigation{display:block;color:#666;font-size:10px;}.wizard .prevnext{cursor:pointer;color:#006DBA;background-color:transparent;border:none;}.wizard .element .input .isExample{color:#006DBA;background-color:transparent;border:0;input:disabled;}.wizard .element{display:block;}.wizard .element .description{display:inline-block;font-size:11px;width:250px;word-wrap:break-word;}.wizard .element .input{display:inline;}.wizard .error{background:url(../images/icons/famfamfam/exclamation.png) no-repeat 230px 4px;}.wizard .element .input input{vertical-align:top;border:1px solid #CCC;margin:2px 0;padding:2px 4px;}.wizard .element .input input:focus,select:focus,textarea:focus{border:1px solid #B2D1FF;}.wizard .element .helpIcon{display:inline-block;margin-top:4px;background:url(../images/icons/famfamfam/help.png) no-repeat left top;width:16px;height:16px;}.wizard .element .helpContent{display:none;}.wizard .element .help{vertical-align:top;display:inline-block;}.wizard .element .help .icon{margin-top:4px;background:url(../images/icons/famfamfam/help.png) no-repeat left top;width:16px;height:16px;}.wizard .element .help .content{display:none;}.wizard .table{display:block;border:1px solid #575a5d;background-color:#ebf7fc;margin-top:10px;font-size:11px;overflow:hidden;white-space:nowrap;}.wizard .table .header{display:block;background-color:#006DBA;color:#fff;font-weight:bold;width:auto;height:32px;line-height:32px;}.wizard .column{display:inline-block;padding:2px 4px;width:120px;}.wizard .firstColumn{display:inline-block;padding:2px 4px;width:20px;}.wizard .table .row{display:block;height:32px;border-top:1px solid #8e908f;width:auto;}.wizard .table .row input,.wizard .table .row select{background-color:#fff;}.wizard .table .ui-selected{background-color:#ffab7b;}.wizard .table .ui-selecting{background-color:#f2e3bc;}.wizard .table .row .warning{color:red;font-size:8px;height:10px;}.wizard .table .row .error{background-color:#ffb0b7;}.wizard .table input[type=text],.wizard .table select{border:1px solid #8e908f;margin:2px 0;padding:2px 4px;background-color:transparent;width:100px;}.wizard .table .header input[type=text],.wizard .table .header select,.wizard .table .header button{border:1px solid #8e908f;margin:2px 0;padding:2px 4px;background-color:#fff;width:75px;}.wizard .table .highlight,.wizard .table .highlight input,.wizard .table .highlight select{background-color:#006DBA;color:#fff;}.wizard .table .highlight input,.wizard .table .highlight select{background-color:#6e99d4;color:#fff;}.wizard .bigbutton{background:url(../images/wizard/big-button.jpg) no-repeat left top;border:0;width:454px;height:53px;color:#fff;font-size:18pt;}.wizard .bigbutton:hover{color:#000;}.wizard .bigtext{color:#006dba;font-weight:normal;font-size:24px;margin:.8em 0 .3em 0;display:block;width:100%;text-align:center;}
Note: See TracChangeset for help on using the changeset viewer.