From 6587f6ba7d047ddc1686c080090afe7d53365bd4 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Tue, 24 Apr 2012 11:35:56 -0700 Subject: first pass RT4 merge, RT#13852 --- .../html/Admin/Articles/Classes/CustomFields.html | 64 +++++ .../html/Admin/Articles/Classes/GroupRights.html | 73 +++++ rt/share/html/Admin/Articles/Classes/Modify.html | 199 +++++++++++++ rt/share/html/Admin/Articles/Classes/Objects.html | 154 ++++++++++ rt/share/html/Admin/Articles/Classes/Topics.html | 68 +++++ .../html/Admin/Articles/Classes/UserRights.html | 72 +++++ rt/share/html/Admin/Articles/Classes/index.html | 91 ++++++ rt/share/html/Admin/Articles/Elements/Topics | 215 ++++++++++++++ rt/share/html/Admin/Articles/index.html | 50 ++++ rt/share/html/Admin/Elements/EditQueueWatcherGroup | 56 ++++ rt/share/html/Admin/Elements/EditRights | 175 ++++++++++++ .../html/Admin/Elements/EditRightsCategoryTabs | 129 +++++++++ rt/share/html/Admin/Elements/Portal | 52 ++++ .../Admin/Elements/SelectCustomFieldRenderType | 70 +++++ .../Admin/Global/CustomFields/Class-Article.html | 54 ++++ rt/share/html/Admin/Global/Topics.html | 63 +++++ rt/share/html/Admin/Tools/Queries.html | 129 +++++++++ rt/share/html/Admin/Tools/Theme.html | 309 +++++++++++++++++++++ 18 files changed, 2023 insertions(+) create mode 100644 rt/share/html/Admin/Articles/Classes/CustomFields.html create mode 100644 rt/share/html/Admin/Articles/Classes/GroupRights.html create mode 100644 rt/share/html/Admin/Articles/Classes/Modify.html create mode 100644 rt/share/html/Admin/Articles/Classes/Objects.html create mode 100644 rt/share/html/Admin/Articles/Classes/Topics.html create mode 100644 rt/share/html/Admin/Articles/Classes/UserRights.html create mode 100644 rt/share/html/Admin/Articles/Classes/index.html create mode 100644 rt/share/html/Admin/Articles/Elements/Topics create mode 100644 rt/share/html/Admin/Articles/index.html create mode 100644 rt/share/html/Admin/Elements/EditQueueWatcherGroup create mode 100644 rt/share/html/Admin/Elements/EditRights create mode 100644 rt/share/html/Admin/Elements/EditRightsCategoryTabs create mode 100644 rt/share/html/Admin/Elements/Portal create mode 100644 rt/share/html/Admin/Elements/SelectCustomFieldRenderType create mode 100644 rt/share/html/Admin/Global/CustomFields/Class-Article.html create mode 100644 rt/share/html/Admin/Global/Topics.html create mode 100644 rt/share/html/Admin/Tools/Queries.html create mode 100644 rt/share/html/Admin/Tools/Theme.html (limited to 'rt/share/html/Admin') 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 +%# +%# +%# (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 ); + + +<%ARGS> +$id => undef + diff --git a/rt/share/html/Admin/Articles/Classes/GroupRights.html b/rt/share/html/Admin/Articles/Classes/GroupRights.html new file mode 100644 index 000000000..092ea4b23 --- /dev/null +++ b/rt/share/html/Admin/Articles/Classes/GroupRights.html @@ -0,0 +1,73 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +%# +%# +%# (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('Modify group rights for Class [_1]', $ClassObj->Name) &> +<& /Elements/Tabs &> +<& /Elements/ListActions, actions => \@results &> + +
+ + + <& /Admin/Elements/EditRights, Context => $ClassObj, Principals => \@principals &> + + <& /Elements/Submit, Label => loc('Save Changes') &> +
+<%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)); + +<%ARGS> +$id => undef + 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 +%# +%# +%# (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 &> + +
+ +%if ($Create ) { + +% } else { + +% } + + + + + + + + + + + + + + + + + + +
<&|/l&>Class Name:
<&|/l&>Description:
 > <&|/l&>Enabled (Unchecking this box disables this class)
 > <&|/l&>All Articles in this class should be listed in a dropdown of the ticket reply page
+ +

When inserting articles in this class into emails:

+
    +
  • > Include article name
  • +
  • > Include article summary
  • +% if ( $cfs ) { +% while (my $cf = $cfs->Next) { +
  • Include custom field '<% $cf->Name %>' +
      +
    • Id} %> />Title
    • +
    • Id} %> />Value
    • +
    +
  • +% } } +
+ +%$m->callback( CallbackName => 'BeforeSubmit', CustomFields => $cfs, ClassObj => $ClassObj ); + +% if ( $Create ) { +<& /Elements/Submit, Label => loc('Create') &> +% } else { +<& /Elements/Submit, Label => loc('Save Changes') &> +% } +
+ +<%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" : ""; + + + +<%ARGS> +$id => undef +$result => undef +$Name => undef +$Create => undef +$Description => undef +$Submitted => undef +$Enabled => undef + 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 +%# +%# +%# (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 &> + +
+ + +% if ( $is_global ) { +

<&|/l&>Applies to all objects

+ +<&|/l&>check this box to remove this Class globally and be able to choose specific Queues. +% } else { +

<&|/l&>Apply globally

+ + +<&|/l&>check this box to apply this Class globally to all Queues. + +

<&|/l&>Selected Queues

+<& /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), + ], +&> + +

<&|/l&>Unselected Queues

+<& /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' &> +
+ +<%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); + + +<%ARGS> +$id => undef +$FindDisabledObjects => 0 +$UpdateObjs => 0 + diff --git a/rt/share/html/Admin/Articles/Classes/Topics.html b/rt/share/html/Admin/Articles/Classes/Topics.html new file mode 100644 index 000000000..5418d81a5 --- /dev/null +++ b/rt/share/html/Admin/Articles/Classes/Topics.html @@ -0,0 +1,68 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +%# +%# +%# (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, title => $title, RootObj => $ClassObj, %ARGS &> + +<%INIT> + +my $ClassObj = RT::Class->new($session{'CurrentUser'}); +$ClassObj->Load($ARGS{'id'}) || $m->comp("/Elements/Error", Why => "Couldn't load class '$id'"); + +my $title = $Modify + ? loc("Modify topic for [_1]", $ClassObj->Name) + : loc("Edit topic hierarchy for [_1]", $ClassObj->Name); + + + + +<%ARGS> +$id => undef +$Modify => "" + diff --git a/rt/share/html/Admin/Articles/Classes/UserRights.html b/rt/share/html/Admin/Articles/Classes/UserRights.html new file mode 100644 index 000000000..c1aedeb33 --- /dev/null +++ b/rt/share/html/Admin/Articles/Classes/UserRights.html @@ -0,0 +1,72 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +%# +%# +%# (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('Modify user rights for class [_1]', $ClassObj->Name) &> +<& /Elements/Tabs &> +<& /Elements/ListActions, actions => \@results &> + +
+ + <& /Admin/Elements/EditRights, Context => $ClassObj, Principals => \@principals &> + + <& /Elements/Submit, Label => loc('Save Changes') &> +<%INIT> +my @results = ProcessACLs(\%ARGS); + +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 @principals = GetPrincipalsMap($ClassObj, 'Users'); + + +<%ARGS> +$id => undef + 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 +%# +%# +%# (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 &> + +

<%$caption%>:

+

<&|/l&>Select a Class:

+% unless ($Classes->Count) { +<&|/l&>No Classes matching search criteria found. +% } else { +<& /Elements/CollectionList, + OrderBy => 'Name', + Order => 'ASC', + %ARGS, + Format => $Format, + Collection => $Classes, + AllowSorting => 1, + PassArguments => [qw( Format Rows Page Order OrderBy FindDisabledClasses )], +&> +% } + + +<&|/l&>Include disabled classes in listing.
+
+ +<%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'}; + + +<%ARGS> +$FindDisabledClasses => 0 +$Format => undef + diff --git a/rt/share/html/Admin/Articles/Elements/Topics b/rt/share/html/Admin/Articles/Elements/Topics new file mode 100644 index 000000000..96ddaf00c --- /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 +%# +%# +%# (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 &> + +
+ + +% if (!$Modify) { + + + + + + + + + +
<&|/l&>Topic Name
<&|/l&>Description
+% } else { +New topic +% } + +<& .tree, Element => $tree, Action => $Modify ? "Move" : "Add", Prefix => $Modify ? "Topic-$Modify-Parent" : "Insert", RootObj => $RootObj, Modify => $Modify &> + +
+ +<%def .edit> +  + + + + + + + + + + + +
Topic Name:
Description:
+<%args> +$topic + + + +<%def .tree> +% my $topic = $Element->getNodeValue; +% unless ($Element->isRoot) { +% if ($Modify and $topic->Id == $Modify) { +% $Action = ""; +<& .edit, topic => $topic &> +% } else { +<%$topic->Name || loc("(no name)") %> +% } +% } +
    +% for my $e (sort {$a->getNodeValue->Name cmp $b->getNodeValue->Name} $Element->getAllChildren) { +
  • <& .tree, Element => $e, Action => $Action, Prefix => $Prefix, RootObj => $RootObj, Modify => $Modify &>
  • +% } +% if ($Action) { +% unless ($Action eq "Move" and grep {$_->getNodeValue->Id == $Modify} $Element->getAllChildren) { +
  • Id%>" value="<&|/l&><%$Action%> here" />
  • +% } +% } +
+<%args> +$Element +$Action +$Prefix +$RootObj +$Modify + + + +<%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"; +} + + + + +<%ARGS> +$RootObj => undef +$title => "" +$Modify => "" + + 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 +%# +%# +%# (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/Elements/EditQueueWatcherGroup b/rt/share/html/Admin/Elements/EditQueueWatcherGroup new file mode 100644 index 000000000..8bc1de29a --- /dev/null +++ b/rt/share/html/Admin/Elements/EditQueueWatcherGroup @@ -0,0 +1,56 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +%# +%# +%# (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> +$Label +$QueueObj +$Watchers + +<% $Label %>: + +<& /Admin/Elements/EditQueueWatchers, QueueObj => $QueueObj, Watchers => $Watchers &> + diff --git a/rt/share/html/Admin/Elements/EditRights b/rt/share/html/Admin/Elements/EditRights new file mode 100644 index 000000000..e5b9908b5 --- /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 +%# +%# +%# (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 + +<%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 + } +} + +%# 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. + + + +
+ + +<%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; + + +
+

+ <% $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}; + + <&|/l, $inc &>includes [_1]\ +<%perl> + } +} + +

+ <& EditRightsCategoryTabs, Context => $Context, Principal => $obj, id => $id &> +
+<%perl> + } +} + +if ( $AddPrincipal ) { + +
+

<&|/l, loc($AddPrincipal) &>Add rights for this [_1]

+ <& EditRightsCategoryTabs, Context => $Context, id => 'acl-AddPrincipal' &> +
+% } + +
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 +%# +%# +%# (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 => '' + +<%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; + +
+ +% for my $category (sort { $catsort{$a} <=> $catsort{$b} } keys %categories) { +
"> +
    +% for my $right (sort { $available_rights{$a} cmp $available_rights{$b} } @{$categories{$category}}) { +
  • + /> + +
  • +% } +
+
+% } +
+ diff --git a/rt/share/html/Admin/Elements/Portal b/rt/share/html/Admin/Elements/Portal new file mode 100644 index 000000000..d5e75c598 --- /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 +%# +%# +%# (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 }}} +
+<&| /Widgets/TitleBox, title => 'RT Portal' &> + + +
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 +%# +%# +%# (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 $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; +} + +<%ARGS> +$Default => undef +$TypeComposite => 'Select-0' +$Name => 'RenderType' +$BasedOn => 0 + 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 +%# +%# +%# (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'}); + 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 +%# +%# +%# (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"); + + + +<%ARGS> +$id => undef +$Modify => "" + diff --git a/rt/share/html/Admin/Tools/Queries.html b/rt/share/html/Admin/Tools/Queries.html new file mode 100644 index 000000000..2fe2d5ac1 --- /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 +%# +%# +%# (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.')); +} + +<& /Admin/Elements/Header, Title => $title &> +<& /Elements/Tabs &> + + +<&|/Widgets/TitleBox, title => loc('SQL Queries') &> +% my $history = $RT::Handle->QueryHistory; +% if (!RT->Config->Get('StatementLog')) { +

<&|/l&>You must set StatementLog to true to enable this query history page.

+% } elsif (!$history) { +

<&|/l&>This server process has recorded no SQL queries.

+% } else { + + +
    +% my $r = 0; +% for my $request (@$history) { +% ++$r; + +% my ($seconds, $count) = (0, 0); +% for my $statement (@{ $request->{Queries} }) { +% $seconds += $statement->[3]; +% $count++; +% } + +
  1. + <% $request->{Path} %> - <&|/l, sprintf('%.4f', $seconds) &>[_1]s + <&|/l, $count &>Toggle [quant,_1,query,queries] + + + + + + + + + +% 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; + + + + + +% } + + +
  2. +% } +
+% } + 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 +%# +%# +%# (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 &> + + + +
+ + +
+

Customize the RT theme

+
    +
  1. + + +
  2. +
  3. +
    <&|/l&>Select a color for the section:
    +% if ($colors) { +
    +% for (@$colors) { +% my $fg = $_->{l} >= $text_threshold ? 'black' : 'white'; + +% } +
    +% } +
    +
  4. +
+
+
+ +
+

Custom CSS (Advanced)

+ +
+
+ + + + +
+
+ +<%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']], +); + + +<%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; +} + +<%ARGS> +$user_css => '' + -- cgit v1.2.1