diff options
Diffstat (limited to 'rt/share/html/Dashboards/Elements')
-rw-r--r-- | rt/share/html/Dashboards/Elements/DashboardsForObject | 81 | ||||
-rw-r--r-- | rt/share/html/Dashboards/Elements/DashboardsForObjects | 81 | ||||
-rw-r--r-- | rt/share/html/Dashboards/Elements/Deleted | 62 | ||||
-rw-r--r-- | rt/share/html/Dashboards/Elements/HiddenSearches | 79 | ||||
-rw-r--r-- | rt/share/html/Dashboards/Elements/ListOfDashboards | 19 | ||||
-rw-r--r-- | rt/share/html/Dashboards/Elements/SelectPrivacy | 64 | ||||
-rw-r--r-- | rt/share/html/Dashboards/Elements/ShowDashboards | 112 | ||||
-rw-r--r-- | rt/share/html/Dashboards/Elements/ShowPortlet/component | 54 | ||||
-rw-r--r-- | rt/share/html/Dashboards/Elements/ShowPortlet/dashboard | 89 | ||||
-rw-r--r-- | rt/share/html/Dashboards/Elements/ShowPortlet/search | 63 | ||||
-rw-r--r-- | rt/share/html/Dashboards/Elements/ShowSubscription | 75 | ||||
-rwxr-xr-x | rt/share/html/Dashboards/Elements/Tabs | 113 |
12 files changed, 892 insertions, 0 deletions
diff --git a/rt/share/html/Dashboards/Elements/DashboardsForObject b/rt/share/html/Dashboards/Elements/DashboardsForObject new file mode 100644 index 000000000..3e5d1e2f3 --- /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 000000000..b4fdcf74e --- /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 000000000..62d0b8db8 --- /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 000000000..aa3a67ebb --- /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 000000000..b2cbd3ebe --- /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 000000000..ff2c27f94 --- /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 000000000..d7014b943 --- /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 000000000..d5e9ccd22 --- /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 000000000..ccefe7c04 --- /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 000000000..eb65cb81b --- /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 000000000..208e4c2c1 --- /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 000000000..d82b9d0b6 --- /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> |