Changeset 349
- Timestamp:
- Apr 19, 2010, 1:05:48 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/conf/BootStrap.groovy
r347 r349 27 27 28 28 // adding the academic 29 println " Adding academic study template..."29 println ".adding academic study template..." 30 30 def studyTemplate = new Template( 31 31 name: 'Academic study', entity: dbnp.studycapturing.Study) … … 36 36 .addToFields(new TemplateField(name: 'Lab code',type: TemplateFieldType.STRING)) 37 37 .addToFields(new TemplateField(name: 'Institute',type: TemplateFieldType.STRING)) 38 .with { if (!validate()) { errors.each { println it} } else save()} 39 40 // Mouse template 41 println ".adding mouse subject template..." 42 def mouseTemplate = new Template( 43 name: 'Mouse', entity: dbnp.studycapturing.Subject) 44 .addToFields(new TemplateField( 45 name: 'Strain', type: TemplateFieldType.ONTOLOGYTERM)) 46 //.addToFields(genotypeField) 47 //.addToFields(genotypeTypeField) 48 //.addToFields(genderField) 49 .addToFields(new TemplateField( 50 name: 'Age (weeks)', type: TemplateFieldType.INTEGER, unit: 'weeks')) 51 .addToFields(new TemplateField( 52 name: 'Age type',type: TemplateFieldType.STRINGLIST, 53 listEntries: [new TemplateFieldListItem(name:'postnatal'),new TemplateFieldListItem(name:'embryonal')])) 54 .addToFields(new TemplateField( 55 name: 'Cage',type: TemplateFieldType.STRING)) 56 .addToFields(new TemplateField( 57 name: '#Mice in cage',type: TemplateFieldType.INTEGER)) 58 .addToFields(new TemplateField( 59 name: 'Litter size',type: TemplateFieldType.INTEGER)) 60 .addToFields(new TemplateField( 61 name: 'Weight (g)', type: TemplateFieldType.DOUBLE, unit: 'gram')) 62 .with { if (!validate()) { errors.each { println it} } else save()} 63 64 // Human template 65 println ".adding human subject template..." 66 def humanTemplate = new Template( 67 name: 'Human', entity: dbnp.studycapturing.Subject) 68 //.addToFields(genderField) 69 //.addToFields(ageField) 70 .addToFields(new TemplateField( 71 name: 'DOB',type: TemplateFieldType.DATE)) 72 .addToFields(new TemplateField( 73 name: 'Height',type: TemplateFieldType.DOUBLE, unit: 'm')) 74 .addToFields(new TemplateField( 75 name: 'Weight (kg)',type: TemplateFieldType.DOUBLE, unit: 'kg')) 76 .addToFields(new TemplateField( 77 name: 'BMI',type: TemplateFieldType.DOUBLE, unit: 'kg/m2')) 78 .addToFields(new TemplateField( 79 name: 'Race',type: TemplateFieldType.STRING)) 80 .addToFields(new TemplateField( 81 name: 'Waist circumference',type: TemplateFieldType.FLOAT, unit: 'cm')) 82 .addToFields(new TemplateField( 83 name: 'Hip circumference',type: TemplateFieldType.FLOAT, unit: 'cm')) 84 .addToFields(new TemplateField( 85 name: 'Systolic blood pressure',type: TemplateFieldType.FLOAT, unit: 'mmHg')) 86 .addToFields(new TemplateField( 87 name: 'Diastolic blood pressure',type: TemplateFieldType.FLOAT, unit: 'mmHg')) 88 .addToFields(new TemplateField( 89 name: 'Heart rate',type: TemplateFieldType.FLOAT, unit: 'beats/min')) 90 .addToFields(new TemplateField( 91 name: 'Run-in-food',type: TemplateFieldType.TEXT)) 38 92 .with { if (!validate()) { errors.each { println it} } else save()} 39 93 -
trunk/grails-app/controllers/dbnp/studycapturing/WizardController.groovy
r343 r349 152 152 } 153 153 on("add") { 154 println params 155 flash.values = params 156 /* 154 157 // fetch species by name (as posted by the form) 155 158 def speciesTerm = Term.findByName(params.addSpecies) … … 182 185 flow.subjectTemplates[ subjectTemplateName ]['subjects'][ subjectsSize ] = increment 183 186 } 187 */ 184 188 }.to "subjects" 185 189 on("next") { -
trunk/grails-app/domain/dbnp/studycapturing/TemplateField.groovy
r348 r349 1 1 package dbnp.studycapturing 2 3 import dbnp.data.Ontology 2 4 3 5 /** … … 14 16 String unit 15 17 String comment // help string for the user interface 18 List listEntries 16 19 17 List listEntries 18 static hasMany = [listEntries : TemplateFieldListItem,19 // to store the entries to choose from when the type is 'item from predefined list'20 ontologies : Ontology // to store the ontologies to choose from when the type is 'ontology term'21 ] 20 static hasMany = [listEntries : TemplateFieldListItem, 21 // to store the entries to choose from when the type is 'item from predefined list' 22 ontologies : Ontology // to store the ontologies to choose from when the type is 'ontology term' 23 ] 24 22 25 static constraints = { 23 26 name(unique: true) -
trunk/grails-app/taglib/dbnp/studycapturing/WizardTagLib.groovy
r341 r349 212 212 def addExampleElement = attrs.remove('addExampleElement') 213 213 def addExample2Element = attrs.remove('addExample2Element') 214 def helpText = help().trim() 214 215 215 216 // got an ajax onchange action? … … 243 244 out << ' <div class="input">' 244 245 out << renderedElement 245 if (help ()) {246 if (helpText.size() > 0) { 246 247 out << ' <div class="helpIcon"></div>' 247 248 } … … 272 273 273 274 // add help content if it is available 274 if (help ()) {275 if (helpText.size() > 0) { 275 276 out << ' <div class="helpContent">' 276 out << ' ' + help ()277 out << ' ' + helpText 277 278 out << ' </div>' 278 279 } 279 280 280 281 out << '</div>' 282 } 283 284 /** 285 * render an ajaxButtonElement 286 * @param Map attrs 287 * @param Closure body (help text) 288 */ 289 def ajaxButtonElement = { attrs, body -> 290 baseElement.call( 291 'ajaxButton', 292 attrs, 293 body 294 ) 281 295 } 282 296 … … 436 450 } 437 451 452 /** 453 * Ontology form element 454 * @param Map attributes 455 * @param Closure help content 456 */ 457 def ontologyElement = { attrs, body -> 458 // @see http://www.bioontology.org/wiki/index.php/NCBO_Widgets#Term-selection_field_on_a_form 459 // @see ontology-chooser.js, table-editor.js 460 baseElement.call( 461 'textField', 462 [ 463 name: attrs.name, 464 value: attrs.value, 465 description: attrs.description, 466 rel: 'ontology-' + ((attrs.ontology) ? attrs.ontology : 'all') + '-name', 467 size: 25 468 ], 469 body 470 ) 471 out << hiddenField( 472 name: attrs.name + '-concept_id' 473 ) 474 out << hiddenField( 475 name: attrs.name + '-ontology_id' 476 ) 477 out << hiddenField( 478 name: attrs.name + '-full_id' 479 ) 480 } 438 481 439 482 /** -
trunk/grails-app/views/wizard/pages/_subjects.gsp
r342 r349 23 23 </span> 24 24 25 <wizard:ajaxButton name="add" value="Add" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" afterSuccess="onWizardPage()" /> 26 <input name="addNumber" size="4" maxlength="4" value="1"> 27 subjects of species 28 <wizard:speciesSelect name="addSpecies" /> 29 using the 30 <wizard:templateSelect name="template" description="Template" value="${study?.template}" entity="${dbnp.studycapturing.Subject}" /> 31 template 25 <wizard:textFieldElement name="addNumber" description="Number of subjects to add" error="addNumber" value="1" size="4" maxlength="4"> 26 The number of subjects to add to your study 27 </wizard:textFieldElement> 28 <wizard:ontologyElement name="species" description="of species" value="" ontology="1132"> 29 The species of the subjects you would like to add to your study 30 </wizard:ontologyElement> 31 <wizard:templateElement name="template" description="with template" value="" error="template" entity="${dbnp.studycapturing.Subject}" > 32 The template to use for this study 33 </wizard:templateElement> 34 <wizard:ajaxButtonElement name="add" value="Add" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" afterSuccess="onWizardPage()"> 35 </wizard:ajaxButtonElement> 36 32 37 33 38 <g:if test="${subjects}"> -
trunk/web-app/css/wizard.min.css
r302 r349 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; height:18px;padding-top:20px;background-color:#EEE;}.wizard .tabs .element{background-color:#EEE;border-bottom:4px solid #006DBA;border-right:1px solid #006DBA;color:#006DBA;cursor:default;display:inline;font-size:10px;height:20px;margin:0;padding:20px 15px 0 15px;text-align:center;text-decoration:none;}.wizard .tabs .active{background-color:#add9ee;color:#fff;font-weight:bold;}.wizard .content{display:block;}.wizard .navigation{display:block;color:#666;font-size:10px;padding-top: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;}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;} -
trunk/web-app/js/ontology-chooser.js
r310 r349 24 24 * @package wizard 25 25 * @requires jquery, jquery-ui 26 * @see http:// www.bioontology.org/wiki/index.php/NCBO_Widgets#Term-selection_field_on_a_form26 * @see http://bioportal.bioontology.org/ontologies/ 27 27 * @see http://bioportal.bioontology.org/search/json_search/?q=musculus 28 28 * … … 35 35 } 36 36 OntologyChooser.prototype = { 37 minLength : 2, // minimum input length before launching Ajax request37 minLength : 3, // minimum input length before launching Ajax request 38 38 cache : [], // ontology cache 39 39 … … 68 68 inputElement.autocomplete({ 69 69 minLength: that.minLength, 70 delay: 300, 70 71 search: function(event, ui) { 71 72 selected = false; -
trunk/web-app/js/ontology-chooser.min.js
r310 r349 1 function OntologyChooser(){}OntologyChooser.prototype={minLength: 2,cache:[],init:function(){var a=this;$("input[rel*='ontology']").each(function(){a.initAutocomplete(this)})},initAutocomplete:function(d){var f=this;var g=$(d);var e=false;var c=g.attr("rel").split("-");var b=c[1];var a=c[2];if(b=="all"){b=""}g.autocomplete({minLength:f.minLength,search:function(h,i){e=false},source:function(j,h){var k=$.trim(j.term);var i="http://bioportal.bioontology.org/search/json_search/"+b+"?q="+j.term+"&response=json&callback=?";if(f.cache[k]){h(f.cache[k])}else{$.getJSON(i,function(m){var l=f.parseData(m.data);f.cache[k]=l;h(f.parseData(m.data))})}},select:function(i,j){e=true;var h=g;f.setInputValue(h,"concept_id",j.item.concept_id);f.setInputValue(h,"ontology_id",j.item.ontology_id);f.setInputValue(h,"full_id",j.item.full_id);h.removeClass("error")},close:function(i,j){if(!e){var h=g;g.val("");f.setInputValue(h,"concept_id","");f.setInputValue(h,"ontology_id","");f.setInputValue(h,"full_id","");h.addClass("error")}}})},setInputValue:function(e,c,d){var a=e.attr("name")+"-"+c;var b=e.parent().find("input[name='"+a+"']");if(b.size()>0){$(b[0]).val(d)}else{e.after('<input type="hidden" name="'+a+'" value="'+d+'"/>')}},parseData:function(d){var a=[];var c=d.split("~!~");for(var b=0;b<c.length;b++){var f=$.trim(c[b]);if(f){var e=f.split("|");a[a.length]={value:e[0],label:e[0]+' <span class="about">('+e[2]+')</span> <span class="from">from: '+e[(e.length-1)]+"</span>",preferred_name:e[0],concept_id:e[1],ontology_id:e[3],full_id:e[4]}}}return a}};1 function OntologyChooser(){}OntologyChooser.prototype={minLength:3,cache:[],init:function(){var a=this;$("input[rel*='ontology']").each(function(){a.initAutocomplete(this)})},initAutocomplete:function(d){var f=this;var g=$(d);var e=false;var c=g.attr("rel").split("-");var b=c[1];var a=c[2];if(b=="all"){b=""}g.autocomplete({minLength:f.minLength,delay:300,search:function(h,i){e=false},source:function(j,h){var k=$.trim(j.term);var i="http://bioportal.bioontology.org/search/json_search/"+b+"?q="+j.term+"&response=json&callback=?";if(f.cache[k]){h(f.cache[k])}else{$.getJSON(i,function(m){var l=f.parseData(m.data);f.cache[k]=l;h(f.parseData(m.data))})}},select:function(i,j){e=true;var h=g;f.setInputValue(h,"concept_id",j.item.concept_id);f.setInputValue(h,"ontology_id",j.item.ontology_id);f.setInputValue(h,"full_id",j.item.full_id);h.removeClass("error")},close:function(i,j){if(!e){var h=g;g.val("");f.setInputValue(h,"concept_id","");f.setInputValue(h,"ontology_id","");f.setInputValue(h,"full_id","");h.addClass("error")}}})},setInputValue:function(e,c,d){var a=e.attr("name")+"-"+c;var b=e.parent().find("input[name='"+a+"']");if(b.size()>0){$(b[0]).val(d)}else{e.after('<input type="hidden" name="'+a+'" value="'+d+'"/>')}},parseData:function(d){var a=[];var c=d.split("~!~");for(var b=0;b<c.length;b++){var f=$.trim(c[b]);if(f){var e=f.split("|");a[a.length]={value:e[0],label:e[0]+' <span class="about">('+e[2]+')</span> <span class="from">from: '+e[(e.length-1)]+"</span>",preferred_name:e[0],concept_id:e[1],ontology_id:e[3],full_id:e[4]}}}return a}};
Note: See TracChangeset
for help on using the changeset viewer.