Ignore:
Timestamp:
Nov 22, 2010, 5:27:23 PM (11 years ago)
Author:
robert@…
Message:

Improved file upload fields so users can delete existing files and are able to access uploaded files (using a tag in the tag library). See ticket #17

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/domain/dbnp/studycapturing/TemplateEntity.groovy

    r1175 r1182  
    450450                        return getStore(field.type)[fieldName]
    451451                }
    452 
    453452        }
    454453
     
    549548                // Magic setter for files: handle values for file fields
    550549                //
    551                 // If NULL is given, the field value is emptied and the old file is removed
     550                // If NULL is given or "*deleted*", the field value is emptied and the old file is removed
    552551                // If an empty string is given, the field value is kept as was
    553552                // If a file is given, it is moved to the right directory. Old files are deleted. If
     
    559558                        def currentFile = getFieldValue(field.name);
    560559
    561                         if (value == null) {
     560                        if (value == null || ( value.class == String && value == '*deleted*' ) ) {
    562561                                // If NULL is given, the field value is emptied and the old file is removed
    563562                                value = "";
Note: See TracChangeset for help on using the changeset viewer.