summaryrefslogtreecommitdiff
path: root/rt/share/html/Admin
diff options
context:
space:
mode:
Diffstat (limited to 'rt/share/html/Admin')
-rw-r--r--rt/share/html/Admin/Articles/Classes/CustomFields.html64
-rw-r--r--[-rwxr-xr-x]rt/share/html/Admin/Articles/Classes/GroupRights.html (renamed from rt/share/html/Admin/Elements/Tabs)60
-rw-r--r--rt/share/html/Admin/Articles/Classes/Modify.html199
-rw-r--r--rt/share/html/Admin/Articles/Classes/Objects.html154
-rw-r--r--[-rwxr-xr-x]rt/share/html/Admin/Articles/Classes/Topics.html (renamed from rt/share/html/Admin/Elements/ToolTabs)38
-rw-r--r--[-rwxr-xr-x]rt/share/html/Admin/Articles/Classes/UserRights.html (renamed from rt/share/html/Admin/Elements/GlobalCustomFieldTabs)65
-rw-r--r--rt/share/html/Admin/Articles/Classes/index.html91
-rw-r--r--rt/share/html/Admin/Articles/Elements/Topics215
-rw-r--r--rt/share/html/Admin/Articles/index.html50
-rw-r--r--rt/share/html/Admin/CustomFields/GroupRights.html58
-rw-r--r--rt/share/html/Admin/CustomFields/Modify.html115
-rw-r--r--rt/share/html/Admin/CustomFields/Objects.html13
-rw-r--r--rt/share/html/Admin/CustomFields/UserRights.html54
-rw-r--r--rt/share/html/Admin/CustomFields/index.html11
-rwxr-xr-xrt/share/html/Admin/Elements/AddCustomFieldValue10
-rw-r--r--rt/share/html/Admin/Elements/ConfigureMyRT2
-rwxr-xr-xrt/share/html/Admin/Elements/CreateUserCalled2
-rw-r--r--rt/share/html/Admin/Elements/CustomFieldTabs121
-rwxr-xr-xrt/share/html/Admin/Elements/EditCustomField2
-rwxr-xr-xrt/share/html/Admin/Elements/EditCustomFieldValues11
-rw-r--r--rt/share/html/Admin/Elements/EditCustomFieldValuesSource2
-rwxr-xr-xrt/share/html/Admin/Elements/EditCustomFields5
-rw-r--r--rt/share/html/Admin/Elements/EditQueueWatcherGroup (renamed from rt/share/html/Admin/Groups/CustomFields.html)12
-rwxr-xr-xrt/share/html/Admin/Elements/EditQueueWatchers2
-rw-r--r--rt/share/html/Admin/Elements/EditRights175
-rw-r--r--rt/share/html/Admin/Elements/EditRightsCategoryTabs129
-rwxr-xr-xrt/share/html/Admin/Elements/EditScrip29
-rwxr-xr-xrt/share/html/Admin/Elements/EditScrips10
-rwxr-xr-xrt/share/html/Admin/Elements/EditTemplates2
-rwxr-xr-xrt/share/html/Admin/Elements/EditUserComments2
-rwxr-xr-xrt/share/html/Admin/Elements/GroupTabs102
-rwxr-xr-xrt/share/html/Admin/Elements/Header2
-rwxr-xr-xrt/share/html/Admin/Elements/ListGlobalCustomFields4
-rwxr-xr-xrt/share/html/Admin/Elements/ListGlobalScrips7
-rwxr-xr-xrt/share/html/Admin/Elements/ModifyTemplate41
-rw-r--r--rt/share/html/Admin/Elements/ObjectCustomFields111
-rw-r--r--rt/share/html/Admin/Elements/PickCustomFields2
-rw-r--r--rt/share/html/Admin/Elements/PickObjects2
-rw-r--r--rt/share/html/Admin/Elements/Portal52
-rwxr-xr-xrt/share/html/Admin/Elements/QueueRightsForUser4
-rwxr-xr-xrt/share/html/Admin/Elements/QueueTabs123
-rw-r--r--rt/share/html/Admin/Elements/SelectCustomField2
-rw-r--r--rt/share/html/Admin/Elements/SelectCustomFieldLookupType2
-rw-r--r--rt/share/html/Admin/Elements/SelectCustomFieldRenderType70
-rwxr-xr-xrt/share/html/Admin/Elements/SelectCustomFieldType4
-rwxr-xr-xrt/share/html/Admin/Elements/SelectGroups4
-rwxr-xr-xrt/share/html/Admin/Elements/SelectModifyGroup4
-rwxr-xr-xrt/share/html/Admin/Elements/SelectModifyQueue4
-rwxr-xr-xrt/share/html/Admin/Elements/SelectModifyUser6
-rwxr-xr-xrt/share/html/Admin/Elements/SelectNewGroupMembers79
-rwxr-xr-xrt/share/html/Admin/Elements/SelectRights17
-rwxr-xr-xrt/share/html/Admin/Elements/SelectScrip2
-rwxr-xr-xrt/share/html/Admin/Elements/SelectScripAction15
-rwxr-xr-xrt/share/html/Admin/Elements/SelectScripCondition16
-rwxr-xr-xrt/share/html/Admin/Elements/SelectSingleOrMultiple2
-rw-r--r--rt/share/html/Admin/Elements/SelectStage2
-rwxr-xr-xrt/share/html/Admin/Elements/SelectTemplate20
-rwxr-xr-xrt/share/html/Admin/Elements/SelectUsers8
-rw-r--r--rt/share/html/Admin/Elements/ShowKeyInfo3
-rwxr-xr-xrt/share/html/Admin/Elements/SystemTabs99
-rwxr-xr-xrt/share/html/Admin/Elements/UserTabs116
-rw-r--r--rt/share/html/Admin/Global/CustomFields/Class-Article.html54
-rw-r--r--rt/share/html/Admin/Global/CustomFields/Groups.html7
-rwxr-xr-xrt/share/html/Admin/Global/CustomFields/Queue-Tickets.html7
-rwxr-xr-xrt/share/html/Admin/Global/CustomFields/Queue-Transactions.html7
-rw-r--r--rt/share/html/Admin/Global/CustomFields/Queues.html7
-rw-r--r--rt/share/html/Admin/Global/CustomFields/Users.html7
-rw-r--r--rt/share/html/Admin/Global/CustomFields/index.html9
-rwxr-xr-xrt/share/html/Admin/Global/GroupRights.html80
-rw-r--r--rt/share/html/Admin/Global/MyRT.html7
-rwxr-xr-xrt/share/html/Admin/Global/Scrip.html29
-rwxr-xr-xrt/share/html/Admin/Global/Scrips.html23
-rwxr-xr-xrt/share/html/Admin/Global/Template.html50
-rwxr-xr-xrt/share/html/Admin/Global/Templates.html23
-rw-r--r--rt/share/html/Admin/Global/Topics.html63
-rwxr-xr-xrt/share/html/Admin/Global/UserRights.html54
-rwxr-xr-xrt/share/html/Admin/Global/index.html42
-rwxr-xr-xrt/share/html/Admin/Groups/GroupRights.html62
-rw-r--r--rt/share/html/Admin/Groups/History.html11
-rwxr-xr-xrt/share/html/Admin/Groups/Members.html42
-rwxr-xr-xrt/share/html/Admin/Groups/Modify.html72
-rwxr-xr-xrt/share/html/Admin/Groups/UserRights.html56
-rwxr-xr-xrt/share/html/Admin/Groups/index.html53
-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
-rw-r--r--rt/share/html/Admin/Tools/Configuration.html68
-rw-r--r--rt/share/html/Admin/Tools/Queries.html129
-rw-r--r--rt/share/html/Admin/Tools/Shredder/Dumps/dhandler7
-rw-r--r--rt/share/html/Admin/Tools/Shredder/Elements/DumpFileLink2
-rw-r--r--rt/share/html/Admin/Tools/Shredder/Elements/Error/NoRights8
-rw-r--r--rt/share/html/Admin/Tools/Shredder/Elements/Error/NoStorage11
-rw-r--r--rt/share/html/Admin/Tools/Shredder/Elements/Object/RT--Attachment7
-rw-r--r--rt/share/html/Admin/Tools/Shredder/Elements/Object/RT--Ticket4
-rw-r--r--rt/share/html/Admin/Tools/Shredder/Elements/Object/RT--User4
-rw-r--r--rt/share/html/Admin/Tools/Shredder/Elements/ObjectCheckBox2
-rw-r--r--rt/share/html/Admin/Tools/Shredder/Elements/PluginArguments4
-rw-r--r--rt/share/html/Admin/Tools/Shredder/Elements/PluginHelp4
-rw-r--r--rt/share/html/Admin/Tools/Shredder/Elements/SelectObjects2
-rw-r--r--rt/share/html/Admin/Tools/Shredder/Elements/SelectPlugin4
-rw-r--r--rt/share/html/Admin/Tools/Shredder/autohandler2
-rw-r--r--rt/share/html/Admin/Tools/Shredder/index.html16
-rw-r--r--rt/share/html/Admin/Tools/Theme.html309
-rw-r--r--rt/share/html/Admin/Tools/index.html13
-rw-r--r--rt/share/html/Admin/Users/CustomFields.html9
-rw-r--r--rt/share/html/Admin/Users/GnuPG.html9
-rw-r--r--rt/share/html/Admin/Users/History.html11
-rw-r--r--rt/share/html/Admin/Users/Memberships.html15
-rwxr-xr-xrt/share/html/Admin/Users/Modify.html74
-rw-r--r--rt/share/html/Admin/Users/MyRT.html14
-rwxr-xr-xrt/share/html/Admin/Users/index.html94
-rw-r--r--rt/share/html/Admin/autohandler2
-rwxr-xr-xrt/share/html/Admin/index.html56
122 files changed, 2683 insertions, 2149 deletions
diff --git a/rt/share/html/Admin/Articles/Classes/CustomFields.html b/rt/share/html/Admin/Articles/Classes/CustomFields.html
new file mode 100644
index 000000000..868c288b8
--- /dev/null
+++ b/rt/share/html/Admin/Articles/Classes/CustomFields.html
@@ -0,0 +1,64 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
+%# <sales@bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<& /Elements/Header, Title => $title &>
+<& /Elements/Tabs &>
+<& /Admin/Elements/EditCustomFields, %ARGS, title => $title, Object => $Object, ObjectType => 'RT::Class', SubType => 'RT::Article' &>
+<%INIT>
+my $Object = RT::Class->new( $session{'CurrentUser'} );
+
+$Object->Load($id) || Abort( loc( "Couldn't load object [_1]", $id ) );
+my $FriendlySubTypes =
+ RT::CustomField->new( $session{'CurrentUser'} )
+ ->FriendlyLookupType( $Object->CustomFieldLookupType );
+
+my $title = loc( 'Edit Custom Fields for [_1]', $Object->Name );
+
+</%INIT>
+<%ARGS>
+$id => undef
+</%ARGS>
diff --git a/rt/share/html/Admin/Elements/Tabs b/rt/share/html/Admin/Articles/Classes/GroupRights.html
index c56ee2e55..092ea4b23 100755..100644
--- a/rt/share/html/Admin/Elements/Tabs
+++ b/rt/share/html/Admin/Articles/Classes/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)
@@ -45,51 +45,29 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-<& /Elements/Tabs,
- tabs => $tabs,
- current_toptab => 'Admin/',
- current_tab => $current_tab,
- Title => $Title &>
+<& /Admin/Elements/Header, Title => loc('Modify group rights for Class [_1]', $ClassObj->Name) &>
+<& /Elements/Tabs &>
+<& /Elements/ListActions, actions => \@results &>
-<%INIT>
- my $tabs = { A => { title => loc('Users'),
- path => 'Admin/Users/',
- },
- B => { title => loc('Groups'),
- path => 'Admin/Groups/',
- },
- C => { title => loc('Queues'),
- path => 'Admin/Queues/',
- },
- D => { 'title' => loc('Custom Fields'),
- path => 'Admin/CustomFields/',
- },
- E => { 'title' => loc('Global'),
- path => 'Admin/Global/',
- },
- F => { 'title' => loc('Tools'),
- path => 'Admin/Tools/',
- },
- };
+<form method="post" action="GroupRights.html" id="ModifyGroupRights" name="ModifyGroupRights">
+<input type="hidden" name="id" value="<% $ClassObj->id %>" />
- # Now let callbacks add their extra tabs
- $m->callback( %ARGS, tabs => $tabs );
+ <& /Admin/Elements/EditRights, Context => $ClassObj, Principals => \@principals &>
- if( defined $current_tab ) {
- foreach my $tab (keys %{$tabs}) {
- if ($tabs->{$tab}->{'path'} eq $current_tab) {
- $tabs->{$tab}->{"subtabs"} = $subtabs;
- $tabs->{$tab}->{"current_subtab"} = $current_subtab;
- }
- }
- }
+ <& /Elements/Submit, Label => loc('Save Changes') &>
+</form>
+<%INIT>
-</%INIT>
+if (!defined $id) {
+ $m->comp("/Elements/Error", Why => loc("No Class defined"));
+}
+my $ClassObj = RT::Class->new($session{'CurrentUser'});
+$ClassObj->Load($id) || $m->comp("/Elements/Error", Why => loc("Couldn't load Class [_1]",$id));
+my @results = ProcessACLs(\%ARGS);
+my @principals = GetPrincipalsMap($ClassObj, qw(System Groups));
+</%INIT>
<%ARGS>
-$subtabs => undef
-$current_tab => undef
-$current_subtab => undef
-$Title => undef
+$id => undef
</%ARGS>
diff --git a/rt/share/html/Admin/Articles/Classes/Modify.html b/rt/share/html/Admin/Articles/Classes/Modify.html
new file mode 100644
index 000000000..8dbd2897d
--- /dev/null
+++ b/rt/share/html/Admin/Articles/Classes/Modify.html
@@ -0,0 +1,199 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
+%# <sales@bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<& /Admin/Elements/Header, Title => $title &>
+<& /Elements/Tabs &>
+<& /Elements/ListActions, actions => \@results &>
+
+<form name="ModifyClass" action="<% RT->Config->Get('WebPath') %>/Admin/Articles/Classes/Modify.html" method="post">
+<input type="hidden" name="Submitted" value="1" />
+%if ($Create ) {
+<input type="hidden" name="id" value="new" />
+% } else {
+<input type="hidden" name="id" value="<%$ClassObj->Id%>" />
+% }
+
+<table>
+<tr>
+<td align="right"><&|/l&>Class Name</&>: </td>
+<td><input name="Name" value="<% $ClassObj->Name || $Name || ''%>" /></td>
+</tr>
+<tr>
+<td align="right"><&|/l&>Description</&>:</td>
+<td><input name="Description" value="<% $ClassObj->Description || $Description || '' %>" size=60 /></td>
+</tr>
+<tr>
+<td>&nbsp;</td>
+<td><input type="checkbox" name="Enabled" value="1" <%$EnabledChecked%>> <&|/l&>Enabled (Unchecking this box disables this class)</&></td>
+</tr>
+<tr>
+<td>&nbsp;</td>
+<td><input type="checkbox" name="HotList" value="1" <%$HotListChecked%>> <&|/l&>All Articles in this class should be listed in a dropdown of the ticket reply page</&></td>
+</tr>
+</table>
+
+<h3>When inserting articles in this class into emails:</h3>
+<ul>
+<li><input type="checkbox" name="Include-Name" value="1" <% $include{Name} %>> Include article name</li>
+<li><input type="checkbox" name="Include-Summary" value="1" <% $include{Summary} %>> Include article summary</li>
+% if ( $cfs ) {
+% while (my $cf = $cfs->Next) {
+<li>Include custom field '<% $cf->Name %>'
+ <ul>
+ <li><input type="checkbox" name="Include-CF-Title-<% $cf->Id %>" <% $include{"CF-Title-".$cf->Id} %> />Title</li>
+ <li><input type="checkbox" name="Include-CF-Value-<% $cf->Id %>" <% $include{"CF-Value-".$cf->Id} %> />Value</li>
+ </ul>
+</li>
+% } }
+</ul>
+
+%$m->callback( CallbackName => 'BeforeSubmit', CustomFields => $cfs, ClassObj => $ClassObj );
+
+% if ( $Create ) {
+<& /Elements/Submit, Label => loc('Create') &>
+% } else {
+<& /Elements/Submit, Label => loc('Save Changes') &>
+% }
+</form>
+
+<%INIT>
+
+my $ClassObj = RT::Class->new($session{'CurrentUser'});
+my ($title, @results, $Disabled);
+
+if ($Create) {
+ $title = loc("Create a Class");
+} else {
+ my ( $val, $msg );
+ if ($id eq 'new') {
+ ($val, $msg) = $ClassObj->Create(Name => $Name);
+ if ( $val ) {
+ push @results, $msg;
+ }
+ else {
+ push @results, loc('Class could not be created: [_1]', $msg);
+ }
+ } else {
+ $ClassObj->Load($id) || $ClassObj->Load($Name) || $m->comp("/Elements/Error", Why => "Couldn't load class '$Name'");
+ $val = $ClassObj->id;
+ }
+
+ if ( $val ) {
+ $title = loc('Modify the Class [_1]', $ClassObj->Name);
+ }
+ else {
+ $title = loc("Create a Class");
+ $Create = 1;
+ }
+}
+
+if ($ClassObj->Id()) {
+ $ARGS{HotList} ||= 0 if $Submitted;
+ my @attribs= qw(Description Name HotList);
+ $m->callback( CallbackName => 'AttributeList', Attributes => \@attribs, ARGSRef => \%ARGS );
+ push @results, UpdateRecordObject( AttributesRef => \@attribs,
+ Object => $ClassObj,
+ ARGSRef => \%ARGS);
+}
+
+#we're asking about enabled on the web page but really care about disabled.
+if ((defined $Enabled && $Enabled == 1) or (not defined $Enabled and $Create)) {
+ $Disabled = 0;
+} else {
+ $Disabled = 1;
+}
+
+my %include = (Name => 1, Summary => 1);
+
+my $cfs;
+if ( $ClassObj->id ) {
+ $cfs = $ClassObj->ArticleCustomFields;
+ $include{"CF-Title-".$_->Id} = $include{"CF-Value-".$_->Id} = 1 while $_ = $cfs->Next;
+}
+
+if ( $ClassObj->id && $Submitted ) {
+ if ( $Disabled != $ClassObj->Disabled) {
+ my ($code, $msg) = $ClassObj->SetDisabled($Disabled);
+ push @results, loc('Enabled status [_1]', loc_fuzzy($msg));
+ }
+
+ for (keys %include) {
+ if ($ARGS{"Include-$_"}) {
+ $ClassObj->DeleteAttribute("Skip-$_");
+ } else {
+ $ClassObj->SetAttribute(Name => "Skip-$_", Content => 1);
+ }
+ }
+}
+
+# This code does automatic redirection if any updates happen.
+MaybeRedirectForResults(
+ Actions => \@results,
+ Arguments => { id => $ClassObj->Id },
+) if $ClassObj->id;
+
+
+if ( $ClassObj->id ) {
+ $include{$_} = not $ClassObj->FirstAttribute("Skip-$_") for keys %include;
+}
+
+$include{$_} = $include{$_} ? " CHECKED" : "" for keys %include;
+
+my $EnabledChecked = ($Create ? $Disabled : $ClassObj->Disabled()) ? "" : "CHECKED";
+my $HotListChecked = $ClassObj->id && $ClassObj->HotList ? "CHECKED" : "";
+</%INIT>
+
+
+<%ARGS>
+$id => undef
+$result => undef
+$Name => undef
+$Create => undef
+$Description => undef
+$Submitted => undef
+$Enabled => undef
+</%ARGS>
diff --git a/rt/share/html/Admin/Articles/Classes/Objects.html b/rt/share/html/Admin/Articles/Classes/Objects.html
new file mode 100644
index 000000000..f7be9f598
--- /dev/null
+++ b/rt/share/html/Admin/Articles/Classes/Objects.html
@@ -0,0 +1,154 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
+%# <sales@bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<& /Admin/Elements/Header, Title => $title &>
+<& /Elements/Tabs &>
+<& /Elements/ListActions, actions => \@results &>
+
+<form action="Objects.html" method="post">
+<input type="hidden" class="hidden" name="id" value="<% $id %>" />
+
+% if ( $is_global ) {
+<h2><&|/l&>Applies to all objects</&></h2>
+<input type="checkbox" name="RemoveClass-<% $Class->id %>" value="0" />
+<&|/l&>check this box to remove this Class globally and be able to choose specific Queues.</&>
+% } else {
+<h2><&|/l&>Apply globally</&></h2>
+
+<input type="checkbox" name="AddClass-<% $Class->id %>" value="0" />
+<&|/l&>check this box to apply this Class globally to all Queues.</&>
+
+<h2><&|/l&>Selected Queues</&></h2>
+<& /Elements/CollectionList,
+ OrderBy => 'id',
+ Order => 'ASC',
+ %ARGS,
+ Collection => $applied,
+ Rows => 0,
+ Page => 1,
+ Format => $format,
+ DisplayFormat => "'__CheckBox.{RemoveClass-". $Class->id ."}__',". $format,
+ AllowSorting => 0,
+ ShowEmpty => 0,
+ PassArguments => [
+ qw(id Format Rows Page Order OrderBy),
+ ],
+&>
+
+<h2><&|/l&>Unselected Queues</&></h2>
+<& /Elements/CollectionList,
+ OrderBy => 'id',
+ Order => 'ASC',
+ %ARGS,
+ Collection => $not_applied,
+ Rows => 50,
+ Format => $format,
+ DisplayFormat => "'__CheckBox.{AddClass-". $Class->id ."}__',". $format,
+ AllowSorting => 1,
+ ShowEmpty => 0,
+ PassArguments => [
+ qw(id Format Rows Page Order OrderBy),
+ ],
+&>
+
+% }
+
+<& /Elements/Submit, Name => 'UpdateObjs' &>
+</form>
+
+<%INIT>
+my $Class = RT::Class->new($session{'CurrentUser'});
+$Class->Load($id) or Abort(loc("Could not load Class [_1]"), $id);
+
+my (@results);
+
+if ( $UpdateObjs ) {
+ if ( defined (my $del = $ARGS{'RemoveClass-'.$Class->id}) ) {
+ foreach my $id ( ref $del? (@$del) : ($del) ) {
+ my $object = RT::Queue->new( $session{'CurrentUser'} );
+ if ( $id ) {
+ $object->Load( $id );
+ next unless $object->id;
+ }
+
+ my ($status, $msg) = $Class->RemoveFromObject( $object );
+ push @results, $msg;
+ }
+ }
+ if ( defined (my $add = $ARGS{'AddClass-'.$Class->id}) ) {
+ foreach my $id ( ref $add? (@$add) : ($add) ) {
+ my $object = RT::Queue->new( $session{'CurrentUser'} );
+ if ( $id ) {
+ $object->Load( $id );
+ next unless $object->id;
+ }
+
+ my ($status, $msg) = $Class->AddToObject( $object );
+ push @results, $msg;
+ }
+ }
+}
+
+my $is_global = $Class->IsApplied(0);
+
+my $applied = $Class->AppliedTo;
+my $not_applied = $Class->NotAppliedTo;
+
+my $collection_class = ref($applied);
+$collection_class =~ s/^RT:://;
+
+my $format = RT->Config->Get('AdminSearchResultFormat')->{$collection_class}
+ || '__id__,__Name__';
+
+my $title = loc('Modify associated objects for [_1]', $Class->Name);
+
+</%INIT>
+<%ARGS>
+$id => undef
+$FindDisabledObjects => 0
+$UpdateObjs => 0
+</%ARGS>
diff --git a/rt/share/html/Admin/Elements/ToolTabs b/rt/share/html/Admin/Articles/Classes/Topics.html
index c3cb6e397..5418d81a5 100755..100644
--- a/rt/share/html/Admin/Elements/ToolTabs
+++ b/rt/share/html/Admin/Articles/Classes/Topics.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,38 +45,24 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-<& /Admin/Elements/Tabs,
- Title => $Title,
- current_tab => 'Admin/Tools/',
- subtabs => $tabs,
- current_subtab => $current_tab,
-&>
+<& /Admin/Elements/Header, Title => $title &>
+<& /Elements/Tabs &>
+
+<& /Admin/Articles/Elements/Topics, title => $title, RootObj => $ClassObj, %ARGS &>
<%INIT>
- my $tabs = {
- A => { title => loc('System Configuration'),
- path => 'Admin/Tools/Configuration.html',
- },
- E => { title => loc('Shredder'),
- path => 'Admin/Tools/Shredder/',
- },
- };
- # Now let callbacks add their extra tabs
- $m->callback( %ARGS, tabs => $tabs );
+my $ClassObj = RT::Class->new($session{'CurrentUser'});
+$ClassObj->Load($ARGS{'id'}) || $m->comp("/Elements/Error", Why => "Couldn't load class '$id'");
- foreach my $tab ( values %{$tabs} ) {
- next unless $tab->{'path'} eq $current_tab;
+my $title = $Modify
+ ? loc("Modify topic for [_1]", $ClassObj->Name)
+ : loc("Edit topic hierarchy for [_1]", $ClassObj->Name);
- $tab->{"subtabs"} = $subtabs;
- $tab->{"current_subtab"} = $current_subtab;
- }
</%INIT>
+
<%ARGS>
$id => undef
-$current_tab => undef
-$subtabs => undef
-$current_subtab => undef
-$Title => undef
+$Modify => ""
</%ARGS>
diff --git a/rt/share/html/Admin/Elements/GlobalCustomFieldTabs b/rt/share/html/Admin/Articles/Classes/UserRights.html
index 475681b05..c1aedeb33 100755..100644
--- a/rt/share/html/Admin/Elements/GlobalCustomFieldTabs
+++ b/rt/share/html/Admin/Articles/Classes/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)
@@ -45,61 +45,28 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-<& /Admin/Elements/SystemTabs, subtabs => $tabs,
- current_tab => 'Admin/Global/CustomFields/index.html',
- current_subtab => $current_tab,
- Title => $Title &>
-<%INIT>
-
-my $tabs = {
-
- A => {
- title => loc('Users'),
- text => loc('Select custom fields for all users'),
- path => 'Admin/Global/CustomFields/Users.html',
- },
+<& /Admin/Elements/Header, Title => loc('Modify user rights for class [_1]', $ClassObj->Name) &>
+<& /Elements/Tabs &>
+<& /Elements/ListActions, actions => \@results &>
- B => {
- title => loc('Groups'),
- text => loc('Select custom fields for all user groups'),
- path => 'Admin/Global/CustomFields/Groups.html',
- },
+<form method="post" action="UserRights.html" name="ModifyUserRights" id="ModifyUserRights">
+<input type="hidden" name="id" value="<% $ClassObj->id %>" />
+ <& /Admin/Elements/EditRights, Context => $ClassObj, Principals => \@principals &>
- C => {
- title => loc('Queues'),
- text => loc('Select custom fields for all queues'),
- path => 'Admin/Global/CustomFields/Queues.html',
- },
+ <& /Elements/Submit, Label => loc('Save Changes') &>
+<%INIT>
+my @results = ProcessACLs(\%ARGS);
- F => {
- title => loc('Tickets'),
- text => loc('Select custom fields for tickets in all queues'),
- path => 'Admin/Global/CustomFields/Queue-Tickets.html',
- },
+if (!defined $id) {
+ $m->comp("/Elements/Error", Why => loc("No Class defined"));
+}
- G => {
- title => loc('Ticket Transactions'),
- text => loc('Select custom fields for transactions on tickets in all queues'),
- path => 'Admin/Global/CustomFields/Queue-Transactions.html',
- },
+my $ClassObj = RT::Class->new($session{'CurrentUser'});
+$ClassObj->Load($id) || $m->comp("/Elements/Error", Why => loc("Couldn't load Class [_1]",$id));
-};
- # Now let callbacks add their extra tabs
- $m->callback( %ARGS, tabs => $tabs );
+my @principals = GetPrincipalsMap($ClassObj, 'Users');
- foreach my $tab (sort keys %{$tabs}) {
- if ($tabs->{$tab}->{'path'} eq $current_tab) {
- $tabs->{$tab}->{"subtabs"} = $subtabs;
- $tabs->{$tab}->{"current_subtab"} = $current_subtab;
- }
- }
</%INIT>
-
-
<%ARGS>
$id => undef
-$current_tab => ''
-$subtabs => undef
-$current_subtab => undef
-$Title => undef
</%ARGS>
diff --git a/rt/share/html/Admin/Articles/Classes/index.html b/rt/share/html/Admin/Articles/Classes/index.html
new file mode 100644
index 000000000..8c32677c9
--- /dev/null
+++ b/rt/share/html/Admin/Articles/Classes/index.html
@@ -0,0 +1,91 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
+%# <sales@bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<& /Admin/Elements/Header, Title => loc("Select a Class") &>
+<& /Elements/Tabs &>
+
+<h1><%$caption%>:</h1>
+<p><&|/l&>Select a Class</&>:</p>
+% unless ($Classes->Count) {
+<em><&|/l&>No Classes matching search criteria found.</&></em>
+% } else {
+<& /Elements/CollectionList,
+ OrderBy => 'Name',
+ Order => 'ASC',
+ %ARGS,
+ Format => $Format,
+ Collection => $Classes,
+ AllowSorting => 1,
+ PassArguments => [qw( Format Rows Page Order OrderBy FindDisabledClasses )],
+&>
+% }
+
+<form method="post" action="<% RT->Config->Get('WebPath') %>/Admin/Articles/Classes/index.html">
+<input type="checkbox" name="FindDisabledClasses" value="1" /><&|/l&>Include disabled classes in listing.</&><br />
+<div align="right"><input type="submit" value="<&|/l&>Go!</&>" /></div>
+</form>
+<%INIT>
+my $caption;
+my $Classes = RT::Classes->new($session{'CurrentUser'});
+
+if ($FindDisabledClasses) {
+ $caption = loc("All Classes");
+ $Classes->{'find_disabled_rows'} = 1;
+ $Classes->UnLimit();
+} else {
+ $caption = loc("Enabled Classes");
+ $Classes->LimitToEnabled();
+
+}
+
+$Format ||= RT->Config->Get('AdminSearchResultFormat')->{'Classes'};
+
+</%INIT>
+<%ARGS>
+$FindDisabledClasses => 0
+$Format => undef
+</%ARGS>
diff --git a/rt/share/html/Admin/Articles/Elements/Topics b/rt/share/html/Admin/Articles/Elements/Topics
new file mode 100644
index 000000000..43ca9562c
--- /dev/null
+++ b/rt/share/html/Admin/Articles/Elements/Topics
@@ -0,0 +1,215 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
+%# <sales@bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<& /Elements/ListActions, actions => \@results &>
+
+<form action="<%RT->Config->Get('WebPath')%><% $m->request_comp->path |n %>" method="post">
+<input type="hidden" name="id" value="<%$RootObj->Id%>" />
+
+% if (!$Modify) {
+<table>
+<tr>
+<td><&|/l&>Topic Name</&></td>
+<td><input type="text" name="Name" size="30" /></td>
+</tr>
+<tr>
+<td><&|/l&>Description</&></td>
+<td><input type="text" name="Description" size="50" /></td>
+</tr>
+</table>
+% } else {
+<a href="Topics.html">New topic</a>
+% }
+
+<& .tree, Element => $tree, Action => $Modify ? "Move" : "Add", Prefix => $Modify ? "Topic-$Modify-Parent" : "Insert", RootObj => $RootObj, Modify => $Modify &>
+
+</form>
+
+<%def .edit>
+&nbsp;
+<table style="margin-top: -0.75em">
+<tr>
+ <td>Topic Name:</td>
+ <td><input type="text" name="Topic-<%$topic->Id%>-Name" size="20" value="<%$topic->Name%>" /></td>
+ <td><input type="submit" name="Update" value="Update"><br /></td>
+</tr>
+<tr>
+ <td>Description:</td>
+ <td> <input type="text" name="Topic-<%$topic->Id%>-Description" size="20" value="<%$topic->Description%>" /></td>
+ <td><input type="submit" name="Delete-Topic-<%$topic->Id%>" value="Delete" /></td>
+</tr>
+</table>
+<%args>
+$topic
+</%args>
+</%def>
+
+<%def .tree>
+% my $topic = $Element->getNodeValue;
+% unless ($Element->isRoot) {
+% if ($Modify and $topic->Id == $Modify) {
+% $Action = "";
+<& .edit, topic => $topic &>
+% } else {
+<a href="<%RT->Config->Get('WebPath')%><% $m->request_comp->path |n %>?id=<%$RootObj->Id%>&Modify=<%$topic->Id%>"
+ title="<%$topic->Description%>"><%$topic->Name || loc("(no name)") %></a>
+% }
+% }
+<ul>
+% for my $e (sort {$a->getNodeValue->Name cmp $b->getNodeValue->Name} $Element->getAllChildren) {
+<li><& .tree, Element => $e, Action => $Action, Prefix => $Prefix, RootObj => $RootObj, Modify => $Modify &></li>
+% }
+% if ($Action) {
+% unless ($Action eq "Move" and grep {$_->getNodeValue->Id == $Modify} $Element->getAllChildren) {
+<li><input type="submit" name="<%$Prefix%>-<%$topic eq "root" ? 0 : $topic->Id%>" value="<% $Action eq 'Move' ? loc('Move here') : loc('Add here') %>" /></li>
+% }
+% }
+</ul>
+<%args>
+$Element
+$Action
+$Prefix
+$RootObj
+$Modify
+</%args>
+</%def>
+
+<%INIT>
+
+my @results;
+
+for my $k (keys %ARGS) {
+ if ($k =~ /^Topic-(\d+)-(Name|Description)/) {
+ my $topic = RT::Topic->new($session{'CurrentUser'});
+ $topic->Load($1);
+ if ($topic->Id) {
+ next if $ARGS{$k} eq $topic->$2;
+ my $proc = "Set$2";
+ my ($val, $msg) = $topic->$proc($ARGS{$k});
+ push @results, $msg;
+ } else {
+ $m->comp("/Elements/Error", Why => loc("Topic not found"));
+ }
+ } elsif ($k =~ /^Topic-(\d+)-Parent-(\d+)/) {
+ my $topic = RT::Topic->new($session{'CurrentUser'});
+ $topic->Load($1);
+ if ($topic->Id) {
+ next if $2 eq $topic->Parent;
+ my $old = $topic->Parent;
+ my $new = "$2";
+ my ($val, $msg) = $topic->setParent($new);
+ push @results, $msg;
+ } else {
+ $m->comp("/Elements/Error", Why => loc("Topic not found"));
+ }
+ } elsif ($k =~ /^Insert-(\d+)/) {
+ my $topic = RT::Topic->new($session{'CurrentUser'});
+ my ($id, $msg) = $topic->Create(
+ Parent => $1,
+ Name => $ARGS{'Name'},
+ Description => $ARGS{'Description'},
+ ObjectType => ref($RootObj),
+ ObjectId => $RootObj->Id,
+ );
+ push @results, $msg;
+ }
+}
+for my $k (keys %ARGS) {
+ next unless $k =~ /^Delete-Topic-(\d+)/;
+ my $topic = RT::Topic->new($session{'CurrentUser'});
+ $topic->Load($1);
+ if ($topic->Id) {
+ my ($val, $msg) = $topic->DeleteAll();
+ push @results, $msg;
+ } else {
+ $m->comp("/Elements/Error", Why => loc("Topic not found"));
+ }
+}
+
+my $topics = RT::Topics->new($session{'CurrentUser'});
+$topics->LimitToObject($RootObj);
+$topics->OrderByCols({FIELD => 'Parent'}, {FIELD => 'id'});
+
+use Tree::Simple;
+my $tree = Tree::Simple->new(Tree::Simple->ROOT);
+my %lookup = (0 => $tree);
+
+my @todo;
+while (my $topic = $topics->Next) {
+ push @todo, $topic;
+}
+
+{
+ my $changed = 0;
+ my @work = @todo;
+ @todo = ();
+ for my $topic (@work) {
+ if (defined $lookup{$topic->Parent}) {
+ $lookup{$topic->Id} = Tree::Simple->new($topic, $lookup{$topic->Parent});
+ $changed = 1;
+ } else {
+ push @todo, $topic;
+ }
+ }
+ redo unless $changed == 0;
+}
+
+for my $topic (@todo) {
+ $topic->setParent(0);
+ $lookup{$topic->Id} = Tree::Simple->new($topic, $tree);
+ push @results, "Reparented orphan ".$topic->Id." to root";
+}
+
+</%INIT>
+
+
+<%ARGS>
+$RootObj => undef
+$title => ""
+$Modify => ""
+</%ARGS>
+
diff --git a/rt/share/html/Admin/Articles/index.html b/rt/share/html/Admin/Articles/index.html
new file mode 100644
index 000000000..d697dc3e0
--- /dev/null
+++ b/rt/share/html/Admin/Articles/index.html
@@ -0,0 +1,50 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
+%# <sales@bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<& /Elements/Header, Title => loc('Article Administration') &>
+<& /Elements/Tabs &>
+<& /Elements/ListMenu, menu => Menu()->child('tools')->child('config')->child('articles') &>
diff --git a/rt/share/html/Admin/CustomFields/GroupRights.html b/rt/share/html/Admin/CustomFields/GroupRights.html
index 2c516d0b2..31c09afc0 100644
--- a/rt/share/html/Admin/CustomFields/GroupRights.html
+++ b/rt/share/html/Admin/CustomFields/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,54 +46,16 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => $title &>
-<& /Admin/Elements/CustomFieldTabs,
- id => $id,
- current_tab => "Admin/CustomFields/GroupRights.html?id=".$id,
- Title => $title
-&>
+<& /Elements/Tabs &>
<& /Elements/ListActions, actions => \@results &>
- <form method="post" action="GroupRights.html">
+ <form method="post" action="GroupRights.html" id="ModifyGroupRights" name="ModifyGroupRights">
<input type="hidden" class="hidden" name="id" value="<% $CustomFieldObj->id %>" />
-
-
-<h1><&|/l&>System groups</&></h1>
-<table>
-% my $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 => $CustomFieldObj &>
- </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 => $CustomFieldObj &>
- </td>
- </tr>
-% }
-</table>
-
- <& /Elements/Submit, Caption => loc("Be sure to save your changes"), Reset => 1 &>
-
+
+ <& /Admin/Elements/EditRights, Context => $CustomFieldObj, Principals => \@principals &>
+ <& /Elements/Submit, Label => loc('Save Changes') &>
</form>
-
+
<%INIT>
if (!defined $id) {
@@ -103,10 +65,12 @@ if (!defined $id) {
my $CustomFieldObj = RT::CustomField->new($session{'CurrentUser'});
$CustomFieldObj->Load($id) || $m->comp("/Elements/Error", Why => loc("Couldn't load CustomField [_1]",$id));
-my @results = ProcessACLChanges( \%ARGS );
+my @results = ProcessACLs( \%ARGS );
my $title = loc('Modify group rights for custom field [_1]', $CustomFieldObj->Name);
-
+
+# Principal collections
+my @principals = GetPrincipalsMap($CustomFieldObj, qw(System Groups));
</%INIT>
<%ARGS>
diff --git a/rt/share/html/Admin/CustomFields/Modify.html b/rt/share/html/Admin/CustomFields/Modify.html
index 249fdb1b4..4ed86b60b 100644
--- a/rt/share/html/Admin/CustomFields/Modify.html
+++ b/rt/share/html/Admin/CustomFields/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,23 +46,20 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => $title &>
-<& /Admin/Elements/CustomFieldTabs,
- id => $CustomFieldObj->Id ,
- current_tab => $current_tab,
- Title => $title &>
+<& /Elements/Tabs &>
<& /Elements/ListActions, actions => \@results &>
-<form method="post" action="Modify.html" name="ModifyCustomField">
+<form method="post" action="Modify.html" name="ModifyCustomField" id="ModifyCustomField">
<input type="hidden" class="hidden" name="id" value="<% $id %>" />
<table>
<tr><td class="label"><&|/l&>Name</&></td>
-<td><input name="Name" value="<% $CustomFieldObj->Name || '' %>" size="20" /></td></tr>
+<td><input name="Name" value="<% $CustomFieldObj->Name || $Name || '' %>" size="20" /></td></tr>
<tr><td class="label"><&|/l&>Description</&></td>
-<td><input name="Description" value="<% $CustomFieldObj->Description || '' %>" size="80" /></td></tr>
+<td><input name="Description" value="<% $CustomFieldObj->Description || $Description || '' %>" size="80" /></td></tr>
<tr><td class="label"><&|/l&>Type</&></td>
<td><& /Admin/Elements/SelectCustomFieldType,
@@ -70,6 +67,19 @@
Default => $CustomFieldObj->TypeComposite, &>
</td></tr>
+% if ( $CustomFieldObj->Id and $CustomFieldObj->HasRenderTypes ) {
+<tr>
+ <td class="label"><&|/l&>Render Type</&></td>
+ <td>
+ <& /Admin/Elements/SelectCustomFieldRenderType,
+ Name => "RenderType",
+ TypeComposite => $CustomFieldObj->TypeComposite,
+ Default => $CustomFieldObj->RenderType,
+ BasedOn => $CustomFieldObj->BasedOnObj->id, &>
+ </td>
+</tr>
+% }
+
% if ( $CustomFieldObj->Id and $CustomFieldObj->IsSelectionType and RT->Config->Get('CustomFieldValuesSources') and ( scalar(@{RT->Config->Get('CustomFieldValuesSources')}) > 0 ) ) {
<tr><td class="label"><&|/l&>Field values source:</&></td><td>
<& /Admin/Elements/EditCustomFieldValuesSource, CustomField => $CustomFieldObj &>
@@ -79,7 +89,7 @@
<tr><td class="label"><&|/l&>Applies to</&></td>
<td><& /Admin/Elements/SelectCustomFieldLookupType,
Name => "LookupType",
- Default => $CustomFieldObj->LookupType, &>
+ Default => $CustomFieldObj->LookupType || $LookupType, &>
</td></tr>
% if ( $CustomFieldObj->Id
@@ -90,42 +100,44 @@
</td></tr>
% }
-<tr><td class="label"><&|/l&>Validation</&></td>
+<tr class="edit_validation"><td class="label"><&|/l&>Validation</&></td>
<td><& /Widgets/ComboBox,
Name => 'Pattern',
- Default => $CustomFieldObj->Pattern,
+ Default => $CustomFieldObj->Pattern || $Pattern,
Size => 20,
Values => \@CFvalidations,
&></td></tr>
<tr><td class="label"><&|/l&>Link values to</&></td><td>
-<input size="60" name="LinkValueTo" value="<% $CustomFieldObj->LinkValueTo || '' %>" />
+<input size="60" name="LinkValueTo" value="<% $CustomFieldObj->LinkValueTo || $LinkValueTo || '' %>" />
<div class="hints">
<&|/l&>RT can make this custom field's values into hyperlinks to another service.</&>
<&|/l&>Fill in this field with a URL.</&>
-<&|/l&>RT will replace <tt>__id__</tt> and <tt>__CustomField__</tt> with the record id and custom field value, respectively</&>
+<&|/l_unsafe, '<tt>__id__</tt>', '<tt>__CustomField__</tt>' &>RT will replace [_1] and [_2] with the record's id and the custom field's value, respectively.</&>
</div></td></tr>
<tr><td class="label"><&|/l&>Include page</&></td><td>
-<input size="60" name="IncludeContentForValue" value="<% $CustomFieldObj->IncludeContentForValue || '' %>" />
+<input size="60" name="IncludeContentForValue" value="<% $CustomFieldObj->IncludeContentForValue || $IncludeContentForValue || '' %>" />
<div class="hints">
<&|/l&>RT can include content from another web service when showing this custom field.</&>
<&|/l&>Fill in this field with a URL.</&>
-<&|/l&>RT will replace <tt>__id__</tt> and <tt>__CustomField__</tt> with the record id and custom field value, respectively</&>
+<&|/l_unsafe, '<tt>__id__</tt>', '<tt>__CustomField__</tt>' &>RT will replace [_1] and [_2] with the record's id and the custom field's value, respectively.</&>
<i><&|/l&>Some browsers may only load content from the same domain as your RT server.</&></i>
</div></td></tr>
% if ( $CustomFieldObj->Id && $CustomFieldObj->IsSelectionType && !$CustomFieldObj->IsExternalValues ) {
-<tr><td class="label"><&|/l&>Categories are based on</&></td><td>
+<tr class="categoriesbasedon"><td class="label"><&|/l&>Categories are based on</&></td><td>
<& /Admin/Elements/SelectCustomField,
Name => "BasedOn",
LookupType => $CustomFieldObj->LookupType,
- Default => $CustomFieldObj->BasedOnObj,
+ Default => $CustomFieldObj->BasedOnObj || $BasedOn,
Not => $CustomFieldObj->id,
&>
</td></tr>
% }
+% $m->callback(CallbackName => 'BeforeEnabled', CustomField => $CustomFieldObj, CFvalidations => \@CFvalidations);
+
<tr><td class="label">&nbsp;</td><td>
<input type="checkbox" class="checkbox" name="Required" value="1" <% $RequiredChecked |n%> />
<&|/l&>Required for ticket resolution</&>
@@ -137,6 +149,8 @@
<&|/l&>Enabled (Unchecking this box disables this custom field)</&>
</td></tr>
+% $m->callback(CallbackName => 'EndOfTable', CustomField => $CustomFieldObj, CFvalidations => \@CFvalidations);
+
</table>
% if ( $CustomFieldObj->Id && $CustomFieldObj->IsSelectionType && !$CustomFieldObj->IsExternalValues ) {
@@ -151,15 +165,15 @@
</form>
<%INIT>
-my ($title, @results, $Disabled);
+my ($title, @results);
my $CustomFieldObj = RT::CustomField->new( $session{'CurrentUser'} );
-my $current_tab = 'Admin/CustomFields/Modify.html';
+
+$m->callback(CallbackName => 'Initial', Pattern => \$Pattern, ARGSRef => \%ARGS);
unless ( $id ) {
$title = loc("Create a CustomField");
$id = 'new';
- $current_tab .= '?Create=1';
}
else {
if ( $id eq 'new' ) {
@@ -172,20 +186,27 @@ else {
LinkValueTo => $LinkValueTo,
IncludeContentForValue => $IncludeContentForValue,
BasedOn => $BasedOn,
+ Disabled => !$Enabled,
);
- $m->comp( "/Elements/Error", Why => loc( "Could not create CustomField", $msg ) ) unless $val;
- push @results, $msg;
- $title = loc( 'Created CustomField [_1]', $CustomFieldObj->Name );
+ if (!$val) {
+ push @results, loc("Could not create CustomField: [_1]", $msg);
+ $title = loc( 'Create a CustomField');
+ }
+ else {
+ push @results, loc("Object created");
+ $title = loc( 'Created CustomField [_1]', $CustomFieldObj->Name );
+ }
} else {
- $CustomFieldObj->Load( $id ) || $m->comp("/Elements/Error", Why => loc('No CustomField') );
+ push @results, loc('No CustomField')
+ unless $CustomFieldObj->Load( $id );
+
$title = loc( 'Editing CustomField [_1]', $CustomFieldObj->Name );
}
- $current_tab .= "?id=$id";
}
if ( $ARGS{'Update'} && $id ne 'new' ) {
#we're asking about enabled on the web page but really care about disabled.
- $ARGS{'Disabled'} = $Disabled = $Enabled? 0 : 1;
+ $ARGS{'Disabled'} = $Enabled? 0 : 1;
$ARGS{'Required'} ||= 0;
@@ -197,7 +218,32 @@ if ( $ARGS{'Update'} && $id ne 'new' ) {
);
$CustomFieldObj->SetValuesClass( $ValuesClass );
- $CustomFieldObj->SetBasedOn( $BasedOn );
+ # Set the render type if we have it, but unset it if the new type doesn't
+ # support render types
+ if ( $CustomFieldObj->HasRenderTypes($TypeComposite) ) {
+ my $original = $CustomFieldObj->RenderType;
+
+ if ( defined $RenderType and $RenderType ne $original ) {
+ # It's changed! Let's update it.
+ my ($good, $msg) = $CustomFieldObj->SetRenderType( $RenderType );
+
+ if ( $good ) {
+ $msg = loc("[_1] changed from '[_2]' to '[_3]'",
+ loc("Render Type"), $original, $RenderType );
+ }
+
+ push @results, $msg;
+ }
+ }
+ else {
+ # Delete it if we no longer support render types
+ $CustomFieldObj->SetRenderType( undef );
+ }
+
+ if (($CustomFieldObj->BasedOn||'') ne ($BasedOn||'')) {
+ my ($good, $msg) = $CustomFieldObj->SetBasedOn( $BasedOn );
+ push @results, $msg;
+ }
$CustomFieldObj->SetUILocation( $UILocation );
@@ -227,10 +273,12 @@ if ( $ARGS{'Update'} && $id ne 'new' ) {
$ARGS{$param} =~ s/^\s+//;
$ARGS{$param} =~ s/\s+$//;
next if ($value->$attr()||'') eq ($ARGS{$param}||'');
+
my $mutator = "Set$attr";
my ($id, $msg) = $value->$mutator( $ARGS{$param} );
push (@results, $msg);
}
+ $m->callback(CallbackName => 'AfterUpdateCustomFieldValue', CustomFieldObj => $CustomFieldObj, CustomFieldValueObj => $value, ARGSRef => \%ARGS );
}
# Add any new values
@@ -242,11 +290,23 @@ if ( $ARGS{'Update'} && $id ne 'new' ) {
$_ => $ARGS{ $paramtag ."-new-$_" } } qw/ Name Description SortOrder Category/
);
push (@results, $msg);
+
+ my $cfv = RT::CustomFieldValue->new( $session{CurrentUser} );
+ $cfv->Load($id);
+ $m->callback(CallbackName => 'AfterCreateCustomFieldValue',
+CustomFieldObj => $CustomFieldObj, CustomFieldValueObj => $cfv, ARGSRef => \%ARGS );
}
}
$id = $CustomFieldObj->id if $CustomFieldObj->id;
+# This code does automatic redirection if any updates happen.
+MaybeRedirectForResults(
+ Actions => \@results,
+ Arguments => { id => $id },
+) if $CustomFieldObj->id;
+
+
my $EnabledChecked = qq[checked="checked"];
$EnabledChecked = '' if $CustomFieldObj->Disabled;
@@ -274,6 +334,7 @@ $Name => undef
$SetEnabled => undef
$Enabled => 0
$ValuesClass => 'RT::CustomFieldValues'
+$RenderType => undef
$LinkValueTo => undef
$IncludeContentForValue => undef
$BasedOn => undef
diff --git a/rt/share/html/Admin/CustomFields/Objects.html b/rt/share/html/Admin/CustomFields/Objects.html
index 8fb00a812..91dc5dcfb 100644
--- a/rt/share/html/Admin/CustomFields/Objects.html
+++ b/rt/share/html/Admin/CustomFields/Objects.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/CustomFieldTabs,
- id => $id,
- current_tab => "Admin/CustomFields/Objects.html?id=".$id,
- Title => $title
- &>
+<& /Elements/Tabs &>
<& /Elements/ListActions, actions => \@results &>
@@ -67,6 +63,7 @@
<input type="checkbox" name="AddCustomField-<% $CF->id %>" value="0" />
<&|/l&>check this box to apply this Custom Field to all objects.</&>
+% unless ( $CF->ApplyGlobally ) {
<h2><&|/l&>Selected objects</&></h2>
<& /Elements/CollectionList,
OrderBy => 'id',
@@ -102,12 +99,14 @@
% }
+% }
+
<& /Elements/Submit, Name => 'UpdateObjs' &>
</form>
<%INIT>
my $CF = RT::CustomField->new($session{'CurrentUser'});
-$CF->Load($id) or Abort(loc("Could not load CustomField [_1]"), $id);
+$CF->Load($id) or Abort(loc("Could not load CustomField [_1]", $id));
my $class = $CF->RecordClassFromLookupType;
Abort(loc("Something wrong. Contact system administrator"))
diff --git a/rt/share/html/Admin/CustomFields/UserRights.html b/rt/share/html/Admin/CustomFields/UserRights.html
index f581588a8..608d5dc40 100644
--- a/rt/share/html/Admin/CustomFields/UserRights.html
+++ b/rt/share/html/Admin/CustomFields/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,43 +46,17 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => $title &>
-<& /Admin/Elements/CustomFieldTabs, id => $id,
-current_tab => "Admin/CustomFields/UserRights.html?id=".$id,
-Title => $title, &>
+<& /Elements/Tabs &>
<& /Elements/ListActions, actions => \@results &>
- <form method="post" action="UserRights.html">
+ <form method="post" action="UserRights.html" name="ModifyUserRights" id="ModifyUserRights">
<input type="hidden" class="hidden" name="id" value="<% $CustomFieldObj->id %>" />
-
-
-<table>
-
-% 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 => $CustomFieldObj &>
- </td>
- </tr>
-% }
- </table>
-
- <& /Elements/Submit, Caption => loc("Be sure to save your changes"), Reset => 1 &>
-
+ <& /Admin/Elements/EditRights, Context => $CustomFieldObj, Principals => \@principals &>
+ <& /Elements/Submit, Label => loc('Save Changes') &>
</form>
-
<%INIT>
-
-#Update the acls.
-my @results = ProcessACLChanges( \%ARGS );
-
-# {{{ Deal with setting up the display of current rights.
-
-
+# Update the acls.
+my @results = ProcessACLs( \%ARGS );
if (!defined $id) {
$m->comp("/Elements/Error", Why => loc("No Class defined"));
@@ -91,20 +65,12 @@ if (!defined $id) {
my $CustomFieldObj = RT::CustomField->new($session{'CurrentUser'});
$CustomFieldObj->Load($id) || $m->comp("/Elements/Error", Why => loc("Couldn't load Class [_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 $title = loc('Modify user rights for custom field [_1]', $CustomFieldObj->Name);
-
-# }}}
-
+
+# Principal collections
+my @principals = GetPrincipalsMap($CustomFieldObj, qw(Users));
</%INIT>
<%ARGS>
$id => undef
-$UserString => undef
-$UserOp => undef
-$UserField => undef
</%ARGS>
diff --git a/rt/share/html/Admin/CustomFields/index.html b/rt/share/html/Admin/CustomFields/index.html
index 2835b1292..b8bc447d2 100644
--- a/rt/share/html/Admin/CustomFields/index.html
+++ b/rt/share/html/Admin/CustomFields/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,10 +46,7 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => $title &>
-<& /Admin/Elements/CustomFieldTabs,
- current_tab => 'Admin/CustomFields/',
- Title => $title,
-&>
+<& /Elements/Tabs &>
% my $tmp = RT::CustomField->new( $session{'CurrentUser'} );
% if ( $Type ) {
@@ -84,6 +81,8 @@
<&|/l&>Include disabled custom fields in listing.</&>
<br />
+% $m->callback(CallbackName => 'BeforeSubmit');
+
<input type="submit" value="<% loc('Go!') %>" />
</form>
@@ -107,6 +106,8 @@ $CustomFields->UnLimit;
$CustomFields->FindAllRows if $ShowDisabled;
$CustomFields->LimitToLookupType( $Type ) if $Type;
+$m->callback(CallbackName => 'MassageCustomFields', CustomFields => $CustomFields);
+
$Format ||= RT->Config->Get('AdminSearchResultFormat')->{'CustomFields'};
</%INIT>
diff --git a/rt/share/html/Admin/Elements/AddCustomFieldValue b/rt/share/html/Admin/Elements/AddCustomFieldValue
index 4871f7a17..4a68c369d 100755
--- a/rt/share/html/Admin/Elements/AddCustomFieldValue
+++ b/rt/share/html/Admin/Elements/AddCustomFieldValue
@@ -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)
@@ -54,7 +54,7 @@
<th><&|/l&>Name</&></th>
<th><&|/l&>Description</&></th>
% if ( $CustomField->Type ne 'Combobox' ) {
-<th><&|/l&>Category</&></th>
+<th class="categoryheader"><&|/l&>Category</&></th>
% }
</tr>
@@ -68,16 +68,18 @@
% my $BasedOnObj = $CustomField->BasedOnObj;
% if ( $BasedOnObj and $BasedOnObj->id ) {
% my $Categories = $BasedOnObj->Values;
-<select name="<% $paramtag %>-Category" size="1">
+<select class="editcategory" name="<% $paramtag %>-Category" size="1">
<option value=""><&|/l&>(no value)</&></option>
% while (my $Value = $Categories->Next) {
<option value="<% $Value->Name %>"><% $Value->Name %></option>
% }
% } else {
-<input type="text" size="10" name="<% $paramtag %>-Category" value="" />
+<input type="text" size="10" class="editcategory" name="<% $paramtag %>-Category" value="" />
% }
</td>
% }
+
+% $m->callback(CallbackName => 'AfterCustomFieldValueInput', CustomFieldObj => $CustomField, ARGSRef => \%ARGS );
</tr>
</table>
diff --git a/rt/share/html/Admin/Elements/ConfigureMyRT b/rt/share/html/Admin/Elements/ConfigureMyRT
index f9b472d99..8b625a901 100644
--- a/rt/share/html/Admin/Elements/ConfigureMyRT
+++ b/rt/share/html/Admin/Elements/ConfigureMyRT
@@ -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)
diff --git a/rt/share/html/Admin/Elements/CreateUserCalled b/rt/share/html/Admin/Elements/CreateUserCalled
index bf994be85..5f83f4b3d 100755
--- a/rt/share/html/Admin/Elements/CreateUserCalled
+++ b/rt/share/html/Admin/Elements/CreateUserCalled
@@ -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)
diff --git a/rt/share/html/Admin/Elements/CustomFieldTabs b/rt/share/html/Admin/Elements/CustomFieldTabs
deleted file mode 100644
index 17b241cb7..000000000
--- a/rt/share/html/Admin/Elements/CustomFieldTabs
+++ /dev/null
@@ -1,121 +0,0 @@
-%# BEGIN BPS TAGGED BLOCK {{{
-%#
-%# COPYRIGHT:
-%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
-%# <sales@bestpractical.com>
-%#
-%# (Except where explicitly superseded by other copyright notices)
-%#
-%#
-%# LICENSE:
-%#
-%# This work is made available to you under the terms of Version 2 of
-%# the GNU General Public License. A copy of that license should have
-%# been provided with this software, but in any event can be snarfed
-%# from www.gnu.org.
-%#
-%# This work is distributed in the hope that it will be useful, but
-%# WITHOUT ANY WARRANTY; without even the implied warranty of
-%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-%# General Public License for more details.
-%#
-%# You should have received a copy of the GNU General Public License
-%# along with this program; if not, write to the Free Software
-%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-%# 02110-1301 or visit their web page on the internet at
-%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-%#
-%#
-%# CONTRIBUTION SUBMISSION POLICY:
-%#
-%# (The following paragraph is not intended to limit the rights granted
-%# to you to modify and distribute this software under the terms of
-%# the GNU General Public License and is only of importance to you if
-%# you choose to contribute your changes and enhancements to the
-%# community by submitting them to Best Practical Solutions, LLC.)
-%#
-%# By intentionally submitting any modifications, corrections or
-%# derivatives to this work, or any other work intended for use with
-%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-%# you are the copyright holder for those contributions and you grant
-%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-%# royalty-free, perpetual, license to use, copy, create derivative
-%# works based on those contributions, and sublicense and distribute
-%# those contributions and any derivatives thereof.
-%#
-%# END BPS TAGGED BLOCK }}}
-<& /Admin/Elements/Tabs,
- current_tab => 'Admin/CustomFields/',
- subtabs => $tabs,
- current_subtab => $current_tab,
- Title => $Title &>
-<%INIT>
-my $tabs;
-
-if ($id) {
- my $cf = RT::CustomField->new( $session{'CurrentUser'} );
- $cf->Load($id);
- $tabs = {
- this => {
- title => $cf->Name,
- path => "Admin/CustomFields/Modify.html?id=" . $id,
- current_subtab => $current_tab,
-
- subtabs => {
-
- C => { title => loc('Basics'),
- path => "Admin/CustomFields/Modify.html?id=" . $id,
- },
- F => { title => loc('Group Rights'),
- path => "Admin/CustomFields/GroupRights.html?id="
- . $id, },
- G => {
- title => loc('User Rights'),
- path => "Admin/CustomFields/UserRights.html?id=" . $id,
- },
-
- } }
-
- };
-
-
- if ($cf->LookupType =~ /^RT::(?:Queue|Group)(?:\Z|-)/i) {
- $tabs->{'this'}->{subtabs}->{D} = {
- title => loc('Applies to'),
- path => "Admin/CustomFields/Objects.html?id=" . $id,
- };
- }
-}
-
-if ( $session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'AdminCustomField')
- || $session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'AdminCustomFieldValues') ) {
- $tabs->{"A"} = { title => loc('Select'),
- path => "Admin/CustomFields/",
- };
-}
-if ($session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'AdminCustomField')) {
- $tabs->{"B"} = { title => loc('Create'),
- path => "Admin/CustomFields/Modify.html?Create=1",
- separator => 1,
- };
-}
-
- # Now let callbacks add their extra tabs
- $m->callback( %ARGS, tabs => $tabs );
-
-foreach my $tab (sort keys %{$tabs->{'this'}->{'subtabs'}}) {
- if ($tabs->{'this'}->{'subtabs'}->{$tab}->{'path'} eq $current_tab) {
- $tabs->{'this'}->{'subtabs'}->{$tab}->{'subtabs'} = $subtabs;
- $tabs->{'this'}->{'subtabs'}->{$tab}->{'current_subtab'} = $current_subtab;
- }
-}
-if( $id ) { $current_tab = "Admin/CustomFields/Modify.html?id=" . $id }
-</%INIT>
-<%ARGS>
-$Title => undef
-$id => undef
-$current_tab => undef
-$subtabs => undef
-$current_subtab => undef
-</%ARGS>
diff --git a/rt/share/html/Admin/Elements/EditCustomField b/rt/share/html/Admin/Elements/EditCustomField
index 920698d98..632b3d8f8 100755
--- a/rt/share/html/Admin/Elements/EditCustomField
+++ b/rt/share/html/Admin/Elements/EditCustomField
@@ -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)
diff --git a/rt/share/html/Admin/Elements/EditCustomFieldValues b/rt/share/html/Admin/Elements/EditCustomFieldValues
index c2a027b81..4d0dc51b8 100755
--- a/rt/share/html/Admin/Elements/EditCustomFieldValues
+++ b/rt/share/html/Admin/Elements/EditCustomFieldValues
@@ -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)
@@ -58,7 +58,7 @@
<th><&|/l&>Name</&></th>
<th><&|/l&>Description</&></th>
% if ($CustomField->Type ne 'Combobox') {
-<th><&|/l&>Category</&></th>
+<th class="categoryheader"><&|/l&>Category</&></th>
% }
</tr>
@@ -68,22 +68,23 @@
<td><input type="checkbox" class="checkbox" name="Delete-<% $paramtag %>" /></td>
<td><input type="text" size="3" name="<% $paramtag %>-SortOrder" value="<% $value->SortOrder %>" /></td>
<td><input type="text" size="25" name="<% $paramtag %>-Name" value="<% $value->Name %>" /></td>
-<td><input type="text" size="45" name="<% $paramtag %>-Description" value="<% $value->Description %>" /></td>
+<td><input type="text" size="45" name="<% $paramtag %>-Description" value="<% $value->Description || '' %>" /></td>
% if ( $CustomField->Type ne 'Combobox' ) {
<td>
% if ( $Categories ) {
% my $selected = $value->Category;
% $selected = '' unless defined $selected;
-<select name="<% $paramtag %>-Category" size="1">
+<select class="editcategory" name="<% $paramtag %>-Category" size="1">
<option value=""<% $selected eq '' ? q[ selected="selected"] : "" |n%>><&|/l&>(no value)</&></option>
% while (my $Value = $Categories->Next) {
<option value="<% $Value->Name %>"<% $selected eq $Value->Name ? q[ selected="selected"] : "" |n%>><% $Value->Name %></option>
% }
% } else {
-<input type="text" size="10" name="<% $paramtag %>-Category" value="<% $value->Category || '' %>" />
+<input type="text" size="10" class="editcategory" name="<% $paramtag %>-Category" value="<% $value->Category || '' %>" />
% }
</td>
% }
+% $m->callback(CallbackName => 'AfterCustomFieldValueInput', CustomFieldObj => $CustomField, CustomFieldValueObj => $value, ARGSRef => \%ARGS );
</tr>
% }
diff --git a/rt/share/html/Admin/Elements/EditCustomFieldValuesSource b/rt/share/html/Admin/Elements/EditCustomFieldValuesSource
index 9455c74db..5b11ec8e0 100644
--- a/rt/share/html/Admin/Elements/EditCustomFieldValuesSource
+++ b/rt/share/html/Admin/Elements/EditCustomFieldValuesSource
@@ -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)
diff --git a/rt/share/html/Admin/Elements/EditCustomFields b/rt/share/html/Admin/Elements/EditCustomFields
index 91d5cffaa..d9d9134e7 100755
--- a/rt/share/html/Admin/Elements/EditCustomFields
+++ b/rt/share/html/Admin/Elements/EditCustomFields
@@ -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)
@@ -128,6 +128,7 @@ if ( $MoveCustomFieldDown ) { {
if ( $UpdateCFs ) {
foreach my $cf_id ( @AddCustomField ) {
my $CF = RT::CustomField->new( $session{'CurrentUser'} );
+ $CF->SetContextObject( $Object );
$CF->Load( $cf_id );
unless ( $CF->id ) {
push @results, loc("Couldn't load CustomField #[_1]", $cf_id);
@@ -138,6 +139,7 @@ if ( $UpdateCFs ) {
}
foreach my $cf_id ( @RemoveCustomField ) {
my $CF = RT::CustomField->new( $session{'CurrentUser'} );
+ $CF->SetContextObject( $Object );
$CF->Load( $cf_id );
unless ( $CF->id ) {
push @results, loc("Couldn't load CustomField #[_1]", $cf_id);
@@ -153,6 +155,7 @@ $m->callback(CallbackName => 'UpdateExtraFields', Results => \@results, Object =
my $applied_cfs = RT::CustomFields->new( $session{'CurrentUser'} );
$applied_cfs->LimitToLookupType($lookup);
$applied_cfs->LimitToGlobalOrObjectId($id);
+$applied_cfs->SetContextObject( $Object );
$applied_cfs->ApplySortOrder;
my $not_applied_cfs = RT::CustomFields->new( $session{'CurrentUser'} );
diff --git a/rt/share/html/Admin/Groups/CustomFields.html b/rt/share/html/Admin/Elements/EditQueueWatcherGroup
index 21f15a99b..8bc1de29a 100644
--- a/rt/share/html/Admin/Groups/CustomFields.html
+++ b/rt/share/html/Admin/Elements/EditQueueWatcherGroup
@@ -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,4 +45,12 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-<& /Admin/Elements/ObjectCustomFields, %ARGS, ObjectType => 'RT::Group' &>
+<%ARGS>
+$Label
+$QueueObj
+$Watchers
+</%ARGS>
+<span><% $Label %>:</span>
+
+<& /Admin/Elements/EditQueueWatchers, QueueObj => $QueueObj, Watchers => $Watchers &>
+
diff --git a/rt/share/html/Admin/Elements/EditQueueWatchers b/rt/share/html/Admin/Elements/EditQueueWatchers
index 017c9ec8e..073278c9e 100755
--- a/rt/share/html/Admin/Elements/EditQueueWatchers
+++ b/rt/share/html/Admin/Elements/EditQueueWatchers
@@ -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)
diff --git a/rt/share/html/Admin/Elements/EditRights b/rt/share/html/Admin/Elements/EditRights
new file mode 100644
index 000000000..e67359313
--- /dev/null
+++ b/rt/share/html/Admin/Elements/EditRights
@@ -0,0 +1,175 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
+%# <sales@bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<%args>
+$Context
+$Principals
+$AddPrincipal => undef
+</%args>
+<%init>
+use Scalar::Util qw(blessed);
+
+# Let callbacks get at principals and context before we do anything with them
+$m->callback( Principals => $Principals, Context => $Context );
+
+# Try to detect if we want to include an add user/group box
+unless ( $AddPrincipal ) {
+ my $last = $Principals->[-1];
+ if ( $last->[0] =~ /Groups/i ) {
+ $AddPrincipal = 'group'; # loc
+ }
+ elsif ( $last->[0] =~ /Users/i ) {
+ $AddPrincipal = 'user'; # loc
+ }
+}
+</%init>
+%# Principals is an array of arrays, where the inner arrays are like:
+%# [ 'Category name' => $CollectionObj => 'DisplayColumn' => 1 ]
+%# The last value is a boolen determining if the value of DisplayColumn
+%# should be loc()-ed before display.
+
+<script type="text/javascript">
+ jQuery(function() {
+ jQuery(".rights-editor").tabs({
+ select: function(ev, ui) {
+ window.location.hash = ui.tab.hash;
+ }
+ });
+ jQuery(".rights-editor .category-tabs").tabs();
+ });
+</script>
+
+<div class="rights-editor clearfix">
+ <ul>
+<%perl>
+for my $category (@$Principals) {
+ my ($name, $collection, $col, $loc) = @$category;
+</%perl>
+<li class="category"><% loc($name) %></li>
+<%perl>
+ while ( my $obj = $collection->Next ) {
+ my $display = ref $col eq 'CODE' ? $col->($obj) : $obj->$col;
+ my $id = "acl-$name-" . $obj->PrincipalId;
+ $id =~ s/[^a-zA-Z0-9\-]/_/g;
+</%perl>
+<li><a href="#<% $id %>"><% $loc ? loc($display) : $display %></a></li>
+<%perl>
+ }
+}
+</%perl>
+% if ( $AddPrincipal ) {
+ <li class="category"><&|/l, loc($AddPrincipal) &>Add [_1]</&></li>
+ <li class="addprincipal">
+ <a href="#acl-AddPrincipal">
+ <input type="text" value=""
+ name="AddPrincipalForRights-<% lc $AddPrincipal %>"
+ id="AddPrincipalForRights-<% lc $AddPrincipal %>" />
+ <script type="text/javascript">
+ jQuery(function() {
+ jQuery("#AddPrincipalForRights-"+<% lc $AddPrincipal |n,j%>).keyup(function(){
+ toggle_addprincipal_validity(this, true);
+ });
+
+% if (lc $AddPrincipal eq 'group') {
+ jQuery("#AddPrincipalForRights-"+<% lc $AddPrincipal |n,j%>).autocomplete({
+ source: <% RT->Config->Get('WebPath') |n,j%>+"/Helpers/Autocomplete/Groups",
+ select: addprincipal_onselect,
+ change: addprincipal_onchange
+ });
+% }
+ });
+ </script>
+% my $type = lc $AddPrincipal eq 'user' ? loc('username') : loc($AddPrincipal);
+ <span class="warning"><&|/l, $type &>Invalid [_1]</&></span>
+ </a>
+ </li>
+% }
+ </ul>
+
+<%perl>
+# Now generate our rights panels for each principal
+for my $category (@$Principals) {
+ my ($name, $collection, $col, $loc) = @$category;
+ while ( my $obj = $collection->Next ) {
+ my $display = ref $col eq 'CODE' ? $col->($obj) : $obj->$col;
+ my $id = "acl-$name-" . $obj->PrincipalId;
+ $id =~ s/[^a-zA-Z0-9\-]/_/g;
+</%perl>
+
+ <div id="<% $id %>">
+ <h3>
+ <% $loc ? loc($display) : $display %>
+<%perl>
+if ($obj->isa('RT::Group') and $obj->Domain eq 'UserDefined') {
+ my $subgroups = $obj->GroupMembersObj( Recursively => 1 );
+ $subgroups->LimitToUserDefinedGroups;
+ $subgroups->Limit( FIELD => 'Name', OPERATOR => '!=', VALUE => $obj->Name );
+
+ if ( $subgroups->Count ) {
+ my $inc = join ", ", map $_->Name, @{$subgroups->ItemsArrayRef};
+</%perl>
+ <span class="subgroups"><&|/l, $inc &>includes [_1]</&></span>\
+<%perl>
+ }
+}
+</%perl>
+ </h3>
+ <& EditRightsCategoryTabs, Context => $Context, Principal => $obj, id => $id &>
+ </div>
+<%perl>
+ }
+}
+
+if ( $AddPrincipal ) {
+</%perl>
+ <div id="acl-AddPrincipal">
+ <h3><&|/l, loc($AddPrincipal) &>Add rights for this [_1]</&></h3>
+ <& EditRightsCategoryTabs, Context => $Context, id => 'acl-AddPrincipal' &>
+ </div>
+% }
+
+</div>
diff --git a/rt/share/html/Admin/Elements/EditRightsCategoryTabs b/rt/share/html/Admin/Elements/EditRightsCategoryTabs
new file mode 100644
index 000000000..786cafdd8
--- /dev/null
+++ b/rt/share/html/Admin/Elements/EditRightsCategoryTabs
@@ -0,0 +1,129 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
+%# <sales@bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<%args>
+$Context
+$Principal => undef
+$id
+$acldesc => ''
+</%args>
+<%init>
+# XXX OPTIMIZATION: Moving the calls to AvailableRights and RightCategories up
+# one component to avoid calling them for every principal would be a win, but
+# it's cleaner to do it here. The values can really be computed once per
+# $Context.
+
+# Find all our available rights...
+my (%available_rights, %categories);
+if ( blessed($Context) and $Context->can('AvailableRights') ) {
+ %available_rights = %{$Context->AvailableRights};
+} else {
+ %available_rights = ( loc('System Error') => loc("No rights found") );
+}
+
+# ...and their categories
+if ( blessed($Context) and $Context->can('RightCategories') ) {
+ my %right_categories = %{$Context->RightCategories};
+
+ for my $right (keys %available_rights) {
+ push @{$categories{$right_categories{$right}}}, $right;
+ }
+}
+
+# Find all the current rights for this principal
+my %current_rights;
+if ($Principal) {
+ my $acls = RT::ACL->new($session{'CurrentUser'});
+ $acls->LimitToObject( $Context );
+ $acls->LimitToPrincipal( Id => $Principal->PrincipalId );
+
+ while ( my $ace = $acls->Next ) {
+ my $right = $ace->RightName;
+ $current_rights{$right} = 1;
+ }
+}
+
+my %category_desc = (
+ 'General' => loc('General rights'),
+ 'Staff' => loc('Rights for Staff'),
+ 'Admin' => loc('Rights for Administrators'),
+ 'Status' => loc('Status changes'),
+);
+
+my %catsort = ( General => 1, Staff => 2, Admin => 3, Status => 4 );
+
+$acldesc ||= join '-', ($Principal ? $Principal->PrincipalId : 'addprincipal'),
+ ref($Context), $Context->Id;
+</%init>
+ <div class="category-tabs">
+ <ul>
+% for my $category (sort { $catsort{$a} <=> $catsort{$b} } keys %categories) {
+ <li><a href="#<% "$id-$category" %>"><% $category_desc{$category} || loc('Miscellaneous') %></a></li>
+% }
+ </ul>
+% for my $category (sort { $catsort{$a} <=> $catsort{$b} } keys %categories) {
+ <div id="<% "$id-$category" %>">
+ <ul class="rights-list">
+% for my $right (sort { $available_rights{$a} cmp $available_rights{$b} } @{$categories{$category}}) {
+ <li>
+ <input type="checkbox" class="checkbox"
+ name="SetRights-<% $acldesc %>"
+ id="SetRights-<% $acldesc %>-<% $right %>"
+ value="<% $right %>"
+ <% $current_rights{$right} ? 'checked' : '' %> />
+ <label for="SetRights-<% $acldesc %>-<% $right %>" title="<% loc($right) %>">
+ <% loc($available_rights{$right}) %>
+ <span class="separator">&mdash;</span>
+ <span class="rightname"><% loc($right) %></span>
+ </label>
+ </li>
+% }
+ </ul>
+ </div>
+% }
+ </div>
+ <input type="hidden" name="CheckACL" value="<% $acldesc %>" />
diff --git a/rt/share/html/Admin/Elements/EditScrip b/rt/share/html/Admin/Elements/EditScrip
index c2e9de19f..858ab9d9b 100755
--- a/rt/share/html/Admin/Elements/EditScrip
+++ b/rt/share/html/Admin/Elements/EditScrip
@@ -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)
@@ -47,7 +47,7 @@
%# END BPS TAGGED BLOCK }}}
<& /Elements/ListActions, actions => \@actions &>
-<form method="post" action="Scrip.html">
+<form method="post" action="Scrip.html" id="ModifyScrip" name="ModifyScrip">
<input type="hidden" class="hidden" name="id" value="<% $id %>" />
<input type="hidden" class="hidden" name="Queue" value="<% $Queue %>" />
@@ -55,12 +55,13 @@
<table>
<tr><td align="right"><&|/l&>Description</&>:</td><td>
-<input name="Scrip-<% $id %>-Description"
- size="60"
+<tr><td class="label"><&|/l&>Description</&>:</td><td class="value">\
+<input name="Scrip-<% $id %>-Description" \
+ size="60" \
value="<% $ARGS{"Scrip-$id-Description"} || $scrip->Description || '' %>" />
</td></tr>
-<tr><td align="right"><&|/l&>Condition</&>:</td><td>
+<tr><td class="label"><&|/l&>Condition</&>:</td><td class="value">\
<& /Admin/Elements/SelectScripCondition,
Name => "Scrip-$id-ScripCondition",
Default => $ARGS{"Scrip-$id-ScripCondition"} || $scrip->ConditionObj->Id,
@@ -75,7 +76,7 @@
ScripX => $ARGS{"Scrip-$id-ScripCondition"} || $scrip->ConditionObj->Id,
&>
-<tr><td align="right"><&|/l&>Action</&>:</td><td>
+<tr><td class="label"><&|/l&>Action</&>:</td><td class="value">\
<& /Admin/Elements/SelectScripAction,
Name => "Scrip-$id-ScripAction",
Default => $ARGS{"Scrip-$id-ScripAction"} || $scrip->ActionObj->Id,
@@ -90,14 +91,14 @@
ScripX => $ARGS{"Scrip-$id-ScripAction"} || $scrip->ActionObj->Id,
&>
-<tr><td align="right"><&|/l&>Template</&>:</td><td>
+<tr><td class="label"><&|/l&>Template</&>:</td><td class="value">\
<& /Admin/Elements/SelectTemplate,
Name => "Scrip-$id-Template",
Default => $ARGS{"Scrip-$id-Template"} || $scrip->TemplateObj->Id,
Queue => $Queue,
&></td></tr>
-<tr><td align="right"><&|/l&>Stage</&>:</td><td>
+<tr><td class="label"><&|/l&>Stage</&>:</td><td class="value">\
<& /Admin/Elements/SelectStage,
Name => "Scrip-$id-Stage",
Default => $ARGS{"Scrip-$id-Stage"} || $scrip->Stage,
@@ -106,6 +107,7 @@
</table>
</&>
+% if ($session{CurrentUser}->HasRight(Object => $RT::System, Right => 'ExecuteCode')) {
<& /Elements/Submit,
Label => $SubmitLabel,
Reset => 1,
@@ -117,21 +119,21 @@
<i><&|/l&>(Use these fields when you choose 'User Defined' for a condition or action)</&></i>
</td></tr>
-<tr><td class="labeltop"><&|/l&>Custom condition</&>:</td><td>
+<tr><td class="labeltop"><&|/l&>Custom condition</&>:</td><td class="value">
% my $code = $ARGS{"Scrip-$id-CustomIsApplicableCode"} || $scrip->CustomIsApplicableCode || '';
% my $lines = @{[ $code =~ /\n/gs ]} + 3;
% $lines = $min_lines if $lines < $min_lines;
<textarea cols="80" rows="<% $lines %>" name="Scrip-<% $id %>-CustomIsApplicableCode"><% $code %></textarea>
</td></tr>
-<tr><td class="labeltop"><&|/l&>Custom action preparation code</&>:</td><td>
+<tr><td class="labeltop"><&|/l&>Custom action preparation code</&>:</td><td class="value">
% $code = $ARGS{"Scrip-$id-CustomPrepareCode"} || $scrip->CustomPrepareCode || '';
% $lines = @{[ $code =~ /\n/gs ]} + 3;
% $lines = $min_lines if $lines < $min_lines;
<textarea cols="80" rows="<% $lines %>" name="Scrip-<% $id %>-CustomPrepareCode"><% $code %></textarea>
</td></tr>
-<tr><td class="labeltop"><&|/l&>Custom action cleanup code</&>:</td><td>
+<tr><td class="labeltop"><&|/l&>Custom action cleanup code</&>:</td><td class="value">
% $code = $ARGS{"Scrip-$id-CustomCommitCode"} || $scrip->CustomCommitCode || '';
% $lines = @{[ $code =~ /\n/gs ]} + 3;
% $lines = $min_lines if $lines < $min_lines;
@@ -141,6 +143,8 @@
</table>
</&>
+% }
+
<& /Elements/Submit,
Label => $SubmitLabel,
Reset => 1,
@@ -167,6 +171,9 @@ unless ( $id ) {
my $min_lines = 10;
+my ($ok, $msg) = $scrip->CompileCheck;
+push @actions, $msg if !$ok;
+
</%init>
<%ARGS>
diff --git a/rt/share/html/Admin/Elements/EditScrips b/rt/share/html/Admin/Elements/EditScrips
index be208d6c4..2fdcae670 100755
--- a/rt/share/html/Admin/Elements/EditScrips
+++ b/rt/share/html/Admin/Elements/EditScrips
@@ -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)
@@ -89,12 +89,14 @@ if ( $id ) {
if ($QueueObj->id) {
$Scrips->LimitToQueue($id);
+ $Format ||= RT->Config->Get('AdminSearchResultFormat')->{'Scrips'};
}
else {
$Scrips->LimitToGlobal();
+ $Format ||= RT->Config->Get('AdminSearchResultFormat')->{'GlobalScrips'};
}
-# {{{ deal with modifying and deleting existing scrips
+# deal with modifying and deleting existing scrips
# we still support DeleteScrip-id format but array is preferred
foreach my $id ( grep $_, @DeleteScrip, map /^DeleteScrip-(\d+)/, keys %ARGS ) {
my $scrip = RT::Scrip->new($session{'CurrentUser'});
@@ -107,10 +109,6 @@ foreach my $id ( grep $_, @DeleteScrip, map /^DeleteScrip-(\d+)/, keys %ARGS ) {
push @actions, $msg;
}
}
-# }}}
-
-$Format ||= RT->Config->Get('AdminSearchResultFormat')->{'Scrips'};
-
</%init>
<%ARGS>
diff --git a/rt/share/html/Admin/Elements/EditTemplates b/rt/share/html/Admin/Elements/EditTemplates
index 5839720e0..2f681aca3 100755
--- a/rt/share/html/Admin/Elements/EditTemplates
+++ b/rt/share/html/Admin/Elements/EditTemplates
@@ -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)
diff --git a/rt/share/html/Admin/Elements/EditUserComments b/rt/share/html/Admin/Elements/EditUserComments
index 9fb2230e8..28563c6a4 100755
--- a/rt/share/html/Admin/Elements/EditUserComments
+++ b/rt/share/html/Admin/Elements/EditUserComments
@@ -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)
diff --git a/rt/share/html/Admin/Elements/GroupTabs b/rt/share/html/Admin/Elements/GroupTabs
deleted file mode 100755
index 7a677ee3c..000000000
--- a/rt/share/html/Admin/Elements/GroupTabs
+++ /dev/null
@@ -1,102 +0,0 @@
-%# BEGIN BPS TAGGED BLOCK {{{
-%#
-%# COPYRIGHT:
-%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
-%# <sales@bestpractical.com>
-%#
-%# (Except where explicitly superseded by other copyright notices)
-%#
-%#
-%# LICENSE:
-%#
-%# This work is made available to you under the terms of Version 2 of
-%# the GNU General Public License. A copy of that license should have
-%# been provided with this software, but in any event can be snarfed
-%# from www.gnu.org.
-%#
-%# This work is distributed in the hope that it will be useful, but
-%# WITHOUT ANY WARRANTY; without even the implied warranty of
-%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-%# General Public License for more details.
-%#
-%# You should have received a copy of the GNU General Public License
-%# along with this program; if not, write to the Free Software
-%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-%# 02110-1301 or visit their web page on the internet at
-%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-%#
-%#
-%# CONTRIBUTION SUBMISSION POLICY:
-%#
-%# (The following paragraph is not intended to limit the rights granted
-%# to you to modify and distribute this software under the terms of
-%# the GNU General Public License and is only of importance to you if
-%# you choose to contribute your changes and enhancements to the
-%# community by submitting them to Best Practical Solutions, LLC.)
-%#
-%# By intentionally submitting any modifications, corrections or
-%# derivatives to this work, or any other work intended for use with
-%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-%# you are the copyright holder for those contributions and you grant
-%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-%# royalty-free, perpetual, license to use, copy, create derivative
-%# works based on those contributions, and sublicense and distribute
-%# those contributions and any derivatives thereof.
-%#
-%# END BPS TAGGED BLOCK }}}
-<& /Admin/Elements/Tabs,
- subtabs => $tabs,
- current_tab => 'Admin/Groups/',
- current_subtab => $current_tab,
- Title => $Title &>
-<%INIT>
-my $tabs;
-
-if ( $GroupObj and $GroupObj->id ) {
-$tabs->{"this"} = { class => "currentnav",
- path => "Admin/Groups/Modify.html?id=" . $GroupObj->id,
- title => $GroupObj->Name,
- current_subtab => $current_subtab,
- subtabs => {
- C => { title => loc('Basics'),
- path => "Admin/Groups/Modify.html?id=" . $GroupObj->id },
-
- D => { title => loc('Members'),
- path => "Admin/Groups/Members.html?id=" . $GroupObj->id },
-
- F => { title => loc('Group Rights'),
- path => "Admin/Groups/GroupRights.html?id=" . $GroupObj->id, },
- G => { title => loc('User Rights'),
- path => "Admin/Groups/UserRights.html?id=" . $GroupObj->id, },
- H => { title => loc('History'),
- path => "Admin/Groups/History.html?id=" . $GroupObj->id },
- }
-}
-}
-$tabs->{"A"} = { title => loc('Select'),
- path => "Admin/Groups/", };
-$tabs->{"B"} = { title => loc('Create'),
- path => "Admin/Groups/Modify.html?Create=1",
- separator => 1, };
-
-# Now let callbacks add their extra tabs
-$m->callback( %ARGS, tabs => $tabs );
-foreach my $tab ( sort keys %{$tabs->{'this'}->{'subtabs'}} ) {
- if ( $tabs->{'this'}->{'subtabs'}->{$tab}->{'path'} eq $current_tab ) {
- $tabs->{'this'}->{'subtabs'}->{$tab}->{"subtabs"} = $subtabs;
- $tabs->{'this'}->{'subtabs'}->{$tab}->{"current_subtab"} = $current_subtab;
- }
-}
- $tabs->{'this'}->{"current_subtab"} = $current_tab;
- $current_tab = "Admin/Groups/Modify.html?id=".$GroupObj->id if $GroupObj;
-
-</%INIT>
-<%ARGS>
-$GroupObj => undef
-$subtabs => undef
-$current_subtab => undef
-$current_tab => undef
-$Title => undef
-</%ARGS>
-
diff --git a/rt/share/html/Admin/Elements/Header b/rt/share/html/Admin/Elements/Header
index fac422520..afb745e0d 100755
--- a/rt/share/html/Admin/Elements/Header
+++ b/rt/share/html/Admin/Elements/Header
@@ -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)
diff --git a/rt/share/html/Admin/Elements/ListGlobalCustomFields b/rt/share/html/Admin/Elements/ListGlobalCustomFields
index 1fd8b768b..1d1cd392d 100755
--- a/rt/share/html/Admin/Elements/ListGlobalCustomFields
+++ b/rt/share/html/Admin/Elements/ListGlobalCustomFields
@@ -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)
@@ -56,6 +56,6 @@
% }
<%init>
-my $CustomFields = new RT::CustomFields ($session{'CurrentUser'});
+my $CustomFields = RT::CustomFields->new ($session{'CurrentUser'});
$CustomFields->LimitToGlobal();
</%INIT>
diff --git a/rt/share/html/Admin/Elements/ListGlobalScrips b/rt/share/html/Admin/Elements/ListGlobalScrips
index 7f1039ed9..701ffbfa7 100755
--- a/rt/share/html/Admin/Elements/ListGlobalScrips
+++ b/rt/share/html/Admin/Elements/ListGlobalScrips
@@ -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)
@@ -56,15 +56,12 @@
%ARGS,
Format => $Format,
Collection => $Scrips,
- ShowHeader => 0,
&>
% }
<%init>
-my $Format = q{'<a href="__WebPath__/Admin/Global/Scrip.html?id=__id__&Queue=0">__id__</a>/TITLE:#'}
- .q{,'<a href="__WebPath__/Admin/Global/Scrip.html?id=__id__&Queue=0">__AutoDescription__</a>/TITLE:Condition, Action and Template'}
- .q{__NEWLINE__,'','<small>__Description__</small>'};
+my $Format = RT->Config->Get('AdminSearchResultFormat')->{'GlobalScrips'};
my $Scrips = RT::Scrips->new( $session{'CurrentUser'} );
$Scrips->LimitToGlobal;
diff --git a/rt/share/html/Admin/Elements/ModifyTemplate b/rt/share/html/Admin/Elements/ModifyTemplate
index 062090531..ebe7c73bc 100755
--- a/rt/share/html/Admin/Elements/ModifyTemplate
+++ b/rt/share/html/Admin/Elements/ModifyTemplate
@@ -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)
@@ -47,38 +47,35 @@
%# END BPS TAGGED BLOCK }}}
<table>
<tr>
-<td align="right">
-<&|/l&>Name</&>:
-</td>
-<td>
-<input name="Name" value="<%$Name%>" size="20" /><br />
-</td>
+<td class="label"><&|/l&>Name</&>:</td>
+<td class="value"><input name="Name" value="<%$Name||''%>" size="20" /></td>
</tr>
<tr>
-<td align="right">
-<&|/l&>Description</&>:
-</td>
-<td>
-<input name="Description" value="<%$Description%>" size="80" /><br />
-</td>
+<td class="label"><&|/l&>Description</&>:</td>
+<td class="value"><input name="Description" value="<%$Description||''%>" size="80" /></td>
</tr>
<tr>
-<td align="right" valign="top">
-<&|/l&>Content</&>:<br />
-</td>
-<td>
-<textarea name="Content" rows="25" cols="80" wrap="soft">
-<%$Content%></textarea>
+<td class="label"><&|/l&>Type</&>:</td>
+<td class="value">
+<input type="radio" name="Type" value="Perl" <% $Type eq "Perl" ? 'checked="checked"' : "" |n %>><&|/l&>Perl</&></input><br />
+<input type="radio" name="Type" value="Simple" <% $Type eq "Simple" ? 'checked="checked"' : "" |n %>><&|/l&>Simple</&></input><br />
</td>
</tr>
+<tr>
+<td class="label" valign="top"><&|/l&>Content</&>:</td>
+<td class="value"><textarea name="Content" rows="25" cols="80" wrap="soft"><%$Content||''%></textarea></td>
+</tr>
</table>
<%INIT>
+$Type = 'Perl' if !$Type;
+
</%INIT>
<%ARGS>
-$Name => undef
-$Description => undef
-$Content => undef
+$Name => ''
+$Description => ''
+$Content => ''
+$Type => 'Perl'
</%ARGS>
diff --git a/rt/share/html/Admin/Elements/ObjectCustomFields b/rt/share/html/Admin/Elements/ObjectCustomFields
deleted file mode 100644
index 7798b8ea8..000000000
--- a/rt/share/html/Admin/Elements/ObjectCustomFields
+++ /dev/null
@@ -1,111 +0,0 @@
-%# BEGIN BPS TAGGED BLOCK {{{
-%#
-%# COPYRIGHT:
-%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
-%# <sales@bestpractical.com>
-%#
-%# (Except where explicitly superseded by other copyright notices)
-%#
-%#
-%# LICENSE:
-%#
-%# This work is made available to you under the terms of Version 2 of
-%# the GNU General Public License. A copy of that license should have
-%# been provided with this software, but in any event can be snarfed
-%# from www.gnu.org.
-%#
-%# This work is distributed in the hope that it will be useful, but
-%# WITHOUT ANY WARRANTY; without even the implied warranty of
-%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-%# General Public License for more details.
-%#
-%# You should have received a copy of the GNU General Public License
-%# along with this program; if not, write to the Free Software
-%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-%# 02110-1301 or visit their web page on the internet at
-%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-%#
-%#
-%# CONTRIBUTION SUBMISSION POLICY:
-%#
-%# (The following paragraph is not intended to limit the rights granted
-%# to you to modify and distribute this software under the terms of
-%# the GNU General Public License and is only of importance to you if
-%# you choose to contribute your changes and enhancements to the
-%# community by submitting them to Best Practical Solutions, LLC.)
-%#
-%# By intentionally submitting any modifications, corrections or
-%# derivatives to this work, or any other work intended for use with
-%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-%# you are the copyright holder for those contributions and you grant
-%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-%# royalty-free, perpetual, license to use, copy, create derivative
-%# works based on those contributions, and sublicense and distribute
-%# those contributions and any derivatives thereof.
-%#
-%# END BPS TAGGED BLOCK }}}
-<& /Admin/Elements/Header, Title => $title &>
-<& $ObjectTabs,
-$id ? (
- id => $Object->id,
- current_tab => "Admin/$Types/CustomFields.html?$sub_type_url&id=".$id,
- current_subtab => "Admin/$Types/CustomFields.html?$sub_type_url&id=".$id,
- "${Type}Obj" => $Object,
-) : (
- current_tab => "Admin/Global/CustomFields/${QualifiedType}s.html",
-),
- Title => $title
- &>
-
-<& /Admin/Elements/EditCustomFields, %ARGS, title => $title, Object => $Object &>
-<%INIT>
-# XXX TODO: Validate here?
-#$ObjectType =~ /^RT::(Queue|User|Group)$/
-# or Abort(loc("Object of type [_1] cannot take custom fields", $ObjectType), SuppressHeader => 1);
-
-
-
-my $Type = $1;
-my $Types = $Type.'s';
-my $ObjectTabs;
-my $Object = $ObjectType->new($session{'CurrentUser'});
-
-
-my $QualifiedType;
-my $FriendlySubTypes;
-if (defined $SubType && $SubType =~/^RT::(.*)$/) {
- $FriendlySubTypes = RT::CustomField->new($session{'CurrentUser'})->FriendlyLookupType($Object->CustomFieldLookupType);
- $QualifiedType = "$Type-$1";
-} else {
- $QualifiedType = $Type;
-}
-
-if ($id) {
- $Object->Load($id) || Abort(loc("Couldn't load object [_1]", $id), SuppressHeader => 1);
- $ObjectTabs = "/Admin/Elements/${Type}Tabs";
-} else {
- $ObjectTabs = "/Admin/Elements/GlobalCustomFieldTabs";
-
-}
-
-my $title;
-if ($id) {
-$title = loc('Edit Custom Fields for [_1]', $Object->Name);
-}
-elsif ($SubType) {
-
- $title= loc("Modify Custom Fields which apply to [_1] for all [_2]", loc(lc($FriendlySubTypes)), loc(lc($Types)));
-} else {
- $title =loc("Modify Custom Fields which apply to all [_1]", loc(lc($Types)));
-
-}
-my $sub_type_url;
-$sub_type_url = "SubType=$SubType" if $SubType;
-
-</%INIT>
-<%ARGS>
-$id => undef
-$ObjectType
-$SubType => undef
-</%ARGS>
diff --git a/rt/share/html/Admin/Elements/PickCustomFields b/rt/share/html/Admin/Elements/PickCustomFields
index 10699421d..1c58b6ab4 100644
--- a/rt/share/html/Admin/Elements/PickCustomFields
+++ b/rt/share/html/Admin/Elements/PickCustomFields
@@ -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)
diff --git a/rt/share/html/Admin/Elements/PickObjects b/rt/share/html/Admin/Elements/PickObjects
index dbf84cb1d..24a9e69a4 100644
--- a/rt/share/html/Admin/Elements/PickObjects
+++ b/rt/share/html/Admin/Elements/PickObjects
@@ -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)
diff --git a/rt/share/html/Admin/Elements/Portal b/rt/share/html/Admin/Elements/Portal
new file mode 100644
index 000000000..821ed5728
--- /dev/null
+++ b/rt/share/html/Admin/Elements/Portal
@@ -0,0 +1,52 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
+%# <sales@bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<div id="rt-portal">
+<&| /Widgets/TitleBox, title => 'RT Portal' &>
+<iframe src="https://bestpractical.com/rt/integration/news?utm_source=rt&utm_medium=iframe&utm_campaign=<%$RT::VERSION%>"></iframe>
+</&>
+</div>
diff --git a/rt/share/html/Admin/Elements/QueueRightsForUser b/rt/share/html/Admin/Elements/QueueRightsForUser
index 9acf98fc5..b8ef1b1d8 100755
--- a/rt/share/html/Admin/Elements/QueueRightsForUser
+++ b/rt/share/html/Admin/Elements/QueueRightsForUser
@@ -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)
@@ -54,7 +54,7 @@
</ul>
<%INIT>
-my $ACL = new RT::ACL($session{'CurrentUser'});
+my $ACL = RT::ACL->new($session{'CurrentUser'});
$ACL->LimitToQueue($QueueObj->id);
$ACL->LimitPrincipalToUser($PrincipalId);
</%INIT>
diff --git a/rt/share/html/Admin/Elements/QueueTabs b/rt/share/html/Admin/Elements/QueueTabs
deleted file mode 100755
index 8ce08dfd3..000000000
--- a/rt/share/html/Admin/Elements/QueueTabs
+++ /dev/null
@@ -1,123 +0,0 @@
-%# BEGIN BPS TAGGED BLOCK {{{
-%#
-%# COPYRIGHT:
-%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
-%# <sales@bestpractical.com>
-%#
-%# (Except where explicitly superseded by other copyright notices)
-%#
-%#
-%# LICENSE:
-%#
-%# This work is made available to you under the terms of Version 2 of
-%# the GNU General Public License. A copy of that license should have
-%# been provided with this software, but in any event can be snarfed
-%# from www.gnu.org.
-%#
-%# This work is distributed in the hope that it will be useful, but
-%# WITHOUT ANY WARRANTY; without even the implied warranty of
-%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-%# General Public License for more details.
-%#
-%# You should have received a copy of the GNU General Public License
-%# along with this program; if not, write to the Free Software
-%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-%# 02110-1301 or visit their web page on the internet at
-%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-%#
-%#
-%# CONTRIBUTION SUBMISSION POLICY:
-%#
-%# (The following paragraph is not intended to limit the rights granted
-%# to you to modify and distribute this software under the terms of
-%# the GNU General Public License and is only of importance to you if
-%# you choose to contribute your changes and enhancements to the
-%# community by submitting them to Best Practical Solutions, LLC.)
-%#
-%# By intentionally submitting any modifications, corrections or
-%# derivatives to this work, or any other work intended for use with
-%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-%# you are the copyright holder for those contributions and you grant
-%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-%# royalty-free, perpetual, license to use, copy, create derivative
-%# works based on those contributions, and sublicense and distribute
-%# those contributions and any derivatives thereof.
-%#
-%# END BPS TAGGED BLOCK }}}
-<& /Admin/Elements/Tabs,
- subtabs => $tabs,
- current_tab => 'Admin/Queues/',
- current_subtab => $current_tab,
- Title => $Title &>
-
-<%INIT>
-my $tabs;
-if ($id) {
- $tabs->{'this'} = {
- title => $QueueObj->Name,
- path => "Admin/Queues/Modify.html?id=".$id,
- current_subtab => $current_tab,
- subtabs => {
- C => { title => loc('Basics'),
- path => "Admin/Queues/Modify.html?id=".$id,
- },
- D => { title => loc('Watchers'),
- path => "Admin/Queues/People.html?id=".$id,
- },
-
- E => { title => loc('Scrips'),
- path => "Admin/Queues/Scrips.html?id=".$id,
- },
- F => { title => loc('Templates'),
- path => "Admin/Queues/Templates.html?id=".$id,
- },
-
- G1 => { title => loc('Ticket Custom Fields'),
- path => 'Admin/Queues/CustomFields.html?SubType=RT::Ticket&id='.$id,
- },
-
- G2 => { title => loc('Transaction Custom Fields'),
- path => 'Admin/Queues/CustomFields.html?SubType=RT::Ticket-RT::Transaction&id='.$id,
- },
-
- H => { title => loc('Group Rights'),
- path => "Admin/Queues/GroupRights.html?id=".$id,
- },
- I => { title => loc('User Rights'),
- path => "Admin/Queues/UserRights.html?id=".$id,
- },
- J => { title => loc('History'),
- path => "Admin/Queues/History.html?id=" . $QueueObj->id
- },
- }
- };
-}
-if ($session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'AdminQueue')) {
- $tabs->{"A"} = { title => loc('Select'),
- path => "Admin/Queues/",
- };
- $tabs->{"B"} = { title => loc('Create'),
- path => "Admin/Queues/Modify.html?Create=1",
- separator => 1, };
-}
-
- # Now let callbacks add their extra tabs
- $m->callback( %ARGS, tabs => $tabs );
-foreach my $tab ( sort keys %{$tabs->{'this'}->{'subtabs'}} ) {
- if ( $tabs->{'this'}->{'subtabs'}->{$tab}->{'path'} eq $current_tab ) {
- $tabs->{'this'}->{'subtabs'}->{$tab}->{"subtabs"} = $subtabs;
- $tabs->{'this'}->{'subtabs'}->{$tab}->{"current_subtab"} = $current_subtab;
- }
-}
- $current_tab = "Admin/Queues/Modify.html?id=".$id if $id;
-</%INIT>
-
-<%ARGS>
-$QueueObj => undef
-$id => undef
-$subtabs => undef
-$current_subtab => undef
-$current_tab => undef
-$Title => undef
-</%ARGS>
diff --git a/rt/share/html/Admin/Elements/SelectCustomField b/rt/share/html/Admin/Elements/SelectCustomField
index fac69fad5..7f4e45eb5 100644
--- a/rt/share/html/Admin/Elements/SelectCustomField
+++ b/rt/share/html/Admin/Elements/SelectCustomField
@@ -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)
diff --git a/rt/share/html/Admin/Elements/SelectCustomFieldLookupType b/rt/share/html/Admin/Elements/SelectCustomFieldLookupType
index e124dfb64..514264b2e 100644
--- a/rt/share/html/Admin/Elements/SelectCustomFieldLookupType
+++ b/rt/share/html/Admin/Elements/SelectCustomFieldLookupType
@@ -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)
diff --git a/rt/share/html/Admin/Elements/SelectCustomFieldRenderType b/rt/share/html/Admin/Elements/SelectCustomFieldRenderType
new file mode 100644
index 000000000..5034c4dfb
--- /dev/null
+++ b/rt/share/html/Admin/Elements/SelectCustomFieldRenderType
@@ -0,0 +1,70 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
+%# <sales@bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<select name="<%$Name%>">
+%for my $option (@types) {
+<option value="<%$option%>"<%$option eq $Default && qq[ selected="selected"] |n%>><% $option %></option>
+%}
+</select>
+<%INIT>
+my $cf = RT::CustomField->new($session{'CurrentUser'});
+$Default ||= $cf->DefaultRenderType($TypeComposite);
+
+my @types = $cf->RenderTypes($TypeComposite);
+
+# XXX: We currently don't support cascaded select CFs when
+# rendering as a list, so don't offer it for now.
+if ( $BasedOn ) {
+ @types = grep { not /List/ } @types;
+}
+</%INIT>
+<%ARGS>
+$Default => undef
+$TypeComposite => 'Select-0'
+$Name => 'RenderType'
+$BasedOn => 0
+</%ARGS>
diff --git a/rt/share/html/Admin/Elements/SelectCustomFieldType b/rt/share/html/Admin/Elements/SelectCustomFieldType
index 6eb149764..50175cab9 100755
--- a/rt/share/html/Admin/Elements/SelectCustomFieldType
+++ b/rt/share/html/Admin/Elements/SelectCustomFieldType
@@ -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)
@@ -52,7 +52,7 @@
</select>
<%INIT>
my $cf = RT::CustomField->new($session{'CurrentUser'});
-
+$Default = "Freeform-1" if $Default eq "-0";
</%INIT>
<%ARGS>
$Default=>undef
diff --git a/rt/share/html/Admin/Elements/SelectGroups b/rt/share/html/Admin/Elements/SelectGroups
index d6888adf1..e839f754a 100755
--- a/rt/share/html/Admin/Elements/SelectGroups
+++ b/rt/share/html/Admin/Elements/SelectGroups
@@ -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)
@@ -52,7 +52,7 @@
</select>
<%INIT>
-my $groups = new RT::Groups($session{'CurrentUser'});
+my $groups = RT::Groups->new($session{'CurrentUser'});
$groups->Limit(FIELD => 'Domain', OPERATOR => '=', VALUE => $Domain);
</%INIT>
diff --git a/rt/share/html/Admin/Elements/SelectModifyGroup b/rt/share/html/Admin/Elements/SelectModifyGroup
index 85dee9e16..8e51fa6b7 100755
--- a/rt/share/html/Admin/Elements/SelectModifyGroup
+++ b/rt/share/html/Admin/Elements/SelectModifyGroup
@@ -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)
@@ -50,7 +50,7 @@
%}
<%INIT>
my ($Group);
-my $Groups = new RT::Groups($session{'CurrentUser'});
+my $Groups = RT::Groups->new($session{'CurrentUser'});
$Groups->UnLimit;
</%INIT>
<%ARGS>
diff --git a/rt/share/html/Admin/Elements/SelectModifyQueue b/rt/share/html/Admin/Elements/SelectModifyQueue
index d676d0178..e0f7d22b3 100755
--- a/rt/share/html/Admin/Elements/SelectModifyQueue
+++ b/rt/share/html/Admin/Elements/SelectModifyQueue
@@ -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)
@@ -50,7 +50,7 @@
%}
<%INIT>
my ($queue);
-my $queues = new RT::Queues($session{'CurrentUser'});
+my $queues = RT::Queues->new($session{'CurrentUser'});
$queues->UnLimit;
</%INIT>
<%ARGS>
diff --git a/rt/share/html/Admin/Elements/SelectModifyUser b/rt/share/html/Admin/Elements/SelectModifyUser
index 2941064dc..f170b824f 100755
--- a/rt/share/html/Admin/Elements/SelectModifyUser
+++ b/rt/share/html/Admin/Elements/SelectModifyUser
@@ -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)
@@ -50,9 +50,9 @@
%}
<%INIT>
my ($user);
-my $users = new RT::Users($session{'CurrentUser'});
+my $users = RT::Users->new($session{'CurrentUser'});
$users->Limit(FIELD => 'id',
- VALUE => $RT::SystemUser->id,
+ VALUE => RT->SystemUser->id,
OPERATOR => '!=' );
if (defined $IdLike) {
diff --git a/rt/share/html/Admin/Elements/SelectNewGroupMembers b/rt/share/html/Admin/Elements/SelectNewGroupMembers
index 04e99e578..8778daec0 100755
--- a/rt/share/html/Admin/Elements/SelectNewGroupMembers
+++ b/rt/share/html/Admin/Elements/SelectNewGroupMembers
@@ -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,58 +46,41 @@
%#
%# END BPS TAGGED BLOCK }}}
% if ( $Show ne 'Groups' ) {
-<b><&|/l&>Users</&></b>
-<br />
-<select multiple="multiple" name="<% $Name %>Users" size="10">
-<%perl>
-my @users = sort { lc($a->[0]) cmp lc($b->[0]) }
- map { [$m->scomp("/Elements/ShowUser", User => $_), $_] }
- @{ $users->ItemsArrayRef };
-</%perl>
-% for (@users) {
-% my ($rendered, $user) = @$_;
-% next if $SkipUsers->{ $user->id };
-<option value="User-<% $user->id %>"><% $rendered |n%></option>
-% }
-</select>
-<br />
+<label for="<% $Name %>Users"><&|/l&>Add user</&>:</label>
+<input type="text" value="" name="<% $Name %>Users" id="<% $Name %>Users" /><br />
+<script type="text/javascript">
+jQuery(function(){
+ jQuery("#"+<% $Name |n,j%>+"Users").autocomplete({
+ source: <% RT->Config->Get('WebPath') |n,j%>+"/Helpers/Autocomplete/Users?return=Name;privileged=1;exclude="+<% $user_ids |n,u,j %>,
+ // Auto-submit once a user is chosen
+ select: function( event, ui ) {
+ jQuery(event.target).val(ui.item.value);
+ jQuery(event.target).closest("form").submit();
+ }
+ });
+});
+</script>
% }
% if ( $Show ne 'Users' ) {
-<b><&|/l&>Groups</&></b>
-<br />
-<select multiple="multiple" name="<% $Name %>Groups" size="10">
-% while ( my $group = $groups->Next ) {
-% next if $SkipGroups->{ $group->id };
-<option value="Group-<% $group->id %>"><% $group->Name %></option>
-% }
-</select>
+<label for="<% $Name %>Groups"><&|/l&>Add group</&>:</label>
+<input type="text" value="" name="<% $Name %>Groups" id="<% $Name %>Groups" /><br />
+<script type="text/javascript">
+jQuery(function(){
+ jQuery("#"+<% $Name |n,j%>+"Groups").autocomplete({
+ source: <% RT->Config->Get('WebPath') |n,j%>+"/Helpers/Autocomplete/Groups?exclude="+<% $group_ids |n,u,j %>,
+ // Auto-submit once a user is chosen
+ select: function( event, ui ) {
+ jQuery(event.target).val(ui.item.value);
+ jQuery(event.target).closest("form").submit();
+ }
+ });
+});
+</script>
% }
-
<%INIT>
-my $users = new RT::Users($session{'CurrentUser'});
-
-$users->Limit(
- FIELD => 'id',
- VALUE => $RT::SystemUser->id,
- OPERATOR => '!=',
- ENTRYAGGREGATOR => 'AND'
-);
-$users->Limit(
- FIELD => 'id',
- VALUE => $RT::Nobody->id,
- OPERATOR => '!=',
- ENTRYAGGREGATOR => 'AND'
-);
-$users->LimitToPrivileged();
-
-my $groups = new RT::Groups($session{'CurrentUser'});
-
-# self-recursive group membership considered harmful!
-$groups->Limit(FIELD => 'id', VALUE => $Group->id, OPERATOR => '!=' );
-$groups->Limit(FIELD => 'Domain', OPERATOR => '=', VALUE => 'UserDefined');
-
-
+my $user_ids = join(',', grep { $SkipUsers->{$_} } keys %$SkipUsers);
+my $group_ids = join(',', grep { $SkipGroups->{$_} } keys %$SkipGroups);
</%INIT>
<%ARGS>
$Name => 'Users'
diff --git a/rt/share/html/Admin/Elements/SelectRights b/rt/share/html/Admin/Elements/SelectRights
index 7ec8d1b42..73f5bced3 100755
--- a/rt/share/html/Admin/Elements/SelectRights
+++ b/rt/share/html/Admin/Elements/SelectRights
@@ -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)
@@ -95,21 +95,20 @@ while ( my $ace = $ACLObj->Next ) {
}
- my $ACLObj = new RT::ACL($session{'CurrentUser'});
- my $ACE = new RT::ACE($session{'CurrentUser'});
+ my $ACLObj = RT::ACL->new($session{'CurrentUser'});
+ my $ACE = RT::ACE->new($session{'CurrentUser'});
$ACLObj->LimitToObject( $Object);
$ACLObj->LimitToPrincipal( Id => $PrincipalId);
$ACLObj->OrderBy(FIELD=>'RightName');
- if (ref($Object) && UNIVERSAL::can($Object, 'AvailableRights')) {
+ eval {
%Rights = %{$Object->AvailableRights};
- }
-
- else {
- %Rights = ( loc('System Error') => loc("No rights found") );
- }
+ };
+ if ($@) {
+ %Rights = ( loc('System Error') => loc("No rights found") );
+ }
$ACLDesc = "$PrincipalId-".ref($Object)."-".$Object->Id;
</%INIT>
diff --git a/rt/share/html/Admin/Elements/SelectScrip b/rt/share/html/Admin/Elements/SelectScrip
index 7e070df8e..f0adab10a 100755
--- a/rt/share/html/Admin/Elements/SelectScrip
+++ b/rt/share/html/Admin/Elements/SelectScrip
@@ -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)
diff --git a/rt/share/html/Admin/Elements/SelectScripAction b/rt/share/html/Admin/Elements/SelectScripAction
index 4dd39f55b..750815b07 100755
--- a/rt/share/html/Admin/Elements/SelectScripAction
+++ b/rt/share/html/Admin/Elements/SelectScripAction
@@ -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)
@@ -62,10 +62,19 @@ form.submit()">
<%INIT>
my $ScripActions = RT::ScripActions->new($session{'CurrentUser'});
-$ScripActions->UnLimit;
-$ScripActions->OrderBy(FIELD => 'Name');
+# hide user-defined if the user can't execute code
+if ($session{CurrentUser}->HasRight(Object => $RT::System, Right => 'ExecuteCode')) {
+ $ScripActions->UnLimit;
+} else {
+ $ScripActions->Limit(
+ FIELD => 'ExecModule',
+ OPERATOR => '!=',
+ VALUE => 'UserDefined',
+ );
+}
+$ScripActions->OrderBy(FIELD => 'Name');
</%INIT>
<%ARGS>
diff --git a/rt/share/html/Admin/Elements/SelectScripCondition b/rt/share/html/Admin/Elements/SelectScripCondition
index 67438a72a..1023df6e0 100755
--- a/rt/share/html/Admin/Elements/SelectScripCondition
+++ b/rt/share/html/Admin/Elements/SelectScripCondition
@@ -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)
@@ -62,9 +62,19 @@ form.submit()">
<%INIT>
my $ScripConditions = RT::ScripConditions->new($session{'CurrentUser'});
-$ScripConditions->UnLimit;
-$ScripConditions->OrderBy(FIELD => 'Name');
+# hide user-defined if the user can't execute code
+if ($session{CurrentUser}->HasRight(Object => $RT::System, Right => 'ExecuteCode')) {
+ $ScripConditions->UnLimit;
+} else {
+ $ScripConditions->Limit(
+ FIELD => 'ExecModule',
+ OPERATOR => '!=',
+ VALUE => 'UserDefined',
+ );
+}
+
+$ScripConditions->OrderBy(FIELD => 'Name');
</%INIT>
<%ARGS>
diff --git a/rt/share/html/Admin/Elements/SelectSingleOrMultiple b/rt/share/html/Admin/Elements/SelectSingleOrMultiple
index 1a2667840..bf2824397 100755
--- a/rt/share/html/Admin/Elements/SelectSingleOrMultiple
+++ b/rt/share/html/Admin/Elements/SelectSingleOrMultiple
@@ -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)
diff --git a/rt/share/html/Admin/Elements/SelectStage b/rt/share/html/Admin/Elements/SelectStage
index 38a7f18a5..369dee9af 100644
--- a/rt/share/html/Admin/Elements/SelectStage
+++ b/rt/share/html/Admin/Elements/SelectStage
@@ -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)
diff --git a/rt/share/html/Admin/Elements/SelectTemplate b/rt/share/html/Admin/Elements/SelectTemplate
index ffaebeeb7..8d45c7de1 100755
--- a/rt/share/html/Admin/Elements/SelectTemplate
+++ b/rt/share/html/Admin/Elements/SelectTemplate
@@ -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)
@@ -47,19 +47,12 @@
%# END BPS TAGGED BLOCK }}}
<select name="<%$Name%>">
<option value=""
-<% defined($Default) && $Default eq 'none' && qq[ selected="selected"] |n %>
->-</option>
+<% defined($Default) && $Default eq 'none' && qq[ selected="selected"] |n %>>-</option>
%while (my $Template = $PrimaryTemplates->Next) {
-<option value="<%$Template->Id%>"
-<% ($Template->Id == $Default) && qq[ selected="selected"] |n %>
-><% loc($Template->Name) %>
-</option>
+<option value="<%$Template->Id%>" <% ($Template->Id == $Default) && qq[ selected="selected"] |n %>><% loc($Template->Name) %></option>
%}
%while (my $Template = $OtherTemplates->Next) {
-<option value="<%$Template->Id%>"
-<% defined($Default) && ($Template->Id == $Default) && qq[ selected="selected"] |n %>
-><&|/l, loc($Template->Name) &>Global template: [_1]</&>
-</option>
+<option value="<%$Template->Id%>" <% defined($Default) && ($Template->Id == $Default) && qq[ selected="selected"] |n %>><&|/l, loc($Template->Name) &>Global template: [_1]</&></option>
%}
</select>
@@ -73,15 +66,12 @@ $PrimaryTemplates->OrderBy(FIELD => 'Name');
}
my $OtherTemplates = RT::Templates->new($session{'CurrentUser'});
-$OtherTemplates->LimitToGlobal($DefaultQueue);
+$OtherTemplates->LimitToGlobal;
$OtherTemplates->OrderBy(FIELD => 'Name');
</%INIT>
<%ARGS>
-
$Queue => undef
$Default => 'none'
-$DefaultQueue => undef
$Name => 'Template'
-
</%ARGS>
diff --git a/rt/share/html/Admin/Elements/SelectUsers b/rt/share/html/Admin/Elements/SelectUsers
index 14ebf822c..1851f23f8 100755
--- a/rt/share/html/Admin/Elements/SelectUsers
+++ b/rt/share/html/Admin/Elements/SelectUsers
@@ -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)
@@ -54,10 +54,10 @@
</select>
<%INIT>
-my $users = new RT::Users($session{'CurrentUser'});
+my $users = RT::Users->new($session{'CurrentUser'});
-$users->Limit(FIELD => 'id', VALUE => $RT::SystemUser->id, OPERATOR => '!=' );
-$users->Limit(FIELD => 'id', VALUE => $RT::Nobody->id, OPERATOR => '!=' );
+$users->Limit(FIELD => 'id', VALUE => RT->SystemUser->id, OPERATOR => '!=' );
+$users->Limit(FIELD => 'id', VALUE => RT->Nobody->id, OPERATOR => '!=' );
$users->LimitToPrivileged();
</%INIT>
diff --git a/rt/share/html/Admin/Elements/ShowKeyInfo b/rt/share/html/Admin/Elements/ShowKeyInfo
index acb51c5de..2ec319a63 100644
--- a/rt/share/html/Admin/Elements/ShowKeyInfo
+++ b/rt/share/html/Admin/Elements/ShowKeyInfo
@@ -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)
@@ -80,6 +80,7 @@ $EmailAddress
$Type => 'public'
</%ARGS>
<%INIT>
+return if ($m->cache_self( key => join("||",$EmailAddress,$Type, $$), expires_in => '2 minutes'));
require RT::Crypt::GnuPG;
my %res = RT::Crypt::GnuPG::GetKeyInfo( $EmailAddress, $Type );
diff --git a/rt/share/html/Admin/Elements/SystemTabs b/rt/share/html/Admin/Elements/SystemTabs
deleted file mode 100755
index 66183efd2..000000000
--- a/rt/share/html/Admin/Elements/SystemTabs
+++ /dev/null
@@ -1,99 +0,0 @@
-%# BEGIN BPS TAGGED BLOCK {{{
-%#
-%# COPYRIGHT:
-%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
-%# <sales@bestpractical.com>
-%#
-%# (Except where explicitly superseded by other copyright notices)
-%#
-%#
-%# LICENSE:
-%#
-%# This work is made available to you under the terms of Version 2 of
-%# the GNU General Public License. A copy of that license should have
-%# been provided with this software, but in any event can be snarfed
-%# from www.gnu.org.
-%#
-%# This work is distributed in the hope that it will be useful, but
-%# WITHOUT ANY WARRANTY; without even the implied warranty of
-%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-%# General Public License for more details.
-%#
-%# You should have received a copy of the GNU General Public License
-%# along with this program; if not, write to the Free Software
-%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-%# 02110-1301 or visit their web page on the internet at
-%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-%#
-%#
-%# CONTRIBUTION SUBMISSION POLICY:
-%#
-%# (The following paragraph is not intended to limit the rights granted
-%# to you to modify and distribute this software under the terms of
-%# the GNU General Public License and is only of importance to you if
-%# you choose to contribute your changes and enhancements to the
-%# community by submitting them to Best Practical Solutions, LLC.)
-%#
-%# By intentionally submitting any modifications, corrections or
-%# derivatives to this work, or any other work intended for use with
-%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-%# you are the copyright holder for those contributions and you grant
-%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-%# royalty-free, perpetual, license to use, copy, create derivative
-%# works based on those contributions, and sublicense and distribute
-%# those contributions and any derivatives thereof.
-%#
-%# END BPS TAGGED BLOCK }}}
-<& /Admin/Elements/Tabs, subtabs => $tabs,
- current_tab => 'Admin/Global/',
- current_subtab => $current_tab,
- Title => $Title &>
-
-<%INIT>
- my $tabs = {
-
- A => { title => loc('Scrips'),
- path => 'Admin/Global/Scrips.html',
- },
- B => { title => loc('Templates'),
- path => 'Admin/Global/Templates.html',
- },
-
- F => { title => loc('Custom Fields'),
- path => 'Admin/Global/CustomFields/index.html',
- },
-
- G => { title => loc('Group Rights'),
- path => 'Admin/Global/GroupRights.html',
- },
- H => { title => loc('User Rights'),
- path => 'Admin/Global/UserRights.html',
- },
- I => { title => loc('RT at a glance'),
- path => 'Admin/Global/MyRT.html',
- },
-
-};
-
- # Now let callbacks add their extra tabs
- $m->callback( %ARGS, tabs => $tabs );
-
- if ($current_tab) {
- foreach my $tab (sort keys %{$tabs}) {
- if ($tabs->{$tab}->{'path'} eq $current_tab) {
- $tabs->{$tab}->{"subtabs"} = $subtabs || {};
- $tabs->{$tab}->{"current_subtab"} = $current_subtab;
- }
- }
- }
-</%INIT>
-
-
-<%ARGS>
-$id => undef
-$current_tab => undef
-$subtabs => undef
-$current_subtab => undef
-$Title => undef
-</%ARGS>
diff --git a/rt/share/html/Admin/Elements/UserTabs b/rt/share/html/Admin/Elements/UserTabs
deleted file mode 100755
index 330c442b5..000000000
--- a/rt/share/html/Admin/Elements/UserTabs
+++ /dev/null
@@ -1,116 +0,0 @@
-%# BEGIN BPS TAGGED BLOCK {{{
-%#
-%# COPYRIGHT:
-%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
-%# <sales@bestpractical.com>
-%#
-%# (Except where explicitly superseded by other copyright notices)
-%#
-%#
-%# LICENSE:
-%#
-%# This work is made available to you under the terms of Version 2 of
-%# the GNU General Public License. A copy of that license should have
-%# been provided with this software, but in any event can be snarfed
-%# from www.gnu.org.
-%#
-%# This work is distributed in the hope that it will be useful, but
-%# WITHOUT ANY WARRANTY; without even the implied warranty of
-%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-%# General Public License for more details.
-%#
-%# You should have received a copy of the GNU General Public License
-%# along with this program; if not, write to the Free Software
-%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-%# 02110-1301 or visit their web page on the internet at
-%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-%#
-%#
-%# CONTRIBUTION SUBMISSION POLICY:
-%#
-%# (The following paragraph is not intended to limit the rights granted
-%# to you to modify and distribute this software under the terms of
-%# the GNU General Public License and is only of importance to you if
-%# you choose to contribute your changes and enhancements to the
-%# community by submitting them to Best Practical Solutions, LLC.)
-%#
-%# By intentionally submitting any modifications, corrections or
-%# derivatives to this work, or any other work intended for use with
-%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-%# you are the copyright holder for those contributions and you grant
-%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-%# royalty-free, perpetual, license to use, copy, create derivative
-%# works based on those contributions, and sublicense and distribute
-%# those contributions and any derivatives thereof.
-%#
-%# END BPS TAGGED BLOCK }}}
-<& /Admin/Elements/Tabs,
- subtabs => $tabs,
- current_tab => 'Admin/Users/',
- current_subtab => $current_tab,
- Title => $Title &>
-<%INIT>
-my $tabs;
-if ($id) {
-$tabs->{'this'} = { title => eval { $UserObj->Name },
-
- path => "Admin/Users/Modify.html?id=".$id,
-subtabs => {
- Basics => { title => loc('Basics'),
- path => "Admin/Users/Modify.html?id=".$id
- },
- Memberships => { title => loc('Memberships'),
- path => "Admin/Users/Memberships.html?id=".$id
- },
- History => { title => loc('History'),
- path => "Admin/Users/History.html?id=".$id
- },
- 'MyRT' => { title => loc('RT at a glance'),
- path => "Admin/Users/MyRT.html?id=".$id
- },
- }
-};
- if ( RT->Config->Get('GnuPG')->{'Enable'} ) {
- $tabs->{'this'}{'subtabs'}{'GnuPG'} = {
- title => loc('GnuPG'),
- path => "Admin/Users/GnuPG.html?id=".$id,
- };
- }
-}
-
-if ($session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'AdminUsers')) {
- $tabs->{"A"} = { title => loc('Select'),
- path => "Admin/Users/",
- };
- $tabs->{"B"} = { title => loc('Create'),
- path => "Admin/Users/Modify.html?Create=1",
- separator => 1,
- };
-}
-
- # Now let callbacks add their extra tabs
- $m->callback( %ARGS, tabs => $tabs );
-
-#foreach my $tab ( sort keys %{$tabs} ) {
-# if ( $tabs->{$tab}->{'path'} eq $current_subtab ) {
-# $tabs->{$tab}->{"current_subtab"} = $current_subtab;
-# }
-#}
-foreach my $tab ( sort keys %{$tabs->{'this'}->{'subtabs'}} ) {
- if ( $tabs->{'this'}->{'subtabs'}->{$tab}->{'path'} eq $current_tab ) {
- $tabs->{'this'}->{'subtabs'}->{$tab}->{"subtabs"} = $subtabs;
- $tabs->{'this'}->{'subtabs'}->{$tab}->{"current_subtab"} = $current_subtab;
- }
-}
-$tabs->{'this'}->{"current_subtab"} = $current_tab;
-$current_tab = "Admin/Users/Modify.html?id=".$id if $id;
-</%INIT>
-<%ARGS>
-$UserObj => undef
-$id => undef
-$current_tab => undef
-$subtabs => undef
-$current_subtab => undef
-$Title => undef
-</%ARGS>
diff --git a/rt/share/html/Admin/Global/CustomFields/Class-Article.html b/rt/share/html/Admin/Global/CustomFields/Class-Article.html
new file mode 100644
index 000000000..771e9efac
--- /dev/null
+++ b/rt/share/html/Admin/Global/CustomFields/Class-Article.html
@@ -0,0 +1,54 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
+%# <sales@bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<& /Admin/Elements/Header, Title => $title &>
+<& /Elements/Tabs &>
+<& /Admin/Elements/EditCustomFields, %ARGS, title => $title, ObjectType => 'RT::Class', Object => $object, SubType => 'RT::Article' &>
+<%INIT>
+ my $title = loc( 'Edit Custom Fields for articles in all classes');
+ my $object = RT::Class->new($session{'CurrentUser'});
+</%INIT>
diff --git a/rt/share/html/Admin/Global/CustomFields/Groups.html b/rt/share/html/Admin/Global/CustomFields/Groups.html
index ef83f8c91..3356a21d4 100644
--- a/rt/share/html/Admin/Global/CustomFields/Groups.html
+++ b/rt/share/html/Admin/Global/CustomFields/Groups.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,10 +46,7 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => $title &>
-<& /Admin/Elements/GlobalCustomFieldTabs,
- current_tab => "Admin/Global/CustomFields/Groups.html",
- current_subtab => "Admin/Global/CustomFields/Groups.html",
- Title => $title
+<& /Elements/Tabs
&>
<& /Admin/Elements/EditCustomFields, %ARGS, title => $title, ObjectType => 'RT::Group', Object=> $object &>
<%INIT>
diff --git a/rt/share/html/Admin/Global/CustomFields/Queue-Tickets.html b/rt/share/html/Admin/Global/CustomFields/Queue-Tickets.html
index 6f5370b65..371b3d6ea 100755
--- a/rt/share/html/Admin/Global/CustomFields/Queue-Tickets.html
+++ b/rt/share/html/Admin/Global/CustomFields/Queue-Tickets.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,10 +46,7 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => $title &>
-<& /Admin/Elements/GlobalCustomFieldTabs,
- current_tab => "Admin/Global/CustomFields/Queue-Tickets.html",
- current_subtab => "Admin/Global/CustomFields/Queue-Tickets.html",
- Title => $title
+<& /Elements/Tabs
&>
<& /Admin/Elements/EditCustomFields, %ARGS, title => $title, ObjectType => 'RT::Queue', Object=> $object, SubType => 'RT::Ticket' &>
<%INIT>
diff --git a/rt/share/html/Admin/Global/CustomFields/Queue-Transactions.html b/rt/share/html/Admin/Global/CustomFields/Queue-Transactions.html
index 4c51b9dc8..ce642935f 100755
--- a/rt/share/html/Admin/Global/CustomFields/Queue-Transactions.html
+++ b/rt/share/html/Admin/Global/CustomFields/Queue-Transactions.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,10 +46,7 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => $title &>
-<& /Admin/Elements/GlobalCustomFieldTabs,
- current_tab => "Admin/Global/CustomFields/Queue-Transactions.html",
- current_subtab => "Admin/Global/CustomFields/Queue-Transactions.html",
- Title => $title
+<& /Elements/Tabs
&>
<& /Admin/Elements/EditCustomFields, %ARGS, title => $title, ObjectType => 'RT::Queue', Object=> $object, SubType => 'RT::Ticket-RT::Transaction' &>
<%INIT>
diff --git a/rt/share/html/Admin/Global/CustomFields/Queues.html b/rt/share/html/Admin/Global/CustomFields/Queues.html
index bc0652ada..6eda3840f 100644
--- a/rt/share/html/Admin/Global/CustomFields/Queues.html
+++ b/rt/share/html/Admin/Global/CustomFields/Queues.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,10 +46,7 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => $title &>
-<& /Admin/Elements/GlobalCustomFieldTabs,
- current_tab => "Admin/Global/CustomFields/Queues.html",
- current_subtab => "Admin/Global/CustomFields/Queues.html",
- Title => $title
+<& /Elements/Tabs
&>
<& /Admin/Elements/EditCustomFields, %ARGS, title => $title, ObjectType => 'RT::Queue', Object=> $object &>
<%INIT>
diff --git a/rt/share/html/Admin/Global/CustomFields/Users.html b/rt/share/html/Admin/Global/CustomFields/Users.html
index 719a44c1d..a1046d1da 100644
--- a/rt/share/html/Admin/Global/CustomFields/Users.html
+++ b/rt/share/html/Admin/Global/CustomFields/Users.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,10 +46,7 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => $title &>
-<& /Admin/Elements/GlobalCustomFieldTabs,
- current_tab => "Admin/Global/CustomFields/Users.html",
- current_subtab => "Admin/Global/CustomFields/Users.html",
- Title => $title
+<& /Elements/Tabs
&>
<& /Admin/Elements/EditCustomFields, %ARGS, title => $title, ObjectType => 'RT::User', Object=> $object &>
<%INIT>
diff --git a/rt/share/html/Admin/Global/CustomFields/index.html b/rt/share/html/Admin/Global/CustomFields/index.html
index 93cea10c3..e27e93a1d 100644
--- a/rt/share/html/Admin/Global/CustomFields/index.html
+++ b/rt/share/html/Admin/Global/CustomFields/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)
@@ -47,7 +47,7 @@
%# END BPS TAGGED BLOCK }}}
% $m->callback( %ARGS, tabs => $tabs );
<& /Admin/Elements/Header, Title => $title &>
-<& /Admin/Elements/GlobalCustomFieldTabs, Title => $title &>
+<& /Elements/Tabs &>
<ul>
% foreach my $key (sort keys %$tabs) {
@@ -91,7 +91,12 @@ my $tabs = {
loc('Select custom fields for transactions on tickets in all queues'),
path => 'Queue-Transactions.html',
},
+ H => {
+ title => loc('Articles'),
+ text => loc('Select Custom Fields for Articles in all Classes'),
+ path => 'Class-Article.html'
+ },
};
diff --git a/rt/share/html/Admin/Global/GroupRights.html b/rt/share/html/Admin/Global/GroupRights.html
index 19ead1ca4..702a2e933 100755
--- a/rt/share/html/Admin/Global/GroupRights.html
+++ b/rt/share/html/Admin/Global/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,78 +46,18 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => loc('Modify global group rights') &>
-<& /Admin/Elements/SystemTabs,
- current_tab => 'Admin/Global/GroupRights.html',
- Title => loc('Modify global group rights') &>
+<& /Elements/Tabs &>
<& /Elements/ListActions, actions => \@results &>
- <form method="post" action="GroupRights.html">
-
-<&| /Widgets/TitleBox, title => loc('Modify global group rights.')&>
-
-<h1><&|/l&>System groups</&></h1>
-<table>
-% $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 =>$RT::System &>
- </td>
- </tr>
-% }
-</table>
-<h1><&|/l&>Roles</&></h1>
-<table>
-% $Groups = RT::Groups->new($session{'CurrentUser'});
-% $Groups->LimitToRolesForSystem();
-% while (my $Group = $Groups->Next()) {
- <tr align="right">
- <td valign="top">
- <% loc($Group->Type) %>
- </td>
- <td>
- <& /Admin/Elements/SelectRights, PrincipalId => $Group->PrincipalId,
- Object => $RT::System &>
- </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 => $RT::System &>
- </td>
- </tr>
-% }
-</table>
-
- </&>
- <& /Elements/Submit, Label => loc('Modify Group Rights'), Reset => 1 &>
-
- </form>
+<form method="post" action="GroupRights.html" id="ModifyGroupRights" name="ModifyGroupRights">
+ <& /Admin/Elements/EditRights, Context => $RT::System, Principals => \@principals &>
+ <& /Elements/Submit, Label => loc('Save Changes') &>
+</form>
<%INIT>
-
- #Update the acls.
- my @results = ProcessACLChanges(\%ARGS);
+# Update the acls.
+my @results = ProcessACLs(\%ARGS);
-
-my $Groups;
-
+# Principal collections
+my @principals = GetPrincipalsMap($RT::System, qw(System Roles Groups));
</%INIT>
-
-<%ARGS>
-</%ARGS>
diff --git a/rt/share/html/Admin/Global/MyRT.html b/rt/share/html/Admin/Global/MyRT.html
index edee2df27..3dca78fad 100644
--- a/rt/share/html/Admin/Global/MyRT.html
+++ b/rt/share/html/Admin/Global/MyRT.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,10 +46,7 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => loc("RT at a glance") &>
-<& /Admin/Elements/SystemTabs,
- current_tab => 'Admin/Global/MyRT.html',
- Title => loc("RT at a glance"),
-&>
+<& /Elements/Tabs &>
<& /Widgets/SelectionBox:header, nojs => 1 &>
diff --git a/rt/share/html/Admin/Global/Scrip.html b/rt/share/html/Admin/Global/Scrip.html
index d5aa9ffd6..3a6ed107d 100755
--- a/rt/share/html/Admin/Global/Scrip.html
+++ b/rt/share/html/Admin/Global/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,41 +46,18 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => $title &>
-<& /Admin/Elements/SystemTabs,
- current_tab => 'Admin/Global/Scrips.html',
- current_subtab => $current_subtab,
- subtabs => $subtabs,
- Title => $title &>
-
+<& /Elements/Tabs &>
<& /Elements/ListActions, actions => \@results &>
<& /Admin/Elements/EditScrip, title => $title, %ARGS, id => $id &>
<%init>
-my $subtabs = {
- A => {
- title => loc('Select'),
- path => "Admin/Global/Scrips.html",
- },
- B => {
- title => loc('New'),
- path => "Admin/Global/Scrip.html?create=1&Queue=0",
- separator => 1,
- },
-};
-
my ($id, @results) = $m->comp( '/Admin/Elements/EditScrip:Process', %ARGS );
-my ($title, $current_subtab);
+my ($title);
if ( $id ) {
- $current_subtab = "Admin/Global/Scrip.html?id=$id&Queue=0";
$title = loc("Modify a scrip that applies to all queues");
- $subtabs->{"C"} = {
- title => loc('Scrip #[_1]', $id),
- path => "Admin/Global/Scrip.html?id=$id&Queue=0",
- };
}
else {
- $current_subtab = "Admin/Global/Scrip.html?create=1&Queue=0";
$title = loc("Add a scrip which will apply to all queues");
}
</%init>
diff --git a/rt/share/html/Admin/Global/Scrips.html b/rt/share/html/Admin/Global/Scrips.html
index 2ee58f770..808913ba2 100755
--- a/rt/share/html/Admin/Global/Scrips.html
+++ b/rt/share/html/Admin/Global/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,32 +46,13 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => $title &>
-<& /Admin/Elements/SystemTabs,
- current_tab => 'Admin/Global/Scrips.html',
- current_subtab => 'Admin/Global/Scrips.html',
- subtabs => $subtabs,
- Title => $title &>
+<& /Elements/Tabs &>
<& /Admin/Elements/EditScrips, title => $title, id => $id, %ARGS &>
</form>
<%init>
-
-my $subtabs = {
- A => { title => loc('Select'),
- path => "Admin/Global/Scrips.html",
- },
- B => { title => loc('New'),
- path => "Admin/Global/Scrip.html?create=1&Queue=0",
- separator => 1,
- }
- };
my $title = loc("Modify scrips which apply to all queues");
-
my (@actions);
-
</%init>
-
-
-
<%ARGS>
$id => 0
</%ARGS>
diff --git a/rt/share/html/Admin/Global/Template.html b/rt/share/html/Admin/Global/Template.html
index c7652e6aa..70b69053b 100755
--- a/rt/share/html/Admin/Global/Template.html
+++ b/rt/share/html/Admin/Global/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,14 +46,10 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => $title &>
-<& /Admin/Elements/SystemTabs,
- current_tab => 'Admin/Global/Templates.html',
- 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 {
@@ -62,30 +58,23 @@
%# 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 $subtabs = {
- A => { title => loc('Select'),
- path => "Admin/Global/Templates.html"
- },
- B => { title => loc('New'),
- path => "Admin/Global/Template.html?Create=1&Queue=0",
- separator => 1,
- }
- };
+my $TemplateObj = RT::Template->new($session{'CurrentUser'});
+my ($title, @results, $SubmitLabel);
if ($Create) {
$title = loc("Create a template");
- $current_subtab = "Admin/Global/Template.html?Create=1&Queue=0";
$SubmitLabel = loc('Create');
}
@@ -103,21 +92,20 @@ else {
}
if ($TemplateObj->Id()) {
- my @attribs = qw( Description Content Queue Name);
+ my @attribs = qw( Description Content Queue Name Type );
my @aresults = UpdateRecordObject( AttributesRef => \@attribs,
Object => $TemplateObj,
ARGSRef => \%ARGS);
- $current_subtab = "Admin/Global/Template.html?Queue=0&Template=".$TemplateObj->Id();
- $subtabs->{"C"} = { title => loc('Template #[_1]', $TemplateObj->Id()),
- path => "Admin/Global/Template.html?Queue=0&Template=".$TemplateObj->Id(),
- };
push @results, @aresults;
+
+ my ($ok, $msg) = $TemplateObj->CompileCheck;
+ push @results, $msg if !$ok;
}
</%INIT>
<%ARGS>
-$Queue => undef
-$Template => undef
-$Create => undef
-$Name => undef
+$Queue => ''
+$Template => ''
+$Create => ''
+$Name => ''
</%ARGS>
diff --git a/rt/share/html/Admin/Global/Templates.html b/rt/share/html/Admin/Global/Templates.html
index 30ad24418..2ff1393cf 100755
--- a/rt/share/html/Admin/Global/Templates.html
+++ b/rt/share/html/Admin/Global/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,32 +46,13 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => $title, FeedURI => 'templates' &>
-<& /Admin/Elements/SystemTabs,
- current_tab => 'Admin/Global/Templates.html',
- current_subtab => 'Admin/Global/Templates.html',
- subtabs => $subtabs,
- Title => $title &>
+<& /Elements/Tabs &>
<& /Admin/Elements/EditTemplates, title => $title, %ARGS &>
</form>
<%init>
-
-my $subtabs = {
- A => { title => loc('Select'),
- path => "Admin/Global/Templates.html"
- },
- B => { title => loc('New'),
- path => "Admin/Global/Template.html?Create=1&Queue=0",
- separator => 1,
- }
- };
my $title = loc("Modify templates which apply to all queues");
-
my (@actions);
-
</%init>
-
-
-
<%ARGS>
$id => undef
</%ARGS>
diff --git a/rt/share/html/Admin/Global/Topics.html b/rt/share/html/Admin/Global/Topics.html
new file mode 100644
index 000000000..b1a1d9796
--- /dev/null
+++ b/rt/share/html/Admin/Global/Topics.html
@@ -0,0 +1,63 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
+%# <sales@bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<& /Admin/Elements/Header, Title => $title &>
+<& /Elements/Tabs &>
+<& /Admin/Articles/Elements/Topics, RootObj => $RT::System, title => $title, %ARGS &>
+
+<%INIT>
+
+my $title = $Modify
+ ? loc("Modify global topics")
+ : loc("Edit global topic hierarchy");
+
+</%INIT>
+
+<%ARGS>
+$id => undef
+$Modify => ""
+</%ARGS>
diff --git a/rt/share/html/Admin/Global/UserRights.html b/rt/share/html/Admin/Global/UserRights.html
index 8011c9b66..f0d094dd4 100755
--- a/rt/share/html/Admin/Global/UserRights.html
+++ b/rt/share/html/Admin/Global/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,54 +46,14 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => loc('Modify global user rights') &>
-<& /Admin/Elements/SystemTabs,
- current_tab => 'Admin/Global/UserRights.html',
- Title => loc('Modify global user rights') &>
+<& /Elements/Tabs &>
<& /Elements/ListActions, actions => \@results &>
- <form method="post" action="UserRights.html">
-
-<&| /Widgets/TitleBox, title => loc('Modify global user rights.') &>
-<table>
-
-% while ( my $UserObj = $Users->Next ) {
-% my $group = RT::Group->new($session{'CurrentUser'});
-% $group->LoadACLEquivalenceGroup( $UserObj );
- <tr align="right">
- <td valign="top"><& /Elements/ShowUser, User => $UserObj &></td>
- <td><& /Admin/Elements/SelectRights,
- PrincipalId => $group->PrincipalId,
- Object => $RT::System,
- &></td>
- </tr>
-% }
-</table>
-</&>
-
-<& /Elements/Submit, Label => loc('Modify User Rights'), Reset => 1 &>
-
+<form method="post" action="UserRights.html" name="ModifyUserRights" id="ModifyUserRights">
+ <& /Admin/Elements/EditRights, Context => $RT::System, Principals => \@principals &>
+ <& /Elements/Submit, Label => loc('Save Changes') &>
</form>
<%INIT>
-
- #Update the acls.
- my @results = ProcessACLChanges(\%ARGS);
-
-# {{{ Deal with setting up the display of current rights.
-
-
-# Find out which users we want to display ACL selects for
-my $Privileged = RT::Group->new($session{'CurrentUser'});
-$Privileged->LoadSystemInternalGroup('Privileged');
-my $Users = $Privileged->UserMembersObj();
-$Users->OrderBy( FIELD => $UserOrderBy, ORDER => $UserOrder );
-
-
-
-# }}}
-
+my @results = ProcessACLs(\%ARGS);
+my @principals = GetPrincipalsMap($RT::System, 'Users');
</%INIT>
-
-<%ARGS>
-$UserOrderBy => 'Name'
-$UserOrder => 'ASC'
-</%ARGS>
diff --git a/rt/share/html/Admin/Global/index.html b/rt/share/html/Admin/Global/index.html
index 0f7b56d4c..0f245f069 100755
--- a/rt/share/html/Admin/Global/index.html
+++ b/rt/share/html/Admin/Global/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)
@@ -45,42 +45,6 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-% $m->callback( %ARGS, tabs => $tabs );
<& /Admin/Elements/Header, Title => loc('Admin/Global configuration') &>
-<& /Admin/Elements/SystemTabs,
- Title => loc('Admin/Global configuration') &>
- <& /Elements/ListMenu, items => $tabs &>
-<%INIT>
- my $tabs = {
-
- A => { title => loc('Scrips'),
- text => loc('Modify scrips which apply to all queues'),
- path => '/Admin/Global/Scrips.html',
- },
- B => { title => loc('Templates'),
- text => loc('Edit system templates'),
- path => '/Admin/Global/Templates.html',
- },
-
- F => { title => loc('Custom Fields'),
- text => loc('Modify global custom fields'),
- path => '/Admin/Global/CustomFields/index.html',
- },
-
- G => { title => loc('Group Rights'),
- text => loc('Modify global group rights'),
- path => '/Admin/Global/GroupRights.html',
- },
- H => { title => loc('User Rights'),
- text => loc('Modify global user rights'),
- path => '/Admin/Global/UserRights.html',
- },
- I => { title => loc('RT at a glance'),
- text => loc('Modify the default "RT at a glance" view'),
- path => '/Admin/Global/MyRT.html',
- },
-
-
-
-};
-</%INIT>
+<& /Elements/Tabs &>
+<& /Elements/ListMenu, menu => Menu()->child('tools')->child('config')->child('global') &>
diff --git a/rt/share/html/Admin/Groups/GroupRights.html b/rt/share/html/Admin/Groups/GroupRights.html
index fc3ac33b1..4d9c1187f 100755
--- a/rt/share/html/Admin/Groups/GroupRights.html
+++ b/rt/share/html/Admin/Groups/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,62 +46,17 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => loc('Modify group rights for group [_1]', $GroupObj->Name) &>
-<& /Admin/Elements/GroupTabs,
- GroupObj => $GroupObj,
- current_tab => 'Admin/Groups/GroupRights.html?id='.$id,
- Title => loc('Modify group rights for group [_1]', $GroupObj->Name) &>
+<& /Elements/Tabs &>
<& /Elements/ListActions, actions => \@results &>
- <form method="post" action="GroupRights.html">
+ <form method="post" action="GroupRights.html" id="ModifyGroupRights" name="ModifyGroupRights">
<input type="hidden" class="hidden" name="id" value="<% $GroupObj->id %>" />
-
-<&| /Widgets/TitleBox, title => loc('Modify group rights for group [_1]', $GroupObj->Name) &>
-
-<h1><&|/l&>System groups</&></h1>
-<table>
-% $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,
- PrincipalType => 'Group',
- Object => $GroupObj &>
- </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,
- PrincipalType => 'Group',
- Object => $GroupObj &>
- </td>
- </tr>
-% }
-</table>
-
- </&>
- <& /Elements/Submit, Label => loc('Modify Group Rights'), Reset => 1 &>
-
+ <& /Admin/Elements/EditRights, Context => $GroupObj, Principals => \@principals &>
+ <& /Elements/Submit, Label => loc('Save Changes') &>
</form>
-
<%INIT>
-
- #Update the acls.
- my @results = ProcessACLChanges(\%ARGS);
-
+# Update the acls.
+my @results = ProcessACLs(\%ARGS);
if (!defined $id) {
Abort(loc("No Group defined"));
@@ -110,8 +65,7 @@ if (!defined $id) {
my $GroupObj = RT::Group->new($session{'CurrentUser'});
$GroupObj->Load($id) || Abort(loc("Couldn't load group [_1]",$id));
-my $Groups;
-
+my @principals = GetPrincipalsMap($GroupObj, 'System', 'Groups');
</%INIT>
<%ARGS>
diff --git a/rt/share/html/Admin/Groups/History.html b/rt/share/html/Admin/Groups/History.html
index 53b041dee..9a8ca015a 100644
--- a/rt/share/html/Admin/Groups/History.html
+++ b/rt/share/html/Admin/Groups/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/GroupTabs,
- id => $id,
- GroupObj => $GroupObj,
- current_subtab => $current_tab,
- Title => $title &>
+<& /Elements/Tabs &>
<& /Ticket/Elements/ShowHistory,
Ticket => $GroupObj,
@@ -58,8 +54,7 @@
&>
<%INIT>
-my $current_tab = 'Admin/Groups/History.html?id='.$id;
-my $GroupObj = new RT::Group($session{'CurrentUser'});
+my $GroupObj = RT::Group->new($session{'CurrentUser'});
$GroupObj->Load($id) || Abort("Couldn't load group '$id'");
my $title = loc("History of the group [_1]", $GroupObj->Name);
</%INIT>
diff --git a/rt/share/html/Admin/Groups/Members.html b/rt/share/html/Admin/Groups/Members.html
index 4b40e5bd3..3ba5b657b 100755
--- a/rt/share/html/Admin/Groups/Members.html
+++ b/rt/share/html/Admin/Groups/Members.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,10 +45,8 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-<& /Admin/Elements/Header, Title => loc('RT/Admin/Edit the group [_1]', $Group->Name) &>
-<& /Admin/Elements/GroupTabs, GroupObj => $Group,
- current_tab => 'Admin/Groups/Members.html?id='.$id,
- Title => "RT/Admin/Edit the group ". $Group->Name &>
+<& /Admin/Elements/Header, Title => $title &>
+<& /Elements/Tabs &>
<& /Elements/ListActions, actions => \@results &>
<form action="<% RT->Config->Get('WebPath') %>/Admin/Groups/Members.html" method="post">
@@ -113,9 +111,11 @@ my @users = sort { lc($a->[0]) cmp lc($b->[0]) }
<%INIT>
-my $Group = new RT::Group($session{'CurrentUser'});
+my $Group = RT::Group->new($session{'CurrentUser'});
$Group->Load($id) || Abort(loc('Could not load group'));
+my $title = loc("Modify the group [_1]", $Group->Name);
+
my (%UsersSeen, %GroupsSeen);
$GroupsSeen{ $Group->id } = 1; # can't be a member of ourself
@@ -129,25 +129,37 @@ foreach my $key (keys %ARGS) {
push (@results, $msg);
}
-foreach my $member (grep $_, @AddMembersUsers, @AddMembersGroups) {
+# Process new users
+foreach my $member (grep $_, @AddMembersUsers) {
+ my $principal = RT::User->new($session{'CurrentUser'});
+
+ if ($member =~ /^User-(\d+)$/) {
+ # Old style, using id
+ $principal->Load($1);
+ } else {
+ # New style, just a username
+ $principal->Load($member);
+ }
+
+ my ($val, $msg) = $Group->AddMember($principal->PrincipalId);
+ push (@results, $msg);
+}
- my $principal;
+# Process new groups
+foreach my $member (grep $_, @AddMembersGroups) {
+ my $principal = RT::Group->new($session{'CurrentUser'});
if ($member =~ /^Group-(\d+)$/) {
- $principal = RT::Group->new($session{'CurrentUser'});
- $principal->Load($1);
- } elsif ($member =~ /^User-(\d+)$/) {
- $principal = RT::User->new($session{'CurrentUser'});
+ # Old style, using id
$principal->Load($1);
} else {
- next;
+ # New style, just a group name
+ $principal->LoadUserDefinedGroup($member);
}
-
my ($val, $msg) = $Group->AddMember($principal->PrincipalId);
push (@results, $msg);
}
-
</%INIT>
<%ARGS>
diff --git a/rt/share/html/Admin/Groups/Modify.html b/rt/share/html/Admin/Groups/Modify.html
index de3dac4b5..148c98e1f 100755
--- a/rt/share/html/Admin/Groups/Modify.html
+++ b/rt/share/html/Admin/Groups/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)
@@ -47,15 +47,12 @@
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => $title &>
-<& /Admin/Elements/GroupTabs,
- GroupObj => $Group,
- current_tab => $current_tab,
- Title => $title &>
+<& /Elements/Tabs &>
<& /Elements/ListActions, actions => \@results &>
-<form action="<%RT->Config->Get('WebPath')%>/Admin/Groups/Modify.html" method="post" enctype="multipart/form-data">
+<form action="<%RT->Config->Get('WebPath')%>/Admin/Groups/Modify.html" name="ModifyGroup" method="post" enctype="multipart/form-data">
%unless ($Group->Id) {
<input type="hidden" class="hidden" name="id" value="new" />
@@ -66,11 +63,11 @@
<tr><td align="right">
<&|/l&>Name</&>:
</td>
-<td><input name="Name" value="<%$Group->Name||''%>" /></td>
+<td><input name="Name" value="<%$Group->Name||$Name||''%>" /></td>
</tr>
<tr>
<td align="right">
-<&|/l&>Description</&>:</td><td colspan="3"><input name="Description" value="<%$Group->Description||''%>" size="60" /></td>
+<&|/l&>Description</&>:</td><td colspan="3"><input name="Description" value="<%$Group->Description||$Description||''%>" size="60" /></td>
</tr>
% my $CFs = $Group->CustomFields;
% while (my $CF = $CFs->Next) {
@@ -99,67 +96,72 @@
</form>
<%INIT>
-my $current_tab;
-my ($title, @results, $Disabled, $EnabledChecked);
+my ($title, @results, @warnings, $Disabled, $EnabledChecked);
my $Group = RT::Group->new($session{'CurrentUser'});
if ($Create) {
- $current_tab = 'Admin/Groups/Modify.html?Create=1';
$title = loc("Create a new group");
-}
-
-else {
- $current_tab = 'Admin/Groups/Modify.html?id='.$id;
+} else {
if ($id eq 'new' ) {
-
- my ($create_id, $create_msg) = $Group->CreateUserDefinedGroup(Name =>
- "$Name");
- unless ($create_id) {
- Abort (loc("Group could not be created: [_1]", $create_msg));
- }
- $id = $Group->Id;
- }
- else {
+ my ($create_id, $create_msg) = $Group->CreateUserDefinedGroup(Name => $Name );
+ if ($create_id) {
+ $id = $Group->Id;
+ push @results, $create_msg;
+ } else {
+ push @results, loc("Group could not be created: [_1]", $create_msg);
+ }
+ } else {
$Group->Load($id) || Abort('Could not load group');
}
-
- if ($id) {
+ if ($Group->Id) {
$title = loc("Modify the group [_1]", $Group->Name);
-
- }
+ }
# If the create failed
else {
$title = loc("Create a new group");
$Create = 1;
- }
-
+ }
}
-if ($id) {
-
+if ($Group->Id) {
my @fields = qw(Description Name );
my @fieldresults = UpdateRecordObject ( AttributesRef => \@fields,
Object => $Group,
ARGSRef => \%ARGS );
push (@results,@fieldresults);
push @results, ProcessObjectCustomFieldUpdates( ARGSRef => \%ARGS, Object => $Group );
+
+ # Warn about duplicate groups
+ my $dupcheck = RT::Groups->new(RT->SystemUser);
+ $dupcheck->LimitToUserDefinedGroups();
+ $dupcheck->Limit( FIELD => 'Name', VALUE => $Group->Name );
+ if ($dupcheck->Count > 1) {
+ push @warnings, loc("There is more than one group with the name '[_1]'. This may cause inconsistency in parts of the admin interface, and therefore it's recommended you rename the conflicting groups.", $Group->Name);
+ }
}
#we're asking about enabled on the web page but really care about disabled.
if (defined $Enabled && $Enabled == 1) {
$Disabled = 0;
-}
-else {
+} else {
$Disabled = 1;
}
-if ( ($SetEnabled) and ( $Disabled != $Group->Disabled) ) {
+if ( $Group->Id and ($SetEnabled) and ( $Disabled != $Group->Disabled) ) {
my ($code, $msg) = $Group->SetDisabled($Disabled);
push @results, $msg;
}
+# This code does automatic redirection if any updates happen.
+MaybeRedirectForResults(
+ Actions => \@results,
+ Arguments => { id => $Group->id },
+) if $Group->Id;
+
+push @results, @warnings;
+
unless ($Group->Disabled()) {
$EnabledChecked ='checked="checked"';
}
diff --git a/rt/share/html/Admin/Groups/UserRights.html b/rt/share/html/Admin/Groups/UserRights.html
index aedb55e5e..8e6b09164 100755
--- a/rt/share/html/Admin/Groups/UserRights.html
+++ b/rt/share/html/Admin/Groups/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,45 +46,18 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => loc('Modify user rights for group [_1]', $GroupObj->Name) &>
-<& /Admin/Elements/GroupTabs,
- GroupObj => $GroupObj,
- current_tab => 'Admin/Groups/UserRights.html?id='.$id,
- Title => loc('Modify user rights for group [_1]', $GroupObj->Name) &>
+<& /Elements/Tabs &>
<& /Elements/ListActions, actions => \@results &>
- <form method="post" action="UserRights.html">
+ <form method="post" action="UserRights.html" name="ModifyUserRights" id="ModifyUserRights">
<input type="hidden" class="hidden" name="id" value="<% $GroupObj->id %>" />
-
-<&| /Widgets/TitleBox, title => loc('Modify user rights for group [_1]', $GroupObj->Name) &>
-<table>
-% while ( my $Member = $Users->Next ) {
-% my $UserObj = $Member->MemberObj->Object;
- <tr align="right">
- <td valign="top"><& /Elements/ShowUser, User => $UserObj &></td>
- <td><& /Admin/Elements/SelectRights,
- PrincipalId => $Member->MemberObj->Id,
- PrincipalType => 'User',
- Object => $GroupObj,
- &></td>
- </tr>
-% }
-</table>
-</&>
-
-<& /Elements/Submit, Label => loc('Modify User Rights'), Reset => 1 &>
-
-</form>
+ <& /Admin/Elements/EditRights, Context => $GroupObj, Principals => \@principals &>
+ <& /Elements/Submit, Label => loc('Save Changes') &>
+ </form>
<%INIT>
-
- #Update the acls.
- my @results = ProcessACLChanges(\%ARGS);
-
-# {{{ Deal with setting up the display of current rights.
-
-
-#Define vars used in html above
-
+# Update the acls.
+my @results = ProcessACLs(\%ARGS);
if (!defined $id) {
Abort(loc("No Group defined"));
@@ -93,20 +66,9 @@ if (!defined $id) {
my $GroupObj = RT::Group->new($session{'CurrentUser'});
$GroupObj->Load($id) || Abort(loc("Couldn't load group [_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 @principals = GetPrincipalsMap($GroupObj, 'Users');
</%INIT>
<%ARGS>
$id => undef
-$UserString => undef
-$UserOp => undef
-$UserField => undef
</%ARGS>
diff --git a/rt/share/html/Admin/Groups/index.html b/rt/share/html/Admin/Groups/index.html
index 2485ea731..ef7395f3e 100755
--- a/rt/share/html/Admin/Groups/index.html
+++ b/rt/share/html/Admin/Groups/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,14 +46,40 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => $title &>
-<& /Admin/Elements/GroupTabs, current_tab => 'Admin/Groups/',
- current_subtab => 'Admin/Groups/',
- Title => $title &>
-<% $caption %>:<br />
+<& /Elements/Tabs &>
+<h1><% $caption %></h1>
+
+<form method="post" action="<% RT->Config->Get('WebPath') %>/Admin/Groups/index.html">
+<input type="hidden" name="GroupField" value="Name" />
+<input type="hidden" name="GroupOp" value="LIKE" />
+<&|/l&>Go to group</&>
+<input type="text" name="GroupString" value="" id="autocomplete-GroupString" />
+<script type="text/javascript">
+jQuery(function(){
+ jQuery("#autocomplete-GroupString").autocomplete({
+ source: <% RT->Config->Get('WebPath') |n,j%>+"/Helpers/Autocomplete/Groups",
+ // Auto-submit once a group is chosen
+ select: function( event, ui ) {
+ jQuery(event.target).val(ui.item.value);
+ var form = jQuery(event.target).closest('form');
+ form.find('input[name=GroupOp]').val('=');
+ form.submit();
+ }
+ });
+});
+</script>
+</form>
+
+<form method="post" action="<% RT->Config->Get('WebPath') %>/Admin/Groups/index.html">
+<&|/l&>Find groups whose</&> <& /Elements/SelectGroups &><br />
+<input type="checkbox" class="checkbox" name="FindDisabledGroups" value="1" <% $FindDisabledGroups? 'checked="checked"': '' |n %> /> <&|/l&>Include disabled groups in listing.</&><br />
+<div align="right"><input type="submit" class="button" value="<&|/l&>Go!</&>" /></div>
+</form>
% unless ( $Groups->Count ) {
<em><&|/l&>No groups matching search criteria found.</&></em>
% } else {
+<p><&|/l&>Select a group</&>:</p>
<& /Elements/CollectionList,
OrderBy => 'Name',
@@ -65,23 +91,8 @@
AllowSorting => 1,
PassArguments => [qw(Format Rows Page Order OrderBy GroupString GroupOp GroupField FindDisabledGroups)],
&>
-
-% my $ids = join ',', map $_->id, @{ $Groups->ItemsArrayRef };
-% if ( $ids ) {
-<div align="right"><em>
-(<a href="<% RT->Config->Get('WebPath') %>/Download/Tabular/Group/<% $ids %>/Groups.tsv">
-<&|/l&>Download as a tab-delimited file</&>
-</a>)</em></div>
-% }
-
-<br /><br />
% }
-<form method="post" action="<% RT->Config->Get('WebPath') %>/Admin/Groups/index.html">
-<input type="checkbox" class="checkbox" name="FindDisabledGroups" value="1" <% $FindDisabledGroups? 'checked="checked"': '' |n %> /> <&|/l&>Include disabled groups in listing.</&><br />
-<&|/l&>Find groups whose</&> <& /Elements/SelectGroups &><br />
-<div align="right"><input type="submit" class="button" value="<&|/l&>Go!</&>" /></div>
-</form>
<%INIT>
my $Groups = RT::Groups->new($session{'CurrentUser'});
$Groups->LimitToUserDefinedGroups();
@@ -108,6 +119,8 @@ if (length $GroupString) {
VALUE => $GroupString,
);
}
+ RT::Interface::Web::Redirect(RT->Config->Get('WebURL')."Admin/Groups/Modify.html?id=".$Groups->First->id)
+ if $Groups->Count == 1 and $Groups->First;
}
else {
$caption = loc("User-defined groups");
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..85cd62f16 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" enctype="multipart/form-data">
<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
diff --git a/rt/share/html/Admin/Tools/Configuration.html b/rt/share/html/Admin/Tools/Configuration.html
index f4c648a11..ed7d4651b 100644
--- a/rt/share/html/Admin/Tools/Configuration.html
+++ b/rt/share/html/Admin/Tools/Configuration.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)
@@ -53,10 +53,7 @@ unless ($session{'CurrentUser'}->HasRight( Object=> $RT::System, Right => 'Super
}
</%init>
<& /Admin/Elements/Header, Title => $title &>
-<& /Admin/Elements/ToolTabs,
- current_tab => 'Admin/Tools/Configuration.html',
- current_subtab => 'Admin/Tools/Configuration.html',
- Title => $title &>
+<& /Elements/Tabs &>
<&|/Widgets/TitleBox, title => loc("RT Configuration") &>
<table border="0" cellspacing="0" cellpadding="5" width="100%" class="collection">
@@ -68,7 +65,7 @@ unless ($session{'CurrentUser'}->HasRight( Object=> $RT::System, Right => 'Super
<%PERL>
my $index_conf;
foreach my $key ( RT->Config->Options( Overridable => undef, Sorted => 0 ) ) {
- my $val = RT->Config->Get( $key );
+ my $val = RT->Config->GetObfuscated( $key );
next unless defined $val;
my $meta = RT->Config->Meta( $key );
@@ -91,19 +88,13 @@ foreach my $key ( RT->Config->Options( Overridable => undef, Sorted => 0 ) ) {
<td class="collection-as-table"><% $key %></td>
<td class="collection-as-table">
% if ( $key =~ /Password(?!Length)/i ) {
-<em>Password not printed</em>\
-% } elsif ( !ref $val ) {
-<% "$val" %>\
-% } elsif ( ref $val eq 'ARRAY' ) {
-<% join ', ', @$val %>\
-% } elsif ( ref $val eq 'HASH' ) {
-<% join ', ', %$val %>\
+<em><% loc('Password not printed' ) %></em>\
% } else {
-<% ref $val %>\
+<% stringify($val) |n %>\
% }
</td>
<td class="collection-as-table" style="white-space: nowrap">
-% if ( $description =~ /^.*site config$/ ) {
+% if ( $meta->{'Source'}{'SiteConfig'} ) {
<span style="font-weight: bold"><% $description %></span>
% } else {
<% $description %>
@@ -134,7 +125,7 @@ foreach my $key ( sort keys %{*RT::} ) {
<td class="collection-as-table">RT::<% $key %></td>
<td class="collection-as-table">
% if ( $key =~ /Password(?!Length)/i ) {
-<em>Password not printed</em>
+<em><% loc('Password not printed' ) %></em>\
% } else {
<% ${'RT::'.$key} %>
% }
@@ -157,7 +148,7 @@ for my $type (qw/Tickets Queues Transactions Groups PrivilegedUsers Unprivileged
my $count;
my $class = 'RT::' . $type;
$class =~ s/Privileged|Unprivileged//;
- my $collection = $class->new($RT::SystemUser);
+ my $collection = $class->new(RT->SystemUser);
$collection->UnLimit;
if ($type =~ /PrivilegedUsers/) {
$user_count = $collection->CountAll;
@@ -182,7 +173,7 @@ for my $type (qw/Tickets Queues Transactions Groups PrivilegedUsers Unprivileged
<&|/Widgets/TitleBox, title => loc("Mason template search order") &>
<ol>
-% foreach my $path ( map { $_->[1] } $m->interp->comp_root_array ) {
+% foreach my $path ( RT::Interface::Web->ComponentRoots ) {
<li><% $path %></li>
% }
</ol>
@@ -199,6 +190,30 @@ for my $type (qw/Tickets Queues Transactions Groups PrivilegedUsers Unprivileged
</td>
</table>
+<&|/Widgets/TitleBox, title => loc("Global Attributes") &>
+<table border="0" cellspacing="0" cellpadding="5" width="100%" class="collection">
+<tr class="collection-as-table">
+<th class="collection-as-table"><&|/l&>Name</&></th>
+<th class="collection-as-table"><&|/l&>Value</&></th>
+</tr>
+% my $attrs = $RT::System->Attributes;
+% my $index_size = 0;
+% while ( my $attr = $attrs->Next ) {
+<tr class="<% $index_size%2 ? 'oddline' : 'evenline'%>">
+% if ($attr->Name eq 'UserLogo') {
+% my $content = $attr->Content;
+% $content->{data} = defined $content->{data} ? 'DATA' : 'undef'
+% if exists $content->{data};
+<td><% $attr->Name %></td><td><% stringify($content) |n %></td>
+% } else {
+<td><% $attr->Name %></td><td><% stringify($attr->Content) |n %></td>
+% }
+</tr>
+% $index_size++;
+% }
+</table>
+</&>
+
<&|/Widgets/TitleBox, title => loc("Loaded perl modules")&>
<table border="0" cellspacing="0" cellpadding="5" width="100%" class="collection">
<tr class="collection-as-table">
@@ -227,7 +242,7 @@ if ($item =~ /^\s*(.*?)\s*v(\S+);/) {
<%$ver%>
</td>
<td class="collection-as-table">
- <% $INC{$distfile} %>
+ <% $INC{$distfile} || '' %>
</td>
</tr>
% }
@@ -240,3 +255,18 @@ if ($item =~ /^\s*(.*?)\s*v(\S+);/) {
<% Config::myconfig() %>
</pre>
</&>
+
+<%INIT>
+use Data::Dumper;
+local $Data::Dumper::Terse = 1;
+local $Data::Dumper::Indent = 2;
+
+sub stringify {
+ my $value = shift;
+ my $output = Dumper $value;
+ RT::Interface::Web::EscapeUTF8(\$output);
+ $output =~ s/ /&nbsp;/g;
+ $output =~ s!\n!<br />!g;
+ return $output;
+}
+</%INIT>
diff --git a/rt/share/html/Admin/Tools/Queries.html b/rt/share/html/Admin/Tools/Queries.html
new file mode 100644
index 000000000..dbc6fc5fe
--- /dev/null
+++ b/rt/share/html/Admin/Tools/Queries.html
@@ -0,0 +1,129 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
+%# <sales@bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<%init>
+my $title = loc('SQL Queries');
+unless ($session{'CurrentUser'}->HasRight( Object=> $RT::System, Right => 'SuperUser')) {
+ Abort(loc('This feature is only available to system administrators.'));
+}
+</%init>
+<& /Admin/Elements/Header, Title => $title &>
+<& /Elements/Tabs &>
+<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/jquery.tablesorter.min.js"></script>
+
+<&|/Widgets/TitleBox, title => loc('SQL Queries') &>
+% my $history = $RT::Handle->QueryHistory;
+% if (!RT->Config->Get('StatementLog')) {
+ <p><&|/l&>You must set StatementLog to true to enable this query history page.</&></p>
+% } elsif (!$history) {
+ <p><&|/l&>This server process has recorded no SQL queries.</&></p>
+% } else {
+ <script type="text/javascript">
+ jQuery(function () { jQuery(".tablesorter").tablesorter(); });
+ </script>
+
+ <ol>
+% my $r = 0;
+% for my $request (@$history) {
+% ++$r;
+
+% my ($seconds, $count) = (0, 0);
+% for my $statement (@{ $request->{Queries} }) {
+% $seconds += $statement->[3];
+% $count++;
+% }
+
+ <li>
+ <tt><% $request->{Path} %></tt> - <i><&|/l, sprintf('%.4f', $seconds) &>[_1]s</&></i>
+ <a href="#" onclick="return hideshow(<% "queries-$r" |n,j%>);"><&|/l, $count &>Toggle [quant,_1,query,queries]</&></a>
+ <table id="queries-<%$r%>" class="tablesorter hidden">
+ <thead>
+ <tr>
+ <th><&|/l&>index</&></th>
+ <th><&|/l&>duration</&></th>
+ <th><&|/l&>statement</&></th>
+ </tr>
+ </thead>
+ <tbody>
+% my $s = 0;
+% my @undup;
+% for my $statement (@{ $request->{Queries} }) {
+% my ($dup) = grep {$_->[1] eq $statement->[1]} @undup[-(@undup > 3?3:@undup)..-1];
+% if ($dup) {
+% $dup->[2] = [$dup->[2]] unless $dup->[5];
+% push @{$dup->[2]}, $statement->[2];
+% $dup->[3] += $statement->[3];
+% $dup->[5] ||= 1; $dup->[5]++;
+% } else {
+% push @undup, $statement;
+% }
+% }
+% for my $statement (@undup) {
+% my ( $time, $sql, $bind, $duration, $trace, $dup ) = @$statement;
+% $sql = $RT::Handle->FillIn($sql, $bind) unless $dup;
+ <tr>
+ <td><% ++$s %><% $dup ? " (x $dup)" : "" %></td>
+ <td><i><&|/l, sprintf('%.4f', $duration) &>[_1]s</&></i></td>
+ <td>
+ <tt><% $sql %></tt>
+% if ($dup and @{$bind->[0]}) {
+% for my $b (@{$bind}) {
+ <br><tt>[<% join(", ", @$b) %>]</tt>
+% }
+% }
+ <a class="query-stacktrace-toggle" href="#" onclick="return hideshow(<% "trace-$r-$s" |n,j%>);"><&|/l &>Toggle stack trace</&></a>
+ <pre id="trace-<%$r%>-<%$s%>" class="hidden"><% $trace %></pre>
+ </td>
+ </tr>
+% }
+ </tbody>
+ </table>
+ </li>
+% }
+ </ol>
+% }
+</&>
diff --git a/rt/share/html/Admin/Tools/Shredder/Dumps/dhandler b/rt/share/html/Admin/Tools/Shredder/Dumps/dhandler
index e742001dd..0d24fa0af 100644
--- a/rt/share/html/Admin/Tools/Shredder/Dumps/dhandler
+++ b/rt/share/html/Admin/Tools/Shredder/Dumps/dhandler
@@ -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)
@@ -48,9 +48,6 @@
<%ATTR>
AutoFlush => 0
</%ATTR>
-<%FLAGS>
-inherit => undef
-</%FLAGS>
<%INIT>
my $arg = $m->dhandler_arg;
$m->abort(404) if $arg =~ m{\.\.|/|\\};
@@ -64,5 +61,5 @@ my $buf;
while( read $fh, $buf, 1024*1024 ) {
$m->out($buf);
}
-return 0;
+$m->abort;
</%INIT>
diff --git a/rt/share/html/Admin/Tools/Shredder/Elements/DumpFileLink b/rt/share/html/Admin/Tools/Shredder/Elements/DumpFileLink
index 0f96b4348..5690377cd 100644
--- a/rt/share/html/Admin/Tools/Shredder/Elements/DumpFileLink
+++ b/rt/share/html/Admin/Tools/Shredder/Elements/DumpFileLink
@@ -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)
diff --git a/rt/share/html/Admin/Tools/Shredder/Elements/Error/NoRights b/rt/share/html/Admin/Tools/Shredder/Elements/Error/NoRights
index 0d4e572ad..429313755 100644
--- a/rt/share/html/Admin/Tools/Shredder/Elements/Error/NoRights
+++ b/rt/share/html/Admin/Tools/Shredder/Elements/Error/NoRights
@@ -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,10 +46,6 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => 'Error' &>
-<& /Admin/Elements/ToolTabs,
- current_tab => 'Admin/Tools/Shredder',
- current_subtab => 'Admin/Tools/Shredder',
- Title => 'Error',
-&>
+<& /Elements/Tabs &>
<div class="error"><% loc("You don't have <b>SuperUser</b> right.") |n%></div>
diff --git a/rt/share/html/Admin/Tools/Shredder/Elements/Error/NoStorage b/rt/share/html/Admin/Tools/Shredder/Elements/Error/NoStorage
index bae4685b0..ae3b96e9b 100644
--- a/rt/share/html/Admin/Tools/Shredder/Elements/Error/NoStorage
+++ b/rt/share/html/Admin/Tools/Shredder/Elements/Error/NoStorage
@@ -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)
@@ -49,11 +49,8 @@
$Path => ''
</%ARGS>
<& /Admin/Elements/Header, Title => 'Error' &>
-<& /Admin/Elements/ToolTabs,
- current_tab => 'Admin/Tools/Shredder',
- current_subtab => 'Admin/Tools/Shredder',
- Title => 'Error',
-&>
+<& /Elements/Tabs &>
<div class="error">
-<% loc('Shredder needs a directory to write dumps to. Please check that you have <span class="file-path">[_1]</span> and it is writable by your web server.', $m->interp->apply_escapes( $Path ) ) |n%>
+% my $path_tag = q{<span class="file-path">} . $m->interp->apply_escapes($Path, 'h') . q{</span>};
+<&|/l_unsafe, $path_tag &>Shredder needs a directory to write dumps to. Please ensure that the directory [_1] exists and that it is writable by your web server.</&>
</div>
diff --git a/rt/share/html/Admin/Tools/Shredder/Elements/Object/RT--Attachment b/rt/share/html/Admin/Tools/Shredder/Elements/Object/RT--Attachment
index 02ef90b3e..0da910d77 100644
--- a/rt/share/html/Admin/Tools/Shredder/Elements/Object/RT--Attachment
+++ b/rt/share/html/Admin/Tools/Shredder/Elements/Object/RT--Attachment
@@ -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)
@@ -48,6 +48,7 @@
<%ARGS>
$Object => undef
</%ARGS>
-<a href="<% RT->Config->Get('WebURL') %>/Ticket/Attachment/<% $Object->TransactionId %>/<% $Object->id %>/">
-<% loc('Attachment') %>(<% loc('id') %>:<% $Object->id %>, <% loc('FileName') %>: <% $Object->Filename || loc('(no value)') %>)
+% my $name = (defined $Object->Filename and length $Object->Filename) ? $Object->Filename : loc("(no value)");
+<a href="<% RT->Config->Get('WebPath') %>/Ticket/Attachment/<% $Object->TransactionId %>/<% $Object->id %>/">
+<% loc('Attachment') %>(<% loc('id') %>:<% $Object->id %>, <% loc('Filename') %>: <% $name %>)
</a>
diff --git a/rt/share/html/Admin/Tools/Shredder/Elements/Object/RT--Ticket b/rt/share/html/Admin/Tools/Shredder/Elements/Object/RT--Ticket
index ec052d642..35f1aa8d8 100644
--- a/rt/share/html/Admin/Tools/Shredder/Elements/Object/RT--Ticket
+++ b/rt/share/html/Admin/Tools/Shredder/Elements/Object/RT--Ticket
@@ -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)
@@ -48,6 +48,6 @@
<%ARGS>
$Object => undef
</%ARGS>
-<a href="<% RT->Config->Get('WebURL') %>/Ticket/Display.html?id=<% $Object->id %>">
+<a href="<% RT->Config->Get('WebPath') %>/Ticket/Display.html?id=<% $Object->id %>">
<% loc('Ticket') %>(<% loc('id') %>:<% $Object->id %>, <% loc('Subject') %>: <% substr($Object->Subject, 0, 30) %>...)
</a>
diff --git a/rt/share/html/Admin/Tools/Shredder/Elements/Object/RT--User b/rt/share/html/Admin/Tools/Shredder/Elements/Object/RT--User
index 125f4f2c8..d7627eb14 100644
--- a/rt/share/html/Admin/Tools/Shredder/Elements/Object/RT--User
+++ b/rt/share/html/Admin/Tools/Shredder/Elements/Object/RT--User
@@ -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)
@@ -48,6 +48,6 @@
<%ARGS>
$Object => undef
</%ARGS>
-<a href="<% RT->Config->Get('WebURL') %>/Admin/Users/Modify.html?id=<% $Object->id %>">
+<a href="<% RT->Config->Get('WebPath') %>/Admin/Users/Modify.html?id=<% $Object->id %>">
<% loc('User') %>(<% loc('id') %>:<% $Object->id %>, <% loc('Name') %>: <% $Object->Name %>)
</a>
diff --git a/rt/share/html/Admin/Tools/Shredder/Elements/ObjectCheckBox b/rt/share/html/Admin/Tools/Shredder/Elements/ObjectCheckBox
index e14c5c5a8..3c2e1e7b6 100644
--- a/rt/share/html/Admin/Tools/Shredder/Elements/ObjectCheckBox
+++ b/rt/share/html/Admin/Tools/Shredder/Elements/ObjectCheckBox
@@ -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)
diff --git a/rt/share/html/Admin/Tools/Shredder/Elements/PluginArguments b/rt/share/html/Admin/Tools/Shredder/Elements/PluginArguments
index 67b46ad9d..d9926af9c 100644
--- a/rt/share/html/Admin/Tools/Shredder/Elements/PluginArguments
+++ b/rt/share/html/Admin/Tools/Shredder/Elements/PluginArguments
@@ -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)
@@ -56,7 +56,7 @@ $Plugin => ''
</div>
<%INIT>
use RT::Shredder::Plugin;
-my $plugin_obj = new RT::Shredder::Plugin;
+my $plugin_obj = RT::Shredder::Plugin->new;
my ($status, $msg) = $plugin_obj->LoadByName( $Plugin );
die $msg unless $status;
</%INIT>
diff --git a/rt/share/html/Admin/Tools/Shredder/Elements/PluginHelp b/rt/share/html/Admin/Tools/Shredder/Elements/PluginHelp
index daaa6b74a..7719ec027 100644
--- a/rt/share/html/Admin/Tools/Shredder/Elements/PluginHelp
+++ b/rt/share/html/Admin/Tools/Shredder/Elements/PluginHelp
@@ -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)
@@ -53,7 +53,7 @@ $Plugin => ''
</div>
<%ONCE>
use RT::Shredder::Plugin;
-my $plugin_obj = new RT::Shredder::Plugin;
+my $plugin_obj = RT::Shredder::Plugin->new;
my %plugins = $plugin_obj->List;
</%ONCE>
<%INIT>
diff --git a/rt/share/html/Admin/Tools/Shredder/Elements/SelectObjects b/rt/share/html/Admin/Tools/Shredder/Elements/SelectObjects
index 2488b73f4..7bae913ae 100644
--- a/rt/share/html/Admin/Tools/Shredder/Elements/SelectObjects
+++ b/rt/share/html/Admin/Tools/Shredder/Elements/SelectObjects
@@ -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)
diff --git a/rt/share/html/Admin/Tools/Shredder/Elements/SelectPlugin b/rt/share/html/Admin/Tools/Shredder/Elements/SelectPlugin
index 3835e0b99..e55f60eb0 100644
--- a/rt/share/html/Admin/Tools/Shredder/Elements/SelectPlugin
+++ b/rt/share/html/Admin/Tools/Shredder/Elements/SelectPlugin
@@ -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)
@@ -68,6 +68,6 @@ $Plugin => ''
</div>
<%ONCE>
use RT::Shredder::Plugin;
-my $plugin_obj = new RT::Shredder::Plugin;
+my $plugin_obj = RT::Shredder::Plugin->new;
my %plugins = $plugin_obj->List('Search');
</%ONCE>
diff --git a/rt/share/html/Admin/Tools/Shredder/autohandler b/rt/share/html/Admin/Tools/Shredder/autohandler
index e7f31b575..955206420 100644
--- a/rt/share/html/Admin/Tools/Shredder/autohandler
+++ b/rt/share/html/Admin/Tools/Shredder/autohandler
@@ -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)
diff --git a/rt/share/html/Admin/Tools/Shredder/index.html b/rt/share/html/Admin/Tools/Shredder/index.html
index 8cea3e42c..81b99ec19 100644
--- a/rt/share/html/Admin/Tools/Shredder/index.html
+++ b/rt/share/html/Admin/Tools/Shredder/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)
@@ -52,11 +52,7 @@ $Wipeout => ''
@WipeoutObject => ()
</%ARGS>
<& /Admin/Elements/Header, Title => $title &>
-<& /Admin/Elements/ToolTabs,
- current_tab => 'Admin/Tools/Shredder',
- current_subtab => 'Admin/Tools/Shredder',
- Title => $title,
-&>
+<& /Elements/Tabs &>
<form id="shredder-search-form" action="<% RT->Config->Get('WebPath') %>/Admin/Tools/Shredder/" method="GET">
<div id="shredder-select-plugin">
<& /Elements/ListActions, actions => $messages{'Errors'} &>
@@ -96,7 +92,7 @@ my $catch_non_fatals = sub {
if( $Plugin ) { { # use additional block({}) to effectively exit block on errors
use RT::Shredder::Plugin;
- $plugin_obj = new RT::Shredder::Plugin;
+ $plugin_obj = RT::Shredder::Plugin->new;
my( $status, $msg ) = $plugin_obj->LoadByName( $Plugin );
unless( $status ) {
push @{ $messages{Errors} }, $msg;
@@ -128,8 +124,8 @@ if( $Plugin ) { { # use additional block({}) to effectively exit block on errors
my $dump_file = '';
if( $Plugin && $Wipeout ) { { # use additional block({}) to effectively exit block on errors
- my $shredder = new RT::Shredder( force => 1 );
- my $backup_plugin = new RT::Shredder::Plugin;
+ my $shredder = RT::Shredder->new( force => 1 );
+ my $backup_plugin = RT::Shredder::Plugin->new;
my ($status, $msg) = $backup_plugin->LoadByName('SQLDump');
unless( $status ) {
push @{ $messages{Errors} }, $msg;
@@ -172,7 +168,7 @@ if( $Plugin && ( $Search || $Wipeout ) ) { { # use additional block({}) to effec
}
push @{ $messages{Success} }, loc('executed plugin successfuly');
- my $shredder = new RT::Shredder;
+ my $shredder = RT::Shredder->new;
foreach my $o( grep defined, splice @objs ) {
eval { push @objs, $shredder->CastObjectsToRecords( Objects => $o ) };
$catch_non_fatals->() && last if $@;
diff --git a/rt/share/html/Admin/Tools/Theme.html b/rt/share/html/Admin/Tools/Theme.html
new file mode 100644
index 000000000..11888cac5
--- /dev/null
+++ b/rt/share/html/Admin/Tools/Theme.html
@@ -0,0 +1,309 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
+%# <sales@bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<& /Admin/Elements/Header,
+ Title => loc("Theme"),
+&>
+<& /Elements/Tabs &>
+<& /Elements/ListActions, actions => \@results &>
+
+<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/farbtastic.js"></script>
+
+<div id="simple-customize">
+<div id="upload-logo">
+ <h2>Logo</h2>
+ <& /Elements/Logo, id => 'logo-theme-editor', ShowName => 0 &>
+ <form method="POST" enctype="multipart/form-data">
+ <label for="logo-upload"><&|/l&>Upload a new logo</&>:</label>
+ <input type="file" name="logo-upload" id="logo-upload" /><br />
+ <div class="gd-support">
+% if (%gd_can) {
+ <&|/l, $valid_image_types &>Your system supports automatic color suggestions for: [_1]</&>
+% } else {
+ <&|/l&>GD is disabled or not installed. You can upload an image, but you won't get automatic color suggestions.</&>
+% }
+ </div>
+ <input name="reset_logo" value="Reset to default RT Logo" type="submit" />
+ <input type="submit" value="Upload" />
+ </form>
+</div>
+
+<div id="customize-theme">
+ <h2>Customize the RT theme</h2>
+ <ol>
+ <li>
+ <label for="section"><&|/l&>Select a section</&>:</label>
+ <select id="section"></select>
+ </li>
+ <li>
+ <div class="description"><&|/l&>Select a color for the section</&>:</div>
+% if ($colors) {
+<div class="primary-colors">
+% for (@$colors) {
+% my $fg = $_->{l} >= $text_threshold ? 'black' : 'white';
+<button type="button" class="color-template"
+ style="background-color: rgb(<% $_->{c} %>); color: <% $fg %>;">
+ <&|/l&>Text</&>
+</button>
+% }
+</div>
+% }
+ <div id="color-picker"></div>
+ </li>
+ </ol>
+</div>
+</div>
+
+<div id="custom-css">
+ <h2>Custom CSS (Advanced)</h2>
+
+ <form method="POST">
+ <textarea rows=20 id="user_css" name="user_css" wrap="off"><% $user_css %></textarea><br />
+ <input id="try" type="button" class="button" value="Try" />
+ <input id="reset" type="reset" value="Reset" type="submit" />
+ <input name="reset_css" value="Reset to default RT Theme" type="submit" />
+ <input value="Save" type="submit" />
+ </form>
+</div>
+
+<%ONCE>
+my @sections = (
+ ['Page' => ['body']],
+ ['Header' => ['div#quickbar', 'body.aileron #main-navigation #app-nav > li, body.aileron #main-navigation #app-nav > li > a, #prefs-menu > li, #prefs-menu > li > a, #logo .rtname']],
+ ['Page title' => ['div#header h1']],
+ ['Page content' => ['div#body']],
+ ['Buttons' => ['input[type="reset"], input[type="submit"], input[class="button"]']],
+ ['Button hover' => ['input[type="reset"]:hover, input[type="submit"]:hover, input[class="button"]:hover']],
+);
+</%ONCE>
+<script type="text/javascript">
+var section_css_mapping = <% JSON(\@sections) |n%>;
+
+jQuery(function($) {
+
+ jQuery.each(section_css_mapping, function(i,v){
+ $('select#section').append($("<option/>")
+ .attr('value', v[0])
+ .text(v[0]));
+ });
+
+ $("style#sitecss").text($('#user_css').val());
+ $('#try').click(function() {
+ $("style#sitecss").text($('#user_css').val());
+ });
+
+ $('#reset').click(function() {
+ setTimeout(function() {
+ $("style#sitecss").text($('#user_css').val());
+ }, 1000);
+ });
+
+ function change_color(bg, fg) {
+ var section = $('select#section').val();
+
+ var applying = jQuery.grep(section_css_mapping, function(a){ return a[0] == section })[0][1];
+ var css = $('#user_css').val();
+ if (applying) {
+ var specials = new RegExp("([.*+?|()\\[\\]{}\\\\])", "g");
+ for (var name in applying) {
+ var selector = (applying[name]).replace(specials, "\\$1");
+ var rule = new RegExp('^'+selector+'\\s*\{.*?\}', "m");
+ var newcss = "background: " + bg;
+
+ /* Don't set the text color on <body> as it affects too much */
+ if (applying[name] != "body")
+ newcss += "; color: " + fg;
+
+ /* Kill the border on the quickbar if we're styling it */
+ if (applying[name].match(/quickbar/))
+ newcss += "; border: none;"
+
+ /* Page title's text color is the selected color */
+ if (applying[name].match(/#header/))
+ newcss = "color: " + bg;
+
+ /* Nav doesn't need a background, but it wants text color */
+ if (applying[name].match(/#main-navigation/))
+ newcss = "color: " + fg;
+
+ css = css.replace(rule, applying[name]+" { "+newcss+" }");
+ }
+ }
+ $('#user_css').val(css);
+ $("style#sitecss").text(css);
+ }
+
+ $('#color-picker').farbtastic(function(color){ change_color(color, this.hsl[2] > <% $text_threshold %> ? '#000' : '#fff') });
+
+ $('button.color-template').click(function() {
+ change_color($(this).css('background-color'), $(this).css('color'));
+ });
+
+
+});
+</script>
+<%INIT>
+unless ($session{'CurrentUser'}->HasRight( Object=> RT->System, Right => 'SuperUser')) {
+ Abort(loc('This feature is only available to system administrators.'));
+}
+
+use Digest::MD5 'md5_hex';
+
+my $text_threshold = 0.6;
+my @results;
+my $imgdata;
+
+if (my $file_hash = _UploadedFile( 'logo-upload' )) {
+ my ($id, $msg) = RT->System->SetAttribute( Name => "UserLogo",
+ Description => "User-provided logo",
+ Content => {
+ type => $file_hash->{ContentType},
+ data => $file_hash->{LargeContent},
+ hash => md5_hex($file_hash->{LargeContent}),
+ } );
+ push @results, loc("Unable to set UserLogo: [_1]", $msg) unless $id;
+
+ $imgdata = $file_hash->{LargeContent};
+}
+elsif ($ARGS{'reset_logo'}) {
+ RT->System->DeleteAttribute('UserLogo');
+}
+else {
+ if (my $attr = RT->System->FirstAttribute('UserLogo')) {
+ my $content = $attr->Content;
+ if (ref($content) eq 'HASH') {
+ $imgdata = $content->{data};
+ }
+ else {
+ RT->System->DeleteAttribute('UserLogo');
+ }
+ }
+}
+
+if ($user_css) {
+ if ($ARGS{'reset_css'}) {
+ RT->System->DeleteAttribute('UserCSS');
+ undef $user_css;
+ }
+ else {
+ my ($id, $msg) = RT->System->SetAttribute( Name => "UserCSS",
+ Description => "User-provided css",
+ Content => $user_css );
+ push @results, loc("Unable to set UserCSS: [_1]", $msg) unless $id;
+ }
+}
+
+if (!$user_css) {
+ my $attr = RT->System->FirstAttribute('UserCSS');
+ $user_css = $attr ? $attr->Content : join(
+ "\n\n" => map {
+ join "\n" => "/* ". $_->[0] ." */",
+ map { "$_ {}" } @{$_->[1]}
+ } @sections
+ );
+}
+
+# XXX: move this to some other modules
+
+use List::MoreUtils qw(uniq);
+
+my $has_color_analyzer = eval { require Convert::Color; 1 };
+my $colors;
+my %gd_can;
+my $valid_image_types;
+
+if (not RT->Config->Get('DisableGD') and $has_color_analyzer) {
+ require GD;
+
+ # Always find out what GD can read...
+ for my $type (qw(Png Jpeg Gif)) {
+ $gd_can{$type}++ if GD::Image->can("newFrom${type}Data");
+ }
+ $valid_image_types = join(", ", map { uc } sort { lc $a cmp lc $b } keys %gd_can);
+
+ # ...but only analyze the image if we have data
+ if ($imgdata) {
+ if ( my $img = GD::Image->new($imgdata) ) {
+ $colors = analyze_img($img);
+ }
+ else {
+ # This has to be one damn long line because the loc() needs to be
+ # source parsed correctly.
+ push @results, loc("Automatically suggested theme colors aren't available for your image. This might be because you uploaded an image type that your installed version of GD doesn't support. Supported types are: [_1]. You can recompile libgd and GD.pm to include support for other image types.", $valid_image_types);
+ }
+ }
+}
+
+sub analyze_img {
+ my $img = shift;
+ my $color;
+
+ for my $i (0..$img->width-1) {
+ for my $j (0..$img->height-1) {
+ my @color = $img->rgb( $img->getPixel($i,$j) );
+ my $hsl = Convert::Color->new('rgb:'.join(',',map { $_ / 255 } @color))->convert_to('hsl');
+ my $c = join(',',@color);
+ next if $hsl->lightness < 0.1;
+ $color->{$c} ||= { h => $hsl->hue, s => $hsl->saturation, l => $hsl->lightness, cnt => 0, c => $c};
+ $color->{$c}->{cnt}++;
+ }
+ }
+
+ for (values %$color) {
+ $_->{rank} = $_->{s} * $_->{cnt};
+ }
+ my @top5 = grep { defined and $_->{'l'} and $_->{'c'} }
+ (sort { $b->{rank} <=> $a->{rank} } values %$color)[0..5];
+ if ((scalar uniq map {$_->{rank}} @top5) == 1) {
+ warn "bad";
+ }
+ return \@top5;
+}
+</%INIT>
+<%ARGS>
+$user_css => ''
+</%ARGS>
diff --git a/rt/share/html/Admin/Tools/index.html b/rt/share/html/Admin/Tools/index.html
index 506385bdf..88612704a 100644
--- a/rt/share/html/Admin/Tools/index.html
+++ b/rt/share/html/Admin/Tools/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)
@@ -45,11 +45,6 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-<%init>
-my $title = loc('System Tools');
-</%init>
-<& /Admin/Elements/Header, Title => $title &>
-<& /Admin/Elements/ToolTabs,
- current_tab => 'Admin/Tools/index.html',
- current_subtab => 'Admin/Tools/Configuration.html',
- Title => $title &>
+<& /Admin/Elements/Header, Title => loc('System Tools') &>
+<& /Elements/Tabs &>
+<& /Elements/ListMenu, menu => Menu()->child('tools')->child('config')->child('tools') &>
diff --git a/rt/share/html/Admin/Users/CustomFields.html b/rt/share/html/Admin/Users/CustomFields.html
index 82e8bbc76..bebb163eb 100644
--- a/rt/share/html/Admin/Users/CustomFields.html
+++ b/rt/share/html/Admin/Users/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/UserTabs,
- id => $Object->id,
- current_tab => "Admin/Users/CustomFields.html?$id=".$id,
- current_subtab => "Admin/Users/CustomFields.html?id=".$id,
- UserObj => $Object,
- Title => $title
+<& /Elements/Tabs
&>
<& /Admin/Elements/EditCustomFields, %ARGS, title => $title, Object => $Object, ObjectType => 'RT::User' &>
diff --git a/rt/share/html/Admin/Users/GnuPG.html b/rt/share/html/Admin/Users/GnuPG.html
index de1199340..90408e449 100644
--- a/rt/share/html/Admin/Users/GnuPG.html
+++ b/rt/share/html/Admin/Users/GnuPG.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/UserTabs,
- id => $id,
- UserObj => $UserObj,
- current_tab => 'Admin/Users/GnuPG.html?id='. $id,
- Title => $title,
-&>
+<& /Elements/Tabs &>
<& /Elements/ListActions, actions => \@results &>
diff --git a/rt/share/html/Admin/Users/History.html b/rt/share/html/Admin/Users/History.html
index e8928c8d5..fb51038ee 100644
--- a/rt/share/html/Admin/Users/History.html
+++ b/rt/share/html/Admin/Users/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/UserTabs,
- id => $id,
- UserObj => $UserObj,
- current_tab => $current_tab,
- Title => $title &>
+<& /Elements/Tabs &>
<& /Ticket/Elements/ShowHistory,
Ticket => $UserObj,
@@ -58,8 +54,7 @@
&>
<%INIT>
-my $current_tab = 'Admin/Users/History.html?id='.$id;
-my $UserObj = new RT::User($session{'CurrentUser'});
+my $UserObj = RT::User->new($session{'CurrentUser'});
$UserObj->Load($id) || Abort("Couldn't load user '$id'");
my $title = loc("History of the user [_1]", $UserObj->Name);
</%INIT>
diff --git a/rt/share/html/Admin/Users/Memberships.html b/rt/share/html/Admin/Users/Memberships.html
index 5422e120e..443e189a9 100644
--- a/rt/share/html/Admin/Users/Memberships.html
+++ b/rt/share/html/Admin/Users/Memberships.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/UserTabs,
- id => $id,
- UserObj => $UserObj,
- current_tab => $current_tab,
- Title => $title &>
+<& /Elements/Tabs &>
<& /Elements/ListActions, actions => \@results &>
@@ -63,12 +59,12 @@
OrderBy => 'Name',
Order => 'ASC',
%ARGS,
- Rows => 0,
+ Rows => 20,
DisplayFormat => "__CheckBox.{Delete}__,$Format",
Format => $Format,
Collection => $is_member,
AllowSorting => 1,
- PassArguments => [qw(Format Rows Order OrderBy id)],
+ PassArguments => [qw(Format Rows Page Order OrderBy id)],
&>
<h2><&|/l&>Groups the user is not member of (check box to add)</&></h2>
@@ -76,7 +72,7 @@
<& /Elements/CollectionList,
OrderBy => 'Name',
Order => 'ASC',
- Rows => 100,
+ Rows => 20,
%ARGS,
DisplayFormat => "__CheckBox.{Add}__,'__HasMemberRecursively.{$id}__/TITLE:Recursive',$Format",
Format => $Format,
@@ -94,7 +90,6 @@ my $UserObj = RT::User->new($session{'CurrentUser'});
$UserObj->Load( $id ) || Abort("Couldn't load user '$id'");
my $title = loc("Memberships of the user [_1]", $UserObj->Name);
-my $current_tab = 'Admin/Users/Memberships.html?id='. $id;
my @results;
if ( $Update ) {
diff --git a/rt/share/html/Admin/Users/Modify.html b/rt/share/html/Admin/Users/Modify.html
index 28d594377..05dde17f2 100755
--- a/rt/share/html/Admin/Users/Modify.html
+++ b/rt/share/html/Admin/Users/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,11 +46,7 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => $title &>
-<& /Admin/Elements/UserTabs,
- id => $id,
- UserObj => $UserObj,
- current_tab => $current_tab,
- Title => $title &>
+<& /Elements/Tabs &>
<& /Elements/ListActions, actions => \@results &>
@@ -70,37 +66,37 @@
<tr><td align="right">
<&|/l&>Username</&>:
</td><td>
-<input name="Name" value="<%$UserObj->Name||''%>" /> <strong><&|/l&>(required)</&></strong>
+<input name="Name" value="<%$UserObj->Name||$Name||''%>" /> <strong><&|/l&>(required)</&></strong>
</td></tr>
<tr><td align="right">
<&|/l&>Email</&>:
</td><td>
-<input name="EmailAddress" value="<%$UserObj->EmailAddress||''%>" />
+<input name="EmailAddress" value="<%$UserObj->EmailAddress||$EmailAddress||''%>" />
</td></tr>
<tr><td align="right">
<&|/l&>Real Name</&>:
</td><td>
-<input name="RealName" value="<%$UserObj->RealName||''%>" />
+<input name="RealName" value="<%$UserObj->RealName||$RealName||''%>" />
</td></tr>
<tr><td align="right">
<&|/l&>Nickname</&>:
</td><td>
-<input name="NickName" value="<%$UserObj->NickName||''%>" />
+<input name="NickName" value="<%$UserObj->NickName||$NickName||''%>" />
</td></tr>
<tr><td align="right">
<&|/l&>Unix login</&>:
</td><td>
-<input name="Gecos" value="<%$UserObj->Gecos||''%>" />
+<input name="Gecos" value="<%$UserObj->Gecos||$Gecos||''%>" />
</td></tr>
<tr><td align="right">
<&|/l&>Language</&>:
</td><td>
-<& /Elements/SelectLang, Name => 'Lang', Default => $UserObj->Lang &>
+<& /Elements/SelectLang, Name => 'Lang', Default => $UserObj->Lang||$Lang &>
</td></tr>
<tr><td align="right">
<&|/l&>Extra info</&>:
</td><td>
-<textarea name="FreeformContactInfo" cols="20" rows="5"><%$UserObj->FreeformContactInfo||''%></textarea>
+<textarea name="FreeformContactInfo" cols="20" rows="5"><%$UserObj->FreeformContactInfo||$FreeformContactInfo||''%></textarea>
</td></tr>
</table>
</&>
@@ -134,39 +130,39 @@
<tr><td align="right">
<&|/l&>Organization</&>:
</td><td>
-<input name="Organization" value="<%$UserObj->Organization||''%>" />
+<input name="Organization" value="<%$UserObj->Organization||$Organization||''%>" />
</td></tr>
<tr><td align="right">
<&|/l&>Address1</&>:
</td><td>
-<input name="Address1" value="<%$UserObj->Address1||''%>" />
+<input name="Address1" value="<%$UserObj->Address1||$Address1||''%>" />
</td></tr>
<tr><td align="right">
<&|/l&>Address2</&>:
</td><td>
-<input name="Address2" value="<%$UserObj->Address2||''%>" />
+<input name="Address2" value="<%$UserObj->Address2||$Address2||''%>" />
</td></tr>
<tr><td align="right">
<&|/l&>City</&>:
</td><td>
-<input name="City" value="<%$UserObj->City||''%>" size="14" />
+<input name="City" value="<%$UserObj->City||$City||''%>" size="14" />
</td></tr>
<tr><td align="right">
<&|/l&>State</&>:
</td><td>
-<input name="State" value="<%$UserObj->State||''%>" size="3" />
+<input name="State" value="<%$UserObj->State||$State||''%>" size="3" />
</td></tr>
<tr><td align="right">
<&|/l&>Zip</&>:
</td><td>
-<input name="Zip" value="<%$UserObj->Zip||''%>" size="9" />
+<input name="Zip" value="<%$UserObj->Zip||$Zip||''%>" size="9" />
</td></tr>
<tr><td align="right">
<&|/l&>Country</&>:
</td><td>
-<input name="Country" value="<%$UserObj->Country||''%>" />
+<input name="Country" value="<%$UserObj->Country||$Country||''%>" />
</td></tr>
</table>
</&>
@@ -176,22 +172,22 @@
<tr><td align="right">
<&|/l&>Residence</&>:
</td><td>
-<input name="HomePhone" value="<%$UserObj->HomePhone||''%>" size="13" /><br />
+<input name="HomePhone" value="<%$UserObj->HomePhone||$HomePhone||''%>" size="13" /><br />
</td></tr>
<tr><td align="right">
<&|/l&>Work</&>:
</td><td>
-<input name="WorkPhone" value="<%$UserObj->WorkPhone||''%>" size="13" /><br />
+<input name="WorkPhone" value="<%$UserObj->WorkPhone||$WorkPhone||''%>" size="13" /><br />
</td></tr>
<tr><td align="right">
<&|/l&>Mobile</&>:
</td><td>
-<input name="MobilePhone" value="<%$UserObj->MobilePhone||''%>" size="13" /><br />
+<input name="MobilePhone" value="<%$UserObj->MobilePhone||$MobilePhone||''%>" size="13" /><br />
</td></tr>
<tr><td align="right">
<&|/l&>Pager</&>:
</td><td>
-<input name="PagerPhone" value="<%$UserObj->PagerPhone||''%>" size="13" /><br />
+<input name="PagerPhone" value="<%$UserObj->PagerPhone||$PagerPhone||''%>" size="13" /><br />
</td>
</tr>
</table>
@@ -207,7 +203,7 @@
% if ($UserObj->id) {
<& /Elements/EditCustomField, %ARGS, Object => $UserObj, CustomField => $CF &>
% } else {
-<& /Elements/EditCustomField, %ARGS, NamePrefix => 'Object-RT::User-new-CustomField-', CustomField => $CF &>
+<& /Elements/EditCustomField, %ARGS, NamePrefix => 'Object-RT::User--CustomField-', CustomField => $CF &>
% }
</td></tr>
% }
@@ -218,12 +214,12 @@
<tr>
<td colspan="2">
<&| /Widgets/TitleBox, title => loc('Comments about this user') &>
-<textarea class="comments" name="Comments" cols="80" rows="5" wrap="virtual"><%$UserObj->Comments||''%></textarea>
+<textarea class="comments" name="Comments" cols="80" rows="5" wrap="virtual"><%$UserObj->Comments||$Comments||''%></textarea>
</&>
%if (!$Create && $UserObj->Privileged) {
<br />
<&| /Widgets/TitleBox, title => loc('Signature') &>
-<textarea class="signature" cols="80" rows="5" name="Signature" wrap="hard"><%$UserObj->Signature||''%></textarea>
+<textarea class="signature" cols="80" rows="5" name="Signature" wrap="hard"><%$UserObj->Signature||$Signature||''%></textarea>
</&>
% }
@@ -240,20 +236,16 @@
<%INIT>
-my $current_tab;
-my $UserObj = new RT::User($session{'CurrentUser'});
+my $UserObj = RT::User->new($session{'CurrentUser'});
my ($title, $PrivilegedChecked, $EnabledChecked, $Disabled, $result, @results);
my ($val, $msg);
if ($Create) {
- $current_tab = 'Admin/Users/Modify.html?Create=1';
$title = loc("Create a new user");
}
else {
- $current_tab = 'Admin/Users/Modify.html?id='.$id if $id;
-
if ( defined $id && $id eq 'new') {
( $val, $msg ) = $UserObj->Create(
Name => $Name,
@@ -290,12 +282,6 @@ else {
if ($val) {
push @results, $msg;
- foreach my $key ( keys %ARGS) {
- # Convert custom fields on the "new" object to custom fields on the one we've just created
- if ($key =~ /^Object-RT::User-new-CustomField-(.*)$/) {
- $ARGS{'Object-RT::User-'.$val.'-CustomField-'.$1} = delete $ARGS{$key};
- }
- }
push @results, ProcessObjectCustomFieldUpdates( ARGSRef => \%ARGS, Object => $UserObj );
} else {
push @results, loc('User could not be created: [_1]', $msg);
@@ -318,6 +304,7 @@ else {
}
+$m->callback( %ARGS, CallbackName => 'BeforeUpdate', User => $UserObj, ARGSRef => \%ARGS, Results => \@results );
# If we have a user to modify, lets try.
@@ -354,7 +341,6 @@ if ($UserObj->Id && $id ne 'new') {
}
- # }}}
}
@@ -379,13 +365,15 @@ unless ( $UserObj->id && $UserObj->Disabled ) {
$EnabledChecked = 'checked="checked"';
}
-if (!$Create && $UserObj->Privileged()) {
+if ((!$Create && $UserObj->Privileged()) or (!$UserObj->Id and $Privileged)) {
$PrivilegedChecked = 'checked="checked"';
}
-# set the id, so the the menu will have the right info, this needs to
-# be done here to avoid creating and then modifying a user
-$id = $UserObj->Id;
+# This code does automatic redirection if any updates happen.
+MaybeRedirectForResults(
+ Actions => \@results,
+ Arguments => { id => $UserObj->Id },
+) if $UserObj->Id;
</%INIT>
diff --git a/rt/share/html/Admin/Users/MyRT.html b/rt/share/html/Admin/Users/MyRT.html
index 346a2d60c..0fcd63b60 100644
--- a/rt/share/html/Admin/Users/MyRT.html
+++ b/rt/share/html/Admin/Users/MyRT.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/UserTabs,
- id => $id,
- UserObj => $UserObj,
- current_tab => $current_tab,
- Title => $title &>
+<& /Elements/Tabs &>
<& /Widgets/SelectionBox:header, nojs => 1 &>
@@ -72,9 +68,7 @@
<%init>
my @actions;
-my $current_tab;
-$current_tab = 'Admin/Users/MyRT.html?id='.$id if $id;
-my $UserObj = new RT::User($session{'CurrentUser'});
+my $UserObj = RT::User->new($session{'CurrentUser'});
$UserObj->Load($id) || Abort("Couldn't load user '" . ($id || '') . "'");
my $title = loc("RT at a glance for the user [_1]", $UserObj->Name);
@@ -94,7 +88,7 @@ push @items, map {["component-$_", $_]} sort keys %allowed_components;
my $sys = RT::System->new( RT::CurrentUser->new($UserObj) );
my @objs = ($sys);
-push @objs, RT::SavedSearches->new( RT::CurrentUser->new( $UserObj ) )->_PrivacyObjects;
+push @objs, RT::SavedSearch->new( RT::CurrentUser->new( $UserObj ) )->ObjectsForLoading;
for my $object (@objs) {
for ($m->comp("/Search/Elements/SearchesForObject", Object => $object)) {
diff --git a/rt/share/html/Admin/Users/index.html b/rt/share/html/Admin/Users/index.html
index 6561abf86..adcfeb5b9 100755
--- a/rt/share/html/Admin/Users/index.html
+++ b/rt/share/html/Admin/Users/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,15 +46,51 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Admin/Elements/Header, Title => loc('Select a user') &>
-<& /Admin/Elements/UserTabs, current_tab => 'Admin/Users/',
- current_subtab => 'Admin/Users/',
- Title => loc('Select a user') &>
-
+<& /Elements/Tabs &>
+
<h1><% $caption %></h1>
-<p><&|/l&>Select a user</&>:</p>
+
+<form method="post" action="<% RT->Config->Get('WebPath') %>/Admin/Users/index.html">
+% foreach my $field( qw(Format Rows Page Order OrderBy) ) {
+% next unless defined $ARGS{ $field } && length $ARGS{ $field };
+<input type="hidden" name="<% $field %>" value="<% $ARGS{ $field } %>" />
+% }
+<input type="hidden" name="UserField" value="Name" />
+<input type="hidden" name="UserOp" value="LIKE" />
+<&|/l&>Go to user</&>
+<input type="text" name="UserString" value="" id="autocomplete-UserString" />
+<script type="text/javascript">
+jQuery(function(){
+ jQuery("#autocomplete-UserString").autocomplete({
+ source: <% RT->Config->Get('WebPath') |n,j%>+"/Helpers/Autocomplete/Users?return=Name",
+ // Auto-submit once a user is chosen
+ select: function( event, ui ) {
+ jQuery(event.target).val(ui.item.value);
+ var form = jQuery(event.target).closest('form');
+ form.find('input[name=UserOp]').val('=');
+ form.submit();
+ }
+ });
+});
+</script>
+</form>
+
+<form method="post" action="<% RT->Config->Get('WebPath') %>/Admin/Users/index.html">
+% foreach my $field( qw(Format Rows Page Order OrderBy) ) {
+% next unless defined $ARGS{ $field } && length $ARGS{ $field };
+<input type="hidden" name="<% $field %>" value="<% $ARGS{ $field } %>" />
+% }
+<&|/l&>Find all users whose</&> <& /Elements/SelectUsers, %ARGS, Fields => \@fields &><br />
+<input type="checkbox" class="checkbox" name="FindDisabledUsers" value="1" <% $FindDisabledUsers? 'checked="checked"': '' %> />
+<&|/l&>Include disabled users in search.</&>
+<br />
+<div align="right"><input type="submit" class="button" value="<&|/l&>Go!</&>" /></div>
+</form>
+
% unless ( $users->Count ) {
<em><&|/l&>No users matching search criteria found.</&></em>
% } else {
+<p><&|/l&>Select a user</&>:</p>
<& /Elements/CollectionList,
OrderBy => 'Name',
@@ -67,29 +103,8 @@
PassArguments => [qw(Format Rows Page Order OrderBy UserString UserOp UserField IdLike EmailLike FindDisabledUsers)],
&>
-% my $ids = join ',', map $_->id, @{ $users->ItemsArrayRef };
-% if ( $ids ) {
-<div align="right"><em>
-(<a href="<%RT->Config->Get('WebPath')%>/Download/Tabular/User/<% $ids %>/Users.tsv">
-<&|/l&>Download as a tab-delimited file</&>
-</a>)</em></div>
% }
-<br /><br />
-% }
-
-<form method="post" action="<% RT->Config->Get('WebPath') %>/Admin/Users/index.html">
-% foreach my $field( qw(Format Rows Page Order OrderBy) ) {
-% next unless defined $ARGS{ $field } && length $ARGS{ $field };
-<input type="hidden" name="<% $field %>" value="<% $ARGS{ $field } %>" />
-% }
-<&|/l&>Find all users whose</&> <& /Elements/SelectUsers, %ARGS &><br />
-<input type="checkbox" class="checkbox" name="FindDisabledUsers" value="1" <% $FindDisabledUsers? 'checked="checked"': '' %> />
-<&|/l&>Include disabled users in search.</&>
-<br />
-<div align="right"><input type="submit" class="button" value="<&|/l&>Go!</&>" /></div>
-</form>
-
<%INIT>
my $caption;
my $users = RT::Users->new( $session{'CurrentUser'} );
@@ -111,6 +126,8 @@ if ( defined($UserString) && length $UserString ) {
VALUE => $UserString,
);
}
+ RT::Interface::Web::Redirect(RT->Config->Get('WebURL')."Admin/Users/Modify.html?id=".$users->First->id)
+ if $users->Count == 1;
}
else {
$caption = loc("Privileged users");
@@ -119,6 +136,29 @@ else {
$Format ||= RT->Config->Get('AdminSearchResultFormat')->{'Users'};
+# Build up the list of fields to display for searching
+my $i = 0;
+my %sorted = map { $_ => $i++ } qw(
+ Name EmailAddress RealName Organization NickName WorkPhone HomePhone
+ MobilePhone PagerPhone Address1 Address2 City State Zip Country
+ Timezone Lang Gecos Comments
+);
+
+my @attrs = sort { $sorted{$a} <=> $sorted{$b} }
+ grep { !/(?:^id$|ContactInfo|Encoding|^External|System|PGPKey|AuthToken|^Last|^Creat(?:ed|or)$|^Signature$)/ }
+ RT::User->ReadableAttributes;
+my @fields;
+
+for my $name (@attrs) {
+ my $label = $m->comp(
+ '/Elements/ColumnMap',
+ Class => 'RT__User',
+ Name => $name,
+ Attr => 'title'
+ );
+
+ push @fields, [ $name, $label || $name ];
+}
</%INIT>
<%ARGS>
$Format => undef,
diff --git a/rt/share/html/Admin/autohandler b/rt/share/html/Admin/autohandler
index d2fe02aab..6559bec2f 100644
--- a/rt/share/html/Admin/autohandler
+++ b/rt/share/html/Admin/autohandler
@@ -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)
diff --git a/rt/share/html/Admin/index.html b/rt/share/html/Admin/index.html
index 7956bde8b..3dd8ab4f9 100755
--- a/rt/share/html/Admin/index.html
+++ b/rt/share/html/Admin/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)
@@ -45,51 +45,9 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-<& //Admin/Elements/Header, Title => loc('RT Administration') &>
-<& //Admin/Elements/Tabs, Title => loc('RT Administration') &>
-
-<& /Elements/ListMenu, items => $tabs &>
-<%init>
-
-
-
-my $tabs = {
- A => {
- title => loc('Users'),
- path => '/Admin/Users/index.html',
- description => loc('Manage users and passwords'),
- },
- B => {
- title => loc('Groups'),
- path => '/Admin/Groups/index.html',
- description => loc('Manage groups and group membership'),
- },
- C => {
- title => loc('Queues'),
- path => '/Admin/Queues/index.html',
- description => loc('Manage queues and queue-specific properties'),
- },
- D => {
- 'title' => loc('Custom Fields'),
- description => loc('Manage custom fields and custom field values'),
- path => '/Admin/CustomFields/index.html',
- },
- E => {
- 'title' => loc('Global'),
- path => '/Admin/Global/index.html',
- description =>
- loc('Manage properties and configuration which apply to all queues'),
- },
- F => {
- 'title' => loc('Tools'),
- path => '/Admin/Tools/index.html',
- description => loc('Use other RT administrative tools')
- },
-};
-
- $m->callback( %ARGS, tabs => $tabs );
-
-
-
-
-</%init>
+<& /Admin/Elements/Header, Title => loc('RT Administration') &>
+<& /Elements/Tabs &>
+<& /Elements/ListMenu, menu => Menu()->child('tools')->child('config') &>
+% if (RT->Config->Get('ShowRTPortal')) {
+<& /Admin/Elements/Portal &>
+% }