1 | <%@ page import="org.dbnp.gdt.GdtService" %> |
---|
2 | <% |
---|
3 | /** |
---|
4 | * Properties template which shows entities and allows to assign properties to columns |
---|
5 | * |
---|
6 | * @author Tjeerd Abma |
---|
7 | * @since 20100210 |
---|
8 | * @package importer |
---|
9 | * |
---|
10 | * Revision information: |
---|
11 | * $Rev: 1556 $ |
---|
12 | * $Author: t.w.abma@umcutrecht.nl $ |
---|
13 | * $Date: 2011-02-24 12:38:17 +0000 (do, 24 feb 2011) $ |
---|
14 | */ |
---|
15 | %> |
---|
16 | |
---|
17 | |
---|
18 | <!-- saveproperties action was defined in the form --> |
---|
19 | <table> |
---|
20 | <tr><td colspan="3"><h4>${importer_entity.name}</h4></td></tr> |
---|
21 | <tr> |
---|
22 | <td class="header" width="55px"> |
---|
23 | <input class="buttonsmall" id="clearselect" type="button" value="Clear" name="clearselect" title="Clear all selections"> |
---|
24 | <input class="buttonsmall" id="fuzzymatchselect" type="button" value="Match" name="fuzzymatchselect" title="Automatically match columns to properties"> |
---|
25 | <input type="hidden" name="fuzzymatching" id="fuzzymatching" value="false"> |
---|
26 | <input class="buttonsmall" id="savepropertiesbutton" type="button" value="Save" name="savepropertiesbutton" title="Save the currently set mappings"> |
---|
27 | <input class="buttonsmall" id="loadpropertiesbutton" type="button" value="Load" name="loadpropertiesbutton" title="Load previously saved mappings"> |
---|
28 | <div id="savemapping" style="display:none"> |
---|
29 | Give current mapping a name and press Save: |
---|
30 | <input type="text" name="mappingname" size="20" id="mappingname"> |
---|
31 | </div> |
---|
32 | <div id="loadmapping" style="display:none"> |
---|
33 | Select an existing mapping and press Load: |
---|
34 | <g:select name="importmapping_id" from="${importer_importmappings}" noSelection="['':'-Select mapping-']" optionValue="name" optionKey="id"/> |
---|
35 | </div> |
---|
36 | </td> |
---|
37 | |
---|
38 | <g:set var="usedfuzzymatches" value="${'-'}"/> |
---|
39 | |
---|
40 | <g:each var="mappingcolumn" in="${importer_header}"> |
---|
41 | <!-- set selected values based on submitted columnproperties, actually refresh --> |
---|
42 | <g:if test="${importer_columnproperty}"> |
---|
43 | <g:set var="selected" value="${importer_columnproperty.index['' + mappingcolumn.index + '']}"/> |
---|
44 | </g:if> |
---|
45 | <g:else> |
---|
46 | <g:set var="selected" value="${mappingcolumn.property}"/> |
---|
47 | </g:else> |
---|
48 | |
---|
49 | <g:set var="matchvalue" value="${mappingcolumn.name}"/> |
---|
50 | |
---|
51 | <td class="header" width="200px"> |
---|
52 | <b>${mappingcolumn.name}</b> |
---|
53 | |
---|
54 | <!-- store the found match --> |
---|
55 | <g:set var="fuzzymatch" value="${importer.propertyChooser(name:columnproperty, mappingcolumn:mappingcolumn, matchvalue:mappingcolumn.name, selected:selected, fuzzymatching:importer_fuzzymatching, template_id:importer_template_id, returnmatchonly:'true')}"/> |
---|
56 | |
---|
57 | <g:if test="${usedfuzzymatches.contains( fuzzymatch.toString() ) }"> |
---|
58 | <g:set var="matchvalue" value=""/> |
---|
59 | </g:if> |
---|
60 | |
---|
61 | <importer:propertyChooser name="columnproperty" mappingcolumn="${mappingcolumn}" matchvalue="${matchvalue}" selected="${selected}" fuzzymatching="${importer_fuzzymatching}" template_id="${importer_template_id}" allfieldtypes="true"/> |
---|
62 | </td> |
---|
63 | |
---|
64 | <!-- build up a string with fuzzy matches used, to prevent duplicate fuzzy matching --> |
---|
65 | <g:set var="usedfuzzymatches" value="${usedfuzzymatches + ',' + fuzzymatch.toString() }"/> |
---|
66 | |
---|
67 | </g:each> |
---|
68 | </tr> |
---|
69 | |
---|
70 | <g:each var="row" in="${session.importer_datamatrix}"> |
---|
71 | <tr> |
---|
72 | <td class="datamatrix"> |
---|
73 | </td> |
---|
74 | <g:each var="cell" in="${row}"> |
---|
75 | <td class="datamatrix"> |
---|
76 | <g:if test="${cell.toString()==''}">.</g:if> |
---|
77 | <g:else><importer:displayCell cell="${cell}"/></g:else> |
---|
78 | </td> |
---|
79 | </g:each> |
---|
80 | </tr> |
---|
81 | </g:each> |
---|
82 | |
---|
83 | </table> |
---|