rt 4.0.23
[freeside.git] / rt / share / html / Dashboards / Elements / ListOfDashboards
index 55d632e..d6f5bcc 100644 (file)
@@ -2,7 +2,7 @@
 %#
 %# COPYRIGHT:
 %#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC
 %#                                          <sales@bestpractical.com>
 %#
 %# (Except where explicitly superseded by other copyright notices)
 # 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>