TimelineStartDue

From Request Tracker Wiki
Jump to navigation Jump to search

How to get the Timeline Extension to use the Start and Due Date to generate a Ticket Timeline

By default the Timeline extension (http://search.cpan.org/~htchapman/RTx-Timeline-0.03/lib/RT/Extension/Timeline.pm) creates its timeline from tickets using their Created and Resolved Dates. In order to make use of the Timeline extension as a task scheduling, project planning tool I wanted to have the timeline of tickets be based on their start and due dates. The steps to do this are first to install the Timeline Extension and then modify the Timeline and timeline.js files which will be installed in the your_rtdir/share/html/Search/Elements folder.

Install Timeline Extension

The steps to install the Timeline extension in RT 3.8.8 where relatively simple . Just install it from cpan:

$sudo perl -MCPAN -e shell
cpan[1]> install RT::Extension::Timeline
cpan[1]> install JSON::Syck

add then add it to the plugins section in your RT_SiteConfig.pm eg:

Set(@Plugins,qw(RTx::Tags),qw(RT::Authen::ExternalAuth),qw(RTx::Calendar),qw(RTx::EmailCompletion),qw(RT::Extension::Timeline));

Once you restart your webserver you should now see "Timeline" available as an option in the Actions menu for any query results page.

Modify the Files to Use Start and Due Date

First copy the /opt/rt3/share/html/Search/Elements/Timeline and /opt/rt3/share/html/Search/Elements/timeline.js files to /opt/rt3.8/local/html/Search/Elements/

The modifications to make in the Timeline file are:

$ diff /opt/rt3.8/local/html/Search/Elements/Timeline /opt/rt3/share/html/Search/Elements/Timeline
72c72
< my $time = $ticket ? $ticket->StartsObj->Unix : time();
---
> my $time = $ticket ? $ticket->CreatedObj->Unix : time();

The modifications to make in the timeline.js file are:

$ diff /opt/rt3.8/local/html/Search/Elements/timeline.js /opt/rt3/share/html/Search/Elements/timeline.js
12,27d11
<     my $TicketTitle = $ticket->id . ' - ' . $ticket->Subject;
<     my $TicketEnd;
<     # If the ticket has a due date set the TicketEnd to that otherwise use the start date
<     if ($ticket->DueObj->Unix > $ticket->StartsObj->Unix) {
< 	$TicketEnd = $ticket->Due;
<     } else {
< 	$TicketEnd = $ticket->Starts;
<     }
<     my $TicketDuration;
<     #If the ticket has a due date show the duration in the timeline otherwise just show it as a dot
<     if ($ticket->DueObj->Unix > $ticket->StartsObj->Unix) {
< 	$TicketDuration = undef;
<     } else {
< 	$TicketDuration = 'True';
<     }
<
29,32c13,16
<         start => $ticket->Starts,
< 	end => $TicketEnd,
<         title => $TicketTitle,
<         isDuration => $TicketDuration, # if on means not point icon
---
>         start => $ticket->Created,
>         ( $ticket->Resolved > $ticket->Created ? (end => $ticket->Resolved) : ()),
>         title => $ticket->id,
>         #isDuration => '1', # if on means not point icon
38c22
<         description => $ticket->TimeLeft,
---
>         description => $ticket->Subject,

Here is an example File:Timeline.png