Changeset 1508
- Timestamp:
- Feb 9, 2011, 11:10:38 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/conf/Config.groovy
r1469 r1508 127 127 '/securityinfo/**': ['ROLE_ADMIN'] 128 128 ] 129 130 // Temporary directory to upload files to. 131 // If the directory is given relative (e.g. 'fileuploads/temp'), it is taken relative to the web-app directory 132 // Otherwise, it should be given as an absolute path (e.g. '/home/user/sequences') 133 // The directory should be writable by the webserver user 134 uploads.uploadDir = "fileuploads" -
trunk/grails-app/services/dbnp/studycapturing/FileService.groovy
r1430 r1508 15 15 package dbnp.studycapturing 16 16 17 import java.io.File; 18 17 19 import org.codehaus.groovy.grails.commons.ApplicationHolder 20 import org.codehaus.groovy.grails.commons.ConfigurationHolder 18 21 19 22 class FileService implements Serializable { … … 29 32 */ 30 33 def File getUploadDir() { 31 // Find the absolute path to the fileuploads directory. This code is foundon32 // http://stackoverflow.com/questions/491067/how-to-find-the-physical-path-of-a-gsp-file-in-a-deployed-grails-application 33 // 34 // The code used in NMC-DSP didn't work, because that code only works in 35 // controllers: 36 // grailsAttributes.getApplicationContext().getResource("/fileuploads").getFile(); 37 return ApplicationHolder.application.parentContext.getResource("fileuploads").getFile() 34 // Find the file upload directory name from the configuration 35 String dir = ConfigurationHolder.config.uploads.uploadDir 36 37 if( !dir ) 38 dir = "fileuploads" 39 40 return absolutePath( dir ); 38 41 } 42 43 /** 44 * Returns the absolute path for the given pathname. If the pathname is relative, it is taken relative to the web-app directory 45 * @param pathname 46 * @return 47 */ 48 private File absolutePath( String pathname ) { 49 if( pathname == null) 50 return null 51 52 // Check if this is an absolute path 53 File f = new File( pathname ); 54 55 if( f.isAbsolute() ) { 56 return f 57 } else { 58 // Find the absolute path relative to the web-app directory. This code is found on 59 // http://stackoverflow.com/questions/491067/how-to-find-the-physical-path-of-a-gsp-file-in-a-deployed-grails-application 60 return ApplicationHolder.application.parentContext.getResource(pathname).getFile() 61 } 62 } 39 63 40 64 /** -
trunk/web-app/js/studywizard.js
r1488 r1508 274 274 onChange : function(file, ext) { 275 275 oldFile = $('#' + field_id).val(); 276 if (oldFile != '' ) {276 if (oldFile != '' && oldFile != 'existing*' && oldFile != '*deleted*' ) { 277 277 if (!confirm('The old file is deleted when uploading a new file. Do you want to continue?')) { 278 278 return false;
Note: See TracChangeset
for help on using the changeset viewer.