Ignore:
Timestamp:
Nov 18, 2010, 3:20:10 PM (6 years ago)
Author:
t.w.abma@…
Message:
  • added add / modify to date template chooser
  • added some JS to handle select boxes, when choosing study the study chooser dropdown disappears
  • added encryption to select box, necessary to let the template add/remove popup work correctly
  • added "encrypted" variable to Config, used by the date template dropdown
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/importer/ImporterController.groovy

    r1165 r1171  
    2929import grails.plugins.springsecurity.Secured
    3030
     31import cr.co.arquetipos.crypto.Blowfish
     32
    3133@Secured(['IS_AUTHENTICATED_REMEMBERED'])
    3234class ImporterController {
     
    4143        // should do a check what is in the url, strip it?
    4244        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
    4354        render(view:"index_simple",
    4455               model:[studies:Study.findAllWhere(owner:AuthenticationService.getLoggedInUser()),
     
    8192        def wb = handleUpload('importfile')
    8293        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       
    86102        // Initialize some session variables
    87103        session.importer_workbook = wb
    88104        session.importer_study = Study.get(params.study.id.toInteger())
    89        
     105
    90106        // Is the current logged in user allowed to write to this study?
    91107        if (session.importer_study.canWrite(AuthenticationService.getLoggedInUser())) {
     
    103119       
    104120            // 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()])
    107123            }
    108124
     
    328344    * @return JSON object containing the found templates
    329345    */
    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
    333354
    334355        // fetch all templates for a specific entity
Note: See TracChangeset for help on using the changeset viewer.