This repository has been archived by the owner on May 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadmin-bar.xsl
98 lines (85 loc) · 3.17 KB
/
admin-bar.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--
Front-end Admin bar
Info
Version: 0.3
Date: 24-11-2010
Author: João Barbosa
E-mail: joao.ofb@gmail.com
Website: www.joaootavio.com.br
Parameters
dev-username: developer's username
logged-label: text that precedes username link
admin-link: text for the administration link
logout-link: text for the logout link
Usage
<xsl:call-template name="front-admin-bar">
<xsl:with-param name="dev-username" select="'developer-username'" />
<xsl:with-param name="logged-label" select="'Logged in as: '" />
<xsl:with-param name="admin-link-label" select="'Back to admin'" />
<xsl:with-param name="logout-link-label" select="'Logout'" />
<xsl:with-param name="debug-link-label" select="'Debug this page'" />
</xsl:call-template>
-->
<xsl:param name="cookie-username" />
<xsl:template name="front-admin-bar">
<!-- Developer Username -->
<xsl:param name="dev-username" />
<!-- Link labels -->
<xsl:param name="logged-label" select="'Logged-in as: '" />
<xsl:param name="admin-link-label" select="'Back to admin'" />
<xsl:param name="logout-link-label" select="'Logout'" />
<xsl:param name="debug-link-label" select="'Debug this page'" />
<xsl:if test="string-length($cookie-username) > 0">
<div class="adminBar">
<h1><a href="{$root}"><xsl:value-of select="$website-name" /></a></h1>
<span>
<!-- Logged in info -->
<xsl:value-of select="$logged-label" />
<a href="{$root}/symphony/system/authors">
<xsl:value-of select="$cookie-username" />
</a>
<xsl:choose>
<xsl:when test="$cookie-username = $dev-username">
<!-- Developer Front-end Admin Bar -->
<xsl:call-template name="debug-link">
<xsl:with-param name="label" select="$debug-link-label" />
</xsl:call-template>
<xsl:call-template name="admin-link">
<xsl:with-param name="label" select="$admin-link-label" />
</xsl:call-template>
<xsl:call-template name="logout-link">
<xsl:with-param name="label" select="$logout-link-label" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<!-- Author Front-end Admin Bar -->
<xsl:call-template name="admin-link">
<xsl:with-param name="label" select="$admin-link-label" />
</xsl:call-template>
<xsl:call-template name="logout-link">
<xsl:with-param name="label" select="$logout-link-label" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</span>
</div>
</xsl:if>
</xsl:template>
<xsl:template name="debug-link">
<xsl:param name="label" />
<xsl:text> | </xsl:text>
<a href="{$current-url}?debug"><xsl:value-of select="$label" /></a>
</xsl:template>
<xsl:template name="admin-link">
<xsl:param name="label" />
<xsl:text> | </xsl:text>
<a href="{$root}/symphony"><xsl:value-of select="$label" /></a>
</xsl:template>
<xsl:template name="logout-link">
<xsl:param name="label" />
<xsl:text> | </xsl:text>
<a href="{$root}/symphony/logout"><xsl:value-of select="$label" /></a>
</xsl:template>
</xsl:stylesheet>