Changeset 1489
- Timestamp:
- Feb 3, 2011, 5:07:42 PM (10 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/dbnp/importer/ImporterController.groovy
r1472 r1489 111 111 112 112 on("refresh") { 113 flash.importer_params = params 113 flash.importer_params = params 114 114 success() 115 115 }.to "pageOne" … … 251 251 render(view: "_error") 252 252 onRender { 253 254 253 // Grom a development message 255 254 if (pluginManager.getGrailsPlugin('grom')) ".rendering the partial pages/_error.gsp".grom() … … 267 266 render(view: "_final_page") 268 267 onRender { 269 println "EEN"270 268 // Grom a development message 271 269 if (pluginManager.getGrailsPlugin('grom')) ".rendering the partial pages/_final_page.gsp".grom() 272 println "TWEE" 273 274 success() 275 println "DRIE" 270 success() 276 271 } 277 272 onEnd { … … 422 417 flow.importer_importeddata.each { table -> 423 418 table.each { entity -> 424 def invalid ontologies = 0419 def invalidfields = 0 425 420 426 421 // Set the fields for this entity by retrieving values from the params … … 430 425 params["entity_" + entity.getIdentifier() + "_" + field.escapedName()] == "#invalidterm" 431 426 ) { 432 invalid ontologies++427 invalidfields++ 433 428 } else 434 429 if (field.type == org.dbnp.gdt.TemplateFieldType.ONTOLOGYTERM && 435 430 params["entity_" + entity.getIdentifier() + "_" + field.escapedName()] != "#invalidterm") { 436 removeFailedCell(flow.importer_failedcells, entity) 431 if (entity) removeFailedCell(flow.importer_failedcells, entity, field) 432 println "removedcellontology" + entity 437 433 entity.setFieldValue(field.toString(), params["entity_" + entity.getIdentifier() + "_" + field.escapedName()]) 438 434 } 439 435 else 436 437 if (field.type == org.dbnp.gdt.TemplateFieldType.STRINGLIST && 438 params["entity_" + entity.getIdentifier() + "_" + field.escapedName()] != "#invalidterm") { 439 if (entity) removeFailedCell(flow.importer_failedcells, entity, field) 440 println "removedcellstringlist" + entity.getIdentifier() 441 entity.setFieldValue(field.toString(), params["entity_" + entity.getIdentifier() + "_" + field.escapedName()]) 442 } else 443 if (field.type == org.dbnp.gdt.TemplateFieldType.STRINGLIST && 444 params["entity_" + entity.getIdentifier() + "_" + field.escapedName()] == "#invalidterm" 445 ) { 446 invalidfields++ 447 } else 448 440 449 entity.setFieldValue(field.toString(), params["entity_" + entity.getIdentifier() + "_" + field.escapedName()]) 441 450 } … … 447 456 448 457 // Try to validate the entity now all fields have been set 449 if (!entity.validate() || invalid ontologies) {458 if (!entity.validate() || invalidfields) { 450 459 flow.importer_invalidentities++ 451 460 … … 463 472 } // end of table 464 473 474 println "invalidentities="+flow.importer_invalidentities 475 465 476 return (flow.importer_invalidentities == 0) ? true : false 466 477 } // end of method … … 470 481 * @param entity entity to remove from the failedcells list 471 482 */ 472 def removeFailedCell(failedcells, entity ) {483 def removeFailedCell(failedcells, entity, field) { 473 484 // Valid entity, remove it from failedcells 474 485 failedcells.each { record -> … … 476 487 477 488 record.importcells.each { cell -> 489 // println "cell_entity=" + cell.value 490 // println "fieldname=" + field.name 491 478 492 // remove the cell from the failed cells session 479 493 if (cell.entityidentifier != entity.getIdentifier()) { -
trunk/grails-app/services/dbnp/importer/ImporterService.groovy
r1471 r1489 323 323 if (!study.save(flush: true)) { 324 324 //this.appendErrors(flow.study, flash.wizardErrors) 325 throw new Exception(' errorsaving study')325 throw new Exception('.importer wizard [saveDatamatrix] error while saving study') 326 326 } 327 327 } else { 328 throw new Exception(' study does not validate')328 throw new Exception('.importer wizard [saveDatamatrix] study does not validate') 329 329 } 330 330 -
trunk/grails-app/views/importer/common/_missingproperties.gsp
r1467 r1489 18 18 <g:each in="${importer_failedcells}" var="record"> 19 19 <g:each in="${record.importcells}" var="cell"> 20 var element = $("select[name=entity_${cell.entityidentifier}_${cell.mappingcolumn.property }]");20 var element = $("select[name=entity_${cell.entityidentifier}_${cell.mappingcolumn.property.toLowerCase()}]"); 21 21 22 22 element.addClass('error') -
trunk/grails-app/views/importer/common/_on_page.gsp
r1486 r1489 93 93 // handle template selects 94 94 new SelectAddMore().init({ 95 rel : 't ypetemplate',95 rel : 'template', 96 96 url : baseUrl + '/templateEditor', 97 97 vars : 'entity', // can be a comma separated list of variable names to pass on … … 99 99 style : 'modify', 100 100 onClose : function(scope) { 101 location.reload();101 refreshFlow() 102 102 } 103 103 }); -
trunk/grails-app/views/importer/index.gsp
r1486 r1489 28 28 <script type="text/javascript" src="${resource(dir: 'js', file: 'ontology-chooser.min.js', plugin: 'gdt')}"></script> 29 29 <script type="text/javascript" src="${resource(dir: 'js', file: 'table-editor.js', plugin: 'gdt')}"></script> 30 <script type="text/javascript" src="${resource(dir: 'js', file: 'importer.js')}"></script>31 30 <script type="text/javascript" src="${resource(dir: 'js', file: 'tooltips.js', plugin: 'gdt')}"></script> 32 31 </g:if><g:else> … … 36 35 <script type="text/javascript" src="${resource(dir: 'js', file: 'ontology-chooser.js', plugin: 'gdt')}"></script> 37 36 <script type="text/javascript" src="${resource(dir: 'js', file: 'table-editor.js', plugin: 'gdt')}"></script> 38 <script type="text/javascript" src="${resource(dir: 'js', file: 'importer.js')}"></script>39 37 <script type="text/javascript" src="${resource(dir: 'js', file: 'tooltips.js', plugin: 'gdt')}"></script> 40 38 </g:else> -
trunk/grails-app/views/importer/pages/_page_one.gsp
r1470 r1489 82 82 </td> 83 83 <td> 84 <g:select rel="t ypetemplate" entity="none" name="template_id" optionKey="id" optionValue="name" from="[]" value="${importer_params?.template_id}"/>84 <g:select rel="template" entity="none" name="template_id" optionKey="id" optionValue="name" from="[]" value="${importer_params?.template_id}"/> 85 85 </td> 86 86 </tr>
Note: See TracChangeset
for help on using the changeset viewer.