1 %# BEGIN BPS TAGGED BLOCK {{{
5 %# This software is Copyright (c) 1996-2007 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., 51 Franklin Street, Fifth Floor, Boston, MA
26 %# 02110-1301 or visit their web page on the internet at
27 %# http://www.gnu.org/copyleft/gpl.html.
30 %# CONTRIBUTION SUBMISSION POLICY:
32 %# (The following paragraph is not intended to limit the rights granted
33 %# to you to modify and distribute this software under the terms of
34 %# the GNU General Public License and is only of importance to you if
35 %# you choose to contribute your changes and enhancements to the
36 %# community by submitting them to Best Practical Solutions, LLC.)
38 %# By intentionally submitting any modifications, corrections or
39 %# derivatives to this work, or any other work intended for use with
40 %# Request Tracker, to Best Practical Solutions, LLC, you confirm that
41 %# you are the copyright holder for those contributions and you grant
42 %# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
43 %# royalty-free, perpetual, license to use, copy, create derivative
44 %# works based on those contributions, and sublicense and distribute
45 %# those contributions and any derivatives thereof.
47 %# END BPS TAGGED BLOCK }}}
48 <& /Elements/Header, Title => loc('Modify people related to queue [_1]', $QueueObj->Name) &>
49 <& /Admin/Elements/QueueTabs, id => $id,
50 QueueObj => $QueueObj,
51 current_tab => $current_tab,
52 Title => loc('Modify people related to queue [_1]', $QueueObj->Name) &>
54 <& /Elements/ListActions, actions => \@results &>
57 <form method="post" action="People.html">
58 <input type="hidden" class="hidden" name="id" value="<%$QueueObj->Id%>" />
64 <h3><&|/l&>Current watchers</&></h3>
69 <& /Admin/Elements/EditQueueWatchers, QueueObj => $QueueObj, Watchers => $QueueObj->Cc &>
71 <&|/l&>Administrative Cc</&>:
73 <& /Admin/Elements/EditQueueWatchers, QueueObj => $QueueObj, Watchers => $QueueObj->AdminCc &>
78 <h3><&|/l&>New watchers</&></h3>
80 <&|/l&>Find people whose</&><br />
81 <& /Elements/SelectUsers &>
82 <input type="submit" class="button" name="OnlySearchForPeople" value="<&|/l&>Go!</&>" />
84 <&|/l&>Find groups whose</&><br />
85 <& /Elements/SelectGroups &>
86 <input type="submit" class="button" name="OnlySearchForGroup" value="<&|/l&>Go!</&>" />
89 <&|/l&>Add new watchers</&>:<br />
91 <strong><&|/l&>Users</&></strong>
94 <em><%$user_msg%></em>
97 % while (my $u = $Users->Next ) {
98 <li><&/Elements/SelectWatcherType, Scope=>'queue', Name =>
99 "Queue-AddWatcher-Principal-".$u->PrincipalId &> <%$u->Name%>
106 <strong><&|/l&>Groups</&></strong>
110 <em><%$group_msg%></em>
111 % } elsif ($Groups) {
113 % while (my $g = $Groups->Next ) {
114 <li><&/Elements/SelectWatcherType, Scope=>'queue', Name =>
115 "Queue-AddWatcher-Principal-".$g->PrincipalId &> <%$g->Name%>
116 (<%$g->Description%>)
128 <& /Elements/Submit, Label => loc('Save Changes'), Caption => loc("If you've updated anything above, be sure to"), Reset => 1 &>
134 my ($field, @results, $User, $Users, $Groups, $watcher, $user_msg, $group_msg);
137 #If we get handed two ids, mason will make them an array. bleck.
138 # We want teh first one. Just because there's no other sensible way
143 my $QueueObj = new RT::Queue($session{'CurrentUser'});
144 $QueueObj->Load($id) || Abort(loc("Couldn't load queue", $id));
147 # {{{ Delete deletable watchers
149 foreach my $key (keys %ARGS) {
150 my $id = $QueueObj->Id;
152 if (($key =~ /^Queue-$id-DeleteWatcher-Type-(.*?)-Principal-(\d*)$/)) {;
153 my ($code, $msg) = $QueueObj->DeleteWatcher(Type => $1,
160 # {{{ Add new watchers
161 foreach my $key (keys %ARGS) {
162 #They're in this order because otherwise $1 gets clobbered :/
163 if ( ($ARGS{$key} =~ /^(AdminCc|Cc)$/) and
164 ($key =~ /^Queue-AddWatcher-Principal-(\d*)$/) ) {
165 $RT::Logger->debug("Adding a watcher $1 to ".$ARGS{$key}."\n");
166 my ($code, $msg) = $QueueObj->AddWatcher(Type => $ARGS{$key},
176 if (!length $ARGS{'UserString'}) {
177 $user_msg = loc("No principals selected.");
180 $Users = new RT::Users($session{'CurrentUser'});
181 $Users->Limit(FIELD => $ARGS{'UserField'},
182 VALUE => $ARGS{'UserString'},
183 OPERATOR => $ARGS{'UserOp'});
186 if (!length $ARGS{'GroupString'}) {
187 $group_msg = loc("No principals selected.");
190 $Groups = new RT::Groups($session{'CurrentUser'});
191 $Groups->Limit(FIELD => 'Domain', OPERATOR => '=', VALUE => 'UserDefined');
192 $Groups->Limit(FIELD => $ARGS{'GroupField'},
193 VALUE => $ARGS{'GroupString'},
194 OPERATOR => $ARGS{'GroupOp'});
197 $current_tab = 'Admin/Queues/People.html?id='.$QueueObj->id;
204 $GroupField => 'Name'
206 $GroupString => undef