1 %# BEGIN BPS TAGGED BLOCK {{{
5 %# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
6 %# <jesse@bestpractical.com>
8 %# (Except where explicitly superseded by other copyright notices)
13 %# This work is made available to you under the terms of Version 2 of
14 %# the GNU General Public License. A copy of that license should have
15 %# been provided with this software, but in any event can be snarfed
18 %# This work is distributed in the hope that it will be useful, but
19 %# WITHOUT ANY WARRANTY; without even the implied warranty of
20 %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 %# General Public License for more details.
23 %# You should have received a copy of the GNU General Public License
24 %# along with this program; if not, write to the Free Software
25 %# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 %# CONTRIBUTION SUBMISSION POLICY:
30 %# (The following paragraph is not intended to limit the rights granted
31 %# to you to modify and distribute this software under the terms of
32 %# the GNU General Public License and is only of importance to you if
33 %# you choose to contribute your changes and enhancements to the
34 %# community by submitting them to Best Practical Solutions, LLC.)
36 %# By intentionally submitting any modifications, corrections or
37 %# derivatives to this work, or any other work intended for use with
38 %# Request Tracker, to Best Practical Solutions, LLC, you confirm that
39 %# you are the copyright holder for those contributions and you grant
40 %# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
41 %# royalty-free, perpetual, license to use, copy, create derivative
42 %# works based on those contributions, and sublicense and distribute
43 %# those contributions and any derivatives thereof.
45 %# END BPS TAGGED BLOCK }}}
46 <& /Elements/Header, Title => loc('Modify people related to queue [_1]', $QueueObj->Name) &>
47 <& /Admin/Elements/QueueTabs, id => $id,
48 QueueObj => $QueueObj,
49 current_tab => $current_tab,
50 Title => loc('Modify people related to queue [_1]', $QueueObj->Name) &>
52 <& /Elements/ListActions, actions => \@results &>
55 <FORM METHOD=POST ACTION="People.html">
56 <INPUT TYPE=HIDDEN NAME=id VALUE="<%$QueueObj->Id%>">
62 <h3><&|/l&>Current watchers</&></h3>
67 <& /Admin/Elements/EditQueueWatchers, QueueObj => $QueueObj, Watchers => $QueueObj->Cc &>
69 <&|/l&>Administrative Cc</&>:
71 <& /Admin/Elements/EditQueueWatchers, QueueObj => $QueueObj, Watchers => $QueueObj->AdminCc &>
76 <h3><&|/l&>New watchers</&></h3>
78 <&|/l&>Find people whose</&><BR>
79 <& /Elements/SelectUsers &>
80 <input type=submit name="OnlySearchForPeople" value="<&|/l&>Go!</&>">
82 <&|/l&>Find groups whose</&><BR>
83 <& /Elements/SelectGroups &>
84 <input type=submit name="OnlySearchForGroup" value="<&|/l&>Go!</&>">
87 <&|/l&>Add new watchers</&>:<br>
89 <b><&|/l&>Users</&></b>
95 % while (my $u = $Users->Next ) {
96 <li><&/Elements/SelectWatcherType, Scope=>'queue', Name =>
97 "Queue-AddWatcher-Principal-".$u->PrincipalId &> <%$u->Name%>
104 <b><&|/l&>Groups</&></b>
108 <i><%$group_msg%></i>
109 % } elsif ($Groups) {
111 % while (my $g = $Groups->Next ) {
112 <li><&/Elements/SelectWatcherType, Scope=>'queue', Name =>
113 "Queue-AddWatcher-Principal-".$g->PrincipalId &> <%$g->Name%>
114 (<%$g->Description%>)
126 <& /Elements/Submit, Label => loc('Save Changes'), Caption => loc("If you've updated anything above, be sure to"), Reset => 1 &>
132 my ($field, @results, $User, $Users, $Groups, $watcher, $user_msg, $group_msg);
135 #If we get handed two ids, mason will make them an array. bleck.
136 # We want teh first one. Just because there's no other sensible way
141 my $QueueObj = new RT::Queue($session{'CurrentUser'});
142 $QueueObj->Load($id) || Abort(loc("Couldn't load queue", $id));
145 # {{{ Delete deletable watchers
147 foreach my $key (keys %ARGS) {
148 my $id = $QueueObj->Id;
150 if (($key =~ /^Queue-$id-DeleteWatcher-Type-(.*?)-Principal-(\d*)$/)) {;
151 my ($code, $msg) = $QueueObj->DeleteWatcher(Type => $1,
158 # {{{ Add new watchers
159 foreach my $key (keys %ARGS) {
160 #They're in this order because otherwise $1 gets clobbered :/
161 if ( ($ARGS{$key} =~ /^(AdminCc|Cc)$/) and
162 ($key =~ /^Queue-AddWatcher-Principal-(\d*)$/) ) {
163 $RT::Logger->debug("Adding a watcher $1 to ".$ARGS{$key}."\n");
164 my ($code, $msg) = $QueueObj->AddWatcher(Type => $ARGS{$key},
174 if (!length $ARGS{'UserString'}) {
175 $user_msg = loc("No principals selected.");
178 $Users = new RT::Users($session{'CurrentUser'});
179 $Users->Limit(FIELD => $ARGS{'UserField'},
180 VALUE => $ARGS{'UserString'},
181 OPERATOR => $ARGS{'UserOp'});
184 if (!length $ARGS{'GroupString'}) {
185 $group_msg = loc("No principals selected.");
188 $Groups = new RT::Groups($session{'CurrentUser'});
189 $Groups->Limit(FIELD => 'Domain', OPERATOR => '=', VALUE => 'UserDefined');
190 $Groups->Limit(FIELD => $ARGS{'GroupField'},
191 VALUE => $ARGS{'GroupString'},
192 OPERATOR => $ARGS{'GroupOp'});
195 $current_tab = 'Admin/Queues/People.html?id='.$QueueObj->id;
202 $GroupField => 'Name'
204 $GroupString => undef