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

Last change on this file since 19879 was 19879, checked in by GarthBraithwaite_STG, 2 years ago

view - footer updates. text sections limited to 700px. Page content formatting and changes. Added goto submit for qm result. Fixed top margin for chart and maps. Limited MM css video to 400px. Changed org unit to authoring. Kendo template for table index page to change search placeholder to filter.

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