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 | |
---|
10 | <ibis:doc> |
---|
11 | <name>html/MenuSelectionsList</name> |
---|
12 | <summary> |
---|
13 | Supplemental code for SELECTIONS/SELECTION XML elements to |
---|
14 | HTML menu structures. This produces a NAV/UL/LI structure that |
---|
15 | has Selections and Selection css classnames. This menu's |
---|
16 | output/element inclusion is limited based on the SELECTION's |
---|
17 | AUTHORITY value matching a user's authority value. If the |
---|
18 | SELECTION has an AUTHORITY then a matching userAuthorities/AUTHORITY |
---|
19 | is required for the selection to be included in the output. |
---|
20 | |
---|
21 | IMPORTANT NOTE: This code relies on an existing container with that |
---|
22 | containers associated CSS definitions for the struct that this |
---|
23 | XSLT code produces. |
---|
24 | |
---|
25 | STRUCTURE (XML HTML CSS Class (Normal Site/Mega Site/Context): |
---|
26 | ======================================================================== |
---|
27 | - - - - - (main, highest level menus items - typically horizontal tabs). |
---|
28 | SELECTIONS UL Main item or tab Container |
---|
29 | SELECTION LI Actual main/tab Req: Title Optional: URL, NAME |
---|
30 | - - - - - (starting point for actual menu selections - sub menu). |
---|
31 | SELECTIONS UL/* Container - first drop down, main mega DIV TABLE TR, main context |
---|
32 | id=[NAME], title=[DESCRIPTION] TITLE isn't used |
---|
33 | SELECTION LI/* Item - drop down selection, TD mega column title, First level context selection/label |
---|
34 | a=[URL], text=[TITLE], title=[DESCRIPTION]. |
---|
35 | SELECTIONS UL Container - 1st fly out, mega column, 2nd level context |
---|
36 | SELECTION LI Item - normal formst, underlined format, indented or normal formatting. |
---|
37 | a=[URL], text=[TITLE], title=[DESCRIPTION]. |
---|
38 | SELECTIONS UL Container - 2nd fly out, mega horz list, 3rd level context - shouldn't ever happen |
---|
39 | SELECTION LI Item - 2nd fly selection - rare, horz item, 3rd level - shouldn't ever happen. |
---|
40 | </summary> |
---|
41 | <description> |
---|
42 | </description> |
---|
43 | </ibis:doc> |
---|
44 | |
---|
45 | |
---|
46 | <xsl:param name="MenuSelectionsList.panelsMenuControlTitle" select="'Site Menu'"/> |
---|
47 | |
---|
48 | |
---|
49 | <xsl:template name="MenuSelectionsList.dropDown" |
---|
50 | ibis:doc="Main call to process a SELECTIONS/SELECTION structure that |
---|
51 | produces a horizontal menu with drop down and popout sub menus. |
---|
52 | The main value that this call provides over the |
---|
53 | SelectionsList.processSelections call is the additional passed |
---|
54 | parameters that set an ID, container css class, and the .On |
---|
55 | selection. |
---|
56 | |
---|
57 | NOTE: this implementation uses a less deep SELECTION nesting when |
---|
58 | compared to a mega menu panal. |
---|
59 | " |
---|
60 | > |
---|
61 | <xsl:param name="selections" ibis:doc="Main SELECTIONS element to process."/> |
---|
62 | <xsl:param name="selectedSelectionName" ibis:doc="Name of the selected SELECTION element - used for setting the 'on' tab."/> |
---|
63 | <xsl:param name="containerID" select="$selections/NAME" |
---|
64 | ibis:doc="Optional main container UL 'id' attribute value. Default is the main SELECTIONS/NAME" |
---|
65 | /> |
---|
66 | <xsl:param name="containerClass" select="'HorizontalMenu'" |
---|
67 | ibis:doc="Optional CSS class for the main UL element. Default = HorizontalMenu" |
---|
68 | /> |
---|
69 | |
---|
70 | <ul> |
---|
71 | <xsl:if test="string-length($containerID) != 0"> |
---|
72 | <xsl:attribute name="id" select="$containerID"/> |
---|
73 | </xsl:if> |
---|
74 | <xsl:if test="exists(ADDITIONAL_CLASSES) or (string-length($containerClass) != 0)"> |
---|
75 | <xsl:attribute name="class" select="concat($containerClass, ' ', ADDITIONAL_CLASSES)"/> |
---|
76 | </xsl:if> |
---|
77 | <xsl:if test="exists(STYLE)"> |
---|
78 | <xsl:attribute name="style" select="STYLE"/> |
---|
79 | </xsl:if> |
---|
80 | |
---|
81 | <xsl:for-each select="$selections/SELECTION[ibis:hasAuthority(AUTHORITY)]"> |
---|
82 | <li> |
---|
83 | <xsl:if test="boolean(NAME/text()) and ($selectedSelectionName = NAME)"> |
---|
84 | <xsl:attribute name="class" select="'On'"/> |
---|
85 | </xsl:if> |
---|
86 | <xsl:if test="string-length(NAME) != 0"> |
---|
87 | <xsl:attribute name="id" select="NAME"/> |
---|
88 | </xsl:if> |
---|
89 | |
---|
90 | <a title="{if(exists(URL or LOCAL_URL)) then 'Show sub menu or goto the link if clicked on' else 'Show sub menu'}" |
---|
91 | href="{if(exists(URL))then URL else if(exists(LOCAL_URL)) then concat($ibis.contextPath, LOCAL_URL) else ''}" |
---|
92 | ><xsl:value-of select="TITLE"/></a> |
---|
93 | |
---|
94 | <xsl:call-template name="SelectionsList.processSelections"> |
---|
95 | <xsl:with-param name="selections" select="SELECTIONS"/> |
---|
96 | <xsl:with-param name="containerClass" select="'VerticalPopoutList'"/> |
---|
97 | </xsl:call-template> |
---|
98 | </li> |
---|
99 | </xsl:for-each> |
---|
100 | </ul> |
---|
101 | </xsl:template> |
---|
102 | |
---|
103 | |
---|
104 | |
---|
105 | <xsl:template name="MenuSelectionsList.megaMenu" |
---|
106 | ibis:doc="Main mega menu/panal SELECTIONS type processor. Creates a |
---|
107 | main menu (typically styled as a horizontal menu) with a panal for |
---|
108 | each major SELECTION with sub SELECTIONs that are put into blocks. |
---|
109 | Structure: |
---|
110 | ul class=[containerClass] SELECTIONS tyically HorizontalMenu + PanalList + InputControl |
---|
111 | li - tab(1) SELECTIONS/SELECTION |
---|
112 | - - - - - - - - |
---|
113 | [ (if input) |
---|
114 | input id=columnPanelControl1 |
---|
115 | label.Title for=columnPanelControl1 |
---|
116 | ] |
---|
117 | or default (if hover) |
---|
118 | span.Title |
---|
119 | div class=MegaMenu SELECTIONS/SELECTION/SELECTIONS |
---|
120 | div class=Block SELECTIONS/SELECTION/SELECTIONS/SELECTION |
---|
121 | [hx] |
---|
122 | ul SELECTIONS/SELECTION/SELECTIONS/SELECTION/SELECTIONS |
---|
123 | li SELECTIONS/SELECTION/SELECTIONS/SELECTION/SELECTIONS/SELECTION |
---|
124 | . . . |
---|
125 | div class=Block SELECTIONS/SELECTION/SELECTIONS/SELECTION |
---|
126 | ul SELECTIONS/SELECTION/SELECTIONS/SELECTION/SELECTIONS |
---|
127 | li SELECTIONS/SELECTION/SELECTIONS/SELECTION/SELECTIONS/SELECTION |
---|
128 | . . . |
---|
129 | li - tab(n) SELECTIONS/SELECTION |
---|
130 | div class=Panel SELECTIONS/SELECTION/SELECTIONS |
---|
131 | " |
---|
132 | > |
---|
133 | <xsl:param name="selections" ibis:doc="Main SELECTIONS element to process."/> |
---|
134 | <xsl:param name="selectedSelectionName" ibis:doc="Name of the selected SELECTION element - used for setting the 'on' tab."/> |
---|
135 | <xsl:param name="containerID" select="$selections/NAME" |
---|
136 | ibis:doc="Optional main container UL 'id' attribute value. Default is the main SELECTIONS/NAME" |
---|
137 | /> |
---|
138 | <xsl:param name="containerClass" select="'HorizontalMenu'" |
---|
139 | ibis:doc="Optional CSS class for the main UL element. Default = HorizontalMenu" |
---|
140 | /> |
---|
141 | |
---|
142 | <xsl:param name="displayControlType" select="'hover'" |
---|
143 | ibis:doc="'input' = create radio/checkbox control, Default = 'hover'" |
---|
144 | /> |
---|
145 | <xsl:param name="inputType" select="'radio'"/> |
---|
146 | <xsl:param name="inputName" select="'columnsPanelControl'"/> |
---|
147 | <xsl:param name="menuControlTitle" select="$MenuSelectionsList.panelsMenuControlTitle"/> |
---|
148 | |
---|
149 | <!-- main input control for hamburger menu - used for responsive small screen devices --> |
---|
150 | <xsl:call-template name="SelectionsList.inputControl"> |
---|
151 | <xsl:with-param name="inputID" select="$inputName"/> |
---|
152 | <xsl:with-param name="inputType" select="'checkbox'"/> |
---|
153 | <xsl:with-param name="title" select="$menuControlTitle"/> |
---|
154 | </xsl:call-template> |
---|
155 | |
---|
156 | <ul> |
---|
157 | <xsl:if test="string-length($containerID) != 0"> |
---|
158 | <xsl:attribute name="id" select="$containerID"/> |
---|
159 | </xsl:if> |
---|
160 | <xsl:if test="(0 != string-length($containerClass)) or (0 != string-length(ADDITIONAL_CLASSES))"> |
---|
161 | <xsl:attribute name="class" select="concat($containerClass, ' ', ADDITIONAL_CLASSES)"/> |
---|
162 | </xsl:if> |
---|
163 | <xsl:if test="exists(STYLE)"> |
---|
164 | <xsl:attribute name="style" select="STYLE"/> |
---|
165 | </xsl:if> |
---|
166 | |
---|
167 | <!-- loop for main top tab menu items --> |
---|
168 | <xsl:for-each select="$selections/SELECTION[ibis:hasAuthority(AUTHORITY)]"> |
---|
169 | <xsl:variable name="selection" select="."/> |
---|
170 | <li> |
---|
171 | <xsl:if test="0 != string-length($selection/NAME)"> |
---|
172 | <xsl:attribute name="id" select="$selection/NAME"/> |
---|
173 | </xsl:if> |
---|
174 | <xsl:if test="$selection/NAME = $selectedSelectionName"> |
---|
175 | <xsl:attribute name="class" select="'On'"/> |
---|
176 | </xsl:if> |
---|
177 | <xsl:if test="exists(ADDITIONAL_CLASSES)"> |
---|
178 | <xsl:attribute name="class" select="ADDITIONAL_CLASSES"/> |
---|
179 | </xsl:if> |
---|
180 | |
---|
181 | <xsl:choose> |
---|
182 | <!-- when a tab item has some selections then process as |
---|
183 | a panel with sub SELECTIONs being blocks/columns |
---|
184 | with other SELECTIONs being blocks within blocks. |
---|
185 | --> |
---|
186 | <xsl:when test="boolean($selection/SELECTIONS)"> |
---|
187 | <xsl:if test="'input' = $displayControlType"> |
---|
188 | <xsl:call-template name="SelectionsList.inputControl"> |
---|
189 | <xsl:with-param name="inputID" select="concat($inputName, position())"/> |
---|
190 | <xsl:with-param name="inputName" select="$inputName"/> |
---|
191 | <xsl:with-param name="inputType" select="$inputType"/> |
---|
192 | <xsl:with-param name="title" select="$selection/TITLE"/> |
---|
193 | </xsl:call-template> |
---|
194 | </xsl:if> |
---|
195 | <xsl:if test="'input' != $displayControlType"> |
---|
196 | <span class="Title"><xsl:value-of select="$selection/TITLE"/></span> |
---|
197 | </xsl:if> |
---|
198 | |
---|
199 | <div class="MegaMenu {$selection/ADDITIONAL_CLASSES}"> |
---|
200 | <xsl:if test="exists($selection/STYLE)"><xsl:attribute name="style" select="STYLE"/></xsl:if> |
---|
201 | |
---|
202 | <xsl:call-template name="MenuSelectionsList.panelHeader"> |
---|
203 | <xsl:with-param name="selection" select="$selection"/> |
---|
204 | </xsl:call-template> |
---|
205 | <div class="Body"> |
---|
206 | <xsl:for-each select="$selection/SELECTIONS/SELECTION"> |
---|
207 | <xsl:call-template name="MenuSelectionsList.panelBlock"> |
---|
208 | <xsl:with-param name="selection" select="."/> |
---|
209 | </xsl:call-template> |
---|
210 | </xsl:for-each> |
---|
211 | </div> |
---|
212 | <xsl:call-template name="MenuSelectionsList.panelFooter"> |
---|
213 | <xsl:with-param name="selection" select="$selection"/> |
---|
214 | </xsl:call-template> |
---|
215 | </div> |
---|
216 | </xsl:when> |
---|
217 | |
---|
218 | <xsl:when test="exists($selection/CONTENT)"> |
---|
219 | <xsl:apply-templates select="$selection/CONTENT/(text() | *)" mode="ibis.copy"/> |
---|
220 | </xsl:when> |
---|
221 | |
---|
222 | <xsl:when test="boolean($selection/URL)"> |
---|
223 | <a href="{$selection/URL}"><xsl:value-of select="$selection/TITLE"/></a> |
---|
224 | </xsl:when> |
---|
225 | <xsl:when test="boolean($selection/LOCAL_URL)"> |
---|
226 | <a href="{concat($ibis.contextPath, $selection/LOCAL_URL)}"><xsl:value-of select="$selection/TITLE"/></a> |
---|
227 | </xsl:when> |
---|
228 | |
---|
229 | <xsl:otherwise> |
---|
230 | <a href="#"><xsl:value-of select="$selection/TITLE"/></a> |
---|
231 | </xsl:otherwise> |
---|
232 | </xsl:choose> |
---|
233 | |
---|
234 | </li> |
---|
235 | </xsl:for-each> |
---|
236 | |
---|
237 | <!-- hook to allow for additional list items --> |
---|
238 | <xsl:call-template name="MenuSelectionsList.additionalPrimaryListItems"/> |
---|
239 | </ul> |
---|
240 | |
---|
241 | </xsl:template> |
---|
242 | |
---|
243 | |
---|
244 | |
---|
245 | <xsl:template name="MenuSelectionsList.panelBlock" |
---|
246 | ibis:doc="Column items handler for the MegaMenu. If a title then put |
---|
247 | in an H. If the SELECTION has a URL or LOCAL_URL then add an A. |
---|
248 | Note that HTML4 does not allow blocks within A's so A's must be |
---|
249 | wrapped within the H. |
---|
250 | " |
---|
251 | > |
---|
252 | <xsl:param name="selection"/> |
---|
253 | <xsl:param name="titleLevel" select="3" |
---|
254 | ibis:doc="Optional level that controls the HTML h element for them |
---|
255 | main column SELECTION/TITLE element. Default is '3'. |
---|
256 | " |
---|
257 | /> |
---|
258 | |
---|
259 | <xsl:if test="ibis:hasAuthority($selection/AUTHORITY)"> |
---|
260 | <div class="Block {$selection/ADDITIONAL_CLASSES}" style="{$selection/STYLE}"> |
---|
261 | <xsl:if test="string-length($selection/NAME) != 0"> |
---|
262 | <xsl:attribute name="id" select="$selection/NAME"/> |
---|
263 | </xsl:if> |
---|
264 | <xsl:if test="0 != string-length($selection/STYLE)"> |
---|
265 | <xsl:attribute name="style" select="$selection/STYLE"/> |
---|
266 | </xsl:if> |
---|
267 | |
---|
268 | <xsl:if test="0 != string-length($selection/TITLE)"> |
---|
269 | <xsl:variable name="href" select=" |
---|
270 | if(string-length($selection/URL) != 0)then $selection/URL |
---|
271 | else if(string-length($selection/LOCAL_URL) != 0)then concat($ibis.contextPath, $selection/LOCAL_URL) |
---|
272 | else '' |
---|
273 | "/> |
---|
274 | <xsl:element name="h{$titleLevel}"> |
---|
275 | <xsl:choose> |
---|
276 | <xsl:when test="string-length($href) != 0"> |
---|
277 | <a href="{$href}"> |
---|
278 | <xsl:if test="string-length($selection/DESCRIPTION) != 0"> |
---|
279 | <xsl:attribute name="title" select="normalize-space($selection/DESCRIPTION)"/> |
---|
280 | </xsl:if> |
---|
281 | <xsl:value-of select="$selection/TITLE"/> |
---|
282 | </a> |
---|
283 | </xsl:when> |
---|
284 | <xsl:otherwise> |
---|
285 | <xsl:value-of select="$selection/TITLE"/> |
---|
286 | </xsl:otherwise> |
---|
287 | </xsl:choose> |
---|
288 | |
---|
289 | <xsl:if test="exists($selection/HELP)"> |
---|
290 | <xsl:call-template name="Help.popup"> |
---|
291 | <xsl:with-param name="content" select="$selection/HELP"/> |
---|
292 | </xsl:call-template> |
---|
293 | </xsl:if> |
---|
294 | </xsl:element> |
---|
295 | |
---|
296 | <!-- To hide the DESCRIPTION, use css display: none; --> |
---|
297 | <xsl:if test="0 != string-length($selection/DESCRIPTION)"> |
---|
298 | <xsl:call-template name="Help.popup"> |
---|
299 | <xsl:with-param name="content" select="$selection/DESCRIPTION"/> |
---|
300 | </xsl:call-template> |
---|
301 | </xsl:if> |
---|
302 | </xsl:if> |
---|
303 | |
---|
304 | <xsl:choose> |
---|
305 | <xsl:when test="exists($selection/CONTENT)"> |
---|
306 | <xsl:apply-templates select="$selection/CONTENT/(text() | *)" mode="ibis.copy"/> |
---|
307 | </xsl:when> |
---|
308 | <xsl:otherwise> |
---|
309 | <xsl:call-template name="SelectionsList.processSelections"> |
---|
310 | <xsl:with-param name="selections" select="$selection/SELECTIONS"/> |
---|
311 | <xsl:with-param name="showDescription" select="true()"/> |
---|
312 | <xsl:with-param name="titleLevel" select="$titleLevel + 1"/> |
---|
313 | </xsl:call-template> |
---|
314 | </xsl:otherwise> |
---|
315 | </xsl:choose> |
---|
316 | </div> |
---|
317 | </xsl:if> |
---|
318 | </xsl:template> |
---|
319 | |
---|
320 | |
---|
321 | <!-- callback API templates --> |
---|
322 | <xsl:template name="MenuSelectionsList.additionalPrimaryListItems"/> |
---|
323 | |
---|
324 | <xsl:template name="MenuSelectionsList.panelHeader" ibis:doc="Stubbed out API call allows each Panel to have a header."> |
---|
325 | <xsl:param name="selection"/> |
---|
326 | </xsl:template> |
---|
327 | <xsl:template name="MenuSelectionsList.panelFooter" ibis:doc="Stubbed out API call allows each Panel to have a footer."> |
---|
328 | <xsl:param name="selection"/> |
---|
329 | </xsl:template> |
---|
330 | |
---|
331 | </xsl:stylesheet> |
---|
332 | <!-- ============================= End of File ============================= --> |
---|
333 | |
---|