1 <& /Elements/Header, Title => 'Modify people related to queue ' . $QueueObj->Name &>
2 <& /Admin/Elements/QueueTabs, id => $id &>
4 <& /Elements/ListActions, actions => \@results &>
7 <FORM METHOD=POST ACTION="People.html">
8 <INPUT TYPE=HIDDEN NAME=id VALUE="<%$QueueObj->Id%>">
9 <& /Elements/TitleBoxStart, title => 'Modify watchers for queue \''.$QueueObj->Name ."'", width => "100%" &>
15 <h3>Current watchers</h3>
16 <i>(Check box to delete)</i><br><BR>
23 %# Print out a placeholder if there are none.
24 %if ($cc->Count == 0 ) {
28 %while (my $watcher=$cc->Next) {
30 <INPUT TYPE=CHECKBOX NAME="DelWatcher<%$watcher->id%>" UNCHECKED>
32 %if ($watcher->IsUser) {
33 <a href="<%$RT::WebPath%>/Admin/Users/Modify.html?id=<%$watcher->OwnerObj->id%>">
34 <%$watcher->OwnerObj->RealName%></a>:
38 <i><%$watcher->Email%></i>
45 %# Print out a placeholder if there are none.
46 %if ($admincc->Count == 0 ) {
50 %while (my $watcher=$admincc->Next) {
51 <li><INPUT TYPE=CHECKBOX NAME="DelWatcher<%$watcher->id%>" UNCHECKED>
53 %if ($watcher->IsUser) {
54 <a href="<%$RT::WebPath%>/Admin/Users/Modify.html?id=<%$watcher->OwnerObj->id%>">
55 <%$watcher->OwnerObj->RealName%></a>:
59 <i><%$watcher->Email%></i>
67 <& /Elements/SelectUsers &>
76 % while (my $u = $Users->Next ) {
77 <li><&/Elements/SelectWatcherType, Scope=>'queue', Name => "WatcherTypeUser".$u->Id &> <%$u->Name%>
91 <& /Elements/TitleBoxEnd &>
92 <& /Elements/Submit, Label => 'Save Changes', Caption => "If you've updated anything above, be sure to" &>
97 my ($field, @results, $User, $Users, $watcher, $key, $msg);
99 #If we get handed two ids, mason will make them an array. bleck.
100 # We want teh first one. Just because there's no other sensible way
105 my $QueueObj = new RT::Queue($session{'CurrentUser'});
106 $QueueObj->Load($id) || Abort("Couldn't load queue '$id'");
109 # {{{ Delete deletable watchers
111 foreach $key (keys %ARGS) {
112 if (($key =~ /^DelWatcher(\d*)$/) and
114 $RT::Logger->debug("Deleting watcher $1\n");
115 my ($code, $msg) = $QueueObj->DeleteWatcher($1);
122 # {{{ Add new watchers
123 foreach $key (keys %ARGS) {
124 #They're in this order because otherwise $1 gets clobbered :/
125 if ( ($ARGS{$key} =~ /^(AdminCc|Cc)$/) and
126 ($key =~ /^WatcherTypeUser(\d*)$/) ) {
127 $RT::Logger->debug("Adding a watcher $1 to ".$ARGS{$key}."\n");
129 $QueueObj->AddWatcher(Type => $ARGS{$key},
139 my $admincc = $QueueObj->AdminCc;
140 my $cc = $QueueObj->Cc;
143 if (!$ARGS{'UserString'}) {
144 $msg = "No users selected.";
147 $Users = new RT::Users($session{'CurrentUser'});
148 $Users->Limit(FIELD => $ARGS{'UserField'},
149 VALUE => $ARGS{'UserString'},
150 OPERATOR => $ARGS{'UserOp'});