[Rt-commit] [svn] r1354 - in rtir/branches/1.1/html/RTIR: Block/Elements Elements Incident/Elements Investigation/Elements Report/Elements

leira at pallas.eruditorum.org leira at pallas.eruditorum.org
Wed Aug 18 22:30:46 EDT 2004


Author: leira
Date: Wed Aug 18 22:30:45 2004
New Revision: 1354

Added:
   rtir/branches/1.1/html/RTIR/Elements/QueueTabs
Modified:
   rtir/branches/1.1/html/RTIR/Block/Elements/Tabs
   rtir/branches/1.1/html/RTIR/Elements/Tabs
   rtir/branches/1.1/html/RTIR/Incident/Elements/Tabs
   rtir/branches/1.1/html/RTIR/Investigation/Elements/Tabs
   rtir/branches/1.1/html/RTIR/Report/Elements/Tabs
Log:
Consolidate some of the Tabs components, so that there's less duplicated code.


Modified: rtir/branches/1.1/html/RTIR/Block/Elements/Tabs
==============================================================================
--- rtir/branches/1.1/html/RTIR/Block/Elements/Tabs	(original)
+++ rtir/branches/1.1/html/RTIR/Block/Elements/Tabs	Wed Aug 18 22:30:45 2004
@@ -22,148 +22,8 @@
 %# 
 %# 
 %# END LICENSE BLOCK
-<& /Elements/Callback, Page => '/Ticket/Elements/Tabs', Ticket => $Ticket, actions=> $actions, tabs => $tabs, %ARGS &>
-<& /RTIR/Elements/Tabs, 
-    tabs => $tabs, 
-    actions => $actions, 
-    current_tab => $current_tab, 
-    current_toptab => $current_toptab,
-    Title => $Title &> 
-<%INIT>
+<& /RTIR/Elements/QueueTabs, 
+    QueueName => 'Blocks',
+    %ARGS
+&> 
 
-my $tabs = {};
-my $current_toptab = 'RTIR/Listing.html?NewSearch=1&Queue=Blocks',
-my $actions;
-my $searchtabs = { } ;
-
-if ( $Ticket) {
-	
-    my $id  = $Ticket->id();
-
-    if ( defined $session{'tickets'} ) {
-
-	my $item_map = $session{'tickets'}->ItemMap;
-    
-	# Don't display prev links if we're on the first ticket
-
-	if ($item_map->{$Ticket->Id}->{prev}) {
-	    $searchtabs->{'_a'} = {
-		class => "nav",
-		path => "RTIR/Display.html?id=" . $item_map->{first},
-		title => '<< ' . loc('First') };
-	    $searchtabs->{"_b"} = { class => "nav",
-				    path => "RTIR/Display.html?id=" . $item_map->{$Ticket->Id}->{prev},
-				    title => '< ' . loc('Prev') };
-	} 
-	
-	
-	# Don't display next links if we're on the last ticket
-	if ($item_map->{$Ticket->Id}->{next}) {
-	    $searchtabs->{'d'} = { class => "nav",
-				   path => "RTIR/Display.html?id=" . $item_map->{$Ticket->Id}->{next},
-				   title => loc('Next') . ' >' };
-	    $searchtabs->{'e'} = {
-		class => "nav",
-		path => "RTIR/Display.html?id=" . $item_map->{last},
-		title => loc('Last') . ' >>' };
-	}
-    }
-
-$tabs->{"this"} = { class => "currentnav",
-                    path  => "RTIR/Display.html?id=" . $Ticket->id,
-                    title => loc("Block #[_1]", $id),
-                    current_subtab => $current_subtab };
-
-my $ticket_page_tabs = {
-    _A => { title => loc('Display'),
-            path  => "RTIR/Display.html?id=" . $id, },
-
-};
-
-# only show edit option if they can do it
-if ($Ticket->CurrentUserHasRight('ModifyTicket')) {
-   $ticket_page_tabs->{'_B'} = { title => loc('Edit'),
-            path  => "RTIR/Edit.html?id=" . $id, };
-}
-
-foreach my $tab ( sort keys %{$ticket_page_tabs} ) {
-    if ( $ticket_page_tabs->{$tab}->{'path'} eq $current_tab ) {
-        $ticket_page_tabs->{$tab}->{"subtabs"}        = $subtabs;
-        $tabs->{'this'}->{"current_subtab"}        = 
-        $ticket_page_tabs->{$tab}->{"path"};
-    }
-}
-$tabs->{'this'}->{"subtabs"} = $ticket_page_tabs;
-
-if (    $Ticket->CurrentUserHasRight('ModifyTicket')
-     or $Ticket->CurrentUserHasRight('ReplyToTicket') ) {
-    $actions->{'A'} = { title => loc('Reply'),
-                        path  => "RTIR/Update.html?Action=Respond&DefaultStatus=stalled&id=" . $id,
-    };
-}
-
-if ( $Ticket->CurrentUserHasRight('ModifyTicket') ) {
-    if ( $Ticket->Status eq 'open' ) {
-        $actions->{'Ac'} = {
-
-            path =>
-              "RTIR/Update.html?Action=Respond&DefaultStatus=stalled&id="
-              . $id,
-            title => loc('Request Removal') };
-    }
-}
-
-if ( $Ticket->CurrentUserHasRight('ModifyTicket') ) {
-    if ( $Ticket->Status eq 'stalled') {
-        $actions->{'Ac'} = {
-
-            path =>
-              "RTIR/Update.html?Action=Comment&DefaultStatus=resolved&id="
-              . $id,
-            title => loc('Remove') };
-    }
-}
-
-if ( $Ticket->CurrentUserHasRight('ModifyTicket') ) {
-    if ( $Ticket->Status eq 'new' or $Ticket->Status eq 'resolved') {
-        $actions->{'Ac'} = {
-
-            path =>
-              "RTIR/Update.html?Action=Comment&DefaultStatus=open&id=" . $id,
-            title => loc('Activate') };
-    }
-}
-
-if ( $Ticket->CurrentUserHasRight('OwnTicket') ) {
-    if ( $Ticket->OwnerObj->id == $RT::Nobody->id ) {
-        $actions->{'D'} = { path => "RTIR/Display.html?Action=Take&id=" . $id,
-                            title => loc('Take') };
-    }
-    elsif ( $Ticket->OwnerObj->id != $session{CurrentUser}->id ) {
-        $actions->{'E'} = {path => "RTIR/Display.html?Action=Steal&id=" . $id,
-                           title => loc('Steal') };
-    }
-}
-
-if (    $Ticket->CurrentUserHasRight('ModifyTicket')
-     or $Ticket->CurrentUserHasRight('CommentOnTicket') ) {
-    $actions->{'F'} = { title => loc('Comment'),
-                        path  => "RTIR/Update.html?Action=Comment&id=" . $id,
-    };
-}
-}
-
-$tabs->{"g"} = { path      => 'RTIR/Listing.html?NewSearch=1&Queue=Blocks',
-                 title     => loc('Search'),
-                 separator => 1,
-                 subtabs   => $searchtabs };
-</%INIT>
-
-  
-<%ARGS>
-$Ticket => undef
-$subtabs => undef
-$current_tab => undef
-$current_subtab => undef
-$Title => undef
-</%ARGS>

Added: rtir/branches/1.1/html/RTIR/Elements/QueueTabs
==============================================================================
--- (empty file)
+++ rtir/branches/1.1/html/RTIR/Elements/QueueTabs	Wed Aug 18 22:30:45 2004
@@ -0,0 +1,195 @@
+%# BEGIN LICENSE BLOCK
+%# 
+%# Copyright (c) 1996-2002 Jesse Vincent <jesse at bestpractical.com>
+%# 
+%# (Except where explictly superceded by other copyright notices)
+%# 
+%# 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.
+%# 
+%# 
+%# Unless otherwise specified, all modifications, corrections or
+%# extensions to this work which alter its source code become the
+%# property of Best Practical Solutions, LLC when submitted for
+%# inclusion in the work.
+%# 
+%# 
+%# END LICENSE BLOCK
+<& /Elements/Callback, Page => '/Ticket/Elements/Tabs', Ticket => $Ticket, actions=> $actions, tabs => $tabs, %ARGS &>
+<& /RTIR/Elements/Tabs, 
+    tabs => $tabs, 
+    actions => $actions, 
+    current_toptab => $current_toptab,
+    current_tab => $mytab,
+    current_subtab => $current_subtab,
+    Title => $Title,
+    QueryString => $QueryString,
+&> 
+
+<%INIT>
+
+my ($Type, undef) = $m->comp('/RTIR/Elements/Type', Queue => $QueueName);
+
+my $tabs = {};
+my $current_toptab = 'RTIR/Search/Results.html?Queue=' . $QueueName . $QueryString,
+my ($actions, $mytab);
+my $searchtabs = { } ;
+
+if ( $Ticket) {
+	
+    my $id   = $Ticket->id();
+    $mytab = "RTIR/Display.html?id=".$id;
+
+    if ( defined $session{'tickets'} ) {
+	
+	my $item_map = $session{'tickets'}->ItemMap;
+	
+	# Don't display prev links if we're on the first ticket
+	
+        if ($item_map->{$Ticket->Id}->{prev}) {
+	    $searchtabs->{'_a'} = {
+		class => "nav",
+		path => "RTIR/Display.html?id=" . $item_map->{first},
+		title => '<< ' . loc('First') };
+	    $searchtabs->{"_b"} = { class => "nav",
+				    path => "RTIR/Display.html?id=" . $item_map->{$Ticket->Id}->{prev},
+				    title => '< ' . loc('Prev') };
+	} 
+	
+	
+        # Don't display next links if we're on the last ticket
+        if ($item_map->{$Ticket->Id}->{next}) {
+            $searchtabs->{'d'} = { class => "nav",
+				   path => "RTIR/Display.html?id=" . $item_map->{$Ticket->Id}->{next},
+				   title => loc('Next') . ' >' };
+            $searchtabs->{'e'} = {
+		class => "nav",
+		path => "RTIR/Display.html?id=" . $item_map->{last},
+		title => loc('Last') . ' >>' };
+        }
+    }
+    
+    $tabs->{"this"} = { class => "currentnav",
+			path  => "RTIR/Display.html?id=" . $Ticket->id,
+			title => loc("$Type #[_1]", $id),
+			current_subtab => $current_subtab };
+    
+    my $ticket_page_tabs = {
+	_A => { title => loc('Display'),
+		path  => "RTIR/Display.html?id=" . $id, },
+    };
+
+# only show edit option if they can do it
+if ($Ticket->CurrentUserHasRight('ModifyTicket')) {
+    $ticket_page_tabs->{'_B'} = { title => loc('Edit'),
+            path  => "RTIR/Edit.html?id=" . $id, };
+
+    $ticket_page_tabs->{'_C'} = { title => loc('Split'),
+            path  => "RTIR/Split.html?Ticket=" . $id, };
+
+    $ticket_page_tabs->{'_D'} = { title => loc('Merge'),
+            path  => "RTIR/Merge.html?NewSearch=1&id=" . $id,
+	    separator => 1 };
+}
+
+foreach my $tab ( sort keys %{$ticket_page_tabs} ) {
+    if ( $ticket_page_tabs->{$tab}->{'path'} eq $current_tab ) {
+        $ticket_page_tabs->{$tab}->{"subtabs"}        = $subtabs;
+        $tabs->{'this'}->{"current_subtab"}        = 
+        $ticket_page_tabs->{$tab}->{"path"};
+    }
+}
+$tabs->{'this'}->{"subtabs"} = $ticket_page_tabs;
+
+if (    $Ticket->CurrentUserHasRight('ModifyTicket')
+     or $Ticket->CurrentUserHasRight('ReplyToTicket') ) {
+    $actions->{'A'} = { title => loc('Reply'),
+                        path  => "RTIR/Update.html?Action=Respond&DefaultStatus=stalled&id=" . $id,
+    };
+}
+
+if ( $Ticket->CurrentUserHasRight('ModifyTicket') ) {
+    if ( $Ticket->Status ne 'resolved' and $Ticket->Status ne 'rejected' ) {
+	my $state = $m->scomp("/RTIR/Elements/ShowRTIRField", 
+		      Ticket => $Ticket, Name => 'State');
+	$state =~ s/\s+$//;
+	if ($state ne 'new') {
+	    $actions->{'Ac'} = {
+
+		path =>
+		    "RTIR/Update.html?Action=Comment&DefaultStatus=resolved&id=" . $id,
+		    title => loc('Resolve') };
+	}
+        $actions->{'B'} = { path => "RTIR/Display.html?Status=rejected&id=" . $id,
+                            title => loc('Quick Reject') };
+        $actions->{'Bb'} = {
+
+            path =>
+              "RTIR/Update.html?Action=Comment&DefaultStatus=rejected&id=" . $id,
+            title => loc('Reject') };
+    }
+    if ( $Ticket->Status eq 'resolved' or $Ticket->Status eq 'rejected' ) {
+        $actions->{'C'} = { path => "RTIR/Display.html?Status=open&id=" . $id,
+                            title => loc('Open it') };
+    }
+}
+
+if ( $Ticket->CurrentUserHasRight('OwnTicket') ) {
+    if ( $Ticket->OwnerObj->id == $RT::Nobody->id ) {
+        $actions->{'D'} = { path => "RTIR/Display.html?Action=Take&id=" . $id,
+                            title => loc('Take') };
+    }
+    elsif ( $Ticket->OwnerObj->id != $session{CurrentUser}->id ) {
+        $actions->{'E'} = {path => "RTIR/Display.html?Action=Steal&id=" . $id, 
+                           title => loc('Steal') };
+    }
+}
+
+if (    $Ticket->CurrentUserHasRight('ModifyTicket')
+     or $Ticket->CurrentUserHasRight('CommentOnTicket') ) {
+    $actions->{'F'} = { title => loc('Comment'),
+                        path  => "RTIR/Update.html?Action=Comment&id=" . $id,
+    };
+}
+} else {
+  $mytab = $current_tab;
+}
+
+$tabs->{"A"} = { path      => 'RTIR/Create.html?Queue=' . $QueueName,
+                 title     => loc("New $Type") };
+$tabs->{"e"} = { path      => 'RTIR/Search/Build.html?Queue=' . $QueueName . '&NewQuery=1',
+                 title     => loc('New Query'),
+                 subtabs   => $searchtabs };
+$tabs->{"f"} = { path      => 'RTIR/Search/Build.html?Queue=' . $QueueName . $QueryString,
+                 title     => loc('Query Builder'),
+                 separator => 1,
+                 subtabs   => $searchtabs };
+$tabs->{"g"} = { path      => 'RTIR/Search/Results.html?Queue=' . $QueueName . $QueryString,
+                 title     => loc('Results'),
+                 separator => 1,
+                 subtabs   => $searchtabs };
+
+if ($Type eq 'Report') {
+$tabs->{"h"} = { path      => 'RTIR/$Type/BulkReject.html?ClearRestrictions=1',
+                 title     => loc('Bulk Reject'),
+                 separator => 1 };
+}
+</%INIT>
+
+  
+<%ARGS>
+$Ticket => undef
+$subtabs => undef
+$current_tab => undef
+$current_subtab => undef
+$Title => undef
+$QueryString => undef
+$QueueName => 'Incident Reports'
+</%ARGS>

Modified: rtir/branches/1.1/html/RTIR/Elements/Tabs
==============================================================================
--- rtir/branches/1.1/html/RTIR/Elements/Tabs	(original)
+++ rtir/branches/1.1/html/RTIR/Elements/Tabs	Wed Aug 18 22:30:45 2004
@@ -41,16 +41,13 @@
 	   path => 'RTIR/index.html',
        },
     C => { title => loc('Incidents'),
-	   path => 'RTIR/Search/Results.html?Queue=Incidents',
-       },
+	   path => 'RTIR/Search/Results.html?Queue=Incidents' . $QueryString },
     D => { title => loc('Incident Reports'),
 	   path => 'RTIR/Search/Results.html?Queue=Incident Reports' . $QueryString },
     E => { title => loc('Investigations'),
-	   path => 'RTIR/Search/Results.html?Queue=Investigations',
-       },
+	   path => 'RTIR/Search/Results.html?Queue=Investigations' . $QueryString },
     F => { title => loc('Blocks'),
-	   path => 'RTIR/Search/Results.html?Queue=Blocks',
-       },
+	   path => 'RTIR/Search/Results.html?Queue=Blocks' . $QueryString },
     G => { title => loc('Tools'),
 	   path => 'RTIR/Tools/Lookup.html',
 		   },

Modified: rtir/branches/1.1/html/RTIR/Incident/Elements/Tabs
==============================================================================
--- rtir/branches/1.1/html/RTIR/Incident/Elements/Tabs	(original)
+++ rtir/branches/1.1/html/RTIR/Incident/Elements/Tabs	Wed Aug 18 22:30:45 2004
@@ -22,164 +22,8 @@
 %# 
 %# 
 %# END LICENSE BLOCK
-<& /Elements/Callback, Page => '/Ticket/Elements/Tabs', Ticket => $Ticket, actions=> $actions, tabs => $tabs, %ARGS &>
-<& /RTIR/Elements/Tabs, 
-    tabs => $tabs, 
-    actions => $actions, 
-    current_tab => $current_tab, 
-    current_toptab => $current_toptab,
-    Title => $Title &> 
+<& /RTIR/Elements/QueueTabs, 
+    QueueName => 'Incidents',
+    %ARGS
+&> 
 
-<%INIT>
-
-my $tabs = {};
-my $current_toptab = 'RTIR/Listing.html?NewSearch=1&Queue=Incidents',
-my $actions;
-my $searchtabs = { } ;
-
-if ( $Ticket) {
-	
-    my $id   = $Ticket->id();
-
-    if ( defined $session{'tickets'} ) {
-	
-	my $item_map = $session{'tickets'}->ItemMap;
-	
-	# Don't display prev links if we're on the first ticket
-	
-        if ($item_map->{$Ticket->Id}->{prev}) {
-	    $searchtabs->{'_a'} = {
-		class => "nav",
-		path => "RTIR/Display.html?id=" . $item_map->{first},
-		title => '<< ' . loc('First') };
-	    $searchtabs->{"_b"} = { class => "nav",
-				    path => "RTIR/Display.html?id=" . $item_map->{$Ticket->Id}->{prev},
-				    title => '< ' . loc('Prev') };
-	} 
-	
-	
-        # Don't display next links if we're on the last ticket
-        if ($item_map->{$Ticket->Id}->{next}) {
-            $searchtabs->{'d'} = { class => "nav",
-				   path => "RTIR/Display.html?id=" . $item_map->{$Ticket->Id}->{next},
-				   title => loc('Next') . ' >' };
-            $searchtabs->{'e'} = {
-		class => "nav",
-		path => "RTIR/Display.html?id=" . $item_map->{last},
-		title => loc('Last') . ' >>' };
-        }
-    }
-    
-    $tabs->{"this"} = { class => "currentnav",
-			path  => "RTIR/Display.html?id=" . $Ticket->id,
-			title => loc("Incident #[_1]", $id),
-			    current_subtab => $current_subtab };
-
-    my $ticket_page_tabs = {
-	_A => { title => loc('Display'),
-		path  => "RTIR/Display.html?id=" . $id, },
-	
-	_B => { title => loc('Incident Reports'),
-		path  => "RTIR/Incident/ShowReports.html?id=" . $id, },
-	
-	_C => { title => loc('Investigations'),
-		path  => "RTIR/Incident/ShowInvestigations.html?id=" . $id, },
-	
-	_D => { title => loc('Blocks'),
-		path  => "RTIR/Incident/ShowBlocks.html?id=" . $id, 
-		separator => 1},
-    };
-
-    # only show edit option if they can do it
-    if ($Ticket->CurrentUserHasRight('ModifyTicket')) {
-	$ticket_page_tabs->{'_E'} = { title => loc('Edit'),
-				      path  => "RTIR/Edit.html?id=" . $id, };
-
-	$ticket_page_tabs->{'_F'} = { title => loc('Split'),
-				      path  => "RTIR/Incident/Split.html?Ticket=" . $id, };
-	
-	$ticket_page_tabs->{'_G'} = { title => loc('Merge'),
-				      path  => "RTIR/Merge.html?NewSearch=1&id=" . $id,
-				      separator => 1 };
-    }
-    
-    
-    foreach my $tab ( sort keys %{$ticket_page_tabs} ) {
-	if ( $ticket_page_tabs->{$tab}->{'path'} eq $current_subtab ) {
-	    $ticket_page_tabs->{$tab}->{"subtabs"}        = $subtabs;
-	    $tabs->{'this'}->{"current_subtab"}        = 
-		$ticket_page_tabs->{$tab}->{"path"};
-	}
-    }
-    $tabs->{'this'}->{"subtabs"} = $ticket_page_tabs;
-    
-    if (    $Ticket->CurrentUserHasRight('ModifyTicket')
-	    or $Ticket->CurrentUserHasRight('ReplyToTicket') ) {
-	$actions->{'A'} = { title => loc('Reply to Reporters'),
-			    path  => "RTIR/Incident/Reply.html?DefaultStatus=stalled&ClearRestrictions=1&id=".$id,
-			};
-    }
-    
-    if (    $Ticket->CurrentUserHasRight('ModifyTicket')
-	    or $Ticket->CurrentUserHasRight('ReplyToTicket') ) {
-	$actions->{'Ab'} = { title => loc('Reply to All'),
-			     path  => "RTIR/Incident/Reply.html?DefaultStatus=stalled&ClearRestrictions=1&id=".$id."&All=1",
-			 };
-    }
-    
-    if ( $Ticket->CurrentUserHasRight('ModifyTicket') ) {
-	if ( $Ticket->Status ne 'resolved' ) {
-	    $actions->{'Ac'} = {
-		
-		path  => "RTIR/Incident/Reply.html?Action=Comment&DefaultStatus=resolved&ClearRestrictions=1&id=".$id."&All=1",
-		
-		title => loc('Resolve') };
-	    $actions->{'B'} = {
-		
-		path  => "RTIR/Incident/Reply.html?Action=Comment&DefaultStatus=rejected&ClearRestrictions=1&id=".$id."&All=1",
-		
-		title => loc('Abandon') };
-	}
-	if ( $Ticket->Status ne 'open' && $Ticket->Status ne 'new' ) {
-	    $actions->{'C'} = { path => "RTIR/Display.html?Status=open&id=" . $id,
-				title => loc('Open') };
-	}
-    }
-    
-    if ( $Ticket->CurrentUserHasRight('OwnTicket') &&
-	 $Ticket->Status ne 'resolved' &&
-	 $Ticket->Status ne 'rejected') {
-	if ( $Ticket->OwnerObj->id == $RT::Nobody->id ) {
-	    $actions->{'D'} = { path => "RTIR/Display.html?Action=Take&id=" . $id,
-				title => loc('Take') };
-	}
-	elsif ( $Ticket->OwnerObj->id != $session{CurrentUser}->id ) {
-	    $actions->{'E'} = {path => "RTIR/Display.html?Action=Steal&id=" . $id,
-			       title => loc('Steal') };
-	}
-    }
-    
-    if (    $Ticket->CurrentUserHasRight('ModifyTicket')
-	    or $Ticket->CurrentUserHasRight('CommentOnTicket') ) {
-	$actions->{'F'} = { title => loc('Comment'),
-			    path  => "RTIR/Update.html?Action=Comment&id=" . $id,
-			};
-    }
-}
-
-$tabs->{"A"} = { path      => 'RTIR/Create.html?Queue=Incidents',
-                 title     => loc('New Incident') };
-$tabs->{"g"} = { path      => 'RTIR/Listing.html?NewSearch=1&Queue=Incidents',
-                 title     => loc('Search'),
-                 separator => 1,
-                 subtabs   => $searchtabs };
-</%INIT>
-
-  
-<%ARGS>
-$Ticket => undef
-$subtabs => undef
-$current_tab => undef
-$current_subtab => undef
-$Title => undef
-</%ARGS>

Modified: rtir/branches/1.1/html/RTIR/Investigation/Elements/Tabs
==============================================================================
--- rtir/branches/1.1/html/RTIR/Investigation/Elements/Tabs	(original)
+++ rtir/branches/1.1/html/RTIR/Investigation/Elements/Tabs	Wed Aug 18 22:30:45 2004
@@ -22,141 +22,8 @@
 %# 
 %# 
 %# END LICENSE BLOCK
-<& /Elements/Callback, Page => '/Ticket/Elements/Tabs', Ticket => $Ticket, actions=> $actions, tabs => $tabs, %ARGS &>
-<& /RTIR/Elements/Tabs, 
-    tabs => $tabs, 
-    actions => $actions, 
-    current_toptab => $current_toptab,
-    current_tab => $mytab,
-    current_subtab => $current_subtab,
-    Title => $Title &> 
-<%INIT>
+<& /RTIR/Elements/QueueTabs, 
+    QueueName => 'Investigations',
+    %ARGS
+&> 
 
-my $tabs = {};
-my $current_toptab = "RTIR/Listing.html?NewSearch=1&Queue=Investigations",
-my ($actions, $mytab);
-my $searchtabs = { };
-
-if ( $Ticket) {
-	
-my $id   = $Ticket->id();
-$mytab = "RTIR/Display.html?id=".$id;
-
-if ( defined $session{'tickets'} ) {
-
-my $item_map = $session{'tickets'}->ItemMap;
-
-            # Don't $current_toptab = display prev links if we're on the first ticket
-
-        if ($item_map->{$Ticket->Id}->{prev}) {
-                $searchtabs->{'_a'} = {
-                            class => "nav",
-                            path => "RTIR/Display.html?id=" . $item_map->{first},
-                            title => '<< ' . loc('First') };
-                $searchtabs->{"_b"} = { class => "nav",
-                            path => "RTIR/Display.html?id=" . $item_map->{$Ticket->Id}->{prev},
-                                  title => '< ' . loc('Prev') };
-       } 
-
-
-        # Don't display next links if we're on the last ticket
-        if ($item_map->{$Ticket->Id}->{next}) {
-            $searchtabs->{'d'} = { class => "nav",
-                            path => "RTIR/Display.html?id=" . $item_map->{$Ticket->Id}->{next},
-                             title => loc('Next') . ' >' };
-            $searchtabs->{'e'} = {
-                           class => "nav",
-                           path => "RTIR/Display.html?id=" . $item_map->{last},
-                           title => loc('Last') . ' >>' };
-        }
-}
-
-$tabs->{"this"} = { class => "currentnav",
-                    path  => "RTIR/Display.html?id=" . $Ticket->id,
-                    title => loc("Investigation #[_1]", $id),
-                    current_subtab => $current_subtab };
-
-my $ticket_page_tabs = {
-    _A => { title => loc('Display'),
-            path  => "RTIR/Display.html?id=" . $id, },
-};
-
-# only show edit option if they can do it
-if ($Ticket->CurrentUserHasRight('ModifyTicket')) {
-    $ticket_page_tabs->{'_B'} = { title => loc('Edit'),
-            path  => "RTIR/Edit.html?id=" . $id, };
-
-    $ticket_page_tabs->{'_C'} = { title => loc('Split'),
-            path  => "RTIR/Split.html?Ticket=" . $id, };
-
-    $ticket_page_tabs->{'_D'} = { title => loc('Merge'),
-            path  => "RTIR/Merge.html?NewSearch=1&id=" . $id,
-	    separator => 1 };
-}
-
-foreach my $tab ( sort keys %{$ticket_page_tabs} ) {
-    if ( $ticket_page_tabs->{$tab}->{'path'} eq $current_tab ) {
-        $ticket_page_tabs->{$tab}->{"subtabs"}        = $subtabs;
-        $tabs->{'this'}->{"current_subtab"}        = 
-        $ticket_page_tabs->{$tab}->{"path"};
-    }
-}
-$tabs->{'this'}->{"subtabs"} = $ticket_page_tabs;
-
-if (    $Ticket->CurrentUserHasRight('ModifyTicket')
-     or $Ticket->CurrentUserHasRight('ReplyToTicket') ) {
-    $actions->{'A'} = { title => loc('Reply'),
-                        path  => "RTIR/Update.html?Action=Respond&DefaultStatus=open&id=" . $id,
-    };
-}
-
-if ( $Ticket->CurrentUserHasRight('ModifyTicket') ) {
-    if ( $Ticket->Status ne 'resolved' ) {
-        $actions->{'B'} = {
-
-            path =>
-              "RTIR/Update.html?Action=Comment&DefaultStatus=resolved&id=" . $id,
-            title => loc('Resolve') };
-    }
-    if ( $Ticket->Status ne 'open' ) {
-        $actions->{'C'} = { path => "RTIR/Display.html?Status=open&id=" . $id,
-                            title => loc('Open it') };
-    }
-}
-
-if ( $Ticket->CurrentUserHasRight('OwnTicket') ) {
-    if ( $Ticket->OwnerObj->id == $RT::Nobody->id ) {
-        $actions->{'D'} = { path => "RTIR/Display.html?Action=Take&id=" . $id,
-                            title => loc('Take') };
-    }
-    elsif ( $Ticket->OwnerObj->id != $session{CurrentUser}->id ) {
-        $actions->{'E'} = {path => "RTIR/Display.html?Action=Steal&id=" . $id,
-                           title => loc('Steal') };
-    }
-}
-
-if (    $Ticket->CurrentUserHasRight('ModifyTicket')
-     or $Ticket->CurrentUserHasRight('CommentOnTicket') ) {
-    $actions->{'F'} = { title => loc('Comment'),
-                        path  => "RTIR/Update.html?Action=Comment&id=" . $id,
-    };
-}
-} else {
-  $mytab = $current_tab;
-}
-
-
-$tabs->{"g"} = { path      => 'RTIR/Listing.html?NewSearch=1&Queue=Investigations',
-                 title     => loc('Search'),
-                 separator => 1,
-                 subtabs   => $searchtabs };
-</%INIT>
-
-  
-<%ARGS>
-$Ticket => undef
-$subtabs => undef
-$current_tab => undef
-$current_subtab => undef
-$Title => undef
-</%ARGS>

Modified: rtir/branches/1.1/html/RTIR/Report/Elements/Tabs
==============================================================================
--- rtir/branches/1.1/html/RTIR/Report/Elements/Tabs	(original)
+++ rtir/branches/1.1/html/RTIR/Report/Elements/Tabs	Wed Aug 18 22:30:45 2004
@@ -22,168 +22,8 @@
 %# 
 %# 
 %# END LICENSE BLOCK
-<& /Elements/Callback, Page => '/Ticket/Elements/Tabs', Ticket => $Ticket, actions=> $actions, tabs => $tabs, %ARGS &>
-<& /RTIR/Elements/Tabs, 
-    tabs => $tabs, 
-    actions => $actions, 
-    current_toptab => $current_toptab,
-    current_tab => $mytab,
-    current_subtab => $current_subtab,
-    Title => $Title,
-    QueryString => $QueryString,
+<& /RTIR/Elements/QueueTabs, 
+    QueueName => 'Incident Reports',
+    %ARGS
 &> 
 
-<%INIT>
-
-my $tabs = {};
-my $current_toptab = 'RTIR/Search/Results.html?Queue=Incident Reports' . $QueryString,
-my ($actions, $mytab);
-my $searchtabs = { } ;
-
-if ( $Ticket) {
-	
-    my $id   = $Ticket->id();
-    $mytab = "RTIR/Display.html?id=".$id;
-
-    if ( defined $session{'tickets'} ) {
-	
-	my $item_map = $session{'tickets'}->ItemMap;
-	
-	# Don't display prev links if we're on the first ticket
-	
-        if ($item_map->{$Ticket->Id}->{prev}) {
-	    $searchtabs->{'_a'} = {
-		class => "nav",
-		path => "RTIR/Display.html?id=" . $item_map->{first},
-		title => '<< ' . loc('First') };
-	    $searchtabs->{"_b"} = { class => "nav",
-				    path => "RTIR/Display.html?id=" . $item_map->{$Ticket->Id}->{prev},
-				    title => '< ' . loc('Prev') };
-	} 
-	
-	
-        # Don't display next links if we're on the last ticket
-        if ($item_map->{$Ticket->Id}->{next}) {
-            $searchtabs->{'d'} = { class => "nav",
-				   path => "RTIR/Display.html?id=" . $item_map->{$Ticket->Id}->{next},
-				   title => loc('Next') . ' >' };
-            $searchtabs->{'e'} = {
-		class => "nav",
-		path => "RTIR/Display.html?id=" . $item_map->{last},
-		title => loc('Last') . ' >>' };
-        }
-    }
-    
-    $tabs->{"this"} = { class => "currentnav",
-			path  => "RTIR/Display.html?id=" . $Ticket->id,
-			title => loc("Incident Report #[_1]", $id),
-			current_subtab => $current_subtab };
-    
-    my $ticket_page_tabs = {
-	_A => { title => loc('Display'),
-		path  => "RTIR/Display.html?id=" . $id, },
-    };
-
-# only show edit option if they can do it
-if ($Ticket->CurrentUserHasRight('ModifyTicket')) {
-    $ticket_page_tabs->{'_B'} = { title => loc('Edit'),
-            path  => "RTIR/Edit.html?id=" . $id, };
-
-    $ticket_page_tabs->{'_C'} = { title => loc('Split'),
-            path  => "RTIR/Split.html?Ticket=" . $id, };
-
-    $ticket_page_tabs->{'_D'} = { title => loc('Merge'),
-            path  => "RTIR/Merge.html?NewSearch=1&id=" . $id,
-	    separator => 1 };
-}
-
-foreach my $tab ( sort keys %{$ticket_page_tabs} ) {
-    if ( $ticket_page_tabs->{$tab}->{'path'} eq $current_tab ) {
-        $ticket_page_tabs->{$tab}->{"subtabs"}        = $subtabs;
-        $tabs->{'this'}->{"current_subtab"}        = 
-        $ticket_page_tabs->{$tab}->{"path"};
-    }
-}
-$tabs->{'this'}->{"subtabs"} = $ticket_page_tabs;
-
-if (    $Ticket->CurrentUserHasRight('ModifyTicket')
-     or $Ticket->CurrentUserHasRight('ReplyToTicket') ) {
-    $actions->{'A'} = { title => loc('Reply'),
-                        path  => "RTIR/Update.html?Action=Respond&DefaultStatus=stalled&id=" . $id,
-    };
-}
-
-if ( $Ticket->CurrentUserHasRight('ModifyTicket') ) {
-    if ( $Ticket->Status ne 'resolved' and $Ticket->Status ne 'rejected' ) {
-	my $state = $m->scomp("/RTIR/Elements/ShowRTIRField", 
-		      Ticket => $Ticket, Name => 'State');
-	$state =~ s/\s+$//;
-	if ($state ne 'new') {
-	    $actions->{'Ac'} = {
-
-		path =>
-		    "RTIR/Update.html?Action=Comment&DefaultStatus=resolved&id=" . $id,
-		    title => loc('Resolve') };
-	}
-        $actions->{'B'} = { path => "RTIR/Display.html?Status=rejected&id=" . $id,
-                            title => loc('Quick Reject') };
-        $actions->{'Bb'} = {
-
-            path =>
-              "RTIR/Update.html?Action=Comment&DefaultStatus=rejected&id=" . $id,
-            title => loc('Reject') };
-    }
-    if ( $Ticket->Status eq 'resolved' or $Ticket->Status eq 'rejected' ) {
-        $actions->{'C'} = { path => "RTIR/Display.html?Status=open&id=" . $id,
-                            title => loc('Open it') };
-    }
-}
-
-if ( $Ticket->CurrentUserHasRight('OwnTicket') ) {
-    if ( $Ticket->OwnerObj->id == $RT::Nobody->id ) {
-        $actions->{'D'} = { path => "RTIR/Display.html?Action=Take&id=" . $id,
-                            title => loc('Take') };
-    }
-    elsif ( $Ticket->OwnerObj->id != $session{CurrentUser}->id ) {
-        $actions->{'E'} = {path => "RTIR/Display.html?Action=Steal&id=" . $id, 
-                           title => loc('Steal') };
-    }
-}
-
-if (    $Ticket->CurrentUserHasRight('ModifyTicket')
-     or $Ticket->CurrentUserHasRight('CommentOnTicket') ) {
-    $actions->{'F'} = { title => loc('Comment'),
-                        path  => "RTIR/Update.html?Action=Comment&id=" . $id,
-    };
-}
-} else {
-  $mytab = $current_tab;
-}
-
-$tabs->{"A"} = { path      => 'RTIR/Create.html?Queue=Incident Reports',
-                 title     => loc('New Incident Report') };
-$tabs->{"e"} = { path      => 'RTIR/Search/Build.html?Queue=Incident Reports&NewQuery=1',
-                 title     => loc('New Query'),
-                 subtabs   => $searchtabs };
-$tabs->{"f"} = { path      => 'RTIR/Search/Build.html?Queue=Incident Reports' . $QueryString,
-                 title     => loc('Query Builder'),
-                 separator => 1,
-                 subtabs   => $searchtabs };
-$tabs->{"g"} = { path      => 'RTIR/Search/Results.html?Queue=Incident Reports' . $QueryString,
-                 title     => loc('Results'),
-                 separator => 1,
-                 subtabs   => $searchtabs };
-$tabs->{"h"} = { path      => 'RTIR/Report/BulkReject.html?ClearRestrictions=1',
-                 title     => loc('Bulk Reject'),
-                 separator => 1 };
-</%INIT>
-
-  
-<%ARGS>
-$Ticket => undef
-$subtabs => undef
-$current_tab => undef
-$current_subtab => undef
-$Title => undef
-$QueryString =>undef
-</%ARGS>


More information about the Rt-commit mailing list