Difference between revisions of "ShowDashboardTabs"

From Request Tracker Wiki
Jump to navigation Jump to search
(Edited to look better)
m (11 revisions imported)
 
(9 intermediate revisions by 2 users not shown)
Line 4: Line 4:


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");
  %my @dashboards = $m->comp("/Dashboards/Elements/ListOfDashboards");
   
   
  <& /Dashboards/Elements/ShowDashboardTabs:table,
  <& /Dashboards/Elements/ShowDashboardTabs:tabs,
   
   
     Dashboards => \@dashboards,
     Dashboards => \@dashboards,
Line 17: Line 13:
   
   
  &>
  &>


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


  <&| /Widgets/TitleBox, title => $Title &>
  <&| /Widgets/TitleBox, title => $Title &>
  <& SELF:tabs, %ARGS &>
  <& SELF:table, %ARGS &>
  </&>
  </&>
  <%ARGS>
  <%ARGS>
  $Title  => undef
  $Title  => undef
  </%ARGS>
  </%ARGS>
   
   
  <%METHOD table>
  <%METHOD tabs>
  <%ARGS>
  <%ARGS>
  $Dashboards => undef
  $Dashboards => undef
  $Verbose => 1
  $Verbose => 1
  </%ARGS>
  </%ARGS>
  <%INIT>
  <%INIT>
  # map each subscription to a dashboard ID
  # map each subscription to a dashboard ID
  my %subscription_for;
  my %subscription_for;
   
   
  for my $attr ($session{'CurrentUser'}->UserObj->Attributes->Named('Subscription')) {
  for my $attr ($session{'CurrentUser'}->UserObj->Attributes->Named('Subscription')) {
     $subscription_for{$attr->SubValue('DashboardId')} = $attr;
     $subscription_for{$attr->SubValue('DashboardId')} = $attr;      
  }
  }  
  </%INIT>
  </%INIT>
   
   
  % if (@$Dashboards == 0) {
  % if (@$Dashboards == 0) {
  %  if ($Verbose) {
  %  if ($Verbose) {
         <% loc("No dashboards.") %>
         <p><% loc("No dashboards.") %></p>
  %  }
  %  }
  % } else {
  % } else {
  % if ($Verbose) {
  % if ($Verbose) {
  % }
  % }                
   
   
  %  my $i = 0;
  %  my $i = 0;
  %  for my $dashboard (@$Dashboards) {
  %  for my $dashboard (@$Dashboards) {
  %      my $url = sprintf '%s/Dashboards/%d/%s',
  %      my $url = sprintf '%s/Dashboards/%d/%s',
  %                RT->Config->Get('WebPath'),
  %                RT->Config->Get('WebPath'),
  %                $dashboard->Id,
  %                $dashboard->Id,
  %                $dashboard->Name;
  %                $dashboard->Name;
   
   
  % if ($Verbose) {
  % if ($Verbose) {
                 <a href="<% $url %>">
                 <a href="<% $url %>">
                     <% $dashboard->Id %>
                     <% $dashboard->Id %>                
                 </a>
                 </a>
  % }
  % }
                 <a href="<% $url %>">
                 <a href="<% $url %>">
                     <% $dashboard->Name %>
                     <% $dashboard->Name %>
                 </a>
                 </a>
   
  ·
&#183;
 
  %  }
  %  }
   
   
  % }
  % }
  </%METHOD>
  </%METHOD>
[[File:RT.jpg|thumb|left|Where the dashboards appear on the personal toolbar.]]

Latest revision as of 16:37, 6 April 2016

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:tabs,

    Dashboards => \@dashboards,

    Verbose => 0,

&>

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

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

<%ARGS>
$Title   => undef


<%METHOD tabs>
<%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 %>
                
·
 
%   }

% }

File:RT.jpg
Where the dashboards appear on the personal toolbar.