summaryrefslogtreecommitdiff
path: root/rt/share/html/Admin/Queues
diff options
context:
space:
mode:
Diffstat (limited to 'rt/share/html/Admin/Queues')
-rwxr-xr-xrt/share/html/Admin/Queues/CustomField.html21
-rwxr-xr-xrt/share/html/Admin/Queues/CustomFields.html11
-rwxr-xr-xrt/share/html/Admin/Queues/GroupRights.html88
-rw-r--r--rt/share/html/Admin/Queues/History.html11
-rwxr-xr-xrt/share/html/Admin/Queues/Modify.html79
-rwxr-xr-xrt/share/html/Admin/Queues/People.html108
-rwxr-xr-xrt/share/html/Admin/Queues/Scrip.html28
-rwxr-xr-xrt/share/html/Admin/Queues/Scrips.html21
-rwxr-xr-xrt/share/html/Admin/Queues/Template.html98
-rwxr-xr-xrt/share/html/Admin/Queues/Templates.html26
-rwxr-xr-xrt/share/html/Admin/Queues/UserRights.html58
-rwxr-xr-xrt/share/html/Admin/Queues/index.html10
12 files changed, 198 insertions, 361 deletions
diff --git a/rt/share/html/Admin/Queues/CustomField.html b/rt/share/html/Admin/Queues/CustomField.html
index 2663fabfd..5b9cfd24a 100755
--- a/rt/share/html/Admin/Queues/CustomField.html
+++ b/rt/share/html/Admin/Queues/CustomField.html
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -46,20 +46,15 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => $title &>
-<& /Admin/Elements/QueueTabs, id => $QueueObj->Id,
- QueueObj => $QueueObj,
- current_tab => 'Admin/Queues/CustomFields.html?id='.$QueueObj->id,
- current_subtab => $current_subtab,
- subtabs => $subtabs,
- Title => $title &>
+<& /Elements/Tabs &>
<& /Admin/Elements/EditCustomField, title => $title, %ARGS &>
<%INIT>
-my $QueueObj = new RT::Queue($session{'CurrentUser'});
+my $QueueObj = RT::Queue->new($session{'CurrentUser'});
$QueueObj->Load($Queue);
-my ($title, $current_subtab);
+my ($title);
unless($QueueObj->id) {
Abort(loc("Queue [_1] not found", $Queue));
@@ -67,16 +62,8 @@ unless($QueueObj->id) {
if ($CustomField) {
$title = loc('Modify a CustomField for queue [_1]', $QueueObj->Name());
}else {
- $current_subtab = "Admin/Queues/CustomField.html?create=1&Queue=".$QueueObj->id;
$title = loc('Create a CustomField for queue [_1]', $QueueObj->Name());
}
-
-my $subtabs = {
- A => { title => loc('New custom field'),
- path => "Admin/Queues/CustomField.html?create=1&Queue=".$QueueObj->id
- }
- };
-
</%INIT>
<%ARGS>
$CustomField => undef
diff --git a/rt/share/html/Admin/Queues/CustomFields.html b/rt/share/html/Admin/Queues/CustomFields.html
index 35ce724fd..88d7b7148 100755
--- a/rt/share/html/Admin/Queues/CustomFields.html
+++ b/rt/share/html/Admin/Queues/CustomFields.html
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -46,12 +46,7 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => $title &>
-<& /Admin/Elements/QueueTabs,
- id => $Object->id,
- current_tab => "Admin/Queues/CustomFields.html?SubType=$SubType&id=$id",
- current_subtab => "Admin/Queues/CustomFields.html?SubType=$SubType&id=$id",
- QueueObj => $Object,
- Title => $title
+<& /Elements/Tabs
&>
<& /Admin/Elements/EditCustomFields, %ARGS, title => $title, Object => $Object, ObjectType => 'RT::Queue' &>
@@ -63,7 +58,7 @@ my $FriendlySubTypes =
RT::CustomField->new( $session{'CurrentUser'} )
->FriendlyLookupType( $Object->CustomFieldLookupType );
-my $title = loc( 'Edit Custom Fields for [_1]', $Object->Name );
+my $title = loc( 'Custom Fields for queue [_1]', $Object->Name );
</%INIT>
<%ARGS>
diff --git a/rt/share/html/Admin/Queues/GroupRights.html b/rt/share/html/Admin/Queues/GroupRights.html
index ed3d5e27e..4c5ca071b 100755
--- a/rt/share/html/Admin/Queues/GroupRights.html
+++ b/rt/share/html/Admin/Queues/GroupRights.html
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -46,75 +46,22 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => loc('Modify group rights for queue [_1]', $QueueObj->Name) &>
-<& /Admin/Elements/QueueTabs, id => $id,
- QueueObj => $QueueObj,
- current_tab => $current_tab,
- Title => loc('Modify group rights for queue [_1]', $QueueObj->Name) &>
+<& /Elements/Tabs &>
<& /Elements/ListActions, actions => \@results &>
- <form method="post" action="GroupRights.html">
- <input type="hidden" class="hidden" name="id" value="<% $QueueObj->id %>" />
-
-
-<h1><&|/l&>System groups</&></h1>
-<table>
-% $m->callback( %ARGS, QueueObj => $QueueObj, results => \@results );
-% $Groups = RT::Groups->new($session{'CurrentUser'});
-% $Groups->LimitToSystemInternalGroups();
-% while (my $Group = $Groups->Next()) {
- <tr align="right">
- <td valign="top">
- <% loc($Group->Type) %>
- </td>
- <td>
- <& /Admin/Elements/SelectRights, PrincipalId => $Group->PrincipalId,
- Object => $QueueObj &>
- </td>
- </tr>
-% }
-</table>
-<h1><&|/l&>Roles</&></h1>
-<table>
-% $Groups = RT::Groups->new($session{'CurrentUser'});
-% $Groups->LimitToRolesForQueue($QueueObj->Id);
-% while (my $Group = $Groups->Next()) {
- <tr align="right">
- <td valign="top">
- <% loc($Group->Type) %>
- </td>
- <td>
- <& /Admin/Elements/SelectRights, PrincipalId => $Group->PrincipalId,
- Object => $QueueObj &>
- </td>
- </tr>
-% }
-</table>
-<h1><&|/l&>User defined groups</&></h1>
-<table>
-% $Groups = RT::Groups->new($session{'CurrentUser'});
-% $Groups->LimitToUserDefinedGroups();
-% while (my $Group = $Groups->Next()) {
- <tr align="right">
- <td valign="top">
- <% $Group->Name %>
- </td>
- <td>
- <& /Admin/Elements/SelectRights, PrincipalId => $Group->PrincipalId,
- Object => $QueueObj &>
- </td>
- </tr>
-% }
-</table>
-
- <& /Elements/Submit, Label => loc('Modify Group Rights'), Reset => 1 &>
-
- </form>
-
-<%INIT>
-
- #Update the acls.
- my @results = ProcessACLChanges(\%ARGS);
+<form method="post" action="GroupRights.html" id="ModifyGroupRights" name="ModifyGroupRights">
+ <input type="hidden" class="hidden" name="id" value="<% $QueueObj->id %>" />
+
+% $m->callback( %ARGS, QueueObj => $QueueObj, results => \@results, principals => \@principals );
+
+ <& /Admin/Elements/EditRights, Context => $QueueObj, Principals => \@principals &>
+ <& /Elements/Submit, Label => loc('Save Changes') &>
+</form>
+
+<%INIT>
+# Update the acls.
+my @results = ProcessACLs(\%ARGS);
if (!defined $id) {
Abort(loc("No Queue defined"));
@@ -123,12 +70,9 @@ if (!defined $id) {
my $QueueObj = RT::Queue->new($session{'CurrentUser'});
$QueueObj->Load($id) || Abort(loc("Couldn't load queue [_1]",$id));
-my $Groups;
-my $current_tab;
-$current_tab = 'Admin/Queues/GroupRights.html?id='.$QueueObj->id;
-
+# Principal collections
+my @principals = GetPrincipalsMap($QueueObj, qw(System Roles Groups));
</%INIT>
-
<%ARGS>
$id => undef
</%ARGS>
diff --git a/rt/share/html/Admin/Queues/History.html b/rt/share/html/Admin/Queues/History.html
index e3a0e9c4a..49a16fe35 100644
--- a/rt/share/html/Admin/Queues/History.html
+++ b/rt/share/html/Admin/Queues/History.html
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -46,11 +46,7 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => $title &>
-<& /Admin/Elements/QueueTabs,
- id => $id,
- QueueObj => $QueueObj,
- current_subtab => $current_tab,
- Title => $title &>
+<& /Elements/Tabs &>
<& /Ticket/Elements/ShowHistory,
Ticket => $QueueObj,
@@ -58,8 +54,7 @@
&>
<%INIT>
-my $current_tab = 'Admin/Queues/History.html?id='.$id;
-my $QueueObj = new RT::Queue($session{'CurrentUser'});
+my $QueueObj = RT::Queue->new($session{'CurrentUser'});
$QueueObj->Load($id) || Abort("Couldn't load queue '$id'");
my $title = loc("History of the queue [_1]", $QueueObj->Name);
</%INIT>
diff --git a/rt/share/html/Admin/Queues/Modify.html b/rt/share/html/Admin/Queues/Modify.html
index 5dd7bf00c..5682eee28 100755
--- a/rt/share/html/Admin/Queues/Modify.html
+++ b/rt/share/html/Admin/Queues/Modify.html
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -46,25 +46,31 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => $title &>
-<& /Admin/Elements/QueueTabs, id => $QueueObj->id,
- QueueObj => $QueueObj,
- current_tab => $current_tab,
- Title => $title &>
+<& /Elements/Tabs &>
<& /Elements/ListActions, actions => \@results &>
-<form action="<%RT->Config->Get('WebPath')%>/Admin/Queues/Modify.html" method="post">
+<form action="<%RT->Config->Get('WebPath')%>/Admin/Queues/Modify.html" name="ModifyQueue" method="post">
<input type="hidden" class="hidden" name="SetEnabled" value="1" />
<input type="hidden" class="hidden" name="id" value="<% $Create? 'new': $QueueObj->Id %>" />
<table>
<tr><td align="right"><&|/l&>Queue Name</&>:</td>
-<td colspan="3"><input name="Name" value="<% ($Create) ? "" : $QueueObj->Name %>" /></td>
+<td colspan="3"><input name="Name" value="<% $Create ? "" : $QueueObj->Name || $Name %>" /></td>
</tr>
<tr><td align="right"><&|/l&>Description</&>:</td>
-<td colspan="3"><input name="Description" value="<% ($Create) ? "" : $QueueObj->Description %>" size="60" /></td>
+<td colspan="3"><input name="Description" value="<% $Create ? "" : $QueueObj->Description || $Description || '' %>" size="60" /></td>
+</tr>
+
+<tr><td align="right"><&|/l&>Lifecycle</&>:</td>
+<td colspan="3"><& /Widgets/Form/Select:InputOnly,
+ Name => 'Lifecycle',
+ Values => [ sort { loc($a) cmp loc($b) } RT::Lifecycle->List ],
+ CurrentValue => $Create ? "default" : $QueueObj->Lifecycle || $ARGS{'Lifecycle'},
+ Default => 0,
+&></td>
</tr>
<tr><td align="right"><&|/l&>Subject Tag</&>:</td>
@@ -72,27 +78,27 @@
</tr>
<tr><td align="right"><&|/l&>Reply Address</&>:</td>
-<td><input name="CorrespondAddress" value="<% ($Create) ? "" : $QueueObj->CorrespondAddress %>" />
+<td><input name="CorrespondAddress" value="<% $Create ? "" : $QueueObj->CorrespondAddress || $CorrespondAddress || '' %>" />
<br /><span><em><&|/l , RT->Config->Get('CorrespondAddress')&>(If left blank, will default to [_1])</&></em></span></td>
<td align="right"><&|/l&>Comment Address</&>:</td>
-<td><input name="CommentAddress" value="<% ($Create) ? "" : $QueueObj->CommentAddress %>" />
+<td><input name="CommentAddress" value="<% $Create ? "" : $QueueObj->CommentAddress || $CommentAddress || '' %>" />
<br /><span><em><&|/l , RT->Config->Get('CommentAddress')&>(If left blank, will default to [_1])</&></em></span></td>
</tr>
<tr><td align="right"><&|/l&>Priority starts at</&>:</td>
<td><& /Elements/SelectPriority,
Name => "InitialPriority",
- Default => $Create? 0: $QueueObj->InitialPriority,
+ Default => $Create? 0: $QueueObj->InitialPriority || $InitialPriority,
&></td>
<td align="right"><&|/l&>Over time, priority moves toward</&>:</td>
<td><& /Elements/SelectPriority,
Name => "FinalPriority",
- Default => $Create? 0: $QueueObj->FinalPriority,
-&></td>
+ Default => $Create? 0: $QueueObj->FinalPriority || $FinalPriority,
+&><br /><span><em><&|/l&>requires running rt-crontool</&></em></span></td>
</tr>
<tr><td align="right"><&|/l&>Requests should be due in</&>:</td>
-<td colspan="3"><input name="DefaultDueIn" value="<% ($Create) ? "" : $QueueObj->DefaultDueIn%>" /> <&|/l&>days</&>.</td>
+<td colspan="3"><input name="DefaultDueIn" value="<% ($Create) ? "" : $QueueObj->DefaultDueIn || $DefaultDueIn || "" %>" /> <&|/l&>days</&>.</td>
</tr>
% my $CFs = $QueueObj->CustomFields;
@@ -154,33 +160,28 @@
<%INIT>
-my ($title, $current_tab, @results, $Disabled, $EnabledChecked);
+my ($title, @results, @no_redirect_results, $Disabled, $EnabledChecked);
my $QueueObj = RT::Queue->new( $session{'CurrentUser'} );
$QueueObj->Load( $id ) if !$id || $id eq 'new';
$EnabledChecked = 'checked="checked"';
-if ($Create) {
- $current_tab = 'Admin/Queues/Modify.html?Create=1';
- $title = loc("Create a queue");
-} else {
+unless ($Create) {
if ( defined $id && $id eq 'new' ) {
my ($val, $msg) = $QueueObj->Create( Name => $Name );
- Abort("$msg") unless $val;
- delete $session{'create_in_queues'};
- push @results, $msg;
- }
- else {
+ if (!$val) {
+ $Create = 1; # Create failed, so bring us back to step 1
+ }
+ push @results, $msg;
+ } else {
$QueueObj->Load($id) || $QueueObj->Load($Name) || Abort(loc("Couldn't load queue '[_1]'", $Name));
}
- $title = loc('Editing Configuration for queue [_1]', $QueueObj->Name);
-
- $current_tab = 'Admin/Queues/Modify.html?id='.$QueueObj->id;
}
+
if ( $QueueObj->Id ) {
- delete $session{'create_in_queues'};
+ $title = loc('Configuration for queue [_1]', $QueueObj->Name );
my @attribs= qw(Description CorrespondAddress CommentAddress Name
- InitialPriority FinalPriority DefaultDueIn Sign Encrypt SubjectTag Disabled);
+ InitialPriority FinalPriority DefaultDueIn Sign Encrypt Lifecycle SubjectTag Disabled);
# we're asking about enabled on the web page but really care about disabled
if ( $SetEnabled ) {
@@ -189,6 +190,14 @@ if ( $QueueObj->Id ) {
qw(Sign Encrypt Disabled);
}
+ $m->callback(
+ CallbackName => 'BeforeUpdate',
+ Queue => $QueueObj,
+ AttributesRef => \@attribs,
+ ARGSRef => \%ARGS,
+ );
+
+ $ARGS{'Lifecycle'} = undef if defined $ARGS{'Lifecycle'} and $ARGS{'Lifecycle'} eq "default";
push @results, UpdateRecordObject(
AttributesRef => \@attribs,
Object => $QueueObj,
@@ -212,10 +221,20 @@ if ( $QueueObj->Id ) {
foreach my $address ( $QueueObj->CorrespondAddress, $QueueObj->CommentAddress ) {
next unless defined $address && length $address;
next if RT::EmailParser->IsRTAddress( $address );
- push @results, loc("RTAddressRegexp option in the config doesn't match [_1]", $address );
+ push @no_redirect_results, loc("RTAddressRegexp option in the config doesn't match [_1]", $address );
}
}
+} else {
+ $title = loc("Create a queue");
}
+
+# This code does automatic redirection if any updates happen.
+MaybeRedirectForResults(
+ Actions => \@results,
+ Arguments => { id => $QueueObj->Id },
+) if $QueueObj->id;
+
+push @results, @no_redirect_results;
</%INIT>
diff --git a/rt/share/html/Admin/Queues/People.html b/rt/share/html/Admin/Queues/People.html
index 917d88c33..729749c33 100755
--- a/rt/share/html/Admin/Queues/People.html
+++ b/rt/share/html/Admin/Queues/People.html
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -45,11 +45,9 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-<& /Elements/Header, Title => loc('Modify people related to queue [_1]', $QueueObj->Name) &>
-<& /Admin/Elements/QueueTabs, id => $id,
- QueueObj => $QueueObj,
- current_tab => $current_tab,
- Title => loc('Modify people related to queue [_1]', $QueueObj->Name) &>
+<& /Elements/Header, Title => $title &>
+
+<& /Elements/Tabs &>
<& /Elements/ListActions, actions => \@results &>
@@ -63,15 +61,11 @@
<h3><&|/l&>Current watchers</&></h3>
+% for my $Name (RT::Queue->ManageableRoleGroupTypes) {
+<& /Admin/Elements/EditQueueWatcherGroup, Label => loc($Name), QueueObj => $QueueObj, Watchers => $QueueObj->$Name &>
+% }
-<&|/l&>Cc</&>:
-
-<& /Admin/Elements/EditQueueWatchers, QueueObj => $QueueObj, Watchers => $QueueObj->Cc &>
-
-<&|/l&>Administrative Cc</&>:
-
-<& /Admin/Elements/EditQueueWatchers, QueueObj => $QueueObj, Watchers => $QueueObj->AdminCc &>
-
+% $m->callback(CallbackName => 'CurrentWatchers', QueueObj => $QueueObj);
</td>
<td valign="top">
@@ -132,22 +126,13 @@
<%INIT>
-my $current_tab;
my ($field, @results, $User, $Users, $Groups, $watcher, $user_msg, $group_msg);
-# {{{ Load the queue
-#If we get handed two ids, mason will make them an array. bleck.
-# We want teh first one. Just because there's no other sensible way
-# to deal
-
-
-
-my $QueueObj = new RT::Queue($session{'CurrentUser'});
+my $QueueObj = RT::Queue->new($session{'CurrentUser'});
$QueueObj->Load($id) || Abort(loc("Couldn't load queue", $id));
-# }}}
unless ($OnlySearchForPeople or $OnlySearchForGroup) {
-# {{{ Delete deletable watchers
+# Delete deletable watchers
foreach my $key (keys %ARGS) {
my $id = $QueueObj->Id;
@@ -158,46 +143,49 @@ unless ($OnlySearchForPeople or $OnlySearchForGroup) {
push @results, $msg;
}
}
-# }}}
-
-# {{{ Add new watchers
- foreach my $key (keys %ARGS) {
- #They're in this order because otherwise $1 gets clobbered :/
- if ( ($ARGS{$key} =~ /^(AdminCc|Cc)$/) and
- ($key =~ /^Queue-AddWatcher-Principal-(\d*)$/) ) {
- $RT::Logger->debug("Adding a watcher $1 to ".$ARGS{$key}."\n");
- my ($code, $msg) = $QueueObj->AddWatcher(Type => $ARGS{$key},
- PrincipalId => $1);
+
+# Add new watchers
+ foreach my $key (keys %ARGS) {
+ my $type = $ARGS{$key};
+
+ next unless $key =~ /^Queue-AddWatcher-Principal-(\d*)$/;
+ my $id = $1;
+
+ next unless RT::Queue->IsManageableRoleGroupType($type);
+
+ my ($code, $msg) = $QueueObj->AddWatcher(
+ Type => $type,
+ PrincipalId => $id,
+ );
push @results, $msg;
- }
}
-
-# }}}
}
-if (!length $ARGS{'UserString'}) {
-$user_msg = loc("No principals selected.");
- }
-else {
- $Users = new RT::Users($session{'CurrentUser'});
- $Users->Limit(FIELD => $ARGS{'UserField'},
- VALUE => $ARGS{'UserString'},
- OPERATOR => $ARGS{'UserOp'});
- }
-
-if (!length $ARGS{'GroupString'}) {
-$group_msg = loc("No principals selected.");
- }
-else {
-$Groups = new RT::Groups($session{'CurrentUser'});
-$Groups->Limit(FIELD => 'Domain', OPERATOR => '=', VALUE => 'UserDefined');
-$Groups->Limit(FIELD => $ARGS{'GroupField'},
- VALUE => $ARGS{'GroupString'},
- OPERATOR => $ARGS{'GroupOp'});
- }
-
-$current_tab = 'Admin/Queues/People.html?id='.$QueueObj->id;
+if ( $ARGS{'UserString'} ) {
+ $Users = RT::Users->new( $session{'CurrentUser'} );
+ $Users->Limit( FIELD => $ARGS{'UserField'},
+ VALUE => $ARGS{'UserString'},
+ OPERATOR => $ARGS{'UserOp'}
+ );
+} else {
+ $user_msg = loc("No principals selected.");
+ }
+
+if ( $ARGS{'GroupString'} ) {
+ $Groups = RT::Groups->new( $session{'CurrentUser'} );
+ $Groups->Limit( FIELD => 'Domain',
+ OPERATOR => '=',
+ VALUE => 'UserDefined'
+ );
+ $Groups->Limit( FIELD => $ARGS{'GroupField'},
+ VALUE => $ARGS{'GroupString'},
+ OPERATOR => $ARGS{'GroupOp'}
+ );
+} else {
+ $group_msg = loc("No principals selected.");
+}
+my $title = loc('People related to queue [_1]', $QueueObj->Name);
</%INIT>
<%ARGS>
diff --git a/rt/share/html/Admin/Queues/Scrip.html b/rt/share/html/Admin/Queues/Scrip.html
index b9c2834cb..ac0a783a7 100755
--- a/rt/share/html/Admin/Queues/Scrip.html
+++ b/rt/share/html/Admin/Queues/Scrip.html
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -46,12 +46,7 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => $title &>
-<& /Admin/Elements/QueueTabs, id => $QueueObj->Id,
- QueueObj => $QueueObj,
- current_tab => 'Admin/Queues/Scrips.html?id='.$QueueObj->id,
- current_subtab => $current_subtab,
- subtabs => $subtabs,
- Title => $title &>
+<& /Elements/Tabs &>
<& /Elements/ListActions, actions => \@results &>
<& /Admin/Elements/EditScrip, title => $title, %ARGS, id => $id &>
@@ -63,30 +58,13 @@ unless( $QueueObj->id ) {
Abort(loc("Queue [_1] not found", $id));
}
-my ($title, $current_subtab);
-my $subtabs = {
- A => {
- title => loc('Select scrip'),
- path => "Admin/Queues/Scrips.html?id=".$QueueObj->id,
- },
- B => {
- title => loc('New scrip'),
- path => "Admin/Queues/Scrip.html?create=1&Queue=".$QueueObj->id,
- separator => 1,
- },
-};
+my ($title);
($id, my @results) = $m->comp( '/Admin/Elements/EditScrip:Process', %ARGS );
if ( $id ) {
- $current_subtab = "Admin/Queues/Scrip.html?id=$id&Queue=". $QueueObj->id;
$title = loc("Modify a scrip for queue [_1]", $QueueObj->Name);
- $subtabs->{"C"} = {
- title => loc("Scrip #[_1]",$id),
- path => "Admin/Queues/Scrip.html?id=$id&Queue=".$QueueObj->id
- };
} else {
- $current_subtab = "Admin/Queues/Scrip.html?create=1&Queue=".$QueueObj->id;
$title = loc("Create a scrip for queue [_1]", $QueueObj->Name);
}
diff --git a/rt/share/html/Admin/Queues/Scrips.html b/rt/share/html/Admin/Queues/Scrips.html
index 698e7e616..56e44664a 100755
--- a/rt/share/html/Admin/Queues/Scrips.html
+++ b/rt/share/html/Admin/Queues/Scrips.html
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -46,12 +46,7 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => $title &>
-<& /Admin/Elements/QueueTabs, id => $QueueObj->id,
- QueueObj => $QueueObj,
- current_tab => 'Admin/Queues/Scrips.html?id='.$id,
- current_subtab => 'Admin/Queues/Scrips.html?id='.$id,
- subtabs => $subtabs,
- Title => $title &>
+<& /Elements/Tabs &>
% unless ( $QueueObj->Disabled ) { # Global scrips does not apply to disabled queues
<h2><&|/l&>Scrips which apply to all queues</&></h2>
@@ -60,7 +55,7 @@
% }
<& /Admin/Elements/EditScrips, title => $title, %ARGS &>
<%init>
-my $QueueObj = new RT::Queue($session{'CurrentUser'});
+my $QueueObj = RT::Queue->new($session{'CurrentUser'});
$QueueObj->Load($id);
my $title;
@@ -70,16 +65,6 @@ if ($QueueObj->id) {
} else {
Abort(loc("Queue [_1] not found",$id));
}
-
-my $subtabs = {
- A => { title => loc('Select scrip'),
- path => "Admin/Queues/Scrips.html?id=".$id,
- },
- B => { title => loc('New scrip'),
- path => "Admin/Queues/Scrip.html?create=1&Queue=".$id,
- separator => 1,
- }
- };
</%init>
<%ARGS>
diff --git a/rt/share/html/Admin/Queues/Template.html b/rt/share/html/Admin/Queues/Template.html
index 640e16119..3dd99e1d7 100755
--- a/rt/share/html/Admin/Queues/Template.html
+++ b/rt/share/html/Admin/Queues/Template.html
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -46,15 +46,10 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => $title &>
-<& /Admin/Elements/QueueTabs, id => $Queue,
- QueueObj => $QueueObj,
- current_tab => 'Admin/Queues/Templates.html?id='.$Queue,
- current_subtab => $current_subtab,
- subtabs => $subtabs,
- Title => $title &>
+<& /Elements/Tabs &>
<& /Elements/ListActions, actions => \@results &>
-<form method="post" action="Template.html">
+<form method="post" name="ModifyTemplate" id="ModifyTemplate" action="Template.html">
%if ($Create ) {
<input type="hidden" class="hidden" name="Template" value="new" />
% } else {
@@ -63,64 +58,61 @@
%# hang onto the queue id
<input type="hidden" class="hidden" name="Queue" value="<%$Queue%>" />
-<& /Admin/Elements/ModifyTemplate, Name => $TemplateObj->Name, Description =>
-$TemplateObj->Description, Content => $TemplateObj->Content &>
+<& /Admin/Elements/ModifyTemplate,
+ Name => $TemplateObj->Name,
+ Description => $TemplateObj->Description,
+ Content => $TemplateObj->Content,
+ Type => $TemplateObj->Type
+&>
<& /Elements/Submit, Label => $SubmitLabel, Reset => 1 &>
</form>
<%INIT>
-my $TemplateObj = new RT::Template($session{'CurrentUser'});
-my ($title, @results, $current_subtab, $SubmitLabel);
+my $TemplateObj = RT::Template->new( $session{'CurrentUser'} );
+my $QueueObj;
+my $SubmitLabel;
+my $title;
+my @results;
-my $subtabs = {
- A => { title => loc('Select template'),
- path => "Admin/Queues/Templates.html?id=$Queue"
- },
- B => { title => loc('New template'),
- path => "Admin/Queues/Template.html?Create=1&Queue=$Queue",
- separator => 1,
- }
- };
+if ( !$Create ) {
+ if ( $Template eq 'new' ) {
+ my ( $val, $msg )
+ = $TemplateObj->Create( Queue => $Queue, Name => $Name );
+ Abort( loc( "Could not create template: [_1]", $msg ) ) unless ($val);
+ push @results, $msg;
+ } else {
+ $TemplateObj->Load($Template) || Abort( loc('No Template') );
+ }
-if ($Create) {
- $title = loc("Create a template");
- $current_subtab = "Admin/Queues/Template.html?Create=1&Queue=".$Queue;
- $SubmitLabel = loc('Create');
}
-else {
- if ($Template eq 'new') {
- my ($val, $msg) = $TemplateObj->Create(Queue => $Queue, Name => $Name);
- Abort(loc("Could not create template: [_1]", $msg)) unless ($val);
- push @results, $msg;
- }
- else {
- $TemplateObj->Load($Template) || Abort(loc('No Template'));
- }
- $title = loc('Modify template [_1]', loc($TemplateObj->Name()));
- $SubmitLabel = loc('Save Changes');
-
-
+if ( $TemplateObj->Id() ) {
+ $Queue = $TemplateObj->Queue;
+ $QueueObj = $TemplateObj->QueueObj;
+
+ my @attribs = qw( Description Content Queue Name Type );
+ my @aresults = UpdateRecordObject( AttributesRef => \@attribs,
+ Object => $TemplateObj,
+ ARGSRef => \%ARGS
+ );
+ push @results, @aresults;
+
+ my ( $ok, $msg ) = $TemplateObj->CompileCheck;
+ push @results, $msg if !$ok;
+} else {
+ $QueueObj = RT::Queue->new( $session{'CurrentUser'} );
+ $QueueObj->Load($Queue);
}
-my $QueueObj;
-if ($TemplateObj->Id()) {
- $Queue = $TemplateObj->Queue;
- $QueueObj = $TemplateObj->QueueObj;
- my @attribs = qw( Description Content Queue Name);
- my @aresults = UpdateRecordObject( AttributesRef => \@attribs,
- Object => $TemplateObj,
- ARGSRef => \%ARGS);
- $current_subtab = "Admin/Queues/Template.html?Queue=$Queue&Template=".$TemplateObj->Id();
- $subtabs->{"C"} = { title => loc('Template #[_1]', $TemplateObj->Id()),
- path => "Admin/Queues/Template.html?Queue=$Queue&Template=".$TemplateObj->Id(),
- };
- push @results, @aresults;
+if ($Create) {
+ $title = loc( 'Create a new template for queue [_1]', $QueueObj->Name );
+ $SubmitLabel = loc('Create');
} else {
- $QueueObj = RT::Queue->new($session{'CurrentUser'});
- $QueueObj->Load($Queue);
+
+ $title = loc( 'Modify template [_1] for queue [_2]', loc( $TemplateObj->Name()), $QueueObj->Name );
+ $SubmitLabel = loc('Save Changes');
}
</%INIT>
diff --git a/rt/share/html/Admin/Queues/Templates.html b/rt/share/html/Admin/Queues/Templates.html
index aac833271..7df0ed2e0 100755
--- a/rt/share/html/Admin/Queues/Templates.html
+++ b/rt/share/html/Admin/Queues/Templates.html
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -46,34 +46,18 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => $title &>
-<& /Admin/Elements/QueueTabs, id => $QueueObj->id,
- current_tab => 'Admin/Queues/Templates.html?id='.$id,
- current_subtab => 'Admin/Queues/Templates.html?id='.$id,
- QueueObj => $QueueObj,
- subtabs => $subtabs,
- Title => $title &>
+<& /Elements/Tabs &>
<& /Admin/Elements/EditTemplates, title => $title, %ARGS &>
<%INIT>
-my $QueueObj = new RT::Queue($session{'CurrentUser'});
+my $QueueObj = RT::Queue->new($session{'CurrentUser'});
$QueueObj->Load($id);
-my ($title, $current_subtab);
-
-if ($QueueObj->id) {
- $title = loc("Edit Templates for queue [_1]", $QueueObj->Name);
-} else {
+if (!$QueueObj->id) {
Abort(loc("Queue [_1] not found",$id));
}
-my $subtabs = {
- A => { title => loc('Select template'),
- path => "Admin/Queues/Templates.html?id=".$id,
- },
- B => { title => loc('New template'),
- path => "Admin/Queues/Template.html?Create=1&Queue=".$id,
- }
- };
+my $title = loc("Templates for queue [_1]", $QueueObj->Name);
</%INIT>
<%ARGS>
diff --git a/rt/share/html/Admin/Queues/UserRights.html b/rt/share/html/Admin/Queues/UserRights.html
index b45c9968e..a7980dcbf 100755
--- a/rt/share/html/Admin/Queues/UserRights.html
+++ b/rt/share/html/Admin/Queues/UserRights.html
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -46,44 +46,23 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => loc('Modify user rights for queue [_1]', $QueueObj->Name) &>
-<& /Admin/Elements/QueueTabs, id => $id,
- QueueObj => $QueueObj,
- current_tab => $current_tab,
- Title => loc('Modify user rights for queue [_1]', $QueueObj->Name) &>
+<& /Elements/Tabs &>
<& /Elements/ListActions, actions => \@results &>
- <form method="post" action="UserRights.html">
- <input type="hidden" class="hidden" name="id" value="<% $QueueObj->id %>" />
-
-
-<table>
-% $m->callback( %ARGS, QueueObj => $QueueObj, results => \@results );
-% while (my $Member = $Users->Next()) {
-% my $UserObj = $Member->MemberObj->Object();
-% my $group = RT::Group->new($session{'CurrentUser'});
-% $group->LoadACLEquivalenceGroup($Member->MemberObj);
- <tr align="right">
- <td valign="top"><& /Elements/ShowUser, User => $UserObj &></td>
- <td>
- <& /Admin/Elements/SelectRights, PrincipalId=> $group->PrincipalId,
- Object => $QueueObj &>
- </td>
- </tr>
-% }
- </table>
-
- <& /Elements/Submit, Label => loc('Modify User Rights'), Reset => 1 &>
-
- </form>
-
-<%INIT>
-
- #Update the acls.
- my @results = ProcessACLChanges(\%ARGS);
+<form method="post" action="UserRights.html" name="ModifyUserRights" id="ModifyUserRights">
+ <input type="hidden" class="hidden" name="id" value="<% $QueueObj->id %>" />
-# {{{ Deal with setting up the display of current rights.
+%# XXX TODO put this somewhere more reasonable
+% $m->callback( %ARGS, QueueObj => $QueueObj, results => \@results );
+ <& /Admin/Elements/EditRights, Context => $QueueObj, Principals => \@principals &>
+
+ <& /Elements/Submit, Label => loc('Save Changes') &>
+</form>
+<%INIT>
+# Update the acls.
+my @results = ProcessACLs(\%ARGS);
if (!defined $id) {
Abort(loc("No Queue defined"));
@@ -92,16 +71,7 @@ if (!defined $id) {
my $QueueObj = RT::Queue->new($session{'CurrentUser'});
$QueueObj->Load($id) || Abort(loc("Couldn't load queue [_1]",$id));
-# Find out which users we want to display ACL selects for
-my $Privileged = RT::Group->new($session{'CurrentUser'});
-$Privileged->LoadSystemInternalGroup('Privileged');
-my $Users = $Privileged->MembersObj();
-
-
-
-# }}}
-my $current_tab;
-$current_tab = 'Admin/Queues/UserRights.html?id='.$QueueObj->id;
+my @principals = GetPrincipalsMap($QueueObj, 'Users');
</%INIT>
<%ARGS>
diff --git a/rt/share/html/Admin/Queues/index.html b/rt/share/html/Admin/Queues/index.html
index b5a2bb4f2..c7a4701b2 100755
--- a/rt/share/html/Admin/Queues/index.html
+++ b/rt/share/html/Admin/Queues/index.html
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -46,9 +46,7 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => loc("Admin queues") &>
-<& /Admin/Elements/QueueTabs, current_tab => 'Admin/Queues/',
- current_subtab => 'Admin/Queues/',
- Title => loc("Admin queues") &>
+<& /Elements/Tabs &>
@@ -91,7 +89,7 @@
</form>
<%INIT>
-my $queues = new RT::Queues($session{'CurrentUser'});
+my $queues = RT::Queues->new($session{'CurrentUser'});
$queues->FindAllRows if $FindDisabledQueues;
my ($caption);
@@ -104,6 +102,8 @@ if ( defined $QueueString && length $QueueString ) {
OPERATOR => $QueueOp,
VALUE => $QueueString,
);
+ RT::Interface::Web::Redirect(RT->Config->Get('WebURL')."Admin/Queues/Modify.html?id=".$queues->First->id)
+ if $queues->Count == 1;
} else {
$queues->UnLimit;
$caption = $FindDisabledQueues