summaryrefslogtreecommitdiff
path: root/rt/webrt/Admin/Queues/Modify.html
blob: 7a200df927061f35cc80980d67966e4054ffe08f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<& /Admin/Elements/Header, Title => 'Admin/Queue/Basics' &>
<& /Admin/Elements/QueueTabs, id => $QueueObj->id &>
<& /Elements/ListActions, actions => \@results &>



<& /Elements/TitleBoxStart, title => $title &>


<FORM ACTION="<%$RT::WebPath%>/Admin/Queues/Modify.html" METHOD=POST>
%if ($Create ) {
<INPUT TYPE=HIDDEN NAME=id VALUE="new">
% } else {
<INPUT TYPE=HIDDEN NAME=id VALUE="<%$QueueObj->Id%>">
% }

<TABLE>
<TR><TD ALIGN=RIGHT>
Queue Name: 
</TD>
<TD><INPUT name="Name" value="<%$QueueObj->Name%>"></TD>
</TR><TR>
<TD ALIGN=RIGHT>
Description:</TD><TD COLSPAN=3><INPUT name="Description" value="<%$QueueObj->Description%>" size=60></TD></TR>
<TR>
<TD ALIGN=RIGHT>
Correspondence Address:
</TD><TD>
<INPUT name="CorrespondAddress" value="<%$QueueObj->CorrespondAddress%>">
<BR><font size="-1"><i>(If left blank, will default to <%$RT::CorrespondAddress%></i></font>
</TD>
<TD ALIGN=RIGHT>

Comment Address: </TD><TD>
<INPUT NAME="CommentAddress" value="<%$QueueObj->CommentAddress%>">
<BR><font size="-1"><i>(If left blank, will default to <%$RT::CommentAddress%></i></font>
</TD>
</TR><TR>

<TD ALIGN=RIGHT>
Priority starts at: 
</TD><TD><INPUT NAME="InitialPriority" value="<%$QueueObj->InitialPriority %>">
</TD>
<TD ALIGN=RIGHT>
Over time, priority moves toward:
</TD><TD><INPUT NAME="FinalPriority" value="<%$QueueObj->FinalPriority %>">
</TD>
</TR>
<TR>
<TD ALIGN=RIGHT>
Requests should be due in:
</TD><TD>
<INPUT NAME="DefaultDueIn" VALUE="<%$QueueObj->DefaultDueIn%>"> days.
</TD>
</TR>
<TR>
<TD>
</TD>
<TD COLSPAN=4><INPUT TYPE=HIDDEN NAME="SetEnabled" VALUE="1">
<INPUT TYPE=CHECKBOX NAME="Enabled" VALUE="1" <%$EnabledChecked%>> Enabled (Unchecking this box disables this queue)<BR>
</TD>
</TR>

</TABLE>
<& /Elements/TitleBoxEnd &>
<& /Elements/Submit &>
</form>



<%INIT>

my $QueueObj = new RT::Queue($session{'CurrentUser'});
my  ($title, @results, $Disabled, $EnabledChecked);

if ($Create) {
    $title = "Create a queue";
}

else {
    if ($id eq 'new') {
       my ($val, $msg) =  $QueueObj->Create(Name => $Name);
       if ($val == 0 ) {
           Abort("Could not create queue: $msg");
	}
	else {
		push @results, $msg;
	}    
     }
     else {
        $QueueObj->Load($id) || $QueueObj->Load($Name) || Abort("Couldn't load queue '$Name'");
    }
        $title = 'Editing Configuration for queue '.$QueueObj->Name;
    
}
if ($QueueObj->Id()) {
my @attribs= qw(Description CorrespondAddress CommentAddress Name 
                InitialPriority FinalPriority DefaultDueIn);

  @results = UpdateRecordObject( AttributesRef => \@attribs, 
				    Object => $QueueObj, 
				    ARGSRef => \%ARGS);

}

#we're asking about enabled on the web page but really care about disabled.
if ($Enabled == 1) {
    $Disabled = 0;
}	
else {
    $Disabled = 1;
}
if  ( ($SetEnabled) and ( $Disabled != $QueueObj->Disabled) ) { 
    my  ($code, $msg) = $QueueObj->SetDisabled($Disabled);
    push @results, 'Enabled status '. $msg;
}

unless ($QueueObj->Disabled()) {
    $EnabledChecked ="CHECKED";
}
</%INIT>


<%ARGS>
$id => undef
$result => undef
$Name => undef
$Create => undef
$Description => undef
$CorrespondAddress => undef
$CommentAddress => undef
$InitialPriority => undef
$FinalPriority => undef
$DefaultDueIn => undef
$SetEnabled => undef
$Enabled => undef
</%ARGS>