[Bps-public-commit] rt-extension-jsgantt branch, master, updated. fa90a843cf2b4db4cd89fbfa410a55ca7da2ffc6

? sunnavy sunnavy at bestpractical.com
Tue Jun 29 18:03:49 EDT 2010


The branch, master has been updated
       via  fa90a843cf2b4db4cd89fbfa410a55ca7da2ffc6 (commit)
       via  0320cbafa88aa85645f8406fb0f5dcae4ff6980d (commit)
       via  26c41c975fd99ead0d8a61ebd9ea94f37efc6ddf (commit)
      from  d986a04b599bdbbfd839ffd97d14656a4c4311c4 (commit)

Summary of changes:
 META.yml                                           |    2 +
 Makefile.PL                                        |    1 +
 README                                             |    5 ++-
 .../Elements/ShowSummary/LinksExtra}               |   15 ++++++++++++-
 html/Search/JSGantt.html                           |   21 +++++++++++++++----
 showsummary.diff                                   |   12 +++++++++++
 6 files changed, 47 insertions(+), 9 deletions(-)
 copy html/Callbacks/JSGantt/{Elements/Header/Head => Ticket/Elements/ShowSummary/LinksExtra} (88%)
 create mode 100644 showsummary.diff

- Log -----------------------------------------------------------------
commit 26c41c975fd99ead0d8a61ebd9ea94f37efc6ddf
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Jun 30 05:17:41 2010 +0800

    use JSON to trans vars to js

diff --git a/META.yml b/META.yml
index 693a997..8ab1fce 100644
--- a/META.yml
+++ b/META.yml
@@ -18,6 +18,8 @@ no_index:
   directory:
     - html
     - inc
+requires:
+  JSON: 0
 resources:
   license: http://dev.perl.org/licenses/
 version: 0.03
diff --git a/Makefile.PL b/Makefile.PL
index c30181a..fd67c8b 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -5,5 +5,6 @@ author ('sunnavy <sunnavy at bestpractical.com>');
 version_from ('lib/RT/Extension/JSGantt.pm');
 abstract_from('lib/RT/Extension/JSGantt.pm');
 license('GPLv2');
+requires( 'JSON' );
 
 &WriteAll;
diff --git a/html/Search/JSGantt.html b/html/Search/JSGantt.html
index eeb5c01..b1fadb3 100644
--- a/html/Search/JSGantt.html
+++ b/html/Search/JSGantt.html
@@ -5,7 +5,6 @@
 <div style="position:relative" class="gantt" id="GanttChartDIV"></div>
 <script>
 
-
   // here's all the html code neccessary to display the chart object
 
   // Future idea would be to allow XML file name to be passed in and chart tasks built from file.
@@ -41,8 +40,6 @@
 %   my ( $min_start, $min_start_obj );
 %   while ( my $Ticket = $Tickets->Next ) {
 %   my $subject = $Ticket->Subject;
-%   $subject =~ s/\\/\\\\/g;
-%   $subject =~ s/'/\\'/g;
 %   my ( $start, $end ) = ('', '');
 %   my ( $start_obj, $end_obj );
 %   if ( $Ticket->StartsObj->Unix ) {
@@ -145,9 +142,10 @@
 %       $item->[3] ||= $min_start;
 %   }
 
+%   use JSON;
 %   for my $item ( @info ) {
-        g.AddTaskItem(new JSGantt.TaskItem( <% join ',', map { 
-           $_ =~ /^\d+$/ ? $_ : q{'} . $_ . q{'} } @$item |n%> ));
+%       my $json = to_json( $item ); $json =~ s/^\[//; $json =~ s/\]$//;
+        g.AddTaskItem(new JSGantt.TaskItem( <% $json |n%> ));
 %   }
 
     g.Draw();    

commit 0320cbafa88aa85645f8406fb0f5dcae4ff6980d
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Jun 30 05:22:42 2010 +0800

    set min_start to now if all tickets do not have start info

diff --git a/html/Search/JSGantt.html b/html/Search/JSGantt.html
index b1fadb3..ca1a117 100644
--- a/html/Search/JSGantt.html
+++ b/html/Search/JSGantt.html
@@ -135,6 +135,14 @@
 
 
 %# here let's tweak our results
+%# set to now if all tickets don't have start/end dates
+%   if ( ! $min_start ) {
+%       $min_start_obj = RT::Date->new($session{CurrentUser});
+%       $min_start_obj->SetToNow;
+%       my ($day,$month,$year) = ($min_start_obj->Localtime('user'))[3,4,5];
+%       $min_start = join '/', $month+1, $day, $year;
+%   }
+
 %   my $no_dates_color = RT->Config->Get('JSGanttNullDatesColor') || '333';
 %   for my $item ( @info ) {
 %       $item->[4] = $no_dates_color unless $item->[2];

commit fa90a843cf2b4db4cd89fbfa410a55ca7da2ffc6
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Jun 30 06:04:59 2010 +0800

    add a Gantt link in the Links widget in ticket display page

diff --git a/README b/README
index bef8827..c725914 100644
--- a/README
+++ b/README
@@ -23,5 +23,6 @@ How to install:
 
         # if we can't find both start and end dates, use this color
         Set($JSGanttNullDatesColor, '333');
-
-5. restart RT
+5. patch /Ticket/Elements/ShowSummary
+    $ patch /path/to/Ticket/Elements/ShowSummary < /path/to/showsummary.diff
+6. restart RT
diff --git a/html/Callbacks/JSGantt/Ticket/Elements/ShowSummary/LinksExtra b/html/Callbacks/JSGantt/Ticket/Elements/ShowSummary/LinksExtra
new file mode 100644
index 0000000..06e3e53
--- /dev/null
+++ b/html/Callbacks/JSGantt/Ticket/Elements/ShowSummary/LinksExtra
@@ -0,0 +1,60 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%# 
+%# COPYRIGHT:
+%# 
+%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
+%#                                          <jesse at 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>
+my %hash = @$extra;
+$hash{titleright_raw} ||= '';
+$hash{titleright_raw} .= ' <a href="'. RT->Config->Get('WebPath').
+    '/Search/JSGantt.html?Ticket='.$ARGS{Ticket}->id.'">'.loc('Gantt Chart').'</a>';
+@$extra = %hash;
+</%init>
+
+<%args>
+$extra
+</%args>
+
diff --git a/html/Search/JSGantt.html b/html/Search/JSGantt.html
index ca1a117..ca466cf 100644
--- a/html/Search/JSGantt.html
+++ b/html/Search/JSGantt.html
@@ -171,6 +171,10 @@
 <%init>
 my $title = loc('JSGantt Results');
 my $Tickets = RT::Tickets->new( $session{'CurrentUser'} );
+if ( $Ticket && ! $Query) {
+    $Query = "MemberOf = $Ticket OR HasMember = $Ticket OR DependsOn = $Ticket OR DependedOnBy = $Ticket OR RefersTo = $Ticket OR ReferredToBy = $Ticket OR id=$Ticket";
+}
+
 $Tickets->FromSQL( $Query );
 if ( $OrderBy =~ /\|/ ) {
     # Multiple Sorts
@@ -190,4 +194,5 @@ else {
 $Query => undef
 $OrderBy => 'id'
 $Order => 'ASC'
+$Ticket => undef
 </%args>
diff --git a/showsummary.diff b/showsummary.diff
new file mode 100644
index 0000000..98f22e3
--- /dev/null
+++ b/showsummary.diff
@@ -0,0 +1,12 @@
+diff --git a/share/html/Ticket/Elements/ShowSummary b/share/html/Ticket/Elements/ShowSummary
+index 21c53c5..264dcdc 100755
+--- a/share/html/Ticket/Elements/ShowSummary
++++ b/share/html/Ticket/Elements/ShowSummary
+@@ -107,6 +107,7 @@
+ 
+ % my (@extra);
+ % push @extra, titleright_raw => '<a href="'. RT->Config->Get('WebPath'). '/Ticket/Graphs/index.html?id='.$Ticket->id.'">'.loc('Graph').'</a>' unless RT->Config->Get('DisableGraphViz');
++% $m->callback( %ARGS, CallbackName => 'LinksExtra', extra => \@extra );
+     <&| /Widgets/TitleBox, title => loc('Links'),
+         title_href => RT->Config->Get('WebPath')."/Ticket/ModifyLinks.html?id=".$Ticket->Id,
+         class => 'ticket-info-links',

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list