%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2018 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
<%init>
# put the list of dashboards into the navigation
use RT::Dashboard;
+my @objs = RT::Dashboard->new($User)->ObjectsForLoading(
+ IncludeSuperuserGroups => $IncludeSuperuserGroups
+ );
-my @objs = RT::Dashboard->new($session{CurrentUser})->_PrivacyObjects(ShowSystem => 1);
-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, User => $User );
+
+ 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>
+$User => $session{CurrentUser}
+$IncludeSuperuserGroups => 1
+</%args>