Index: /main/trunk/model-sites-dev/multimodal-mdl/collect/linkeddata-my-ipod/transform/layouts/header.xsl
===================================================================
--- /main/trunk/model-sites-dev/multimodal-mdl/collect/linkeddata-my-ipod/transform/layouts/header.xsl	(revision 28589)
+++ /main/trunk/model-sites-dev/multimodal-mdl/collect/linkeddata-my-ipod/transform/layouts/header.xsl	(revision 28589)
@@ -0,0 +1,234 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+	xmlns:java="http://xml.apache.org/xslt/java"
+	xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
+	xmlns:gslib="http://www.greenstone.org/skinning"
+	xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
+	extension-element-prefixes="java util"
+	exclude-result-prefixes="java util gsf">
+
+	<xsl:template name="goto-sparql-button">
+
+			<!-- sparql -->
+			<li>
+				<a href="{$library_name}/collection/{$collNameChecked}/page/sparql">
+					<xsl:attribute name="title">Sparql Interface page</xsl:attribute>
+					<span id="sparqlButton">Sparql</span>
+					<script type="text/javascript">
+						<xsl:text disable-output-escaping="yes">
+							$("#sparqlButton").button();
+							$("#sparqlButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});
+						</xsl:text>
+					</script>
+				</a>
+			</li>
+
+	</xsl:template>
+
+	<!-- ***** HOME HELP PREFERENCES LOGIN ***** -->
+	<xsl:template name="home-help-preferences">
+		<ul id="bannerLinks">
+
+		  <!-- RSS feed link can appear in a global format statement (where it has no type attribute) 
+		       or in section specific format statements, such as browse, search, display. 
+		       If it's present in any format statement, display the RSS link in the bannerlinks section. -->
+		  <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search' or not(@type)]/gsf:option[@name='RSS']/@value = 'true'">
+			<li><gsf:link type="rss"><gsf:icon file="rssicon.png"/></gsf:link></li>
+		  </xsl:if>
+
+			<!-- preferences -->
+			<li>
+				<a href="{$library_name}/collection/{$collNameChecked}/page/pref">
+					<xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_tip')"/></xsl:attribute>
+					<span id="preferencesButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/></span>
+					<script type="text/javascript">
+						<xsl:text disable-output-escaping="yes">
+							$("#preferencesButton").button({icons:{primary:"ui-icon-wrench"}});
+							$("#preferencesButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});
+						</xsl:text>
+					</script>
+				</a>
+			</li>
+
+			<!-- help -->
+			<li>
+				<a href="{$library_name}/collection/{$collNameChecked}/page/help">
+					<xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_tip')"/></xsl:attribute>
+					<span id="helpButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/></span>
+					<script type="text/javascript">
+						<xsl:text disable-output-escaping="yes">
+							$("#helpButton").button({icons:{primary:"ui-icon-help"}});
+							$("#helpButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});
+						</xsl:text>
+					</script>
+				</a>
+			</li>
+			
+			<xsl:call-template name="goto-sparql-button"/>
+
+
+			<!-- login/logout -->
+			<li id="userMenuButton">
+				<xsl:choose>
+					<xsl:when test="/page/pageRequest/userInformation/@username">
+						<a>
+							<xsl:attribute name="href">javascript:toggleUserMenu();</xsl:attribute>
+							<script type="text/javascript">
+								<xsl:text disable-output-escaping="yes">
+									function toggleUserMenu()
+									{
+										var button = $("#userMenuButton");
+										var menu;
+
+										if(button.data("userMenu"))
+										{
+											menu = button.data("userMenu");
+											if(menu.css("display") == "block")
+											{
+												menu.hide();
+											}
+											else
+											{
+												menu.show();
+											}
+										}
+										else
+										{
+											menu = $("&lt;UL&gt;")
+												.css("position", "absolute")
+												.css("display", "block")
+												.css("z-index", "100")
+												.css("list-style", "none outside none")
+												.css("margin", "0px")
+												.css("padding", "0px")
+												.css("font-size", "90%");
+												
+											menu.attr("id", "userMenu");
+
+											button.data("userMenu", menu);
+
+											var settingsLink = $("&lt;a&gt;")
+												.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">");
+											var settingsButton = $("&lt;LI&gt;")
+												.css("padding", "3px")
+												.html("Account settings")
+												.addClass("ui-state-default");
+											settingsLink.append(settingsButton);
+											
+											var editingLink = $("&lt;a&gt;")
+												.attr("href", "javascript:;");
+											var editingButton = $("&lt;LI&gt;")
+												.css("padding", "3px")
+												.html((gs.userInformation.editEnabled == "true") ? "Disable edit mode" : "Enable edit mode")
+												.addClass("ui-state-default")
+												.click(function()
+												{
+													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");
+													$.ajax(url)
+													.success(function(response)
+													{
+														location.reload();
+													});
+												});
+											editingLink.append(editingButton);
+
+											var url = document.URL;
+											var hasQueryString = (url.indexOf("?") != -1);
+											var hashIndex = url.indexOf("#");
+											
+											var hashPart;
+											if(hashIndex != -1)
+											{
+												hashPart = url.substring(hashIndex);
+												url = url.substring(0, hashIndex);
+											}
+											
+											var logoutLink = $("&lt;a&gt;")
+												.attr("href", url + (hasQueryString ? "&amp;" : "?") + "logout=" + (hashPart ? hashPart : ""));
+											var logoutButton = $("&lt;LI&gt;")
+												.css("padding", "3px")
+												.html("Logout")
+												.addClass("ui-state-default");
+											logoutLink.append(logoutButton);
+
+											menu.append(settingsLink);
+											menu.append(editingLink);
+											menu.append(logoutLink);
+
+											var buttonLeft = button.offset().left;
+											var buttonTop = button.offset().top;
+
+											var buttonHeight = button.height();
+
+											menu.offset({top: buttonTop + buttonHeight + 4, left: buttonLeft});
+											$("#topArea").append(menu);
+										}
+									}
+								</xsl:text>
+							</script>
+							<span id="loginButton"><xsl:value-of select="/page/pageRequest/userInformation/@username"/></span>
+							<script type="text/javascript">
+								<xsl:text disable-output-escaping="yes">
+									$("#loginButton").button({icons:{primary:"ui-icon-unlocked"}});
+									$("#loginButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});
+								</xsl:text>
+							</script>
+						</a>
+					</xsl:when>
+					<xsl:otherwise>
+						<a>
+							<xsl:attribute name="href">
+								<xsl:value-of select="$library_name"/>
+								<xsl:text>?a=p&amp;sa=login&amp;redirectURL=</xsl:text>
+								<xsl:value-of select="$library_name"/>
+								<xsl:text>%3F</xsl:text>
+								<xsl:if test="/page/pageRequest/@action">
+									<xsl:text>a=</xsl:text>
+									<xsl:value-of select="/page/pageRequest/@action"/>
+								</xsl:if>
+								<xsl:if test="/page/pageRequest/@subaction">
+									<xsl:text>%26sa=</xsl:text>
+									<xsl:value-of select="/page/pageRequest/@subaction"/>
+								</xsl:if>
+								<xsl:for-each select="/page/pageRequest/paramList/param">
+									<xsl:if test="@name != 'password' and @name != 's1.password' and @name != 's1.newPassword' and @name != 's1.oldPassword'">
+										<xsl:text>%26</xsl:text>
+										<xsl:value-of select="@name"/>
+										<xsl:text>=</xsl:text>
+										<xsl:value-of select="@value"/>
+									</xsl:if>
+								</xsl:for-each>
+							</xsl:attribute>
+							<xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'login_tip')"/></xsl:attribute>
+							<span id="loginButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'login_b')"/></span>
+							<script type="text/javascript">
+								<xsl:text disable-output-escaping="yes">
+									$("#loginButton").button({icons:{primary:"ui-icon-locked"}});
+									$("#loginButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});
+								</xsl:text>
+							</script>
+						</a>
+					</xsl:otherwise>
+				</xsl:choose>
+			</li>
+		  
+			<!-- debuginfo (doesn't use class="ui-state-error" since the text is not legible due to inherited text-colour) -->
+			<xsl:if test="/page/pageRequest/paramList/param[(@name='debug') and (@value='on' or @value='true' or @value='1')]">
+				<li>
+					<a href="{$library_name}/collection/{$collNameChecked}/page/debug">
+						<xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'debuginfo_tip')"/></xsl:attribute>
+						<span id="debugButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'debuginfo_b')"/></span>
+						<script type="text/javascript">
+							<xsl:text disable-output-escaping="yes">
+								$("#debugButton").button({icons:{primary:"ui-icon-info"}});
+								$("#debugButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});
+							</xsl:text>
+						</script>
+					</a>
+				</li>
+			</xsl:if>
+		</ul>
+	</xsl:template>
+
+</xsl:stylesheet>
