]> git.uio.no Git - usit-rt.git/blame_incremental - share/html/Admin/Queues/Modify.html
Master to 4.2.8
[usit-rt.git] / share / html / Admin / Queues / Modify.html
... / ...
CommitLineData
1%# BEGIN BPS TAGGED BLOCK {{{
2%#
3%# COPYRIGHT:
4%#
5%# This software is Copyright (c) 1996-2014 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, actions => \@results &>
51
52
53
54<form action="<%RT->Config->Get('WebPath')%>/Admin/Queues/Modify.html" name="ModifyQueue" method="post" enctype="multipart/form-data">
55<input type="hidden" class="hidden" name="id" value="<% $Create? 'new': $QueueObj->Id %>" />
56
57<table>
58<tr><td align="right"><&|/l&>Queue Name</&>:</td><td colspan="3">
59% if ($InternalQueue) {
60<% $QueueObj->Name %>
61% } else {
62<input name="Name" value="<% $Create ? "" : $QueueObj->Name || $Name %>" />
63% }
64</td></tr>
65
66<tr><td align="right"><&|/l&>Description</&>:</td>
67<td colspan="3"><input name="Description" value="<% $Create ? "" : $QueueObj->Description || $Description || '' %>" size="60" /></td>
68</tr>
69
70<tr><td align="right"><&|/l&>Lifecycle</&>:</td><td colspan="3">
71% if ($InternalQueue) {
72<% $QueueObj->Lifecycle %>
73% } else {
74<& /Widgets/Form/Select:InputOnly,
75 Name => 'Lifecycle',
76 Values => [ sort { loc($a) cmp loc($b) } RT::Lifecycle->List ],
77 CurrentValue => $Create ? "default" : $QueueObj->Lifecycle || $ARGS{'Lifecycle'},
78 Default => 0,
79&>
80% }
81</td></tr>
82
83<tr><td align="right"><&|/l&>Subject Tag</&>:</td>
84<td colspan="3"><input name="SubjectTag" value="<% $ARGS{'SubjectTag'} || ($Create ? "" : $QueueObj->SubjectTag || '' ) %>" size="60" /></td>
85</tr>
86
87<tr><td align="right"><&|/l&>Reply Address</&>:</td>
88<td><input name="CorrespondAddress" value="<% $Create ? "" : $QueueObj->CorrespondAddress || $CorrespondAddress || '' %>" />
89<br /><span><em><&|/l , RT->Config->Get('CorrespondAddress')&>(If left blank, will default to [_1])</&></em></span></td>
90<td align="right"><&|/l&>Comment Address</&>:</td>
91<td><input name="CommentAddress" value="<% $Create ? "" : $QueueObj->CommentAddress || $CommentAddress || '' %>" />
92<br /><span><em><&|/l , RT->Config->Get('CommentAddress')&>(If left blank, will default to [_1])</&></em></span></td>
93</tr>
94
95<tr><td align="right"><&|/l&>Priority starts at</&>:</td>
96<td><& /Elements/SelectPriority,
97 Name => "InitialPriority",
98 Default => $Create? 0: $QueueObj->InitialPriority || $InitialPriority,
99&></td>
100<td align="right"><&|/l&>Over time, priority moves toward</&>:</td>
101<td><& /Elements/SelectPriority,
102 Name => "FinalPriority",
103 Default => $Create? 0: $QueueObj->FinalPriority || $FinalPriority,
104&><br /><span><em><&|/l&>requires running rt-crontool</&></em></span></td>
105</tr>
106
107<tr><td align="right"><&|/l&>Requests should be due in</&>:</td>
108<td colspan="3"><input name="DefaultDueIn" value="<% ($Create) ? "" : $QueueObj->DefaultDueIn || $DefaultDueIn || "" %>" /> <&|/l&>days</&>.</td>
109</tr>
110
111% my $CFs = $QueueObj->CustomFields;
112% while (my $CF = $CFs->Next) {
113<tr valign="top"><td align="right">
114<% $CF->Name %>:
115</td><td>
116<& /Elements/EditCustomField, CustomField => $CF,
117 Object => $QueueObj, &>
118</td></tr>
119% }
120
121% if ( RT->Config->Get('Crypt')->{'Enable'} ) {
122<tr><td align="right"><input type="checkbox" class="checkbox" id="Sign" name="Sign" value="1" <% $QueueObj->Sign? 'checked="checked"': '' |n%> /></td>
123<td><label for="Sign"><&|/l&>Sign by default</&></label></td>
124<td align="right"><input type="checkbox" class="checkbox" id="Encrypt" name="Encrypt" value="1" <% $QueueObj->Encrypt? 'checked="checked"': '' |n%> /></td>
125<td><label for="Encrypt"><&|/l&>Encrypt by default</&></label></td>
126</tr>
127<tr><td align="right"><input type="checkbox" class="checkbox" name="SignAuto" value="1" <% $QueueObj->SignAuto? 'checked="checked"': '' |n%> /></td>
128<td colspan="3"><&|/l_unsafe, "<b>","</b>","<i>","</i>"&>Sign all auto-generated mail. [_1]Caution[_2]: Enabling this option alters the signature from providing [_3]authentication[_4] to providing [_3]integrity[_4].</&></td></tr>
129% }
130
131% unless ($InternalQueue) {
132<tr><td align="right"><input type="checkbox" class="checkbox" id="Enabled" name="Enabled" value="1" <%$EnabledChecked|n%> /></td>
133<td colspan="3"><label for="Enabled"><&|/l&>Enabled (Unchecking this box disables this queue)</&></label><br />
134<input type="hidden" class="hidden" name="SetEnabled" value="1" />
135% $m->callback( %ARGS, QueueObj => $QueueObj, results => \@results );
136</td></tr>
137% }
138
139% if ( RT->Config->Get('Crypt')->{'Enable'} ) {
140<tr><td colspan="4">
141<input type="hidden" class="hidden" name="SetCrypt" value="1" />
142% if ( my $email = $QueueObj->CorrespondAddress || RT->Config->Get('CorrespondAddress') ) {
143<& /Admin/Elements/ShowKeyInfo, Type => 'private', EmailAddress => $email &>
144% } else {
145<&|/Widgets/TitleBox, title => loc( 'Private keys') &>
146<i><&|/l&>You have enabled encryption support but have not set a correspondence address for this queue.</&>
147<&|/l&>You must set a correspondence address for this queue in order to configure a private key.</&></i>
148</&>
149% }
150</td></tr>
151<tr><td colspan="4">
152% if ( my $email = $QueueObj->CommentAddress || RT->Config->Get('CommentAddress') ) {
153<& /Admin/Elements/ShowKeyInfo, Type => 'private', EmailAddress => $email &>
154% } else {
155<&|/Widgets/TitleBox, title => loc( 'Private keys') &>
156<i><&|/l&>You have enabled encryption support but have not set a comment address for this queue.</&>
157<&|/l&>You must set a comment address for this queue in order to configure a private key.</&></i>
158</&>
159%}
160</td></tr>
161% }
162
163</table>
164% if ( $Create ) {
165<& /Elements/Submit, Label => loc('Create') &>
166% } else {
167<& /Elements/Submit, Label => loc('Save Changes') &>
168% }
169</form>
170
171
172
173<%INIT>
174my ($title, @results, @no_redirect_results, $Disabled, $EnabledChecked);
175my $QueueObj = RT::Queue->new( $session{'CurrentUser'} );
176$QueueObj->Load( $id ) if !$id || $id eq 'new';
177
178$EnabledChecked = 'checked="checked"';
179
180unless ($Create) {
181 if ( defined $id && $id eq 'new' ) {
182 my ($val, $msg) = $QueueObj->Create( Name => $Name );
183 if (!$val) {
184 $Create = 1; # Create failed, so bring us back to step 1
185 }
186 push @results, $msg;
187 } else {
188 $QueueObj->Load($id) || $QueueObj->Load($Name) || Abort(loc("Couldn't load queue '[_1]'", $Name));
189 }
190}
191
192if ( $QueueObj->Id ) {
193 $title = loc('Configuration for queue [_1]', $QueueObj->Name );
194 my @attribs= qw(Description CorrespondAddress CommentAddress Name
195 InitialPriority FinalPriority DefaultDueIn Sign SignAuto Encrypt Lifecycle SubjectTag Disabled);
196
197 # we're asking about enabled on the web page but really care about disabled
198 if ( $SetEnabled ) {
199 $Disabled = $ARGS{'Disabled'} = $Enabled? 0: 1;
200 }
201 if ( $SetCrypt ) {
202 $ARGS{$_} = 0 foreach grep !defined $ARGS{$_} || !length $ARGS{$_},
203 qw(Sign SignAuto Encrypt);
204 }
205
206 $m->callback(
207 CallbackName => 'BeforeUpdate',
208 Queue => $QueueObj,
209 AttributesRef => \@attribs,
210 ARGSRef => \%ARGS,
211 );
212
213 push @results, UpdateRecordObject(
214 AttributesRef => \@attribs,
215 Object => $QueueObj,
216 ARGSRef => \%ARGS
217 );
218
219 $Disabled = $ARGS{'Disabled'} = $Enabled? 0: 1;
220
221 $EnabledChecked = "" if $QueueObj->Disabled;
222
223 my @linkresults;
224 $m->callback(
225 results => \@linkresults,
226 RecordObj => $QueueObj,
227 ARGSRef => \%ARGS,
228 CallbackName => 'ProcessLinks'
229 );
230 push @results, @linkresults;
231 push @results, ProcessObjectCustomFieldUpdates( ARGSRef => \%ARGS, Object => $QueueObj );
232 if ( RT->Config->Get('RTAddressRegexp') ) {
233 foreach my $address ( $QueueObj->CorrespondAddress, $QueueObj->CommentAddress ) {
234 next unless defined $address && length $address;
235 next if RT::EmailParser->IsRTAddress( $address );
236 push @no_redirect_results, loc("RTAddressRegexp option in the config doesn't match [_1]", $address );
237 }
238 }
239} else {
240 $title = loc("Create a queue");
241}
242
243my $InternalQueue = ($QueueObj->Id and $QueueObj->Disabled == 2);
244
245# This code does automatic redirection if any updates happen.
246MaybeRedirectForResults(
247 Actions => \@results,
248 Arguments => { id => $QueueObj->Id },
249) if $QueueObj->id;
250
251push @results, @no_redirect_results;
252</%INIT>
253
254
255<%ARGS>
256$id => undef
257$result => undef
258$Name => undef
259$Create => undef
260$Description => undef
261$CorrespondAddress => undef
262$CommentAddress => undef
263$InitialPriority => undef
264$FinalPriority => undef
265$DefaultDueIn => undef
266$SetEnabled => undef
267$SetCrypt => undef
268$Enabled => undef
269</%ARGS>