<& /Admin/Elements/Header, Title => 'RT/Admin/Edit the user '. $User->Name &>
<& /Admin/Elements/UserTabs, id => $id &>
<& /Elements/ListActions, actions => \@results &>
<& /Elements/TitleBoxStart, title => "Editing queue watches for user " . $User->Name . " (" . $User->RealName . ")" &>
<FORM ACTION="<%$RT::WebPath%>/Admin/Users/Watches2.html" METHOD=POST>
<INPUT TYPE=HIDDEN NAME=id VALUE="<%$User->id%>">
<TABLE WIDTH="100%">
<TR>
<TD>
Add queues</TD>
<TD>
Current queues
</TD>
</TR>
<TR>
<TD VALIGN=TOP>
<ul>
% while (my $queue=$Queues->Next) {
<li>
<select NAME=WatcherTypeQueue<%$queue->Id%>>
<option VALUE="none">-</option>
<option VALUE="Cc">Cc</option>
<option VALUE="AdminCc">AdminCc</option>
</select>
<%$queue->Name%> (<%$queue->Description%>)
</li>
% }
</ul>
</TD>
<TD VALIGN=TOP>
<%PERL>
my $QueueList = "(Check box to remove watch)\n<UL>\n";
my $ShowList = 0;
while ($Queue = $Queues->Next()) {
if ($Queue->IsAdminCc($User)) {
$QueueList .= "<LI><INPUT TYPE=CHECKBOX Name='Delete-" . $Queue->Id . "-AdminCc' UNCHECKED>\n";
$QueueList .= "<a href='/Admin/Queues/Modify.html?id=" . $Queue->Id . "'>" . $Queue->Name . "</a> (as AdminCc)\n";
$ShowList = 1;
}
if ($Queue->IsCc($User)) {
$QueueList .= "<LI><INPUT TYPE=CHECKBOX Name='Delete-" . $Queue->Id . "-Cc' UNCHECKED>\n";
$QueueList .= "<a href='/Admin/Queues/Modify.html?id=" . $Queue->Id . "'>" . $Queue->Name . "</a> (as Cc)\n";
$ShowList = 1;
}
}
$QueueList .= "</UL>\n";
</%PERL>
% if ($ShowList) {
<% $QueueList | n %>
% } else {
<i>(User doesn't watch any queues</i>
% }
</TD>
</TR>
</TABLE>
<& /Elements/TitleBoxEnd &>
<& /Elements/Submit &>
</form>
<%ARGS>
$id => undef
</%ARGS>
<%INIT>
my $User = new RT::User($session{'CurrentUser'});
$User->Load($id);
my $Queues = new RT::Queues($session{'CurrentUser'});
$Queues->UnLimit;
my $Queue = new RT::Queue($session{'CurrentUser'});
my $QueueMember = new RT::User($session{'CurrentUser'});
my (@results);
my $key;
foreach $key (keys %ARGS) {
if ($key =~ /^Delete-(\d+)-(.*)$/) {
my $queue = $1;
my $type = $2;
$Queue->Load($queue) || Abort('Could not load queue');
my ($val,$msg) = $Queue->DeleteWatcher($User->EmailAddress, $type);
push (@results, $msg);
}
if ($key =~ /^WatcherTypeQueue(\d+)$/ && $ARGS{$key} ne "none") {
my $queue = $1;
$Queue->Load($queue) || Abort('Could not load queue');
my ($val,$msg) = $Queue->AddWatcher(Owner => $id, Type => $ARGS{$key});
push (@results, $msg);
}
}
</%INIT>