source: main/trunk/ibisph-view/src/main/webapp/xslt/html/community/Page.xslt @ 19781

Last change on this file since 19781 was 19781, checked in by GarthBraithwaite_STG, 3 years ago

view, content - updated all topic pages to html5. Removed context nav xmls. Unversioned all QMs. xslt and css sectionsContent to contentBody. Changed panel css back to megamenu. Moved all input control xslt code to the selectionlist.xslt. Removed Click css class and moved all to Popup. ip/page.xslt to include basic control. Changed chart container from div to figure. Updated error jsp.

File size: 16.6 KB
Line 
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/ComparisonValues.xslt"/>
13        <xsl:import href="../Graphic.xslt"/>
14        <xsl:import href="../Page.xslt"/>
15
16        <ibis:doc>
17                <name>html/community/Page</name>
18                <summary>Default core code that most Community profile Pages inherit from</summary>
19                <description>
20                        Community profile base XSLT.
21                </description>
22        </ibis:doc>
23
24        <xsl:param name="Page.stateTitle" select="$ibis.adopterTitle"/>
25       
26        <xsl:param name="Page.htmlClass" select="'Community'"/>
27
28        <xsl:param name="Dimensions"/>
29        <xsl:param name="Page.dimensions" select="$Dimensions/DIMENSIONS"/>
30        <xsl:param name="Measures"/>
31        <xsl:param name="Page.measures"   select="$Measures/MEASURES"/>
32        <xsl:param name="ValueTypes"/>
33        <xsl:param name="Page.valueTypes" select="document(ibis:getContentPath('xml/value_types.xml'), /)/VALUE_TYPES"/>
34
35        <!-- Request parameter names and XML models injected by the controller -->
36        <xsl:param name="CommunityReportType"/>
37        <xsl:param name="IndicatorName"/>
38        <xsl:param name="IndicatorSets"/>
39        <xsl:param name="IndicatorSetName"/>
40        <xsl:param name="IndicatorProfileXMLFilePath"/>
41        <xsl:param name="CommunityProfileXMLFilePath"/>
42
43        <xsl:param name="DimensionName"/>
44        <xsl:param name="DimensionValue"/>
45        <xsl:param name="Page.dimensionName"  select="if(0 = string-length($DimensionName)) then $PathSegments[last()] else $DimensionName"/> 
46        <xsl:param name="Page.dimensionValue" select="$DimensionValue"/>
47
48        <xsl:param name="Page.communityDimension"      select="$Page.dimensions/DIMENSION[NAME = $Page.dimensionName]"/>
49        <xsl:param name="Page.communityDimensionValue" select="$Page.communityDimension/VALUES/VALUE[normalize-space(text()[1]) = $Page.dimensionValue]"/>
50        <xsl:param name="Page.previousDimensionValue"  select="$Page.communityDimensionValue/preceding-sibling::*[not(NOT_SELECTABLE_FLAG)][1]"/>
51        <xsl:param name="Page.nextDimensionValue"      select="$Page.communityDimensionValue/following-sibling::*[not(NOT_SELECTABLE_FLAG)][1]"/>
52
53        <xsl:param name="Page.communityDimensionTitle" select="ibis:getDimensionTitle($Page.communityDimension)"/>
54
55        <!-- XML file paths injected by controller - renaming so downstream XSLT knows where this came from -->
56        <xsl:param name="Page.indicatorProfileXMLFilePath" select="$IndicatorProfileXMLFilePath"/>
57
58        <xsl:param name="Page.indicatorName" select="$IndicatorName"/>
59
60        <xsl:param name="Page.indicatorSets" select="$IndicatorSets/INDICATOR_SETS"/>
61        <xsl:param name="Page.indicatorSetName" select="if(0 = string-length($IndicatorSetName)) then $Page.indicatorSets/INDICATOR_SET[1]/NAME else $IndicatorSetName"/>
62        <xsl:param name="Page.indicatorSet"  select="$Page.indicatorSets/INDICATOR_SET[NAME = $Page.indicatorSetName]"/>
63
64        <!-- Optional file that allows filtering out of IP sets and possibly other
65                options that lois/adopters want.
66        -->
67        <xsl:param name="Page.communityProfileXMLFilePath" select="$CommunityProfileXMLFilePath"/>
68        <xsl:param name="Page.communityProfile" 
69                select="document(concat($Page.communityProfileXMLFilePath, '/', $Page.dimensionName, '.xml'), /)/COMMUNITY_PROFILE"
70        />
71        <xsl:param name="Page.communityIndicatorSet" select="if(0 = count($Page.communityProfile/INDICATOR_SET_NAMES/INDICATOR_SET_NAME))
72                then $Page.indicatorSets/INDICATOR_SET
73                else $Page.indicatorSets/INDICATOR_SET[NAME = $Page.communityProfile/INDICATOR_SET_NAMES/INDICATOR_SET_NAME]"
74        />
75
76        <xsl:param name="Page.communityReportType" select="if(0 = string-length($CommunityReportType)) then 'indicators' else $CommunityReportType"/>
77
78
79        <xsl:param name="Page.confidenceIntervalHelpContent">
80                <div>Description of the Confidence Interval</div>
81                The confidence interval indicates the range of probable
82                true values for the level of risk in the community.
83                <br/><br/>
84
85                A value of "DNA" (Data Not Available) will appear
86                if the confidence interval was not published with
87                the IBIS indicator data for this measure.
88        </xsl:param>
89
90        <xsl:param name="Page.statisticalStabilityHelpContent">
91                <div>Description of Statistical Stability</div>
92                <ul>
93                        <li>
94                                Stable = This count or rate is relatively stable
95                                and should provide a good estimate of your
96                                community risk.
97                        </li>
98                        <li>
99                                Unstable = This count or rate is statistically
100                                unstable (RSE >0.30), and may fluctuate widely
101                                due to random variation (chance).
102                        </li>
103                        <li>
104                                Very Unstable = This count or rate is extremely
105                                unstable (RSE >0.50). This value should not be
106                                used to represent your population risk. You
107                                should combine years or otherwise increase the
108                                population denominator in this calculation.
109                        </li>
110                        <li>
111                                DNA = Data Not Available. The required community
112                                value and/or confidence interval was not available
113                                for this measure.
114                        </li>
115                </ul>
116        </xsl:param>
117
118        <xsl:param name="Page.gauge4HelpContent" ibis:doc="">
119                <h4>Description of the Dashboard Gauge</h4>
120                This "dashboard" type graphic is based on the community data
121                on the right.  It compares the community value on this indicator
122                to the state overall value.
123
124                <ul class="ExtraWhiteSpace">
125                        <li>Excellent = The community's value on this indicator
126                                is BETTER than the state value, and the difference
127                                IS statistically significant.
128                        </li>
129                        <li>Watch = The community's value is BETTER than state value,
130                                but the difference IS NOT statistically significant.
131                        </li>
132                        <li>Similar = The community's value is SIMILAR to the state value,
133                                difference IS NOT statistically significant.
134                        </li>
135                        <li>Improvement Needed = The community's value on this
136                                indicator is WORSE than the state value, but the
137                                difference IS NOT statistically significant.
138                        </li>
139                        <li>Reason for Concern = The community's value on this
140                                indicator is WORSE than the state value, and the
141                                difference IS statistically significant.
142                        </li>
143                </ul><br/>
144        </xsl:param>
145
146        <xsl:param name="Page.gauge3HelpContent" ibis:doc="">
147                <h4>Description of the Dashboard Gauge</h4>
148                This "dashboard" type graphic is based on the community data
149                on the right.  It compares the community value on this indicator
150                to the state overall value.
151
152                <ul class="ExtraWhiteSpace">
153                        <li>Excellent = The community's value on this indicator
154                                is BETTER than the state value, and the difference
155                                IS statistically significant.
156                        </li>
157                        <li>Similar = The community's value is SIMILAR to the state value,
158                                difference IS NOT statistically significant.
159                        </li>
160                        <li>Reason for Concern = The community's value on this
161                                indicator is WORSE than the state value, and the
162                                difference IS statistically significant.
163                        </li>
164                </ul><br/>
165
166                <div class="BottomHalfLineSpace">
167                        The community value is considered statistically significantly
168                        different from the state value if the state value is outside
169                        the range of the community's 95% confidence interval. If the
170                        community's data or 95% confidence interval information is
171                        not available, a blank gauge image will be displayed with
172                        the message, "missing information."
173                </div>
174
175                NOTE: The labels used on the gauge graphic are meant to describe
176                the community's status in plain language. The placement of the
177                gauge needle is based solely on the statistical difference
178                between the community and state values.  When selecting priority
179                health issues to work on, a community should take into account
180                additional factors such as how much improvement could be made,
181                the U.S. value, the statistical stability of the community
182                number, the severity of the health condition, and whether the
183                difference is clinically significant.
184        </xsl:param>
185
186
187<!-- NOT USED
188        <xsl:template name="Compare.valueOrDNA"
189                ibis:doc="Used to show value or DNA."
190        >
191                <xsl:param name="value"/>
192                <xsl:choose>
193                        <xsl:when test="string(number($value)) ='NaN'">DNA</xsl:when>
194                        <xsl:otherwise><xsl:value-of select="$value"/></xsl:otherwise>
195                </xsl:choose>
196        </xsl:template>
197
198
199        <xsl:template name="Compare.confidenceInterval"
200                ibis:doc="DNA is shown if the comparitiveValue is missing."
201        >
202                <xsl:param name="measureLowerLimit"/>
203                <xsl:param name="measureUpperLimit"/>
204                <xsl:param name="valueFormatPattern"/>
205
206                <xsl:choose>
207                        <xsl:when test="($measureLowerLimit = 'DNA') or ($measureUpperLimit = 'DNA')">
208                                DNA
209                        </xsl:when>
210                        <xsl:otherwise>
211                                 (<xsl:value-of select="ibis:getFormattedNumber($measureLowerLimit, $valueFormatPattern)"/>
212                                - <xsl:value-of select="ibis:getFormattedNumber($measureUpperLimit, $valueFormatPattern)"/>)
213                        </xsl:otherwise>
214                </xsl:choose>
215        </xsl:template>
216-->
217
218
219
220        <xsl:param name="ContentContainer.titleLevel" select="2"/>
221        <xsl:param name="ContentContainer.contentBlockType" select="'expandable'"/>
222
223
224        <xsl:param name="Page.pageTitle" ibis:doc="Page's title text."
225                select="concat(
226                        $Page.communityDimensionValue/TITLE,
227                        ' ',
228                        ibis:getDimensionTitle($Page.communityDimension),
229                        ' - ',
230                        $Page.indicatorSet/TITLE
231                )"
232        />
233        <xsl:param name="Page.contentTitle" select="$Page.pageTitle"/>
234
235
236        <xsl:template name="Page.specificScript"
237                ibis:doc="Provides the javascript selection changes and selection map."
238        >
239                <script type="text/javascript" src="{$ibis.contextPath}js/InputSelections.js"/>
240                <script type="text/javascript">
241                        var webappContextPath = "<xsl:value-of select="$ibis.contextPath"/>";
242                        var dimensionName     = "<xsl:value-of select="$Page.dimensionName"/>";
243
244                        var selectionMapDialog;
245                        var $jqueryLeaflet;
246
247                        window.inputSelections = new InputSelections();         // all input elements on the page.
248
249                        $(document).ready(function()
250                        {
251                                if(location.href.indexOf("PrinterFriendly") == -1)
252                                {
253                                        window.inputSelections.registerOnChange();
254                                }
255
256                                selectionMapDialog =
257                                        $("#selectionMapDialog").kendoWindow({
258                                                title: "<xsl:value-of select="$Page.communityDimensionTitle"/> Selection Map"
259                                                ,visible: false
260                                                ,width: "90%"
261                                                ,resizable: true
262                                                ,modal: true
263                                        }).data("kendoWindow");
264
265                                var leafletMapConstructorJSON = $.extend
266                                        (true, {}
267                                                ,<xsl:call-template name="LeafletMap.baseJSON"/>
268                                                ,<xsl:call-template name="LeafletMap.namedConfigurationJSON">
269                                                        <xsl:with-param name="configurationName" select="'Selection'"/>
270                                                </xsl:call-template>
271                                                ,<xsl:call-template name="LeafletMap.requestJSON"> 
272                                                        <xsl:with-param name="mapType" select="'selection'"/>
273<xsl:with-param name="selectionLayerSetLayerKeys" select="$Page.dimensionName"/>                <!-- Page.communityDimension/NAME can't simply use dim name as this needs to be a node -->
274                                                        <xsl:with-param name="selectionLayerSetSelectionType" select="'single'"/>
275                                                </xsl:call-template>
276                                        );
277// GARTH TODO: some pages don't have a map so do this simply test to avoid error...
278                                if($("#map").leaflet) $jqueryLeaflet = $("#map").leaflet(leafletMapConstructorJSON);
279                        });
280
281
282                        function showMap()
283                        {
284                                selectionMapDialog.center().open();
285                                $jqueryLeaflet.map.invalidateSize();
286                                L.Control.LayerSets.prototype.htmlSelectionsToMapSelections("GeoProxy", "dimensionValue", $jqueryLeaflet.map, dimensionName);
287                        } //~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~
288
289
290                        function resetForm()
291                        {
292                                document.form.reset();
293                        } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
294
295
296                        // according to: http://www.hunlock.com/blogs/Mastering_The_Back_Button_With_Javascript
297                        // having a window.onbeforeunload tells the browser to NOT cache the
298                        // page so that the back button doesn't impact cleared non selected
299                        // query selection values.  On the modern browsers that were tested
300                        // this never was an issue as modern browsers pick up the "post"
301                        // and understand to reset the page as it was prior to submitting.
302//                      window.onbeforeunload = function() {}
303
304
305/*
306index -
307        builds all 3 types of urls
308        left nav changes dim name to new index
309
310ips -
311        drop down Choose different dim value    requestSamePageDifferentDimensionValue
312        drop down choose different IP set
313        left nav facts, ip built xslt.           
314        left nav prev/next dim value                    requestSamePageDifferentDimensionValue
315        left nav different ip set
316
317ip -
318        drop down Choose different dim value    requestSamePageDifferentDimensionValue
319        drop down choose different IP ?
320        left nav facts, ip built xslt.
321        left nav ip set built xslt  (if set exists)
322        left nav prev/next dim value                    requestSamePageDifferentDimensionValue
323        left nav prev/next ip   (if set exists) requestSamePageDifferentSegment???
324
325quick facts -
326        drop down Choose different dim value    requestSamePageDifferentDimensionValue
327        left nav ip built xslt (if set exists)
328        left nav ip set built xslt  (if ip exists)
329        left nav prev/next dim value
330document.querySelector("input[name='gender']:checked").value;
331*/
332                        // Builds complete url based on the requested report type. 
333                        // NOTE: this is only used on the index pages but included here to
334                        // keep things simpler to maintain.
335                        function requestCommunityPage()
336                        {
337                                var communityReportType = document.forms.form.communityReportType.value;
338                                var dimensionValue      = document.forms.form.dimensionValue.value;
339                                var indicatorSetName    = document.forms.form.indicatorSetName.value;
340                                var indicatorName       = document.forms.form.indicatorName.value;
341
342                                var subURL;
343                                if("indicatorSet" == communityReportType)
344                                {
345                                        subURL = "community/indicators/" + indicatorSetName + "/" + dimensionName + "/" + dimensionValue;
346                                }
347                                else if("communityIndicator" == communityReportType)
348                                {
349                                        subURL = "community/indicator/" + indicatorName + "/" + dimensionName + "/" + dimensionValue;
350                                }
351                                else if("communityFacts" == communityReportType)
352                                {
353                                        subURL = "community/facts/" + dimensionName + "/" + dimensionValue;
354                                }
355                                location.href = webappContextPath + subURL + ".html";
356                        } //~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~
357
358
359
360                        // used for prev/next dim value navigation
361                        function requestSamePageDifferentDimensionValue(dimensionValue)
362                        {
363                                if(!dimensionValue) dimensionValue = document.querySelector("select[name='dimensionValue']").value;
364                                var dotHTMLIndex   = location.href.lastIndexOf(".html");
365                                var lastSlashIndex = location.href.lastIndexOf("/");
366                                var currentDimensionValue = location.href.substring(lastSlashIndex, dotHTMLIndex) + ".html";
367                                location.href = location.href.replace(currentDimensionValue, "/" + dimensionValue + ".html");
368                        } //~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~
369
370
371                        // used for prev/next indicator navigation
372                        function requestSamePageDifferentSegment(currentSegmentValue, newSegmentValue)
373                        {
374                                location.href = location.href.replace("/"+currentSegmentValue+"/", "/"+newSegmentValue+"/");
375                        } //~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~
376
377
378                        // used for indicators change ip set name
379                        function requestDifferentIndicatorSet(currentIndicatorSetName)
380                        {
381                                var indicatorSetName = document.querySelector("select[name='indicatorSetName']").value;
382                                if(currentIndicatorSetName)
383                                        requestSamePageDifferentSegment(currentIndicatorSetName, indicatorSetName);
384                                else
385                                {
386                                        var questionMarkIndex = location.href.indexOf("?");
387                                        var href = (-1 == questionMarkIndex) ? location.href : location.href.substring(0, questionMarkIndex);
388                                        location.href = href + "?IndicatorSetName=" + indicatorSetName;
389                                }
390                        } //~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~
391
392                        // <![CDATA[
393                        // ]]>
394                </script>
395        </xsl:template>
396
397
398        <xsl:template name="Page.selectionMap">
399                <input type="button" value=" Show Selection Map " onclick="showMap();"/>
400
401                <div id="selectionMapDialog" class="DialogContent">
402                        <div class="InnerCanvas">
403                                <xsl:call-template name="Graphic.mapContainer"/>
404                        </div>
405                        <button type="button" title="Sets the selected geographical values."
406                                onclick="L.Control.LayerSets.prototype.mapSelectionsToHTMLSelections($jqueryLeaflet.map, 'GeoProxy', 'dimensionValue'); selectionMapDialog.close()" 
407                        >OK</button>
408                        <button type="button" title="Closes map selection without updating selections."
409                                onclick="selectionMapDialog.close()" 
410                        >Cancel</button>
411                </div>
412                <xsl:call-template name="Graphic.selectionMapJavaScript"/>
413        </xsl:template>
414
415</xsl:stylesheet>
416<!-- ============================= End of File ============================= -->
Note: See TracBrowser for help on using the repository browser.