1 | <?xml version="1.0" encoding="ISO-8859-1"?> |
---|
2 | <xsl:stylesheet version="3.0" |
---|
3 | xmlns:xsl ="http://www.w3.org/1999/XSL/Transform" |
---|
4 | xmlns:ibis="http://www.ibisph.org" |
---|
5 | |
---|
6 | exclude-result-prefixes="ibis" |
---|
7 | > |
---|
8 | |
---|
9 | <ibis:doc> |
---|
10 | <name>html/Help</name> |
---|
11 | <summary>Templates for help content - alerts, popup type content blocks.</summary> |
---|
12 | <description> |
---|
13 | Structure: |
---|
14 | HELP |
---|
15 | [TITLE] |
---|
16 | [ADDITIONAL_CLASSES] |
---|
17 | one of: |
---|
18 | URL |
---|
19 | LOCAL_URL |
---|
20 | TEXT |
---|
21 | [USE_ALERT_FLAG] |
---|
22 | </description> |
---|
23 | </ibis:doc> |
---|
24 | |
---|
25 | |
---|
26 | <!-- ========================================================== H E L P --> |
---|
27 | <xsl:template match="HELP" mode="Help.element" |
---|
28 | ibis:doc="General template to add a [Help] button to the right of |
---|
29 | the sections content based on any 'HELP' type element. This |
---|
30 | template is simply a match to call-template wrapper. |
---|
31 | " |
---|
32 | > |
---|
33 | <xsl:call-template name="Help.content"> |
---|
34 | <xsl:with-param name="help" select="."/> |
---|
35 | </xsl:call-template> |
---|
36 | </xsl:template> |
---|
37 | |
---|
38 | |
---|
39 | <!-- General template that adds a [Help] type button/icon to the right of a |
---|
40 | given block. The button handles the following 4 options: |
---|
41 | - First if the useAlert is set then FORCE it to do the browser alert. |
---|
42 | This is the case even if the text contains a URL!!! |
---|
43 | - If a URL is specified, then when clicked, a new window will be opened |
---|
44 | using the specified URL for the page's contents. |
---|
45 | - If a URL is not specified but there is a TEXT element or text(), then |
---|
46 | a popup block is used. |
---|
47 | - Lastly, if no URL, no text, and only a title is specified then skip - |
---|
48 | this is wrong - if a popup is wanted then put the text to be shown |
---|
49 | as content not a title. |
---|
50 | --> |
---|
51 | <xsl:template name="Help.content" |
---|
52 | ibis:doc="General template to add a [Help] button/link/popup on the page. |
---|
53 | this template determines which of the actual sub help templates to |
---|
54 | use based on the useAlert, URL and if none of those then the default |
---|
55 | popup. |
---|
56 | " |
---|
57 | > |
---|
58 | <xsl:param name="help" ibis:doc="required help element - all other parameters are based off of this element's sub elements."/> |
---|
59 | <xsl:param name="title" select="$help/TITLE" ibis:doc="Optional text to be shown on button mouse over"/> |
---|
60 | <xsl:param name="titleLevel" select="4"/> |
---|
61 | |
---|
62 | <xsl:param name="url" select=" |
---|
63 | if(exists($help/LOCAL_URL)) then |
---|
64 | concat($ibis.baseRequestPath, $help/LOCAL_URL) |
---|
65 | else |
---|
66 | $help/URL |
---|
67 | " |
---|
68 | ibis:doc="Optional URL that if present will be shown in a new browser window when clicked on" |
---|
69 | /> |
---|
70 | <xsl:param name="useAlert" select="exists($help/USE_ALERT_FLAG)"/> |
---|
71 | <xsl:param name="additionalClasses" select="$help/ADDITIONAL_CLASSES" |
---|
72 | ibis:doc="additional control css class(s) to be added to the help icon." |
---|
73 | /> |
---|
74 | <xsl:variable name="additionalClasses" select="if(0 != string-length($additionalClasses))then $additionalClasses else 'Right'"/> |
---|
75 | |
---|
76 | <xsl:choose> |
---|
77 | <xsl:when test="$useAlert"> |
---|
78 | <xsl:call-template name="Help.alert"> |
---|
79 | <xsl:with-param name="title" select="$title"/> |
---|
80 | <xsl:with-param name="text"> |
---|
81 | <xsl:call-template name="ContentContainer.delimitedNodesetContent"> |
---|
82 | <xsl:with-param name="contentNodeset" select="$help/TEXT"/> |
---|
83 | <xsl:with-param name="delimiter" select="'\n\n'"/> |
---|
84 | </xsl:call-template> |
---|
85 | </xsl:with-param> |
---|
86 | <xsl:with-param name="additionalClasses" select="$additionalClasses"/> |
---|
87 | </xsl:call-template> |
---|
88 | </xsl:when> |
---|
89 | |
---|
90 | <xsl:when test="0 != string-length($url)"> |
---|
91 | <xsl:call-template name="Help.link"> |
---|
92 | <xsl:with-param name="title" select="$title"/> |
---|
93 | <xsl:with-param name="url" select="$url"/> |
---|
94 | <xsl:with-param name="additionalClasses" select="$additionalClasses"/> |
---|
95 | </xsl:call-template> |
---|
96 | </xsl:when> |
---|
97 | |
---|
98 | <xsl:when test="0 != count($help/TEXT)"> |
---|
99 | <xsl:call-template name="Help.popup"> |
---|
100 | <xsl:with-param name="title" select="$title"/> |
---|
101 | <xsl:with-param name="titleLevel" select="$titleLevel"/> |
---|
102 | <xsl:with-param name="content"> |
---|
103 | <xsl:call-template name="ContentContainer.delimitedNodesetContent"> |
---|
104 | <xsl:with-param name="contentNodeset" select="$help/TEXT"/> |
---|
105 | <xsl:with-param name="delimiter"><br/><br/></xsl:with-param> |
---|
106 | </xsl:call-template> |
---|
107 | </xsl:with-param> |
---|
108 | <xsl:with-param name="additionalClasses" select="$additionalClasses"/> |
---|
109 | </xsl:call-template> |
---|
110 | </xsl:when> |
---|
111 | </xsl:choose> |
---|
112 | </xsl:template> |
---|
113 | |
---|
114 | |
---|
115 | <xsl:template name="Help.popup" ibis:doc="creates popup content help html code."> |
---|
116 | <xsl:param name="title" ibis:doc="Optional text to be shown on button mouse over"/> |
---|
117 | <xsl:param name="titleLevel" select="4"/> |
---|
118 | <xsl:param name="content" ibis:doc="text with optional sub elements."/> |
---|
119 | <xsl:param name="additionalClasses"/> |
---|
120 | <xsl:param name="addWikiAttribute" select="true()"/> |
---|
121 | <!-- xsl:message select="concat('Help.popup level: ', $titleLevel, ', title: ', $title)"/ --> |
---|
122 | |
---|
123 | <span class="Help Popup FontIcon {$additionalClasses}"> |
---|
124 | <div class="Container"> |
---|
125 | <xsl:call-template name="ContentContainer.fixed"> |
---|
126 | <xsl:with-param name="title" select="$title"/> |
---|
127 | <xsl:with-param name="titleLevel" select="$titleLevel"/> |
---|
128 | <xsl:with-param name="content" select="$content"/> |
---|
129 | <xsl:with-param name="contentContainerClass" select="'Content'"/> |
---|
130 | <xsl:with-param name="contentContinerElementName" select="'div'"/> |
---|
131 | <xsl:with-param name="addWikiAttribute" select="$addWikiAttribute"/> |
---|
132 | </xsl:call-template> |
---|
133 | </div> |
---|
134 | </span> |
---|
135 | </xsl:template> |
---|
136 | |
---|
137 | |
---|
138 | <xsl:template name="Help.link" ibis:doc="creates link based help html."> |
---|
139 | <xsl:param name="title" ibis:doc="Optional text to be shown on button mouse over"/> |
---|
140 | <xsl:param name="url" ibis:doc="Optional URL that if present will be shown in a new browser window when clicked on"/> |
---|
141 | <xsl:param name="additionalClasses" select="'Right'"/> |
---|
142 | |
---|
143 | <span onclick="window.open('{$url}', '_blank')" title="{$title}" |
---|
144 | class="Help Link FontIcon {$additionalClasses}" |
---|
145 | > </span> |
---|
146 | </xsl:template> |
---|
147 | |
---|
148 | <!-- |
---|
149 | Prior to 2008 a javascript alert box was used to display the text. |
---|
150 | NOTE: There are not many formatting options when the text element is used |
---|
151 | in an alert box. Only javascript string escape characters are supported |
---|
152 | AND you must be aware of the XML restrictions. Below lists some of the |
---|
153 | escape characters and things that should be watched for in the text: |
---|
154 | \n = new line - carriage return. For a blank line \n\n is needed. |
---|
155 | \" = double quote character. |
---|
156 | \' = single quote character. |
---|
157 | \t = tab / indent. This only works in IE - not NS. |
---|
158 | |
---|
159 | & produces the "&" character. |
---|
160 | > produces the ">" character. |
---|
161 | < produces the "<" character. |
---|
162 | \' produces the "'" character. Another way of doing \'. |
---|
163 | \" produces the " character. Another way of doing \". |
---|
164 | |
---|
165 | Also, for text elements all CR/LF's must be removed because the javascript |
---|
166 | generated will break lines and it can't deal with that (that's why the |
---|
167 | normalize-space function is used - to remove all CR/LF/Tab characters). |
---|
168 | Also, the " character will blow up the script call as well. The " char |
---|
169 | is replaced with the \" char. The translate function could also be used |
---|
170 | to simply remove all " characters. Either solution also works for ". |
---|
171 | --> |
---|
172 | <xsl:template name="Help.alert" ibis:doc="creates script alert popup help html."> |
---|
173 | <xsl:param name="title" ibis:doc="Optional text to be shown on button mouse over"/> |
---|
174 | <xsl:param name="text" ibis:doc="Text to be displayed via a script alert."/> |
---|
175 | <xsl:param name="additionalClasses" select="'Right'"/> |
---|
176 | |
---|
177 | <xsl:variable name="text" select="normalize-space($text)"/> |
---|
178 | <span onclick="javascript:alert('{$text}';" title="{$title}" |
---|
179 | class="Help Alert FontIcon {$additionalClasses}" |
---|
180 | > </span> |
---|
181 | </xsl:template> |
---|
182 | |
---|
183 | </xsl:stylesheet> |
---|
184 | <!-- ============================= End of File ============================= --> |
---|