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

Revision 1687 (checked in by douglm, 5 years ago)

Use metatdata to define module configuration.

More corrections to config application.

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 CONFIGURATION WEB APP                    -->
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="resourcesRoot" select="/bedework/appRoot"/>
10   <xsl:variable name="urlPrefix" select="/bedework/urlPrefix"/>
11
12   <xsl:template match="/">
13     <html lang="en">
14       <head>
15         <title>Bedework Calendar Configuration Builder</title>
16         <link rel="stylesheet" type="text/css" media="screen,all" href="{$resourcesRoot}/default/default/bedeworkConfig.css"/>
17         <link rel="icon" type="image/ico" href="{$resourcesRoot}/resources/bedework.ico" />
18         <script language="JavaScript" type="text/javascript">
19           <![CDATA[
20             function setPrevView() {
21               if (window.document.propsForm.setappvar.options.selectedIndex != 0) {
22                 window.document.propsForm.setappvar.options.selectedIndex -= 1;
23                 window.document.propsForm.submit();
24               }
25             }
26             function setNextView() {
27               if (window.document.propsForm.setappvar.options.selectedIndex != window.document.propsForm.setappvar.options.length-1) {
28                 window.document.propsForm.setappvar.options.selectedIndex += 1;
29                 window.document.propsForm.submit();
30               }
31             }
32             function showHelp(id) {
33               helpField = document.getElementById(id);
34               helpField.className="helpText";
35             }
36             function hideHelp(id) {
37               helpField = document.getElementById(id);
38               helpField.className="hidden";
39             }
40           ]]>
41         </script>
42       </head>
43       <body class="tundra">
44         <div id="bodyBlock">
45           <div id="header">
46             <h2 id="title">
47               <a href="/bedework"><img src="{$resourcesRoot}/images/bedework.gif" alt="Bedework Calendar" border="0"/></a>
48             </h2>
49             <div id="configLabel">
50               Bedework Calendar Configuration Builder
51             </div>
52           </div>
53           <xsl:if test="/bedework/message">
54             <div id="messages">
55               <xsl:apply-templates select="/bedework/message"/>
56             </div>
57           </xsl:if>
58           <xsl:if test="/bedework/error">
59             <div id="errors">
60               <xsl:apply-templates select="/bedework/error"/>
61             </div>
62           </xsl:if>
63           <div id="content">
64
65             <xsl:choose>
66               <xsl:when test="/bedework/page='main'">
67                 <xsl:call-template name="main"/>
68               </xsl:when>
69               <xsl:when test="/bedework/page='save'">
70                 <xsl:call-template name='save'/>
71               </xsl:when>
72               <xsl:otherwise>
73                 <xsl:apply-templates select="/bedework/propertyGroups/form/propertyGroup"/>
74               </xsl:otherwise>
75             </xsl:choose>
76
77           </div>
78           <div id="footer">
79             <p>
80               some footer text
81             </p>
82             <ul class="menu" id="footMenu">
83               <li class="first"><a href="/bedework">Bedework Quickstart Jump Page</a></li>
84               <li><a href="?noxslt=yes">Show XML</a></li>
85               <li><a href="?refreshXslt=yes">Refresh XSLT</a></li>
86             </ul>
87           </div>
88           <div id="subFoot">&#160;</div>
89         </div>
90       </body>
91     </html>
92   </xsl:template>
93
94   <xsl:template name="main">
95     <h1>BedeFig: Configure Bedework Properties</h1>
96     <p>
97       Welcome to the Bedework property configuration tool.  This
98       application allows you to review, modify, validate, and
99       save the properties used for building a Bedework
100       Calendar production-ready application.
101     </p>
102     <p>
103       Options are grouped into pages.  You can select any section
104       at any time by using the pull-down menu above, or you may
105       move from page to page by clicking the "next" button to the upper right.
106     </p>
107     <p>
108       When you have finished reviewing and modifying properties,
109       press "validate" to check your settings, and "save" to download
110       a properly-configured properties file which you can use to build
111       a production-ready version of the Bedework Calendar application.
112     </p>
113   </xsl:template>
114
115   <xsl:template name="save">
116     <form action="save.do" method="POST" enctype="multipart/form-data" name="downloadForm">
117       <input type="hidden" name="contentType" value="text/text"/>
118       <input type="hidden" name="contentName" value="myBedework.properties"/>
119       <input type="hidden" name="skinName" value="outputText"/>
120       <input type="hidden" name="refreshXslt" value="yes"/>
121       <ul id="buttonMenu">
122         <li><input type="submit" name="save" value="download file"/></li>
123         <li><a href="setup.do">return</a></li>
124       </ul>
125     </form>
126     <h1>Your Configured Properties File:</h1>
127     <div id="propFile">
128       <xsl:for-each select="/bedework/propertyGroups/propertyGroup">
129         #<br/>
130         # <xsl:value-of select="@name"/><br/>
131         #<br/>
132         <xsl:for-each select="property">
133           <xsl:value-of select="@name"/>=<xsl:value-of select="."/><br/>
134         </xsl:for-each>
135         <br/>
136       </xsl:for-each>
137     </div>
138   </xsl:template>
139
140   <xsl:template match="propertyGroup">
141     <xsl:variable name="groupName" select="@name"/>
142     <xsl:apply-templates select="@name" mode="groupHeading"/>
143     <table id="{$groupName}">
144       <xsl:apply-templates select="property[fieldName!='modules.advanced']"/>
145     </table>
146   </xsl:template>
147
148   <xsl:template match="property">
149     <xsl:variable name="propertyName" select="@name"/>
150     <xsl:variable name="fieldName" select="fieldName"/>
151     <xsl:variable name="fieldValue" select="fieldValue"/>
152     <tr id="{$propertyName}">
153       <td><xsl:apply-templates select="fieldName" mode="label"/></td>
154       <td>
155         <xsl:choose>
156           <xsl:when test="@type='0'"><!-- text input (string) -->
157             <input type="text" name="{$fieldName}" size="50" value="{$fieldValue}" class="string"/>
158           </xsl:when>
159           <xsl:when test="@type='1'"><!-- text input (int) -->
160             <input type="text" name="{$fieldName}" size="40" value="{$fieldValue}" class="int"/>
161           </xsl:when>
162           <xsl:when test="@type='2'"><!-- intended as checkbox (boolean)
163             but we're going to implement as radio buttons so we can always
164             send an explicit value -->
165             <xsl:choose>
166               <xsl:when test="fieldValue='true'">
167                 <xsl:choose>
168                   <xsl:when test="contains($fieldName,'modules.')">
169                     <input type="radio" name="{$fieldName}" value="true" checked="checked" onclick="submit()"/> yes
170                     <input type="radio" name="{$fieldName}" value="false" onclick="submit()"/> no
171                   </xsl:when>
172                   <xsl:otherwise>
173                     <input type="radio" name="{$fieldName}" value="true" checked="checked"/> yes
174                     <input type="radio" name="{$fieldName}" value="false"/> no
175                   </xsl:otherwise>
176                 </xsl:choose>
177               </xsl:when>
178               <xsl:otherwise>
179                 <xsl:choose>
180                   <xsl:when test="contains($fieldName,'modules.')">
181                     <input type="radio" name="{$fieldName}" value="true" onclick="submit()"/> yes
182                     <input type="radio" name="{$fieldName}" value="false" checked="checked" onclick="submit()"/> no
183                   </xsl:when>
184                   <xsl:otherwise>
185                     <input type="radio" name="{$fieldName}" value="true"/> yes
186                     <input type="radio" name="{$fieldName}" value="false" checked="checked"/> no
187                   </xsl:otherwise>
188                 </xsl:choose>
189               </xsl:otherwise>
190             </xsl:choose>
191           </xsl:when>
192           <xsl:when test="@type='3'"><!-- radio input (choice) -->
193             not supported yet (in the xsl)
194           </xsl:when>
195           <xsl:when test="@type='4'"><!-- multi input (checkbox of same name or multi-select box) -->
196             not supported yet (in the xsl)
197           </xsl:when>
198         </xsl:choose>
199         <xsl:apply-templates select="fieldName" mode="help"/>
200       </td>
201     </tr>
202   </xsl:template>
203
204   <xsl:template match="@name" mode="groupHeading">
205     <xsl:choose>
206       <xsl:when test=".='modules'">
207         <h1>Select Modules</h1>
208         <p>Select the Bedework modules you wish to build:</p>
209       </xsl:when>
210       <xsl:when test=".='globals'">
211         <h1>Global Settings</h1>
212       </xsl:when>
213       <xsl:when test=".='Webadmin'">
214         <h1>Administration Web Client Settings</h1>
215       </xsl:when>
216       <xsl:when test=".='webpublic'">
217         <h1>Public Web Client Settings</h1>
218       </xsl:when>
219       <xsl:when test=".='webpersonal'">
220         <h1>Personal Web Client Settings</h1>
221       </xsl:when>
222       <xsl:when test=".='calDAV-public'">
223         <h1>Public CalDAV Server Settings</h1>
224       </xsl:when>
225       <xsl:when test=".='calDAV-personal'">
226         <h1>Personal CalDAV Server Settings</h1>
227       </xsl:when>
228     </xsl:choose>
229   </xsl:template>
230
231   <xsl:template match="fieldName" mode="label">
232     <xsl:choose>
233       <xsl:when test=".='modules.adminwebclient'">
234         Public events administration web client
235       </xsl:when>
236       <xsl:when test=".='modules.publicwebclient'">
237         Public events web client
238       </xsl:when>
239       <xsl:when test=".='modules.personalwebclient'">
240         Personal events web client
241       </xsl:when>
242       <xsl:when test=".='modules.publiccaldav'">
243         Public events CalDAV server
244       </xsl:when>
245       <xsl:when test=".='modules.personalcaldav'">
246         Personal events CalDAV server
247       </xsl:when>
248       <xsl:when test=".='modules.advanced'">
249         Use advanced interface
250       </xsl:when>
251       <xsl:otherwise>
252         <xsl:value-of select="."/>
253       </xsl:otherwise>
254     </xsl:choose>
255   </xsl:template>
256
257   <xsl:template match="fieldName" mode="help">
258     <xsl:variable name="fieldId">help<xsl:value-of select="translate(.,'.','')"/></xsl:variable>
259     <span class="help">
260     <xsl:choose>
261       <xsl:when test=".='modules.adminwebclient'">
262         <a href="" onmouseover="showHelp('{$fieldId}')" onmouseout="hideHelp('{$fieldId}')">?</a>
263         <div id="{$fieldId}" class="hidden">
264           help for Public events administration web client
265         </div>
266       </xsl:when>
267       <xsl:when test=".='modules.publicwebclient'">
268         <a href="" onmouseover="showHelp('{$fieldId}')" onmouseout="hideHelp('{$fieldId}')">?</a>
269         <div id="{$fieldId}" class="hidden">
270           help for Public events web client
271         </div>
272       </xsl:when>
273       <xsl:when test=".='modules.personalwebclient'">
274         <a href="" onmouseover="showHelp('{$fieldId}')" onmouseout="hideHelp('{$fieldId}')">?</a>
275         <div id="{$fieldId}" class="hidden">
276           help for Personal events web client
277         </div>
278       </xsl:when>
279       <xsl:when test=".='modules.publiccaldav'">
280         <a href="" onmouseover="showHelp('{$fieldId}')" onmouseout="hideHelp('{$fieldId}')">?</a>
281         <div id="{$fieldId}" class="hidden">
282           help for Public events CalDAV server
283         </div>
284       </xsl:when>
285       <xsl:when test=".='modules.personalcaldav'">
286         <a href="" onmouseover="showHelp('{$fieldId}')" onmouseout="hideHelp('{$fieldId}')">?</a>
287         <div id="{$fieldId}" class="hidden">
288           help for Personal events CalDAV server
289         </div>
290       </xsl:when>
291       <xsl:when test=".='modules.advanced'">
292         <a href="" onmouseover="showHelp('{$fieldId}')" onmouseout="hideHelp('{$fieldId}')">?</a>
293         <div id="{$fieldId}" class="hidden">
294           help for Use advanced interface
295         </div>
296       </xsl:when>
297     </xsl:choose>
298     </span>
299   </xsl:template>
300
301   <xsl:template match="message">
302     <xsl:choose>
303       <xsl:when test="id = 'org.bedework.config.error.missingvalue'">
304         <p>placeholder.</p>
305       </xsl:when>
306       <xsl:otherwise>
307         <xsl:value-of select="id"/>
308         <xsl:if test="param"> =
309           <xsl:for-each select="param">
310             <xsl:value-of select="."/>
311           </xsl:for-each>
312         </xsl:if>
313       </xsl:otherwise>
314     </xsl:choose>
315   </xsl:template>
316
317   <xsl:template match="error">
318     <xsl:choose>
319       <xsl:when test="id = 'org.bedework.config.error.missingvalue'">
320         <p>Property<xsl:text> </xsl:text>
321         (<xsl:for-each select="param">
322             <xsl:value-of select="."/><xsl:text> </xsl:text>
323           </xsl:for-each>)
324         is missing.</p>
325       </xsl:when>
326       <xsl:otherwise>
327         <p><xsl:value-of select="id"/>
328         <xsl:if test="param"><xsl:text>: </xsl:text>
329           <xsl:for-each select="param">
330             <xsl:value-of select="."/><xsl:text> </xsl:text>
331           </xsl:for-each>
332         </xsl:if></p>
333       </xsl:otherwise>
334     </xsl:choose>
335   </xsl:template>
336 </xsl:stylesheet>
337
338
339
340
Note: See TracBrowser for help on using the browser.