summaryrefslogtreecommitdiff
path: root/rt/share/html/Dashboards
diff options
context:
space:
mode:
authorivan <ivan>2009-12-31 13:16:41 +0000
committerivan <ivan>2009-12-31 13:16:41 +0000
commitb4b0c7e72d7eaee2fbfc7022022c9698323203dd (patch)
treeba4cd21399e412c32fe3737eaa8478e3271509f9 /rt/share/html/Dashboards
parent2dfda73eeb3eae2d4f894099754794ef07d060dd (diff)
import rt 3.8.7
Diffstat (limited to 'rt/share/html/Dashboards')
-rw-r--r--rt/share/html/Dashboards/Elements/DashboardsForObject81
-rw-r--r--rt/share/html/Dashboards/Elements/DashboardsForObjects81
-rw-r--r--rt/share/html/Dashboards/Elements/Deleted62
-rw-r--r--rt/share/html/Dashboards/Elements/HiddenSearches79
-rw-r--r--rt/share/html/Dashboards/Elements/ListOfDashboards19
-rw-r--r--rt/share/html/Dashboards/Elements/SelectPrivacy64
-rw-r--r--rt/share/html/Dashboards/Elements/ShowDashboards112
-rw-r--r--rt/share/html/Dashboards/Elements/ShowPortlet/component54
-rw-r--r--rt/share/html/Dashboards/Elements/ShowPortlet/dashboard89
-rw-r--r--rt/share/html/Dashboards/Elements/ShowPortlet/search63
-rw-r--r--rt/share/html/Dashboards/Elements/ShowSubscription75
-rwxr-xr-xrt/share/html/Dashboards/Elements/Tabs113
-rwxr-xr-xrt/share/html/Dashboards/Modify.html168
-rw-r--r--rt/share/html/Dashboards/Queries.html280
-rw-r--r--rt/share/html/Dashboards/Render.html143
-rw-r--r--rt/share/html/Dashboards/Subscription.html292
-rw-r--r--rt/share/html/Dashboards/dhandler56
-rw-r--r--rt/share/html/Dashboards/index.html107
18 files changed, 1938 insertions, 0 deletions
diff --git a/rt/share/html/Dashboards/Elements/DashboardsForObject b/rt/share/html/Dashboards/Elements/DashboardsForObject
new file mode 100644
index 0000000..3e5d1e2
--- /dev/null
+++ b/rt/share/html/Dashboards/Elements/DashboardsForObject
@@ -0,0 +1,81 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
+%# <jesse@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>
+$Object => undef
+</%args>
+<%init>
+# Returns a hash of dashboards associated on $Object
+
+use RT::Dashboard;
+my %dashboards;
+my $privacy = RT::Dashboard->_build_privacy($Object);
+
+while (my $attr = $Object->Attributes->Next) {
+ if ($attr->Name =~ /^Dashboard\b/) {
+ my $dashboard = RT::Dashboard->new($session{'CurrentUser'});
+ my ($ok, $msg) = $dashboard->Load($privacy, $attr->id);
+
+ if (!$ok) {
+ $RT::Logger->debug("Unable to load dashboard $ok (privacy $privacy): $msg");
+ next;
+ }
+
+ if ($Object->isa('RT::System')) {
+ push @{ $dashboards{system} }, $dashboard;
+ }
+ elsif ($Object->isa('RT::User')) {
+ push @{ $dashboards{personal} }, $dashboard;
+ }
+ elsif ($Object->isa('RT::Group')) {
+ push @{ $dashboards{group}{$Object->Name} }, $dashboard;
+ }
+ }
+}
+return \%dashboards;
+</%init>
+
diff --git a/rt/share/html/Dashboards/Elements/DashboardsForObjects b/rt/share/html/Dashboards/Elements/DashboardsForObjects
new file mode 100644
index 0000000..b4fdcf7
--- /dev/null
+++ b/rt/share/html/Dashboards/Elements/DashboardsForObjects
@@ -0,0 +1,81 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
+%# <jesse@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
new file mode 100644
index 0000000..62d0b8d
--- /dev/null
+++ b/rt/share/html/Dashboards/Elements/Deleted
@@ -0,0 +1,62 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
+%# <jesse@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>
+@searches
+</%args>
+% if (@searches) {
+<&| /Widgets/TitleBox, title => loc('Deleted queries') &>
+<p><% loc("The following queries have been deleted and each will be removed from the dashboard once its pane is updated.") %></p>
+
+<ul>
+% for (@searches) {
+ <li><% loc('[_1] (from pane [_2])', ($_->{description} || $_->{name}), $_->{pane}) %></li>
+% }
+</ul>
+</&>
+% }
+
diff --git a/rt/share/html/Dashboards/Elements/HiddenSearches b/rt/share/html/Dashboards/Elements/HiddenSearches
new file mode 100644
index 0000000..aa3a67e
--- /dev/null
+++ b/rt/share/html/Dashboards/Elements/HiddenSearches
@@ -0,0 +1,79 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
+%# <jesse@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>
+@searches
+$Dashboard
+</%args>
+<%init>
+return if @searches == 0;
+
+my @display;
+
+for my $search (@searches) {
+ if ($search->Name eq 'SavedSearch') {
+ push @display, $search->Description;
+ }
+ elsif ($search->Name =~ m/^Search - (.*)/) {
+ push @display, $1;
+ }
+ else {
+ push @display, $search->Name;
+ }
+}
+
+</%init>
+<&| /Widgets/TitleBox, title => loc('Possible hidden searches') &>
+<p><% loc("The following queries may not be visible to all users who can see this dashboard.") %></p>
+
+<ul>
+% for (@display) {
+ <li><% $_ %></li>
+% }
+</ul>
+</&>
+
diff --git a/rt/share/html/Dashboards/Elements/ListOfDashboards b/rt/share/html/Dashboards/Elements/ListOfDashboards
new file mode 100644
index 0000000..b2cbd3e
--- /dev/null
+++ b/rt/share/html/Dashboards/Elements/ListOfDashboards
@@ -0,0 +1,19 @@
+<%init>
+# 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 @dashboards = (
+ (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} || {} },
+);
+
+$m->callback(%ARGS, dashboards => \@dashboards, CallbackName => 'ModifyDashboards');
+
+return @dashboards;
+</%init>
diff --git a/rt/share/html/Dashboards/Elements/SelectPrivacy b/rt/share/html/Dashboards/Elements/SelectPrivacy
new file mode 100644
index 0000000..ff2c27f
--- /dev/null
+++ b/rt/share/html/Dashboards/Elements/SelectPrivacy
@@ -0,0 +1,64 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
+%# <jesse@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
+$Name => undef
+$Default => undef
+</%args>
+<select name="<%$Name%>">
+% foreach my $object (@Objects) {
+% my $privacy = ref($object) . '-' . $object->id;
+% my $selected = $privacy eq ($Default || '') ? 'selected="selected"' : '';
+
+% if (ref($object) eq 'RT::User' && $object->id == $session{'CurrentUser'}->Id) {
+<option <%$selected|n%> value="<%$privacy%>"><&|/l&>My dashboards</&></option>
+% } else {
+<option <%$selected|n%> value="<%$privacy%>"><&|/l, $object->Name&>[_1]'s dashboards</&></option>
+% }
+% }
+</select>
diff --git a/rt/share/html/Dashboards/Elements/ShowDashboards b/rt/share/html/Dashboards/Elements/ShowDashboards
new file mode 100644
index 0000000..d7014b9
--- /dev/null
+++ b/rt/share/html/Dashboards/Elements/ShowDashboards
@@ -0,0 +1,112 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
+%# <jesse@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 }}}
+<&| /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>
+% }
+% } 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>
+% }
+</%METHOD>
+
diff --git a/rt/share/html/Dashboards/Elements/ShowPortlet/component b/rt/share/html/Dashboards/Elements/ShowPortlet/component
new file mode 100644
index 0000000..d5e9ccd
--- /dev/null
+++ b/rt/share/html/Dashboards/Elements/ShowPortlet/component
@@ -0,0 +1,54 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
+%# <jesse@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>
+$Dashboard
+$Portlet
+$Rows => 20
+$Preview => 0
+</%args>
+% $m->comp($Portlet->{path});
diff --git a/rt/share/html/Dashboards/Elements/ShowPortlet/dashboard b/rt/share/html/Dashboards/Elements/ShowPortlet/dashboard
new file mode 100644
index 0000000..ccefe7c
--- /dev/null
+++ b/rt/share/html/Dashboards/Elements/ShowPortlet/dashboard
@@ -0,0 +1,89 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
+%# <jesse@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>
+$Dashboard
+$Pane
+$Portlet
+$Rows => 20
+$Preview => 0
+$Depth => 0
+</%args>
+<%init>
+my $current_dashboard;
+
+use Scalar::Util 'blessed';
+if (blessed($Portlet) && $Portlet->isa('RT::Dashboard')) {
+ $current_dashboard = $Portlet;
+}
+else {
+ $current_dashboard = RT::Dashboard->new($session{CurrentUser});
+ my ($ok, $msg) = $current_dashboard->LoadById($Portlet->{id});
+ if (!$ok) {
+ $m->out($msg);
+ return;
+ }
+}
+
+my @panes = @{ $current_dashboard->Panes->{$Pane} || [] };
+
+Abort("Possible recursive dashboard detected.") if $Depth > 8;
+</%init>
+
+<%perl>
+for my $portlet (@panes) {
+ $m->comp($portlet->{portlet_type},
+ Portlet => $portlet,
+ Rows => $Rows,
+ Preview => $Preview,
+ Dashboard => $current_dashboard,
+ Pane => $Pane,
+ Depth => $Depth + 1,
+ );
+}
+</%perl>
+
diff --git a/rt/share/html/Dashboards/Elements/ShowPortlet/search b/rt/share/html/Dashboards/Elements/ShowPortlet/search
new file mode 100644
index 0000000..eb65cb8
--- /dev/null
+++ b/rt/share/html/Dashboards/Elements/ShowPortlet/search
@@ -0,0 +1,63 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
+%# <jesse@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>
+$Dashboard
+$Portlet
+$Rows => 20
+$Preview => 0
+</%args>
+<%init>
+my @for_showsearch = $Dashboard->ShowSearchName($Portlet);
+</%init>
+
+<& /Elements/ShowSearch,
+ @for_showsearch,
+ Override => { Rows => $Rows },
+ hideable => $Preview,
+ ShowCustomize => $Preview,
+&>
diff --git a/rt/share/html/Dashboards/Elements/ShowSubscription b/rt/share/html/Dashboards/Elements/ShowSubscription
new file mode 100644
index 0000000..208e4c2
--- /dev/null
+++ b/rt/share/html/Dashboards/Elements/ShowSubscription
@@ -0,0 +1,75 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
+%# <jesse@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
new file mode 100755
index 0000000..d82b9d0
--- /dev/null
+++ b/rt/share/html/Dashboards/Elements/Tabs
@@ -0,0 +1,113 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
+%# <jesse@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>
diff --git a/rt/share/html/Dashboards/Modify.html b/rt/share/html/Dashboards/Modify.html
new file mode 100755
index 0000000..35a8046
--- /dev/null
+++ b/rt/share/html/Dashboards/Modify.html
@@ -0,0 +1,168 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
+%# <jesse@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 }}}
+<& /Elements/Header, Title => $title &>
+<& /Dashboards/Elements/Tabs,
+ current_subtab => $current_subtab,
+ Title => $title,
+ $Create ? () : (DashboardObj => $Dashboard),
+&>
+<& /Elements/ListActions, actions => \@results &>
+
+<form action="<%RT->Config->Get('WebPath')%>/Dashboards/Modify.html" method="post" enctype="multipart/form-data" name="ModifyDashboard">
+
+%unless ($Dashboard->Id) {
+<input type="hidden" class="hidden" name="id" value="new" />
+% } else {
+<input type="hidden" class="hidden" name="id" value="<%$Dashboard->Id%>" />
+% }
+<table>
+<tr><td align="right">
+<&|/l&>Name</&>:
+</td>
+<td><input name="Name" value="<%$Dashboard->Name%>" /></td>
+</tr>
+<tr><td align="right">
+<&|/l&>Privacy</&>:
+</td><td>
+<& /Dashboards/Elements/SelectPrivacy, Name => "Privacy", Objects => \@privacies, Default => $Dashboard->Privacy &>
+</td></tr>
+</table>
+% if ( $Create ) {
+<& /Elements/Submit, Name => 'Save', Label => loc('Create') &>
+% } else {
+<& /Elements/Submit, Name => 'Save', Label => loc('Save Changes') &>
+% }
+% if ($Dashboard->Id && $can_delete) {
+<& /Elements/Submit, Name => 'Delete', Label => loc('Delete') &>
+% }
+</form>
+<%INIT>
+
+my $current_subtab;
+my ($title, @results);
+my $tried_create = 0;
+
+# user went directly to Modify.html
+$Create = 1 if !$id;
+
+use RT::Dashboard;
+
+my $Dashboard = RT::Dashboard->new($session{'CurrentUser'});
+my @privacies = $Dashboard->_PrivacyObjects(($Create ? 'Create' : 'Modify') => 1);
+
+Abort(loc("Permission denied")) if @privacies == 0;
+
+if ($Create) {
+ $current_subtab = 'Dashboards/Modify.html?Create=1';
+ $title = loc("Create a new dashboard");
+}
+else {
+ if ($id eq 'new') {
+ $tried_create = 1;
+
+ my ($val, $msg) = $Dashboard->Save(
+ Name => $ARGS{'Name'},
+ Privacy => $ARGS{'Privacy'},
+ );
+
+ if (!$val) {
+ Abort(loc("Dashboard could not be created: [_1]", $msg));
+ }
+
+ push @results, $msg;
+ $id = $Dashboard->Id;
+ }
+ else {
+ my ($ok, $msg) = $Dashboard->LoadById($id);
+ $ok || Abort($msg);
+ }
+
+ if ($id) {
+ $title = loc("Modify the dashboard [_1]", $Dashboard->Name);
+ $current_subtab = 'Dashboards/Modify.html?id=' . $id;
+ }
+ # If the create failed
+ else {
+ $Create = 1;
+ $current_subtab = 'Dashboards/Modify.html?Create=1';
+ $title = loc("Create a new dashboard");
+ }
+}
+
+if (!$Create && !$tried_create && $id && $ARGS{'Save'}) {
+ my ($ok, $msg) = $Dashboard->Update(Privacy => $ARGS{'Privacy'},
+ Name => $ARGS{'Name'});
+
+ if ($ok) {
+ push @results, loc("Dashboard updated");
+ }
+ else {
+ push @results, loc("Dashboard could not be updated: [_1]", $msg);
+ }
+
+}
+
+my $can_delete = $Dashboard->CurrentUserCanDelete;
+
+if (!$Create && !$tried_create && $id && $ARGS{'Delete'}) {
+ my ($ok, $msg) = $Dashboard->Delete();
+ $ok || Abort(loc("Couldn't delete dashboard [_1]: [_2]", $id, $msg));
+
+ # put the user back into a useful place with a message
+ RT::Interface::Web::Redirect(RT->Config->Get('WebURL')."Dashboards/index.html?Deleted=$id");
+
+}
+</%INIT>
+
+<%ARGS>
+$Create => undef
+$Name => undef
+$id => '' unless defined $id
+$Delete => undef
+</%ARGS>
+
diff --git a/rt/share/html/Dashboards/Queries.html b/rt/share/html/Dashboards/Queries.html
new file mode 100644
index 0000000..1a1066b
--- /dev/null
+++ b/rt/share/html/Dashboards/Queries.html
@@ -0,0 +1,280 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
+%# <jesse@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 }}}
+<& /Elements/Header, Title => $title &>
+<& /Dashboards/Elements/Tabs,
+ current_subtab => $current_subtab,
+ Title => $title,
+ DashboardObj => $Dashboard &>
+
+<& /Widgets/SelectionBox:header, nojs => 1 &>
+
+<& /Elements/ListActions, actions => \@results &>
+
+<& Elements/Deleted, searches => \@deleted, Dashboard => $Dashboard &>
+
+<& Elements/HiddenSearches, searches => \@hidden_searches, Dashboard => $Dashboard &>
+
+<table width="100%" border="0">
+% for my $pane (@panes) {
+<tr><td valign="top" class="boxcontainer">
+<form action="Queries.html" name="Dashboard-<%$pane->{Name}%>" method="post" enctype="multipart/form-data">
+<input type="hidden" class="hidden" name="id" value="<%$Dashboard->Id%>" />
+<input type="hidden" class="hidden" name="Privacy" value="<%$Dashboard->Privacy%>" />
+
+<&| /Widgets/TitleBox, title => $pane->{DisplayName} &>
+% my ( $pane_name ) = $pane->{Name} =~ /Searches-(.+)/;
+ <& /Widgets/SelectionBox:show, self => $pane, nojs => 1, grep( {
+ $_->{pane} eq $pane_name} @deleted ) ? ( ShowUpdate => 1 ) : () &>
+</&>
+</form>
+</td></tr>
+% }
+</table>
+
+<%INIT>
+
+my $current_subtab = 'Dashboards/Queries.html?id=' . $id;
+my @results;
+
+use RT::Dashboard;
+my $Dashboard = new RT::Dashboard($session{'CurrentUser'});
+my ($ok, $msg) = $Dashboard->LoadById($id);
+$ok || Abort(loc("Couldn't load dashboard [_1]: [_2]", $id, $msg));
+my $title = loc("Modify the queries of dashboard [_1]", $Dashboard->Name);
+
+my %desc_of;
+my @items;
+my %selected;
+my %still_exists;
+
+# add portlets (homepage componenets)
+my @components = @{ RT->Config->Get('HomepageComponents') };
+
+for my $desc (@components) {
+ my $name = "component-$desc";
+ push @items, [$name, $desc];
+ $desc_of{$name} = $desc;
+ $still_exists{$name} = 1;
+}
+
+# add dashboards
+my $dashboards = $m->comp("/Dashboards/Elements/DashboardsForObjects", flatten => 1);
+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;
+
+ my $name = 'dashboard-' . $dashboard->Id . '-' . $dashboard->Privacy;
+ my $desc = "Dashboard: " . $dashboard->Name;
+ push @items, [$name, $desc];
+ $desc_of{$name} = $desc;
+ $still_exists{$name} = 1;
+}
+
+# add saved searches
+my @objs = RT::System->new($session{'CurrentUser'});
+
+push @objs, RT::SavedSearches->new( $session{CurrentUser} )->_PrivacyObjects
+ if $session{'CurrentUser'}->HasRight( Right => 'LoadSavedSearch',
+ Object => $RT::System );
+
+for my $object (@objs) {
+ for ($m->comp("/Search/Elements/SearchesForObject", Object => $object)) {
+ my ($desc, $search) = @$_;
+ my $SearchType = $search->Content->{'SearchType'} || 'Ticket';
+ my $type = ($SearchType eq 'Ticket') ? 'Saved Search' : $SearchType; # loc
+ $desc = "$type: $desc";
+ my $privacy = $Dashboard->_build_privacy($object);
+ my $name = 'search-' . $search->Id . '-' . $privacy;
+ push @items, [$name, $desc];
+ $desc_of{$name} = $desc;
+ $still_exists{$name} = 1;
+ }
+}
+
+# Get the list of queries already in use
+my @deleted;
+do {
+ my $panes = $Dashboard->Panes;
+ for my $pane (keys %$panes) {
+ for my $portlet (@{ $panes->{$pane} }) {
+ my $name;
+ my $type = $portlet->{portlet_type};
+
+ if ($type eq 'search' || $type eq 'dashboard') {
+ $name = join '-', $type, $portlet->{id}, $portlet->{privacy};
+ }
+ elsif ($type eq 'component') {
+ $name = join '-', 'component', $portlet->{component};
+ }
+
+ if (!$still_exists{$name}) {
+ push @deleted, {
+ pane => $pane,
+ name => $name,
+ description => $portlet->{description},
+ };
+ next;
+ }
+
+ push @{ $selected{$pane} }, $name;
+ $desc_of{$name} = $portlet->{description};
+ }
+ }
+};
+
+$m->callback(
+ CallbackName => 'PopulatePossibilities',
+ Dashboard => $Dashboard,
+ items => \@items,
+ desc_of => \%desc_of,
+ still_exists => \%still_exists,
+ selected => \%selected,
+);
+
+# Create selectionbox widgets for those queries
+
+my %pane_name = (
+ 'body' => loc('Body'),
+ 'sidebar' => loc('Sidebar'),
+);
+
+$m->callback(
+ CallbackName => 'Panes',
+ Dashboard => $Dashboard,
+ panes => \%pane_name,
+);
+
+my @panes;
+for my $pane (keys %pane_name) {
+ my $sel = $m->comp(
+ '/Widgets/SelectionBox:new',
+ Action => 'Queries.html',
+ Name => "Searches-$pane",
+ DisplayName => $pane_name{$pane},
+ Available => \@items,
+ Selected => $selected{$pane},
+ AutoSave => 1,
+ OnSubmit => sub {
+ my $self = shift;
+
+ $m->callback(
+ CallbackName => 'Submit',
+ Dashboard => $Dashboard,
+ Selected => $self->{Current},
+ pane => $pane,
+ );
+
+ my @portlets;
+ for (@{ $self->{Current} }) {
+ my $item = $_;
+ my $desc = $desc_of{$item};
+ my $portlet_type = $1 if $item =~ s/^(\w+)-//;
+
+ if ($portlet_type eq 'search' || $portlet_type eq 'dashboard') {
+ my ($id, $privacy) = split '-', $item, 2;
+ push @portlets, {
+ portlet_type => $portlet_type,
+ privacy => $privacy,
+ id => $id,
+ description => $desc,
+ pane => $pane,
+ };
+ }
+ elsif ($portlet_type eq 'component') {
+ # Absolute paths stay absolute, relative paths go into
+ # /Elements. This way, extensions that add portlets work.
+ my $path = $item;
+ $path = "/Elements/$path" if substr($path, 0, 1) ne '/';
+
+ push @portlets, {
+ portlet_type => $portlet_type,
+ component => $item,
+ path => $path,
+ description => $item,
+ pane => $pane,
+ };
+ }
+ }
+
+ # we want to keep all the other panes the same
+ my $panes = $Dashboard->Panes;
+ $panes->{$pane} = \@portlets;
+
+ # remove "deleted" warnings about this pane
+ @deleted = grep { $_->{pane} ne $pane } @deleted;
+
+ $m->callback(
+ CallbackName => 'BeforeUpdate',
+ Dashboard => $Dashboard,
+ panes => $panes,
+ );
+
+ my ($ok, $msg) = $Dashboard->Update(Panes => $panes);
+
+ if ($ok) {
+ push @results, loc("Dashboard updated");
+ }
+ else {
+ push @results, loc("Dashboard could not be updated: [_1]", $msg);
+ }
+ },
+ );
+
+ push @panes, $sel;
+}
+
+$m->comp('/Widgets/SelectionBox:process', %ARGS, self => $_, nojs => 1)
+ for @panes;
+
+my @hidden_searches = $Dashboard->PossibleHiddenSearches;
+</%INIT>
+<%ARGS>
+$id => '' unless defined $id
+</%ARGS>
+
diff --git a/rt/share/html/Dashboards/Render.html b/rt/share/html/Dashboards/Render.html
new file mode 100644
index 0000000..1893b53
--- /dev/null
+++ b/rt/share/html/Dashboards/Render.html
@@ -0,0 +1,143 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
+%# <jesse@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 }}}
+<& /Elements/Header,
+ Title => $title,
+ JavaScript => $Preview,
+ ShowBar => $Preview,
+ Refresh => $Refresh,
+&>
+
+% if ($Preview) {
+<& /Dashboards/Elements/Tabs,
+ current_subtab => $current_subtab,
+ Title => $title,
+ DashboardObj => $DashboardObj &>
+% }
+
+% $m->callback(CallbackName => 'BeforeTable', Dashboard => $DashboardObj, show_cb => $show_cb);
+
+<table class="dashboard">
+<!-- Dashboard #<%$id%> -->
+
+% $m->callback(CallbackName => 'BeforePanes', Dashboard => $DashboardObj, show_cb => $show_cb);
+
+<tr valign="top">
+
+<td class="boxcontainer">
+% $show_cb->('body');
+</td>
+
+<td class="boxcontainer">
+% $show_cb->('sidebar');
+</td>
+
+</tr>
+
+% $m->callback(CallbackName => 'AfterPanes', Dashboard => $DashboardObj, show_cb => $show_cb);
+
+</table>
+
+% $m->callback(CallbackName => 'AfterTable', Dashboard => $DashboardObj, show_cb => $show_cb);
+
+</td>
+
+
+</tr>
+</table>
+
+<%INIT>
+
+my $current_subtab = 'Dashboards/Render.html?id=' . $id;
+
+use RT::Dashboard;
+my $DashboardObj = RT::Dashboard->new($session{'CurrentUser'});
+my ($ok, $msg) = $DashboardObj->LoadById($id);
+Abort(loc("Couldn't load dashboard [_1]: [_2]", $id, $msg)) if !$ok;
+
+my $SubscriptionObj = RT::Attribute->new($session{'CurrentUser'});
+my $rows;
+
+# try to load the subscription to this id to get a better idea of number of rows
+for my $sub ($session{'CurrentUser'}->UserObj->Attributes->Named('Subscription')) {
+ next unless $sub->SubValue('DashboardId') == $id;
+ $SubscriptionObj = $sub;
+ $rows = $SubscriptionObj->SubValue('Rows');
+ last;
+}
+
+# otherwise honor their search preferences.. otherwise 20 rows
+if (!$rows) {
+ my $prefs = $session{'CurrentUser'}->UserObj->Preferences("SearchDisplay") || {};
+ $rows = defined($prefs->{'RowsPerPage'}) ? $prefs->{'RowsPerPage'} : 20;
+}
+
+my $title = loc 'Dashboard [_1]', $DashboardObj->Name;
+
+my $show_cb = sub {
+ my $pane = shift;
+ $m->comp('Elements/ShowPortlet/dashboard',
+ Portlet => $DashboardObj,
+ Rows => $rows,
+ Preview => $Preview,
+ Dashboard => $DashboardObj,
+ Pane => $pane,
+ Depth => 0,
+ );
+};
+
+my $Refresh = $Preview
+ ? $session{'home_refresh_interval'}
+ || RT->Config->Get('HomePageRefreshInterval', $session{'CurrentUser'})
+ : 0;
+
+</%INIT>
+<%ARGS>
+$id => undef
+$Preview => 1
+</%ARGS>
+
diff --git a/rt/share/html/Dashboards/Subscription.html b/rt/share/html/Dashboards/Subscription.html
new file mode 100644
index 0000000..3de58ac
--- /dev/null
+++ b/rt/share/html/Dashboards/Subscription.html
@@ -0,0 +1,292 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
+%# <jesse@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 }}}
+<& /Elements/Header, Title => $title &>
+<& /Dashboards/Elements/Tabs,
+ current_subtab => $current_subtab,
+ Title => $title,
+ DashboardObj => $DashboardObj &>
+
+<& /Elements/ListActions, actions => \@results &>
+
+<form action="<%RT->Config->Get('WebPath')%>/Dashboards/Subscription.html" method="post" enctype="multipart/form-data" name="SubscribeDashboard">
+<input type="hidden" class="hidden" name="DashboardId" value="<% $fields{'DashboardId'} %>" />
+<table width="100%" border="0">
+<tr>
+
+<td valign="top" class="boxcontainer">
+<&| /Widgets/TitleBox, title => loc('Dashboard') &>
+
+<table>
+<tr><td class="label">
+<&|/l&>Dashboard</&>:
+</td><td class="value">
+<% $DashboardObj->Name %>
+</td></tr>
+
+<tr><td class="label">
+<&|/l&>Queries</&>:
+</td><td class="value">
+% my @portlets = grep { defined } $DashboardObj->Portlets;
+% if (!@portlets) {
+(<&|/l&>none</&>)
+% } else {
+<ol class="dashboard-queries">
+% for my $portlet (@portlets) {
+ <li class="dashboard-query">
+ <% loc($portlet->{description}, $fields{'Rows'}) %>
+ </li>
+% }
+</ol>
+% }
+</td></tr>
+
+</table>
+</&>
+
+<&| /Widgets/TitleBox, title => loc('Subscription') &>
+
+<table>
+<tr><td class="label">
+<&|/l&>Frequency</&>:
+</td><td class="value">
+
+<input type="radio" name="Frequency" value="daily" <% $fields{'Frequency'} eq 'daily' ? 'checked="checked"' : "" %>>
+ <&|/l&>daily</&>
+</input><br />
+
+<input type="radio" name="Frequency" value="m-f" <% $fields{'Frequency'} eq 'm-f' ? 'checked="checked"' : "" %>>
+ <&|/l&>Monday through Friday</&>
+</input><br />
+
+<input type="radio" name="Frequency" value="weekly"<% $fields{'Frequency'} eq 'weekly' ? 'checked="checked"' : "" %>>
+<&|/l&>weekly</&></input>, <&|/l&>on</&>
+<select name="Dow">
+ <option value="Monday" <% $fields{'Dow'} eq 'Monday' ? 'selected="selected"' : '' %>><&|/l&>Monday</&></option>
+ <option value="Tuesday" <% $fields{'Dow'} eq 'Tuesday' ? 'selected="selected"' : '' %>><&|/l&>Tuesday</&></option>
+ <option value="Wednesday" <% $fields{'Dow'} eq 'Wednesday' ? 'selected="selected"' : '' %>><&|/l&>Wednesday</&></option>
+ <option value="Thursday" <% $fields{'Dow'} eq 'Thursday' ? 'selected="selected"' : '' %>><&|/l&>Thursday</&></option>
+ <option value="Friday" <% $fields{'Dow'} eq 'Friday' ? 'selected="selected"' : '' %>><&|/l&>Friday</&></option>
+ <option value="Saturday" <% $fields{'Dow'} eq 'Saturday' ? 'selected="selected"' : '' %>><&|/l&>Saturday</&></option>
+ <option value="Sunday" <% $fields{'Dow'} eq 'Sunday' ? 'selected="selected"' : '' %>><&|/l&>Sunday</&></option>
+</select>
+<&|/l&>every</&>
+<select name="Fow">
+% for my $f ( qw/1 2 3 4/ ) {
+ <option value="<%$f%>" <% $fields{'Fow'} == $f ? 'selected="selected"' : '' %>><% $f %></option>
+% }
+</select>
+<&|/l&>weeks</&>
+<br />
+
+<input type="radio" name="Frequency" value="monthly"<% $fields{'Frequency'} eq 'monthly' ? 'checked="checked"' : "" %>>
+<&|/l&>monthly</&></input> , <&|/l&>on day</&>
+<select name="Dom">
+% for my $dom (1..31) {
+ <option value="<% $dom %>" <% $fields{'Dom'} == $dom ? 'selected="selected"' : '' %>><% loc($dom) %></option>
+% }
+</select>
+<br />
+
+<input type="radio" name="Frequency" value="never" <% $fields{'Frequency'} eq 'never' ? 'checked="checked"' : "" %>>
+ <&|/l&>never</&>
+</input>
+
+</td></tr>
+<tr><td class="label">
+<&|/l&>Hour</&>:
+</td><td class="value">
+<select name="Hour">
+% for my $hour (0..23) {
+% my $formatted = sprintf '%02d:00', $hour;
+% my $selected = $formatted eq $fields{'Hour'}
+% ? 'selected="selected"'
+% : '';
+
+ <option value="<% $formatted %>" <%$selected%>><% $formatted %></option>
+% }
+</select>
+(<%$timezone%>)
+</td></tr>
+<tr><td class="label">
+<&|/l&>Rows</&>:
+</td><td class="value">
+<select name="Rows">
+% for my $rows (1, 2, 5, 10, 15, 20, 25, 50, 75, 100, 0) {
+ <option value="<% $rows %>" <% $fields{'Rows'} eq $rows ? 'selected="selected"' : '' %>><% loc($rows || 'Unlimited') %></option>
+% }
+</select>
+</td></tr>
+
+<tr><td class="label">
+<&|/l&>Recipient</&>:
+</td><td class="value">
+<input name="Recipient" id="Recipient" size="30" value="<%$fields{Recipient} ? $fields{Recipient} : ''%>" />
+<div class="hints"><% loc("Leave blank to send to your current email address ([_1])", $session{'CurrentUser'}->UserObj->EmailAddress) %></div>
+</td></tr>
+</table>
+</&>
+</td>
+</tr>
+</table>
+
+% if ($SubscriptionObj->Id) {
+ <& /Elements/Submit, Name => "Save", Label => loc('Save Changes') &>
+% } else {
+ <& /Elements/Submit, Name => "Save", Label => loc('Subscribe') &>
+% }
+</form>
+
+<%INIT>
+
+my $current_subtab = 'Dashboards/Subscription.html?DashboardId=' . $DashboardId;
+
+my ($title, @results);
+my ($val, $msg);
+my $Loaded = 0;
+my $timezone = $session{'CurrentUser'}->UserObj->Timezone || RT->Config->Get('Timezone');
+
+use RT::Dashboard;
+my $DashboardObj = RT::Dashboard->new($session{'CurrentUser'});
+
+my $SubscriptionObj = RT::Attribute->new($session{'CurrentUser'});
+
+# first let's see if we already have a subscription to this DashboardId
+for my $sub ($session{'CurrentUser'}->UserObj->Attributes->Named('Subscription')) {
+ next unless $sub->SubValue('DashboardId') == $DashboardId;
+ $SubscriptionObj = $sub;
+ last;
+}
+
+$DashboardId = $SubscriptionObj->Id
+ ? $SubscriptionObj->SubValue('DashboardId')
+ : $ARGS{'DashboardId'};
+
+($val, $msg) = $DashboardObj->LoadById($DashboardId);
+$val || Abort(loc("Couldn't load dashboard [_1]: [_2].", $DashboardId, $msg));
+
+my %fields = (
+ DashboardId => $DashboardId,
+ Frequency => 'daily',
+ Hour => '06:00',
+ Dow => 'Monday',
+ Dom => 1,
+ Rows => 20,
+ Recipient => '',
+ Fow => 1,
+ Counter => 0,
+);
+
+# update any fields with the values from the subscription object
+if ($SubscriptionObj->Id) {
+ for my $field (keys %fields) {
+ $fields{$field} = $SubscriptionObj->SubValue($field);
+ }
+}
+
+# finally, update any fields with arguments passed in by the user
+for my $field (keys %fields) {
+ next if $field eq 'DashboardId'; # but this one is immutable
+ $fields{$field} = $ARGS{$field}
+ if defined($ARGS{$field});
+}
+# this'll be defined on submit
+if (defined $ARGS{Save}) {
+ # update
+ if ($SubscriptionObj->Id) {
+ $DashboardId = delete $fields{'DashboardId'}; # immutable
+ ($val, $msg) = $SubscriptionObj->SetSubValues(%fields);
+ $fields{'DashboardId'} = $DashboardId;
+
+ # not so good to spew base64-encoded data at the user :)
+ if ($msg =~ /^Content changed from/) {
+ $msg = "Subscription updated.";
+ }
+
+ push @results, $msg;
+ }
+ # create
+ else {
+ Abort(loc("Unable to subscribe to dashboard [_1]: Permission denied", $DashboardId))
+ unless $DashboardObj->CurrentUserCanSubscribe;
+
+ my ($val, $msg) = $SubscriptionObj->Create(
+ Name => 'Subscription',
+ Description => 'Subscription to dashboard ' . $DashboardId,
+ ContentType => 'storable',
+ Object => $session{'CurrentUser'}->UserObj,
+ Content => \%fields,
+ );
+ if ($val) {
+ push @results, loc("Subscribed to dashboard [_1]", $DashboardObj->Name);
+ push @results, loc("Warning: you have no email address set, so you will not receive this dashboard until you have it set")
+ unless $session{'CurrentUser'}->EmailAddress || $fields{Recipient};
+ }
+ else {
+ push @results, loc('Subscription could not be created: [_1]', $msg);
+ }
+ }
+}
+
+if ($SubscriptionObj->Id) {
+ $title = loc("Modify the subscription to dashboard [_1]", $DashboardObj->Name);
+}
+else {
+ $title = loc("Subscribe to dashboard [_1]", $DashboardObj->Name);
+}
+
+</%INIT>
+<%ARGS>
+$DashboardId => undef
+$Frequency => undef
+$Hour => undef
+$Dow => undef
+$Dom => undef
+$Rows => undef
+$Recipient => undef
+</%ARGS>
+
diff --git a/rt/share/html/Dashboards/dhandler b/rt/share/html/Dashboards/dhandler
new file mode 100644
index 0000000..056476b
--- /dev/null
+++ b/rt/share/html/Dashboards/dhandler
@@ -0,0 +1,56 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
+%# <jesse@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 }}}
+<%INIT>
+if ($m->dhandler_arg =~ /^(\d+)/) {
+ $m->comp('/Dashboards/Render.html', id => $1, %ARGS);
+}
+else {
+ $m->decline;
+}
+</%INIT>
+
diff --git a/rt/share/html/Dashboards/index.html b/rt/share/html/Dashboards/index.html
new file mode 100644
index 0000000..8f71ab0
--- /dev/null
+++ b/rt/share/html/Dashboards/index.html
@@ -0,0 +1,107 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
+%# <jesse@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 }}}
+<& /Elements/Header, Title => $title &>
+<& /Dashboards/Elements/Tabs,
+ current_subtab => 'Dashboards/index.html',
+ Title => $title &>
+
+<& /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;
+if (defined $Deleted) {
+ push @actions, loc("Deleted dashboard [_1]", $Deleted);
+}
+
+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>
+<%ARGS>
+$Deleted => undef
+</%ARGS>
+