]> git.uio.no Git - usit-rt.git/blob - share/html/Admin/Scrips/Objects.html
Putting 4.2.0 on top of 4.0.17
[usit-rt.git] / share / html / Admin / Scrips / Objects.html
1 %# BEGIN BPS TAGGED BLOCK {{{
2 %#
3 %# COPYRIGHT:
4 %#
5 %# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
6 %#                                          <sales@bestpractical.com>
7 %#
8 %# (Except where explicitly superseded by other copyright notices)
9 %#
10 %#
11 %# LICENSE:
12 %#
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
16 %# from www.gnu.org.
17 %#
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.
22 %#
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.
28 %#
29 %#
30 %# CONTRIBUTION SUBMISSION POLICY:
31 %#
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.)
37 %#
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.
46 %#
47 %# END BPS TAGGED BLOCK }}}
48 <& /Admin/Elements/Header, Title => $title &>
49 <& /Elements/Tabs &>
50 <& /Elements/ListActions &>
51
52 <form action="Objects.html" method="post" name="AddRemoveScrip">
53 <input type="hidden" class="hidden" name="id" value="<% $id %>" />
54
55 % if ( $global ) {
56 <h2><&|/l&>Applies to all objects</&></h2>
57 <label>
58 <input type="checkbox" name="RemoveScrip-<% $id %>" value="0" />
59 <&|/l&>check this box to remove this scrip from all objects and be able to choose specific objects.</&>
60 </label>
61
62 <& /Admin/Elements/SelectStageForAdded,
63     Default => $Stage || $global->Stage,
64     Label   => loc("Select global scrip stage:")
65     &>
66 % } else {
67 <h2><&|/l&>Apply globally</&></h2>
68
69 <label>
70 <input type="checkbox" name="AddScrip-<% $id %>" value="0" />
71 <&|/l&>check this box to apply this scrip to all objects.</&>
72 </label>
73
74 <h2><&|/l&>Selected objects</&></h2>
75 <& /Elements/CollectionList,
76     OrderBy => 'id',
77     Order => 'ASC',
78     %ARGS,
79     Collection => $added,
80     Rows => 0,
81     Page => 1,
82     Format        => $format,
83     DisplayFormat => "'__CheckBox.{RemoveScrip-$id}__','__ScripStage.{$id}__',". $format,
84     AllowSorting => 0,
85     ShowEmpty    => 0,
86     PassArguments => [
87         qw(id Stage Format Rows Page Order OrderBy),
88     ],
89 &>
90
91 <h2><&|/l&>Unselected objects</&></h2>
92 <& /Elements/CollectionList,
93     OrderBy => 'Name',
94     Order   => 'ASC',
95     %ARGS,
96     Collection    => $not_added,
97     Rows          => 50,
98     Format        => $format,
99     DisplayFormat => "'__CheckBox.{AddScrip-". $id ."}__',". $format,
100     AllowSorting  => 1,
101     ShowEmpty     => 0,
102     PassArguments => [
103         qw(id Stage Format Rows Page Order OrderBy),
104     ],
105 &>
106
107 <& /Admin/Elements/SelectStageForAdded, Default => $Stage &>
108 <div style="text-align:right">
109 <% loc('You can change template if needed') %>:
110 <& Elements/SelectTemplate, Scrip => $scrip, Default => $Template &>
111 </div>
112
113 % }
114
115 <& /Elements/Submit, Name => 'Update' &>
116 </form>
117
118 <%ARGS>
119 $id => undef
120 $Stage => undef
121 $Template => ''
122 $Update => 0
123 </%ARGS>
124 <%INIT>
125 my $scrip = RT::Scrip->new( $session{'CurrentUser'} );
126 $scrip->Load($id) or Abort(loc("Could not load scrip #[_1]", $id));
127 $id = $scrip->id;
128
129 my $global = $scrip->IsGlobal;
130
131 if ( $Update ) {
132     my (@results);
133     if ( $Template ) {
134         my ($status, $msg) = $scrip->SetTemplate( $Template );
135         push @results, loc('Template: [_1]', $msg);
136     }
137     if ( defined (my $del = $ARGS{"RemoveScrip-$id"}) ) {
138         foreach my $id ( ref $del? (@$del) : ($del) ) {
139             my ($status, $msg) = $scrip->RemoveFromObject( $id );
140             push @results, $msg;
141         }
142     }
143     if ( defined (my $add = $ARGS{"AddScrip-$id"}) ) {
144         foreach my $id ( ref $add? (@$add) : ($add) ) {
145             my ($status, $msg) = $scrip->AddToObject( $id, Stage => $Stage );
146             push @results, $msg;
147         }
148     }
149     if ($global and $global->Stage ne $Stage) {
150         my ($status, $msg) = $global->SetStage($Stage);
151         push @results, $msg;
152     }
153     MaybeRedirectForResults(
154         Actions   => \@results,
155         Arguments => { id => $id },
156     );
157 }
158
159 my $added = $scrip->AddedTo;
160 my $not_added = $scrip->NotAddedTo;
161
162 my $format = RT->Config->Get('AdminSearchResultFormat')->{'Queues'};
163
164 my $title = loc('Modify associated objects for scrip #[_1]', $id);
165
166 </%INIT>