[Bps-public-commit] RT-BugTracker branch, rt4, updated. 426a0dc5964988648e24ff13b0d2f790adee0c02

? sunnavy sunnavy at bestpractical.com
Mon Jun 4 11:18:58 EDT 2012


The branch, rt4 has been updated
       via  426a0dc5964988648e24ff13b0d2f790adee0c02 (commit)
      from  ec32c3332a4fc52baabfa5ac0ee6e5b20c5e0787 (commit)

Summary of changes:
 .../Callbacks/BugTracker/Elements/Tabs/SelfService |   83 ++++++++++-
 html/Dist/Browse.html                              |    5 +-
 html/Dist/ByMaintainer.html                        |   13 +-
 html/Dist/Display.html                             |    2 +-
 html/Dist/Elements/ErrorDisabled                   |    2 +-
 html/Dist/Elements/Tabs                            |  154 --------------------
 html/Dist/Manage.html                              |    2 +-
 html/Dist/Search.html                              |    5 +-
 8 files changed, 86 insertions(+), 180 deletions(-)
 delete mode 100644 html/Dist/Elements/Tabs

- Log -----------------------------------------------------------------
commit 426a0dc5964988648e24ff13b0d2f790adee0c02
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Jun 4 23:18:52 2012 +0800

    more menu fixes for rt4

diff --git a/html/Callbacks/BugTracker/Elements/Tabs/SelfService b/html/Callbacks/BugTracker/Elements/Tabs/SelfService
index 4694009..8dc5f01 100644
--- a/html/Callbacks/BugTracker/Elements/Tabs/SelfService
+++ b/html/Callbacks/BugTracker/Elements/Tabs/SelfService
@@ -47,9 +47,86 @@
 %# END BPS TAGGED BLOCK }}}
 <%INIT>
 my $Name = $session{'CurrentUser'}->UserObj->Name;
+my $escaped_uname = $m->interp->apply_escapes(
+    $session{'CurrentUser'}->UserObj->Name, 'u'
+);
+
+my $tracker = Menu()->child(
+    bugtracker => title => loc('Distributions'),
+);
+
+$tracker->child(
+    by_maintainer => title => loc('My Distributions'),
+    path        => '/Dist/ByMaintainer.html?Name=' . $escaped_uname,
+);
+
+$tracker->child(
+    search => title => loc('Search'),
+    path        => '/Dist/Search.html',
+);
 
-Menu()->child(
-    by_maintainer => title => loc('Distributions'),
-    path        => '/Dist/ByMaintainer.html?Name=' . $Name,
+$tracker->child(
+    browse => title => loc('Browse'),
+    path        => '/Dist/Browse.html',
 );
+
+my $request_path = $HTML::Mason::Commands::r->path_info;
+$request_path =~ s!^/{2,}!/!;
+if ( $request_path =~ /^\/Dist/ ) {
+    my $Queue = $DECODED_ARGS->{'Queue'} || $DECODED_ARGS->{'Name'};
+    my $queue_obj;
+    if ($Queue) {
+        my $tmp = RT::Queue->new( $session{'CurrentUser'} );
+        $tmp->Load($Queue);
+        unless ( $tmp->id ) {
+            $RT::Logger->warning("Couldn't load queue '$Queue'");
+        }
+        else {
+            $queue_obj = $tmp;
+            $Queue = $queue_obj->Name;
+        }
+    }
+
+    my $escaped_queue = $m->interp->apply_escapes( $Queue, 'u' );
+
+    if ($queue_obj) {
+        $tracker->child(
+            queue_display => title => $Queue,
+            path => '/Dist/Display.html?Queue=' . $escaped_queue,
+        );
+        PageMenu()->child(
+            active => title => loc("Active bugs"),
+            path => "/Dist/Display.html?Status=Active&Queue=" . $escaped_queue,
+        );
+
+        PageMenu()->child(
+            resolved => title => loc("Resolved bugs"),
+            path => "/Dist/Display.html?Status=Resolved&Queue="
+              . $escaped_queue,
+        );
+
+        PageMenu()->child(
+            rejected => title => loc("Rejected bugs"),
+            path => "/Dist/Display.html?Status=Rejected&Queue="
+              . $escaped_queue,
+        );
+
+        if ( !$queue_obj->Disabled ) {
+            PageMenu()->child(
+                report => title => loc("Report a new bug"),
+                path => '/Ticket/Create.html?Queue=' . $escaped_queue,
+            );
+        }
+
+        if (   $queue_obj->IsAdminCc( $session{'CurrentUser'}->id )
+            || $queue_obj->CurrentUserHasRight('AdminQueue') )
+        {
+            PageMenu()->child(
+                manage => title => loc("Manage"),
+                path => '/Dist/Manage.html?Queue=' . $escaped_queue,
+            );
+        }
+    }
+
+}
 </%INIT>
diff --git a/html/Dist/Browse.html b/html/Dist/Browse.html
index cbf9e20..4344613 100755
--- a/html/Dist/Browse.html
+++ b/html/Dist/Browse.html
@@ -46,10 +46,7 @@
 %# 
 %# END BPS TAGGED BLOCK }}}
 <& /Elements/Header, Title => $title &>
-<& /Dist/Elements/Tabs,
-    Title => $title,
-    current_tab => 'Dist/Browse.html',
-&>
+<& /Elements/Tabs &>
 
 <& /Dist/Elements/BeginsWith, Name => $Name &>
 
diff --git a/html/Dist/ByMaintainer.html b/html/Dist/ByMaintainer.html
index 108e899..9cbed77 100755
--- a/html/Dist/ByMaintainer.html
+++ b/html/Dist/ByMaintainer.html
@@ -46,10 +46,7 @@
 %# 
 %# END BPS TAGGED BLOCK }}}
 <& /Elements/Header, Title => loc("Distributions maintained by [_1]", $user->Name) &>
-<& /Dist/Elements/Tabs,
-    Title => loc("Distributions maintained by [_1]", $user->Name),
-    current_tab => $current_tab,
-    &>
+<& /Elements/Tabs &>
 
 <& /Dist/Elements/DistributionList, queues => $watched_queues &>
 
@@ -68,14 +65,6 @@ if (not $user->Id) {
 
 my $watched_queues = $user->WatchedQueues('AdminCc');
 
-my $current_tab;
-if ($Name eq $user->Name) {
-    $current_tab = 'Dist/ByMaintainer.html?Name=' . $Name;
-}
-else {
-    $current_tab = 'Dist/Browse.html';
-}
-
 </%init>
 <%args>
 $Name => undef
diff --git a/html/Dist/Display.html b/html/Dist/Display.html
index 0e4c329..f372d77 100755
--- a/html/Dist/Display.html
+++ b/html/Dist/Display.html
@@ -50,7 +50,7 @@
     RSSAutoDiscovery => $RSSFeedURL,
 &>
 
-<& /Dist/Elements/Tabs, 
+<& /Elements/Tabs, 
     current_tab => '/Dist/Display.html',
     current_subtab => $current_subtab,
     Queue => $Name,
diff --git a/html/Dist/Elements/ErrorDisabled b/html/Dist/Elements/ErrorDisabled
index ec74319..7a8d5d0 100644
--- a/html/Dist/Elements/ErrorDisabled
+++ b/html/Dist/Elements/ErrorDisabled
@@ -1,6 +1,6 @@
 <& /Dist/Elements/Header, Title => loc("Error") &>
 
-<& /Dist/Elements/Tabs,
+<& /Elements/Tabs,
     Title       => loc("Queue for the distribution is disabled"),
     current_tab => '',
 &>
diff --git a/html/Dist/Elements/Tabs b/html/Dist/Elements/Tabs
deleted file mode 100644
index b20a65d..0000000
--- a/html/Dist/Elements/Tabs
+++ /dev/null
@@ -1,154 +0,0 @@
-%# BEGIN BPS TAGGED BLOCK {{{
-%# 
-%# COPYRIGHT:
-%#  
-%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC 
-%#                                          <jesse at bestpractical.com>
-%# 
-%# (Except where explicitly superseded by other copyright notices)
-%# 
-%# 
-%# LICENSE:
-%# 
-%# This work is made available to you under the terms of Version 2 of
-%# the GNU General Public License. A copy of that license should have
-%# been provided with this software, but in any event can be snarfed
-%# from www.gnu.org.
-%# 
-%# This work is distributed in the hope that it will be useful, but
-%# WITHOUT ANY WARRANTY; without even the implied warranty of
-%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-%# General Public License for more details.
-%# 
-%# You should have received a copy of the GNU General Public License
-%# along with this program; if not, write to the Free Software
-%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-%# 02110-1301 or visit their web page on the internet at
-%# http://www.gnu.org/copyleft/gpl.html.
-%# 
-%# 
-%# CONTRIBUTION SUBMISSION POLICY:
-%# 
-%# (The following paragraph is not intended to limit the rights granted
-%# to you to modify and distribute this software under the terms of
-%# the GNU General Public License and is only of importance to you if
-%# you choose to contribute your changes and enhancements to the
-%# community by submitting them to Best Practical Solutions, LLC.)
-%# 
-%# By intentionally submitting any modifications, corrections or
-%# derivatives to this work, or any other work intended for use with
-%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-%# you are the copyright holder for those contributions and you grant
-%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
-%# royalty-free, perpetual, license to use, copy, create derivative
-%# works based on those contributions, and sublicense and distribute
-%# those contributions and any derivatives thereof.
-%# 
-%# END BPS TAGGED BLOCK }}}
-<& /Elements/Tabs,
-    actions => $actions,
-    current_toptab => $current_toptab,
-    current_tab => $current_tab,
-    tabs => $tabs,
-    Title => $Title,
-&>
-
-<%INIT>
-my $escaped_uname = $m->interp->apply_escapes(
-    $session{'CurrentUser'}->UserObj->Name, 'u'
-);
-my $current_toptab = "Dist/ByMaintainer.html?Name=$escaped_uname";
-
-my $tabs = {
-    A => {
-        title => loc('My Distributions'),
-        path => "Dist/ByMaintainer.html?Name=$escaped_uname",
-    },
-    B => {
-        title => loc('Search'),
-        path => 'Dist/Search.html',
-    },
-    C => {
-        title => loc('Browse'),
-        path => 'Dist/Browse.html',
-    },
-};
-
-my $queue_obj;
-if ( $Queue ) {
-    if (ref($Queue)) {
-        $Queue = $Queue->Name;
-    }
-    else {
-        my $tmp = RT::Queue->new( $session{'CurrentUser'} );
-        $tmp->Load( $Queue );
-        unless ( $tmp->id ) {
-            $RT::Logger->warning( "Couldn't load queue '$Queue'");
-        } else {
-            $queue_obj = $tmp;
-        }
-        $Queue = $queue_obj->Name;
-    }
-}
-
-my $escaped_queue = $m->interp->apply_escapes( $Queue, 'u' );
-
-if ($Queue) {
-    my $queue_display_path = 'Dist/Display.html?Queue='. $escaped_queue;
-    $tabs->{'H'} = {
-        title => $Queue,
-        path => $queue_display_path,
-    };
-}
-
-my $dist_subtabs = {
-    A => {
-        title   => loc("Active bugs"),
-        path    => "Dist/Display.html?Status=Active&Queue=". $escaped_queue,
-    },
-    Ab => {
-        title   => loc("Resolved bugs"),
-        path    => "Dist/Display.html?Status=Resolved&Queue=". $escaped_queue,
-    },
-    Ac => {
-        title   => loc("Rejected bugs"),
-        path    => "Dist/Display.html?Status=Rejected&Queue=". $escaped_queue,
-    },
-};
-
-if ( $queue_obj && !$queue_obj->Disabled ) {
-    $dist_subtabs->{'G'} = {
-        title   => loc("Report a new bug"),
-        path    => 'Ticket/Create.html?Queue='. $escaped_queue,
-    };
-}
-
-if ( $queue_obj
-    && (
-       $queue_obj->IsAdminCc( $session{'CurrentUser'}->id )
-    || $queue_obj->CurrentUserHasRight('AdminQueue') ) )
-{
-    $dist_subtabs->{'J'} = {
-        title   => loc("Manage"),
-        path    => 'Dist/Manage.html?Queue='. $escaped_queue,
-    };
-}
-
-# if we're looking at a page with a submenu, add it to the hash and set the
-# current tab
-if ($current_subtab =~ m!^(Dist/Display|Ticket/Create)\.html!) {
-    $tabs->{'H'}->{'subtabs'} = $dist_subtabs;
-    $tabs->{'H'}->{'current_subtab'} = $current_subtab;
-    $current_tab = 'Dist/Display.html?Queue='. $escaped_queue;
-}
-
-</%INIT>
-
-<%ARGS>
-$Queue => undef
-$actions => undef
-$subtabs => undef
-$current_tab => ''
-$current_subtab => ''
-$Title => undef
-</%ARGS>
diff --git a/html/Dist/Manage.html b/html/Dist/Manage.html
index 8dee8bf..8c3e155 100644
--- a/html/Dist/Manage.html
+++ b/html/Dist/Manage.html
@@ -2,7 +2,7 @@
     Title => $title,
 &>
 
-<& /Dist/Elements/Tabs, 
+<& /Elements/Tabs, 
     current_tab => '/Dist/Manage.html',
     current_subtab => $current_subtab,
     Queue => $Name,
diff --git a/html/Dist/Search.html b/html/Dist/Search.html
index cdafd88..2aba765 100755
--- a/html/Dist/Search.html
+++ b/html/Dist/Search.html
@@ -46,10 +46,7 @@
 %# 
 %# END BPS TAGGED BLOCK }}}
 <& /Elements/Header, Title => loc("Public Bug Tracker") &>
-<& Elements/Tabs, 
-    current_tab => "Dist/Search.html",
-    Title => loc("Search Distributions")
-&>
+<& /Elements/Tabs &>
 
 <p>
   <form action="/Dist/Display.html" method="get">

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list