source: main/trunk/ibisph-view/src/main/webapp/xslt/html/indicator/profile/view/Page.xslt @ 19867

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

view - Split out IP paths so that IP xml can be refed diff from standard xml content. Stubbed out ContentOptions? for IP, CP, and rough query bulder and result page options. css tweaks - buttons, user. Removed unused vert menu css from main css. Added more defensive code for ibis ip view title/dim value title. Removed all the contextNavigation from xslt code.

File size: 18.1 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:xs  ="http://www.w3.org/2001/XMLSchema"
6        xmlns:ibis="http://www.ibisph.org"
7
8        exclude-result-prefixes="ibis xs xsl"
9>
10        <xsl:import href="../../../../xml/Interactive.xslt"/>
11        <xsl:import href="../../../../json/Dataset.xslt"/>
12        <xsl:import href="../../../../json/Kendo.xslt"/>
13        <xsl:import href="../../../../json/LeafletMap.xslt"/>
14        <xsl:import href="../../../Graphic.xslt"/>
15        <xsl:import href="../Indicator.xslt"/>
16        <xsl:import href="../Page.xslt"/>
17
18
19        <ibis:doc>
20                <name>html/indicator/profile/view/Page</name>
21                <summary>Interactive indicator profile view page</summary>
22                <description>
23                        Specific XSLT used to create the indicator profile view page.
24                </description>
25        </ibis:doc>
26
27
28        <xsl:param name="Page.pageTitle" ibis:doc="Page's title text based on the 'INDICATOR/TITLE' element.">
29                Health Indicator Report - <xsl:value-of select="ibis:getCompleteIndicatorViewTitle($indicator, $indicatorView, $Indicator.dimensions)"/> 
30        </xsl:param>
31        <xsl:param name="Page.contentTitle" ibis:doc="Page's content block title text based on the 'INDICATOR/TITLE' element.">
32                <xsl:value-of select="ibis:getCompleteIndicatorViewTitle($indicator, $indicatorView, $Indicator.dimensions)"/> 
33        </xsl:param>
34
35        <xsl:param name="Page.comparisonDimensionName"  select="'GeoState'"/>
36        <xsl:param name="Page.comparisonDimensionValue" select="'35'"/>
37
38        <xsl:param name="Page.showMap" ibis:doc="Exposed so that SS can access."
39                select="ibis:Graphic.showMap(
40                        $indicatorView/MAP_NAME,
41                        $indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[USAGE='category']/NAME,
42                        $indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[USAGE='series']/NAME,
43                        $Indicator.dimensions
44                )"
45        /> 
46        <xsl:param name="Page.showChart" select="ibis:Graphic.showChart($indicatorView/CHART_NAME)"/>
47
48        <xsl:param name="Indicator.contentBlockType" select="'fixed'"/>
49
50
51
52        <xsl:template name="Page.contentBody" ibis:doc="Main page content template that determines if IP or Surrogate.">
53
54                <!-- if no external content or external content AND a dest selector then call the default page. -->
55                <xsl:if test="(0 = string-length($indicatorView/EXTERNAL_CONTENT_URL)) or (0 != string-length($indicatorView/EXTERNAL_CONTENT_DEST_SELECTOR))">
56                        <xsl:call-template name="Page.interativeContent">
57                                <xsl:with-param name="indicator"     select="$indicator"/>
58                                <xsl:with-param name="indicatorView" select="$indicatorView"/>
59                        </xsl:call-template>
60                </xsl:if>
61
62                <!-- if external content of any sort e.g. complete replacement or section. -->
63                <xsl:if test="(0 != string-length($indicatorView/EXTERNAL_CONTENT_URL))">
64                        <xsl:call-template name="Page.insertAJAXContent">
65                                <xsl:with-param name="sourceContentURL"            select="$indicatorView/EXTERNAL_CONTENT_URL"/>
66                                <xsl:with-param name="sourceContentJQuerySelector" select="$indicatorView/EXTERNAL_CONTENT_SELECTOR"/>
67                                <xsl:with-param name="destContentJQuerySelector" 
68                                        select="if(0 != string-length($indicatorView/EXTERNAL_CONTENT_DEST_SELECTOR))
69                                                then $indicatorView/EXTERNAL_CONTENT_DEST_SELECTOR
70                                                else 'sectionsContainer'"
71                                />
72                        </xsl:call-template>
73                </xsl:if>
74        </xsl:template>
75
76
77        <xsl:template name="Page.interativeContent"
78                ibis:doc="Main interactive sections content template."
79        >
80                <xsl:param name="indicator"/>
81                <xsl:param name="indicatorView"/>
82                <xsl:param name="measure" select="$Indicator.measure"/>
83
84                <xsl:variable name="recordDimensionFields">
85                        <xsl:call-template name="Interactive.getRecordDimensionFields">
86                                <xsl:with-param name="dimensions"      select="$Indicator.dimensions"/>
87                                <xsl:with-param name="dimensionUsages" select="$indicatorView/DIMENSION_USAGES"/>
88                        </xsl:call-template>
89                </xsl:variable>
90                <xsl:variable name="datasetRecords" select="$indicator/DATASETS/DATASET[NAME = $indicatorView/DATASET_NAMES/DATASET_NAME]/RECORDS"/>
91
92                <xsl:variable name="indicatorViewDatasetRecords">
93                        <xsl:call-template name="Interactive.getIndicatorViewDatasetRecords">
94                                <xsl:with-param name="datasetRecords"  select="$datasetRecords"/>
95                                <xsl:with-param name="dimensionUsages" select="$indicatorView/DIMENSION_USAGES"/>
96                                <xsl:with-param name="recordDimensionFields" select="$recordDimensionFields"/>
97                        </xsl:call-template>
98                </xsl:variable>
99                <xsl:variable name="valueAttributeNames" select="distinct-values($indicatorViewDatasetRecords//VALUE_ATTRIBUTE_NAME)"/>
100
101<!--
102<xsl:message select="'INDICATOR VIEW DSR.  IP DS Names, IV DS Names, Count of all possible, count of matched, actual matched DSRs'"/>
103<xsl:message select="$indicator/DATASETS/DATASET/NAME"/>
104<xsl:message select="$indicatorView/DATASET_NAMES/DATASET_NAME"/>
105<xsl:message select="count($datasetRecords/RECORD)"/>
106<xsl:message select="count($indicatorViewDatasetRecords/RECORD)"/>
107<xsl:message select="$indicatorViewDatasetRecords"/>
108
109                <xsl:call-template name="Indicator.whyImportant"/>
110-->
111
112                <xsl:call-template name="Page.options">
113                        <xsl:with-param name="title">Indicator Report Data View Options</xsl:with-param>
114                </xsl:call-template>
115
116                <xsl:if test="$Page.showMap">
117                        <xsl:call-template name="Graphic.mapContainer">
118                                <xsl:with-param name="containerID" select="'map'"/>
119                                <xsl:with-param name="title" select="ibis:getIndicatorViewMapTitle($indicator, $indicatorView, $Indicator.dimensions)"/>
120                                <xsl:with-param name="footerContent" select="$indicatorView/MAP_NARRATIVE"/>
121                        </xsl:call-template>
122                </xsl:if>
123
124                <xsl:if test="$Page.showChart">
125                        <xsl:call-template name="Graphic.chartContainer">
126                                <xsl:with-param name="containerID"   select="'chart'"/>
127                                <xsl:with-param name="footerContent" select="$indicatorView/CHART_NARRATIVE/text()"/>
128                        </xsl:call-template>
129                </xsl:if>
130
131                <xsl:call-template name="Indicator.externalDataViz">
132                        <xsl:with-param name="indicatorView" select="$indicatorView"/>
133                </xsl:call-template>
134
135                <xsl:call-template name="Graphic.gridContainer">
136                        <xsl:with-param name="containerID"   select="'grid'"/>
137                        <xsl:with-param name="valueAttributeNames" select="$valueAttributeNames"/>
138                        <xsl:with-param name="valueAttributes"     select="$Indicator.valueAttributes"/>
139                </xsl:call-template>
140
141                <xsl:call-template name="Indicator.whyImportant"/>
142                <xsl:call-template name="Indicator.definition"/>
143
144                <xsl:call-template name="Indicator.dataNotes">
145                        <xsl:with-param name="title"         select="''"/>
146                        <xsl:with-param name="measure"       select="$measure"/>
147                        <xsl:with-param name="indicatorView" select="$indicatorView"/>
148                </xsl:call-template>
149                <xsl:call-template name="Indicator.dataSources"/>
150                <xsl:call-template name="Indicator.howCalculated"/>
151
152                <xsl:call-template name="Indicator.relatedIndicators"/>
153                <xsl:call-template name="Indicator.relatedQueries"/>
154                <xsl:call-template name="Indicator.relatedTopics"/>
155
156                <xsl:call-template name="Indicator.allDates"/>
157
158                <xsl:variable name="ancillaryValueNames" select="distinct-values($indicator/DATASETS/DATASET[NAME = $indicatorView/DATASET_NAMES/DATASET_NAME]/ANCILLARY_VALUE_USAGES/ANCILLARY_VALUE_USAGE/NAME)"/>
159                <xsl:variable name="measureValueFormatPattern" select="($Indicator.valueTypes/VALUE_TYPE[NAME = $measure/VALUE_TYPE_NAME]/XSLT_FORMAT_PATTERN)[1]"/>
160                <xsl:call-template name="Graphic.choroplethMapJavaScript"/>
161                <xsl:call-template name="Graphic.leafletKendoScript">
162                        <xsl:with-param name="scriptContainerID"     select="concat($indicatorView/NAME, '_script')"/>
163                        <xsl:with-param name="dimensions"            select="$Indicator.dimensions"/>
164                        <xsl:with-param name="datasetRecords"        select="$indicatorViewDatasetRecords"/>
165                        <xsl:with-param name="recordDimensionFields" select="$recordDimensionFields"/>
166                        <xsl:with-param name="recordAncillaryValueFields">
167                                <xsl:call-template name="Interactive.getIndicatorRecordAncillaryValueFields">
168                                        <xsl:with-param name="indicator"     select="$indicator"/>
169                                        <xsl:with-param name="indicatorView" select="$indicatorView"/>
170                                        <xsl:with-param name="ancillaryValueNames" select="$ancillaryValueNames"/>
171                                        <xsl:with-param name="ancillaryValues" select="$Indicator.ancillaryValues"/>
172                                        <xsl:with-param name="valueTypes"      select="$Indicator.valueTypes"/>
173                                        <xsl:with-param name="measureValueFormatPattern" select="$measureValueFormatPattern"/>
174                                </xsl:call-template>
175                        </xsl:with-param>
176
177                        <xsl:with-param name="measure" select="$measure"/>
178                        <xsl:with-param name="measureValueFormatPattern" select="$measureValueFormatPattern"/>
179
180                        <xsl:with-param name="showMap"        select="$Page.showMap"/>
181                        <xsl:with-param name="mapName"        select="$indicatorView/MAP_NAME"/>
182                        <xsl:with-param name="geoJSONName"    select="$indicatorView/MAP_DIMENSION_NAME"/>
183                        <xsl:with-param name="geoIDFieldName" select="$recordDimensionFields/RECORD_DIMENSION_FIELD[DIMENSION_NAMES/DIMENSION_NAME = $indicatorView/MAP_DIMENSION_NAME]/NAME"/> 
184                        <xsl:with-param name="geoIDFieldValuePrefixToRemove" select="concat($indicatorView/MAP_DIMENSION_NAME, '.')"/>
185                        <xsl:with-param name="geoTypeTitle"  select="ibis:getDimensionTitle($indicator//DIMENSIONS/DIMENSION[NAME = $indicatorView/MAP_DIMENSION_NAME])"/>
186                        <xsl:with-param name="mapComparisonValue" select="$indicatorViewDatasetRecords/RECORD[ DIMENSIONS[ (2 = count(DIMENSION)) and DIMENSION[(NAME = $Page.comparisonDimensionName)     and (VALUE = $Page.comparisonDimensionValue)]]]/MEASURE/VALUE"/>
187                        <xsl:with-param name="mapDimensionFieldInclusionCriteria">
188                        <xsl:if test="false()">
189                                <DIMENSION>
190                                        <NAME></NAME>
191                                        <VALUE></VALUE>
192                                        <TITLE></TITLE>
193if view map dim name
194maybe simply use the view's first series dim and value and const dim and value???
195constant and series field names and values
196                        select="$recordDimensionFields/RECORD_DIMENSION_FIELD[DIMENSION_NAMES/DIMENSION_NAME = $indicatorView/MAP_DIMENSION_NAME]/NAME"
197                                </DIMENSION>
198</xsl:if>
199                        </xsl:with-param>
200
201                        <xsl:with-param name="showChart"     select="$Page.showChart"/>
202                        <xsl:with-param name="chartName"     select="$indicatorView/CHART_NAME"/>
203                        <xsl:with-param name="chartTitle"    select="ibis:getIndicatorViewChartTitle($indicator, $indicatorView, $Indicator.dimensions)"/>
204
205                        <xsl:with-param name="showGrid"      select="true()"/>
206                        <xsl:with-param name="showValueAttributeColumn" select="0 != count($valueAttributeNames)"/>
207                        <xsl:with-param name="showLabelColumn"          select="exists($indicatorViewDatasetRecords/RECORD[0 != string-length(LABEL)])"/>
208<!-- never show this...
209                        <xsl:with-param name="showNoteColumn"           select="exists($indicatorViewDatasetRecords/RECORD[0 != string-length(NOTE)])"/>
210-->
211
212                        <xsl:with-param name="baseExportFilename" select="ibis:getCompleteIndicatorViewTitle($indicator, $indicatorView, $Indicator.dimensions)"/> 
213                </xsl:call-template>
214        </xsl:template>
215
216
217
218
219<!--
220==========================================================================
221==========================================================================
222==========================================================================
223
224
225                                // Hack for vert bar charts to fill the width of the container.
226                                // Kendo charts have an issue filling when the container is hidden.
227                                // For some reason on my system need to wait 2 seconds for it
228                                // to work.
229                                // If set width then it's that size no matter what the window is
230                                // resized to.  Only 100% sure fire way is to have open or fire
231                                // some script when opened.
232//                              setTimeout(resizeKendoChart, 1000);
233                                var chartContainerWidth = $(".ExpandableContent").innerWidth();
234//                              $kendoChart.getKendoChart().options.chartArea.width = chartContainerWidth;
235//                              $("#chart").width = $(".ExpandableContent").innerWidth();
236                                $kendoChart.getKendoChart().resize();
237                        });
238
239                        function resizeKendoChart()
240                        {
241//                              var chartContainerWidth = $(".ExpandableContent").innerWidth();
242//                              $kendoChart.getKendoChart().options.chartArea.width = chartContainerWidth;
243                                $kendoChart.getKendoChart().resize();
244//                              $kendoChart.resize($("#chart"));
245                        };
246
247function myFunction() {
248                                kendoDataSource.read();
249                                $kendoChart.getKendoChart().resize();
250                                $kendoChart.getKendoChart().refresh();
251                                $kendoChart.getKendoChart().redraw();
252                                $kendoGrid.getKendoGrid().dataSource.sort({field: "CategorySortOrder", dir: "asc"});
253}
254
255/*                     
256// none of these have any effect on the chart!!!
257//                              $kendoGrid.getKendoGrid().refresh();
258//                              $kendoChart.width(1000);
259//                              $kendoChart.chartArea.width(1000);
260//                              $kendoChart.getKendoChart().resize();
261//                              $kendoChart.getKendoChart().refresh();
262//                              $kendoChart.getKendoChart().redraw();
263
264$kendoGrid.getKendoGrid().dataSource.sort({field: "CategorySortOrder", dir: "asc"});
265                                $kendoGrid.getKendoGrid().refresh();
266                                $kendoChart.getKendoChart().redraw();
267*/
268
269/* GARTH TODO:
270$("#grid tr[role='row']").on("mouseenter mouseover", function () {
271        var row = $("#grid").data("kendoGrid").dataItem(this); //get the data item attached to this row being hovered
272        chart.toggleHighlight(true,
273                function(point)
274                {
275                        return point.dataItem.Id === row.rowID;
276                }
277        ); //show the tooltip for the point where the Ids match
278
279
280
281
282GARTH TODO:
283
284// var firstSlot = $kendoChart.getKendoChart()._plotArea.axes[0].getSlot(0);
285// alert("first slot width" + firstSlot.width());
286
287<xsl:variable name="geoDimensionName" select="
288        if(0 != string-length($indicatorView/DEFAULT_GEOGRAPHY_DIM_NAME))
289        then $indicatorView/DEFAULT_GEOGRAPHY_DIM_NAME
290        else ($Indicator.dimensions/DIMENSION[
291                        exists(GEOGRAPHY_FLAG)
292                        and
293                        NAME = $indicatorView//DIMENSION_USAGE/NAME
294                ])[1]/NAME"
295/>
296
297<xsl:message select="$Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]/NAME"/>
298<xsl:message select="exists($indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[DIMENSION_NAME = $Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]/NAME])"/>
299<xsl:message select="exists($indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[DIMENSION_NAME = $Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]/NAME])"/>
300<xsl:message select="exists($indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[DIMENSION_NAME = $Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]])"/>
301<xsl:message select="$Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]/NAME"/>
302<xsl:message select="concat('Interactive - Show Map: ', $showMap, ', geoDimensionName:', $geoDimensionName)"/>
303
304<xsl:message select="'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX interact.xslt'"/>
305<xsl:message select="$Page.comparisonDimensionName"/>
306<xsl:message select="$Page.comparisonDimensionValue"/>
307<xsl:with-param name="comparisonValue" select="$indicatorViewDatasetRecords/RECORD[ DIMENSIONS[ (2 = count(DIMENSION)) and DIMENSION[(NAME = $Page.comparisonDimensionName)     and (VALUE = $Page.comparisonDimensionValue)]]]/MEASURE/VALUE"/>
308
309Stuff to try when doing dashboard
310function dataSource_change(e) {
311  console.log(e);
312}
313kendoDataSource.bind("change", dataSource_change);
314select="$indicatorViewDatasetRecords/RECORD[ DIMENSIONS[ (2 = count(DIMENSION)) and DIMENSION[(NAME = $Page.comparisonDimensionName)     and (VALUE = $Page.comparisonDimensionValue)]]]/MEASURE/VALUE"/>
315
316**********************************************
317
318PROBLEM: "CATEGORY":"GeoCnty.4"
319                                                <xsl:with-param name="geoJSONName"      select="$indicatorView/MAP_DIMENSION_NAME"/>
320                                               
321******************
322probably need to geojson to have the geodim name + . + geodim value to uniquely ID the area.
323
324************ PROBLEM is that the QM only returns 1..31 and not GeoCnty.1
325
326The IP and QM dimension files are all 1..31
327
328So, need the field name then use the geotype and parse the .XXX from the end.
329Then in the QM will need to build the JSON fields the same way as we do with
330the IP - which is the right way to do it anyway so fields can be combined???
331
332*** also have issues with if 2d and 3d...
333        if mult series then drop down for that.
334        if mult constants then drop down for that as well.
335        when changed regen map.
336        Need to specify the category field name and value
337        Need to specify the series field name and value
338        Need to specify the constant field name and value
339       
340        GeoJSON GeoID Prefix to add when doing comparison???
341
342        <xsl:variable name="communityDatasets" select="$indicator/DATASETS/DATASET[DIMENSION_COMBINATIONS/DIMENSION_COMBINATION[not(DIMENSION_2/NAME) and DIMENSION_1/NAME = $communityDimensionName]]"/>
343        <xsl:variable name="communityDataset"  select="$communityDatasets[(MEASURE_NAME = $measureName) and DIMENSION_COMBINATIONS/DIMENSION_COMBINATION[PERIOD_DIMENSION/NAME = $periodName]]"/>
344        <xsl:variable name="stateRecord"       select="$communityDataset/RECORDS/RECORD[ DIMENSIONS[ (2 = count(DIMENSION)) and DIMENSION[(NAME = $stateDimensionName)     and (VALUE = $stateDimensionValue)]     and DIMENSION[(NAME = $periodName) and (VALUE = $periodValue)]]]"/>
345
346
347GARTH TODO:
348        <xsl:message select="'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX'"/>
349<xsl:message select="$indicatorViewDatasetRecords[1]"/>
350
351
352
353<xsl:with-param name="dimensionFieldInclusionCriteria">
354records have the field names to filter.
355to include need field name and value.
356
357specifies the records held constant - This is to filter out not matching constant records
358
359for mouse overs, the title needs specifics - dimension title and dimension value title.
360        <DIMENSION><NAME>CONSTANT</NAME><VALUE>YearAll.2014</VALUE><TITLE>Year</TITLE><VALUE_TITLE>2014</VALUE_TITLE></DIMENSION>
361        <DIMENSION><NAME>SERIES</NAME><VALUE>Sex.1</VALUE><TITLE>Sex</TITLE><VALUE_TITLE>Male</VALUE_TITLE></DIMENSION>
362</xsl:with-param>
363
364==========================================================================
365<xsl:message select="$indicatorViewDatasetRecords/RECORD"/>
366
367<xsl:message select="'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX interact.xslt'"/>
368<xsl:message select="$indicatorView/MAP_DIMENSION_NAME"/>
369<xsl:message select="$recordDimensionFields/RECORD_DIMENSION_FIELD[DIMENSION_NAMES/DIMENSION_NAME = $indicatorView/MAP_DIMENSION_NAME]/NAME"/> 
370
371==========================================================================
372==========================================================================
373==========================================================================
374-->
375
376</xsl:stylesheet>
377<!-- ============================= End of File ============================= -->
Note: See TracBrowser for help on using the repository browser.