import rt 3.8.8
[freeside.git] / rt / share / html / Admin / Queues / Modify.html
1 %# BEGIN BPS TAGGED BLOCK {{{
2 %# 
3 %# COPYRIGHT:
4 %# 
5 %# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
6 %#                                          <jesse@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 <& /Admin/Elements/QueueTabs, id => $QueueObj->id, 
50     QueueObj => $QueueObj,
51     current_tab => $current_tab, 
52     Title => $title &>
53 <& /Elements/ListActions, actions => \@results &>
54
55
56
57 <form action="<%RT->Config->Get('WebPath')%>/Admin/Queues/Modify.html" method="post">
58 <input type="hidden" class="hidden" name="SetEnabled" value="1" />
59 <input type="hidden" class="hidden" name="id" value="<% $Create? 'new': $QueueObj->Id %>" />
60
61 <table>
62 <tr><td align="right"><&|/l&>Queue Name</&>:</td>
63 <td colspan="3"><input name="Name" value="<% ($Create) ? "" : $QueueObj->Name %>" /></td>
64 </tr>
65
66 <tr><td align="right"><&|/l&>Description</&>:</td>
67 <td colspan="3"><input name="Description" value="<% ($Create) ? "" : $QueueObj->Description %>" size="60" /></td>
68 </tr>
69
70 <tr><td align="right"><&|/l&>Subject Tag</&>:</td>
71 <td colspan="3"><input name="SubjectTag" value="<% $ARGS{'SubjectTag'} || ($Create ? "" : $QueueObj->SubjectTag || '' ) %>" size="60" /></td>
72 </tr>
73
74 <tr><td align="right"><&|/l&>Reply Address</&>:</td>
75 <td><input name="CorrespondAddress" value="<% ($Create) ? "" : $QueueObj->CorrespondAddress %>" />
76 <br /><span><em><&|/l , RT->Config->Get('CorrespondAddress')&>(If left blank, will default to [_1])</&></em></span></td>
77 <td align="right"><&|/l&>Comment Address</&>:</td>
78 <td><input name="CommentAddress" value="<% ($Create) ? "" : $QueueObj->CommentAddress %>" />
79 <br /><span><em><&|/l , RT->Config->Get('CommentAddress')&>(If left blank, will default to [_1])</&></em></span></td>
80 </tr>
81
82 <tr><td align="right"><&|/l&>Priority starts at</&>:</td>
83 <td><& /Elements/SelectPriority,
84     Name => "InitialPriority",
85     Default => $Create? 0: $QueueObj->InitialPriority,
86 &></td>
87 <td align="right"><&|/l&>Over time, priority moves toward</&>:</td>
88 <td><& /Elements/SelectPriority,
89     Name => "FinalPriority",
90     Default => $Create? 0: $QueueObj->FinalPriority,
91 &></td>
92 </tr>
93
94 <tr><td align="right"><&|/l&>Requests should be due in</&>:</td>
95 <td colspan="3"><input name="DefaultDueIn" value="<% ($Create) ? "" : $QueueObj->DefaultDueIn%>" /> <&|/l&>days</&>.</td>
96 </tr>
97
98 % my $CFs = $QueueObj->CustomFields;
99 % while (my $CF = $CFs->Next) {
100 <tr valign="top"><td align="right">
101 <% loc($CF->Name) %>:
102 </td><td>
103 <& /Elements/EditCustomField, CustomField => $CF, 
104                               Object => $QueueObj, 
105                               ($Create ? (NamePrefix => 'Object-RT::Queue--CustomField-') 
106                                        : () )&>
107 </td></tr>
108 % }
109
110 % if ( RT->Config->Get('GnuPG')->{'Enable'} ) {
111 <tr><td align="right"><input type="checkbox" class="checkbox" name="Sign" value="1" <% $QueueObj->Sign? 'checked="checked"': '' |n%> /></td>
112 <td><&|/l&>Sign by default</&></td>
113 <td align="right"><input type="checkbox" class="checkbox" name="Encrypt" value="1" <% $QueueObj->Encrypt? 'checked="checked"': '' |n%> /></td>
114 <td><&|/l&>Encrypt by default</&></td>
115 </tr>
116 % }
117
118 <tr><td align="right"><input type="checkbox" class="checkbox" name="Enabled" value="1" <%$EnabledChecked|n%> /></td>
119 <td colspan="3"><&|/l&>Enabled (Unchecking this box disables this queue)</&><br />
120 % $m->callback( %ARGS, QueueObj => $QueueObj, results => \@results );
121 </td></tr>
122
123 % if ( RT->Config->Get('GnuPG')->{'Enable'} ) {
124 % if ( my $email = $QueueObj->CorrespondAddress || RT->Config->Get('CorrespondAddress') ) {
125 <tr><td colspan="4"><& /Admin/Elements/ShowKeyInfo, Type => 'private', EmailAddress => $email &></td></tr>
126 % }
127 % if ( my $email = $QueueObj->CommentAddress || RT->Config->Get('CommentAddress') ) {
128 <tr><td colspan="4"><& /Admin/Elements/ShowKeyInfo, Type => 'private', EmailAddress => $email &></td></tr>
129 % }
130 % }
131
132 </table>
133 % if ( $Create ) {
134 <& /Elements/Submit, Label => loc('Create') &>
135 % } else {
136 <& /Elements/Submit, Label => loc('Save Changes') &>
137 % }
138 </form>
139
140
141
142 <%INIT>
143 my ($title, $current_tab, @results, $Disabled, $EnabledChecked);
144 my $QueueObj = RT::Queue->new( $session{'CurrentUser'} );
145 $QueueObj->Load( $id ) if !$id || $id eq 'new';
146
147 $EnabledChecked = 'checked="checked"';
148
149 if ($Create) {
150     $current_tab = 'Admin/Queues/Modify.html?Create=1';
151     $title = loc("Create a queue");
152 } else {
153     if ( defined $id && $id eq 'new' ) {
154         my ($val, $msg) = $QueueObj->Create( Name => $Name );
155         Abort("$msg") unless $val;
156         delete $session{'create_in_queues'};
157                 push @results, $msg;
158     }
159     else {
160         $QueueObj->Load($id) || $QueueObj->Load($Name) || Abort(loc("Couldn't load queue '[_1]'", $Name));
161     }
162     $title = loc('Editing Configuration for queue [_1]', $QueueObj->Name);
163     
164     $current_tab = 'Admin/Queues/Modify.html?id='.$QueueObj->id;
165 }
166 if ( $QueueObj->Id ) {
167     delete $session{'create_in_queues'};
168     my @attribs= qw(Description CorrespondAddress CommentAddress Name
169         InitialPriority FinalPriority DefaultDueIn Sign Encrypt SubjectTag Disabled);
170
171     # we're asking about enabled on the web page but really care about disabled
172     if ( $SetEnabled ) {
173         $Disabled = $ARGS{'Disabled'} = $Enabled? 0: 1;
174         $ARGS{$_} = 0 foreach grep !defined $ARGS{$_} || !length $ARGS{$_},
175             qw(Sign Encrypt Disabled);
176     }
177
178     push @results, UpdateRecordObject(
179         AttributesRef => \@attribs,
180         Object => $QueueObj, 
181         ARGSRef => \%ARGS
182     );
183
184     $Disabled = $ARGS{'Disabled'} = $Enabled? 0: 1;
185
186     $EnabledChecked = "" if $QueueObj->Disabled;
187
188     my @linkresults;
189     $m->callback(
190         results      => \@linkresults,
191         RecordObj    => $QueueObj,
192         ARGSRef      => \%ARGS, 
193         CallbackName => 'ProcessLinks'
194     );
195     push @results, @linkresults;
196     push @results, ProcessObjectCustomFieldUpdates( ARGSRef => \%ARGS, Object => $QueueObj );
197     if ( RT->Config->Get('RTAddressRegexp') ) {
198         foreach my $address ( $QueueObj->CorrespondAddress, $QueueObj->CommentAddress ) {
199             next unless defined $address && length $address;
200             next if RT::EmailParser->IsRTAddress( $address );
201             push @results, loc("RTAddressRegexp option in the config doesn't match [_1]", $address );
202         }
203     }
204 }
205 </%INIT>
206
207
208 <%ARGS>
209 $id => undef
210 $result => undef
211 $Name => undef
212 $Create => undef
213 $Description => undef
214 $CorrespondAddress => undef
215 $CommentAddress => undef
216 $InitialPriority => undef
217 $FinalPriority => undef
218 $DefaultDueIn => undef
219 $SetEnabled => undef
220 $Enabled => undef
221 </%ARGS>