[Bps-public-commit] rtx-calendar branch, master, updated. 1.01-10-g505d9a5

? sunnavy sunnavy at bestpractical.com
Fri Jul 17 14:48:17 EDT 2020


The branch, master has been updated
       via  505d9a5f658670faeb75b917cd1d6fae8b4ae286 (commit)
       via  96f7c653706580361e3a74824bef3cd2025a5ab0 (commit)
       via  3beda214434b14a270d363ee9a3da5e56a4a8272 (commit)
       via  5d902631b1206c603728801cc051cc723b3dd372 (commit)
       via  5fcee75efdf36d355e6f712b4458cb13e21e4c5e (commit)
       via  3e9e0e896325e3c881500a4651850fb4c272c4bb (commit)
       via  dcb5f6d209e33839d6f799b5bc3911c1610dd36c (commit)
       via  0cf0d8a90fca416f62f54a8ee3e5896bc586752d (commit)
       via  1b6354bfe0b2cfb08927aad222d0ed46a51bacf2 (commit)
       via  5905af87066e1e3c0287b76c0fab58c4f00d157a (commit)
      from  104504d2af9d69e322270449605371cfb7aedef9 (commit)

Summary of changes:
 CHANGES                                            |  5 ++
 MANIFEST                                           |  1 +
 META.yml                                           | 11 ++--
 Makefile.PL                                        |  3 +-
 README                                             | 32 +++++----
 etc/tabs_privileged_callback.patch                 | 32 +++++++++
 .../RTx-Calendar/Elements/Tabs/Privileged          | 27 +++-----
 html/Elements/CalendarEvent                        |  2 +-
 html/Search/Calendar.html                          |  6 +-
 inc/Module/Install.pm                              | 35 ++--------
 inc/Module/Install/Base.pm                         |  2 +-
 inc/Module/Install/Can.pm                          | 13 +++-
 inc/Module/Install/Fetch.pm                        |  2 +-
 inc/Module/Install/Include.pm                      |  2 +-
 inc/Module/Install/Makefile.pm                     |  2 +-
 inc/Module/Install/Metadata.pm                     |  2 +-
 inc/Module/Install/RTx.pm                          | 54 ++++++++++++---
 inc/Module/Install/RTx/Runtime.pm                  |  1 +
 inc/Module/Install/ReadmeFromPod.pm                | 76 +++++++++++++++++-----
 inc/Module/Install/Win32.pm                        |  2 +-
 inc/Module/Install/WriteAll.pm                     |  2 +-
 inc/YAML/Tiny.pm                                   | 14 ++--
 lib/RTx/Calendar.pm                                | 33 ++++++----
 static/css/calendar.css                            | 11 ++--
 24 files changed, 244 insertions(+), 126 deletions(-)
 create mode 100644 etc/tabs_privileged_callback.patch

- Log -----------------------------------------------------------------
commit 5905af87066e1e3c0287b76c0fab58c4f00d157a
Author: Aaron Trevena <aaron at aarontrevena.co.uk>
Date:   Wed Jul 8 13:10:07 2020 +0100

    Update CSS styling of calendar days for RT 5
    
    Bootstrap styling hides tooltip class used for days' content, this updates the
    class used for days contents to so that it's displayed correctly in RT 4.x and 5.x

diff --git a/html/Elements/CalendarEvent b/html/Elements/CalendarEvent
index 18bd306..5b8a6c5 100644
--- a/html/Elements/CalendarEvent
+++ b/html/Elements/CalendarEvent
@@ -3,7 +3,7 @@ $Date => undef
 $Object => undef
 $DateTypes => undef
 </%args>
-<div class="tooltip">
+<div class="day">
 <small>
 
 % if ($IsReminder and RTx::Calendar::LocalDate($Object->DueObj->Unix) eq $today) {
diff --git a/static/css/calendar.css b/static/css/calendar.css
index aee3989..4adfc4a 100644
--- a/static/css/calendar.css
+++ b/static/css/calendar.css
@@ -1,17 +1,20 @@
 /* Tooltips */
-table.rtxcalendar .tooltip {
+table.rtxcalendar .day {
     position: relative;
     z-index: 1;
 }
-table.rtxcalendar .tooltip:hover {
+
+
+
+table.rtxcalendar .day:hover {
     z-index: 5;
     color:#000;
 }
-table.rtxcalendar .tooltip span.tip {
+table.rtxcalendar .day span.tip {
     display: none;
     text-align: left;
 }
-table.rtxcalendar div.tooltip:hover span.tip{
+table.rtxcalendar div.day:hover span.tip{
     display: block;
     position: absolute;
     top:12px; left:24px; width:350px;

commit 1b6354bfe0b2cfb08927aad222d0ed46a51bacf2
Author: Aaron Trevena <aaron at aarontrevena.co.uk>
Date:   Wed Jul 8 13:08:35 2020 +0100

    Clarify documentation on what the calendar displays and how

diff --git a/README b/README
index 74c1f4b..da6ee10 100644
--- a/README
+++ b/README
@@ -4,9 +4,15 @@ NAME
 DESCRIPTION
     This RT extension provides a calendar view for your tickets and your
     reminders so you see when is your next due ticket. You can find it in
-    the menu Search->Calendar.
+    ticket search sub navigation menu.
 
-    There's a portlet to put on your home page (see Prefs/MyRT.html)
+    Date fields in the search results are displayed/used in the calendar,
+    for example if you have a ticket with a due date, it won't be displayed
+    on that date unless the Due field is included in the search result
+    format.
+
+    There's a portlet to put on your home page (see Prefs/MyRT.html), see
+    the CONFIGURATION section below for details on adding it.
 
 INSTALLATION
     perl Makefile.PL
@@ -50,7 +56,7 @@ CONFIGURATION
         Set(@CalendarPopupFields, ('Status', 'OwnerObj->Name', 'DueObj->ISO'));
 
 USAGE
-    A small help section is available in /Prefs/Calendar.html
+    A small help section is available in /Search/Calendar.html
 
 AUTHOR
     Best Practical Solutions, LLC <modules at bestpractical.com>
diff --git a/lib/RTx/Calendar.pm b/lib/RTx/Calendar.pm
index 4f2c478..1269e9d 100644
--- a/lib/RTx/Calendar.pm
+++ b/lib/RTx/Calendar.pm
@@ -4,7 +4,7 @@ use strict;
 use DateTime;
 use DateTime::Set;
 
-our $VERSION = "1.01";
+our $VERSION = "1.02";
 
 RT->AddStyleSheets('calendar.css');
 
@@ -115,9 +115,14 @@ RTx::Calendar - Calendar for RT due dates
 
 This RT extension provides a calendar view for your tickets and your
 reminders so you see when is your next due ticket. You can find it in
-the menu Search->Calendar.
+ticket search sub navigation menu.
 
-There's a portlet to put on your home page (see Prefs/MyRT.html)
+Date fields in the search results are displayed/used in the calendar,
+for example if you have a ticket with a due date, it won't be displayed on
+that date unless the Due field is included in the search result format.
+
+There's a portlet to put on your home page (see Prefs/MyRT.html), see the
+CONFIGURATION section below for details on adding it.
 
 =head1 INSTALLATION
 
@@ -175,7 +180,7 @@ mouse over a date in F<etc/RT_SiteConfig.pm>:
 
 =head1 USAGE
 
-A small help section is available in /Prefs/Calendar.html
+A small help section is available in /Search/Calendar.html
 
 =head1 AUTHOR
 

commit 0cf0d8a90fca416f62f54a8ee3e5896bc586752d
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Jul 18 02:11:20 2020 +0800

    Update M:I

diff --git a/META.yml b/META.yml
index 5e6b9db..1d59fcf 100644
--- a/META.yml
+++ b/META.yml
@@ -8,7 +8,7 @@ configure_requires:
   ExtUtils::MakeMaker: 6.59
 distribution_type: module
 dynamic_config: 1
-generated_by: 'Module::Install version 1.16'
+generated_by: 'Module::Install version 1.19'
 license: gpl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -26,5 +26,5 @@ requires:
 resources:
   license: http://opensource.org/licenses/gpl-license.php
 version: '1.01'
-x_module_install_rtx_version: '0.37'
+x_module_install_rtx_version: '0.42'
 x_requires_rt: 4.0.9
diff --git a/inc/Module/Install.pm b/inc/Module/Install.pm
index f44ab4d..7ba98c2 100644
--- a/inc/Module/Install.pm
+++ b/inc/Module/Install.pm
@@ -31,7 +31,7 @@ BEGIN {
 	# This is not enforced yet, but will be some time in the next few
 	# releases once we can make sure it won't clash with custom
 	# Module::Install extensions.
-	$VERSION = '1.16';
+	$VERSION = '1.19';
 
 	# Storage for the pseudo-singleton
 	$MAIN    = undef;
@@ -244,6 +244,8 @@ sub new {
 	}
 	return $args{_self} if $args{_self};
 
+	$base_path = VMS::Filespec::unixify($base_path) if $^O eq 'VMS';
+
 	$args{dispatch} ||= 'Admin';
 	$args{prefix}   ||= 'inc';
 	$args{author}   ||= ($^O eq 'VMS' ? '_author' : '.author');
@@ -322,7 +324,7 @@ sub find_extensions {
 	my ($self, $path) = @_;
 
 	my @found;
-	File::Find::find( sub {
+	File::Find::find( {no_chdir => 1, wanted => sub {
 		my $file = $File::Find::name;
 		return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is;
 		my $subpath = $1;
@@ -336,7 +338,7 @@ sub find_extensions {
 		# correctly.  Otherwise, root through the file to locate the case-preserved
 		# version of the package name.
 		if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) {
-			my $content = Module::Install::_read($subpath . '.pm');
+			my $content = Module::Install::_read($File::Find::name);
 			my $in_pod  = 0;
 			foreach ( split /\n/, $content ) {
 				$in_pod = 1 if /^=\w/;
@@ -351,7 +353,7 @@ sub find_extensions {
 		}
 
 		push @found, [ $file, $pkg ];
-	}, $path ) if -d $path;
+	}}, $path ) if -d $path;
 
 	@found;
 }
@@ -373,8 +375,6 @@ sub _caller {
 	return $call;
 }
 
-# Done in evals to avoid confusing Perl::MinimumVersion
-eval( $] >= 5.006 ? <<'END_NEW' : <<'END_OLD' ); die $@ if $@;
 sub _read {
 	local *FH;
 	open( FH, '<', $_[0] ) or die "open($_[0]): $!";
@@ -383,16 +383,6 @@ sub _read {
 	close FH or die "close($_[0]): $!";
 	return $string;
 }
-END_NEW
-sub _read {
-	local *FH;
-	open( FH, "< $_[0]"  ) or die "open($_[0]): $!";
-	binmode FH;
-	my $string = do { local $/; <FH> };
-	close FH or die "close($_[0]): $!";
-	return $string;
-}
-END_OLD
 
 sub _readperl {
 	my $string = Module::Install::_read($_[0]);
@@ -413,8 +403,6 @@ sub _readpod {
 	return $string;
 }
 
-# Done in evals to avoid confusing Perl::MinimumVersion
-eval( $] >= 5.006 ? <<'END_NEW' : <<'END_OLD' ); die $@ if $@;
 sub _write {
 	local *FH;
 	open( FH, '>', $_[0] ) or die "open($_[0]): $!";
@@ -424,17 +412,6 @@ sub _write {
 	}
 	close FH or die "close($_[0]): $!";
 }
-END_NEW
-sub _write {
-	local *FH;
-	open( FH, "> $_[0]"  ) or die "open($_[0]): $!";
-	binmode FH;
-	foreach ( 1 .. $#_ ) {
-		print FH $_[$_] or die "print($_[0]): $!";
-	}
-	close FH or die "close($_[0]): $!";
-}
-END_OLD
 
 # _version is for processing module versions (eg, 1.03_05) not
 # Perl versions (eg, 5.8.1).
diff --git a/inc/Module/Install/Base.pm b/inc/Module/Install/Base.pm
index 5762a74..9fa42c2 100644
--- a/inc/Module/Install/Base.pm
+++ b/inc/Module/Install/Base.pm
@@ -4,7 +4,7 @@ package Module::Install::Base;
 use strict 'vars';
 use vars qw{$VERSION};
 BEGIN {
-	$VERSION = '1.16';
+	$VERSION = '1.19';
 }
 
 # Suspend handler for "redefined" warnings
diff --git a/inc/Module/Install/Can.pm b/inc/Module/Install/Can.pm
index d859276..d65c753 100644
--- a/inc/Module/Install/Can.pm
+++ b/inc/Module/Install/Can.pm
@@ -8,7 +8,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.16';
+	$VERSION = '1.19';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
@@ -121,6 +121,15 @@ END_C
 # Can we locate a (the) C compiler
 sub can_cc {
 	my $self   = shift;
+
+	if ($^O eq 'VMS') {
+		require ExtUtils::CBuilder;
+		my $builder = ExtUtils::CBuilder->new(
+		quiet => 1,
+		);
+		return $builder->have_compiler;
+	}
+
 	my @chunks = split(/ /, $Config::Config{cc}) or return;
 
 	# $Config{cc} may contain args; try to find out the program part
@@ -151,4 +160,4 @@ if ( $^O eq 'cygwin' ) {
 
 __END__
 
-#line 236
+#line 245
diff --git a/inc/Module/Install/Fetch.pm b/inc/Module/Install/Fetch.pm
index 41d3517..3072b08 100644
--- a/inc/Module/Install/Fetch.pm
+++ b/inc/Module/Install/Fetch.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.16';
+	$VERSION = '1.19';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/Include.pm b/inc/Module/Install/Include.pm
index 2eb1d1f..13fdcd0 100644
--- a/inc/Module/Install/Include.pm
+++ b/inc/Module/Install/Include.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.16';
+	$VERSION = '1.19';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/Makefile.pm b/inc/Module/Install/Makefile.pm
index e9918d2..13a4464 100644
--- a/inc/Module/Install/Makefile.pm
+++ b/inc/Module/Install/Makefile.pm
@@ -8,7 +8,7 @@ use Fcntl qw/:flock :seek/;
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.16';
+	$VERSION = '1.19';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/Metadata.pm b/inc/Module/Install/Metadata.pm
index 9792685..11bf971 100644
--- a/inc/Module/Install/Metadata.pm
+++ b/inc/Module/Install/Metadata.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.16';
+	$VERSION = '1.19';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/RTx.pm b/inc/Module/Install/RTx.pm
index cb4cfde..2dd9489 100644
--- a/inc/Module/Install/RTx.pm
+++ b/inc/Module/Install/RTx.pm
@@ -6,9 +6,10 @@ use strict;
 use warnings;
 no warnings 'once';
 
+use Term::ANSIColor qw(:constants);
 use Module::Install::Base;
 use base 'Module::Install::Base';
-our $VERSION = '0.37';
+our $VERSION = '0.42';
 
 use FindBin;
 use File::Glob     ();
@@ -53,7 +54,7 @@ sub RTx {
         my @look = @INC;
         unshift @look, grep {defined and -d $_} @try;
         push @look, grep {defined and -d $_}
-            map { ( "$_/rt4/lib", "$_/lib/rt4", "$_/lib" ) } @prefixes;
+            map { ( "$_/rt5/lib", "$_/lib/rt5", "$_/rt4/lib", "$_/lib/rt4", "$_/lib" ) } @prefixes;
         last if eval {local @INC = @look; require RT; $RT::LocalLibPath};
 
         warn
@@ -76,6 +77,22 @@ sub RTx {
         $self->requires_rt('4.0.0');
     }
 
+    my $package = $name;
+    $package =~ s/-/::/g;
+    if ( $RT::CORED_PLUGINS{$package} ) {
+        my ($base_version) = $RT::VERSION =~ /(\d+\.\d+\.\d+)/;
+        die RED, <<"EOT";
+
+**** Error: Your installed version of RT ($RT::VERSION) already
+            contains this extension in core, so you don't need to
+            install it.
+
+            Check https://docs.bestpractical.com/rt/$base_version/RT_Config.html
+            to configure it.
+
+EOT
+    }
+
     # Installation locations
     my %path;
     my $plugin_path;
@@ -113,11 +130,29 @@ lexicons ::
 .
     }
 
+    my $remove_files;
+    if( $extra_args->{'remove_files'} ){
+        $self->include('Module::Install::RTx::Remove');
+        our @remove_files;
+        eval { require "etc/upgrade/remove_files" }
+          or print "No remove file located, no files to remove\n";
+        $remove_files = join ",", map {"q(\$(DESTDIR)$plugin_path/$name/$_)"} @remove_files;
+    }
+
     $self->include('Module::Install::RTx::Runtime') if $self->admin;
     $self->include_deps( 'YAML::Tiny', 0 ) if $self->admin;
     my $postamble = << ".";
 install ::
 \t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Iinc -MModule::Install::RTx::Runtime -e"RTxPlugin()"
+.
+
+    if( $remove_files ){
+        $postamble .= << ".";
+\t\$(NOECHO) \$(PERL) -MModule::Install::RTx::Remove -e \"RTxRemove([$remove_files])\"
+.
+    }
+
+    $postamble .= << ".";
 \t\$(NOECHO) \$(PERL) -MExtUtils::Install -e \"install({$args})\"
 .
 
@@ -205,7 +240,7 @@ sub requires_rt {
     my @sorted = sort RT::Handle::cmp_version $version,$RT::VERSION;
 
     if ($sorted[-1] eq $version) {
-        die <<"EOT";
+        die RED, <<"EOT";
 
 **** Error: This extension requires RT $version. Your installed version
             of RT ($RT::VERSION) is too old.
@@ -231,12 +266,12 @@ sub requires_rt_plugin {
         unshift @INC, $path;
     } else {
         my $name = $self->name;
-        warn <<"EOT";
+        my $msg = <<"EOT";
 
 **** Warning: $name requires that the $plugin plugin be installed and
               enabled; it does not appear to be installed.
-
 EOT
+        warn RED, $msg, RESET, "\n";
     }
     $self->requires(@_);
 }
@@ -246,9 +281,8 @@ sub rt_too_new {
     my $name = $self->name;
     $msg ||= <<EOT;
 
-**** Error: Your installed version of RT (%s) is too new; this extension
-            only works with versions older than %s.
-
+**** Warning: Your installed version of RT (%s) is too new; this extension
+              has not been tested on your version of RT and may not work as expected.
 EOT
     $self->add_metadata("x_rt_too_new", $version) if $self->is_admin;
 
@@ -256,7 +290,7 @@ EOT
     my @sorted = sort RT::Handle::cmp_version $version,$RT::VERSION;
 
     if ($sorted[0] eq $version) {
-        die sprintf($msg,$RT::VERSION,$version);
+        warn RED, sprintf($msg,$RT::VERSION), RESET, "\n";
     }
 }
 
@@ -279,4 +313,4 @@ sub _load_rt_handle {
 
 __END__
 
-#line 428
+#line 484
diff --git a/inc/Module/Install/RTx/Runtime.pm b/inc/Module/Install/RTx/Runtime.pm
index 937949f..ae07502 100644
--- a/inc/Module/Install/RTx/Runtime.pm
+++ b/inc/Module/Install/RTx/Runtime.pm
@@ -33,6 +33,7 @@ sub RTxDatabase {
 
     my $lib_path = File::Basename::dirname($INC{'RT.pm'});
     my @args = (
+        "-I.",
         "-Ilib",
         "-I$RT::LocalLibPath",
         "-I$lib_path",
diff --git a/inc/Module/Install/ReadmeFromPod.pm b/inc/Module/Install/ReadmeFromPod.pm
index b5e03c3..3738232 100644
--- a/inc/Module/Install/ReadmeFromPod.pm
+++ b/inc/Module/Install/ReadmeFromPod.pm
@@ -7,12 +7,41 @@ use warnings;
 use base qw(Module::Install::Base);
 use vars qw($VERSION);
 
-$VERSION = '0.22';
+$VERSION = '0.30';
+
+{
+
+    # these aren't defined until after _require_admin is run, so
+    # define them so prototypes are available during compilation.
+    sub io;
+    sub capture(&;@);
+
+#line 28
+
+    my $done = 0;
+
+    sub _require_admin {
+
+	# do this once to avoid redefinition warnings from IO::All
+	return if $done;
+
+	require IO::All;
+	IO::All->import( '-binary' );
+
+	require Capture::Tiny;
+	Capture::Tiny->import ( 'capture' );
+
+	return;
+    }
+
+}
 
 sub readme_from {
   my $self = shift;
   return unless $self->is_admin;
 
+  _require_admin;
+
   # Input file
   my $in_file  = shift || $self->_all_from
     or die "Can't determine file to make readme_from";
@@ -50,6 +79,8 @@ sub readme_from {
     $out_file = $self->_readme_htm($in_file, $out_file, $options);
   } elsif ($format eq 'man') {
     $out_file = $self->_readme_man($in_file, $out_file, $options);
+  } elsif ($format eq 'md') {
+    $out_file = $self->_readme_md($in_file, $out_file, $options);
   } elsif ($format eq 'pdf') {
     $out_file = $self->_readme_pdf($in_file, $out_file, $options);
   }
@@ -67,10 +98,10 @@ sub _readme_txt {
   $out_file ||= 'README';
   require Pod::Text;
   my $parser = Pod::Text->new( @$options );
-  open my $out_fh, '>', $out_file or die "Could not write file $out_file:\n$!\n";
+  my $io = io->file($out_file)->open(">");
+  my $out_fh = $io->io_handle;
   $parser->output_fh( *$out_fh );
   $parser->parse_file( $in_file );
-  close $out_fh;
   return $out_file;
 }
 
@@ -79,11 +110,14 @@ sub _readme_htm {
   my ($self, $in_file, $out_file, $options) = @_;
   $out_file ||= 'README.htm';
   require Pod::Html;
-  Pod::Html::pod2html(
-    "--infile=$in_file",
-    "--outfile=$out_file",
-    @$options,
-  );
+  my ($o) = capture {
+    Pod::Html::pod2html(
+      "--infile=$in_file",
+      "--outfile=-",
+      @$options,
+    );
+  };
+  io->file($out_file)->print($o);
   # Remove temporary files if needed
   for my $file ('pod2htmd.tmp', 'pod2htmi.tmp') {
     if (-e $file) {
@@ -99,7 +133,10 @@ sub _readme_man {
   $out_file ||= 'README.1';
   require Pod::Man;
   my $parser = Pod::Man->new( @$options );
-  $parser->parse_from_file($in_file, $out_file);
+  my $io = io->file($out_file)->open(">");
+  my $out_fh = $io->io_handle;
+  $parser->output_fh( *$out_fh );
+  $parser->parse_file( $in_file );
   return $out_file;
 }
 
@@ -111,11 +148,20 @@ sub _readme_pdf {
     or die "Could not generate $out_file because pod2pdf could not be found\n";
   my $parser = App::pod2pdf->new( @$options );
   $parser->parse_from_file($in_file);
-  open my $out_fh, '>', $out_file or die "Could not write file $out_file:\n$!\n";
-  select $out_fh;
-  $parser->output;
-  select STDOUT;
-  close $out_fh;
+  my ($o) = capture { $parser->output };
+  io->file($out_file)->print($o);
+  return $out_file;
+}
+
+sub _readme_md {
+  my ($self, $in_file, $out_file, $options) = @_;
+  $out_file ||= 'README.md';
+  require Pod::Markdown;
+  my $parser = Pod::Markdown->new( @$options );
+  my $io = io->file($out_file)->open(">");
+  my $out_fh = $io->io_handle;
+  $parser->output_fh( *$out_fh );
+  $parser->parse_file( $in_file );
   return $out_file;
 }
 
@@ -134,5 +180,5 @@ sub _all_from {
 
 __END__
 
-#line 254
+#line 316
 
diff --git a/inc/Module/Install/Win32.pm b/inc/Module/Install/Win32.pm
index 218a66b..f7aa615 100644
--- a/inc/Module/Install/Win32.pm
+++ b/inc/Module/Install/Win32.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.16';
+	$VERSION = '1.19';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/WriteAll.pm b/inc/Module/Install/WriteAll.pm
index 530749b..2db861a 100644
--- a/inc/Module/Install/WriteAll.pm
+++ b/inc/Module/Install/WriteAll.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.16';
+	$VERSION = '1.19';
 	@ISA     = qw{Module::Install::Base};
 	$ISCORE  = 1;
 }
diff --git a/inc/YAML/Tiny.pm b/inc/YAML/Tiny.pm
index aa539f7..fb157a6 100644
--- a/inc/YAML/Tiny.pm
+++ b/inc/YAML/Tiny.pm
@@ -2,12 +2,12 @@
 use 5.008001; # sane UTF-8 support
 use strict;
 use warnings;
-package YAML::Tiny; # git description: v1.68-2-gcc5324e
+package YAML::Tiny; # git description: v1.72-7-g8682f63
 # XXX-INGY is 5.8.1 too old/broken for utf8?
 # XXX-XDG Lancaster consensus was that it was sufficient until
 # proven otherwise
 
-our $VERSION = '1.69';
+our $VERSION = '1.73';
 
 #####################################################################
 # The YAML::Tiny API.
@@ -374,7 +374,7 @@ sub _load_scalar {
     while ( @$lines ) {
         $lines->[0] =~ /^(\s*)/;
         last unless length($1) >= $indent->[-1];
-        push @multiline, substr(shift(@$lines), length($1));
+        push @multiline, substr(shift(@$lines), $indent->[-1]);
     }
 
     my $j = (substr($string, 0, 1) eq '>') ? ' ' : "\n";
@@ -570,10 +570,8 @@ sub _dump_file {
     if ( _can_flock() ) {
         # Open without truncation (truncate comes after lock)
         my $flags = Fcntl::O_WRONLY()|Fcntl::O_CREAT();
-        sysopen( $fh, $file, $flags );
-        unless ( $fh ) {
-            $self->_error("Failed to open file '$file' for writing: $!");
-        }
+        sysopen( $fh, $file, $flags )
+            or $self->_error("Failed to open file '$file' for writing: $!");
 
         # Use no translation and strict UTF-8
         binmode( $fh, ":raw:encoding(UTF-8)");
@@ -871,4 +869,4 @@ delete $YAML::Tiny::{refaddr};
 
 __END__
 
-#line 1489
+#line 1487

commit dcb5f6d209e33839d6f799b5bc3911c1610dd36c
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Jul 18 01:55:21 2020 +0800

    Tweak menu to make it compatible with RT 5.0
    
    In RT 5.0, transaction/asset searches are also in /Search/, and we only
    support "Calendar" for ticket searches.
    
    This tweak also fixes the issue that "Calendar" couldn't show up on
    "/Search/Builder.html" when there is a current search while Query is not
    set in URL.

diff --git a/html/Callbacks/RTx-Calendar/Elements/Tabs/Privileged b/html/Callbacks/RTx-Calendar/Elements/Tabs/Privileged
index c67d1df..9862702 100644
--- a/html/Callbacks/RTx-Calendar/Elements/Tabs/Privileged
+++ b/html/Callbacks/RTx-Calendar/Elements/Tabs/Privileged
@@ -46,24 +46,17 @@
 %#
 %# END BPS TAGGED BLOCK }}}
 <%INIT>
-my $request_path = $HTML::Mason::Commands::r->path_info;
-my $request_args = $m->request_args;
 
-my $query_string = sub {
-    my %args = @_;
-    my $u    = URI->new();
-    $u->query_form(%args);
-    return $u->query;
-};
-
-if ( $request_path =~ qr{^/Search/} && $request_args->{Query} ) {
-    my $tabs = PageMenu;
-    my $chart = $tabs->child('chart');
-
-    $request_args->{Format} = RT->Config->Get('DefaultSearchResultFormat') unless $request_args->{Format};
-
-    $chart->add_after( 'calendar' => title => loc('Calendar'),
-                       path => '/Search/Calendar.html?' . $query_string->( %$request_args ) );
+if ( $Path =~ qr{^/Search/} && $Has_Query && !$DECODED_ARGS->{Class} || $DECODED_ARGS->{Class} eq 'RT::Tickets' ) {
+    if ( my $chart = PageMenu->child('chart') ) {
+        $chart->add_after( 'calendar' => title => loc('Calendar'), path => "/Search/Calendar.html$Search_Args" );
+    }
 }
 
 </%INIT>
+
+<%ARGS>
+$Has_Query
+$Path
+$Search_Args
+</%ARGS>

commit 3e9e0e896325e3c881500a4651850fb4c272c4bb
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Jul 18 02:12:38 2020 +0800

    Add patch tabs_privileged_callback.patch and update docs for it
    
    In previous menu tweak(dcb5f6d209) for RT 5, we used a couple of changes
    not available in RT 4.4.1 and prior versions, which is what the patch
    for.
    
    As RT 4.0 has already reached EOL for a while, we don't need to worry
    about it and can simply bump required RT version.

diff --git a/META.yml b/META.yml
index 1d59fcf..9a93ce6 100644
--- a/META.yml
+++ b/META.yml
@@ -16,15 +16,16 @@ meta-spec:
 name: RTx-Calendar
 no_index:
   directory:
+    - etc
     - html
     - inc
     - static
 requires:
   DateTime: 0
   DateTime::Set: 0
-  perl: 5.8.3
+  perl: 5.10.1
 resources:
   license: http://opensource.org/licenses/gpl-license.php
 version: '1.01'
 x_module_install_rtx_version: '0.42'
-x_requires_rt: 4.0.9
+x_requires_rt: 4.2.0
diff --git a/Makefile.PL b/Makefile.PL
index 9e541fa..e6f849b 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -5,7 +5,7 @@ RTx('RTx-Calendar');
 requires 'DateTime';
 requires 'DateTime::Set';
 
-requires_rt '4.0.9';
+requires_rt '4.2.0';
 
 sign();
 WriteAll();
diff --git a/README b/README
index da6ee10..093e0eb 100644
--- a/README
+++ b/README
@@ -14,22 +14,24 @@ DESCRIPTION
     There's a portlet to put on your home page (see Prefs/MyRT.html), see
     the CONFIGURATION section below for details on adding it.
 
+RT VERSION
+    Works with RT 4.2, 4.4, 5.0
+
 INSTALLATION
     perl Makefile.PL
     make
     make install
         May need root permissions
 
-    Edit your /opt/rt4/etc/RT_SiteConfig.pm
-        If you are using RT 4.2 or greater, add this line:
-
-            Plugin('RTx::Calendar');
+    patch RT
+        Apply for versions prior to 4.4.2:
 
-        For RT 4.0, add this line:
+            patch -p1 -d /path/to/rt < etc/tabs_privileged_callback.patch
 
-            Set(@Plugins, qw(RTx::Calendar));
+    Edit your /opt/rt4/etc/RT_SiteConfig.pm
+        Add this line:
 
-        or add RTx::Calendar to your existing @Plugins line.
+            Plugin('RTx::Calendar');
 
     Clear your mason cache
             rm -rf /opt/rt4/var/mason_data/obj
diff --git a/etc/tabs_privileged_callback.patch b/etc/tabs_privileged_callback.patch
new file mode 100644
index 0000000..493c0f8
--- /dev/null
+++ b/etc/tabs_privileged_callback.patch
@@ -0,0 +1,32 @@
+diff --git a/share/html/Elements/Tabs b/share/html/Elements/Tabs
+index c6c6505..d4b2e59 100644
+--- a/share/html/Elements/Tabs
++++ b/share/html/Elements/Tabs
+@@ -757,6 +757,9 @@ my $build_main_nav = sub {
+         }
+     }
+ 
++    # Scope here so we can share in the Privileged callback
++    my $args      = '';
++    my $has_query = '';
+     if (
+         (
+                $request_path =~ m{^/(?:Ticket|Search)/}
+@@ -767,8 +770,6 @@ my $build_main_nav = sub {
+       )
+     {
+         my $search = Menu()->child('search')->child('tickets');
+-        my $args      = '';
+-        my $has_query = '';
+         my $current_search = $session{"CurrentSearchHash"} || {};
+         my $search_id = $DECODED_ARGS->{'SavedSearchLoad'} || $DECODED_ARGS->{'SavedSearchId'} || $current_search->{'SearchId'} || '';
+         my $chart_id = $DECODED_ARGS->{'SavedChartSearchId'} || $current_search->{SavedChartSearchId};
+@@ -936,7 +937,7 @@ my $build_main_nav = sub {
+         PageMenu()->child( edit => title => loc('Edit'), path => '/Prefs/MyRT.html' );
+     }
+ 
+-    $m->callback( CallbackName => 'Privileged', Path => $request_path );
++    $m->callback( CallbackName => 'Privileged', Path => $request_path, Search_Args => $args, Has_Query => $has_query );
+ };
+ 
+ my $build_selfservice_nav = sub {
diff --git a/lib/RTx/Calendar.pm b/lib/RTx/Calendar.pm
index 1269e9d..d9f2ac7 100644
--- a/lib/RTx/Calendar.pm
+++ b/lib/RTx/Calendar.pm
@@ -124,6 +124,10 @@ that date unless the Due field is included in the search result format.
 There's a portlet to put on your home page (see Prefs/MyRT.html), see the
 CONFIGURATION section below for details on adding it.
 
+=head1 RT VERSION
+
+Works with RT 4.2, 4.4, 5.0
+
 =head1 INSTALLATION
 
 =over
@@ -136,17 +140,17 @@ CONFIGURATION section below for details on adding it.
 
 May need root permissions
 
-=item Edit your F</opt/rt4/etc/RT_SiteConfig.pm>
+=item patch RT
 
-If you are using RT 4.2 or greater, add this line:
+Apply for versions prior to 4.4.2:
 
-    Plugin('RTx::Calendar');
+    patch -p1 -d /path/to/rt < etc/tabs_privileged_callback.patch
 
-For RT 4.0, add this line:
+=item Edit your F</opt/rt4/etc/RT_SiteConfig.pm>
 
-    Set(@Plugins, qw(RTx::Calendar));
+Add this line:
 
-or add C<RTx::Calendar> to your existing C<@Plugins> line.
+    Plugin('RTx::Calendar');
 
 =item Clear your mason cache
 

commit 5fcee75efdf36d355e6f712b4458cb13e21e4c5e
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Jul 18 02:24:12 2020 +0800

    Update RT path to /opt/rt5 in docs

diff --git a/README b/README
index 093e0eb..f3478ec 100644
--- a/README
+++ b/README
@@ -28,13 +28,13 @@ INSTALLATION
 
             patch -p1 -d /path/to/rt < etc/tabs_privileged_callback.patch
 
-    Edit your /opt/rt4/etc/RT_SiteConfig.pm
+    Edit your /opt/rt5/etc/RT_SiteConfig.pm
         Add this line:
 
             Plugin('RTx::Calendar');
 
     Clear your mason cache
-            rm -rf /opt/rt4/var/mason_data/obj
+            rm -rf /opt/rt5/var/mason_data/obj
 
     Restart your webserver
 
diff --git a/lib/RTx/Calendar.pm b/lib/RTx/Calendar.pm
index d9f2ac7..413f730 100644
--- a/lib/RTx/Calendar.pm
+++ b/lib/RTx/Calendar.pm
@@ -146,7 +146,7 @@ Apply for versions prior to 4.4.2:
 
     patch -p1 -d /path/to/rt < etc/tabs_privileged_callback.patch
 
-=item Edit your F</opt/rt4/etc/RT_SiteConfig.pm>
+=item Edit your F</opt/rt5/etc/RT_SiteConfig.pm>
 
 Add this line:
 
@@ -154,7 +154,7 @@ Add this line:
 
 =item Clear your mason cache
 
-    rm -rf /opt/rt4/var/mason_data/obj
+    rm -rf /opt/rt5/var/mason_data/obj
 
 =item Restart your webserver
 

commit 5d902631b1206c603728801cc051cc723b3dd372
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Jul 18 02:26:49 2020 +0800

    Update copyright year to 2020

diff --git a/README b/README
index f3478ec..c57ee46 100644
--- a/README
+++ b/README
@@ -75,7 +75,7 @@ BUGS
         L<rt.cpan.org|http://rt.cpan.org/Public/Dist/Display.html?Name=RTx-Calendar>.
 
 LICENSE AND COPYRIGHT
-    This software is Copyright (c) 2010-2014 by Best Practical Solutions
+    This software is Copyright (c) 2010-2020 by Best Practical Solutions
 
     Copyright 2007-2009 by Nicolas Chuche
 
diff --git a/lib/RTx/Calendar.pm b/lib/RTx/Calendar.pm
index 413f730..e466f54 100644
--- a/lib/RTx/Calendar.pm
+++ b/lib/RTx/Calendar.pm
@@ -204,7 +204,7 @@ or via the web at
 
 =head1 LICENSE AND COPYRIGHT
 
-This software is Copyright (c) 2010-2014 by Best Practical Solutions
+This software is Copyright (c) 2010-2020 by Best Practical Solutions
 
 Copyright 2007-2009 by Nicolas Chuche
 

commit 3beda214434b14a270d363ee9a3da5e56a4a8272
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Jul 18 02:27:06 2020 +0800

    Add "." to @INC for perl 5.26+

diff --git a/Makefile.PL b/Makefile.PL
index e6f849b..ed70d43 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,3 +1,4 @@
+use lib '.';
 use inc::Module::Install;
 
 RTx('RTx-Calendar');

commit 96f7c653706580361e3a74824bef3cd2025a5ab0
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Jul 18 02:44:12 2020 +0800

    Tweak button/select styles for new RT 5.0 theme

diff --git a/html/Search/Calendar.html b/html/Search/Calendar.html
index 722b399..5eceb0c 100644
--- a/html/Search/Calendar.html
+++ b/html/Search/Calendar.html
@@ -93,19 +93,19 @@ $NewQuery => 0
 <td valign="top" align="center">
 <form action="<%$RT::WebPath%>/Search/Calendar.html?<%$QueryString%>" method="post">
 
-<select name="Month">
+<select name="Month" class="selectpicker">
 % for (0..11) {
 <option value="<%$_%>" <% $_ == $Month ? 'selected' : ''%> ><%$rtdate->GetMonth($_)%></option>
 % }
 </select>
 % my $year = (localtime)[5] + 1900;
-<select name="Year">
+<select name="Year" class="selectpicker">
 % for ( ($year-5) .. ($year+5)) {
 <option value="<%$_%>" <% $_ == $Year ? 'selected' : ''%>><%$_%></option>
 % }
 </select>
 
-<input type="submit" value="<% loc('Submit') %>" class="button" />
+<input type="submit" value="<% loc('Submit') %>" class="button btn btn-primary" />
 
 </form>
 </td>

commit 505d9a5f658670faeb75b917cd1d6fae8b4ae286
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Jul 18 02:27:41 2020 +0800

    Prep 1.02

diff --git a/CHANGES b/CHANGES
index ce83352..2886b0d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,8 @@
+1.02 2020-07-17
+ - Clarify documentation on what the calendar displays and how
+ - Make it work with RT 5.0
+ - RT 4.0 is not supported any more
+
 1.01
  - Provide a default search format when one isn't passed
 
diff --git a/MANIFEST b/MANIFEST
index f5de514..f88506c 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,4 +1,5 @@
 CHANGES
+etc/tabs_privileged_callback.patch
 html/Callbacks/RTx-Calendar/Elements/Tabs/Privileged
 html/Elements/CalendarEvent
 html/Elements/MyCalendar
diff --git a/META.yml b/META.yml
index 9a93ce6..21d4c23 100644
--- a/META.yml
+++ b/META.yml
@@ -26,6 +26,6 @@ requires:
   perl: 5.10.1
 resources:
   license: http://opensource.org/licenses/gpl-license.php
-version: '1.01'
+version: '1.02'
 x_module_install_rtx_version: '0.42'
 x_requires_rt: 4.2.0

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


More information about the Bps-public-commit mailing list