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

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

view, java - Updated the user/modelmap/ProcessUserRegistration.java to use the modelmap's webapp base request path. Change ibis:getcompleteurl to getRequestURL.

File size: 22.5 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="../ibis.xslt"/>
10        <xsl:import href="ContentContainer.xslt"/>
11        <xsl:import href="Help.xslt"/>
12        <xsl:import href="SelectionsList.xslt"/>
13        <xsl:import href="MenuSelectionsList.xslt"/>
14
15
16        <ibis:doc>
17                <name>html/Page</name>
18                <summary>Standard HTML "Page" template API definitions</summary>
19                <description>
20                        Standard HTML page template definition/API used for ALL IBIS-PH web
21                        page transformations.  This XSLT defines the core XSLT HTML page API.
22
23                        This XSLT is "imported" by the root site specific page.xslt which is
24                        then imported by all sub IBISPH-View XSLTs that produce HTML.  Some
25                        of the core HTML "page" templates defined are simply stubbed out
26                        template definitions without any code (which may or may not be
27                        implemented in sub page.xslt template files).  These templates are
28                        designed so that they can be overridden as needed either in sub site
29                        specific page template files or in the specific page's template file.
30
31                        CORE XSLT IMPORT NOTE:
32                        Prior to 6/2015, tried to have the page.xslt or ss.xslt import the
33                        needed xslts so that it was obvious what was being used.  However,
34                        there were duplicate imports and most pages use some if not all of
35                        the main "core" xslt templates.  So, even though they are not called
36                        directly in this file they are imported within the core Page.xslt
37                        because it is more reliable then importing in the main ss.xslt and
38                        then duplicating those imports in sub Page.xslt files.
39                        This xslt did not include the
40                </description>
41        </ibis:doc>
42
43        <xsl:output method="html" version="5.0" html-version="5" encoding="ISO-8859-1" indent="no"/>
44        <!--
45                IMPORTANT INDENT: off = "no". If yes then wiki formatting is messed.
46
47                Output Notes:
48                - method='html', 'text' or 'xhtml'.  If xhtml then version needs to be
49                  1.0 or 1.1.  Version 1.1 requires not omitting the xml declaration which
50                  messes with the CSS formatting so for IE, xhtml strict should be 1.0
51                  so can omit the xml declaration.  Even using xhtml 1.0, IE still will
52                  NOT format correctly like FF.  If html then version should be 4.01.
53                  XHTML works with xalan BUT ie 6 can't handle.  Posts about IE 6.x not
54                  handling xHTML:
55                        http://erik.eae.net/archives/2003/07/29/21.07.24/
56                        http://www.objectsbydesign.com/projects/xslt/xhtml.html:
57                - The main xhtml item IE has a problem with is the <script/> tag!  If it's
58                  standard like: <script></script> then all appears to work!!!  One trick
59                  is to insert "//" in between the tags or the &#160; character.  That
60                  works!!!  If nothing is put in between (e.g. normal whitespace then it auto
61                  collapses to the xml way of closing tags/elements without any content ("/>").
62
63                - typical encoding="UTF-8" encoding="ISO-8859-1".  Had problems with UTF-8.
64                - "omit" controls the xml version tag which messes up most current browsers.
65                - Same goes for setting method="xml".  Both produce correct code but ie
66                  doesn't like it.
67
68                Other doctype values:
69                doctype-public="-//W3C//DTD HTML 4.01//EN"
70                doctype-system="http://www.w3.org/TR/html4/strict.dtd"
71
72                doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
73                doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
74
75                doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
76                doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
77
78                doctype-system="about:legacy-compat"  -  used for HTML5 for older XSLT processors.
79
80                Complete HTML 4.01:
81                method="html" media-type="text/html" version="4.01" indent="no"
82                encoding="ISO-8859-1" omit-xml-declaration="yes"
83                doctype-public="-//W3C//DTD HTML 4.01//EN"
84                doctype-system="http://www.w3.org/TR/html4/strict.dtd"
85
86                Complete HTML5 with Saxon:
87                method="html" version="5.0" encoding="ISO-8859-1" indent="no"
88        -->
89
90
91        <!-- STRIPPING SPACE: The xsl:strip-space element is used to remove white-space
92                only nodes so that they do not appear in the output (removes the element!).
93                The related xsl:preserve-space element is used to keep white-space only
94                nodes in the output. Note that the default is to leave white-space only
95                nodes.  Therefore, it is only necessary to use the xsl:preserve-space
96                element when you use the xsl:strip-space element and wish to insure that
97                certain white-space nodes are not removed.  So, some elements are null
98                text elements and are used as flags and thus MUST not be stripped.  If
99                there are problems then a list of flag type elements must be specified
100                at the top of the xslt.
101
102                See: http://www-106.ibm.com/developerworks/xml/library/x-tipwhitesp.html
103        -->
104
105
106
107
108        <!-- ====================================================== GLOBAL VARIABLES
109                These are variables which are needed to be defined in one centralized
110                location which are then used by various XSLTs.  Some templates could have
111                been implemented as variables and would have made more sense.  However,
112                variables are typically only created when an element is used more than
113                once or there's a specific reason.  So for element text that is only used
114                once a template is typically marginally better as it does not need to be
115                stored in memory like a variable is.
116        -->
117        <xsl:param name="Page.ibisphWebmasterEmailAddress" select="'webmaster@ibis.your_state.gov'"
118                ibis:doc="Site's Webmaster email address which is used in the head's meta
119                        tag and can be used in footers etc.  This value should be implemented
120                        in the site specific XSLT."
121        />
122
123        <xsl:param name="Page.applicationTitle" select="'IBIS-PH'"
124                ibis:doc="Used for the page's title element prefix text"
125        />
126
127        <xsl:param name="Page.pageTitle" 
128                ibis:doc="Provides the page's title text which is typically displayed
129                        by the browser's window title bar.  This variable is a stubb and
130                        should be implemented for each specific type of page."
131        />
132
133        <xsl:param name="Page.contentTitle" select="$Page.pageTitle"
134                ibis:doc="Provides the page's content title text which is typically
135                        displayed in the content header section.  This variable is a stubb
136                        and should be implemented for each specific type of page.
137                "
138        />
139
140        <xsl:param name="Page.metaAuthor" select="'Deparment of Health'"
141                ibis:doc="Optional standardized hook template that provides the text to
142                        be inserted into the page's head 'author' meta tag element.
143                "
144        />
145
146        <xsl:param name="Page.metaDescription" select="$Page.pageTitle"
147                ibis:doc="Optional standardized hook template that provides the
148                        text to be inserted into the page's head 'description' meta tag element.
149                        This template should be overridden in the page specific templates.
150                        The value defaults to the text provided by the 'html.pageTitle' template.
151                "
152        />
153
154        <xsl:param name="Page.metaKeywords" select="$Page.pageTitle"
155                ibis:doc="Optional standardized hook template that provides the
156                        text to be inserted into the page's head 'keywords' meta tag element.
157                        This template should be overridden in the page specific templates.
158                        The value defaults to the text provided by the 'html.pageTitle' template.
159                "
160        />
161
162        <xsl:param name="Page.htmlClass" ibis:doc="Stub param that provides hook to set the main html css class."/>
163
164        <xsl:param name="XMLModifedDate"
165                ibis:doc="Parameter which is set via the Java model code so that the
166                        resultant page can display the XML file's modified date/time."
167        />
168        <xsl:variable name="Page.XMLModifedDate" 
169                select="if(string-length($XMLModifedDate) = 0) then //ibis:doc/versions/version[1]/date else $XMLModifedDate"
170                ibis:doc="Variable that wraps the 'XMLModifedDate' parameter so that we
171                        know where this variable/parameter is defined.  If the parameter
172                        value is not specified then the parameter defaults to selecting the
173                        XML document's ibis:doc version date."
174        />
175
176        <xsl:param name="OrgUnits"/>
177        <xsl:param name="Page.orgUnits" select="$OrgUnits/ORG_UNITS"
178                ibis:doc="Convenience variable which holds the ORG_UNIT elements.  This
179                        could/should be loaded and cached at app startup and injected at some
180                        future point for speed.  For now, because there is not a reload the   
181                        cache when published mechanism, it is implemented as a file/document
182                        lookup.
183                "
184        />
185        <xsl:param name="Page.orgUnitName" select="'DEFAULT'"
186                ibis:doc="Default Org Unit name used for page body content footer.  This
187                variable is overridden by indicator profile and query module pages.
188                Defaults to 'DEFAULT'."
189        />
190
191
192        <!-- ============================= ROOT HTML CONTAINER/API CALLING TEMPLATES
193                The core templates (API) are listed below.  These templates are defined
194                here as they apply to most of HTML pages that are produced.  Since this
195                XSLT is designed to be imported, these templates can be overridden by
196                more specific XSLT implementations.  Note that these templates all begin
197                with "html.".  This was done so it is easy to identify where these
198                templates are defined and being used/called from.
199        -->
200
201        <!-- THE ROOT TEMPLATE -->
202        <xsl:template match="/"
203                ibis:doc="Main root element processing template.  This template is the
204                        main page template API.  This includes the HTML tag, the head information,
205                        and the cotent.
206                "
207        >
208                <!-- global error catcher... -->
209                <xsl:fallback>
210                        <xsl:message terminate="yes">
211                                The XSLT has a problem processing and is now terminating...
212                        </xsl:message>
213                </xsl:fallback>
214
215                <html lang="en">
216                        <xsl:if test="string-length($Page.htmlClass) != 0">
217                                <xsl:attribute name="class" select="$Page.htmlClass"/>
218                        </xsl:if>
219
220                        <xsl:call-template name="Page.head"/>
221                        <xsl:call-template name="Page.body"/>
222                </html>
223        </xsl:template>
224
225
226        <!-- =============================================== HTML HEAD API TEMPLATES
227                HTML HEAD element templates.  Most of these templates are blank stubs.
228                These templates provide an "interface" definition/mechanism where other
229                XSLT pages can implement/add additional functionality by overriding the
230                these defined templates with a site specific or a more page specific
231                XSLT implementation.
232        -->
233        <xsl:template name="Page.head" ibis:doc="Produces the HTML HEAD element and contents.">
234                <head>
235                        <meta http-equiv="Reply-to"             content="{$Page.ibisphWebmasterEmailAddress}"/>
236
237                        <meta name="author"      content="{$Page.metaAuthor}"/>
238                        <meta name="description" content="{$Page.metaDescription}"/>
239                        <meta name="keywords"    content="{$Page.metaKeywords}"/>
240                        <meta name="robots"      content="ALL"/>
241
242                        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
243                        <!-- commented for hand held but doesn't work very well
244                        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
245                        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
246                        See more at: http://m5designstudio.com/2013/orlando-web-design/bootstrap-responsive-layout/#sthash.K7Y4tGnk.dpuf
247                        https://developer.mozilla.org/en-US/docs/Mozilla/Mobile/Viewport_meta_tag
248                        -->
249
250                        <title><xsl:value-of select="if(contains($Page.pageTitle, $Page.applicationTitle))then $Page.pageTitle else concat($Page.applicationTitle, ' - ', $Page.pageTitle)"/></title>
251
252                        <link rel="shortcut icon" href="{$ibis.baseRequestPath}image/application.ico" type="image/vnd.microsoft.icon"/>
253                        <link rel="icon"          href="{$ibis.baseRequestPath}image/application.ico" type="image/vnd.microsoft.icon"/> 
254                        <link rel="home"          href="{$ibis.baseRequestPath}"/> 
255                        <link rel="help"          href="{$ibis.baseRequestPath}about/Help.html"/> 
256                        <link rel="toc"           href="{$ibis.baseRequestPath}about/SiteMap.html"/> 
257                        <link rel="make"          href="http://www.ibisph.org"/> 
258
259                        <xsl:call-template name="Page.standardCSS"/>
260                        <xsl:call-template name="Page.specificCSS"/>
261
262                        <xsl:call-template name="Page.standardScript"/>
263                        <xsl:call-template name="Page.specificScript"/>
264
265                        <xsl:call-template name="Page.specificHeadContent"/>
266                </head>
267        </xsl:template>
268
269
270        <!-- META TAG CACHING NOTE: Meta tags are easy to use, but aren't very effective.
271                That's because they're only honoured by a few browser caches (which actually
272                read the HTML), not proxy caches (which almost never read the HTML in the
273                document). While it may be tempting to put a Pragma: no-cache meta tag into
274                a Web page, it won't necessarily cause it to be kept fresh.  See:
275                http://www.mnot.net/cache_docs/#CONTROL
276        -->
277        <xsl:template name="Page.metaNoCacheControl"
278                ibis:doc="Returns all the HTML HEAD meta tag elements that are
279                        used by a browser/proxy caches to cache content.  This includes:
280                        'Expires', 'Pragma', 'Cache-Control', and 'robots'."
281        >
282                <meta http-equiv="Expires"       content="Fri, 12 Dec 1980 23:23:23 GMT"/>
283                <meta http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=0"/>
284                <meta http-equiv="Pragma"        content="no-cache"/>
285                <meta name="robots"              content="NONE, NOINDEX, NOFOLLOW, NOARCHIVE"/>
286        </xsl:template>
287
288
289
290        <xsl:template name="Page.standardCSS"
291                ibis:doc="Provides the common/standard CSS to be used by all the
292                        pages.  It is recommended that this template be defined high up in
293                        the import hierarchy for ease of maintenance e.g. not be overridden
294                        by each specific page type.  The 'html.otherCSS' template is provided
295                        to handle lower level, page specific CSS links/code.  The default is
296                        a CSS link to the 'css/stylesheet.css' file.
297
298                        The print version is used IF the PrinterFriendly parameter is present
299                        then the print.css is provided as a generic media type.  If not present
300                        then the media type is set to 'print' so that any browser print operation
301                        will be formatted accordingly.  This unique structure allows for pages
302                        to still be served up as a web page without the header, navigation and
303                        other elements formatted appropriately - which will still work for
304                        printing!  Note that this CSS should be placed after all other CSS
305                        definitions so that it can override previous settings.
306                "
307        >
308                <link rel="stylesheet" type="text/css" href="{$ibis.baseRequestPath}css/stylesheet.css"/>
309                <link rel="stylesheet" type="text/css" href="{$ibis.baseRequestPath}css/_print.css">
310                        <xsl:if test="ibis:isPrinterFriendly() = false()">
311                                <xsl:attribute name="media" select="'print'"/>
312                        </xsl:if>
313                </link>
314                <xsl:if test="($PrinterFriendly = 'bw') or ($PrinterFriendly = 'BW')">
315                        <link rel="stylesheet" type="text/css" href="{$ibis.baseRequestPath}css/_print_bw.css" media="print"/>
316                </xsl:if>
317        </xsl:template>
318
319
320        <xsl:template name="Page.specificCSS" ibis:doc="Provides a hook for sub page CSS to be implemented."/>
321
322
323        <xsl:template name="Page.standardScript"
324                ibis:doc="Provides the common/standard script code/links to be used
325                        by all the pages.  It is recommended that this template be defined high
326                        up in the import hierarchy for ease of maintenance e.g. not be overridden
327                        by each specific page type.  The 'page.specificScript' template is designed
328                        to handle page specific script links/code.  Note that even though this is
329                        a stubbed out API call, a reference is made to the jquery code which
330                        highlights the dependency that most script code has on this core script.
331
332                        404 jquery jquery.min.map file issue:
333                        See: http://stackoverflow.com/questions/18365315/jquerys-jquery-1-10-2-min-map-is-triggering-a-404-not-found
334                "
335        >
336                <script src="{$ibis.baseRequestPath}js/jquery.min.js"/>
337                <script src="{$ibis.baseRequestPath}js/jquery.wikitohtml.js"/>
338                <script src="{$ibis.baseRequestPath}js/kendo.all.min.js"/>
339                <script src="{$ibis.baseRequestPath}js/kendo.js"/>
340
341                <script>
342                        // <![CDATA[
343                        $(document).ready(function()
344                        {
345                                // Add the wiki processing if any element uses it.  This should
346                                // only be done on non HTML_CONTENT type pages.
347// both ways work... $("*[wiki='true']").each( function(){ $(this).wikiToHTML(); } );
348                                $("*[wiki='true']").wikiToHTML();
349                        }); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
350                        // ]]>
351                </script>
352        </xsl:template>
353
354
355        <xsl:template name="Page.specificScript" ibis:doc="Provides mechanism for type of page specific script code."/>
356
357
358        <xsl:template name="Page.specificHeadContent"
359                ibis:doc="Optional standardized hook template so that other more
360                        page specific or site specific templates can include other meta tag
361                        elements, CSS, or script code.  The template is a stub and should
362                        be implemented for each specific type of page."
363        />
364
365
366
367        <!-- ================================ HTML PAGE LAYOUT SECTION API TEMPLATES
368                These templates provide the basic page layout control.
369        -->
370        <xsl:template name="Page.body" ibis:doc="Produces the HTML BODY element and contents.">
371                <body>
372                        <xsl:call-template name="Page.adaMainSectionLinks"/>
373                        <xsl:call-template name="Page.banner"/>
374
375                        <div id="page">
376                                <xsl:call-template name="Page.header"/>
377                                <xsl:call-template name="Page.content"/>
378                                <xsl:call-template name="Page.footer"/>
379                        </div>
380                </body>
381        </xsl:template>
382
383
384        <xsl:template name="Page.adaMainSectionLinks" ibis:doc="Provides ADA recommended section jump tos.">
385                <div title="Page's main sections index" class="OffPage">
386                        <a href="#siteSearch"        title="Skip to search">Skip directly to search</a>
387                        <a href="#siteNavigation"    title="Skip to site navigation">Skip directly to the site navigation</a>
388                        <a href="#sectionsContainer" title="Skip to content">Skip directly to the page's main content</a>
389                        <a href="?PrinterFriendly=x" title="Show page without navigation menus and headers."/>
390                </div>
391        </xsl:template>
392
393
394        <xsl:template name="Page.banner" ibis:doc="Optional stubbed template for state and doh banners."/>
395
396
397        <xsl:template name="Page.header"
398                ibis:doc="This is the page's header content that usually has the
399                        web application's logo and common/major navigation links and options.
400                        This is a stubbed hook template that is intended to be overridden in
401                        a site specific template file or left as is which results in this
402                        being effectively turned off."
403        >
404                <header id="header"/>
405        </xsl:template>
406
407
408        <xsl:template name="Page.content"
409                ibis:doc="This template is used to provide the main page content.  It is
410                        comprised of a content header, content body, and content footer.
411                        Again these can be overridden to provide site specific implementations.
412                "
413        >
414                <main id="content">
415                        <xsl:call-template name="Page.contentHeader"/>
416                        <xsl:call-template name="Page.contentBody"/>
417                        <xsl:call-template name="Page.contentFooter"/>
418                </main>
419        </xsl:template>
420
421
422        <xsl:template name="Page.contentHeader"
423                ibis:doc="This is the page's content top that defaults to provding the
424                        'Page.contentTitle' text within an HTML h1 container.  If the content
425                        title text does not exist, then the nothing is inserted."
426        >
427                <xsl:if test="string-length($Page.contentTitle) != 0">
428                        <header><h1><xsl:value-of select="$Page.contentTitle"/></h1></header>
429                </xsl:if>
430        </xsl:template>
431
432
433        <xsl:template name="Page.contentBody"
434                ibis:doc="Stubbed template that needs to be implemented in each page specific
435                        XSLT file (not site specific) that provides the main page body content."
436        />
437
438
439        <xsl:template name="Page.contentFooter"
440                ibis:doc="This is the page's content bottom that defaults to
441                        provding the 'page.orgUnit' text within an HTML DIV container that has
442                        an id of 'contentFooter'.  If the org unit does not exist, then nothing
443                        is displayed."
444        >
445                <xsl:param name="orgUnitName" select="if(string-length($Page.orgUnitName) != 0) then $Page.orgUnitName else 'DEFAULT'"/>
446                <xsl:param name="orgUnit"     select="$Page.orgUnits//ORG_UNIT[NAME=$orgUnitName]"/>
447
448                <xsl:if test="string-length($orgUnit/TITLE) != 0">
449                        <footer>
450                                <xsl:value-of select="$orgUnit/TITLE"/>, <xsl:value-of select="$orgUnit/CONTACT_TEXT"/>
451                                <xsl:if test="string-length($orgUnit/URL) != 0">
452                                        (<a href="{$orgUnit/URL}"><xsl:value-of select="$orgUnit/URL"/></a>)
453                                </xsl:if>
454                        </footer>
455                </xsl:if>
456        </xsl:template>
457
458
459        <xsl:template name="Page.footer"
460                ibis:doc="This is the page's footer content that usually has the
461                        web application's disclaimers, links etc.  This is a stubbed hook
462                        template that is intended to be overridden in a site specific template
463                        file or left as is which results in this being effectively turned off."
464        >
465                <footer/>
466        </xsl:template>
467
468
469
470        <xsl:template name="Page.insertAJAXContent"
471                ibis:doc="
472                        Provides a way to get AJAX content into a page.
473                        1) The main use case is to get HTML_CONTENT to look like it's part of
474                                the IP's views.  This use case is for UT EPHT wants some
475                                HTML_CONTENT page to show up as a dataless *view*.  The page will
476                                have to be 100% crafted as HTML_CONTENT and does not provide/allow
477                                any IP or IPV type data field processing etc - all or nothing. 
478
479                        2) Alternate IP view that looks like it's part of the IP's views.
480                                This tries to provide a work around for adopters that want IPs
481                                to contain views of different value type e.g. Rates and Counts
482                                to be contained within the same *IP view* set.  This works IF:
483                                A) The *Rates* and *Counts* IP data is duplicated,
484                                B) The map is turned off from the view being referenced.
485                                Note that this sometimes doesn't work for maps because the map
486                                layers are AJAX and this surrogate content is also ajax of the
487                                entire page body.
488
489                        NOTES:
490                                Tried IFRAME and EMBED.  If entire page then get header, footer,
491                                nav etc.  If limited to the section.Sections container element
492                                then have issues with css and script.  Also needed script to auto
493                                size the height.  See 9/19/2017 commit for temp IP Interactive.xslt
494                                code tried.
495
496                                Can't easily include outside content.  It's easily done IF we
497                                don't have the security headers enabled - which then raises lots
498                                of flags when the site is scanned for security vulnerabilities.
499                "
500        >
501                <xsl:param name="sourceContentURL"/>
502                <xsl:param name="sourceContentJQuerySelector" select="'section.Sections'"/>
503                <xsl:param name="destContentJQuerySelector"   select="'section.Sections'"/>
504
505                <script>
506                        $.ajax({
507                                url: "<xsl:value-of select="ibis:getRequestURL($sourceContentURL)"/>"
508                                ,type: "GET"
509                                ,success: function(data)
510                                {
511                                        $("<xsl:value-of select="$destContentJQuerySelector"/>").html( $(data).find("<xsl:value-of select="$sourceContentJQuerySelector"/>").html() );
512                                }
513                        });
514                </script>
515        </xsl:template>
516
517</xsl:stylesheet>
518<!-- ============================= End of File ============================= -->
519
Note: See TracBrowser for help on using the repository browser.