[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.9.4-509-g6c815c8
Shawn Moore
sartak at bestpractical.com
Wed Nov 17 18:21:41 EST 2010
The branch, 3.9-trunk has been updated
via 6c815c8c99345b6307471e1bae39da7eb2f23586 (commit)
from 681be64ee9051e8a46c70945f7060a7cf2575405 (commit)
Summary of changes:
share/html/Dashboards/Elements/ShowDashboards | 80 ++++++-------------------
share/html/Dashboards/index.html | 52 +---------------
share/html/Elements/Dashboards | 23 +-------
3 files changed, 22 insertions(+), 133 deletions(-)
- Log -----------------------------------------------------------------
commit 6c815c8c99345b6307471e1bae39da7eb2f23586
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Wed Nov 17 18:21:44 2010 -0500
Factor out the CollectionList stuff into ShowDashboards
diff --git a/share/html/Dashboards/Elements/ShowDashboards b/share/html/Dashboards/Elements/ShowDashboards
index 0194982..5c3ba4b 100644
--- a/share/html/Dashboards/Elements/ShowDashboards
+++ b/share/html/Dashboards/Elements/ShowDashboards
@@ -45,68 +45,24 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-<%ARGS>
-$Dashboards => undef
-$Verbose => 1
-$Title => loc("Dashboards"),
-$title_href => ""
-$bodyclass => ""
-$titleright => ""
-$titleright_href => ""
-</%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>
-<&| /Widgets/TitleBox, title => $Title,
- title_href => $title_href,
- bodyclass => $bodyclass,
- titleright => $titleright,
- titleright_href => $titleright_href
-
- &>
-
-% if (@$Dashboards == 0) {
-% if ($Verbose) {
- <p><% loc("No dashboards.") %></p>
-% }
-% } 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>
+% 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);
% }
-
- </table>
+% $title = $m->interp->apply_escapes($title, 'h');
+<& /Elements/CollectionList,
+ %ARGS,
+ Format => qq{'<a href="__WebPath__/__ShowURL__">__Name__</a>/TITLE:$title', __Subscription__},
+ Collection => $Dashboards,
+&>
% }
-</&>
+<%init>
+use RT::Dashboards;
+my @Objects = RT::Dashboard->new($session{CurrentUser})->ObjectsForLoading;
+</%init>
diff --git a/share/html/Dashboards/index.html b/share/html/Dashboards/index.html
index cb6065a..644208c 100644
--- a/share/html/Dashboards/index.html
+++ b/share/html/Dashboards/index.html
@@ -45,55 +45,7 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-<& /Elements/Header, Title => $title &>
+<& /Elements/Header, Title => loc("Dashboards") &>
<& /Elements/Tabs &>
-<& /Elements/ListActions, actions => \@actions &>
-
-<& /Dashboards/Elements/ShowDashboards,
- Title => loc('Personal Dashboards'),
- Dashboards => \@personal_dashboards,
-&>
-
-<& /Dashboards/Elements/ShowDashboards,
- Title => loc('System Dashboards'),
- Dashboards => \@system_dashboards,
-&>
-
-% for (@grouped_dashboards) {
-% my $group = $_->{name};
-% my $dashboards = $_->{dashboards};
-
- <& /Dashboards/Elements/ShowDashboards,
- Title => loc('[_1] Dashboards', $group),
- Dashboards => $dashboards,
- &>
-% }
-
-<%INIT>
-my $title = loc("Dashboards");
-use RT::Dashboard;
-
-my $dashboards = $m->comp("/Dashboards/Elements/DashboardsForObjects");
-
-my @actions;
-
-my @personal_dashboards = sort { $a->Id <=> $b->Id } @{ $dashboards->{personal} || [] };
-my @system_dashboards = sort { $a->Id <=> $b->Id } @{ $dashboards->{system} || [] };
-
-my @groups = sort keys %{ $dashboards->{group} || {} };
-my @grouped_dashboards = map {
- {
- name => $_,
- dashboards => [ sort { $a->Id <=> $b->Id } @{ $dashboards->{group}{$_} || [] } ],
- }
-} @groups;
-
-$m->callback(
- PersonalDashboards => \@personal_dashboards,
- SystemDashboards => \@system_dashboards,
- GroupedDashboards => \@grouped_dashboards,
- CallbackName => 'MassageDashboards',
-);
-</%INIT>
-
+<& /Dashboards/Elements/ShowDashboards &>
diff --git a/share/html/Elements/Dashboards b/share/html/Elements/Dashboards
index 2129df8..5e8750c 100644
--- a/share/html/Elements/Dashboards
+++ b/share/html/Elements/Dashboards
@@ -52,25 +52,6 @@
titleright_href => RT->Config->Get('WebPath').'/Dashboards/index.html',
&>
-% 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);
-% }
-% $title = $m->interp->apply_escapes($title, 'h');
-<& /Elements/CollectionList,
- %ARGS,
- Format => qq{'<a href="__WebPath__/__ShowURL__">__Name__</a>/TITLE:$title', __Subscription__},
- Collection => $Dashboards,
-&>
-% }
-</&>
-<%init>
-use RT::Dashboards;
+<& /Dashboards/Elements/ShowDashboards &>
-my @Objects = RT::Dashboard->new($session{CurrentUser})->ObjectsForLoading;
-</%init>
+</&>
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list