This commit was generated by cvs2svn to compensate for changes in r10640,
[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-2011 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 <& /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 <tr><td colspan="4">
125 % if ( my $email = $QueueObj->CorrespondAddress || RT->Config->Get('CorrespondAddress') ) {
126 <& /Admin/Elements/ShowKeyInfo, Type => 'private', EmailAddress => $email &>
127 % } else {
128 <&|/Widgets/TitleBox, title => loc( 'GnuPG private keys') &>
129 <i><&|/l&>You have enabled GnuPG support but have not set a correspondence address for this queue.</&>
130 <&|/l&>You must set a correspondence address for this queue in order to configure a GnuPG private key.</&></i>
131 </&>
132 % }
133 </td></tr>
134 <tr><td colspan="4">
135 % if ( my $email = $QueueObj->CommentAddress || RT->Config->Get('CommentAddress') ) {
136 <& /Admin/Elements/ShowKeyInfo, Type => 'private', EmailAddress => $email &>
137 % } else {
138 <&|/Widgets/TitleBox, title => loc( 'GnuPG private keys') &>
139 <i><&|/l&>You have enabled GnuPG support but have not set a comment address for this queue.</&>
140 <&|/l&>You must set a comment address for this queue in order to configure a GnuPG private key.</&></i>
141 </&>
142 %}
143 </td></tr>
144 % }
145
146 </table>
147 % if ( $Create ) {
148 <& /Elements/Submit, Label => loc('Create') &>
149 % } else {
150 <& /Elements/Submit, Label => loc('Save Changes') &>
151 % }
152 </form>
153
154
155
156 <%INIT>
157 my ($title, $current_tab, @results, $Disabled, $EnabledChecked);
158 my $QueueObj = RT::Queue->new( $session{'CurrentUser'} );
159 $QueueObj->Load( $id ) if !$id || $id eq 'new';
160
161 $EnabledChecked = 'checked="checked"';
162
163 if ($Create) {
164     $current_tab = 'Admin/Queues/Modify.html?Create=1';
165     $title = loc("Create a queue");
166 } else {
167     if ( defined $id && $id eq 'new' ) {
168         my ($val, $msg) = $QueueObj->Create( Name => $Name );
169         Abort("$msg") unless $val;
170         delete $session{'create_in_queues'};
171                 push @results, $msg;
172     }
173     else {
174         $QueueObj->Load($id) || $QueueObj->Load($Name) || Abort(loc("Couldn't load queue '[_1]'", $Name));
175     }
176     $title = loc('Editing Configuration for queue [_1]', $QueueObj->Name);
177     
178     $current_tab = 'Admin/Queues/Modify.html?id='.$QueueObj->id;
179 }
180 if ( $QueueObj->Id ) {
181     delete $session{'create_in_queues'};
182     my @attribs= qw(Description CorrespondAddress CommentAddress Name
183         InitialPriority FinalPriority DefaultDueIn Sign Encrypt SubjectTag Disabled);
184
185     # we're asking about enabled on the web page but really care about disabled
186     if ( $SetEnabled ) {
187         $Disabled = $ARGS{'Disabled'} = $Enabled? 0: 1;
188         $ARGS{$_} = 0 foreach grep !defined $ARGS{$_} || !length $ARGS{$_},
189             qw(Sign Encrypt Disabled);
190     }
191
192     push @results, UpdateRecordObject(
193         AttributesRef => \@attribs,
194         Object => $QueueObj, 
195         ARGSRef => \%ARGS
196     );
197
198     $Disabled = $ARGS{'Disabled'} = $Enabled? 0: 1;
199
200     $EnabledChecked = "" if $QueueObj->Disabled;
201
202     my @linkresults;
203     $m->callback(
204         results      => \@linkresults,
205         RecordObj    => $QueueObj,
206         ARGSRef      => \%ARGS, 
207         CallbackName => 'ProcessLinks'
208     );
209     push @results, @linkresults;
210     push @results, ProcessObjectCustomFieldUpdates( ARGSRef => \%ARGS, Object => $QueueObj );
211     if ( RT->Config->Get('RTAddressRegexp') ) {
212         foreach my $address ( $QueueObj->CorrespondAddress, $QueueObj->CommentAddress ) {
213             next unless defined $address && length $address;
214             next if RT::EmailParser->IsRTAddress( $address );
215             push @results, loc("RTAddressRegexp option in the config doesn't match [_1]", $address );
216         }
217     }
218 }
219 </%INIT>
220
221
222 <%ARGS>
223 $id => undef
224 $result => undef
225 $Name => undef
226 $Create => undef
227 $Description => undef
228 $CorrespondAddress => undef
229 $CommentAddress => undef
230 $InitialPriority => undef
231 $FinalPriority => undef
232 $DefaultDueIn => undef
233 $SetEnabled => undef
234 $Enabled => undef
235 </%ARGS>