root/trunk/bedework/deployment/webconfig/webapp/resources/default/default/default.xsl

Revision 952 (checked in by douglm, 7 years ago)

--

Line 
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3   <!-- ==================================================================== -->
4   <!-- ==================================================================== -->
5   <!--                           BEDEWORK LUWAK                             -->
6   <!-- ==================================================================== -->
7   <!-- ==================================================================== -->
8   <xsl:output method="xhtml" indent="yes" media-type="text/html" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" standalone="yes" omit-xml-declaration="yes"/>
9   <xsl:variable name="appRoot" select="/bedeworkconfig/appRoot"/>
10   <xsl:variable name="urlPrefix" select="/bedeworkconfig/urlPrefix"/>
11
12   <xsl:variable name="firstView">welcome</xsl:variable>
13   <xsl:variable name="lastView" select="/bedeworkconfig/propertyGroups/form/propertyGroup[position()=last()]/@name"/>
14   <xsl:variable name="currentView">
15     <xsl:choose>
16       <xsl:when test="/bedeworkconfig/appvar/key='setView'"><xsl:value-of select="/bedeworkconfig/appvar[key='setView']/value"/></xsl:when>
17       <xsl:otherwise><xsl:value-of select="$firstView"/></xsl:otherwise>
18     </xsl:choose>
19   </xsl:variable>
20   <xsl:variable name="currentViewPos">
21     <xsl:choose>
22       <xsl:when test="$currentView = $firstView">0</xsl:when>
23       <xsl:otherwise><xsl:for-each select="/bedeworkconfig/propertyGroups/form/propertyGroup[@name=$currentView]"><xsl:number/></xsl:for-each></xsl:otherwise>
24     </xsl:choose>
25   </xsl:variable>
26   <xsl:variable name="prevView">
27     <xsl:choose>
28       <xsl:when test="$currentView = $firstView">$currentView</xsl:when>
29       <xsl:otherwise><xsl:value-of select="/bedeworkconfig/propertyGroups/form/propertyGroup[position()=number($currentViewPos)-1]/@name"/></xsl:otherwise>
30     </xsl:choose>
31   </xsl:variable>
32   <xsl:variable name="nextView">
33     <xsl:choose>
34       <xsl:when test="$currentView = $lastView">$currentView</xsl:when>
35       <xsl:otherwise><xsl:value-of select="/bedeworkconfig/propertyGroups/form/propertyGroup[position()=number($currentViewPos)+1]/@name"/></xsl:otherwise>
36     </xsl:choose>
37   </xsl:variable>
38
39
40   <xsl:template match="/">
41     <html lang="en">
42       <head>
43         <title>Bedework: open-source institutional events calendar - <xsl:value-of select="$currentView"/></title>
44         <link rel="stylesheet" type="text/css" media="screen,all" href="{$appRoot}/default/default/bedeworkConfig.css"/>
45         <script language="JavaScript" type="text/javascript">
46           <![CDATA[
47             function setPrevView() {
48               if (window.document.propsForm.setappvar.options.selectedIndex != 0) {
49                 window.document.propsForm.setappvar.options.selectedIndex -= 1;
50                 window.document.propsForm.submit();
51               }
52             }
53             function setNextView() {
54               if (window.document.propsForm.setappvar.options.selectedIndex != window.document.propsForm.setappvar.options.length-1) {
55                 window.document.propsForm.setappvar.options.selectedIndex += 1;
56                 window.document.propsForm.submit();
57               }
58             }
59             function showHelp(id) {
60               helpField = document.getElementById(id);
61               helpField.className="helpText";
62             }
63             function hideHelp(id) {
64               helpField = document.getElementById(id);
65               helpField.className="hidden";
66             }
67           ]]>
68         </script>
69       </head>
70       <body>
71         <div id="bodyBlock">
72           <div id="header">
73             <h2 id="title">
74               <a href="setup.do"><img src="{$appRoot}/images/bedework.gif" alt="Bedework Calendar" border="0"/></a>
75             </h2>
76             <div id="configLabel">
77               BedeFig: Bedework Calendar Properties Config
78             </div>
79           </div>
80           <xsl:if test="/bedeworkconfig/message">
81             <div id="messages">
82               <xsl:apply-templates select="/bedeworkconfig/message"/>
83             </div>
84           </xsl:if>
85           <xsl:if test="/bedeworkconfig/error">
86             <div id="errors">
87               <xsl:apply-templates select="/bedeworkconfig/error"/>
88             </div>
89           </xsl:if>
90           <div id="content">
91             <xsl:choose>
92               <xsl:when test="/bedeworkconfig/page='main'">
93                 <form action="save.do" method="POST" enctype="multipart/form-data" name="propsForm">
94                   <div id="buttonMenuTop">
95                     <xsl:choose>
96                       <xsl:when test="$currentView = $firstView">
97                         <div id="buttonMenuPrev">&lt; prev</div>
98                       </xsl:when>
99                       <xsl:otherwise>
100                         <div id="buttonMenuPrev">&lt; <a href="javascript:setPrevView()">prev</a></div>
101                       </xsl:otherwise>
102                     </xsl:choose>
103                     <xsl:choose>
104                       <xsl:when test="$currentView = $lastView">
105                         <div id="buttonMenuNext">next &gt;</div>
106                       </xsl:when>
107                       <xsl:otherwise>
108                         <div id="buttonMenuNext"><a href="javascript:setNextView()">next</a> &gt;</div>
109                       </xsl:otherwise>
110                     </xsl:choose>
111                   </div>
112
113                   <ul id="buttonMenu">
114                     <li><input type="submit" name="validate" value="validate"/></li>
115                     <li><input type="submit" name="save" value="save"/></li>
116                   </ul>
117
118                   <select name="setappvar" onchange="submit()">
119                     <option value="setView(welcome)">welcome</option>
120                     <xsl:for-each select="/bedeworkconfig/propertyGroups/form/propertyGroup">
121                       <xsl:variable name="groupName" select="@name"/>
122                       <xsl:choose>
123                         <xsl:when test="$currentView = $groupName">
124                           <option name="{$groupName}" value="setView({$groupName})" selected="selected">
125                             <xsl:value-of select="$groupName"/>
126                           </option>
127                         </xsl:when>
128                         <xsl:otherwise>
129                           <option name="{$groupName}" value="setView({$groupName})">
130                             <xsl:value-of select="$groupName"/>
131                           </option>
132                         </xsl:otherwise>
133                       </xsl:choose>
134                     </xsl:for-each>
135                   </select>
136
137                   advanced:
138                   <xsl:choose>
139                     <xsl:when test="/bedeworkconfig/propertyGroups/form/propertyGroup[@name='modules']/property[@name='advanced']/fieldValue='true'">
140                       <input type="radio" name="modules.advanced" value="true" checked="checked" onclick="submit()"/> yes
141                       <input type="radio" name="modules.advanced" value="false" onclick="submit()"/> no
142                     </xsl:when>
143                     <xsl:otherwise>
144                       <input type="radio" name="modules.advanced" value="true" onclick="submit()"/> yes
145                       <input type="radio" name="modules.advanced" value="false" checked="checked" onclick="submit()"/> no
146                     </xsl:otherwise>
147                   </xsl:choose>
148
149     <!-- ======================================================================= -->
150     <!-- ========================== GENERATE CONTENT =========================== -->
151     <!-- ======================================================================= -->
152
153                   <xsl:choose>
154                     <xsl:when test="$currentView = 'welcome'">
155                       <div id="welcome">
156                         <h1>BedeFig: Configure Bedework Properties</h1>
157                         <p>
158                           Welcome to the Bedework property configuration tool.  This
159                           application allows you to review, modify, validate, and
160                           save the properties used for building a Bedework
161                           Calendar production-ready application.
162                         </p>
163                         <p>
164                           Options are grouped into pages.  You can select any section
165                           at any time by using the pull-down menu above, or you may
166                           move from page to page by clicking the "next" button to the upper right.
167                         </p>
168                         <p>
169                           When you have finished reviewing and modifying properties,
170                           press "validate" to check your settings, and "save" to download
171                           a properly-configured properties file which you can use to build
172                           a production-ready version of the Bedework Calendar application.
173                         </p>
174                       </div>
175                     </xsl:when>
176                     <xsl:otherwise>
177                       <xsl:apply-templates select="/bedeworkconfig/propertyGroups/form/propertyGroup[@name=$currentView]"/>
178                     </xsl:otherwise>
179                   </xsl:choose>
180
181
182     <!-- ======================================================================= -->
183     <!-- ======================================================================= -->
184     <!-- ======================================================================= -->
185                 </form>
186               </xsl:when>
187               <xsl:when test="/bedeworkconfig/page='save'">
188                 <form action="save.do" method="POST" enctype="multipart/form-data" name="downloadForm">
189                   <input type="hidden" name="contentType" value="text/text"/>
190                   <input type="hidden" name="contentName" value="myBedework.properties"/>
191                   <input type="hidden" name="skinName" value="outputText"/>
192                   <input type="hidden" name="refreshXslt" value="yes"/>
193                   <ul id="buttonMenu">
194                     <li><input type="submit" name="save" value="download file"/></li>
195                     <li><a href="setup.do">return</a></li>
196                   </ul>
197                 </form>
198                 <h1>Your Configured Properties File:</h1>
199                 <div id="propFile">
200                   <xsl:for-each select="/bedeworkconfig/propertyGroups/propertyGroup">
201                     #<br/>
202                     # <xsl:value-of select="@name"/><br/>
203                     #<br/>
204                     <xsl:for-each select="property">
205                       <xsl:value-of select="@name"/>=<xsl:value-of select="."/><br/>
206                     </xsl:for-each>
207                     <br/>
208                   </xsl:for-each>
209                 </div>
210               </xsl:when>
211             </xsl:choose>
212           </div>
213           <div id="footer">
214             <p>
215               some footer text
216
217             </p>
218             <ul class="menu" id="footMenu">
219               <li class="first">first item</li>
220               <li>second</li>
221               <li>third</li>
222             </ul>
223           </div>
224           <div id="subFoot">&#160;</div>
225         </div>
226       </body>
227     </html>
228   </xsl:template>
229
230   <xsl:template match="propertyGroup">
231     <xsl:variable name="groupName" select="@name"/>
232     <xsl:apply-templates select="@name" mode="groupHeading"/>
233     <table id="{$groupName}">
234       <xsl:apply-templates select="property[fieldName!='modules.advanced']"/>
235     </table>
236   </xsl:template>
237
238   <xsl:template match="property">
239     <xsl:variable name="propertyName" select="@name"/>
240     <xsl:variable name="fieldName" select="fieldName"/>
241     <xsl:variable name="fieldValue" select="fieldValue"/>
242     <tr id="{$propertyName}">
243       <td><xsl:apply-templates select="fieldName" mode="label"/></td>
244       <td>
245         <xsl:choose>
246           <xsl:when test="@type='0'"><!-- text input (string) -->
247             <input type="text" name="{$fieldName}" size="50" value="{$fieldValue}" class="string"/>
248           </xsl:when>
249           <xsl:when test="@type='1'"><!-- text input (int) -->
250             <input type="text" name="{$fieldName}" size="40" value="{$fieldValue}" class="int"/>
251           </xsl:when>
252           <xsl:when test="@type='2'"><!-- intended as checkbox (boolean)
253             but we're going to implement as radio buttons so we can always
254             send an explicit value -->
255             <xsl:choose>
256               <xsl:when test="fieldValue='true'">
257                 <xsl:choose>
258                   <xsl:when test="contains($fieldName,'modules.')">
259                     <input type="radio" name="{$fieldName}" value="true" checked="checked" onclick="submit()"/> yes
260                     <input type="radio" name="{$fieldName}" value="false" onclick="submit()"/> no
261                   </xsl:when>
262                   <xsl:otherwise>
263                     <input type="radio" name="{$fieldName}" value="true" checked="checked"/> yes
264                     <input type="radio" name="{$fieldName}" value="false"/> no
265                   </xsl:otherwise>
266                 </xsl:choose>
267               </xsl:when>
268               <xsl:otherwise>
269                 <xsl:choose>
270                   <xsl:when test="contains($fieldName,'modules.')">
271                     <input type="radio" name="{$fieldName}" value="true" onclick="submit()"/> yes
272                     <input type="radio" name="{$fieldName}" value="false" checked="checked" onclick="submit()"/> no
273                   </xsl:when>
274                   <xsl:otherwise>
275                     <input type="radio" name="{$fieldName}" value="true"/> yes
276                     <input type="radio" name="{$fieldName}" value="false" checked="checked"/> no
277                   </xsl:otherwise>
278                 </xsl:choose>
279               </xsl:otherwise>
280             </xsl:choose>
281           </xsl:when>
282           <xsl:when test="@type='3'"><!-- radio input (choice) -->
283             not supported yet (in the xsl)
284           </xsl:when>
285           <xsl:when test="@type='4'"><!-- multi input (checkbox of same name or multi-select box) -->
286             not supported yet (in the xsl)
287           </xsl:when>
288         </xsl:choose>
289         <xsl:apply-templates select="fieldName" mode="help"/>
290       </td>
291     </tr>
292   </xsl:template>
293
294   <xsl:template match="@name" mode="groupHeading">
295     <xsl:choose>
296       <xsl:when test=".='modules'">
297         <h1>Select Modules</h1>
298         <p>Select the Bedework modules you wish to build:</p>
299       </xsl:when>
300       <xsl:when test=".='globals'">
301         <h1>Global Settings</h1>
302       </xsl:when>
303       <xsl:when test=".='Webadmin'">
304         <h1>Administration Web Client Settings</h1>
305       </xsl:when>
306       <xsl:when test=".='webpublic'">
307         <h1>Public Web Client Settings</h1>
308       </xsl:when>
309       <xsl:when test=".='webpersonal'">
310         <h1>Personal Web Client Settings</h1>
311       </xsl:when>
312       <xsl:when test=".='calDAV-public'">
313         <h1>Public CalDAV Server Settings</h1>
314       </xsl:when>
315       <xsl:when test=".='calDAV-personal'">
316         <h1>Personal CalDAV Server Settings</h1>
317       </xsl:when>
318     </xsl:choose>
319   </xsl:template>
320
321   <xsl:template match="fieldName" mode="label">
322     <xsl:choose>
323       <xsl:when test=".='modules.adminwebclient'">
324         Public events administration web client
325       </xsl:when>
326       <xsl:when test=".='modules.publicwebclient'">
327         Public events web client
328       </xsl:when>
329       <xsl:when test=".='modules.personalwebclient'">
330         Personal events web client
331       </xsl:when>
332       <xsl:when test=".='modules.publiccaldav'">
333         Public events CalDAV server
334       </xsl:when>
335       <xsl:when test=".='modules.personalcaldav'">
336         Personal events CalDAV server
337       </xsl:when>
338       <xsl:when test=".='modules.advanced'">
339         Use advanced interface
340       </xsl:when>
341       <xsl:otherwise>
342         <xsl:value-of select="."/>
343       </xsl:otherwise>
344     </xsl:choose>
345   </xsl:template>
346
347   <xsl:template match="fieldName" mode="help">
348     <xsl:variable name="fieldId">help<xsl:value-of select="translate(.,'.','')"/></xsl:variable>
349     <span class="help">
350     <xsl:choose>
351       <xsl:when test=".='modules.adminwebclient'">
352         <a href="" onmouseover="showHelp('{$fieldId}')" onmouseout="hideHelp('{$fieldId}')">?</a>
353         <div id="{$fieldId}" class="hidden">
354           help for Public events administration web client
355         </div>
356       </xsl:when>
357       <xsl:when test=".='modules.publicwebclient'">
358         <a href="" onmouseover="showHelp('{$fieldId}')" onmouseout="hideHelp('{$fieldId}')">?</a>
359         <div id="{$fieldId}" class="hidden">
360           help for Public events web client
361         </div>
362       </xsl:when>
363       <xsl:when test=".='modules.personalwebclient'">
364         <a href="" onmouseover="showHelp('{$fieldId}')" onmouseout="hideHelp('{$fieldId}')">?</a>
365         <div id="{$fieldId}" class="hidden">
366           help for Personal events web client
367         </div>
368       </xsl:when>
369       <xsl:when test=".='modules.publiccaldav'">
370         <a href="" onmouseover="showHelp('{$fieldId}')" onmouseout="hideHelp('{$fieldId}')">?</a>
371         <div id="{$fieldId}" class="hidden">
372           help for Public events CalDAV server
373         </div>
374       </xsl:when>
375       <xsl:when test=".='modules.personalcaldav'">
376         <a href="" onmouseover="showHelp('{$fieldId}')" onmouseout="hideHelp('{$fieldId}')">?</a>
377         <div id="{$fieldId}" class="hidden">
378           help for Personal events CalDAV server
379         </div>
380       </xsl:when>
381       <xsl:when test=".='modules.advanced'">
382         <a href="" onmouseover="showHelp('{$fieldId}')" onmouseout="hideHelp('{$fieldId}')">?</a>
383         <div id="{$fieldId}" class="hidden">
384           help for Use advanced interface
385         </div>
386       </xsl:when>
387     </xsl:choose>
388     </span>
389   </xsl:template>
390
391   <xsl:template match="message">
392     <xsl:choose>
393       <xsl:when test="id = 'org.bedework.config.error.missingvalue'">
394         <p>placeholder.</p>
395       </xsl:when>
396       <xsl:otherwise>
397         <xsl:value-of select="id"/>
398         <xsl:if test="param"> =
399           <xsl:for-each select="param">
400             <xsl:value-of select="."/>
401           </xsl:for-each>
402         </xsl:if>
403       </xsl:otherwise>
404     </xsl:choose>
405   </xsl:template>
406
407   <xsl:template match="error">
408     <xsl:choose>
409       <xsl:when test="id = 'org.bedework.config.error.missingvalue'">
410         <p>A value is missing.  See the field
411         (<xsl:for-each select="param">
412             <xsl:value-of select="."/>
413           </xsl:for-each>)
414         highlighted below.</p>
415       </xsl:when>
416       <xsl:otherwise>
417         <xsl:value-of select="id"/>
418         <xsl:if test="param"> =
419           <xsl:for-each select="param">
420             <xsl:value-of select="."/>
421           </xsl:for-each>
422         </xsl:if>
423       </xsl:otherwise>
424     </xsl:choose>
425   </xsl:template>
426 </xsl:stylesheet>
427
428
429
430
Note: See TracBrowser for help on using the browser.