1 %# BEGIN BPS TAGGED BLOCK {{{
5 %# This software is Copyright (c) 1996-2017 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 }}}
48 <& /Admin/Elements/Header, Title => $title &>
50 <& /Elements/ListActions, actions => \@results &>
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 % $m->callback( CallbackName => 'FormStart', Create => $Create, ARGSRef => \%ARGS );
58 <tr><td align="right"><&|/l&>Queue Name</&>:</td><td colspan="3">
59 % if ($InternalQueue) {
62 <input name="Name" value="<% $Create ? "" : $QueueObj->Name || $Name %>" />
66 <tr><td align="right"><&|/l&>Description</&>:</td>
67 <td colspan="3"><input name="Description" value="<% $Create ? "" : $QueueObj->Description || $Description || '' %>" size="60" /></td>
70 <tr><td align="right"><&|/l&>Lifecycle</&>:</td><td colspan="3">
71 % if ($InternalQueue) {
72 <% $QueueObj->Lifecycle %>
74 <& /Widgets/Form/Select:InputOnly,
76 Values => [ sort { loc($a) cmp loc($b) } RT::Lifecycle->List ],
77 CurrentValue => $Create ? "default" : $QueueObj->Lifecycle || $ARGS{'Lifecycle'},
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>
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>
95 <tr><td align="right"><&|/l&>Priority starts at</&>:</td>
96 <td><& /Elements/SelectPriority,
97 Name => "InitialPriority",
98 Default => $Create? 0: $QueueObj->InitialPriority || $InitialPriority,
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>
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>
111 % my $CFs = $QueueObj->CustomFields;
112 % while (my $CF = $CFs->Next) {
113 <tr valign="top"><td align="right">
116 <& /Elements/EditCustomField, CustomField => $CF,
117 Object => $QueueObj, &>
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>
127 <tr><td align="right"><input type="checkbox" class="checkbox" id="SignAuto" name="SignAuto" value="1" <% $QueueObj->SignAuto? 'checked="checked"': '' |n%> /></td>
128 <td colspan="3"><label for="SignAuto"><&|/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].</&></label></td></tr>
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 );
139 % if ( RT->Config->Get('Crypt')->{'Enable'} ) {
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 &>
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>
152 % if ( my $email = $QueueObj->CommentAddress || RT->Config->Get('CommentAddress') ) {
153 <& /Admin/Elements/ShowKeyInfo, Type => 'private', EmailAddress => $email &>
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>
165 <& /Elements/Submit, Label => loc('Create') &>
167 <& /Elements/Submit, Label => loc('Save Changes') &>
174 my ($title, @results, @no_redirect_results, $Disabled, $EnabledChecked);
175 my $QueueObj = RT::Queue->new( $session{'CurrentUser'} );
176 $QueueObj->Load( $id ) if !$id || $id eq 'new';
178 $EnabledChecked = 'checked="checked"';
181 if ( defined $id && $id eq 'new' ) {
182 my ($val, $msg) = $QueueObj->Create( Name => $Name );
184 $Create = 1; # Create failed, so bring us back to step 1
188 $QueueObj->Load($id) || $QueueObj->Load($Name) || Abort(loc("Couldn't load queue '[_1]'", $Name));
192 if ( $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);
197 # we're asking about enabled on the web page but really care about disabled
199 $Disabled = $ARGS{'Disabled'} = $Enabled? 0: 1;
202 $ARGS{$_} = 0 foreach grep !defined $ARGS{$_} || !length $ARGS{$_},
203 qw(Sign SignAuto Encrypt);
207 CallbackName => 'BeforeUpdate',
209 AttributesRef => \@attribs,
213 push @results, UpdateRecordObject(
214 AttributesRef => \@attribs,
219 $Disabled = $ARGS{'Disabled'} = $Enabled? 0: 1;
221 $EnabledChecked = "" if $QueueObj->Disabled;
225 results => \@linkresults,
226 RecordObj => $QueueObj,
228 CallbackName => 'ProcessLinks'
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 );
240 $title = loc("Create a queue");
243 my $InternalQueue = ($QueueObj->Id and $QueueObj->Disabled == 2);
245 # This code does automatic redirection if any updates happen.
246 MaybeRedirectForResults(
247 Actions => \@results,
248 Arguments => { id => $QueueObj->Id },
251 push @results, @no_redirect_results;
260 $Description => undef
261 $CorrespondAddress => undef
262 $CommentAddress => undef
263 $InitialPriority => undef
264 $FinalPriority => undef
265 $DefaultDueIn => undef