diff options
Diffstat (limited to 'rt/share/html/Dashboards/Elements')
-rw-r--r-- | rt/share/html/Dashboards/Elements/DashboardsForObject | 2 | ||||
-rw-r--r-- | rt/share/html/Dashboards/Elements/DashboardsForObjects | 81 | ||||
-rw-r--r-- | rt/share/html/Dashboards/Elements/Deleted | 2 | ||||
-rw-r--r-- | rt/share/html/Dashboards/Elements/HiddenSearches | 2 | ||||
-rw-r--r-- | rt/share/html/Dashboards/Elements/ListOfDashboards | 30 | ||||
-rw-r--r-- | rt/share/html/Dashboards/Elements/SelectPrivacy | 2 | ||||
-rw-r--r-- | rt/share/html/Dashboards/Elements/ShowDashboards | 85 | ||||
-rw-r--r-- | rt/share/html/Dashboards/Elements/ShowPortlet/component | 2 | ||||
-rw-r--r-- | rt/share/html/Dashboards/Elements/ShowPortlet/dashboard | 2 | ||||
-rw-r--r-- | rt/share/html/Dashboards/Elements/ShowPortlet/search | 2 | ||||
-rw-r--r-- | rt/share/html/Dashboards/Elements/ShowSubscription | 75 | ||||
-rwxr-xr-x | rt/share/html/Dashboards/Elements/Tabs | 113 |
12 files changed, 52 insertions, 346 deletions
diff --git a/rt/share/html/Dashboards/Elements/DashboardsForObject b/rt/share/html/Dashboards/Elements/DashboardsForObject index 9e9e9fd60..e96afbd6a 100644 --- a/rt/share/html/Dashboards/Elements/DashboardsForObject +++ b/rt/share/html/Dashboards/Elements/DashboardsForObject @@ -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/Dashboards/Elements/DashboardsForObjects b/rt/share/html/Dashboards/Elements/DashboardsForObjects deleted file mode 100644 index c676dfb1b..000000000 --- a/rt/share/html/Dashboards/Elements/DashboardsForObjects +++ /dev/null @@ -1,81 +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 }}} -<%args> -$Objects => undef -$dashboards => {} -$flatten => 0 -</%args> -<%init> -# Returns a hash of dashboards associated with @Objects -if (!defined($Objects)) { - @$Objects = RT::Dashboard->new($session{CurrentUser})->_PrivacyObjects; -} - -for my $object (@$Objects) { - my $new_dashboards = $m->comp("/Dashboards/Elements/DashboardsForObject", Object => $object); - - push @{ $dashboards->{$_} }, @{ $new_dashboards->{$_} || [] } - for qw/personal system/; - - push @{ $dashboards->{group}{$_} }, @{ $new_dashboards->{group}{$_} } - for keys %{ $new_dashboards->{group} || {} }; -} - -if ($flatten) { - my @dashboards; - push @dashboards, @{ $dashboards->{personal} || [] }; - push @dashboards, map { @{ $_ || [] } } values %{ $dashboards->{group} }; - push @dashboards, @{ $dashboards->{system} || [] }; - - return \@dashboards; -} - -return $dashboards; -</%init> - - diff --git a/rt/share/html/Dashboards/Elements/Deleted b/rt/share/html/Dashboards/Elements/Deleted index 32fdf5515..8a54754af 100644 --- a/rt/share/html/Dashboards/Elements/Deleted +++ b/rt/share/html/Dashboards/Elements/Deleted @@ -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/Dashboards/Elements/HiddenSearches b/rt/share/html/Dashboards/Elements/HiddenSearches index a9dff69a1..4d0d9e5e2 100644 --- a/rt/share/html/Dashboards/Elements/HiddenSearches +++ b/rt/share/html/Dashboards/Elements/HiddenSearches @@ -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/Dashboards/Elements/ListOfDashboards b/rt/share/html/Dashboards/Elements/ListOfDashboards index 55d632e52..a7398bccc 100644 --- a/rt/share/html/Dashboards/Elements/ListOfDashboards +++ b/rt/share/html/Dashboards/Elements/ListOfDashboards @@ -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,18 +49,34 @@ # put the list of dashboards into the navigation use RT::Dashboard; -my @objs = RT::Dashboard->new($session{CurrentUser})->_PrivacyObjects(ShowSystem => 1); -my $dashboard_map = $m->comp("/Dashboards/Elements/DashboardsForObjects", Objects => \@objs); +my @objs = RT::Dashboard->new($session{CurrentUser})->ObjectsForLoading( + IncludeSuperuserGroups => $IncludeSuperuserGroups + ); + +my %dashboard_map; + +for my $object (@objs) { + my $new_dashboards = $m->comp("/Dashboards/Elements/DashboardsForObject", Object => $object); + + push @{ $dashboard_map{$_} }, @{ $new_dashboards->{$_} || [] } + for qw/personal system/; + + push @{ $dashboard_map{group}{$_} }, @{ $new_dashboards->{group}{$_} } + for keys %{ $new_dashboards->{group} || {} }; +} my @dashboards = ( - (sort { $a->Id <=> $b->Id } @{ $dashboard_map->{personal} || [] }), - (sort { $a->Id <=> $b->Id } @{ $dashboard_map->{system} || [] }), + (sort { $a->Id <=> $b->Id } @{ $dashboard_map{personal} || [] }), + (sort { $a->Id <=> $b->Id } @{ $dashboard_map{system} || [] }), - map { sort { $a->Id <=> $b->Id } @{ $dashboard_map->{group}{$_} } } - keys %{ $dashboard_map->{group} || {} }, + map { sort { $a->Id <=> $b->Id } @{ $dashboard_map{group}{$_} } } + keys %{ $dashboard_map{group} || {} }, ); $m->callback(%ARGS, dashboards => \@dashboards, CallbackName => 'ModifyDashboards'); return @dashboards; </%init> +<%args> +$IncludeSuperuserGroups => 1 +</%args> diff --git a/rt/share/html/Dashboards/Elements/SelectPrivacy b/rt/share/html/Dashboards/Elements/SelectPrivacy index da02300be..523790bba 100644 --- a/rt/share/html/Dashboards/Elements/SelectPrivacy +++ b/rt/share/html/Dashboards/Elements/SelectPrivacy @@ -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/Dashboards/Elements/ShowDashboards b/rt/share/html/Dashboards/Elements/ShowDashboards index 8dcc733eb..56c757bf0 100644 --- a/rt/share/html/Dashboards/Elements/ShowDashboards +++ b/rt/share/html/Dashboards/Elements/ShowDashboards @@ -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,68 +45,27 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<&| /Widgets/TitleBox, title => $Title &> -<& SELF:table, %ARGS &> -</&> -<%ARGS> -$Title => undef -</%ARGS> - -<%METHOD table> -<%ARGS> -$Dashboards => undef -$Verbose => 1 -</%ARGS> -<%INIT> -# map each subscription to a dashboard ID -my %subscription_for; - -for my $attr ($session{'CurrentUser'}->UserObj->Attributes->Named('Subscription')) { - $subscription_for{$attr->SubValue('DashboardId')} = $attr; -} -</%INIT> - -% if (@$Dashboards == 0) { -% if ($Verbose) { - <p><% loc("No dashboards.") %></p> +% foreach my $Object (@Objects) { +% my $Dashboards = RT::Dashboards->new($session{CurrentUser}); +% $Dashboards->LimitToPrivacy(join('-',ref($Object),$Object->Id)); +% my $title; +% if (ref $Object eq 'RT::User' && $Object->Id == $session{CurrentUser}->Id) { +% $title = loc("My dashboards"); +% } else { +% $title = loc("[_1]'s dashboards",$Object->Name); % } -% } else { - <table class="collection-as-table"> - <tr class="collection-as-table"> -% if ($Verbose) { - <th class="collection-as-table"><% loc("#") %></th> -% } - <th class="collection-as-table"><% loc("Name") %></th> - <th class="collection-as-table"><% loc("Subscription") %></th> - </tr> - -% my $i = 0; -% for my $dashboard (@$Dashboards) { -% my $url = sprintf '%s/Dashboards/%d/%s', -% RT->Config->Get('WebPath'), -% $dashboard->Id, -% $dashboard->Name; - - <tr class="collection-as-table <% ++$i % 2 ? 'oddline' : 'evenline' %>"> -% if ($Verbose) { - <td class="collection-as-table"> - <a href="<% $url %>"> - <% $dashboard->Id %> - </a> - </td> -% } - <td class="collection-as-table"> - <a href="<% $url %>"> - <% $dashboard->Name %> - </a> - </td> - <td class="collection-as-table"> - <& /Dashboards/Elements/ShowSubscription, Dashboard => $dashboard, Subscription => $subscription_for{$dashboard->Id} &> - </td> - </tr> -% } - - </table> +% $title = $m->interp->apply_escapes($title, 'h'); +<& /Elements/CollectionList, + %ARGS, + Format => qq{'<a href="__WebPath__/__ShowURL__">__Name__</a>/TITLE:$title', __Subscription__}, + Collection => $Dashboards, +&> % } -</%METHOD> +<%init> +use RT::Dashboards; +my @Objects = RT::Dashboard->new($session{CurrentUser})->ObjectsForLoading(IncludeSuperuserGroups => $IncludeSuperuserGroups); +</%init> +<%args> +$IncludeSuperuserGroups => 1 +</%args> diff --git a/rt/share/html/Dashboards/Elements/ShowPortlet/component b/rt/share/html/Dashboards/Elements/ShowPortlet/component index 230a15cc1..dbdfe320e 100644 --- a/rt/share/html/Dashboards/Elements/ShowPortlet/component +++ b/rt/share/html/Dashboards/Elements/ShowPortlet/component @@ -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/Dashboards/Elements/ShowPortlet/dashboard b/rt/share/html/Dashboards/Elements/ShowPortlet/dashboard index 06f9f75cd..92f2488bb 100644 --- a/rt/share/html/Dashboards/Elements/ShowPortlet/dashboard +++ b/rt/share/html/Dashboards/Elements/ShowPortlet/dashboard @@ -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/Dashboards/Elements/ShowPortlet/search b/rt/share/html/Dashboards/Elements/ShowPortlet/search index 44fba313d..ce2c24cd2 100644 --- a/rt/share/html/Dashboards/Elements/ShowPortlet/search +++ b/rt/share/html/Dashboards/Elements/ShowPortlet/search @@ -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/Dashboards/Elements/ShowSubscription b/rt/share/html/Dashboards/Elements/ShowSubscription deleted file mode 100644 index c188853e4..000000000 --- a/rt/share/html/Dashboards/Elements/ShowSubscription +++ /dev/null @@ -1,75 +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 }}} -<a href="<% $url %>"><% $frequency %></a> -<%ARGS> -$Dashboard => undef -$Subscription => undef -</%ARGS> -<%INIT> -my $url = sprintf '%s/Dashboards/Subscription.html?DashboardId=%d', - RT->Config->Get('WebPath'), - $Dashboard->Id,; - -my $frequency = loc("None"); - -if (defined $Subscription) { - my $freq = $Subscription->SubValue('Frequency'); - my $hour = $Subscription->SubValue('Hour'); - - if ($freq eq 'weekly') { - my $day = $Subscription->SubValue('Dow'); - $frequency = loc("weekly (on [_1]) at [_2]", loc($day), $hour); - } - elsif ($freq eq 'monthly') { - $frequency = loc("monthly (day [_1]) at [_2]", $Subscription->SubValue('Dom'), $hour); - } - elsif ($freq eq 'daily') { - $frequency = loc("daily at [_1]", $hour); - } -} -</%INIT> diff --git a/rt/share/html/Dashboards/Elements/Tabs b/rt/share/html/Dashboards/Elements/Tabs deleted file mode 100755 index 5e4815cad..000000000 --- a/rt/share/html/Dashboards/Elements/Tabs +++ /dev/null @@ -1,113 +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 }}} -<& /Tools/Elements/Tabs, - subtabs => $subtabs, - current_tab => 'Dashboards/index.html', - current_subtab => $current_subtab, - actions => $actions, - Title => $Title &> - -<%INIT> -my $subtabs; -my $actions; - -if ( $DashboardObj and $DashboardObj->Id ) { - my $id = $DashboardObj->Id; - my $name = $DashboardObj->Name; - - my $modify = "Dashboards/Modify.html?id=$id"; - my $queries = "Dashboards/Queries.html?id=$id"; - my $render = "Dashboards/$id/$name"; - my $subscribe = "Dashboards/Subscription.html?DashboardId=$id"; - - $subtabs = $m->comp('/Elements/DashboardTabs', CurrentDashboard => $DashboardObj); - $current_subtab = $render; - - $actions = { - a_Basics => { - title => loc('Basics'), - path => $modify, - }, - - b_Queries => { - title => loc('Queries'), - path => $queries, - }, - - c_Subscription => { - title => loc('Subscription'), - path => $subscribe, - }, - }; - - delete $actions->{"c_Subscription"} - unless $DashboardObj->CurrentUserCanSubscribe; -} -else { - $subtabs->{"a_Select"} = { - title => loc('Select'), - path => "Dashboards/index.html", - }; - - my $dashboard = RT::Dashboard->new($session{'CurrentUser'}); - my @objects = $dashboard->_PrivacyObjects(Create => 1); - - if (@objects) { - $subtabs->{"b_Create"} = { - title => loc('New'), - path => "Dashboards/Modify.html?Create=1", - separator => 1, - }; - } -} -</%INIT> -<%ARGS> -$DashboardObj => undef -$current_subtab => undef -$Title => undef -</%ARGS> |