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="../../json/Dataset.xslt"/> |
---|
10 | <xsl:import href="../../json/Kendo.xslt"/> |
---|
11 | <xsl:import href="../../json/LeafletMap.xslt"/> |
---|
12 | <xsl:import href="../../xml/Interactive.xslt"/> |
---|
13 | <xsl:import href="../../xml/ComparisonValues.xslt"/> |
---|
14 | <xsl:import href="../DataViz.xslt"/> |
---|
15 | <xsl:import href="../Page.xslt"/> |
---|
16 | |
---|
17 | <ibis:doc> |
---|
18 | <name>html/community/Page</name> |
---|
19 | <summary>Default core code that most Community profile Pages inherit from</summary> |
---|
20 | <description> |
---|
21 | Community profile base XSLT. |
---|
22 | |
---|
23 | Since this XSLT is needed for all community pages even though the |
---|
24 | facts page is HTML_CONTENT implemented CSS via XSLT like: |
---|
25 | [xsl:param name="Page.htmlClass" select="'Community'"/] |
---|
26 | [xsl:template name="Page.specificCSS"] |
---|
27 | [link rel="stylesheet" type="text/css" href="css/Community.css"/] |
---|
28 | [/xsl:template] |
---|
29 | |
---|
30 | For facts could have used for the XML elements for Topic CSS but this |
---|
31 | only covers the facts and not all community report type requests. |
---|
32 | HTML_CLASS]Community[/HTML_CLASS] |
---|
33 | [OTHER_HEAD_CONTENT] |
---|
34 | [link ibis:href="css/Community.css" rel="stylesheet" type="text/css"/] |
---|
35 | [/OTHER_HEAD_CONTENT] |
---|
36 | </description> |
---|
37 | </ibis:doc> |
---|
38 | |
---|
39 | <xsl:param name="Page.stateTitle" select="$ibis.adopterTitle"/> |
---|
40 | |
---|
41 | <xsl:param name="Page.htmlClass" select="'Community'"/> |
---|
42 | |
---|
43 | <!-- Request parameter names and XML models injected by the controller --> |
---|
44 | <xsl:param name="Dimensions"/> |
---|
45 | <xsl:param name="Page.dimensions" select="$Dimensions/DIMENSIONS"/> |
---|
46 | <xsl:param name="Measures"/> |
---|
47 | <xsl:param name="Page.measures" select="$Measures/MEASURES"/> |
---|
48 | <xsl:param name="ValueTypes"/> |
---|
49 | <xsl:param name="Page.valueTypes" select="$ValueTypes/VALUE_TYPES"/> |
---|
50 | |
---|
51 | <xsl:param name="CommunityReportType"/> |
---|
52 | <xsl:param name="Page.communityReportType" select="if(0 = string-length($CommunityReportType)) then 'indicators' else $CommunityReportType"/> |
---|
53 | |
---|
54 | <xsl:param name="IndicatorName"/> |
---|
55 | <xsl:param name="Page.indicatorName" select="$IndicatorName"/> |
---|
56 | |
---|
57 | <xsl:param name="IndicatorProfilePath"/> |
---|
58 | <xsl:param name="Page.indicatorProfilePath" select="$IndicatorProfilePath"/> |
---|
59 | |
---|
60 | <xsl:param name="IndicatorSets"/> |
---|
61 | <xsl:param name="Page.indicatorSets" select="$IndicatorSets/INDICATOR_SETS"/> |
---|
62 | |
---|
63 | <xsl:param name="IndicatorSetName"/> |
---|
64 | <xsl:param name="Page.indicatorSetName" select="if(0 = string-length($IndicatorSetName)) then $Page.indicatorSets/INDICATOR_SET[1]/NAME else $IndicatorSetName"/> |
---|
65 | <xsl:param name="Page.indicatorSet" select="$Page.indicatorSets/INDICATOR_SET[NAME = $Page.indicatorSetName]"/> |
---|
66 | |
---|
67 | <!-- main model map. NULL element if not exists. --> |
---|
68 | <xsl:param name="Page.communityProfile" select="/COMMUNITY_PROFILE"/> |
---|
69 | <xsl:param name="Page.communityIndicatorSet" select="if(0 = count($Page.communityProfile/INDICATOR_SET_NAMES/INDICATOR_SET_NAME)) |
---|
70 | then $Page.indicatorSets/INDICATOR_SET |
---|
71 | else $Page.indicatorSets/INDICATOR_SET[NAME = $Page.communityProfile/INDICATOR_SET_NAMES/INDICATOR_SET_NAME]" |
---|
72 | /> |
---|
73 | |
---|
74 | <!-- GARTH TODO: discuss with Lois/CoP |
---|
75 | Implemented as a simple list so that adopters can override |
---|
76 | -or- |
---|
77 | adopters can simply deselect the COMMUNITY_FLAG in the db for those |
---|
78 | dimensions they don't want to be considered a community. |
---|
79 | xsl:param name="Page.communityNames" select="$Page.dimensions/DIMENSION[COMMUNITY_FLAG = 'x']/NAME" |
---|
80 | --> |
---|
81 | <xsl:param name="Page.communityNames" select="'GeoCnty', 'GeoRegion', |
---|
82 | 'GeoSarea', 'GeoSchDist', 'RacEthDOH', 'Sex', 'SexualOrientation', |
---|
83 | 'Income5Grps' |
---|
84 | "/> |
---|
85 | |
---|
86 | <xsl:param name="DimensionName"/> |
---|
87 | <xsl:param name="Page.communityName" select="if($Page.communityNames = $DimensionName) then $DimensionName else $Page.communityNames[1]"/> |
---|
88 | |
---|
89 | <xsl:param name="DimensionValue"/> |
---|
90 | <xsl:param name="Page.communityValue" select="$DimensionValue"/> |
---|
91 | |
---|
92 | <xsl:param name="Page.communityDimension" select="$Page.dimensions/DIMENSION[NAME = $Page.communityName]"/> |
---|
93 | <xsl:param name="Page.communityDimensionValue" select="$Page.communityDimension/VALUES/VALUE[normalize-space(text()[1]) = $Page.communityValue]"/> |
---|
94 | <xsl:param name="Page.previousDimensionValue" select="$Page.communityDimensionValue/preceding-sibling::*[not(NOT_SELECTABLE_FLAG)][1]"/> |
---|
95 | <xsl:param name="Page.nextDimensionValue" select="$Page.communityDimensionValue/following-sibling::*[not(NOT_SELECTABLE_FLAG)][1]"/> |
---|
96 | |
---|
97 | <xsl:param name="Page.communityDimensionTitle" select="ibis:getDimensionTitle($Page.communityDimension)"/> |
---|
98 | |
---|
99 | |
---|
100 | <!-- Optional file that allows filtering out of IP sets and possibly other |
---|
101 | options that lois/adopters want. |
---|
102 | --> |
---|
103 | <xsl:param name="ContentContainer.headingLevel" select="2"/> |
---|
104 | <xsl:param name="ContentContainer.contentBlockType" select="'expandable'"/> |
---|
105 | |
---|
106 | |
---|
107 | <xsl:param name="Page.indicatorBaseRequestPath" select="'indicator/'"/> |
---|
108 | <xsl:param name="Page.communityBaseRequestPath" select="'community/'"/> |
---|
109 | |
---|
110 | |
---|
111 | <xsl:param name="Page.pageTitle" ibis:doc="Page's title text." |
---|
112 | select="concat( |
---|
113 | $Page.communityDimensionValue/TITLE, |
---|
114 | ' ', |
---|
115 | ibis:getDimensionTitle($Page.communityDimension), |
---|
116 | ' - ', |
---|
117 | $Page.indicatorSet/TITLE |
---|
118 | )" |
---|
119 | /> |
---|
120 | <xsl:param name="Page.contentTitle" select="$Page.pageTitle"/> |
---|
121 | |
---|
122 | |
---|
123 | <xsl:param name="Page.indicatorSetHelpContent"> |
---|
124 | List of health indicators based on the selected |
---|
125 | set of indicators that have data for the selected |
---|
126 | community. |
---|
127 | |
---|
128 | You can change the set of health indicators to |
---|
129 | be reported on by using the drop down list. |
---|
130 | |
---|
131 | Click on the title link in the list |
---|
132 | for a more detailed view of that community's |
---|
133 | health indicator. |
---|
134 | </xsl:param> |
---|
135 | |
---|
136 | |
---|
137 | <!-- GARTH TODO: Is this needed/wanted ??? --> |
---|
138 | <xsl:template name="Page.specificCSS"> |
---|
139 | <link rel="stylesheet" type="text/css" href="css/Community.css"/> |
---|
140 | </xsl:template> |
---|
141 | |
---|
142 | |
---|
143 | <!-- GARTH TODO: Used to have a selection map on the index pages. This currently |
---|
144 | isn't used so either remove or implement??? |
---|
145 | --> |
---|
146 | <xsl:template name="Page.specificScript" |
---|
147 | ibis:doc="Provides the javascript selection changes and selection map." |
---|
148 | > |
---|
149 | <script type="text/javascript" src="js/InputSelections.js"/> |
---|
150 | <script type="text/javascript"> |
---|
151 | var dimensionName = "<xsl:value-of select="$Page.communityName"/>"; |
---|
152 | |
---|
153 | var $jqueryLeaflet; |
---|
154 | |
---|
155 | window.inputSelections = new InputSelections(); // all input elements on the page. |
---|
156 | |
---|
157 | $(document).ready(function() |
---|
158 | { |
---|
159 | if(location.href.indexOf("PrinterFriendly") == -1) |
---|
160 | { |
---|
161 | window.inputSelections.registerOnChange(); |
---|
162 | } |
---|
163 | |
---|
164 | window.selectionMapDialog = |
---|
165 | $("#selectionMapDialog").kendoWindow({ |
---|
166 | title: "<xsl:value-of select="$Page.communityDimensionTitle"/> Selection Map" |
---|
167 | ,visible: false |
---|
168 | ,width: "90%" |
---|
169 | ,resizable: true |
---|
170 | ,modal: true |
---|
171 | }).data("kendoWindow"); |
---|
172 | |
---|
173 | var leafletMapConstructorJSON = $.extend |
---|
174 | (true, {} |
---|
175 | ,<xsl:call-template name="LeafletMap.baseJSON"/> |
---|
176 | ,<xsl:call-template name="LeafletMap.namedConfigurationJSON"> |
---|
177 | <xsl:with-param name="configurationName" select="'Selection'"/> |
---|
178 | </xsl:call-template> |
---|
179 | ,<xsl:call-template name="LeafletMap.requestJSON"> |
---|
180 | <xsl:with-param name="mapType" select="'selection'"/> |
---|
181 | <xsl:with-param name="selectionLayerSetLayerKeys" select="$Page.communityName"/> <!-- Page.communityDimension/NAME can't simply use dim name as this needs to be a node --> |
---|
182 | <xsl:with-param name="selectionLayerSetSelectionType" select="'single'"/> |
---|
183 | </xsl:call-template> |
---|
184 | ); |
---|
185 | }); |
---|
186 | |
---|
187 | |
---|
188 | function showMap() |
---|
189 | { |
---|
190 | window.selectionMapDialog.center().open(); |
---|
191 | $jqueryLeaflet.map.invalidateSize(); |
---|
192 | L.Control.LayerSets.prototype.htmlSelectionsToMapSelections("GeoProxy", "dimensionValue", $jqueryLeaflet.map, dimensionName); |
---|
193 | } //~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~ |
---|
194 | |
---|
195 | |
---|
196 | function resetForm() |
---|
197 | { |
---|
198 | document.form.reset(); |
---|
199 | } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
200 | |
---|
201 | |
---|
202 | // according to: http://www.hunlock.com/blogs/Mastering_The_Back_Button_With_Javascript |
---|
203 | // having a window.onbeforeunload tells the browser to NOT cache the |
---|
204 | // page so that the back button doesn't impact cleared non selected |
---|
205 | // query selection values. On the modern browsers that were tested |
---|
206 | // this never was an issue as modern browsers pick up the "post" |
---|
207 | // and understand to reset the page as it was prior to submitting. |
---|
208 | // window.onbeforeunload = function() {} |
---|
209 | |
---|
210 | // <![CDATA[ |
---|
211 | // ]]> |
---|
212 | </script> |
---|
213 | </xsl:template> |
---|
214 | |
---|
215 | |
---|
216 | <!-- GARTH TODO: Not used as of 8/2020 |
---|
217 | Same type of code exists in the QM SectionSelections.xslt |
---|
218 | <xsl:template name="Page.selectionMap"> |
---|
219 | <input type="button" value=" Show Selection Map " onclick="showMap();"/> |
---|
220 | |
---|
221 | <div id="selectionMapDialog" class="DialogWindow"> |
---|
222 | <div class="Content"> |
---|
223 | <xsl:call-template name="DataViz.mapContainer"/> |
---|
224 | </div> |
---|
225 | <button type="button" title="Sets the selected geographical values." |
---|
226 | onclick="L.Control.LayerSets.prototype.mapSelectionsToHTMLSelections($jqueryLeaflet.map, 'GeoProxy', 'dimensionValue'); window.selectionMapDialog.close()" |
---|
227 | >OK</button> |
---|
228 | <button type="button" title="Closes map selection without updating selections." |
---|
229 | onclick="window.selectionMapDialog.close()" |
---|
230 | >Cancel</button> |
---|
231 | </div> |
---|
232 | <xsl:call-template name="DataViz.selectionMapJavaScript"/> |
---|
233 | </xsl:template> |
---|
234 | --> |
---|
235 | |
---|
236 | <xsl:template name="Page.contentOptions"> |
---|
237 | <xsl:param name="title"/> |
---|
238 | <xsl:param name="communityReportType" select="$Page.communityReportType"/> |
---|
239 | <xsl:param name="communityBaseRequestPath" select="$Page.communityBaseRequestPath"/> |
---|
240 | <xsl:param name="showIndicatorSetsSelection" select="false()"/> |
---|
241 | <xsl:param name="showIndicatorSelection" select="false()"/> |
---|
242 | <xsl:param name="showQuickFactsSelection" select="false()"/> |
---|
243 | |
---|
244 | <div class="ContentOptions"> |
---|
245 | <h3><xsl:value-of select="$title"/></h3> |
---|
246 | |
---|
247 | <table class="ListTable"> |
---|
248 | |
---|
249 | <xsl:if test="(1 lt count($Page.communityNames)) and ('facts' != $communityReportType)"> |
---|
250 | <tr> |
---|
251 | <td><label for="dimensions">Community Type:</label></td> |
---|
252 | <td> |
---|
253 | <select name="dimensions" id="dimensions" |
---|
254 | onchange="location=this.options[this.selectedIndex].getAttribute('href');" |
---|
255 | > |
---|
256 | <xsl:for-each select="$Page.dimensions/DIMENSION[NAME = $Page.communityNames]"> |
---|
257 | <xsl:sort select="SORT_ORDER" data-type="number" order="ascending"/> |
---|
258 | <xsl:sort select="LABEL" order="ascending"/> |
---|
259 | <option value="{NAME}" href="{$communityBaseRequestPath}indicators/{$Page.indicatorSetName}/{NAME}.html"> |
---|
260 | <xsl:if test="NAME = $Page.communityName"> |
---|
261 | <xsl:attribute name="selected">selected</xsl:attribute> |
---|
262 | </xsl:if> |
---|
263 | <xsl:value-of select="LABEL"/> |
---|
264 | </option> |
---|
265 | </xsl:for-each> |
---|
266 | </select> |
---|
267 | </td> |
---|
268 | </tr> |
---|
269 | </xsl:if> |
---|
270 | |
---|
271 | <tr> |
---|
272 | <td><label for="dimensionValue"><xsl:value-of select="$Page.communityDimensionTitle"/>:</label></td> |
---|
273 | <td> |
---|
274 | <!-- |
---|
275 | <xsl:if test="0 != string-length($Page.previousDimensionValue/TITLE)"> |
---|
276 | <a href="javascript:requestSamePageDifferentDimensionValue('{normalize-space($Page.previousDimensionValue/text()[1])}')" |
---|
277 | title="show previous community value" |
---|
278 | ><< Show <xsl:value-of select="$Page.previousDimensionValue/TITLE"/></a> |
---|
279 | </xsl:if> |
---|
280 | --> |
---|
281 | <select name="dimensionValue" id="dimensionValue" |
---|
282 | onchange="location=this.options[this.selectedIndex].getAttribute('href');" |
---|
283 | > |
---|
284 | <xsl:for-each select="$Page.communityDimension/VALUES/VALUE[not(NOT_SELECTABLE_FLAG)]"> |
---|
285 | <xsl:sort select="SORT_ORDER" data-type="number" order="ascending"/> |
---|
286 | <xsl:sort select="TITLE" order="ascending"/> |
---|
287 | <xsl:variable name="value" select="normalize-space(text()[1])"/> |
---|
288 | <xsl:variable name="href"> |
---|
289 | <xsl:if test="'facts' = $communityReportType"> |
---|
290 | <xsl:value-of select="concat($communityBaseRequestPath, 'facts/', $Page.communityName, '/', $value, '.html')"/> |
---|
291 | </xsl:if> |
---|
292 | <xsl:if test="'indicator' = $communityReportType"> |
---|
293 | <xsl:value-of select="concat($communityBaseRequestPath, 'indicator/', $Page.indicatorName, '/', $Page.communityName, '/', $value, '.html')"/> |
---|
294 | </xsl:if> |
---|
295 | <xsl:if test="'indicators' = $communityReportType"> |
---|
296 | <xsl:value-of select="concat($communityBaseRequestPath, 'indicators/', $Page.indicatorSetName, '/', $Page.communityName, '/', $value, '.html')"/> |
---|
297 | </xsl:if> |
---|
298 | </xsl:variable> |
---|
299 | <option value="{$value}" href="{$href}"> |
---|
300 | <xsl:if test="$value = $Page.communityValue"> |
---|
301 | <xsl:attribute name="selected">selected</xsl:attribute> |
---|
302 | </xsl:if> |
---|
303 | <xsl:value-of select="TITLE"/> |
---|
304 | </option> |
---|
305 | </xsl:for-each> |
---|
306 | </select> |
---|
307 | <!-- |
---|
308 | <xsl:if test="0 != string-length($Page.nextDimensionValue/TITLE)"> |
---|
309 | <a href="javascript:requestSamePageDifferentDimensionValue('{ibis:getValueText($Page.nextDimensionValue/text()[1])}')" |
---|
310 | title="show next community value" |
---|
311 | >Show <xsl:value-of select="$Page.nextDimensionValue/TITLE"/> >></a> |
---|
312 | </xsl:if> |
---|
313 | --> |
---|
314 | </td> |
---|
315 | </tr> |
---|
316 | |
---|
317 | <xsl:if test="(1 lt count($Page.communityIndicatorSet)) and ('facts' != $communityReportType)"> |
---|
318 | <tr> |
---|
319 | <td> |
---|
320 | <label for="indicatorSetName">Set of Health Indicators:</label> |
---|
321 | </td> |
---|
322 | <td> |
---|
323 | <select name="indicatorSetName" id="indicatorSetName" |
---|
324 | onchange="location=this.options[this.selectedIndex].getAttribute('href');"> |
---|
325 | > |
---|
326 | <!-- |
---|
327 | <option value="">All</option> |
---|
328 | --> |
---|
329 | <xsl:for-each select="$Page.communityIndicatorSet"> |
---|
330 | <xsl:sort select="SORT_ORDER" data-type="number" order="ascending"/> |
---|
331 | <xsl:sort select="TITLE" order="ascending"/> |
---|
332 | <xsl:variable name="href"> |
---|
333 | <xsl:if test="'indicator' = $communityReportType"> |
---|
334 | <xsl:value-of select="concat($communityBaseRequestPath, 'indicator/', NAME, '/', $Page.communityName, '/', $Page.communityValue, '.html')"/> |
---|
335 | </xsl:if> |
---|
336 | <xsl:if test="'indicators' = $communityReportType"> |
---|
337 | <xsl:value-of select="concat($communityBaseRequestPath, 'indicators/', NAME, '/', $Page.communityName, '/', $Page.communityValue, '.html')"/> |
---|
338 | </xsl:if> |
---|
339 | </xsl:variable> |
---|
340 | <option value="{NAME}" href="{$href}"> |
---|
341 | <xsl:if test="NAME = $Page.indicatorSetName"> |
---|
342 | <xsl:attribute name="selected">selected</xsl:attribute> |
---|
343 | </xsl:if> |
---|
344 | <xsl:value-of select="TITLE"/> |
---|
345 | </option> |
---|
346 | </xsl:for-each> |
---|
347 | </select> |
---|
348 | </td> |
---|
349 | <td> |
---|
350 | <xsl:call-template name="Help.popup"> |
---|
351 | <xsl:with-param name="content" select="$Page.indicatorSetHelpContent"/> |
---|
352 | </xsl:call-template> |
---|
353 | </td> |
---|
354 | </tr> |
---|
355 | </xsl:if> |
---|
356 | |
---|
357 | <!-- GARTH TODO: turned off until quick facts can be better defined |
---|
358 | <xsl:if test="('facts' != $communityReportType) and exists($Page.communityProfile/FACTS_PAGE_FLAG)"> |
---|
359 | <tr> |
---|
360 | <td><label><xsl:value-of select="$Page.communityDimensionTitle"/> Information:</label></td> |
---|
361 | <td> |
---|
362 | <a title="Show this communities quick facts page." |
---|
363 | href="{$communityBaseRequestPath}facts/{$Page.communityName}/{$Page.communityValue}.html" |
---|
364 | ><xsl:value-of select="$Page.communityDimensionValue/TITLE"/>'s Quick Facts</a> |
---|
365 | </td> |
---|
366 | </tr> |
---|
367 | </xsl:if> |
---|
368 | --> |
---|
369 | </table> |
---|
370 | </div> |
---|
371 | |
---|
372 | </xsl:template> |
---|
373 | |
---|
374 | </xsl:stylesheet> |
---|
375 | <!-- ============================= End of File ============================= --> |
---|