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