source: main/trunk/ibisph-admin/src/main/webapp/WEB-INF/tags/mergeRecordData.tag @ 21373

Last change on this file since 21373 was 21373, checked in by GarthBraithwaite_STG, 2 months ago

admin - commented out related_indicators.jsp grouping. Reworked IPV dataset record edit interface to show red if the constant value has "year" in it's title. Reworked the mergeRecordData.tag to have a popup if the user selects overwrite existing data. Added listed steps and help.

File size: 7.7 KB
Line 
1<%@tag description="Merge Record Data template"%>
2
3<%@include file="/WEB-INF/jsp/_taglibs.jsp"%>
4
5<%@attribute name="title"%>
6<%@attribute name="cssClass"%>
7<%@attribute name="startingDestinationTableRow"%>
8<%@attribute name="tableRowIndexAdjustment"%>
9<%@attribute name="firstNumericElementTDQuerySelector"%>
10
11<%@attribute name="help"%>
12
13<c:set var="mergeDestinationStartingRowHelp">
14        The starting destination row allows you to specify where this data will be
15        inserted into the dataset records table.  This value indexes starting at 1
16        which means 1 = the first row of data.
17</c:set>
18<c:set var="mergeDelimiterHelp">
19        Specifies how the above data values are seperated. 
20        Use <code class="Bold Larger">\t</code> if pasting from MS-Excel,
21        use a <code class="Bold Larger">comma</code> for CSV,
22        other delimiters could be <code class="Bold Larger">space, | #</code> etc.
23        <br/><br/>
24        Note: delimiter values are typically a single character but are not limited
25        to a single character.  For example you might have data that uses a string
26        like <code class="Bold Larger">#!#</code> that delimits the values etc.
27</c:set>
28
29<c:set var="mergeOverwriteHelp">
30        If you want to overwrite existing data make you MUST check this box.  If unchecked
31        then data is only merged into blank existing cells.  So if you are entering a
32        new year, all fields/cells on the dataset record page *SHOULD* be blank and thus
33        this option does not need to be selected.
34        <br/><br/>
35
36        <div class="Bold">IMPORTANT: Be very careful using this
37        option as it is rarely needed or used in this new version of the application. 
38        In older versions this was used to update all values when a new current year's
39        data was being implemented.  In version 3 this is NOT used as new data MUST
40        be associated with a new period dimension value.  This allows historical data
41        to not be thrown away so it can be used for trending etc.
42</c:set>
43
44<div id="mergeDialog" class="${empty cssClass ? "ModalDialog" : cssClass}">
45        <a href="javascript:global.mergeDialog.hide()" title="Close" class="CloseBox"><img src="${pageContext.request.contextPath}/image/icon/32/closebox.png"/></a>
46        <div class="InnerCanvas" style="padding: 2em;">
47                <h2 class="TitleBar">Merge Data into ${title} <tag:help content="${help}"/></h2>
48                <hr/>
49                <div id="mergeDialogContentContainer">
50                        <br/>
51                        The "Merge Data" function allows data to be copied from outside
52                        applications like Excel spreadsheets, database tools, or CSV files
53                        and pasted into the dataset record value cells.
54                        <br/><br/>
55
56                        <h4>Steps:</h4>
57                        <ol>
58                                <li>
59                                        <label for="mergeDataToParse">Paste and/or enter delimited values to be merged into the dataset records table:</label><br/>
60                                        <textarea id="mergeDataToParse" rows="10" title="Paste the delimited data into this edit box - or edit directly."></textarea>
61                                        <div class="Note">IMPORTANT: both the row and column
62                                                data ordering MUST match exactly.  This means that the series
63                                                and category values are not cross matched - the data is placed
64                                                into the table in the exact order as exists above.
65                                        </div>
66                                </li>
67                                <li title="Use '\t' for Excel, or any character like ',' or ' ' etc.">
68                                        <label for="mergeColumnDelimiter">Enter the delimiter for the pasted/entered values:</label>
69                                        <input type="text" name="mergeColumnDelimiter" id="mergeColumnDelimiter"
70                                                value="\t" maxlength="10" style="width: 4em;"
71                                        />
72                                        <tag:help content="${mergeDelimiterHelp}"/>
73                                </li>
74                                <li title="Starting row to merge the data to.">
75                                        <label for="mergeStartingTableRow">Enter the destination starting row: </label>
76                                        <input type="number" id="mergeStartingTableRow" maxlength="4"
77                                                value="${(empty startingDestinationTableRow) ? 1 : startingDestinationTableRow}"
78                                                indexAdjustment="${(empty tableRowIndexAdjustment) ? -1 : tableRowIndexAdjustment}"
79                                                style="width: 4em;"
80                                        />
81                                        <tag:help content="${mergeDestinationStartingRowHelp}"/>
82                                </li>
83
84                                <li>
85                                        <input type="checkbox" name="mergeOverwriteNonBlankData" id="mergeOverwriteNonBlankData" value="true"
86                                                onclick="javascript:alertIfExistingData()"
87                                                title="Check this to overwrite existing non blank data values."
88                                        />
89                                        <label for="mergeOverwriteNonBlankData">Check this to allow any existing, non blank data to be overwritten (if applicable).
90                                        <tag:help content="${mergeOverwriteHelp}"/>
91                                        </label>
92                                </li>
93
94                                <li>
95                                        Press the [Merge] button to proceed or click the "x" located
96                                        in the upper right corner of this window to cancel this operation. 
97                                        <br/>
98                                        <input type="button" value="Merge Data" onclick="mergeParsedData()" style="padding: 0.5em 1em; margin-top: 1em;"/>
99                                        <br/><br/>
100
101                                        <div class="Note">
102                                                If you proceed with the merge operation and do not like the
103                                                merged result you can always use the "Reset" option which will
104                                                reset the page to the point of when it was first entered. 
105                                                Once back to the dataset records page IF you "Save" or
106                                                navigate to another page the values will be committed.
107                                        </div>
108                                </li>
109                        </ol>
110                </div>
111
112        </div>
113</div>
114
115
116<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/ModalDialog.css"/>
117
118<script language="JavaScript" type="text/javascript" src="${pageContext.request.contextPath}/js/DocumentSize.js"></script>
119<script language="JavaScript" type="text/javascript" src="${pageContext.request.contextPath}/js/ModalDialog.js"></script>
120<script language="JavaScript" type="text/javascript" src="${pageContext.request.contextPath}/js/merge.js"></script>
121
122<script language="JavaScript" type="text/javascript" src="${pageContext.request.contextPath}/js/Cookie.js"></script>
123<script language="JavaScript" type="text/javascript" src="${pageContext.request.contextPath}/js/NamedInputElement.js"></script>
124<script language="JavaScript" type="text/javascript" src="${pageContext.request.contextPath}/js/CookieBoundInputElement.js"></script>
125<script>
126        function showMergeDataDialog()
127        {
128                if(!global.mergeDialog)
129                {
130                        global.mergeDialog = new ModalDialog("mergeDialog", "mergeDialogContentContainer");
131                }
132                global.mergeDialog.show();
133        } //~~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~~~
134
135
136        // checks if any blank values.  If so then show alert message.
137        function alertIfExistingData()
138        {
139                var isChecked = document.getElementById("mergeOverwriteNonBlankData").checked;
140
141                if(isChecked)
142                {
143                        var nonBlankValuesFound = false;
144                        var elements = document.getElementsByName("measureValue");
145                        for(var i = 0, element; element = elements[i++];)
146                        {
147                                nonBlankValuesFound = (element.value > " ");
148                                if(nonBlankValuesFound) break;
149                        }
150                        if(nonBlankValuesFound) alert(
151                                "***   STOP!   IMPORTANT WARNING!   DATA EXISTS!   READ BELOW!   ***\n\n"
152                                + "Do NOT proceed if you are updating a new years data! "
153                                + "Close the Merge Data window to return to the records entry page "
154                                + "and correct this issue by changing to the appropriate year. If you proceed "
155                                + "you will loose or corrupt valid historical data. \n\n"
156                                + "If you are not updating data to a new year proceed with extreme caution "
157                                + "and verify each and every value before saving the values."
158                        );
159                }
160        } //~~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~~~
161
162
163
164        // called from the dialog's [Merge] button when clicked.
165        function mergeParsedData()
166        {
167                mergeTextAreaDataToTableInput(
168                        "mergeDataToParse",
169                        "mergeColumnDelimiter",
170                        "valuesTable",
171                        "mergeStartingTableRow",
172                        "td.Number",
173                        "mergeOverwriteNonBlankData"
174                );
175                global.mergeDialog.hide();
176        } //~~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~~~
177</script>
Note: See TracBrowser for help on using the repository browser.