[Bps-public-commit] RT-Extension-PreviewInSearch branch update-for-rt5 created. 0.04-10-gbf4d815
BPS Git Server
git at git.bestpractical.com
Mon Sep 25 22:29:43 UTC 2023
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "RT-Extension-PreviewInSearch".
The branch, update-for-rt5 has been created
at bf4d81551d38be2b8772ebe9d42e29ad14ac95c8 (commit)
- Log -----------------------------------------------------------------
commit bf4d81551d38be2b8772ebe9d42e29ad14ac95c8
Author: Brad Embree <brad at bestpractical.com>
Date: Tue Sep 19 15:34:28 2023 -0700
Prepare version 0.05
diff --git a/META.yml b/META.yml
index 912c309..1933f3c 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.14'
+generated_by: 'Module::Install version 1.21'
license: gpl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -23,6 +23,6 @@ requires:
resources:
license: http://opensource.org/licenses/gpl-license.php
repository: https://github.com/bestpractical/rt-extension-previewinsearch.git
-version: '0.04'
-x_module_install_rtx_version: '0.37'
+version: '0.05'
+x_module_install_rtx_version: '0.43'
x_requires_rt: 4.0.0
diff --git a/README b/README
index cb53cad..be96298 100644
--- a/README
+++ b/README
@@ -17,7 +17,7 @@ DESCRIPTION
will be displayed at the bottom of the page.
RT VERSIONS
- Works with RT 4.2.
+ Works with RT 4.2, 4.4, 5.0
INSTALLATION
perl Makefile.PL
diff --git a/lib/RT/Extension/PreviewInSearch.pm b/lib/RT/Extension/PreviewInSearch.pm
index 955fb0c..435b4f5 100644
--- a/lib/RT/Extension/PreviewInSearch.pm
+++ b/lib/RT/Extension/PreviewInSearch.pm
@@ -29,7 +29,7 @@ at the bottom of the page.
=head1 RT VERSIONS
-Works with RT 4.2, 4.4.
+Works with RT 4.2, 4.4, 5.0
=head1 INSTALLATION
commit 76dacdda37eccee80c5e7104a88e924f7ff169d2
Author: Brad Embree <brad at bestpractical.com>
Date: Tue Sep 19 15:28:59 2023 -0700
Update Module::Install files
diff --git a/inc/Module/Install.pm b/inc/Module/Install.pm
index ff767fa..3dd721b 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.14';
+ $VERSION = '1.21';
# 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 4206347..67ce900 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.14';
+ $VERSION = '1.21';
}
# Suspend handler for "redefined" warnings
diff --git a/inc/Module/Install/Can.pm b/inc/Module/Install/Can.pm
index 9929b1b..93fc4f9 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.14';
+ $VERSION = '1.21';
@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 3d8de76..3c9390a 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.14';
+ $VERSION = '1.21';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Include.pm b/inc/Module/Install/Include.pm
index f274f87..b9b926f 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.14';
+ $VERSION = '1.21';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Makefile.pm b/inc/Module/Install/Makefile.pm
index 66993af..1e214a0 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.14';
+ $VERSION = '1.21';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Metadata.pm b/inc/Module/Install/Metadata.pm
index e547fa0..2ae8036 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.14';
+ $VERSION = '1.21';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -455,12 +455,8 @@ sub author_from {
my %license_urls = (
perl => 'http://dev.perl.org/licenses/',
apache => 'http://apache.org/licenses/LICENSE-2.0',
- apache_1_1 => 'http://apache.org/licenses/LICENSE-1.1',
artistic => 'http://opensource.org/licenses/artistic-license.php',
- artistic_2 => 'http://opensource.org/licenses/artistic-license-2.0.php',
lgpl => 'http://opensource.org/licenses/lgpl-license.php',
- lgpl2 => 'http://opensource.org/licenses/lgpl-2.1.php',
- lgpl3 => 'http://opensource.org/licenses/lgpl-3.0.html',
bsd => 'http://opensource.org/licenses/bsd-license.php',
gpl => 'http://opensource.org/licenses/gpl-license.php',
gpl2 => 'http://opensource.org/licenses/gpl-2.0.php',
@@ -471,6 +467,12 @@ my %license_urls = (
unrestricted => undef,
restrictive => undef,
unknown => undef,
+
+ # these are not actually allowed in meta-spec v1.4 but are left here for compatibility:
+ apache_1_1 => 'http://apache.org/licenses/LICENSE-1.1',
+ artistic_2 => 'http://opensource.org/licenses/artistic-license-2.0.php',
+ lgpl2 => 'http://opensource.org/licenses/lgpl-2.1.php',
+ lgpl3 => 'http://opensource.org/licenses/lgpl-3.0.html',
);
sub license {
diff --git a/inc/Module/Install/RTx.pm b/inc/Module/Install/RTx.pm
index 97acf77..2889ece 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.43';
use FindBin;
use File::Glob ();
@@ -37,6 +38,13 @@ sub RTx {
}
$self->add_metadata("x_module_install_rtx_version", $VERSION );
+ my $installdirs = $ENV{INSTALLDIRS};
+ for ( @ARGV ) {
+ if ( /INSTALLDIRS=(.*)/ ) {
+ $installdirs = $1;
+ }
+ }
+
# Try to find RT.pm
my @prefixes = qw( /opt /usr/local /home /usr /sw /usr/share/request-tracker4);
$ENV{RTHOME} =~ s{/RT\.pm$}{} if defined $ENV{RTHOME};
@@ -46,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
@@ -69,9 +77,31 @@ 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;
- $path{$_} = $RT::LocalPluginPath . "/$name/$_"
+ my $plugin_path;
+ if ( $installdirs && $installdirs eq 'vendor' ) {
+ $plugin_path = $RT::PluginPath;
+ } else {
+ $plugin_path = $RT::LocalPluginPath;
+ }
+ $path{$_} = $plugin_path . "/$name/$_"
foreach @DIRS;
# Copy RT 4.2.0 static files into NoAuth; insufficient for
@@ -85,7 +115,7 @@ sub RTx {
my %index = map { $_ => 1 } @INDEX_DIRS;
$self->no_index( directory => $_ ) foreach grep !$index{$_}, @DIRS;
- my $args = join ', ', map "q($_)", map { ($_, $path{$_}) }
+ my $args = join ', ', map "q($_)", map { ($_, "\$(DESTDIR)$path{$_}") }
sort keys %path;
printf "%-10s => %s\n", $_, $path{$_} for sort keys %path;
@@ -100,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})\"
.
@@ -131,6 +179,7 @@ install ::
if ( $path{lib} ) {
$self->makemaker_args( INSTALLSITELIB => $path{'lib'} );
$self->makemaker_args( INSTALLARCHLIB => $path{'lib'} );
+ $self->makemaker_args( INSTALLVENDORLIB => $path{'lib'} )
} else {
$self->makemaker_args( PM => { "" => "" }, );
}
@@ -139,6 +188,13 @@ install ::
$self->makemaker_args( INSTALLSITEMAN3DIR => "$RT::LocalPath/man/man3" );
$self->makemaker_args( INSTALLSITEARCH => "$RT::LocalPath/man" );
+ # INSTALLDIRS=vendor should install manpages into /usr/share/man.
+ # That is the default path in most distributions. Need input from
+ # Redhat, Centos etc.
+ $self->makemaker_args( INSTALLVENDORMAN1DIR => "/usr/share/man/man1" );
+ $self->makemaker_args( INSTALLVENDORMAN3DIR => "/usr/share/man/man3" );
+ $self->makemaker_args( INSTALLVENDORARCH => "/usr/share/man" );
+
if (%has_etc) {
print "For first-time installation, type 'make initdb'.\n";
my $initdb = '';
@@ -184,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.
@@ -210,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(@_);
}
@@ -225,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;
@@ -235,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";
}
}
@@ -258,4 +313,4 @@ sub _load_rt_handle {
__END__
-#line 390
+#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 9706e5f..b6c1d37 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.14';
+ $VERSION = '1.21';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/WriteAll.pm b/inc/Module/Install/WriteAll.pm
index dbedc00..d87eb9a 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.14';
+ $VERSION = '1.21';
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
diff --git a/inc/YAML/Tiny.pm b/inc/YAML/Tiny.pm
index 8da7cd1..db3ae5c 100644
--- a/inc/YAML/Tiny.pm
+++ b/inc/YAML/Tiny.pm
@@ -2,13 +2,12 @@
use 5.008001; # sane UTF-8 support
use strict;
use warnings;
-package YAML::Tiny;
-# git description: v1.63-12-g5dd832a
-$YAML::Tiny::VERSION = '1.64';
+package YAML::Tiny; # git description: v1.73-12-ge02f827
# 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.74';
#####################################################################
# The YAML::Tiny API.
@@ -375,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";
@@ -514,7 +513,7 @@ sub _load_hash {
}
if ( exists $hash->{$key} ) {
- die \"YAML::Tiny found a duplicate key '$key' in line '$lines->[0]'";
+ warn "YAML::Tiny found a duplicate key '$key' in line '$lines->[0]'";
}
# Do we have a value?
@@ -571,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)");
@@ -872,4 +869,4 @@ delete $YAML::Tiny::{refaddr};
__END__
-#line 1490
+#line 1487
commit 274fd1e49df5308e4a4bd36ec5953bc49e99fbc1
Author: Brad Embree <brad at bestpractical.com>
Date: Tue May 9 12:08:01 2023 -0700
Update MANIFEST
diff --git a/MANIFEST b/MANIFEST
index aa978f3..937d5fb 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,7 +1,7 @@
Changes
doc/images/preview-screenshot.png
+html/Callbacks/RT-Extension-PreviewInSearch/Elements/ShowHistoryPage/ModifyPaths
html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/AfterResults
-html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/BeforeResults
html/Helpers/TicketPreview
inc/Module/Install.pm
inc/Module/Install/Base.pm
commit c084e8f2196b4133c366a011361d9ab70a67f079
Author: Brad Embree <brad at bestpractical.com>
Date: Tue Sep 19 15:31:19 2023 -0700
Modify modal offset for RT search filter in side-by-side mode
The way that the ticket list is wrapped when in preview side by side
mode causes a display issue when calculating the max-height of the
search filter modal.
Add JS to overwrite the search filter on click handler to modify the
max-height calculation so the modal displays correctly.
See commit 9263f906ea for where the height offset was introduced.
diff --git a/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/AfterResults b/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/AfterResults
index 22171fa..fd5304a 100644
--- a/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/AfterResults
+++ b/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/AfterResults
@@ -35,6 +35,23 @@ var do_preview = function (row) {
jQuery(document).ready(function() {
do_preview( get_ticket_row( jQuery('table.ticket-list tbody tr td').first() ) );
+
+ // if RT 5.0.4 or newer need to adjust calculation of max-height of search filter modal
+ if ( jQuery(".search-filter") ) {
+ jQuery(".search-filter").click(function(ev){
+ ev.preventDefault();
+ var modal = jQuery(this).closest('th').find('.modal.search-results-filter');
+ modal.css('top', jQuery(this).offset().top);
+ var left = jQuery(this).offset().left;
+ // 10 is extra space to move modal a bit away from edge
+ if ( left + modal.width() + 10 > jQuery('body').width() ) {
+ left = jQuery('body').width() - modal.width() - 10;
+ }
+ modal.css('left', left);
+ modal.find('div.modal-content').css('max-height', jQuery(window).height() - jQuery(this).offset().top - 160 );
+ modal.modal('show');
+ });
+ }
});
jQuery(function(){
commit c5e2451450dd19ef5f9e4251eac9d4044363515c
Author: Brad Embree <brad at bestpractical.com>
Date: Tue May 9 12:06:51 2023 -0700
Add callback to fix ticket action paths using scroll history
If history is set to scrolling the paths assume you are on
Ticket/Display.html and uses relative paths. For example AttachmentPath
is set to Attachment instead of the full path. This means the paths do
not work for the search preview and so the paths need to be set to full
paths so they work.
diff --git a/html/Callbacks/RT-Extension-PreviewInSearch/Elements/ShowHistoryPage/ModifyPaths b/html/Callbacks/RT-Extension-PreviewInSearch/Elements/ShowHistoryPage/ModifyPaths
new file mode 100644
index 0000000..dd08313
--- /dev/null
+++ b/html/Callbacks/RT-Extension-PreviewInSearch/Elements/ShowHistoryPage/ModifyPaths
@@ -0,0 +1,21 @@
+<%ARGS>
+$ARGSRef
+</%ARGS>
+<%INIT>
+my $ShowHistory = RT->Config->Get("ShowHistory", $session{'CurrentUser'});
+if ($ShowHistory eq "scroll") {
+ # if scrolling history the paths assume you are on Ticket/Display.html
+ # eg AttachmentPath is set to Attachment instead of the full path
+ # this means the paths do not work for the search preview
+ # fix the paths to be full paths so they work
+ if ( $ARGSRef->{AttachmentPath} ne ( RT->Config->Get('WebPath') . '/Ticket/Attachment' ) ) {
+ $ARGSRef->{AttachmentPath} = RT->Config->Get('WebPath') . '/Ticket/Attachment';
+ }
+ if ( $ARGSRef->{ForwardPath} ne ( RT->Config->Get('WebPath') . '/Ticket/Forward.html' ) ) {
+ $ARGSRef->{ForwardPath} = RT->Config->Get('WebPath') . '/Ticket/Forward.html';
+ }
+ if ( $ARGSRef->{UpdatePath} ne ( RT->Config->Get('WebPath') . '/Ticket/Update.html' ) ) {
+ $ARGSRef->{UpdatePath} = RT->Config->Get('WebPath') . '/Ticket/Update.html';
+ }
+}
+</%INIT>
commit 41f48a7b60a42a4b2d4f7ddd1268be2a5b77fd7f
Author: Brad Embree <brad at bestpractical.com>
Date: Thu Mar 9 09:46:50 2023 -0800
Add RT 5 code
diff --git a/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/AfterResults b/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/AfterResults
index 7ae3d40..22171fa 100644
--- a/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/AfterResults
+++ b/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/AfterResults
@@ -1,4 +1,53 @@
-% if ( RT::Handle::cmp_version($RT::VERSION, '5.0.0') < 0 ) {
+% if ( RT::Handle::cmp_version($RT::VERSION, '5.0.0') >= 0 ) {
+% # RT 5 version
+<style>
+tr.in-preview td { background: #ffb }
+div.ticket-list-with-previewinsearch table.ticket-list { table-layout:fixed; }
+</style>
+<script type="text/javascript">
+var ticket_list = jQuery('table.ticket-list');
+
+% if ( RT->Config->Get('SideBySidePreview') ) {
+ticket_list.wrap( "<div class='row m-0'><div class='ticket-list-with-previewinsearch col-6'></div></div>" );
+jQuery('div.ticket-list-with-previewinsearch').after( "<div id='ticket-preview-container' class='col-6'><p>foobar</p></div>" );
+% } else {
+ticket_list.after( "<div class='row m-0'><div id='ticket-preview-container' class='col-12'><p>foobar</p></div></div>" );
+% }
+
+var get_ticket_row = function (from) {
+ var row = jQuery(from).closest('tr');
+ var even_or_odd = row.hasClass('oddline')? 'evenline': 'oddline';
+ row = row.add(
+ row.prevUntil( '.' + even_or_odd, '[class*="line"]' )
+ ).add(
+ row.nextUntil( '.' + even_or_odd, '[class*="line"]' )
+ );
+ return row;
+};
+
+var do_preview = function (row) {
+ var tid = row.find('> td a[href*="Display.html?id="]').first().attr('href').match(/Display\.html\?id=(\d+)/)[1];
+ var url = <% RT->Config->Get('WebPath') |n,j %> +'/Helpers/TicketPreview?id='+tid;
+ row.closest('table').children('tbody').children('tr').removeClass('in-preview');
+ row.addClass('in-preview');
+ jQuery('#ticket-preview-container').text(<% loc('Loading...') |n,j %>).load( url );
+};
+
+jQuery(document).ready(function() {
+ do_preview( get_ticket_row( jQuery('table.ticket-list tbody tr td').first() ) );
+});
+
+jQuery(function(){
+ jQuery('table.collection-as-table > tbody > tr > td').on('click', function (e) {
+ if (e.target.tagName != 'TD')
+ return;
+
+ var row = get_ticket_row(e.target);
+ do_preview(row);
+ });
+});
+</script>
+% } elsif ( RT::Handle::cmp_version($RT::VERSION, '5.0.0') < 0 ) {
% # RT 4 version
<style>
tr.in-preview td { background: #ffb }
commit 91bdfc16b6fb4389f8de1f5eb919ffd3b70553a3
Author: Brad Embree <brad at bestpractical.com>
Date: Thu Mar 9 09:43:23 2023 -0800
Move RT 4 code to AfterResults callback
The RT 5 code needs to be in the AfterResults callback in order to
manipulate the html. Moving the RT 4 code into the same callback
eliminates the need to use two different callbacks.
diff --git a/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/AfterResults b/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/AfterResults
index e69de29..7ae3d40 100644
--- a/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/AfterResults
+++ b/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/AfterResults
@@ -0,0 +1,97 @@
+% if ( RT::Handle::cmp_version($RT::VERSION, '5.0.0') < 0 ) {
+% # RT 4 version
+<style>
+tr.in-preview td { background: #ffb }
+% if ( RT->Config->Get('SideBySidePreview') ) {
+table.ticket-list, .ticket-list-with-previewinsearch {
+ position: fixed;
+ width: 42%;
+ top: 10em;
+ bottom: 6em;
+ overflow-y: auto;
+ overflow-x: hidden;
+ z-index: 11;
+}
+.refresh-with-previewinsearch {
+ position: fixed;
+ bottom: 0;
+}
+.paging-with-previewinsearch {
+ position: fixed;
+ bottom: 2.5em;
+}
+#ticket-preview-container {
+ position: fixed;
+ top: 10em;
+% if ( $web_style =~ /web2|ballard/ ) {
+ left: 54%;
+% }
+% else {
+ left: 47%;
+% }
+ right: 0;
+ bottom: 0;
+ overflow-y: auto;
+ background: inherit;
+ z-index: 10;
+ display: none;
+}
+% }
+</style>
+<div id="ticket-preview-container" ></div>
+<script type="text/javascript">
+var get_ticket_row = function (from) {
+ var row = jQuery(from).closest('tr');
+ var even_or_odd = row.hasClass('oddline')? 'evenline': 'oddline';
+ row = row.add(row.prevUntil('.'+even_or_odd, '[class*="line"]'))
+ .add(row.nextUntil('.'+even_or_odd, '[class*="line"]'));
+ return row;
+};
+var do_preview = function(row) {
+ var tid = row.find('> td a[href*="Display.html?id="]')
+ .first().attr('href').match(/Display\.html\?id=(\d+)/)[1];
+ var url = <% RT->Config->Get('WebPath') |n,j %> +'/Helpers/TicketPreview?id='+tid;
+ row.closest('table').children('tbody').children('tr').removeClass('in-preview');
+ row.addClass('in-preview');
+ jQuery('#ticket-preview-container').text(<% loc('Loading...') |n,j %>).load( url );
+% if ( RT->Config->Get('SideBySidePreview') ) {
+ var ticket_list = jQuery('table.ticket-list');
+ ticket_list.wrap( "<div class='ticket-list-with-previewinsearch'></div>" );
+ ticket_list.removeClass('ticket-list');
+ jQuery('#ticket-preview-container').show();
+ jQuery('div.refresh').addClass('refresh-with-previewinsearch');
+ jQuery('div.ticket-list-with-previewinsearch').animate({
+ scrollTop: '+='+(jQuery("tr.in-preview").offset().top-jQuery('div.ticket-list-with-previewinsearch').offset().top)
+ }, 1);
+ jQuery('div.paging').addClass('paging-with-previewinsearch');
+% } else {
+ jQuery('html, body').animate({
+ scrollTop: '+='+(jQuery("#ticket-preview-container").offset().top-jQuery(window).scrollTop())
+ }, 1000);
+% }
+};
+
+% if ( RT->Config->Get('SideBySidePreview') ) {
+jQuery(document).ready(function() {
+ do_preview( get_ticket_row( jQuery('table.ticket-list tbody tr td').first() ) );
+});
+% }
+
+jQuery(function(){
+ jQuery('table.collection-as-table > tbody > tr > td').on('click', function (e) {
+ if (e.target.tagName != 'TD')
+ return;
+
+ var row = get_ticket_row(e.target);
+ do_preview(row);
+ });
+});
+</script>
+% }
+<%ARGS>
+</%ARGS>
+<%INIT>
+my $web_style = $session{'CurrentUser'}
+ ? $session{'CurrentUser'}->Stylesheet
+ : RT->Config->Get('WebDefaultStylesheet');
+</%INIT>
diff --git a/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/BeforeResults b/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/BeforeResults
deleted file mode 100644
index eeb1162..0000000
--- a/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/BeforeResults
+++ /dev/null
@@ -1,94 +0,0 @@
-<style>
-tr.in-preview td { background: #ffb }
-% if ( RT->Config->Get('SideBySidePreview') ) {
-table.ticket-list, .ticket-list-with-previewinsearch {
- position: fixed;
- width: 42%;
- top: 10em;
- bottom: 6em;
- overflow-y: auto;
- overflow-x: hidden;
- z-index: 11;
-}
-.refresh-with-previewinsearch {
- position: fixed;
- bottom: 0;
-}
-.paging-with-previewinsearch {
- position: fixed;
- bottom: 2.5em;
-}
-#ticket-preview-container {
- position: fixed;
- top: 10em;
-% if ( $web_style =~ /web2|ballard/ ) {
- left: 54%;
-% }
-% else {
- left: 47%;
-% }
- right: 0;
- bottom: 0;
- overflow-y: auto;
- background: inherit;
- z-index: 10;
- display: none;
-}
-% }
-</style>
-<div id="ticket-preview-container" ></div>
-<script type="text/javascript">
-var get_ticket_row = function (from) {
- var row = jQuery(from).closest('tr');
- var even_or_odd = row.hasClass('oddline')? 'evenline': 'oddline';
- row = row.add(row.prevUntil('.'+even_or_odd, '[class*="line"]'))
- .add(row.nextUntil('.'+even_or_odd, '[class*="line"]'));
- return row;
-};
-var do_preview = function(row) {
- var tid = row.find('> td a[href*="Display.html?id="]')
- .first().attr('href').match(/Display\.html\?id=(\d+)/)[1];
- var url = <% RT->Config->Get('WebPath') |n,j %> +'/Helpers/TicketPreview?id='+tid;
- row.closest('table').children('tbody').children('tr').removeClass('in-preview');
- row.addClass('in-preview');
- jQuery('#ticket-preview-container').text(<% loc('Loading...') |n,j %>).load( url );
-% if ( RT->Config->Get('SideBySidePreview') ) {
- var ticket_list = jQuery('table.ticket-list');
- ticket_list.wrap( "<div class='ticket-list-with-previewinsearch'></div>" );
- ticket_list.removeClass('ticket-list');
- jQuery('#ticket-preview-container').show();
- jQuery('div.refresh').addClass('refresh-with-previewinsearch');
- jQuery('div.ticket-list-with-previewinsearch').animate({
- scrollTop: '+='+(jQuery("tr.in-preview").offset().top-jQuery('div.ticket-list-with-previewinsearch').offset().top)
- }, 1);
- jQuery('div.paging').addClass('paging-with-previewinsearch');
-% } else {
- jQuery('html, body').animate({
- scrollTop: '+='+(jQuery("#ticket-preview-container").offset().top-jQuery(window).scrollTop())
- }, 1000);
-% }
-};
-
-% if ( RT->Config->Get('SideBySidePreview') ) {
-jQuery(document).ready(function() {
- do_preview( get_ticket_row( jQuery('table.ticket-list tbody tr td').first() ) );
-});
-% }
-
-jQuery(function(){
- jQuery('table.collection-as-table > tbody > tr > td').on('click', function (e) {
- if (e.target.tagName != 'TD')
- return;
-
- var row = get_ticket_row(e.target);
- do_preview(row);
- });
-});
-</script>
-<%ARGS>
-</%ARGS>
-<%INIT>
-my $web_style = $session{'CurrentUser'}
- ? $session{'CurrentUser'}->Stylesheet
- : RT->Config->Get('WebDefaultStylesheet');
-</%INIT>
commit 289684d0bc6e35f273140a2b7d392ee92b291d11
Author: Brad Embree <brad at bestpractical.com>
Date: Thu Mar 9 09:34:26 2023 -0800
Use ScrollShowHistory if configured
diff --git a/html/Helpers/TicketPreview b/html/Helpers/TicketPreview
index 67d6cba..645cba4 100644
--- a/html/Helpers/TicketPreview
+++ b/html/Helpers/TicketPreview
@@ -12,6 +12,12 @@ my $web_path = RT->Config->Get('WebPath');
<h2><a href="<% $web_path %>/Ticket/Display.html?id=<% $ticket->id %>">#<% $ticket->id %>: <% $ticket->Subject %></a></h2>
</div>
% $m->callback(CallbackName => 'BeforeHistory', ARGSRef => \%ARGS, Ticket => $ticket);
+% my $ShowHistory = RT->Config->Get("ShowHistory", $session{'CurrentUser'});
+% if ($ShowHistory eq "scroll") {
+ <& /Ticket/Elements/ScrollShowHistory,
+ Ticket => $ticket,
+ &>
+% } else {
<& /Elements/ShowHistory,
Object => $ticket,
ShowDisplayModes => 0,
@@ -24,6 +30,7 @@ my $web_path = RT->Config->Get('WebPath');
EmailRecordPath => "$web_path/Ticket/ShowEmailRecord.html",
EncryptionPath => "$web_path/Ticket/Crypt.html",
&>
+% }
<script type="text/javascript">ReplaceUserReferences()</script>
% $m->callback(CallbackName => 'AfterHistory', ARGSRef => \%ARGS, Ticket => $ticket);
% $m->abort();
\ No newline at end of file
-----------------------------------------------------------------------
hooks/post-receive
--
RT-Extension-PreviewInSearch
More information about the Bps-public-commit
mailing list