Changeset 1171
- Timestamp:
- Nov 18, 2010, 3:20:10 PM (13 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/conf/Config.groovy
r1155 r1171 187 187 // @see ImporterController 188 188 importableEntities: [ 189 event: [name: 'Event', entity: 'dbnp.studycapturing.Event' ],190 sample: [name: 'Sample', entity: 'dbnp.studycapturing.Sample' ],191 study: [name: 'Study', entity: 'dbnp.studycapturing.Study' ],192 subject: [name: 'Subject', entity: 'dbnp.studycapturing.Subject' ],193 samplingevent: [name: 'SamplingEvent', entity: 'dbnp.studycapturing.SamplingEvent' ]189 event: [name: 'Event', entity: 'dbnp.studycapturing.Event', encrypted:''], 190 sample: [name: 'Sample', entity: 'dbnp.studycapturing.Sample', encrypted:''], 191 study: [name: 'Study', entity: 'dbnp.studycapturing.Study', encrypted:''], 192 subject: [name: 'Subject', entity: 'dbnp.studycapturing.Subject', encrypted:''], 193 samplingevent: [name: 'SamplingEvent', entity: 'dbnp.studycapturing.SamplingEvent', encrypted:''] 194 194 195 195 ] -
trunk/grails-app/controllers/dbnp/importer/ImporterController.groovy
r1165 r1171 29 29 import grails.plugins.springsecurity.Secured 30 30 31 import cr.co.arquetipos.crypto.Blowfish 32 31 33 @Secured(['IS_AUTHENTICATED_REMEMBERED']) 32 34 class ImporterController { … … 41 43 // should do a check what is in the url, strip it? 42 44 session.import_referer = params.redirectTo 45 46 grailsApplication.config.gscf.domain.importableEntities.each { 47 it.value.encrypted = 48 Blowfish.encryptBase64( 49 it.value.entity.toString().replaceAll(/^class /, ''), 50 grailsApplication.config.crypto.shared.secret 51 ) 52 } 53 43 54 render(view:"index_simple", 44 55 model:[studies:Study.findAllWhere(owner:AuthenticationService.getLoggedInUser()), … … 81 92 def wb = handleUpload('importfile') 82 93 def selectedentities = [] 83 def entity = grailsApplication.config.gscf.domain.importableEntities.get(params.entity).entity 84 def entityClass = Class.forName(entity, true, this.getClass().getClassLoader()) 85 94 //def entity = grailsApplication.config.gscf.domain.importableEntities.get(params.entity).entity 95 def entityName = Blowfish.decryptBase64( 96 params.entity, 97 grailsApplication.config.crypto.shared.secret 98 ) 99 100 def entityClass = Class.forName(entityName, true, this.getClass().getClassLoader()) 101 86 102 // Initialize some session variables 87 103 session.importer_workbook = wb 88 104 session.importer_study = Study.get(params.study.id.toInteger()) 89 105 90 106 // Is the current logged in user allowed to write to this study? 91 107 if (session.importer_study.canWrite(AuthenticationService.getLoggedInUser())) { … … 103 119 104 120 // Initialize 'selected entities', used to show entities above the columns 105 session.importer_header.each { 106 selectedentities.add([name: params.entity, columnindex:it.key.toInteger()])121 session.importer_header.each { 122 selectedentities.add([name:entityName, columnindex:it.key.toInteger()]) 107 123 } 108 124 … … 328 344 * @return JSON object containing the found templates 329 345 */ 330 def ajaxGetTemplatesByEntity = { 331 def entityClass = grailsApplication.config.gscf.domain.importableEntities.get(params.entity).entity 332 346 def ajaxGetTemplatesByEntity = { 347 def entityName = Blowfish.decryptBase64( 348 params.entity, 349 grailsApplication.config.crypto.shared.secret 350 ) 351 352 //def entityClass = grailsApplication.config.gscf.domain.importableEntities.get(params.entity).entity 353 def entityClass = entityName 333 354 334 355 // fetch all templates for a specific entity -
trunk/grails-app/services/dbnp/importer/ImporterService.groovy
r1164 r1171 345 345 break 346 346 case Event : break 347 case Sample : break 347 case Sample : 348 break 348 349 case SamplingEvent : break 349 350 default : // unknown entity -
trunk/grails-app/views/importer/common/_properties_horizontal.gsp
r1143 r1171 15 15 <g:form name="propertiesform" action="saveProperties"> 16 16 <table> 17 <g:each var="stdentity" in ="${standardentities}"> 18 19 <% if (selectedentities.any { it.name.toLowerCase() == stdentity.value.name.toLowerCase() } && stdentity.value.name!="") { %> 17 <g:each var="stdentity" in ="${standardentities}"> 18 <% if (selectedentities.any { it.name.toLowerCase() == stdentity.value.entity.toLowerCase() } && stdentity.value.entity!="") { %> 20 19 <tr><td colspan="2"><h4>${stdentity.value.name}</h4></td></tr> 21 20 <tr> 22 21 <g:each var="selentity" in="${selectedentities}"> 23 <g:if test="${selentity.name.toLowerCase()==stdentity.value. name.toLowerCase()}">22 <g:if test="${selentity.name.toLowerCase()==stdentity.value.entity.toLowerCase()}"> 24 23 <td class="header" width="200px"> 25 24 <b>${header[selentity.columnindex.toInteger()].name}</b> -
trunk/grails-app/views/importer/index_simple.gsp
r1148 r1171 35 35 var items = data 36 36 37 // If a study has been selected, don't show the "Choose study" field, otherwise do 38 if ($('#'+'entity ').val() == 'study')37 // If a study has been selected, don't show the "Choose study" field, otherwise do 38 if ($('#'+'entity :selected').text() == 'Study') 39 39 $('#studyfield').hide(); 40 40 else $('#studyfield').show(); 41 41 42 42 // set the entity name for the data template chooser 43 // alert ( "das" + $('select[name=template_id]').attr('entity'))43 //if ($('#'+'entity').val() == 'event') 44 44 45 45 //$('select[name=template_id]').attr('entity', $('#'+'entity').val()); 46 $('select[name=template_id]').attr('entity', $('#'+'entity').val()); 47 46 48 47 49 if (items) { … … 72 74 rel : 'typetemplate', 73 75 url : '/gscf/templateEditor', 74 vars : ' thentity', // can be a comma separated list of variable names to pass on76 vars : 'entity', // can be a comma separated list of variable names to pass on 75 77 label : 'add / modify ...', 76 78 style : 'modify', … … 162 164 from="${entities}" 163 165 optionValue="${{it.value.name}}" 164 optionKey=" key"166 optionKey="${{it.value.encrypted}}" 165 167 noSelection="['':'-Choose type of data-']" 166 168 onChange="${remoteFunction( controller: 'importer', … … 175 177 </td> 176 178 <td> 177 <g:select rel="typetemplate" entity=" hoi" name="template_id" optionKey="id" optionValue="name" from="[]" />179 <g:select rel="typetemplate" entity="none" name="template_id" optionKey="id" optionValue="name" from="[]" /> 178 180 </td> 179 181 </tr>
Note: See TracChangeset
for help on using the changeset viewer.