source: main/trunk/model-interfaces-dev/respooled/transform/pages/pref.xsl@ 29862

Last change on this file since 29862 was 29862, checked in by davidb, 6 years ago

Funk interface for video popup respooled project

  • Property svn:mime-type set to application/xml
File size: 11.4 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:java="http://xml.apache.org/xslt/java"
5 xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
6 xmlns:gslib="http://www.greenstone.org/skinning"
7 extension-element-prefixes="java util"
8 exclude-result-prefixes="java util">
9
10 <!-- use the 'main' layout -->
11 <xsl:include href="layouts/main.xsl"/>
12
13 <!-- set page title -->
14 <xsl:template name="pageTitle"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/></xsl:template>
15
16 <!-- set page breadcrumbs -->
17 <xsl:template name="breadcrumbs">
18 <gslib:siteLink/><gslib:rightArrow/>
19 <xsl:if test="/page/pageResponse/collection">
20 <gslib:collectionNameLinked/><gslib:rightArrow/>
21 </xsl:if>
22 </xsl:template>
23
24 <!-- the page content -->
25 <xsl:template match="/page">
26 <xsl:call-template name="prefs-javascript"/>
27 <xsl:variable name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/>
28
29 <div id="queryform">
30 <form name="PrefForm" method="get" action="{$library_name}" id="prefform">
31
32 <input type='hidden' name='a' value='p'/>
33 <input type='hidden' name='sa' value='pref'/>
34 <input type='hidden' name='c' value="{$collName}"/>
35
36 <p id="SaveInstructions" style="color:red; text-align:center; display:none;"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.set_prefs_help')"/></p>
37 <xsl:call-template name="presentation-prefs"/>
38 <br/>
39
40 <input type='submit' onclick="bypass=true;"><xsl:attribute name="value"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.set_prefs')"/></xsl:attribute></input>
41
42 </form>
43 </div>
44
45 </xsl:template>
46 <xsl:template name="presentation-prefs">
47 <h3 class="formheading"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.prespref')"/></h3>
48 <div id="presprefs">
49 <xsl:call-template name="lang-param"/>
50 <!-- <xsl:call-template name="encoding-param"/>-->
51 <xsl:call-template name="format-edit-param"/>
52 <xsl:call-template name="berry-basket-param"/>
53 <xsl:call-template name="document-maker-param"/>
54 <xsl:call-template name="book-param"/>
55 <xsl:call-template name="theme-change-param"/>
56 </div>
57 </xsl:template>
58
59 <xsl:template name="prefs-javascript">
60 <!--
61 Add some javascript to the page that notices when a preference
62 is changed so that, if the user tries to navigate away from
63 the page without clicking the "Set preferences" button, it
64 gives a stay/leave dialog. -->
65 <script type="text/javascript"><xsl:text disable-output-escaping="yes">
66 var modified = false;
67 var bypass = false;
68
69 function unsavedChanges(e) {
70 if (modified &amp;&amp; !bypass) {
71 document.getElementById("SaveInstructions").style.display="block";
72 return "Provide the prompt";
73 }
74 // no return statement - no dialog will be shown
75 }
76
77 function changed()
78 {
79 modified = true;
80 bypass = false;
81 }
82
83 function pageLoad()
84 {
85 var formElem = document.getElementById("prefform");
86
87 var selectNodes = formElem.getElementsByTagName("select");
88 var inputNodes = formElem.getElementsByTagName("input");
89
90 YAHOO.util.Event.addListener(selectNodes, 'change', changed);
91
92 for(var i = 0; i &lt; inputNodes.length; i++)
93 {
94 current = inputNodes[i];
95 if(current.getAttribute("type") == null)
96 {
97 YAHOO.util.Event.on(current, 'keyup', changed);
98 }
99 }
100 }
101
102 YAHOO.util.Event.addListener(window, 'load', pageLoad);
103 $(window).bind("beforeunload", unsavedChanges);
104 </xsl:text></script>
105 </xsl:template>
106
107
108 <xsl:template name="lang-param">
109 <div class="paramLabel">
110 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.interfacelang')"/>
111 </div>
112 <div class="paramValue">
113 <select name="l">
114 <xsl:for-each select="/page/pageResponse/languageList/language">
115 <option value="{@name}"><xsl:if test="@name=/page/@lang"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:value-of select="displayItem[@name='name']"/></option>
116 </xsl:for-each>
117 </select>
118
119 </div>
120 <br class="clear"/>
121
122</xsl:template>
123
124
125 <xsl:template name="encoding-param">
126 <div class="paramValue">
127 <span class="rightspace"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.encoding')"/></span>
128 </div>
129 <br class="clear"/>
130
131 </xsl:template>
132
133
134 <xsl:template name="format-edit-param">
135 <xsl:if test="/page/pageResponse/collection/serviceList/service[@name='CoverageMetadataRetrieve']">
136 <div id="formateditprefs">
137 <xsl:variable name="formatedit"><xsl:choose><xsl:when test="/page/pageRequest/paramList/param[@name='formatedit']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='formatedit']/@value"/></xsl:when><xsl:otherwise>off</xsl:otherwise></xsl:choose></xsl:variable>
138 <div class="paramLabel">
139 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.formatedit')"/>
140 </div>
141 <div class="paramValue">
142 <select name="formatedit">
143 <option value="on"><xsl:if test="$formatedit='on'"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.formatedit.on')"/></option>
144 <option value="off"><xsl:if test="$formatedit='off'"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.formatedit.off')"/></option>
145 </select>
146 </div>
147 <br class="clear"/>
148 </div>
149 </xsl:if>
150</xsl:template>
151
152<xsl:template name="berry-basket-param">
153 <div id="berrybasketprefs">
154 <xsl:variable name="berrybasket"><xsl:choose><xsl:when test="/page/pageRequest/paramList/param[@name='berrybasket']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='berrybasket']/@value"/></xsl:when><xsl:otherwise>off</xsl:otherwise></xsl:choose></xsl:variable>
155 <div class="paramLabel">
156 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.berrybasket')"/>
157 </div>
158 <div class="paramValue">
159 <select name="berrybasket">
160 <option value="on"><xsl:if test="$berrybasket='on'"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.berrybasket.on')"/></option>
161 <option value="off"><xsl:if test="$berrybasket='off'"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.berrybasket.off')"/></option>
162 </select>
163 </div>
164 <br class="clear"/>
165 </div>
166</xsl:template>
167 <xsl:template name="document-maker-param">
168 <xsl:if test="/page/pageRequest/userInformation and (util:contains(/page/pageRequest/userInformation/@groups, 'administrator') or util:contains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:contains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor))">
169 <div id="documentmakerprefs">
170 <xsl:variable name="documentbasket"><xsl:choose><xsl:when test="/page/pageRequest/paramList/param[@name='documentbasket']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='documentbasket']/@value"/></xsl:when><xsl:otherwise>off</xsl:otherwise></xsl:choose></xsl:variable>
171 <div class="paramLabel">Document basket</div>
172 <div class="paramValue">
173 <select name="documentbasket">
174 <option value="on"><xsl:if test="$documentbasket='on'"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.berrybasket.on')"/></option>
175 <option value="off"><xsl:if test="$documentbasket='off'"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.berrybasket.off')"/></option>
176 </select>
177 </div>
178 <br class="clear"/>
179 </div>
180 </xsl:if>
181 </xsl:template>
182 <xsl:template name="book-param">
183 <!-- tidy (?) -->
184 <xsl:variable name="tidyoption"><xsl:value-of select="/page/pageResponse/collection/metadataList/metadata[@name='tidyoption']"/></xsl:variable>
185 <xsl:if test="$tidyoption='tidy'">
186 <xsl:variable name="book">
187 <xsl:choose>
188 <xsl:when test="/page/pageRequest/paramList/param[@name='book']">
189 <xsl:value-of select="/page/pageRequest/paramList/param[@name='book']/@value"/>
190 </xsl:when>
191 <xsl:when test="/page/pageRequest/paramList/param[@name='s1.book']">
192 <xsl:value-of select="/page/pageRequest/paramList/param[@name='s1.book']/@value"/>
193 </xsl:when>
194 <xsl:otherwise>off</xsl:otherwise>
195 </xsl:choose>
196 </xsl:variable>
197 <div class="paramLabel">
198 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.book')"/>
199 </div>
200 <div class="paramValue">
201 <select name="s1.book">
202 <option value="on"><xsl:if test="$book='on'"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.berrybasket.on')"/></option>
203 <option value="off"><xsl:if test="$book='off'"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.berrybasket.off')"/></option>
204 </select>
205 </div>
206 <br class="clear"/>
207 </xsl:if>
208 </xsl:template>
209 <xsl:template name="theme-change-param">
210 <!-- Theme Changer -->
211 <xsl:if test="/page/pageRequest/userInformation and util:contains(/page/pageRequest/userInformation/@groups, 'administrator')">
212 <div>
213 <div class="paramLabel"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.theme')"/></div>
214 <script type="text/javascript">
215 <xsl:text disable-output-escaping="yes">
216 $(document).ready(function(){
217 $("#switcher").themeswitcher({
218 imgpath: "interfaces/" + gs.xsltParams.interface_name + "/style/images/",
219 additionalThemes: [
220 {title:"Greenstone Default", name:"custom-theme0", icon:"theme_90_greenstone.png", url:"interfaces/" + gs.xsltParams.interface_name + "/style/themes/main/jquery-ui-1.8.16.custom.css"},
221 {title:"Greenstone Custom 1", name:"custom-theme1", icon:"theme_90_start_menu.png", url:"interfaces/" + gs.xsltParams.interface_name + "/style/themes/alt_theme_1/jquery-ui-1.8.16.custom.css"},
222 {title:"Greenstone Custom 2", name:"custom-theme2", icon:"theme_90_mint_choco.png", url:"interfaces/" + gs.xsltParams.interface_name + "/style/themes/alt_theme_2/jquery-ui-1.8.16.custom.css"},
223 {title:"Greenstone Custom 3", name:"custom-theme3", icon:"theme_90_trontastic.png", url:"interfaces/" + gs.xsltParams.interface_name + "/style/themes/alt_theme_3/jquery-ui-1.8.16.custom.css"},
224 {title:"Respooled", name:"respooled", icon:"theme_90_respooled.png", url:"interfaces/" + gs.xsltParams.interface_name + "/style/themes/respooled/jquery-ui.css"}
225 ]
226 });
227 });
228 </xsl:text>
229 </script>
230 <div class="paramValue" id="switcher"><xsl:text> </xsl:text></div>
231 </div>
232 <br class="clear"/>
233 </xsl:if>
234</xsl:template>
235
236</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.