Difference between revisions of "ShowDashboardTabs"

From Request Tracker Wiki
Jump to navigation Jump to search
(Content needed to add dashboards to PersonalQuickbar)
 
(Edited to look better)
Line 5: Line 5:
I modified the rt3/local/html/Elements/PersonalQuickbar file to add this:
I modified the rt3/local/html/Elements/PersonalQuickbar file to add this:


%my @dashboards = $m->comp("/Dashboards/Elements/ListOfDashboards");
<& /Dashboards/Elements/ShowDashboardTabs:table,
    Dashboards => \@dashboards,
    Verbose => 0,
&>


Added the rt3/local/html/Dashboards/Elements/ShowDashboardTabs file with this content:


<&| /Widgets/TitleBox, title => $Title &>
<& SELF:table, %ARGS &>
</&>
<%ARGS>
$Title  => undef
</%ARGS>


<%METHOD table>
%my @dashboards = $m->comp("/Dashboards/Elements/ListOfDashboards");
<%ARGS>
$Dashboards => undef
<& /Dashboards/Elements/ShowDashboardTabs:table,
$Verbose => 1
</%ARGS>
    Dashboards => \@dashboards,
<%INIT>
# map each subscription to a dashboard ID
    Verbose => 0,
my %subscription_for;
&>
 
 
 
Added the rt3/local/html/Dashboards/Elements/ShowDashboardTabs file with this content:


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 {
% if ($Verbose) {
% }


%  my $i = 0;
<&| /Widgets/TitleBox, title => $Title &>
%  for my $dashboard (@$Dashboards) {
%      my $url = sprintf '%s/Dashboards/%d/%s',
<& SELF:table, %ARGS &>
%                RT->Config->Get('WebPath'),
%                $dashboard->Id,
</&>
%                $dashboard->Name;
% if ($Verbose) {
<%ARGS>
                <a href="<% $url %>">
                    <% $dashboard->Id %>
$Title  => undef
                </a>
% }
</%ARGS>
                <a href="<% $url %>">
                    <% $dashboard->Name %>
<%METHOD table>
                </a>
                &#183;
<%ARGS>
%  }
% }
$Dashboards => undef
</%METHOD>
$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 {
% if ($Verbose) {
% }               
%  my $i = 0;
%  for my $dashboard (@$Dashboards) {
%      my $url = sprintf '%s/Dashboards/%d/%s',
%                RT->Config->Get('WebPath'),
%                $dashboard->Id,
%                $dashboard->Name;
% if ($Verbose) {
                <a href="<% $url %>">
                    <% $dashboard->Id %>                
                </a>
% }
                <a href="<% $url %>">
                    <% $dashboard->Name %>
                </a>
&#183;
%  }
% }
</%METHOD>

Revision as of 17:27, 25 January 2011

Wanted an easy way to get back to my Dashboards from any page so I set out to add the dashboards separated by a dot along the top (to the left of the existing content of the PersonalQuickbar.

Needed to add one file and modify another.

I modified the rt3/local/html/Elements/PersonalQuickbar file to add this:



%my @dashboards = $m->comp("/Dashboards/Elements/ListOfDashboards");

<& /Dashboards/Elements/ShowDashboardTabs:table,

    Dashboards => \@dashboards,

    Verbose => 0,

&>


Added the rt3/local/html/Dashboards/Elements/ShowDashboardTabs file with this content:


<&| /Widgets/TitleBox, title => $Title &>

<& SELF:table, %ARGS &>



<%ARGS>

$Title   => undef



<%METHOD table>

<%ARGS>

$Dashboards => undef

$Verbose => 1



<%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;       

} 



% if (@$Dashboards == 0) {

%   if ($Verbose) {

<% loc("No dashboards.") %>

%   }

% } else {

% if ($Verbose) {

% }                 

%   my $i = 0;

%   for my $dashboard (@$Dashboards) {

%       my $url = sprintf '%s/Dashboards/%d/%s',

%                 RT->Config->Get('WebPath'),

%                 $dashboard->Id,

%                 $dashboard->Name;

% if ($Verbose) {

                

                    <% $dashboard->Id %>                 

                

% }

                

                    <% $dashboard->Name %>

                

·

%   }

% }