[Rt-commit] rt branch, 4.2/add-scrips-menu, created. rt-4.2.3-64-gd870d4b
Wallace Reis
wreis at bestpractical.com
Fri Mar 28 11:36:42 EDT 2014
The branch, 4.2/add-scrips-menu has been created
at d870d4be66a1003c9610944ed8b2d388908730c7 (commit)
- Log -----------------------------------------------------------------
commit d870d4be66a1003c9610944ed8b2d388908730c7
Author: Wallace Reis <wreis at bestpractical.com>
Date: Thu Mar 13 18:01:44 2014 -0300
I#28787: Add Scrips menu
Add Scrips menu with 'Select' and 'Create' options. The 'Select' opt
defaults to Admin/Scrips path unless the user comes from Global or
Queue's Scrips listing page. The 'Create' one points to the same place
for all cases.
diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 8ebb13b..3788ba8 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -2945,6 +2945,16 @@ Set(%AdminSearchResultFormat,
.q{,'<a href="__WebPath__/Admin/CustomFields/Modify.html?id=__id__">__Name__</a>/TITLE:Name'}
.q{,__AddedTo__, __FriendlyType__, __FriendlyPattern__},
+ QueueScrips =>
+ q{'<a href="__WebPath__/Admin/Scrips/Modify.html?id=__id____FromQueueId__">__id__</a>/TITLE:#'}
+ .q{,'<a href="__WebPath__/Admin/Scrips/Modify.html?id=__id____FromQueueId__">__Description__</a>/TITLE:Description'}
+ .q{,__Condition__, __Action__, __Template__, __Disabled__},
+
+ GlobalScrips =>
+ q{'<a href="__WebPath__/Admin/Scrips/Modify.html?id=__id__&FromGlobal=1">__id__</a>/TITLE:#'}
+ .q{,'<a href="__WebPath__/Admin/Scrips/Modify.html?id=__id__&FromGlobal=1">__Description__</a>/TITLE:Description'}
+ .q{,__Condition__, __Action__, __Template__, __Disabled__},
+
Scrips =>
q{'<a href="__WebPath__/Admin/Scrips/Modify.html?id=__id__">__id__</a>/TITLE:#'}
.q{,'<a href="__WebPath__/Admin/Scrips/Modify.html?id=__id__">__Description__</a>/TITLE:Description'}
diff --git a/share/html/Admin/Elements/EditScrips b/share/html/Admin/Elements/EditScrips
index c13f687..39a5c16 100644
--- a/share/html/Admin/Elements/EditScrips
+++ b/share/html/Admin/Elements/EditScrips
@@ -120,7 +120,14 @@ my $find_scrips = sub {
return $scrips;
};
-$Format ||= RT->Config->Get('AdminSearchResultFormat')->{'Scrips'};
+my $request_path = $HTML::Mason::Commands::r->path_info;
+if ( $request_path =~ /queue/i ) {
+ $Format ||= RT->Config->Get('AdminSearchResultFormat')->{'QueueScrips'};
+} elsif ( $request_path =~ /global/i ) {
+ $Format ||= RT->Config->Get('AdminSearchResultFormat')->{'GlobalScrips'};
+} else {
+ $Format ||= RT->Config->Get('AdminSearchResultFormat')->{'Scrips'};
+}
my $DisplayFormat = $Format;
if ( $id ) {
$DisplayFormat = "__RemoveCheckBox__, $DisplayFormat";
diff --git a/share/html/Elements/RT__Scrip/ColumnMap b/share/html/Elements/RT__Scrip/ColumnMap
index b6b3348..ea7ad8b 100644
--- a/share/html/Elements/RT__Scrip/ColumnMap
+++ b/share/html/Elements/RT__Scrip/ColumnMap
@@ -66,6 +66,18 @@ my $COLUMN_MAP = {
return join(", ", map {$_->Id} @{$_[0]->AddedTo->ItemsArrayRef});
},
},
+ FromQueueId => {
+ title => 'Queue', # loc
+ value => sub {
+ my $queue_id = $m->request_args->{'id'};
+ if ( $queue_id ) {
+ return '&FromQueueId=' . $queue_id;
+ }
+ else {
+ return q{};
+ }
+ },
+ },
Condition => {
title => 'Condition', # loc
value => sub { return $_[0]->loc( $_[0]->ScripConditionObj->Name ) },
diff --git a/share/html/Elements/Tabs b/share/html/Elements/Tabs
index 0b3a50e..fd9876e 100644
--- a/share/html/Elements/Tabs
+++ b/share/html/Elements/Tabs
@@ -380,6 +380,23 @@ my $build_admin_menu = sub {
$obj->Load($id);
my $tabs = PageMenu();
+
+ my ( $admin_cat, $create_path_arg ) = ( q{}, q{} );
+ my ($from_queue) = $DECODED_ARGS->{'FromQueueId'} && $DECODED_ARGS->{'FromQueueId'} =~ /^(\d+)$/;
+ if ( $from_queue ) {
+ $admin_cat .= "Queues/Scrips.html?id=$from_queue";
+ $create_path_arg = '?Queue=1';
+ }
+ elsif ( $DECODED_ARGS->{'FromGlobal'} ) {
+ $admin_cat .= 'Global/Scrips.html';
+ }
+ else {
+ $admin_cat .= 'Scrips';
+ }
+ my $scrips = $tabs->child( scrips => title => loc('Scrips'), path => "/Admin/${admin_cat}" );
+ $scrips->child( select => title => loc('Select'), path => "/Admin/${admin_cat}" );
+ $scrips->child( create => title => loc('Create'), path => "/Admin/Scrips/Create.html${create_path_arg}" );
+
$tabs->child( basics => title => loc('Basics') => path => "/Admin/Scrips/Modify.html?id=".$id );
$tabs->child( 'applies-to' => title => loc('Applies to'), path => "/Admin/Scrips/Objects.html?id=" . $id );
}
-----------------------------------------------------------------------
More information about the rt-commit
mailing list