Changeset 786


Ignore:
Timestamp:
May 31, 2012, 3:12:42 PM (5 years ago)
Author:
ferryjagers@…
Message:

templateAdmin role, only users with this role are allowed to modify templates.

Location:
gdt/trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • gdt/trunk/GdtGrailsPlugin.groovy

    r784 r786  
    2121
    2222class GdtGrailsPlugin {
    23     def version                 = "0.2.1"
    24     def grailsVersion   = "1.3.4 > *"
     23    def version                 = "0.2.2"
     24    def grailsVersion   = "1.3.7 > *"
    2525    def dependsOn               = [ajaxflow: "0.2.1 => *", crypto: "2.0 => *", jquery: "1.7.1 => *" ]
    2626    def pluginExcludes  = [
  • gdt/trunk/application.properties

    r784 r786  
    11#Grails Metadata file
    2 #Mon Apr 02 16:09:32 CEST 2012
     2#Thu May 31 14:21:31 CEST 2012
    33app.grails.version=1.3.7
    44app.name=gdt
  • gdt/trunk/grails-app/taglib/org/dbnp/gdt/GdtTagLib.groovy

    r679 r786  
    2525class GdtTagLib extends AjaxflowTagLib {
    2626        def gdtService
     27    def authenticationService
    2728
    2829        // define default text field width
     
    386387
    387388                // add a rel element if it does not exist
    388                 if (!attrs.rel) {
    389                         attrs.rel = 'template'
    390                 }
     389                if (authenticationService.getLoggedInUser().hasTemplateAdminRights()) {
     390                        attrs.rel = 'templateAdmin'
     391                }
     392
     393        else {
     394                attrs.rel = 'templateUser'
     395        }
    391396
    392397                // got an ajaxOnChange defined?
  • gdt/trunk/grails-app/views/templateEditor/elements/_liTemplate.gsp

    r87 r786  
    11<li id="template_${template.id}"class="ui-state-default">
    2   <g:if test="${template.inUse()}">
    3         <g:render template="elements/liTemplateNonEditable" model="['template': template, , 'standalone': standalone]"/>
     2  <g:set var="templateAdmin" value="${false}"/>
     3  <sec:ifAllGranted roles="ROLE_TEMPLATEADMIN">
     4      <g:if test="${!template.inUse()}">
     5        <g:render template="elements/liTemplateEditable" model="['template': template, 'standalone': standalone]"/>
     6      </g:if>
     7      <g:else>
     8        <g:render template="elements/liTemplateNonDeletable" model="['template': template, 'standalone': standalone]"/>
     9      </g:else>
     10      <g:set var="templateAdmin" value="${true}"/>
     11  </sec:ifAllGranted>
     12
     13  <g:if test="${templateAdmin == false}">
     14      <g:render template="elements/liTemplateNonEditable" model="['template': template, 'standalone': standalone]"/>
    415  </g:if>
    5   <g:else>
    6         <g:render template="elements/liTemplateEditable" model="['template': template, 'standalone': standalone]"/>
    7   </g:else>
    816</li>
  • gdt/trunk/grails-app/views/templateEditor/elements/_liTemplateNonEditable.gsp

    r87 r786  
    11<g:set var="numUses" value="${template.numUses()}" />
    22<span class="listButtons">
    3   <img onClick="editTemplate( ${template.id} );" src="${resource( dir: 'images/icons', file: 'application_edit.png', plugin: 'famfamfam' )}" alt="Edit template properties" title="Edit template properties">
    4   <img onClick="editFields( ${template.id} );"src="${resource( dir: 'images/icons', file: 'application_form.png', plugin: 'famfamfam' )}" alt="Add/remove template fields" title="Add/remove template fields">
    5   <img onClick="cloneTemplate( ${template.id} );"src="${resource( dir: 'images/icons', file: 'page_copy.png', plugin: 'famfamfam' )}" alt="Clone this template" title="Clone this template">
    6   <img class="disabled" src="${resource( dir: 'images/icons', file: 'delete.png', plugin: 'famfamfam' )}" alt="Deleting this template is not possible. Template is used in ${numUses} objects." title="Deleting this template is not possible. Template is used in ${numUses} objects.">
     3  <img class="disabled" src="${resource( dir: 'images/icons', file: 'application_edit.png', plugin: 'famfamfam' )}" alt="Template properties are only editable for (template)Admins." title="Template properties are only editable for (template)Admins.">
     4  <img class="disabled" src="${resource( dir: 'images/icons', file: 'application_form.png', plugin: 'famfamfam' )}" alt="Template fields can only be removed by (template)Admins." title="Template fields can only be removed by (template)Admins.">
     5  <img class="disabled" src="${resource( dir: 'images/icons', file: 'page_copy.png', plugin: 'famfamfam' )}" alt="Templates can only be cloned by (template)Admins." title="Templates can only be cloned by (template)Admins.">
     6  <img class="disabled" src="${resource( dir: 'images/icons', file: 'delete.png', plugin: 'famfamfam' )}" alt="Templates can only be deleted by (template)Admins." title="Templates can only be deleted by (template)Admins.">
     7  <img onClick="requestTemplate( ${ template.id } );" src="${resource( dir: 'images/icons', file: 'email.png', plugin: 'famfamfam' )}" alt="Request a new template or template modification." title="Request a new template or template modification.">
    78</span>
    89${template.name}
  • gdt/trunk/web-app/js/templateEditor.js

    r727 r786  
    179179}
    180180
     181/**
     182 * Opens templateRequest dialog
     183 */
     184function requestTemplate( id ) {
     185    //define popup's width/height
     186    var requestWidth = 800;
     187    var requestHeight = 490;
     188    //open window
     189    requestWindow = window.open(baseUrl + '/forms/templateRequestForm.gsp', 'bla', 'width='+requestWidth+', height='+requestHeight+', resizable=0, left='+ (window.screen.width - requestWidth) / 2 + ',top=' + (window.screen.height - requestHeight) / 2);
     190    requestWindow.focus()
     191}
     192
    181193// Adds a new listitem when a field has been added
    182 function addTemplateListItem( id, newHTML ) {
     194function  addTemplateListItem( id, newHTML ) {
    183195        // Create a new listitem
    184196        var li = $( newHTML );
Note: See TracChangeset for help on using the changeset viewer.