import of rt 3.0.4
[freeside.git] / rt / html / Admin / Queues / Modify.html
1 %# BEGIN LICENSE BLOCK
2 %# 
3 %# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
4 %# 
5 %# (Except where explictly superceded by other copyright notices)
6 %# 
7 %# This work is made available to you under the terms of Version 2 of
8 %# the GNU General Public License. A copy of that license should have
9 %# been provided with this software, but in any event can be snarfed
10 %# from www.gnu.org.
11 %# 
12 %# This work is distributed in the hope that it will be useful, but
13 %# WITHOUT ANY WARRANTY; without even the implied warranty of
14 %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 %# General Public License for more details.
16 %# 
17 %# Unless otherwise specified, all modifications, corrections or
18 %# extensions to this work which alter its source code become the
19 %# property of Best Practical Solutions, LLC when submitted for
20 %# inclusion in the work.
21 %# 
22 %# 
23 %# END LICENSE BLOCK
24 <& /Admin/Elements/Header, Title => loc('Admin/Queue/Basics') &>
25 <& /Admin/Elements/QueueTabs, id => $QueueObj->id, 
26     QueueObj => $QueueObj,
27     current_tab => $current_tab, 
28     Title => loc('Admin/Queue/Basics') &>
29 <& /Elements/ListActions, actions => \@results &>
30
31
32
33 <FORM ACTION="<%$RT::WebPath%>/Admin/Queues/Modify.html" METHOD=POST>
34 %if ($Create ) { 
35 <INPUT TYPE=HIDDEN NAME=id VALUE="new">
36 % } else {
37 <INPUT TYPE=HIDDEN NAME=id VALUE="<%$QueueObj->Id%>">
38 % }
39
40 <TABLE>
41 <TR><TD ALIGN=RIGHT>
42 <&|/l&>Queue Name</&>: 
43 </TD>
44 <TD><INPUT name="Name" value="<% ($Create) ? "" : $QueueObj->Name %>"></TD>
45 </TR><TR>
46 <TD ALIGN=RIGHT>
47 <&|/l&>Description</&>:</TD><TD COLSPAN=3><INPUT name="Description" value="<% ($Create) ? "" : $QueueObj->Description %>" size=60></TD></TR>
48 <TR>
49 <TD ALIGN=RIGHT>
50 <&|/l&>Correspondence Address</&>:
51 </TD><TD>
52 <INPUT name="CorrespondAddress" value="<% ($Create) ? "" : $QueueObj->CorrespondAddress %>">
53 <BR><font size="-1"><i><&|/l , $RT::CorrespondAddress&>(If left blank, will default to [_1]</&></i></font>
54 </TD>
55 <TD ALIGN=RIGHT>
56
57 <&|/l&>Comment Address</&>: </TD><TD>
58 <INPUT NAME="CommentAddress" value="<% ($Create) ? "" : $QueueObj->CommentAddress %>">
59 <BR><font size="-1"><i><&|/l , $RT::CommentAddress&>(If left blank, will default to [_1]</&></i></font>
60 </TD>
61 </TR><TR>
62
63 <TD ALIGN=RIGHT>
64 <&|/l&>Priority starts at</&>: 
65 </TD><TD><INPUT NAME="InitialPriority" value="<% ($Create) ? "" : $QueueObj->InitialPriority %>">
66 </TD>
67 <TD ALIGN=RIGHT>
68 <&|/l&>Over time, priority moves toward</&>:
69 </TD><TD><INPUT NAME="FinalPriority" value="<% ($Create) ? "" : $QueueObj->FinalPriority %>">
70 </TD>
71 </TR>
72 <TR>
73 <TD ALIGN=RIGHT>
74 <&|/l&>Requests should be due in</&>:
75 </TD><TD>
76 <INPUT NAME="DefaultDueIn" VALUE="<% ($Create) ? "" : $QueueObj->DefaultDueIn%>"> <&|/l&>days</&>.
77 </TD>
78 </TR>
79 <TR>
80 <TD>
81 </TD>
82 <TD COLSPAN=4><INPUT TYPE=HIDDEN NAME="SetEnabled" VALUE="1">
83 <INPUT TYPE=CHECKBOX NAME="Enabled" VALUE="1" <%$EnabledChecked%>> <&|/l&>Enabled (Unchecking this box disables this queue)</&><BR>
84 <& /Elements/Callback, QueueObj => $QueueObj, results => \@results, %ARGS &>
85 </TD>
86 </TR>
87
88 </TABLE>
89 <& /Elements/Submit &>
90 </form>
91
92
93
94 <%INIT>
95 my $current_tab;
96 my $QueueObj = new RT::Queue($session{'CurrentUser'});
97 $QueueObj->Load($id);
98 my  ($title, @results, $Disabled, $EnabledChecked);
99 $EnabledChecked = "CHECKED";
100
101 if ($Create) {
102     $current_tab = 'Admin/Queues/Modify.html?Create=1';
103     $title = loc("Create a queue");
104 } else {
105     if ($id eq 'new') {
106        my ($val, $msg) =  $QueueObj->Create(Name => $Name);
107        delete $session{'create_in_queues'};
108        if ($val == 0 ) {
109            Abort("$msg");
110         }
111         else {
112                 push @results, $msg;
113         }    
114      }
115      else {
116         $QueueObj->Load($id) || $QueueObj->Load($Name) || Abort("Couldn't load queue '$Name'");
117     }
118         $title = loc('Editing Configuration for queue [_1]', $QueueObj->Name);
119     
120     $current_tab = 'Admin/Queues/Modify.html?id='.$QueueObj->id;
121 }
122 if ($QueueObj->Id()) {
123     delete $session{'create_in_queues'};
124 my @attribs= qw(Description CorrespondAddress CommentAddress Name 
125                 InitialPriority FinalPriority DefaultDueIn);
126
127   @results = UpdateRecordObject( AttributesRef => \@attribs, 
128                                     Object => $QueueObj, 
129                                     ARGSRef => \%ARGS);
130
131   #we're asking about enabled on the web page but really care about disabled.
132   if ($Enabled == 1) {
133       $Disabled = 0;
134   }     
135   else {
136       $Disabled = 1;
137   }
138   if  ( ($SetEnabled) and ( $Disabled != $QueueObj->Disabled) ) { 
139       my  ($code, $msg) = $QueueObj->SetDisabled($Disabled);
140       push @results, loc('Enabled status [_1]', loc_fuzzy($msg));
141   }
142   
143   if ($QueueObj->Disabled()) {
144       $EnabledChecked ="";
145   }
146 }
147 </%INIT>
148
149
150 <%ARGS>
151 $id => undef
152 $result => undef
153 $Name => undef
154 $Create => undef
155 $Description => undef
156 $CorrespondAddress => undef
157 $CommentAddress => undef
158 $InitialPriority => undef
159 $FinalPriority => undef
160 $DefaultDueIn => undef
161 $SetEnabled => undef
162 $Enabled => undef
163 </%ARGS>