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: 1505 $ |
---|
12 | * $Author: t.w.abma@umcutrecht.nl $ |
---|
13 | * $Date: 2011-02-08 14:53:49 +0000 (di, 08 feb 2011) $ |
---|
14 | */ |
---|
15 | %> |
---|
16 | <script type="text/javascript"> |
---|
17 | |
---|
18 | // for each select field on the page |
---|
19 | $(document).ready(function() { |
---|
20 | |
---|
21 | $('select[name^=columnproperty.index.]').each ( function() { |
---|
22 | |
---|
23 | $(this).bind('change', function(e) { |
---|
24 | //console.log($(this).val()) |
---|
25 | var selection = $(this) |
---|
26 | |
---|
27 | $('select[name^=columnproperty.index.] option:selected').each ( function() { |
---|
28 | var selector = $(this) |
---|
29 | |
---|
30 | if (selection.attr('id') != selector.parent().attr('id') && (selection.val()!="dontimport")) |
---|
31 | if ($(this).val() == selection.val()) { |
---|
32 | selection.val($('option:first', selection).val()); |
---|
33 | |
---|
34 | alert("Property is already set for an other column, please choose a different property.") |
---|
35 | return false |
---|
36 | } |
---|
37 | }); |
---|
38 | |
---|
39 | }); |
---|
40 | |
---|
41 | }); |
---|
42 | |
---|
43 | |
---|
44 | |
---|
45 | }); |
---|
46 | </script> |
---|
47 | <!-- saveproperties action was defined in the form --> |
---|
48 | <table> |
---|
49 | <g:each var="stdentity" in ="${GdtService.cachedEntities}"> |
---|
50 | <% if (importer_selectedentities.any { it.name.toLowerCase() == stdentity.entity.toLowerCase() } && stdentity.entity!="") { %> |
---|
51 | |
---|
52 | <tr><td colspan="3"><h4>${stdentity.name}</h4></td></tr> |
---|
53 | <tr> |
---|
54 | <td class="header" width="25px"><input id="clearselect" type="button" value="Clear" name="clearselect"> |
---|
55 | <input id="fuzzymatchselect" type="button" value="Match" name="fuzzymatchselect"> |
---|
56 | </td> |
---|
57 | <g:each var="selentity" in="${importer_selectedentities}"> |
---|
58 | <g:if test="${selentity.name.toLowerCase()==stdentity.entity.toLowerCase()}"> |
---|
59 | <td class="header" width="200px"> |
---|
60 | <b>${importer_header[selentity.columnindex.toInteger()].name}</b> |
---|
61 | <importer:propertyChooser name="columnproperty" mappingcolumn="${importer_header[selentity.columnindex.toInteger()]}" matchvalue="${importer_header[selentity.columnindex.toInteger()].name}" fuzzymatching="${importer_fuzzymatching}" template_id="${importer_template_id}" allfieldtypes="true"/> |
---|
62 | </td> |
---|
63 | </g:if> |
---|
64 | </g:each> |
---|
65 | </tr> |
---|
66 | |
---|
67 | <g:each var="row" in="${session.importer_datamatrix}"> |
---|
68 | <tr> |
---|
69 | <td class="datamatrix"> |
---|
70 | </td> |
---|
71 | <g:each var="cell" in="${row}"> |
---|
72 | <td class="datamatrix"> |
---|
73 | <g:if test="${cell.toString()==''}">.</g:if> |
---|
74 | <g:else><importer:displayCell cell="${cell}"/></g:else> |
---|
75 | </td> |
---|
76 | </g:each> |
---|
77 | </tr> |
---|
78 | </g:each> |
---|
79 | |
---|
80 | <% } %> <!-- end of JSP if--> |
---|
81 | </g:each> |
---|
82 | </table> |
---|