- Location:
- /trunk
- Files:
-
- 56 added
- 17 deleted
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
/trunk/doc/DatabaseDesign.tex
r20 r30 30 30 \subitem and ease of maintenance. 31 31 \item SVN and FTP/SSH for collaboration. 32 \item Django pythonweb framework.32 \item Grails web framework. 33 33 \item Architecture MVC 34 34 %TODO: -
/trunk/src/grails-app/conf/BootStrap.groovy
r20 r30 1 class BootStrap { 1 import grails.util.GrailsUtil 2 2 3 def init = { servletContext -> 3 class BootStrap 4 { 5 def init = { servletContext -> 4 6 5 //TypeOfPersonGroup 6 new TypeOfPersonGroup(name:"Department").save() 7 new TypeOfPersonGroup(name:"Contractor").save() 8 new TypeOfPersonGroup(name:"ProjectTeam").save() 9 10 //PersonGroup 11 new PersonGroup(typeOfPersonGroup:TypeOfPersonGroup.get(1), 12 name:"Electrical").save() 13 new PersonGroup(typeOfPersonGroup:TypeOfPersonGroup.get(2), 14 name:"Kewl AirCon Guys").save() 15 new PersonGroup(typeOfPersonGroup:TypeOfPersonGroup.get(3), 16 name:"openMim").save() 17 } 7 println "**** BootStrap; GrailsUtil.environment: ${GrailsUtil.environment}" 8 9 switch (GrailsUtil.environment) 10 { 11 case "development": 12 println "**** BootStrap detected development" 13 configureForDevelopment() 14 break 15 case "test": 16 println "**** BootStrap detected test" 17 configureForTest() 18 break 19 case "production": 20 println "**** BootStrap detected production" 21 configureForProduction() 22 break 23 } 24 25 } 18 26 19 27 def destroy = { 20 } 28 } 29 30 /* 31 Tasks to do when Grails is running in each environment. 32 */ 33 void configureForDevelopment() 34 { 35 println "BootStrap configureForDevelopment() called" 36 37 //TypeOfPersonGroup 38 new PersonGroupType(name:"Department").save() 39 new PersonGroupType(name:"Contractor").save() 40 new PersonGroupType(name:"ProjectTeam").save() 41 42 //PersonGroup 43 new PersonGroup(personGroupType:PersonGroupType.findByName("Department"), 44 name:"Electrical").save() 45 new PersonGroup(personGroupType:PersonGroupType.get(2), 46 name:"Kewl AirCon Guys").save() 47 new PersonGroup(personGroupType:PersonGroupType.get(3), 48 name:"openMim").save() 49 50 //Person 51 new Person(personGroup:PersonGroup.get(1), 52 firstName:"FirstNameTech1", 53 lastName:"LastNameTech1").save() 54 new Person(personGroup:PersonGroup.get(2), 55 firstName:"Joe", 56 lastName:"Samples").save() 57 58 //TaskGroup 59 new TaskGroup(name:"Engineering", 60 description:"Engineering task group").save() 61 new TaskGroup(name:"Production", 62 description:"Production task group").save() 63 new TaskGroup(name:"NewProject(s)", 64 description:" ").save() 65 66 67 //Task 68 new Task(taskGroup:TaskGroup.findByName("Engineering"), 69 person:Person.get(1), 70 name:"Check specific level sensor", 71 description:"Has been noted as problematic, try recallibrating", 72 scheduledDate: new Date(), 73 targetDate: new Date() ).save() 74 new Task(taskGroup:TaskGroup.findByName("Production"), 75 person:Person.get(2), 76 name:"Production Report", 77 description:"Production report for specific production run or shift", 78 scheduledDate: new Date(), 79 targetDate: new Date() ).save() 80 81 //EntryType 82 new EntryType(name:"Fault").save() 83 new EntryType(name:"WorkDone").save() 84 85 } 86 87 //--------------------------------------------------------- 88 void configureForTest() 89 { 90 println "BootStrap configureForTest() called" 91 } 92 93 //--------------------------------------------------------- 94 void configureForProduction() 95 { 96 println "BootStrap configureForProduction() called" 97 } 98 21 99 } -
/trunk/src/grails-app/controllers/EntryController.groovy
r20 r30 1 1 class EntryController { 2 3 def index = { redirect(action:list,params:params) } 2 4 3 def scaffold = Entry 5 // the delete, save and update actions only accept POST requests 6 def allowedMethods = [delete:'POST', save:'POST', update:'POST'] 7 8 def list = { 9 if(!params.max) params.max = 10 10 [ entryInstanceList: Entry.list( params ) ] 11 } 12 13 def show = { 14 def entryInstance = Entry.get( params.id ) 15 16 if(!entryInstance) { 17 flash.message = "Entry not found with id ${params.id}" 18 redirect(action:list) 19 } 20 else { return [ entryInstance : entryInstance ] } 21 } 22 23 def delete = { 24 def entryInstance = Entry.get( params.id ) 25 if(entryInstance) { 26 entryInstance.delete() 27 flash.message = "Entry ${params.id} deleted" 28 redirect(action:list) 29 } 30 else { 31 flash.message = "Entry not found with id ${params.id}" 32 redirect(action:list) 33 } 34 } 35 36 def edit = { 37 def entryInstance = Entry.get( params.id ) 38 39 if(!entryInstance) { 40 flash.message = "Entry not found with id ${params.id}" 41 redirect(action:list) 42 } 43 else { 44 return [ entryInstance : entryInstance ] 45 } 46 } 47 48 def update = { 49 def entryInstance = Entry.get( params.id ) 50 if(entryInstance) { 51 entryInstance.properties = params 52 if(!entryInstance.hasErrors() && entryInstance.save()) { 53 flash.message = "Entry ${params.id} updated" 54 redirect(action:show,id:entryInstance.id) 55 } 56 else { 57 render(view:'edit',model:[entryInstance:entryInstance]) 58 } 59 } 60 else { 61 flash.message = "Entry not found with id ${params.id}" 62 redirect(action:edit,id:params.id) 63 } 64 } 65 66 def create = { 67 def entryInstance = new Entry() 68 entryInstance.properties = params 69 return ['entryInstance':entryInstance] 70 } 71 72 def save = { 73 def entryInstance = new Entry(params) 74 if(!entryInstance.hasErrors() && entryInstance.save()) { 75 flash.message = "Entry ${entryInstance.id} created" 76 redirect(action:show,id:entryInstance.id) 77 } 78 else { 79 render(view:'create',model:[entryInstance:entryInstance]) 80 } 81 } 4 82 } -
/trunk/src/grails-app/controllers/ModificationController.groovy
r20 r30 1 1 class ModificationController { 2 3 def index = { redirect(action:list,params:params) } 2 4 3 def scaffold = Modification 5 // the delete, save and update actions only accept POST requests 6 def allowedMethods = [delete:'POST', save:'POST', update:'POST'] 7 8 def list = { 9 if(!params.max) params.max = 10 10 [ modificationInstanceList: Modification.list( params ) ] 11 } 12 13 def show = { 14 def modificationInstance = Modification.get( params.id ) 15 16 if(!modificationInstance) { 17 flash.message = "Modification not found with id ${params.id}" 18 redirect(action:list) 19 } 20 else { return [ modificationInstance : modificationInstance ] } 21 } 22 23 def delete = { 24 def modificationInstance = Modification.get( params.id ) 25 if(modificationInstance) { 26 modificationInstance.delete() 27 flash.message = "Modification ${params.id} deleted" 28 redirect(action:list) 29 } 30 else { 31 flash.message = "Modification not found with id ${params.id}" 32 redirect(action:list) 33 } 34 } 35 36 def edit = { 37 def modificationInstance = Modification.get( params.id ) 38 39 if(!modificationInstance) { 40 flash.message = "Modification not found with id ${params.id}" 41 redirect(action:list) 42 } 43 else { 44 return [ modificationInstance : modificationInstance ] 45 } 46 } 47 48 def update = { 49 def modificationInstance = Modification.get( params.id ) 50 if(modificationInstance) { 51 modificationInstance.properties = params 52 if(!modificationInstance.hasErrors() && modificationInstance.save()) { 53 flash.message = "Modification ${params.id} updated" 54 redirect(action:show,id:modificationInstance.id) 55 } 56 else { 57 render(view:'edit',model:[modificationInstance:modificationInstance]) 58 } 59 } 60 else { 61 flash.message = "Modification not found with id ${params.id}" 62 redirect(action:edit,id:params.id) 63 } 64 } 65 66 def create = { 67 def modificationInstance = new Modification() 68 modificationInstance.properties = params 69 return ['modificationInstance':modificationInstance] 70 } 71 72 def save = { 73 def modificationInstance = new Modification(params) 74 if(!modificationInstance.hasErrors() && modificationInstance.save()) { 75 flash.message = "Modification ${modificationInstance.id} created" 76 redirect(action:show,id:modificationInstance.id) 77 } 78 else { 79 render(view:'create',model:[modificationInstance:modificationInstance]) 80 } 81 } 4 82 } -
/trunk/src/grails-app/controllers/PersonController.groovy
r20 r30 1 1 class PersonController { 2 3 def index = { redirect(action:list,params:params) } 2 4 3 def scaffold = Person 5 // the delete, save and update actions only accept POST requests 6 def allowedMethods = [delete:'POST', save:'POST', update:'POST'] 7 8 def list = { 9 if(!params.max) params.max = 10 10 [ personInstanceList: Person.list( params ) ] 11 } 12 13 def show = { 14 def personInstance = Person.get( params.id ) 15 16 if(!personInstance) { 17 flash.message = "Person not found with id ${params.id}" 18 redirect(action:list) 19 } 20 else { return [ personInstance : personInstance ] } 21 } 22 23 def delete = { 24 def personInstance = Person.get( params.id ) 25 if(personInstance) { 26 personInstance.delete() 27 flash.message = "Person ${params.id} deleted" 28 redirect(action:list) 29 } 30 else { 31 flash.message = "Person not found with id ${params.id}" 32 redirect(action:list) 33 } 34 } 35 36 def edit = { 37 def personInstance = Person.get( params.id ) 38 39 if(!personInstance) { 40 flash.message = "Person not found with id ${params.id}" 41 redirect(action:list) 42 } 43 else { 44 return [ personInstance : personInstance ] 45 } 46 } 47 48 def update = { 49 def personInstance = Person.get( params.id ) 50 if(personInstance) { 51 personInstance.properties = params 52 if(!personInstance.hasErrors() && personInstance.save()) { 53 flash.message = "Person ${params.id} updated" 54 redirect(action:show,id:personInstance.id) 55 } 56 else { 57 render(view:'edit',model:[personInstance:personInstance]) 58 } 59 } 60 else { 61 flash.message = "Person not found with id ${params.id}" 62 redirect(action:edit,id:params.id) 63 } 64 } 65 66 def create = { 67 def personInstance = new Person() 68 personInstance.properties = params 69 return ['personInstance':personInstance] 70 } 71 72 def save = { 73 def personInstance = new Person(params) 74 if(!personInstance.hasErrors() && personInstance.save()) { 75 flash.message = "Person ${personInstance.id} created" 76 redirect(action:show,id:personInstance.id) 77 } 78 else { 79 render(view:'create',model:[personInstance:personInstance]) 80 } 81 } 4 82 } -
/trunk/src/grails-app/controllers/TaskController.groovy
r20 r30 1 1 class TaskController { 2 3 def index = { redirect(action:list,params:params) } 2 4 3 def scaffold = Task 5 // the delete, save and update actions only accept POST requests 6 def allowedMethods = [delete:'POST', save:'POST', update:'POST'] 7 8 def list = { 9 if(!params.max) params.max = 10 10 [ taskInstanceList: Task.list( params ) ] 11 } 12 13 def show = { 14 def taskInstance = Task.get( params.id ) 15 16 if(!taskInstance) { 17 flash.message = "Task not found with id ${params.id}" 18 redirect(action:list) 19 } 20 else { return [ taskInstance : taskInstance ] } 21 } 22 23 def delete = { 24 def taskInstance = Task.get( params.id ) 25 if(taskInstance) { 26 taskInstance.delete() 27 flash.message = "Task ${params.id} deleted" 28 redirect(action:list) 29 } 30 else { 31 flash.message = "Task not found with id ${params.id}" 32 redirect(action:list) 33 } 34 } 35 36 def edit = { 37 def taskInstance = Task.get( params.id ) 38 39 if(!taskInstance) { 40 flash.message = "Task not found with id ${params.id}" 41 redirect(action:list) 42 } 43 else { 44 return [ taskInstance : taskInstance ] 45 } 46 } 47 48 def update = { 49 def taskInstance = Task.get( params.id ) 50 if(taskInstance) { 51 taskInstance.properties = params 52 if(!taskInstance.hasErrors() && taskInstance.save()) { 53 flash.message = "Task ${params.id} updated" 54 redirect(action:show,id:taskInstance.id) 55 } 56 else { 57 render(view:'edit',model:[taskInstance:taskInstance]) 58 } 59 } 60 else { 61 flash.message = "Task not found with id ${params.id}" 62 redirect(action:edit,id:params.id) 63 } 64 } 65 66 def create = { 67 def taskInstance = new Task() 68 taskInstance.properties = params 69 return ['taskInstance':taskInstance] 70 } 71 72 def save = { 73 def taskInstance = new Task(params) 74 if(!taskInstance.hasErrors() && taskInstance.save()) { 75 flash.message = "Task ${taskInstance.id} created" 76 redirect(action:show,id:taskInstance.id) 77 } 78 else { 79 render(view:'create',model:[taskInstance:taskInstance]) 80 } 81 } 4 82 } -
/trunk/src/grails-app/controllers/TaskGroupController.groovy
r20 r30 1 1 class TaskGroupController { 2 3 def index = { redirect(action:list,params:params) } 2 4 3 def scaffold = TaskGroup 5 // the delete, save and update actions only accept POST requests 6 def allowedMethods = [delete:'POST', save:'POST', update:'POST'] 7 8 def list = { 9 if(!params.max) params.max = 10 10 [ taskGroupInstanceList: TaskGroup.list( params ) ] 11 } 12 13 def show = { 14 def taskGroupInstance = TaskGroup.get( params.id ) 15 16 if(!taskGroupInstance) { 17 flash.message = "TaskGroup not found with id ${params.id}" 18 redirect(action:list) 19 } 20 else { return [ taskGroupInstance : taskGroupInstance ] } 21 } 22 23 def delete = { 24 def taskGroupInstance = TaskGroup.get( params.id ) 25 if(taskGroupInstance) { 26 taskGroupInstance.delete() 27 flash.message = "TaskGroup ${params.id} deleted" 28 redirect(action:list) 29 } 30 else { 31 flash.message = "TaskGroup not found with id ${params.id}" 32 redirect(action:list) 33 } 34 } 35 36 def edit = { 37 def taskGroupInstance = TaskGroup.get( params.id ) 38 39 if(!taskGroupInstance) { 40 flash.message = "TaskGroup not found with id ${params.id}" 41 redirect(action:list) 42 } 43 else { 44 return [ taskGroupInstance : taskGroupInstance ] 45 } 46 } 47 48 def update = { 49 def taskGroupInstance = TaskGroup.get( params.id ) 50 if(taskGroupInstance) { 51 taskGroupInstance.properties = params 52 if(!taskGroupInstance.hasErrors() && taskGroupInstance.save()) { 53 flash.message = "TaskGroup ${params.id} updated" 54 redirect(action:show,id:taskGroupInstance.id) 55 } 56 else { 57 render(view:'edit',model:[taskGroupInstance:taskGroupInstance]) 58 } 59 } 60 else { 61 flash.message = "TaskGroup not found with id ${params.id}" 62 redirect(action:edit,id:params.id) 63 } 64 } 65 66 def create = { 67 def taskGroupInstance = new TaskGroup() 68 taskGroupInstance.properties = params 69 return ['taskGroupInstance':taskGroupInstance] 70 } 71 72 def save = { 73 def taskGroupInstance = new TaskGroup(params) 74 if(!taskGroupInstance.hasErrors() && taskGroupInstance.save()) { 75 flash.message = "TaskGroup ${taskGroupInstance.id} created" 76 redirect(action:show,id:taskGroupInstance.id) 77 } 78 else { 79 render(view:'create',model:[taskGroupInstance:taskGroupInstance]) 80 } 81 } 4 82 } -
/trunk/src/grails-app/domain/Entry.groovy
r20 r30 2 2 Person person 3 3 Task task 4 Date dateTime 4 EntryType entryType 5 Date date 5 6 Integer duration 6 7 String comments … … 8 9 static hasMany = [persons: Person] 9 10 10 static belongsTo = [ TypeOfEntry, Task, Person]11 static belongsTo = [EntryType, Task, Person] 11 12 12 13 static constraints = { 13 person(blank:false) 14 task(blank:false) 15 dateTime(nullable:true) 16 duration(nullable:true) 17 comments(maxLength:500) 14 comments(maxSize:500) 18 15 } 19 16 } -
/trunk/src/grails-app/domain/Modification.groovy
r20 r30 1 1 class Modification { 2 2 Person person 3 TypeOfModification typeOfModification3 ModificationType modificationType 4 4 Task task 5 5 Date dateTime 6 6 String comments 7 7 8 static belongsTo = [Person, TypeOfModification, Task]8 static belongsTo = [Person, ModificationType, Task] 9 9 10 10 static constraints = { 11 11 person() 12 typeOfModification()12 modificationType() 13 13 task() 14 14 dateTime() -
/trunk/src/grails-app/domain/Person.groovy
r20 r30 7 7 8 8 static hasMany = [modifications : Modification, 9 entries : Entry, tasks : Task, 9 entries : Entry, 10 tasks : Task, 10 11 personGroups : PersonGroup] 11 12 -
/trunk/src/grails-app/domain/PersonGroup.groovy
r20 r30 1 1 class PersonGroup { 2 TypeOfPersonGroup typeOfPersonGroup2 PersonGroupType personGroupType 3 3 String name 4 4 String description = "" … … 7 7 static hasMany = [persons : Person] 8 8 9 static belongsTo = TypeOfPersonGroup9 static belongsTo = PersonGroup 10 10 11 11 String toString() { -
/trunk/src/grails-app/domain/TaskGroup.groovy
r20 r30 2 2 String name 3 3 String description 4 boolean isActive 4 boolean isActive = true 5 5 6 6 static hasMany = [tasks : Task] -
/trunk/src/grails-app/views/layouts/main.gsp
r20 r30 1 1 <html> 2 2 <head> 3 <title><g:layoutTitle default=" Grails" /></title>3 <title><g:layoutTitle default="openMim" /></title> 4 4 <link rel="stylesheet" href="${createLinkTo(dir:'css',file:'main.css')}" /> 5 <link rel="shortcut icon" href="${createLinkTo(dir:'images',file:' favicon.ico')}" type="image/x-icon" />5 <link rel="shortcut icon" href="${createLinkTo(dir:'images',file:'gnuMimsIcon.ico')}" type="image/x-icon" /> 6 6 <g:layoutHead /> 7 7 <g:javascript library="application" /> … … 11 11 <img src="${createLinkTo(dir:'images',file:'spinner.gif')}" alt="Spinner" /> 12 12 </div> 13 <div class="logo"><img src="${createLinkTo(dir:'images',file:'g rails_logo.jpg')}" alt="Grails" /></div>13 <div class="logo"><img src="${createLinkTo(dir:'images',file:'gnuMimsLogo.jpg')}" alt="openMim" /></div> 14 14 <g:layoutBody /> 15 15 </body> -
/trunk/src/grails-app/views/personGroup/create.gsp
r20 r30 56 56 <tr class="prop"> 57 57 <td valign="top" class="name"> 58 <label for=" typeOfPersonGroup">Type Of Person Group:</label>58 <label for="personGroupType">Person Group Type:</label> 59 59 </td> 60 <td valign="top" class="value ${hasErrors(bean:personGroupInstance,field:' typeOfPersonGroup','errors')}">61 <g:select optionKey="id" from="${ TypeOfPersonGroup.list()}" name="typeOfPersonGroup.id" value="${personGroupInstance?.typeOfPersonGroup?.id}" ></g:select>60 <td valign="top" class="value ${hasErrors(bean:personGroupInstance,field:'personGroupType','errors')}"> 61 <g:select optionKey="id" from="${PersonGroupType.list()}" name="personGroupType.id" value="${personGroupInstance?.personGroupType?.id}" ></g:select> 62 62 </td> 63 63 </tr> -
/trunk/src/grails-app/views/personGroup/edit.gsp
r20 r30 58 58 <tr class="prop"> 59 59 <td valign="top" class="name"> 60 <label for="personGroupType">Person Group Type:</label> 61 </td> 62 <td valign="top" class="value ${hasErrors(bean:personGroupInstance,field:'personGroupType','errors')}"> 63 <g:select optionKey="id" from="${PersonGroupType.list()}" name="personGroupType.id" value="${personGroupInstance?.personGroupType?.id}" ></g:select> 64 </td> 65 </tr> 66 67 <tr class="prop"> 68 <td valign="top" class="name"> 60 69 <label for="persons">Persons:</label> 61 70 </td> … … 72 81 </tr> 73 82 74 <tr class="prop">75 <td valign="top" class="name">76 <label for="typeOfPersonGroup">Type Of Person Group:</label>77 </td>78 <td valign="top" class="value ${hasErrors(bean:personGroupInstance,field:'typeOfPersonGroup','errors')}">79 <g:select optionKey="id" from="${TypeOfPersonGroup.list()}" name="typeOfPersonGroup.id" value="${personGroupInstance?.typeOfPersonGroup?.id}" ></g:select>80 </td>81 </tr>82 83 83 </tbody> 84 84 </table> -
/trunk/src/grails-app/views/personGroup/list.gsp
r20 r30 30 30 <g:sortableColumn property="name" title="Name" /> 31 31 32 <th> Type Of Person Group</th>32 <th>Person Group Type</th> 33 33 34 34 </tr> … … 46 46 <td>${fieldValue(bean:personGroupInstance, field:'name')}</td> 47 47 48 <td>${fieldValue(bean:personGroupInstance, field:' typeOfPersonGroup')}</td>48 <td>${fieldValue(bean:personGroupInstance, field:'personGroupType')}</td> 49 49 50 50 </tr> -
/trunk/src/grails-app/views/personGroup/show.gsp
r20 r30 52 52 53 53 <tr class="prop"> 54 <td valign="top" class="name">Person s:</td>54 <td valign="top" class="name">Person Group Type:</td> 55 55 56 <td valign="top" class="value"> ${fieldValue(bean:personGroupInstance, field:'persons')}</td>56 <td valign="top" class="value"><g:link controller="personGroupType" action="show" id="${personGroupInstance?.personGroupType?.id}">${personGroupInstance?.personGroupType?.encodeAsHTML()}</g:link></td> 57 57 58 58 </tr> 59 59 60 60 <tr class="prop"> 61 <td valign="top" class="name"> Type Of Person Group:</td>61 <td valign="top" class="name">Persons:</td> 62 62 63 <td valign="top" class="value"> <g:link controller="typeOfPersonGroup" action="show" id="${personGroupInstance?.typeOfPersonGroup?.id}">${personGroupInstance?.typeOfPersonGroup?.encodeAsHTML()}</g:link></td>63 <td valign="top" class="value">${fieldValue(bean:personGroupInstance, field:'persons')}</td> 64 64 65 65 </tr> -
/trunk/src/web-app/index.gsp
r20 r30 1 1 <html> 2 2 <head> 3 <title>Welcome to Grails</title>3 <title>Welcome to openMim</title> 4 4 <meta name="layout" content="main" /> 5 5 </head> 6 6 <body> 7 <h1 style="margin-left:20px;">Welcome to Grails</h1> 8 <p style="margin-left:20px;width:80%">Congratulations, you have successfully started your first Grails application! At the moment 9 this is the default page, feel free to modify it to either redirect to a controller or display whatever 10 content you may choose. Below is a list of controllers that are currently deployed in this application, 11 click on each to execute its default action:</p> 7 <h1 style="margin-left:20px;">Welcome to openMim</h1> 8 <p style="margin-left:20px;width:80%"> 9 Home 10 </p> 12 11 <div class="dialog" style="margin-left:20px;width:60%;"> 13 12 <ul>
Note: See TracChangeset
for help on using the changeset viewer.