[Bps-public-commit] r20160 - RT-BugTracker-Public/html/Elements
ruz at bestpractical.com
ruz at bestpractical.com
Mon Nov 30 02:46:17 EST 2009
Author: ruz
Date: Mon Nov 30 02:46:17 2009
New Revision: 20160
Modified:
RT-BugTracker-Public/html/Elements/PersonalQuickbar
Log:
* refactor personal quickbar
Modified: RT-BugTracker-Public/html/Elements/PersonalQuickbar
==============================================================================
--- RT-BugTracker-Public/html/Elements/PersonalQuickbar (original)
+++ RT-BugTracker-Public/html/Elements/PersonalQuickbar Mon Nov 30 02:46:17 2009
@@ -1,51 +1,43 @@
-<%ARGS>
-$Prefs => '/User/Prefs.html'
-$URL => undef
-</%ARGS>
-<%INIT>
-use URI::Escape;
-
-my $return_url = $RT::WebPath
- . '/index.html?goto='
- . URI::Escape::uri_escape(
- URI::Escape::uri_escape(
- $m->request_comp->path
- . '?'
- . $m->comp('/Elements/QueryString', %{$r->args})
- )
- );
-</%INIT>
- <div id="quick-personal">
+<div id="quick-personal">
<span class="hide"><a href="#skipnav"><&|/l&>Skip Menu</&></a> | </span>
-% if ($session{'CurrentUser'}->Name
-% and $session{'CurrentUser'}->Name ne $RT::WebPublicUser)
-% {
- <&|/l, "<span>".$session{'CurrentUser'}->Name."</span>" &>Logged in as [_1]</&>
-% }
-% elsif ($session{'CurrentUser'}->Name eq $RT::WebPublicUser) {
+% if ( $public_user ) {
<&|/l&>You are currently an anonymous guest.</&>
- |
- <a href="<%$RT::WebPath%>/NoAuth/Logout.html?URL=<% $return_url %>"><&|/l&>Login</&></a>
- |
- <a href="<%$RT::WebPath%>/NoAuth/Logout.html"><&|/l&>Return to Main</&></a>
-% }
-% else {
+ | <a href="<% RT->Config->Get('WebPath') %>/NoAuth/Logout.html?URL=<% $return_url %>"><&|/l&>Login</&></a>
+ | <a href="<% RT->Config->Get('WebPath') %>/NoAuth/Logout.html"><&|/l&>Return to Main</&></a>
+% } elsif ( $logged_in ) {
+ <&|/l, "<span>".$session{'CurrentUser'}->Name."</span>" &>Logged in as [_1]</&>
+% } else {
<&|/l&>Not logged in.</&>
% }
-% if ( $session{'CurrentUser'}->Id
-% and $session{'CurrentUser'}->HasRight( Right => 'ModifySelf', Object => $RT::System )) {
- | <a href="<%$RT::WebPath%><%$Prefs%>"><&|/l&>Preferences</&></a>
+% if ( $can_modify_self ) {
+ | <a href="<%RT->Config->Get('WebPath')%><% $Prefs %>"><&|/l&>Preferences</&></a>
% }
-% if ($session{'CurrentUser'}->Name ne $RT::WebPublicUser
-% and $m->request_comp->path =~ m|^/Public/|)
-% {
- | <a href="<%$RT::WebPath%>/"><&|/l&>Return to Main</&></a>
+% $m->callback( %ARGS );
+% if ( $logged_in && !$public_user ) {
+<& Logout, %ARGS &>
% }
- <& /Elements/Callback, %ARGS &>
-% unless (!$session{'CurrentUser'}->Name
-% or ($RT::WebExternalAuth and !$RT::WebFallbackToInternalAuth)
-% or $session{'CurrentUser'}->Name eq $RT::WebPublicUser) {
- | <a href="<%$RT::WebPath%>/NoAuth/Logout.html<%$URL ? "?URL=".$URL : ''%>"><&|/l&>Logout</&></a>
-% }
- </div>
+</div>
+<%ARGS>
+$Prefs => '/Prefs/Other.html'
+</%ARGS>
+<%INIT>
+my $logged_in = $session{'CurrentUser'}->Name;
+my ($can_modify_self, $public_user, $return_url) = (0, 0, '');
+if ( $logged_in ) {
+ $can_modify_self = $session{'CurrentUser'}->HasRight(
+ Right => 'ModifySelf', Object => $RT::System,
+ ) if $Prefs;
+ $public_user = $logged_in eq $RT::WebPublicUser;
+}
+if ( $public_user ) {
+ $return_url =
+ RT->Config->Get('WebPath')
+ . '/index.html?goto='
+ . URI::Escape::uri_escape( URI::Escape::uri_escape(
+ $m->request_path
+ . '?'
+ . $m->comp('/Elements/QueryString', %{$r->args})
+ ) );
+}
+</%INIT>
More information about the Bps-public-commit
mailing list