Changeset 440 for trunk/grails-app/controllers
- Timestamp:
- Mar 16, 2010, 11:33:22 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/PersonController.groovy
r403 r440 1 1 import org.codehaus.groovy.grails.plugins.springsecurity.Secured 2 import org.codehaus.groovy.grails.commons.ConfigurationHolder 2 3 3 4 @Secured(['ROLE_Manager','ROLE_AppAdmin']) 4 5 class PersonController extends BaseAppAdminController { 5 6 7 def filterService 8 def personCsvService 6 9 def authenticateService 7 def filterService8 10 9 11 // the delete, save and update actions only accept POST requests … … 12 14 def index = { 13 15 redirect action: list, params: params 16 } 17 18 /** 19 * Disaply the import view. 20 */ 21 def importPersons = { 22 } 23 24 /** 25 * Handle the import save. 26 */ 27 def importPersonsSave = { 28 def result = personCsvService.importPersons(request) 29 30 if(!result.error) { 31 response.contentType = ConfigurationHolder.config.grails.mime.types["text"] 32 response.setHeader("Content-disposition", "attachment; filename=LoginNamesAndPasswords.txt") 33 render result.loginNamesAndPasswords 34 return 35 } 36 37 flash.errorMessage = g.message(code: result.error.code, args: result.error.args) 38 redirect(action: importPersons) 39 } 40 41 /** 42 * Export a csv template. 43 * NOTE: IE has a 'validating' bug in dev mode that causes the export to take a long time! 44 * This does not appear to be a problem once deployed to Tomcat. 45 */ 46 def exportPersonsTemplate = { 47 response.contentType = ConfigurationHolder.config.grails.mime.types["csv"] 48 response.setHeader("Content-disposition", "attachment; filename=personsTemplate.csv") 49 def s = personCsvService.buildPersonsTemplate() 50 render s 14 51 } 15 52
Note: See TracChangeset
for help on using the changeset viewer.