1 %# BEGIN BPS TAGGED BLOCK {{{
5 %# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC
6 %# <sales@bestpractical.com>
8 %# (Except where explicitly superseded by other copyright notices)
13 %# This work is made available to you under the terms of Version 2 of
14 %# the GNU General Public License. A copy of that license should have
15 %# been provided with this software, but in any event can be snarfed
18 %# This work is distributed in the hope that it will be useful, but
19 %# WITHOUT ANY WARRANTY; without even the implied warranty of
20 %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 %# General Public License for more details.
23 %# You should have received a copy of the GNU General Public License
24 %# along with this program; if not, write to the Free Software
25 %# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 %# 02110-1301 or visit their web page on the internet at
27 %# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
30 %# CONTRIBUTION SUBMISSION POLICY:
32 %# (The following paragraph is not intended to limit the rights granted
33 %# to you to modify and distribute this software under the terms of
34 %# the GNU General Public License and is only of importance to you if
35 %# you choose to contribute your changes and enhancements to the
36 %# community by submitting them to Best Practical Solutions, LLC.)
38 %# By intentionally submitting any modifications, corrections or
39 %# derivatives to this work, or any other work intended for use with
40 %# Request Tracker, to Best Practical Solutions, LLC, you confirm that
41 %# you are the copyright holder for those contributions and you grant
42 %# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
43 %# royalty-free, perpetual, license to use, copy, create derivative
44 %# works based on those contributions, and sublicense and distribute
45 %# those contributions and any derivatives thereof.
47 %# END BPS TAGGED BLOCK }}}
56 title => 'Queue', # loc
58 return $_[0]->loc('Global') if $_[0]->IsGlobal;
59 return join(", ", map {$_->Name} @{$_[0]->AddedTo->ItemsArrayRef});
63 title => 'Queue', # loc
65 return 0 if $_[0]->IsGlobal;
66 return join(", ", map {$_->Id} @{$_[0]->AddedTo->ItemsArrayRef});
72 my $request_path = $HTML::Mason::Commands::r->path_info;
73 my $queue_id = $m->request_args->{'id'};
74 if ( $request_path =~ m{/Admin/Queues/Scrips\.html} and $queue_id ) {
75 return '&From=' . $queue_id;
76 } elsif ( $request_path =~ m{/Admin/Global/Scrips\.html} ) {
77 return '&From=Global';
85 title => 'Condition', # loc
86 value => sub { return $_[0]->loc( $_[0]->ScripConditionObj->Name ) },
89 title => 'Action', # loc
90 value => sub { return $_[0]->loc( $_[0]->ScripActionObj->Name ) },
93 title => 'Template', # loc
94 value => sub { return $_[0]->loc( $_[0]->Template ) },
97 title => 'Condition, Action and Template', # loc
98 value => sub { return $_[0]->loc( "[_1] [_2] with template [_3]",
99 $_[0]->loc($_[0]->ConditionObj->Name),
100 $_[0]->loc($_[0]->ActionObj->Name),
101 $_[0]->loc($_[0]->Template),
105 title => 'Description', # loc
106 attribute => 'Description',
107 value => sub { return $_[0]->Description() },
110 title => 'Status', # loc
111 attribute => 'Disabled',
112 value => sub { return $_[0]->Disabled? $_[0]->loc('Disabled'): $_[0]->loc('Enabled') },
116 my $name = 'RemoveScrip';
117 my $checked = $m->request_args->{ $name .'All' }? 'checked="checked"': '';
119 return \qq{<input type="checkbox" name="${name}All" value="1" $checked
120 onclick="setCheckbox(this, '$name')" />};
124 return '' if $_[0]->IsGlobal;
126 my $name = 'RemoveScrip';
127 my $arg = $m->request_args->{ $name };
130 if ( $arg && ref $arg ) {
131 $checked = 'checked="checked"' if grep $_ == $id, @$arg;
134 $checked = 'checked="checked"' if $arg == $id;
136 return \qq{<input type="checkbox" name="$name" value="$id" $checked />}
140 title => 'Move', # loc
144 my $context = $_[2] || 0;
145 return '' unless $_[0]->IsAdded( $context );
147 my $name = 'MoveScrip';
148 my $args = $m->caller_args( 1 );
149 my @pass = ref $args->{'PassArguments'}
150 ? @{$args->{'PassArguments'}}
151 : ($args->{'PassArguments'});
152 my %pass = map { $_ => $args->{$_} } grep exists $args->{$_}, @pass;
154 my $uri = RT->Config->Get('WebPath') . $m->request_path;
158 $uri .'?'. $m->comp("/Elements/QueryString", %pass, MoveScripUp => $id ),
159 \'">', loc('[Up]'), \'</a>',
161 $uri .'?'. $m->comp("/Elements/QueryString", %pass, MoveScripDown => $id ),
162 \'">', loc('[Down]'), \'</a>'
169 title => 'Stage', # loc
171 my $os = RT::ObjectScrip->new( $_[0]->CurrentUser );
172 my $id = $_[0]->IsGlobal ? 0 : $_[-1];
173 $os->LoadByCols( Scrip => $_[0]->id, ObjectId => $id );
174 return $_[0]->loc( $os->FriendlyStage );
181 $m->callback( GenericMap => $GenericMap, COLUMN_MAP => $COLUMN_MAP, CallbackName => 'ColumnMap', CallbackOnce => 1 );
182 return GetColumnMapEntry( Map => $COLUMN_MAP, Name => $Name, Attribute => $Attr );