Changeset 40 for trunk


Ignore:
Timestamp:
Jan 29, 2009, 8:31:15 PM (15 years ago)
Author:
gav
Message:

Added login page and adjusted Person domain/views/controller and BootStrap?.
Add beforeInterceptor() to all controllers.
Added BaseController?.
Added adminmenubar adjust layout and css to suite.

Location:
trunk/src
Files:
4 added
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/grails-app/conf/BootStrap.groovy

    r39 r40  
    4444        //Person
    4545        new Person(personGroup:PersonGroup.get(1),
    46                    firstName:"Craig",
    47                    lastName:"SuperTech").save()
     46            firstName:"Admin",
     47            lastName:"Powers",
     48            userId:"admin",
     49            password:"pass").save()
     50        new Person(personGroup:PersonGroup.get(1),
     51            firstName:"User",
     52            lastName:"Tester",
     53            userId:"user",
     54            password:"pass").save()
     55        new Person(personGroup:PersonGroup.get(1),
     56            firstName:"Craig",
     57            lastName:"SuperTech",
     58            userId:"craig",
     59            password:"pass").save()
    4860        new Person(personGroup:PersonGroup.get(2),
    49                    firstName:"Joe",
    50                    lastName:"Samples").save()
     61            firstName:"Joe",
     62            lastName:"Samples",
     63            userId:"joe",
     64            password:"pass").save()
    5165        new Person(personGroup:PersonGroup.get(1),
    52                    firstName:"Production",
    53                    lastName:"Mann").save()
     66            firstName:"Production",
     67            lastName:"Mann",
     68            userId:"Mann",
     69            password:"pass").save()
    5470               
    5571        //TaskGroup
     
    6480        //Task
    6581        new Task(taskGroup:TaskGroup.findByName("Engineering"),
    66                  person:Person.get(1),
     82                 person:Person.get(3),
    6783                 name:"Check specific level sensor",
    6884                 description:"Has been noted as problematic, try recallibrating",
     
    7086                 targetDate: new Date() ).save()
    7187        new Task(taskGroup:TaskGroup.findByName("Production"),
    72                  person:Person.get(2),
     88                 person:Person.get(5),
    7389                 name:"Production Report",
    7490                 description:"Production report for specific production run or shift",
     91                 scheduledDate: new Date(),
     92                 targetDate: new Date() ).save()
     93        new Task(taskGroup:TaskGroup.findByName("NewProject(s)"),
     94                 person:Person.get(1),
     95                 name:"Make killer CMMS app",
     96                 description:"Use Grails and get a move on!",
    7597                 scheduledDate: new Date(),
    7698                 targetDate: new Date() ).save()
  • trunk/src/grails-app/controllers/EntryController.groovy

    r21 r40  
    1 class EntryController {
    2    
     1class EntryController extends BaseController {
     2
     3    def beforeInterceptor = [action:this.&auth]
     4
    35    def index = { redirect(action:list,params:params) }
    46
  • trunk/src/grails-app/controllers/EntryTypeController.groovy

    r21 r40  
    1 class EntryTypeController {
    2    
     1class EntryTypeController extends BaseController {
     2
     3    def beforeInterceptor = [action:this.&auth]
     4
    35    def index = { redirect(action:list,params:params) }
    46
  • trunk/src/grails-app/controllers/ModificationController.groovy

    r21 r40  
    1 class ModificationController {
    2    
     1class ModificationController extends BaseController {
     2
     3    def beforeInterceptor = [action:this.&auth]
     4
    35    def index = { redirect(action:list,params:params) }
    46
  • trunk/src/grails-app/controllers/ModificationTypeController.groovy

    r21 r40  
    1 class ModificationTypeController {
    2    
     1class ModificationTypeController extends BaseController {
     2
     3    def beforeInterceptor = [action:this.&auth]
     4
    35    def index = { redirect(action:list,params:params) }
    46
  • trunk/src/grails-app/controllers/PersonController.groovy

    r21 r40  
    1 class PersonController {
    2    
     1class PersonController extends BaseController {
     2
     3    def beforeInterceptor = [action:this.&auth,except:['login', 'logout']]
     4
    35    def index = { redirect(action:list,params:params) }
    46
     
    8082        }
    8183    }
     84
     85    def login = {
     86        if (request.method == "GET") {
     87            session.userId = null
     88            def person = new Person()
     89        }
     90        else {
     91            def person = Person.findByUserIdAndPassword(params.userId,params.password)
     92            if (person) {
     93                    session.userId = person.userId
     94                    def redirectParams =
     95                        session.originalRequestParams ?
     96                        session.originalRequestParams : [controller:'task']
     97                    redirect(redirectParams)
     98            }
     99            else {
     100         flash['message'] = 'Please enter a valid user ID and password'
     101            }
     102        }
     103    }
     104
     105    def logout = {
     106        session.userId = null
     107        flash['message'] = 'Successfully logged out'
     108        redirect(controller:'person', action:'login')
     109    }
     110
     111    def admin = {
     112        render(view:'admin')
     113    }
     114
    82115}
  • trunk/src/grails-app/controllers/PersonGroupController.groovy

    r19 r40  
    1 class PersonGroupController {
    2    
     1class PersonGroupController extends BaseController {
     2
     3    def beforeInterceptor = [action:this.&auth]
     4
    35    def index = { redirect(action:list,params:params) }
    46
  • trunk/src/grails-app/controllers/PersonGroupTypeController.groovy

    r21 r40  
    1 class PersonGroupTypeController {
    2    
     1class PersonGroupTypeController extends BaseController {
     2
     3    def beforeInterceptor = [action:this.&auth]
     4
    35    def index = { redirect(action:list,params:params) }
    46
  • trunk/src/grails-app/controllers/TaskController.groovy

    r21 r40  
    1 class TaskController {
    2    
     1class TaskController extends BaseController {
     2
     3    def beforeInterceptor = [action:this.&auth]
     4
    35    def index = { redirect(action:list,params:params) }
    46
  • trunk/src/grails-app/controllers/TaskGroupController.groovy

    r21 r40  
    1 class TaskGroupController {
    2    
     1class TaskGroupController extends BaseController {
     2
     3    def beforeInterceptor = [action:this.&auth]
     4
    35    def index = { redirect(action:list,params:params) }
    46
  • trunk/src/grails-app/domain/Person.groovy

    r35 r40  
    22    String firstName
    33    String lastName
     4    String userId
     5    String password
    46    Integer employeeID
    57    boolean isActive = true
     
    1719        firstName(maxSize:50,blank:false)
    1820        lastName(maxSize:50,blank:false)
     21        userId(maxSize:8,unique:true)
     22        password(maxSize:8)
    1923        employeeID(blank:true, nullable:true)
    2024    }
  • trunk/src/grails-app/views/layouts/main.gsp

    r38 r40  
    1515        <!-- <div class="logo" style="text-align: center; width: 980px; height: 220px">
    1616          <img src="${createLinkTo(dir:'images',file:'logo.png')}"
    17         alt="gnuMims" /></div> -->
     17        alt="gnuMims" />
     18        <g:render template="/adminmenubar" />
     19
     20        </div> -->
    1821        <div id="Header">
     22        </div>
     23        <div class="appControl">
     24            <g:render template="/adminmenubar" />
    1925        </div>
    2026        <g:layoutBody />
  • trunk/src/grails-app/views/person/create.gsp

    r35 r40  
    4747                            <tr class="prop">
    4848                                <td valign="top" class="name">
     49                                    <label for="userId">User Id:</label>
     50                                </td>
     51                                <td valign="top" class="value ${hasErrors(bean:personInstance,field:'userId','errors')}">
     52                                    <input type="text" maxlength="8" id="userId" name="userId" value="${fieldValue(bean:personInstance,field:'userId')}"/>
     53                                </td>
     54                            </tr>
     55                       
     56                            <tr class="prop">
     57                                <td valign="top" class="name">
     58                                    <label for="password">Password:</label>
     59                                </td>
     60                                <td valign="top" class="value ${hasErrors(bean:personInstance,field:'password','errors')}">
     61                                    <input type="text" maxlength="8" id="password" name="password" value="${fieldValue(bean:personInstance,field:'password')}"/>
     62                                </td>
     63                            </tr>
     64                       
     65                            <tr class="prop">
     66                                <td valign="top" class="name">
    4967                                    <label for="employeeID">Employee ID:</label>
    5068                                </td>
  • trunk/src/grails-app/views/person/edit.gsp

    r35 r40  
    4444                                <td valign="top" class="value ${hasErrors(bean:personInstance,field:'lastName','errors')}">
    4545                                    <input type="text" maxlength="50" id="lastName" name="lastName" value="${fieldValue(bean:personInstance,field:'lastName')}"/>
     46                                </td>
     47                            </tr>
     48                       
     49                            <tr class="prop">
     50                                <td valign="top" class="name">
     51                                    <label for="userId">User Id:</label>
     52                                </td>
     53                                <td valign="top" class="value ${hasErrors(bean:personInstance,field:'userId','errors')}">
     54                                    <input type="text" maxlength="8" id="userId" name="userId" value="${fieldValue(bean:personInstance,field:'userId')}"/>
     55                                </td>
     56                            </tr>
     57                       
     58                            <tr class="prop">
     59                                <td valign="top" class="name">
     60                                    <label for="password">Password:</label>
     61                                </td>
     62                                <td valign="top" class="value ${hasErrors(bean:personInstance,field:'password','errors')}">
     63                                    <input type="text" maxlength="8" id="password" name="password" value="${fieldValue(bean:personInstance,field:'password')}"/>
    4664                                </td>
    4765                            </tr>
  • trunk/src/grails-app/views/person/list.gsp

    r35 r40  
    2828                                <g:sortableColumn property="lastName" title="Last Name" />
    2929                       
     30                                <g:sortableColumn property="userId" title="User Id" />
     31                       
     32                                <g:sortableColumn property="password" title="Password" />
     33                       
    3034                                <g:sortableColumn property="employeeID" title="Employee ID" />
    31                        
    32                                 <g:sortableColumn property="isActive" title="Is Active" />
    3335                       
    3436                        </tr>
     
    4446                            <td>${fieldValue(bean:personInstance, field:'lastName')}</td>
    4547                       
     48                            <td>${fieldValue(bean:personInstance, field:'userId')}</td>
     49                       
     50                            <td>${fieldValue(bean:personInstance, field:'password')}</td>
     51                       
    4652                            <td>${fieldValue(bean:personInstance, field:'employeeID')}</td>
    47                        
    48                             <td>${fieldValue(bean:personInstance, field:'isActive')}</td>
    4953                       
    5054                        </tr>
  • trunk/src/grails-app/views/person/show.gsp

    r35 r40  
    4545                   
    4646                        <tr class="prop">
     47                            <td valign="top" class="name">User Id:</td>
     48                           
     49                            <td valign="top" class="value">${fieldValue(bean:personInstance, field:'userId')}</td>
     50                           
     51                        </tr>
     52                   
     53                        <tr class="prop">
     54                            <td valign="top" class="name">Password:</td>
     55                           
     56                            <td valign="top" class="value">${fieldValue(bean:personInstance, field:'password')}</td>
     57                           
     58                        </tr>
     59                   
     60                        <tr class="prop">
    4761                            <td valign="top" class="name">Employee ID:</td>
    4862                           
     
    5468                            <td valign="top" class="name">Entries:</td>
    5569                           
    56                             <td valign="top" class="value">${fieldValue(bean:personInstance, field:'entries')}</td>
     70                            <td  valign="top" style="text-align:left;" class="value">
     71                                <ul>
     72                                <g:each var="e" in="${personInstance.entries}">
     73                                    <li><g:link controller="entry" action="show" id="${e.id}">${e?.encodeAsHTML()}</g:link></li>
     74                                </g:each>
     75                                </ul>
     76                            </td>
    5777                           
    5878                        </tr>
  • trunk/src/web-app/css/public.css

    r38 r40  
    3737  background: transparent url("../images/logo.png") no-repeat scroll center;
    3838  width: 980px;
    39   height: 220px;
     39  height: 200px;
    4040}
    4141
     
    9595}
    9696
     97.appcontrol {
     98    text-align: right;
     99    padding: 5px 160px 5px 5px
     100}
     101
     102.appcontrolButton {
     103    font-size: 10px;
     104    padding: 5px 5px;
     105}
     106
    97107.nav a{
    98108    background: url("../images/linkPanel.png") no-repeat top;
  • trunk/src/web-app/index.gsp

    r31 r40  
    1 <html>
    2     <head>
    3         <title>Welcome to gnuMims</title>
    4                 <meta name="layout" content="main" />
    5     </head>
    6     <body>
    7         <h1 style="margin-left:20px;">Welcome to gnuMims</h1>
    8         <p style="margin-left:20px;width:80%">
    9         Home
    10         </p>
    11         <div class="dialog" style="margin-left:20px;width:60%;">
    12             <ul>
    13               <g:each var="c" in="${grailsApplication.controllerClasses}">
    14                     <li class="controller"><g:link controller="${c.logicalPropertyName}">${c.fullName}</g:link></li>
    15               </g:each>
    16             </ul>
    17         </div>
    18     </body>
    19 </html>
     1<%response.sendRedirect(request.getContextPath()+'/task/list')%>
Note: See TracChangeset for help on using the changeset viewer.