Changeset 358 for trunk


Ignore:
Timestamp:
Feb 16, 2010, 9:01:07 AM (15 years ago)
Author:
gav
Message:

Added an application log view.
Reduced log file size and added CSS and JavaScript? to suite.

Location:
trunk
Files:
1 added
6 edited

Legend:

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

    r353 r358  
    5959        rollingFile name:"appLog",
    6060                        file:"${logDirectory}/${appName}.log".toString(),
    61                         maxFileSize:'1MB',
     61                        maxFileSize:'300kB',
    6262                        maxBackupIndex:0,
    6363                        layout:pattern(conversionPattern: '%d{[EEE, dd-MMM-yyyy @ HH:mm:ss.SSS]} [%t] %-5p %c %x - %m%n')
  • trunk/grails-app/controllers/AppCoreController.groovy

    r318 r358  
    11import org.codehaus.groovy.grails.plugins.springsecurity.Secured
     2import org.codehaus.groovy.grails.commons.*
    23
    34/**
     
    193194    }
    194195
     196    /**
     197    * Render the application log file.
     198    */
     199    @Secured(['ROLE_AppAdmin'])
     200    def appLog = {
     201        def file = new File(ConfigurationHolder.config.log4j.appenders.appLog.file)
     202
     203        // Success.
     204        [log: file.text]
     205    }
     206
    195207} // end of class.
  • trunk/grails-app/controllers/SectionDetailedController.groovy

    r298 r358  
    33@Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_AssetManager'])
    44class SectionDetailedController extends BaseController {
     5
     6    def sectionService
    57
    68    // the delete, save and update actions only accept POST requests
     
    2931    @Secured(['ROLE_AppAdmin'])
    3032    def delete = {
    31         def sectionInstance = Section.get( params.id )
    32         if(sectionInstance) {
    33             try {
    34                 sectionInstance.delete(flush:true)
    35                 flash.message = "Section ${params.id} deleted"
    36                 redirect(action:list)
    37             }
    38             catch(org.springframework.dao.DataIntegrityViolationException e) {
    39                 flash.message = "Section ${params.id} could not be deleted"
    40                 redirect(action:show,id:params.id)
    41             }
     33        def result = sectionService.delete(params)
     34
     35        if(!result.error) {
     36            flash.message = g.message(code: "default.delete.success", args: ["Section", params.id])
     37            redirect(action:list)
     38            return
    4239        }
    43         else {
    44             flash.message = "Section not found with id ${params.id}"
     40
     41        flash.errorMessage = g.message(code: result.error.code, args: result.error.args)
     42
     43        if(result.error.code == "default.not.found") {
    4544            redirect(action:list)
     45            return
    4646        }
     47
     48        redirect(action:show, id: params.id)
    4749    }
    4850
  • trunk/grails-app/views/appCore/appAdmin.gsp

    r264 r358  
    1717                <table>
    1818                    <tbody>
     19
     20                        <tr class="prop">
     21                            <td valign="top" class="name">
     22                                <label>Log:</label>
     23                            </td>
     24                            <td valign="top" class="value">
     25                                <g:link action="appLog">View</g:link> - The application log file.
     26                            </td>
     27                        </tr>
    1928
    2029                        <tr class="prop">
  • trunk/web-app/css/main.css

    r328 r358  
    5555    float: left;
    5656    /*border: 1px solid #ccc;*/
     57}
     58
     59#log {
     60    width: 920px;
     61    height: auto;
    5762}
    5863
  • trunk/web-app/js/jsUtil.js

    r323 r358  
    3535    }
    3636}
     37
     38function textAreaScrollBottom(id) {
     39    $(id).scrollTop = $(id).scrollHeight;
     40}
     41
     42function focusUtil(id) {
     43    $(id).focus();
     44}
Note: See TracChangeset for help on using the changeset viewer.