[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.9.6-345-g6c7977f

Shawn Moore sartak at bestpractical.com
Fri Dec 3 15:18:09 EST 2010


The branch, 3.9-trunk has been updated
       via  6c7977faebe6427aca6c8881f7fafbcd64a7781c (commit)
      from  dbdfca4b6dd2945988173df192fe430074187e91 (commit)

Summary of changes:
 .../html/Dashboards/Elements/DashboardsForObjects  |   79 --------------------
 share/html/Dashboards/Elements/ListOfDashboards    |   21 ++++-
 share/html/Dashboards/Queries.html                 |    4 +-
 3 files changed, 18 insertions(+), 86 deletions(-)
 delete mode 100644 share/html/Dashboards/Elements/DashboardsForObjects

- Log -----------------------------------------------------------------
commit 6c7977faebe6427aca6c8881f7fafbcd64a7781c
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Dec 3 15:14:23 2010 -0500

    DashboardsForObjects can be removed in favor of ListOfDashboards
    
        It was used more before we used CollectionAsTable for dashboards

diff --git a/share/html/Dashboards/Elements/DashboardsForObjects b/share/html/Dashboards/Elements/DashboardsForObjects
deleted file mode 100644
index 5e0aa3c..0000000
--- a/share/html/Dashboards/Elements/DashboardsForObjects
+++ /dev/null
@@ -1,79 +0,0 @@
-%# BEGIN BPS TAGGED BLOCK {{{
-%#
-%# COPYRIGHT:
-%#
-%# This software is Copyright (c) 1996-2010 Best Practical Solutions, LLC
-%#                                          <jesse at 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})->ObjectsForLoading;
-}
-
-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/share/html/Dashboards/Elements/ListOfDashboards b/share/html/Dashboards/Elements/ListOfDashboards
index 3874f7f..e4ddc0e 100644
--- a/share/html/Dashboards/Elements/ListOfDashboards
+++ b/share/html/Dashboards/Elements/ListOfDashboards
@@ -50,14 +50,25 @@
 use RT::Dashboard;
 
 my @objs = RT::Dashboard->new($session{CurrentUser})->ObjectsForLoading;
-my $dashboard_map = $m->comp("/Dashboards/Elements/DashboardsForObjects", Objects => \@objs);
+
+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');
diff --git a/share/html/Dashboards/Queries.html b/share/html/Dashboards/Queries.html
index e20d4b8..6bf1dd5 100644
--- a/share/html/Dashboards/Queries.html
+++ b/share/html/Dashboards/Queries.html
@@ -99,8 +99,8 @@ for my $desc (@components) {
 }
 
 # add dashboards
-my $dashboards = $m->comp("/Dashboards/Elements/DashboardsForObjects", flatten => 1);
-for my $dashboard (@{ $dashboards || [] }) {
+my @dashboards = $m->comp("/Dashboards/Elements/ListOfDashboards");
+for my $dashboard (@dashboards) {
     # Users *can* set up mutually recursive dashboards, but don't make it THIS
     # easy for them to shoot themselves in the foot.
     next if $dashboard->Id == $Dashboard->Id;

-----------------------------------------------------------------------


More information about the Rt-commit mailing list