1 | <?xml version="1.0" encoding="ISO-8859-1"?> |
---|
2 | |
---|
3 | <xsl:stylesheet version="3.0" |
---|
4 | xmlns:xsl ="http://www.w3.org/1999/XSL/Transform" |
---|
5 | xmlns:ibis="http://www.ibisph.org" |
---|
6 | |
---|
7 | exclude-result-prefixes="ibis" |
---|
8 | > |
---|
9 | <xsl:import href="../Page.xslt"/> |
---|
10 | |
---|
11 | <ibis:doc> |
---|
12 | <name>html/indicator/index/table/TablePage</name> |
---|
13 | <summary>Indicator Profile Index DS List page</summary> |
---|
14 | <description> |
---|
15 | </description> |
---|
16 | </ibis:doc> |
---|
17 | |
---|
18 | |
---|
19 | <xsl:param name="Page.pageTitle" ibis:doc="Page's title text.">Sortable, Filterable Table of all Health Indicator Reports</xsl:param> |
---|
20 | |
---|
21 | <xsl:param name="DataSources"/> |
---|
22 | <xsl:param name="Page.dataSources" select="$DataSources/DATA_SOURCES"/> |
---|
23 | |
---|
24 | <xsl:param name="Page.overviewContent" ibis:doc="localizes the cat index overview content. Set blank to turn this off."> |
---|
25 | Click on an indicator report link to view a report. Use the search box to |
---|
26 | search the entire table. Click on a column header to sort by that column. |
---|
27 | Use the table's header column menus (<span font-icon="" style="background-color: #ddd"/>) to filter |
---|
28 | table rows and/or hide/unhide columns. |
---|
29 | </xsl:param> |
---|
30 | |
---|
31 | |
---|
32 | <xsl:param name="Page.kendoGridJSON"> |
---|
33 | { |
---|
34 | "autoBind": false // "read()" will fire the "change" event of the dataSource and the widget will be bound |
---|
35 | ,"columnMenu": true |
---|
36 | ,"filterable": true |
---|
37 | ,"resizable": true |
---|
38 | ,"reorderable": true |
---|
39 | ,"groupable": true |
---|
40 | ,"navigatable": true |
---|
41 | ,"scrollable": false |
---|
42 | ,"selectable": "multiple cell" |
---|
43 | ,"allowCopy": true |
---|
44 | ,"pageable": false |
---|
45 | ,"sortable": |
---|
46 | { |
---|
47 | "allowUnsort": false |
---|
48 | ,"mode": "single" |
---|
49 | } |
---|
50 | ,"theme": "silver" |
---|
51 | ,"toolbar": [ { "template": kendo.template($("#gridSearchTemplate").html()) } ] |
---|
52 | ,"dataSource": kendoDataSource |
---|
53 | ,"columns": |
---|
54 | [<xsl:text/> |
---|
55 | { |
---|
56 | "field": "name" |
---|
57 | ,"title": "Indicator Profile ID" |
---|
58 | ,"hidden": true |
---|
59 | } |
---|
60 | ,{ |
---|
61 | "field": "title" |
---|
62 | ,"title": "Indicator Report Title" |
---|
63 | ,"template": "<a href=\"../summary/#=name#.html\">#=title#</a>" |
---|
64 | } |
---|
65 | ,{ |
---|
66 | "field": "viewNames" |
---|
67 | ,"title": "Data View IDs" |
---|
68 | ,"hidden": true |
---|
69 | ,encoded: false |
---|
70 | } |
---|
71 | ,{ |
---|
72 | "field": "viewTitles" |
---|
73 | ,"title": "Data Views" |
---|
74 | ,encoded: false |
---|
75 | } |
---|
76 | ,{ |
---|
77 | "field": "dataSourceNames" |
---|
78 | ,"title": "Data Source IDs" |
---|
79 | ,"hidden": true |
---|
80 | ,encoded: false |
---|
81 | } |
---|
82 | ,{ |
---|
83 | "field": "dataSourceTitles" |
---|
84 | ,"title": "Data Sources" |
---|
85 | ,encoded: false |
---|
86 | } |
---|
87 | ,{ |
---|
88 | "field": "orgUnitName" |
---|
89 | ,"title": "Authoring Program ID" |
---|
90 | ,"hidden": true |
---|
91 | /* |
---|
92 | ,"template": "<a href=\"../view/#=name#.html\">#=title#</a>" |
---|
93 | ,"template": "#=MeasureValueTitle#" |
---|
94 | ,"attributes": {"class": "SeriesColumn Dimension"} |
---|
95 | ,"sortable": |
---|
96 | { |
---|
97 | "compare": function (a, b) |
---|
98 | { |
---|
99 | var diff = a.MeasureValue - b.MeasureValue; |
---|
100 | return(diff);<xsl:text/> |
---|
101 | } |
---|
102 | } |
---|
103 | ,"footerTemplate": "<div>footer row title</div>" <!-- tried to do away with div so excel export looked better but can't do with css as 1d vs 2d messes with it --> |
---|
104 | */ |
---|
105 | } |
---|
106 | ,{ |
---|
107 | "field": "orgUnitTitle" |
---|
108 | ,"title": "Authoring Program" |
---|
109 | } |
---|
110 | ,{ |
---|
111 | "field": "publishedDate" |
---|
112 | ,"title": "Published Date" |
---|
113 | ,"template": "#=kendo.toString(kendo.parseDate(publishedDate, 'MM/dd/yyyy'), 'MMM dd, yyyy')#" |
---|
114 | } |
---|
115 | <xsl:text/> |
---|
116 | ] |
---|
117 | } |
---|
118 | </xsl:param> |
---|
119 | |
---|
120 | |
---|
121 | |
---|
122 | <xsl:template name="Page.contentBody"> |
---|
123 | <p><xsl:copy-of select="$Page.overviewContent"/></p> |
---|
124 | |
---|
125 | <!-- as per: https://www.telerik.com/forums/search-panel-and-toolbar-template --> |
---|
126 | <script id="gridSearchTemplate" type="text/x-kendo-template"> |
---|
127 | <span class="k-textbox k-grid-search k-display-flex"> |
---|
128 | <input autocomplete="off" placeholder="Filter..." title="Filter..." class="k-input"/> |
---|
129 | <span class="k-input-icon"> |
---|
130 | <span class="k-icon k-i-search"></span> |
---|
131 | </span> |
---|
132 | </span> |
---|
133 | </script> |
---|
134 | |
---|
135 | <div id="grid"/> |
---|
136 | |
---|
137 | <xsl:call-template name="getJavascript" ibis:doc=""> |
---|
138 | </xsl:call-template> |
---|
139 | </xsl:template> |
---|
140 | |
---|
141 | |
---|
142 | |
---|
143 | <xsl:template name="getJavascript" ibis:doc=""> |
---|
144 | <xsl:param name="gridContainerID" select="'grid'"/> |
---|
145 | |
---|
146 | <script type="text/javascript"> |
---|
147 | |
---|
148 | <!-- RECORDS ARRAY --> |
---|
149 | var recordsJSON = |
---|
150 | [<xsl:text> </xsl:text> |
---|
151 | <xsl:for-each select="$Page.publishedIndicators"> |
---|
152 | <xsl:sort select="TITLE"/> |
---|
153 | <xsl:if test="1 != position()">,</xsl:if><xsl:text>{</xsl:text> |
---|
154 | "name": "<xsl:value-of select="NAME"/>" |
---|
155 | ,"title": "<xsl:value-of select="TITLE"/>" |
---|
156 | ,"dataSourceNames": "<xsl:call-template name="getDataSourceNames"><xsl:with-param name="publishedIndicator" select="current()"/></xsl:call-template>" |
---|
157 | ,"dataSourceTitles":"<xsl:call-template name="getDataSourceTitles"><xsl:with-param name="publishedIndicator" select="current()"/></xsl:call-template>" |
---|
158 | ,"viewNames": "<xsl:call-template name="getViewNames"> <xsl:with-param name="publishedIndicator" select="current()"/></xsl:call-template>" |
---|
159 | ,"viewTitles": "<xsl:call-template name="getViewTitles"> <xsl:with-param name="publishedIndicator" select="current()"/></xsl:call-template>" |
---|
160 | ,"orgUnitName": "<xsl:value-of select="current()/ORG_UNIT_NAME"/>" |
---|
161 | ,"orgUnitTitle": "<xsl:value-of select="$Page.orgUnits/ORG_UNIT[NAME = current()/ORG_UNIT_NAME]/TITLE"/>" |
---|
162 | ,"publishedDate": "<xsl:value-of select="current()/PUBLISHED_DATE"/>" |
---|
163 | <xsl:text>}</xsl:text> |
---|
164 | </xsl:for-each> |
---|
165 | ]; |
---|
166 | |
---|
167 | |
---|
168 | <!-- KENDO DATA SOURCE JSON --> |
---|
169 | var dataSourceJSON = |
---|
170 | <xsl:text>{</xsl:text> |
---|
171 | "data": recordsJSON |
---|
172 | ,"schema": |
---|
173 | { |
---|
174 | "model": |
---|
175 | { |
---|
176 | "id": "name" |
---|
177 | ,"fields": |
---|
178 | { |
---|
179 | "name": { type: "string", editable: false } |
---|
180 | ,"title": { type: "string" } |
---|
181 | ,"dataSourceNames": { type: "string" } |
---|
182 | ,"dataSourceTitles":{ type: "string" } |
---|
183 | ,"viewNames": { type: "string" } |
---|
184 | ,"viewTitles": { type: "string" } |
---|
185 | ,"orgUnitName": { type: "string" } |
---|
186 | ,"orgUnitTitle": { type: "string" } |
---|
187 | ,"publishedDate": { type: "date" } |
---|
188 | } |
---|
189 | } |
---|
190 | } |
---|
191 | ,"sort": |
---|
192 | [ |
---|
193 | {"field": "title"} |
---|
194 | ]<xsl:text/> |
---|
195 | };<xsl:text/> |
---|
196 | |
---|
197 | |
---|
198 | var kendoDataSource = new kendo.data.DataSource(dataSourceJSON); |
---|
199 | var kendoGrid; |
---|
200 | $(document).ready(function() |
---|
201 | { |
---|
202 | $kendoGrid = $("#<xsl:value-of select="$gridContainerID"/>").kendoGrid(<xsl:copy-of select="$Page.kendoGridJSON"/>); |
---|
203 | |
---|
204 | // "read" fires the "change" event of the dataSource and any objects |
---|
205 | // that ref the data source will be bound. This needs to occur |
---|
206 | // after the grid and chart are created because .autoBind = false. |
---|
207 | // Can also fire load by issuing a sort: |
---|
208 | // $kendoGrid.getKendoGrid().dataSource.sort({field: "CategorySortOrder", dir: "asc"}); |
---|
209 | kendoDataSource.read(); |
---|
210 | }); //~~~~~~~~~~~~~~~~~~~~ End of Ready Function ~~~~~~~~~~~~~~~~~~~ |
---|
211 | </script> |
---|
212 | |
---|
213 | </xsl:template> |
---|
214 | |
---|
215 | |
---|
216 | |
---|
217 | <xsl:template name="getDataSourceNames" ibis:doc="localizes getting the associated data source name(s)."> |
---|
218 | <xsl:param name="publishedIndicator"/> |
---|
219 | <ul> |
---|
220 | <xsl:for-each select="distinct-values($publishedIndicator//DATA_SOURCE_USAGE[USAGE = 'numerator']/NAME)"> |
---|
221 | <li><xsl:value-of select="current()"/></li> |
---|
222 | </xsl:for-each> |
---|
223 | </ul> |
---|
224 | </xsl:template> |
---|
225 | |
---|
226 | <xsl:template name="getDataSourceTitles" ibis:doc="localizes getting the associated data source(s)."> |
---|
227 | <xsl:param name="publishedIndicator"/> |
---|
228 | <ul> |
---|
229 | <xsl:for-each select="$Page.dataSources/DATA_SOURCE[NAME = $publishedIndicator//DATA_SOURCE_USAGE[(USAGE = 'numerator')]/NAME]"> |
---|
230 | <li><xsl:value-of select="current()/TITLE"/></li> |
---|
231 | </xsl:for-each> |
---|
232 | </ul> |
---|
233 | </xsl:template> |
---|
234 | |
---|
235 | <xsl:template name="getViewNames" ibis:doc="localizes getting the associated view name(s)."> |
---|
236 | <xsl:param name="publishedIndicator"/> |
---|
237 | <ul> |
---|
238 | <xsl:for-each select="$publishedIndicator//INDICATOR_VIEW"> |
---|
239 | <li><xsl:value-of select="current()/NAME"/></li> |
---|
240 | </xsl:for-each> |
---|
241 | </ul> |
---|
242 | </xsl:template> |
---|
243 | <xsl:template name="getViewTitles" ibis:doc="localizes getting the associated view(s)."> |
---|
244 | <xsl:param name="publishedIndicator"/> |
---|
245 | <ul> |
---|
246 | <xsl:for-each select="$publishedIndicator//INDICATOR_VIEW"> |
---|
247 | <li><xsl:value-of select="current()/TITLE"/></li> |
---|
248 | </xsl:for-each> |
---|
249 | </ul> |
---|
250 | </xsl:template> |
---|
251 | |
---|
252 | </xsl:stylesheet> |
---|
253 | <!-- ============================= End of File ============================= --> |
---|