source: main/adopters/ma/trunk/ibisph-view/src/main/webapp/xslt/html/query/module/result/SiteSpecific.xslt @ 3511

Last change on this file since 3511 was 3511, checked in by Paul Leo, 11 years ago

Fix for trac ticket #163 - output to excel, and view xml now show and work in results page - actually view xml works, output to excel needs to be tested.
Also would like Garth to review method of repair, for accuracy and compliance with how to implement SiteSpecific? mods

File size: 16.5 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2
3<xsl:stylesheet version="2.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="../SiteSpecific.xslt"/>
10
11
12        <ibis:doc>
13                <name>html/query/result/SiteSpecific</name>
14                <summary>Provides adopter 'query/result' site specific template overrides</summary>
15                <description>
16                        Provides an overridden 'siteSpecific.topMenu'
17                        API template call so that the banner can be turned off.  This
18                        template also includes the 'css/query.css' links and other adopter specific
19                        code.
20                </description>
21
22                <author>Garth Braithwaite</author>
23                <company>Software Technology Group/CDC/Utah Department of Health</company>
24        </ibis:doc>
25
26
27        <!-- ~~~~~~~~~~~~~~~~~~~~~~~~ GLOBAL VARIABLES ~~~~~~~~~~~~~~~~~~~~~~~~~ -->
28        <xsl:param name="SiteSpecific.builderURL" select="concat($ibis.urlPrefix, 'query/builder', /QUERY_MODULE/REQUEST/CONFIGURATION_PATH, '.html')"
29                ibis:doc="Builder page URL."
30        />
31
32
33        <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TEMPLATES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
34        <xsl:template  name="SiteSpecific.contextNavigation"
35                ibis:doc="Query Result left nav menu - specific to the current module config."
36        >
37                <xsl:param name="selections">
38                        <SELECTIONS>
39                                <SELECTION>
40                                        <URL><xsl:value-of select="$SiteSpecific.builderURL"/></URL>
41                                        <DESCRIPTION>Not seeing what you want? Click this to go to the query builder page.</DESCRIPTION>
42                                        <TITLE>Query Definition</TITLE>
43                                </SELECTION>
44                                <SELECTION>
45                                        <URL><xsl:value-of select="concat($ibis.urlPrefix, 'query/result', /QUERY_MODULE/REQUEST/CONFIGURATION_PATH, '.html?Reload=x')"/></URL>
46                                        <DESCRIPTION>Runs the query using default criteria.</DESCRIPTION>
47                                        <TITLE>Default Query Result</TITLE>
48                                </SELECTION>
49                                <SELECTION>
50                                        <URL><xsl:value-of select="concat($ibis.urlPrefix, /QUERY_MODULE/QUERY_CONFIGURATION_SELECTION/LOCAL_URL)"/></URL>
51                                        <DESCRIPTION>Click this button to choose different dataset.</DESCRIPTION>
52                                        <TITLE>Query Dataset Configuration Selection</TITLE>
53                                        <ADDITIONAL_CLASSES>MenuItem2Lines</ADDITIONAL_CLASSES>
54                                </SELECTION>
55
56                                <xsl:if test="not($Result.configuration/CRITERIA/EXCLUDE/GRAPHIC_NAMES/ALL_FLAG)">
57                                        <SELECTION>
58                                                <DESCRIPTION>Available Graphics/Charts</DESCRIPTION>
59                                                <TITLE>Graphical Charts</TITLE>
60                                                <SELECTIONS>
61                                                        <xsl:for-each select="$Result.charts/CHART[
62                                                                (NAME != $Result.queryModule/REQUEST/GRAPHIC_NAME) and
63                                                                not(NAME = $Result.configuration/CRITERIA/EXCLUDE/GRAPHIC_NAMES/GRAPHIC_NAME)]"
64                                                        >
65                                                                <xsl:sort select="SORT_ODRER" order="ascending" data-type="number"/>
66
67                                                                <SELECTION>
68                                                                        <URL>?GraphicName=<xsl:value-of select="NAME"/></URL>
69                                                                        <DESCRIPTION>Display the data in a <xsl:value-of select="TITLE"/> graph</DESCRIPTION>
70                                                                        <TITLE><xsl:value-of select="TITLE"/></TITLE>
71                                                                </SELECTION>
72                                                        </xsl:for-each>
73
74                                                        <xsl:if test="exists($Result.configuration/MAP[
75                                                          (CHLOROPLETH_VALUES_MEASURE_NAME=/QUERY_MODULE/REQUEST/MEASURE_NAME)
76                                                           or (DATA_VALUES_MEASURE_NAME   =/QUERY_MODULE/REQUEST/MEASURE_NAME)])">
77                                                                <SELECTION>
78                                                                        <URL>?GraphicName=Map</URL>
79                                                                        <DESCRIPTION>Display the data in a map</DESCRIPTION>
80                                                                        <TITLE>Map</TITLE>
81                                                                </SELECTION>
82                                                        </xsl:if>
83                                                </SELECTIONS>
84                                        </SELECTION>
85                                </xsl:if>
86
87                                <xsl:if test="(count($Result.displayableMeasures) &gt; 1)">
88                                        <SELECTION>
89                                                <DESCRIPTION>Select different data measure</DESCRIPTION>
90                                                <TITLE>Other Measures</TITLE>
91                                                <SELECTIONS>
92                                                        <xsl:for-each select="$Result.displayableMeasures">
93
94                                                                <xsl:if test="current()/NAME != /QUERY_MODULE/REQUEST/MEASURE_NAME">
95                                                                        <SELECTION>
96                                                                                <URL>?MeasureName=<xsl:value-of select="NAME"/></URL>
97                                                                                <DESCRIPTION>Display the <xsl:value-of select="TITLE"/> data measure</DESCRIPTION>
98                                                                                <TITLE><xsl:value-of select="TITLE"/></TITLE>
99                                                                        </SELECTION>
100                                                                </xsl:if>
101                                                        </xsl:for-each>
102                                                </SELECTIONS>
103                                        </SELECTION>
104                                </xsl:if>
105
106                                <SELECTION>
107                                        <URL><xsl:value-of select="concat(replace($Result.resultURL, '.html', '.xls'), '?PrinterFriendly=true')"/></URL>
108                                        <DESCRIPTION>Click this button to have this page automatically put into Microsoft Excel.</DESCRIPTION>
109                                        <TITLE>Output to Excel</TITLE>
110                                </SELECTION>
111                                <SELECTION>
112                                        <URL><xsl:value-of select="concat($ibis.urlPrefix, 'query/configuration', /QUERY_MODULE/REQUEST/CONFIGURATION_PATH, '.xml')"/></URL>
113                                        <DESCRIPTION>Click this button to get the raw module data as XML.</DESCRIPTION>
114                                        <TITLE>XML View</TITLE>
115                                </SELECTION>
116
117                                <SELECTION>
118                                        <URL><xsl:value-of select="concat($ibis.urlPrefix, 'query/definition/detail/edit.html')"/></URL>
119                                        <DESCRIPTION>Click this button to edit the query.</DESCRIPTION>
120                                        <TITLE>Save Query Definition</TITLE>
121                                </SELECTION>
122                        </SELECTIONS>
123                </xsl:param>
124
125                <xsl:apply-templates select="$selections/SELECTIONS" mode="Menu"/>
126        </xsl:template>
127       
128        <!--MA 508-->
129        <xsl:template name="Page.submitControlContainer"
130                ibis:doc="Provides the submit query control buttons">
131
132                <xsl:variable name="excel">
133                        <xsl:value-of select="concat($ibis.urlPrefix, '/query/result/pop/PopMain/Count.xls?PrinterFriendly=true')"/>
134                </xsl:variable>
135        <!--
136qqqq <xsl:value-of select="$excel"/> -->
137                <xsl:variable name="xmlview">
138                        <xsl:value-of select="concat($ibis.urlPrefix, 'query/configuration', /QUERY_MODULE/REQUEST/CONFIGURATION_PATH, '.xml')"/>
139                </xsl:variable> 
140               
141                <div id="resultsDisplay" class="SubmitControl">
142                        <input id="excelButton" type="Button" value="Output to Excel" onclick="window.location='{$excel}'" title="Output to Excel"/>
143                        <input id="viewButton"  type="Button" value="View XML" onclick="window.location='{$xmlview}'" title="View XML"/>
144                </div>   
145        </xsl:template> 
146       
147<!-- see description and caveats in Page.xslt in this directory for Page.sectionContent template -->
148<xsl:template name="Page.sectionsContent"
149                ibis:doc="Main page content template that creates the selections
150                        section, the optional graphic, optional 2-d table, data list table."
151        >
152                <xsl:param name="rowDimensionName"    select="$Result.queryModule/REQUEST/RESULT_GROUP_BY/ROW_DIMENSION_NAME"/>
153                <xsl:param name="colDimensionName"    select="$Result.queryModule/REQUEST/RESULT_GROUP_BY/COLUMN_DIMENSION_NAME"/>
154                <xsl:param name="otherDimensionName"  select="$Result.queryModule/REQUEST/RESULT_GROUP_BY/OTHER_DIMENSION_NAME"/>
155                <xsl:param name="rowDimensionTitle"   select="$Result.queryModule/DIMENSIONS/DIMENSION[NAME=$rowDimensionName]/TITLE"/>
156                <xsl:param name="colDimensionTitle"   select="$Result.queryModule/DIMENSIONS/DIMENSION[NAME=$colDimensionName]/TITLE"/>
157                <xsl:param name="otherDimensionTitle" select="$Result.queryModule/DIMENSIONS/DIMENSION[NAME=$otherDimensionName]/TITLE"/>
158                <xsl:param name="graphicName"         select="$Result.queryModule/REQUEST/GRAPHIC_NAME"/>
159                <xsl:param name="recordCount"         select="count($Result.queryResult/RECORDS/RECORD)"/>
160               
161                <!--MA 508-->
162        <!--     --><xsl:call-template name="Page.submitControlContainer"/> 
163               
164
165                <a name="top"></a>
166                <xsl:call-template name="Selections.userCriteria">
167                        <xsl:with-param name="queryModule"   select="$Result.queryModule"/>
168                        <xsl:with-param name="criteriaTitle" select="concat('Query Criteria for the ', $Result.configuration/TITLE, ' Measure')"/>
169                        <xsl:with-param name="criteriaDescription" 
170                                select="if(exists($Result.configuration/DESCRIPTION))
171                                        then $Result.configuration/DESCRIPTION
172                                        else 'User query criteria includes filtering and how the data is grouped'
173                                "
174                        />
175                        <xsl:with-param name="rowDimensionTitle"   select="$rowDimensionTitle"/>
176                        <xsl:with-param name="colDimensionTitle"   select="$colDimensionTitle"/>
177                        <xsl:with-param name="otherDimensionTitle" select="$otherDimensionTitle"/>
178                        <xsl:with-param name="graphTitle" 
179                                select="if($graphicName = 'Map') then 'Map' else $Result.charts/CHART[NAME = $graphicName]/TITLE"
180                        />
181                </xsl:call-template>
182                <br/>
183
184
185                <!-- Display the data.  If no records are available then provide the user
186                        with a message on what is possibly going on.
187                -->
188                <xsl:choose>
189                        <xsl:when test="exists($Result.queryModule/REQUEST/ERROR)">
190                                <div class="Error" title="View System Error">
191                                        <h2>Error: <xsl:value-of select="$Result.queryModule/REQUEST/ERROR/TITLE"/></h2>
192                                        There is a problem getting the specified query data from the
193                                        database.  This error could be a temporary issue either with
194                                        the servers or the network.  Please wait a few minutes and try
195                                        your query again.  If the problem persists, please report this
196                                        problem to us (<a href="{$ibis.urlPrefix}home/ContactInformation.html">contact information</a>).
197                                        The nature of the problem is shown below and will be helpful
198                                        when reporting the problem.  We apologize for any inconveniences
199                                        and appreciate your patience and help.
200                                        <br/><br/>
201
202                                        <div class="Note" title="{$Result.queryModule/REQUEST/ERROR/TITLE}">
203                                                <h3>More Error Detail:</h3>
204                                                <xsl:value-of select="$Result.queryModule/REQUEST/ERROR/DESCRIPTION"/>
205                                        </div>
206                                </div><br/>
207                        </xsl:when>
208
209                        <xsl:when test="exists($Result.queryResult/ERROR)">
210                                <div class="Error">
211                                        <h2>SAS/CGI System Error:</h2>
212                                        There is a problem getting the specified query data from the
213                                        database.  Please report this problem to us (<a href="{$ibis.urlPrefix}home/ContactInformation.html">contact information</a>).
214                                        The nature of the problem is shown below and will be helpful
215                                        when reporting the problem.  We apologize for any inconveniences
216                                        and appreciate your patience and help.
217                                        <br/><br/>
218
219                                        <div class="Note" title="{$Result.queryModule/REQUEST/ERROR/TITLE}">
220                                                <h3>More Error Detail:</h3>
221                                                <xsl:value-of select="$Result.queryResult/ERROR"/>
222                                        </div>
223                                </div><br/>
224                        </xsl:when>
225
226                        <xsl:when test="not(exists($Result.queryResult))">
227                                <div class="PleaseWait">
228                                        <h2>Please wait.  Processing query.</h2>
229                                        The system is processing your data request.  Your browser should
230                                        be actively trying to load a page.  This is typically indicated
231                                        by your browser showing a spinning/waving something in the upper
232                                        right corner of the browser's window.  If this is not the case
233                                        click on this <a href="{$Result.resultURL}" title="Resubmit query">get
234                                        query results</a> link.  Otherwise be patient as your data will be
235                                        displayed as soon as they are available.
236                                </div><br/>
237                        </xsl:when>
238
239                        <xsl:when test="$recordCount = 0">
240                                <div class="NoDataReturned">
241                                        <h2>Sorry, no data were returned for your query.</h2>
242                                        The filtering criteria was too specific or no data exists in
243                                        the dataset.  If you feel that your query should have worked,
244                                        please contact us and let us know about the problem. Otherwise,
245                                        please go back and modify your query using less specific
246                                        filtering criteria.
247                                </div><br/>
248                        </xsl:when>
249
250                        <!-- If records, then display the data list table. -->
251                        <xsl:otherwise>
252
253                                <!-- Display the chart/map graphic - if one is selected and it is not none -->
254                                <xsl:if test="(string-length($graphicName) &gt; 0) and ($graphicName != 'None')">
255                                        <xsl:call-template name="Graphic.queryResult">
256                                                <xsl:with-param name="graphicName" select="$graphicName"/>
257                                                <xsl:with-param name="measure"     select="$Result.measure"/>
258                                                <xsl:with-param name="rowDimensionTitle" select="$rowDimensionTitle"/>
259                                                <xsl:with-param name="colDimensionTitle" select="$colDimensionTitle"/>
260                                                <xsl:with-param name="rowDimensionName"  select="$rowDimensionName"/>
261                                                <xsl:with-param name="colDimensionName"  select="$colDimensionName"/>
262                                        </xsl:call-template>
263                                        <xsl:if test="string-length($otherDimensionName) &gt; 0">
264                                                <div class="Footnote">
265                                                        NOTE: The above chart does not show all dataset grouped
266                                                        by dimensions.
267                                                </div>
268                                        </xsl:if>
269                                        <br/>
270                                </xsl:if>
271
272                                <!-- Display 2d table of query results if there are 2 dimensions specified. -->
273                                <xsl:if test="(string-length($colDimensionName) &gt; 0) and (string-length($otherDimensionName) = 0)">
274                                        <xsl:call-template name="Values2d.queryResult2dDataTable">
275                                                <xsl:with-param name="measure"           select="$Result.measure"/>
276                                                <xsl:with-param name="rowDimensionName"  select="$rowDimensionName"/>
277                                                <xsl:with-param name="colDimensionName"  select="$colDimensionName"/>
278                                                <xsl:with-param name="rowDimensionTitle" select="$rowDimensionTitle"/>
279                                                <xsl:with-param name="colDimensionTitle" select="$colDimensionTitle"/>
280                                        </xsl:call-template>
281                                        <xsl:call-template name="Page.dataTableValuesFootnote"/>
282                                </xsl:if>
283
284                                <!-- lastly, display the standard data list table. -->
285                                <h2 title="Lists all query values with numerator, denominator, and confidence limit values">Data List</h2>
286                                <xsl:call-template name="Values.queryResultDataList">
287                                        <xsl:with-param name="uniqueRecordDimensionNames" select="distinct-values($Result.queryResult/RECORDS/RECORD/DIMENSIONS/DIMENSION/NAME)"/>
288                                        <xsl:with-param name="displayableMeasures"        select="$Result.displayableMeasures"/>
289                                </xsl:call-template>
290                                <div class="RecordCount">Record Count: <xsl:value-of select="$recordCount"/></div>
291                                <br/>
292                                <xsl:call-template name="Page.dataTableValuesFootnote"/>
293                        </xsl:otherwise>
294                </xsl:choose>
295
296
297                <!-- Data Notes -->
298                <xsl:if test="exists($Result.configuration/DATA_NOTES)">
299                        <h2>Data Notes</h2>
300                        <xsl:for-each select="$Result.configuration/DATA_NOTES/DATA_NOTE">
301                                <xsl:sort select="SORT_ODRER" order="ascending" data-type="number"/>
302                                <xsl:call-template name="Page.containedTitleText">
303                                        <xsl:with-param name="titleTextContainer" select="."/>
304                                </xsl:call-template>
305                                <br/>
306                        </xsl:for-each>
307                </xsl:if>
308 
309                <!-- Data Sources -->
310                <xsl:if test="count($Result.configuration/DATA_SOURCES/DATA_SOURCE) &gt; 0">
311                        <h2>Data Sources</h2>
312                        <xsl:for-each select="$Result.configuration/DATA_SOURCES/DATA_SOURCE">
313                                <xsl:sort select="SORT_ODRER" order="ascending" data-type="number"/>
314                                <xsl:if test="position() &gt; 1">;&#160;</xsl:if>
315                                <xsl:value-of select="TEXT"/>
316                        </xsl:for-each>
317                        <br/><br/>
318                </xsl:if>
319
320                <!-- Data Issues -->
321                <xsl:if test="exists($Result.configuration/DATA_ISSUES)">
322                        <h2>Data Issues</h2>
323                        <xsl:for-each select="$Result.configuration/DATA_ISSUES/DATA_ISSUE">
324                                <xsl:sort select="SORT_ODRER" order="ascending" data-type="number"/>
325                                <xsl:call-template name="Page.containedTitleText">
326                                        <xsl:with-param name="titleTextContainer" select="."/>
327                                </xsl:call-template>
328                                <br/>
329                        </xsl:for-each>
330                </xsl:if>
331
332                <h2>Time of Query</h2>
333                These data were queried on: <xsl:value-of select="/QUERY_MODULE/REQUEST/FINISHED_DATE_TIME_STAMP"/>
334                <br/><br/>
335
336                <a href="#top" class="Top">Top</a>
337                <br/><br/>
338        </xsl:template> 
339       
340
341        <xsl:template name="SiteSpecific.navigationPath"
342                ibis:doc="Hook that allows for bread crumb trails..."
343        >
344                <a href="{$ibis.urlPrefix}" title="MassCHIP Website">MassCHIP</a> &gt;
345                <a href="{$ibis.urlPrefix}query" title="MassCHIP Website Dataset Queries">Dataset Queries</a> &gt; 
346                <a title="Query module configuration selection page">
347                        <xsl:attribute name="href" select="concat($ibis.urlPrefix, /QUERY_MODULE/QUERY_CONFIGURATION_SELECTION/LOCAL_URL)"/>
348                        <xsl:value-of select="/QUERY_MODULE/QUERY_CONFIGURATION_SELECTION/TITLE"/></a> &gt; 
349                <a href="{$SiteSpecific.builderURL}" title="Query module builder page">Query Builder</a>
350        </xsl:template>
351
352
353
354
355        <xsl:template name="Page.sectionsFooter"
356                ibis:doc="This is the page's content bottom that defaults to
357                        provding the 'page.orgUnit' text within an HTML DIV container that has
358                        an id of 'contentFooter'.  If the org unit does not exist, then nothing
359                        is displayed."
360        >
361                <xsl:param name="orgUnitName" select="if(string-length($Page.orgUnitName) = 0) then 'DEFAULT' else $Page.orgUnitName"/>
362                <xsl:param name="orgUnit" select="$Page.orgUnits/ORG_UNIT[NAME=$orgUnitName]"/>
363
364<span style="">
365<a href="{$ibis.urlPrefix}query/definition/detail/edit.html">Save this query definition</a>
366</span>
367
368                <xsl:if test="string-length($orgUnit/TITLE) &gt; 0">
369                        <div class="Footer">
370                                <xsl:value-of select="$orgUnit/TITLE"/>, <xsl:value-of select="$orgUnit/CONTACT_TEXT"/>
371                        </div>
372                </xsl:if>
373        </xsl:template>
374
375
376
377</xsl:stylesheet>
378<!-- ============================= End of File ============================= -->
379
Note: See TracBrowser for help on using the repository browser.