Changeset 40
- Timestamp:
- Oct 29, 2009, 5:46:11 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/conf/DataSource.groovy
r16 r40 12 12 // environment specific settings 13 13 environments { 14 14 development { 15 15 dataSource { 16 16 dbCreate = "create-drop" // one of 'create', 'create-drop','update' … … 18 18 } 19 19 } 20 20 test { 21 21 dataSource { 22 22 dbCreate = "update" … … 26 26 production { 27 27 dataSource { 28 dbCreate = "update" 29 url = "jdbc:hsqldb:file:prodDb;shutdown=true" 28 // create a database first called gscf, add a user nmc with password nmcdsp and grant him all rights to nmc_dsp_tno 29 // $ mysql --user=root 30 // mysql> create database nmc_dsp_tno; 31 // mysql> use nmc_dsp_tno; 32 // mysql> grant all on nmc_dsp_tno.* to nmc@localhost identified by 'nmcdsp'; 33 // mysql> flush privileges; 34 // mysql> exit 35 // $ mysql --user=nmc -p --database=nmc_dsp_tno 36 37 driverClassName = "com.mysql.jdbc.Driver" 38 dbCreate = "update" 39 username = "gscf" 40 password = "dbnp" 41 url = "jdbc:mysql://localhost/gscf" 42 43 //dbCreate = "update" 44 //url = "jdbc:hsqldb:file:prodDb;shutdown=true" 30 45 } 31 46 } -
trunk/grails-app/conf/NimbleBootStrap.groovy
r37 r40 16 16 */ 17 17 18 import org.codehaus.groovy.grails.commons.GrailsApplication 19 import grails.util.GrailsUtil 18 20 19 21 import intient.nimble.InstanceGenerator … … 47 49 // Execute any custom Nimble related BootStrap for your application below 48 50 49 // Create example User account 50 def user = InstanceGenerator.user() 51 user.username = "user" 52 user.pass = 'useR123!' 53 user.passConfirm = 'useR123!' 54 user.enabled = true 51 if ( GrailsUtil.getEnvironment().equals(GrailsApplication.ENV_DEVELOPMENT)) { 55 52 56 def userProfile = InstanceGenerator.profile() 57 userProfile.fullName = "Test User" 58 userProfile.owner = user 59 user.profile = userProfile 53 // Create example User account 54 def user = InstanceGenerator.user() 55 user.username = "user" 56 user.pass = 'useR123!' 57 user.passConfirm = 'useR123!' 58 user.enabled = true 60 59 61 def savedUser = userService.createUser(user) 62 if (savedUser.hasErrors()) { 63 savedUser.errors.each { 64 log.error(it) 65 } 66 throw new RuntimeException("Error creating example user") 60 def userProfile = InstanceGenerator.profile() 61 userProfile.fullName = "Test User" 62 userProfile.owner = user 63 user.profile = userProfile 64 65 def savedUser = userService.createUser(user) 66 if (savedUser.hasErrors()) { 67 savedUser.errors.each { 68 log.error(it) 69 } 70 throw new RuntimeException("Error creating example user") 71 } 72 73 // Create example Administrative account 74 def admins = Role.findByName(AdminsService.ADMIN_ROLE) 75 def admin = InstanceGenerator.user() 76 admin.username = "admin" 77 admin.pass = "admiN123!" 78 admin.passConfirm = "admiN123!" 79 admin.enabled = true 80 81 def adminProfile = InstanceGenerator.profile() 82 adminProfile.fullName = "Administrator" 83 adminProfile.owner = admin 84 admin.profile = adminProfile 85 86 def savedAdmin = userService.createUser(admin) 87 if (savedAdmin.hasErrors()) { 88 savedAdmin.errors.each { 89 log.error(it) 90 } 91 throw new RuntimeException("Error creating administrator") 92 } 93 94 adminsService.add(admin) 95 67 96 } 68 97 69 // Create example Administrative account70 def admins = Role.findByName(AdminsService.ADMIN_ROLE)71 def admin = InstanceGenerator.user()72 admin.username = "admin"73 admin.pass = "admiN123!"74 admin.passConfirm = "admiN123!"75 admin.enabled = true76 77 def adminProfile = InstanceGenerator.profile()78 adminProfile.fullName = "Administrator"79 adminProfile.owner = admin80 admin.profile = adminProfile81 82 def savedAdmin = userService.createUser(admin)83 if (savedAdmin.hasErrors()) {84 savedAdmin.errors.each {85 log.error(it)86 }87 throw new RuntimeException("Error creating administrator")88 }89 90 adminsService.add(admin)91 98 } 92 99 -
trunk/grails-app/controllers/StudyController.groovy
r39 r40 1 class StudyController extends BaseController { 1 2 2 3 class StudyController extends BaseController { 4 5 def index = { redirect(action:list,params:params) } 6 7 // the delete, save and update actions only accept POST requests 8 static allowedMethods = [delete:'POST', save:'POST', update:'POST'] 9 10 def list = { 11 params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) 12 [ studyInstanceList: Study.list( params ), studyInstanceTotal: Study.count() ] 13 } 14 15 def show = { 16 def studyInstance = Study.get( params.id ) 17 18 if(!studyInstance) { 19 flash.message = "Study not found with id ${params.id}" 20 redirect(action:list) 21 } 22 else { return [ studyInstance : studyInstance ] } 23 } 24 25 def delete = { 26 def studyInstance = Study.get( params.id ) 27 if(studyInstance) { 28 try { 29 studyInstance.delete(flush:true) 30 flash.message = "Study ${params.id} deleted" 31 redirect(action:list) 32 } 33 catch(org.springframework.dao.DataIntegrityViolationException e) { 34 flash.message = "Study ${params.id} could not be deleted" 35 redirect(action:show,id:params.id) 36 } 37 } 38 else { 39 flash.message = "Study not found with id ${params.id}" 40 redirect(action:list) 41 } 42 } 43 44 def edit = { 45 def studyInstance = Study.get( params.id ) 46 47 if(!studyInstance) { 48 flash.message = "Study not found with id ${params.id}" 49 redirect(action:list) 50 } 51 else { 52 return [ studyInstance : studyInstance ] 53 } 54 } 55 56 def update = { 57 def studyInstance = Study.get( params.id ) 58 if(studyInstance) { 59 if(params.version) { 60 def version = params.version.toLong() 61 if(studyInstance.version > version) { 62 63 studyInstance.errors.rejectValue("version", "study.optimistic.locking.failure", "Another user has updated this Study while you were editing.") 64 render(view:'edit',model:[studyInstance:studyInstance]) 65 return 66 } 67 } 68 studyInstance.properties = params 69 if(!studyInstance.hasErrors() && studyInstance.save()) { 70 flash.message = "Study ${params.id} updated" 71 redirect(action:show,id:studyInstance.id) 72 } 73 else { 74 render(view:'edit',model:[studyInstance:studyInstance]) 75 } 76 } 77 else { 78 flash.message = "Study not found with id ${params.id}" 79 redirect(action:list) 80 } 81 } 82 83 def create = { 84 def studyInstance = new Study() 85 studyInstance.properties = params 86 return ['studyInstance':studyInstance] 87 } 88 89 def save = { 90 def studyInstance = new Study(params) 91 if(!studyInstance.hasErrors() && studyInstance.save()) { 92 flash.message = "Study ${studyInstance.id} created" 93 redirect(action:show,id:studyInstance.id) 94 } 95 else { 96 render(view:'create',model:[studyInstance:studyInstance]) 97 } 98 } 3 def scaffold = true 99 4 } -
trunk/grails-app/domain/Experiment.groovy
r31 r40 17 17 Date created 18 18 Date modified 19 Integer Study19 Study study 20 20 21 21 static constraints = { -
trunk/grails-app/domain/Study.groovy
r35 r40 18 18 String researchQuestion 19 19 Date startDate 20 IntegerecCode20 String ecCode 21 21 Date created 22 22 Date modified 23 gscf.User owner 23 24 24 25 static constraints = { -
trunk/grails-app/views/index.gsp
r39 r40 4 4 <meta name="layout" content="main" /> 5 5 <g:javascript library="jquery"/> 6 <link rel="stylesheet" href="${createLinkTo(dir:'css/jquery-ui', file: 'jquery-ui-1.7.2.custom.css')}" >6 <link rel="stylesheet" href="${createLinkTo(dir:'css/jquery-ui', file: 'jquery-ui-1.7.2.custom.css')}"/> 7 7 <script src="${createLinkTo(dir: 'js', file: 'jquery-ui-1.7.2.custom.min.js')}" type="text/javascript"></script> 8 8 <script type="text/javascript"> 9 9 $(function() { 10 $("#accordion").accordion();11 10 $("#tabs").tabs(); 12 11 });
Note: See TracChangeset
for help on using the changeset viewer.