This commit was generated by cvs2svn to compensate for changes in r2526,
[freeside.git] / rt / webrt / Admin / Queues / Modify.html
1 <& /Admin/Elements/Header, Title => 'Admin/Queue/Basics' &>
2 <& /Admin/Elements/QueueTabs, id => $QueueObj->id &>
3 <& /Elements/ListActions, actions => \@results &>
4
5
6
7 <& /Elements/TitleBoxStart, title => $title &>
8
9
10 <FORM ACTION="<%$RT::WebPath%>/Admin/Queues/Modify.html" METHOD=POST>
11 %if ($Create ) {
12 <INPUT TYPE=HIDDEN NAME=id VALUE="new">
13 % } else {
14 <INPUT TYPE=HIDDEN NAME=id VALUE="<%$QueueObj->Id%>">
15 % }
16
17 <TABLE>
18 <TR><TD ALIGN=RIGHT>
19 Queue Name: 
20 </TD>
21 <TD><INPUT name="Name" value="<%$QueueObj->Name%>"></TD>
22 </TR><TR>
23 <TD ALIGN=RIGHT>
24 Description:</TD><TD COLSPAN=3><INPUT name="Description" value="<%$QueueObj->Description%>" size=60></TD></TR>
25 <TR>
26 <TD ALIGN=RIGHT>
27 Correspondence Address:
28 </TD><TD>
29 <INPUT name="CorrespondAddress" value="<%$QueueObj->CorrespondAddress%>">
30 <BR><font size="-1"><i>(If left blank, will default to <%$RT::CorrespondAddress%></i></font>
31 </TD>
32 <TD ALIGN=RIGHT>
33
34 Comment Address: </TD><TD>
35 <INPUT NAME="CommentAddress" value="<%$QueueObj->CommentAddress%>">
36 <BR><font size="-1"><i>(If left blank, will default to <%$RT::CommentAddress%></i></font>
37 </TD>
38 </TR><TR>
39
40 <TD ALIGN=RIGHT>
41 Priority starts at: 
42 </TD><TD><INPUT NAME="InitialPriority" value="<%$QueueObj->InitialPriority %>">
43 </TD>
44 <TD ALIGN=RIGHT>
45 Over time, priority moves toward:
46 </TD><TD><INPUT NAME="FinalPriority" value="<%$QueueObj->FinalPriority %>">
47 </TD>
48 </TR>
49 <TR>
50 <TD ALIGN=RIGHT>
51 Requests should be due in:
52 </TD><TD>
53 <INPUT NAME="DefaultDueIn" VALUE="<%$QueueObj->DefaultDueIn%>"> days.
54 </TD>
55 </TR>
56 <TR>
57 <TD>
58 </TD>
59 <TD COLSPAN=4><INPUT TYPE=HIDDEN NAME="SetEnabled" VALUE="1">
60 <INPUT TYPE=CHECKBOX NAME="Enabled" VALUE="1" <%$EnabledChecked%>> Enabled (Unchecking this box disables this queue)<BR>
61 </TD>
62 </TR>
63
64 </TABLE>
65 <& /Elements/TitleBoxEnd &>
66 <& /Elements/Submit &>
67 </form>
68
69
70
71 <%INIT>
72
73 my $QueueObj = new RT::Queue($session{'CurrentUser'});
74 my  ($title, @results, $Disabled, $EnabledChecked);
75
76 if ($Create) {
77     $title = "Create a queue";
78 }
79
80 else {
81     if ($id eq 'new') {
82        my ($val, $msg) =  $QueueObj->Create(Name => $Name);
83        if ($val == 0 ) {
84            Abort("Could not create queue: $msg");
85         }
86         else {
87                 push @results, $msg;
88         }    
89      }
90      else {
91         $QueueObj->Load($id) || $QueueObj->Load($Name) || Abort("Couldn't load queue '$Name'");
92     }
93         $title = 'Editing Configuration for queue '.$QueueObj->Name;
94     
95 }
96 if ($QueueObj->Id()) {
97 my @attribs= qw(Description CorrespondAddress CommentAddress Name 
98                 InitialPriority FinalPriority DefaultDueIn);
99
100   @results = UpdateRecordObject( AttributesRef => \@attribs, 
101                                     Object => $QueueObj, 
102                                     ARGSRef => \%ARGS);
103
104 }
105
106 #we're asking about enabled on the web page but really care about disabled.
107 if ($Enabled == 1) {
108     $Disabled = 0;
109 }       
110 else {
111     $Disabled = 1;
112 }
113 if  ( ($SetEnabled) and ( $Disabled != $QueueObj->Disabled) ) { 
114     my  ($code, $msg) = $QueueObj->SetDisabled($Disabled);
115     push @results, 'Enabled status '. $msg;
116 }
117
118 unless ($QueueObj->Disabled()) {
119     $EnabledChecked ="CHECKED";
120 }
121 </%INIT>
122
123
124 <%ARGS>
125 $id => undef
126 $result => undef
127 $Name => undef
128 $Create => undef
129 $Description => undef
130 $CorrespondAddress => undef
131 $CommentAddress => undef
132 $InitialPriority => undef
133 $FinalPriority => undef
134 $DefaultDueIn => undef
135 $SetEnabled => undef
136 $Enabled => undef
137 </%ARGS>