source: main/trunk/model-sites-dev/von-sparql/transform/layouts/header.xsl@ 28688

Last change on this file since 28688 was 28688, checked in by davidb, 10 years ago

Example visualization added to home page of this site

  • Property svn:executable set to *
File size: 9.5 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
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 xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
8 extension-element-prefixes="java util"
9 exclude-result-prefixes="java util gsf">
10
11 <xsl:template name="goto-sparql-button">
12
13 <!-- sparql -->
14 <li>
15 <a href="{$library_name}/collection/{$collNameChecked}/page/sparql">
16 <xsl:attribute name="title">Sparql Interface page</xsl:attribute>
17 <span id="sparqlButton">Sparql</span>
18 <script type="text/javascript">
19 <xsl:text disable-output-escaping="yes">
20 $("#sparqlButton").button();
21 $("#sparqlButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});
22 </xsl:text>
23 </script>
24 </a>
25 </li>
26
27 </xsl:template>
28
29 <!-- ***** HOME HELP PREFERENCES LOGIN ***** -->
30 <xsl:template name="home-help-preferences">
31 <ul id="bannerLinks">
32
33 <!-- RSS feed link can appear in a global format statement (where it has no type attribute)
34 or in section specific format statements, such as browse, search, display.
35 If it's present in any format statement, display the RSS link in the bannerlinks section. -->
36 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search' or not(@type)]/gsf:option[@name='RSS']/@value = 'true'">
37 <li><gsf:link type="rss"><gsf:icon file="rssicon.png"/></gsf:link></li>
38 </xsl:if>
39
40 <!-- preferences -->
41 <li>
42 <a href="{$library_name}/collection/{$collNameChecked}/page/pref">
43 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_tip')"/></xsl:attribute>
44 <span id="preferencesButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/></span>
45 <script type="text/javascript">
46 <xsl:text disable-output-escaping="yes">
47 $("#preferencesButton").button({icons:{primary:"ui-icon-wrench"}});
48 $("#preferencesButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});
49 </xsl:text>
50 </script>
51 </a>
52 </li>
53
54 <!-- help -->
55 <li>
56 <a href="{$library_name}/collection/{$collNameChecked}/page/help">
57 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_tip')"/></xsl:attribute>
58 <span id="helpButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/></span>
59 <script type="text/javascript">
60 <xsl:text disable-output-escaping="yes">
61 $("#helpButton").button({icons:{primary:"ui-icon-help"}});
62 $("#helpButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});
63 </xsl:text>
64 </script>
65 </a>
66 </li>
67
68 <xsl:call-template name="goto-sparql-button"/>
69
70
71 <!-- login/logout -->
72 <li id="userMenuButton">
73 <xsl:choose>
74 <xsl:when test="/page/pageRequest/userInformation/@username">
75 <a>
76 <xsl:attribute name="href">javascript:toggleUserMenu();</xsl:attribute>
77 <script type="text/javascript">
78 <xsl:text disable-output-escaping="yes">
79 function toggleUserMenu()
80 {
81 var button = $("#userMenuButton");
82 var menu;
83
84 if(button.data("userMenu"))
85 {
86 menu = button.data("userMenu");
87 if(menu.css("display") == "block")
88 {
89 menu.hide();
90 }
91 else
92 {
93 menu.show();
94 }
95 }
96 else
97 {
98 menu = $("&lt;UL&gt;")
99 .css("position", "absolute")
100 .css("display", "block")
101 .css("z-index", "100")
102 .css("list-style", "none outside none")
103 .css("margin", "0px")
104 .css("padding", "0px")
105 .css("font-size", "90%");
106
107 menu.attr("id", "userMenu");
108
109 button.data("userMenu", menu);
110
111 var settingsLink = $("&lt;a&gt;")
112 .attr("href", gs.xsltParams.library_name + "/admin/AccountSettings?s1.username=</xsl:text><xsl:value-of select="/page/pageRequest/userInformation/@username"/><xsl:text disable-output-escaping="yes">");
113 var settingsButton = $("&lt;LI&gt;")
114 .css("padding", "3px")
115 .html("Account settings")
116 .addClass("ui-state-default");
117 settingsLink.append(settingsButton);
118
119 var editingLink = $("&lt;a&gt;")
120 .attr("href", "javascript:;");
121 var editingButton = $("&lt;LI&gt;")
122 .css("padding", "3px")
123 .html((gs.userInformation.editEnabled == "true") ? "Disable edit mode" : "Enable edit mode")
124 .addClass("ui-state-default")
125 .click(function()
126 {
127 var url = gs.xsltParams.library_name + "?a=g&amp;rt=ro&amp;s=ChangeUserEditMode&amp;s1.username=" + gs.userInformation.username + "&amp;s1.enabled=" + ((gs.userInformation.editEnabled == "true") ? "false" : "true");
128 $.ajax(url)
129 .success(function(response)
130 {
131 location.reload();
132 });
133 });
134 editingLink.append(editingButton);
135
136 var url = document.URL;
137 var hasQueryString = (url.indexOf("?") != -1);
138 var hashIndex = url.indexOf("#");
139
140 var hashPart;
141 if(hashIndex != -1)
142 {
143 hashPart = url.substring(hashIndex);
144 url = url.substring(0, hashIndex);
145 }
146
147 var logoutLink = $("&lt;a&gt;")
148 .attr("href", url + (hasQueryString ? "&amp;" : "?") + "logout=" + (hashPart ? hashPart : ""));
149 var logoutButton = $("&lt;LI&gt;")
150 .css("padding", "3px")
151 .html("Logout")
152 .addClass("ui-state-default");
153 logoutLink.append(logoutButton);
154
155 menu.append(settingsLink);
156 menu.append(editingLink);
157 menu.append(logoutLink);
158
159 var buttonLeft = button.offset().left;
160 var buttonTop = button.offset().top;
161
162 var buttonHeight = button.height();
163
164 menu.offset({top: buttonTop + buttonHeight + 4, left: buttonLeft});
165 $("#topArea").append(menu);
166 }
167 }
168 </xsl:text>
169 </script>
170 <span id="loginButton"><xsl:value-of select="/page/pageRequest/userInformation/@username"/></span>
171 <script type="text/javascript">
172 <xsl:text disable-output-escaping="yes">
173 $("#loginButton").button({icons:{primary:"ui-icon-unlocked"}});
174 $("#loginButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});
175 </xsl:text>
176 </script>
177 </a>
178 </xsl:when>
179 <xsl:otherwise>
180 <a>
181 <xsl:attribute name="href">
182 <xsl:value-of select="$library_name"/>
183 <xsl:text>?a=p&amp;sa=login&amp;redirectURL=</xsl:text>
184 <xsl:value-of select="$library_name"/>
185 <xsl:text>%3F</xsl:text>
186 <xsl:if test="/page/pageRequest/@action">
187 <xsl:text>a=</xsl:text>
188 <xsl:value-of select="/page/pageRequest/@action"/>
189 </xsl:if>
190 <xsl:if test="/page/pageRequest/@subaction">
191 <xsl:text>%26sa=</xsl:text>
192 <xsl:value-of select="/page/pageRequest/@subaction"/>
193 </xsl:if>
194 <xsl:for-each select="/page/pageRequest/paramList/param">
195 <xsl:if test="@name != 'password' and @name != 's1.password' and @name != 's1.newPassword' and @name != 's1.oldPassword'">
196 <xsl:text>%26</xsl:text>
197 <xsl:value-of select="@name"/>
198 <xsl:text>=</xsl:text>
199 <xsl:value-of select="@value"/>
200 </xsl:if>
201 </xsl:for-each>
202 </xsl:attribute>
203 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'login_tip')"/></xsl:attribute>
204 <span id="loginButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'login_b')"/></span>
205 <script type="text/javascript">
206 <xsl:text disable-output-escaping="yes">
207 $("#loginButton").button({icons:{primary:"ui-icon-locked"}});
208 $("#loginButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});
209 </xsl:text>
210 </script>
211 </a>
212 </xsl:otherwise>
213 </xsl:choose>
214 </li>
215
216 <!-- debuginfo (doesn't use class="ui-state-error" since the text is not legible due to inherited text-colour) -->
217 <xsl:if test="/page/pageRequest/paramList/param[(@name='debug') and (@value='on' or @value='true' or @value='1')]">
218 <li>
219 <a href="{$library_name}/collection/{$collNameChecked}/page/debug">
220 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'debuginfo_tip')"/></xsl:attribute>
221 <span id="debugButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'debuginfo_b')"/></span>
222 <script type="text/javascript">
223 <xsl:text disable-output-escaping="yes">
224 $("#debugButton").button({icons:{primary:"ui-icon-info"}});
225 $("#debugButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});
226 </xsl:text>
227 </script>
228 </a>
229 </li>
230 </xsl:if>
231 </ul>
232 </xsl:template>
233
234</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.