Changeset 996
- Timestamp:
- Oct 26, 2010, 3:19:22 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/application.properties
r995 r996 1 1 #Grails Metadata file 2 # Mon Oct 25 15:43:32 CEST 20102 #Tue Oct 26 15:12:32 CEST 2010 3 3 app.grails.version=1.3.5 4 4 app.name=gscf … … 11 11 plugins.hibernate=1.3.5 12 12 plugins.jquery=1.4.3.2 13 plugins.jumpbar=0.1 13 14 plugins.mail=0.9 14 15 plugins.oauth=0.10 … … 16 17 plugins.spring-security-core=1.0.1 17 18 plugins.tomcat=1.3.5 18 plugins. jumpbar=0.119 plugins.webflow=1.3.4 -
trunk/grails-app/controllers/RestController.groovy
r983 r996 67 67 } 68 68 69 /** 70 * REST resource for data modules. 71 * Consumer and token should be supplied via URL parameters. 72 * Provides the details of the user that has logged in 73 * 74 * @param consumer consumer name of the calling module 75 * @param token token for the authenticated user (e.g. session_id) 76 * @return bool {"username": "...", "id": ... } when user/password is logged in. 77 */ 78 def getUser = { 79 SecUser user = AuthenticationService.getRemotelyLoggedInUser( params.consumer, params.token ) 80 def reply = [username: user.username, id: user.id] 81 render reply as JSON 82 } 69 83 70 84 /** -
trunk/grails-app/controllers/dbnp/authentication/UserController.groovy
r985 r996 16 16 17 17 import grails.converters.JSON 18 18 import grails.plugins.springsecurity.Secured 19 19 import org.springframework.dao.DataIntegrityViolationException 20 20 … … 22 22 * @author <a href='mailto:burt@burtbeckwith.com'>Burt Beckwith</a> 23 23 */ 24 @Secured(['ROLE_ADMIN']) 24 25 class UserController { 25 26 … … 213 214 214 215 protected findById() { 216 if(!params.id) { 217 flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'user.label', default: 'User'), params.id])}" 218 redirect action: search 219 } 220 215 221 def user = SecUser.get(params.id) 222 216 223 if (!user) { 217 224 flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'user.label', default: 'User'), params.id])}" -
trunk/grails-app/controllers/dbnp/studycapturing/TemplateEditorController.groovy
r959 r996 16 16 import dbnp.data.* 17 17 import dbnp.studycapturing.* 18 import dbnp.authentication.AuthenticationService 18 19 import cr.co.arquetipos.crypto.Blowfish 19 20 import grails.converters.* … … 23 24 def entityName; 24 25 def entity; 25 26 27 def AuthenticationService 28 26 29 /** 27 30 * Study template editor page … … 174 177 * On error the method gives a HTTP response status 500 and the error 175 178 */ 176 179 def createTemplate = { 177 180 // Decode the entity 178 181 if( !_checkEntity() ) { … … 194 197 response.status = 500; 195 198 render 'Template could not be created because errors occurred.'; 199 return 200 } 201 } 202 203 /** 204 * Clones a template using a AJAX call 205 * 206 * @return JSON object with two entries: 207 * id: [id of this object] 208 * html: HTML of the contents of the LI-item that will be added. 209 * On error the method gives a HTTP response status 500 and the error 210 */ 211 def cloneTemplate = { 212 // Search for the template field 213 def template = Template.get( params.id ); 214 if( !template ) { 215 response.status = 404; 216 render 'Template not found'; 217 return; 218 } 219 220 // Create the template fields and add it to the template 221 def newTemplate = new Template( template, authenticationService.getLoggedInUser() ); 222 if (newTemplate.validate() && newTemplate.save(flush: true)) { 223 def html = g.render( template: 'elements/liTemplate', model: [template: newTemplate] ); 224 def output = [ id: newTemplate.id, html: html ]; 225 render output as JSON; 226 } else { 227 response.status = 500; 228 render 'Template could not be cloned because errors occurred.'; 196 229 return 197 230 } … … 607 640 def currentIndex = template.fields.indexOf( templateField ); 608 641 def moveField = template.fields.remove( currentIndex ); 642 643 println( "Old: " + currentIndex + " - New: " + params.position ); 644 609 645 template.fields.add( Integer.parseInt( params.position ), moveField ); 610 646 template.save(flush:true); -
trunk/grails-app/controllers/dbnp/studycapturing/WizardController.groovy
r978 r996 29 29 @Secured(['IS_AUTHENTICATED_REMEMBERED']) 30 30 class WizardController { 31 31 def AuthenticationService 32 32 33 33 /** -
trunk/grails-app/domain/dbnp/studycapturing/Study.groovy
r976 r996 29 29 List assays 30 30 boolean published = false // Determines whether a study is private (only accessable by the owner and writers) or published (also visible to readers) 31 31 boolean publicstudy = false // Determines whether anonymous users are allowed to see this study. This has only effect when published = true 32 32 33 33 static hasMany = [ -
trunk/grails-app/domain/dbnp/studycapturing/Template.groovy
r976 r996 2 2 3 3 import dbnp.authentication.SecUser 4 import dbnp.authentication.AuthenticationService 4 5 5 6 /** … … 37 38 38 39 static hasMany = [fields: TemplateField] 39 40 40 static mapping = { 41 41 } … … 77 77 // name(unique:['entity']) 78 78 79 } 80 81 public Template() { 82 super() 83 } 84 85 /** 86 * Creates a clone of the given other template and also copies its owner 87 * 88 * @param otherTemplate 89 */ 90 public Template( Template otherTemplate) { 91 this() 92 93 //authenticationService = new AuthenticationService() 94 95 this.name = otherTemplate.name + " (Copy)" 96 this.description = otherTemplate.description 97 this.entity = otherTemplate.entity 98 this.owner = otherTemplate.owner 99 100 // The fields are copied by reference 101 this.fields = otherTemplate.fields 102 } 103 104 /** 105 * Creates a clone of the given other template. The currently logged in user 106 * is set as the owner 107 * @param otherTemplate 108 */ 109 public Template( Template otherTemplate, SecUser owner ) { 110 this() 111 112 //authenticationService = new AuthenticationService() 113 114 this.name = otherTemplate.name + " (Copy)" 115 this.description = otherTemplate.description 116 this.entity = otherTemplate.entity 117 this.owner = owner 118 119 // The fields are copied by reference 120 this.fields = [] 121 otherTemplate.fields.each { 122 this.fields.add( it ) 123 } 79 124 } 80 125 -
trunk/grails-app/views/templateEditor/elements/_liTemplateEditable.gsp
r980 r996 2 2 <img onClick="editTemplate( ${template.id} );" src="${createLinkTo( dir: 'images/icons', file: 'application_edit.png', plugin: 'famfamfam' )}" alt="Edit template properties" title="Edit template properties"> 3 3 <img onClick="editFields( ${template.id} );"src="${createLinkTo( dir: 'images/icons', file: 'application_form.png', plugin: 'famfamfam' )}" alt="Add/remove template fields" title="Add/remove template fields"> 4 <img onClick="cloneTemplate( ${template.id} );"src="${createLinkTo( dir: 'images/icons', file: 'page_copy.png', plugin: 'famfamfam' )}" alt="Clone this template" title="Clone this template"> 4 5 <img onClick="if( confirm( 'Are you sure?' ) ) { deleteTemplate( ${template.id} ); }" src="${createLinkTo( dir: 'images/icons', file: 'delete.png', plugin: 'famfamfam' )}" alt="Delete this template" title="Delete this template"> 5 6 </span> -
trunk/grails-app/views/templateEditor/elements/_liTemplateNonEditable.gsp
r980 r996 3 3 <img onClick="editTemplate( ${template.id} );" src="${createLinkTo( dir: 'images/icons', file: 'application_edit.png', plugin: 'famfamfam' )}" alt="Edit template properties" title="Edit template properties"> 4 4 <img onClick="editFields( ${template.id} );"src="${createLinkTo( 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="${createLinkTo( dir: 'images/icons', file: 'page_copy.png', plugin: 'famfamfam' )}" alt="Clone this template" title="Clone this template"> 5 6 <img class="disabled" src="${createLinkTo( 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."> 6 7 </span> -
trunk/grails-app/views/templateEditor/index.gsp
r959 r996 59 59 </div> 60 60 61 <div id="wait" class="wait"> 62 63 </div> 64 <div class="wait_text wait"> 65 <img src="<g:resource dir="images" file="spinner.gif" />"> Please wait 66 </div> 67 68 61 69 </body> 62 70 </html> -
trunk/grails-app/views/templateEditor/template.gsp
r959 r996 88 88 <ol id="selectedTemplateFields" class="templateFields <g:if test="${template.inUse()}">inUse</g:if>"> 89 89 <g:render template="elements/selected" var="templateField" collection="${template.fields}" model="['template':template]"/> 90 <% /* NB: this empty field should always be the last in the list! */ %> 90 91 <li class="empty ui-state-default" <g:if test="${template.fields?.size() > 0 }">style='display: none;'</g:if>>This template does not yet contain any fields. Drag a field to this list or use the 'Add field button'.</li> 91 92 </ol> … … 96 97 <p>These fields are available for adding to the template. Drag a field to the template to add it.</p> 97 98 <ol id="availableTemplateFields" class="templateFields"> 99 <g:render template="elements/available" var="templateField" collection="${allFields - template.fields}" /> 98 100 <li class="empty ui-state-default" <g:if test="${allFields.size() > template.fields.size()}">style='display: none;'</g:if>>There are no additional fields that can be added. Use the 'Create new field' button to create new fields.</li> 99 <g:render template="elements/available" var="templateField" collection="${allFields - template.fields}" />100 101 </ol> 101 102 … … 121 122 </div> 122 123 123 </body> 124 <div id="wait" class="wait"> 125 126 </div> 127 <div class="wait_text wait"> 128 <img src="<g:resource dir="images" file="spinner.gif" />"> Please wait 129 </div> 130 </body> 124 131 </html> -
trunk/grails-app/views/user/create.gsp
r985 r996 10 10 }); 11 11 </script> 12 <style type="text/css"> 13 div.usermanagement { font-size: 0.8em; } 14 </style> 12 15 </head> 13 16 … … 18 21 <g:form action="save" name='userCreateForm' class="button-style"> 19 22 20 <div id="tabs" >23 <div id="tabs" class="usermanagement"> 21 24 <ul> 22 25 <li><a href="#userinfo">User info</a></li> … … 54 57 <input type="submit" value="Save" /> 55 58 56 <g:if test='${user}'>57 DELETE58 </g:if>59 60 59 </div> 61 60 62 61 </g:form> 63 64 <g:if test='${user}'>65 deleteform66 </g:if>67 62 68 63 <script> -
trunk/grails-app/views/user/edit.gsp
r985 r996 10 10 }); 11 11 </script> 12 <style type="text/css"> 13 div.usermanagement { font-size: 0.8em; } 14 </style> 12 15 </head> 13 16 … … 20 23 <g:hiddenField name="version" value="${user?.version}"/> 21 24 22 <div id="tabs" >25 <div id="tabs" class="usermanagement"> 23 26 <ul> 24 27 <li><a href="#userinfo">User info</a></li> … … 57 60 58 61 <g:if test='${user}'> 59 DELETE 62 <input type="button" value="Delete" onClick="$('#userDeleteForm').submit(); return false;"/> 60 63 </g:if> 61 64 … … 65 68 66 69 <g:if test='${user}'> 67 deleteform 70 <g:form action="delete" name='userDeleteForm'> 71 <g:hiddenField name="id" value="${user?.id}"/> 72 </g:form> 68 73 </g:if> 69 74 -
trunk/grails-app/views/user/search.gsp
r985 r996 10 10 <g:form action='userSearch' name='userSearchForm'> 11 11 12 <g:if test="${flash.message}"> 13 <p> 14 ${flash.message} 15 </p> 16 </g:if> 12 17 <br/> 13 18 -
trunk/web-app/css/templateEditor.css
r959 r996 82 82 } 83 83 84 /* Please wait dialog */ 85 #wait { /* Transparency, see http://hungred.com/how-to/css-opacity-cross-browser-compatible/ */ 86 filter: alpha(opacity:0.5); 87 KHTMLOpacity: 0.5; 88 MozOpacity: 0.5; 89 -khtml-opacity:.50; 90 -ms-filter:âalpha(opacity=50)â; 91 -moz-opacity:.50; 92 filter:alpha(opacity=50); 93 opacity:.50; 94 } 95 #wait { position: absolute; left: 0; top: 0; width: 100%; height: 100%; z-index: 100; background-color: #f2f5f7; } 96 .wait_text { position: absolute; left: 50%; top: 50%; margin-left: -100px; margin-top: -20px; width: 200px; height: 40px; text-align: center; font-weight: bold; background-color: white; border: 1px solid #006DBA; padding-top: 13px; vertical-align: center; } 97 .wait { display: none; } 98 84 99 /* Add Ontology dialog */ 85 100 #addOntology { list-style-type: none; padding-left: 0; } -
trunk/web-app/js/templateEditor.js
r959 r996 61 61 var formEl = $( '#template_' + id + '_form' ); 62 62 63 showWaiting(); 64 63 65 // Update the field 64 66 $.ajax({ … … 73 75 error: function( request ) { 74 76 alert( "Could not create template: " + request.responseText ); 75 } 77 }, 78 complete: function( request, textStatus ) { 79 hideWaiting(); 80 } 76 81 }); 77 82 } … … 82 87 function updateTemplate( id ) { 83 88 var formEl = $( '#template_' + id + '_form' ); 89 90 showWaiting(); 84 91 85 92 // Update the field … … 95 102 error: function( request ) { 96 103 alert( "Could not update template: " + request.responseText ); 97 } 104 }, 105 complete: function( request, textStatus ) { 106 hideWaiting(); 107 } 98 108 }); 99 109 } … … 103 113 */ 104 114 function deleteTemplate( id ) { 105 // Update the field 115 116 showWaiting(); 117 118 // Update the field 106 119 $.ajax({ 107 120 url: baseUrl + '/templateEditor/deleteTemplate', … … 116 129 error: function( request ) { 117 130 alert( "Could not delete template: " + request.responseText ); 118 } 131 }, 132 complete: function( request, textStatus ) { 133 hideWaiting(); 134 } 119 135 }); 120 136 121 137 return true; 138 } 139 140 /** 141 * Clones a template using AJAX 142 */ 143 function cloneTemplate( id ) { 144 showWaiting(); 145 146 // Update the field 147 $.ajax({ 148 url: baseUrl + '/templateEditor/cloneTemplate/' + id, 149 dataType: 'json', 150 type: "POST", 151 success: function(data, textStatus, request) { 152 addTemplateListItem( data.id, data.html ); 153 }, 154 error: function( request ) { 155 alert( "Could not clone template: " + request.responseText ); 156 }, 157 complete: function( request, textStatus ) { 158 hideWaiting(); 159 } 160 }); 122 161 } 123 162 … … 203 242 var templateId = $('#templateSelect').val(); 204 243 244 showWaiting(); 245 205 246 // Update the field 206 247 $.ajax({ … … 215 256 error: function( request ) { 216 257 alert( "Could not add template field: " + request.responseText ); 217 } 258 }, 259 complete: function( request, textStatus ) { 260 hideWaiting(); 261 } 218 262 }); 219 263 } … … 224 268 function updateTemplateField( id ) { 225 269 var formEl = $( '#templateField_' + id + '_form' ); 270 271 showWaiting(); 226 272 227 273 // Update the field … … 237 283 error: function( request ) { 238 284 alert( "Could not update template field: " + request.responseText ); 239 } 285 }, 286 complete: function( request, textStatus ) { 287 hideWaiting(); 288 } 240 289 }); 241 290 } … … 245 294 */ 246 295 function deleteTemplateField( id ) { 296 showWaiting(); 297 247 298 // Delete the field 248 299 $.ajax({ … … 258 309 error: function( request ) { 259 310 alert( "Could not delete template field: " + request.responseText ); 260 } 311 }, 312 complete: function( request, textStatus ) { 313 hideWaiting(); 314 } 261 315 }); 262 316 … … 266 320 /** 267 321 * Is triggered when an item from the templatefields has been moved and 268 * shoul ebe updated322 * should be updated 269 323 */ 270 324 function updateTemplateFieldPosition( event, ui ) { … … 279 333 return true; 280 334 } 335 281 336 // Find the new position of the element in the list 282 337 // http://stackoverflow.com/questions/2979643/jquery-ui-sortable-position 283 338 // 284 // Because there is also a hidden 'empty template' list item in the list,285 // the number is decreased by 1 286 var newposition = ui.item.index() - 1;339 // There is also a hidden 'empty template' list item in the list. This is 340 // the last item in the list, so it doesn't matter in this computation 341 var newposition = ui.item.index(); 287 342 288 343 // Find the ID of the templateField and template … … 296 351 // Disable sorting until this move has been saved (in order to prevent collisions 297 352 $( '#templateFields' ).sortable( 'disable' ); 353 354 showWaiting(); 298 355 299 356 // Move the item … … 310 367 undoMove(); 311 368 alert( "Could not move template field: " + request.responseText ); 312 } 369 }, 370 complete: function( request, textStatus ) { 371 hideWaiting(); 372 } 313 373 }); 314 374 } … … 345 405 var templateId = $('#templateSelect').val(); 346 406 407 showWaiting(); 408 347 409 // Update the field 348 410 $.ajax({ … … 369 431 370 432 alert( "Could not add template field: " + request.responseText ); 371 } 433 }, 434 complete: function( request, textStatus ) { 435 hideWaiting(); 436 } 372 437 }); 373 438 … … 397 462 var templateId = $('#templateSelect').val(); 398 463 464 showWaiting(); 465 399 466 // Update the field 400 467 $.ajax({ … … 420 487 421 488 alert( "Could not delete template field: " + request.responseText ); 422 } 489 }, 490 complete: function( request, textStatus ) { 491 hideWaiting(); 492 } 423 493 }); 424 494 … … 514 584 } 515 585 } 586 587 function showWaiting() { $( '.wait' ).show() } 588 function hideWaiting() { $( '.wait' ).hide() } 516 589 517 590 /************************************
Note: See TracChangeset
for help on using the changeset viewer.