Changeset 215


Ignore:
Timestamp:
Feb 26, 2010, 12:26:29 PM (7 years ago)
Author:
tabma
Message:
  • added Template chooser, used in the properties page
Location:
trunk/grails-app
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/importer/ImporterController.groovy

    r203 r215  
    2222import org.apache.poi.hssf.usermodel.HSSFCell
    2323import org.apache.poi.ss.usermodel.DataFormatter
     24import dbnp.studycapturing.Template
    2425
    2526class ImporterController {
     
    2930     * Default page
    3031     **/
    31     def index = { }
     32    def index = {
     33        [templates:Template.list()]
     34    }
    3235
    3336    /**
     
    4750
    4851        session.header = header
     52        session.importtemplate_id = params.template_id
    4953
    5054        render (view:"step1", model:[header:header, datamatrix:datamatrix])
     
    5256    }
    5357
     58    /**
     59    * User has assigned all entities to the columns and continues to the next step (assigning properties to columns)
     60    *
     61    * @param entity list of entities
     62    * @return properties page
     63    */
    5464    def savepreview = {
    5565        def entities  = request.getParameterValues("entity")
    5666
    57         render(view:"step2", model:[entities:entities, header:session.header])
     67        // currently only one template is used for all entities
     68        // TODO: show template fields per entity
     69       
     70        def templates = Template.get(session.importtemplate_id)
     71
     72        render(view:"step2", model:[entities:entities, header:session.header, templates:templates])
    5873    }
    5974}
  • trunk/grails-app/taglib/dbnp/importer/ImporterTagLib.groovy

    r203 r215  
    9393        out << createSelect(selected, attrs['name'], standardcelltypes, customvalue)
    9494    }
     95   
     96
    9597}
  • trunk/grails-app/views/importer/common/_preview.gsp

    r203 r215  
    5454        </g:each>
    5555        <tr>
    56             <td align="right" colspan="${datamatrix.length}"><input type="submit" value="Accept"></td>
     56            <td align="right" colspan="${datamatrix.length}"><input type="submit" value="Next"></td>
    5757        </tr>
    5858  </table>
  • trunk/grails-app/views/importer/common/_properties.gsp

    r203 r215  
    2727                            </td>
    2828                            <td>
    29                                 <g:select name="property" from="${['BMI', 'DOB', 'Gender']}" />
     29                               
     30                                <g:each var="template" in="${templates}">
     31                                    ${template.studyFields()}
     32                                </g:each>
    3033                            </td>
    3134                    </g:if>
  • trunk/grails-app/views/importer/index.gsp

    r147 r215  
    1717        <table border="0">
    1818        <tr>
    19             <td width="160px">Choose your Excel file to import:</td>
    20             <td width="280px"><input type="file" name="importfile"/></td>
    21             <td><input type="submit" value="Import"/></td>
    22         </tr>   
     19            <td width="100px">
     20                Choose your Excel file to import:
     21            </td>
     22            <td width="100px">
     23                <input type="file" name="importfile"/>
     24            </td>
     25        </tr>
     26        <tr>
     27            <td>
     28                Template
     29            </td>
     30            <td>
     31                <g:select name="template_id" from="${templates}" optionKey="id"/>
     32            </td>
     33        </tr>
     34        <tr>
     35            <td colspan="2">
     36                <input type="submit" value="Next"/>
     37            </td>
     38        </tr>
    2339        </table>
    2440        </g:form>
  • trunk/grails-app/views/importer/step1.gsp

    r203 r215  
    2020    <meta name="layout" content="main"/>
    2121    <link rel="stylesheet" href="${resource(dir: 'css', file: 'importer.css')}"/>
    22     <title>Import wizard preview</title>
     22    <title>Step 1: import wizard preview</title>
    2323  </head>
    2424  <body>
    25     <h1>Import wizard preview</h1>
     25    <h1>Step 1: import wizard preview</h1>
    2626    <p>Below you see a preview of your imported file, please correct the automatically detected types.</p>
    27   <importer:preview header="${header}" datamatrix="${datamatrix}"/>
    28   </body>
    29 
     27  <importer:preview header="${header}" datamatrix="${datamatrix}"/> 
     28  </body> 
    3029</html>
  • trunk/grails-app/views/importer/step2.gsp

    r203 r215  
    2626    <h1>Step 2: import wizard entities/properties</h1>
    2727    <p>Below you see the entities and columns, assign properties to the columns.</p>
    28   <importer:properties entities="${entities}" header="${header}"/>
     28  <importer:properties entities="${entities}" header="${header}" templates="${templates}"/>
    2929  </body>
    3030</html>
Note: See TracChangeset for help on using the changeset viewer.