[Bps-public-commit] RT-Extension-ReportSpam branch, rt4, created. e5ffcf185ec188a53ff97c876254af3fd3683c55
Thomas Sibley
trs at bestpractical.com
Tue Apr 2 01:51:55 EDT 2013
The branch, rt4 has been created
at e5ffcf185ec188a53ff97c876254af3fd3683c55 (commit)
- Log -----------------------------------------------------------------
commit 9af3b973d6d9c1001439ceac8d6a52d98f088742
Author: Thomas Sibley <trs at bestpractical.com>
Date: Mon Apr 1 17:43:32 2013 -0700
Prep for updates for RT 4.0 compat
RT 3.8 users should stick with version 0.03 of the plugin.
diff --git a/Changes b/Changes
index 83e37ba..bc3f872 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,8 @@
+0.10 Mon Apr 1 20:51:14 PDT 2013
+
+ * RT 4.0 compatibility. This release requires RT 4.0. Users of 3.8 should
+ not upgrade past version 0.03 of this extension.
+
0.03 2009-07-01
* new images for buttons
diff --git a/META.yml b/META.yml
index 1b1bbab..afd8012 100644
--- a/META.yml
+++ b/META.yml
@@ -1,13 +1,14 @@
---
-abstract: 'report a spam in one click in RT'
+abstract: 'mark tickets as spam with one click'
author:
- 'Ruslan Zakirov <Ruslan.Zakirov at gmail.com>'
build_requires:
- ExtUtils::MakeMaker: 6.42
+ ExtUtils::MakeMaker: 6.59
configure_requires:
- ExtUtils::MakeMaker: 6.42
+ ExtUtils::MakeMaker: 6.59
distribution_type: module
-generated_by: 'Module::Install version 0.99'
+dynamic_config: 1
+generated_by: 'Module::Install version 1.06'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -21,4 +22,4 @@ requires:
perl: 5.8.0
resources:
license: http://dev.perl.org/licenses/
-version: 0.03
+version: 0.10
diff --git a/Makefile.PL b/Makefile.PL
index bd48874..3036cf7 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -2,4 +2,6 @@ use inc::Module::Install;
RTx('RT-Extension-ReportSpam');
all_from 'lib/RT/Extension/ReportSpam.pm';
readme_from 'lib/RT/Extension/ReportSpam.pm';
+requires_rt("4.0.0");
+sign;
WriteAll();
diff --git a/README b/README
index 9096314..03f1c95 100644
--- a/README
+++ b/README
@@ -1,8 +1,8 @@
NAME
- RT::Extension::ReportSpam - report a spam in one click in RT
+ RT::Extension::ReportSpam - mark tickets as spam with one click
DESCRIPTION
- A simple extension that works with RT 3.6 and newer and allows users to
+ A simple extension that works with RT 4.0 and newer and allows users to
report a ticket as a spam message.
To find all tickets reported as spam you have to use query builder in
@@ -10,6 +10,10 @@ DESCRIPTION
HasAttribute = 'SpamReports'
+RT 3.8
+ Users of this extension on RT 3.8 should not upgrade past version 0.03
+ of this extension.
+
AUTHOR
Ruslan Zakirov <Ruslan.Zakirov at gmail.com>
diff --git a/inc/Module/Install.pm b/inc/Module/Install.pm
index af32a30..4ecf46b 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 = '0.99';
+ $VERSION = '1.06';
# Storage for the pseudo-singleton
$MAIN = undef;
@@ -230,8 +230,12 @@ sub preload {
sub new {
my ($class, %args) = @_;
- delete $INC{'FindBin.pm'};
- require FindBin;
+ delete $INC{'FindBin.pm'};
+ {
+ # to suppress the redefine warning
+ local $SIG{__WARN__} = sub {};
+ require FindBin;
+ }
# ignore the prefix on extension modules built from top level.
my $base_path = Cwd::abs_path($FindBin::Bin);
@@ -447,7 +451,7 @@ sub _version ($) {
}
sub _cmp ($$) {
- _version($_[0]) <=> _version($_[1]);
+ _version($_[1]) <=> _version($_[2]);
}
# Cloned from Params::Util::_CLASS
@@ -463,4 +467,4 @@ sub _CLASS ($) {
1;
-# Copyright 2008 - 2010 Adam Kennedy.
+# Copyright 2008 - 2012 Adam Kennedy.
diff --git a/inc/Module/Install/Base.pm b/inc/Module/Install/Base.pm
index c86c197..802844a 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 = '0.99';
+ $VERSION = '1.06';
}
# Suspend handler for "redefined" warnings
diff --git a/inc/Module/Install/Can.pm b/inc/Module/Install/Can.pm
index 994dd3f..22167b8 100644
--- a/inc/Module/Install/Can.pm
+++ b/inc/Module/Install/Can.pm
@@ -3,13 +3,12 @@ package Module::Install::Can;
use strict;
use Config ();
-use File::Spec ();
use ExtUtils::MakeMaker ();
use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.99';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -29,7 +28,7 @@ sub can_use {
eval { require $mod; $pkg->VERSION($ver || 0); 1 };
}
-# check if we can run some command
+# Check if we can run some command
sub can_run {
my ($self, $cmd) = @_;
@@ -38,14 +37,88 @@ sub can_run {
for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') {
next if $dir eq '';
- my $abs = File::Spec->catfile($dir, $_[1]);
+ require File::Spec;
+ my $abs = File::Spec->catfile($dir, $cmd);
return $abs if (-x $abs or $abs = MM->maybe_command($abs));
}
return;
}
-# can we locate a (the) C compiler
+# Can our C compiler environment build XS files
+sub can_xs {
+ my $self = shift;
+
+ # Ensure we have the CBuilder module
+ $self->configure_requires( 'ExtUtils::CBuilder' => 0.27 );
+
+ # Do we have the configure_requires checker?
+ local $@;
+ eval "require ExtUtils::CBuilder;";
+ if ( $@ ) {
+ # They don't obey configure_requires, so it is
+ # someone old and delicate. Try to avoid hurting
+ # them by falling back to an older simpler test.
+ return $self->can_cc();
+ }
+
+ # Do we have a working C compiler
+ my $builder = ExtUtils::CBuilder->new(
+ quiet => 1,
+ );
+ unless ( $builder->have_compiler ) {
+ # No working C compiler
+ return 0;
+ }
+
+ # Write a C file representative of what XS becomes
+ require File::Temp;
+ my ( $FH, $tmpfile ) = File::Temp::tempfile(
+ "compilexs-XXXXX",
+ SUFFIX => '.c',
+ );
+ binmode $FH;
+ print $FH <<'END_C';
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+int main(int argc, char **argv) {
+ return 0;
+}
+
+int boot_sanexs() {
+ return 1;
+}
+
+END_C
+ close $FH;
+
+ # Can the C compiler access the same headers XS does
+ my @libs = ();
+ my $object = undef;
+ eval {
+ local $^W = 0;
+ $object = $builder->compile(
+ source => $tmpfile,
+ );
+ @libs = $builder->link(
+ objects => $object,
+ module_name => 'sanexs',
+ );
+ };
+ my $result = $@ ? 0 : 1;
+
+ # Clean up all the build files
+ foreach ( $tmpfile, $object, @libs ) {
+ next unless defined $_;
+ 1 while unlink;
+ }
+
+ return $result;
+}
+
+# Can we locate a (the) C compiler
sub can_cc {
my $self = shift;
my @chunks = split(/ /, $Config::Config{cc}) or return;
@@ -78,4 +151,4 @@ if ( $^O eq 'cygwin' ) {
__END__
-#line 156
+#line 236
diff --git a/inc/Module/Install/Fetch.pm b/inc/Module/Install/Fetch.pm
index df357b2..bee0c4f 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 = '0.99';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Makefile.pm b/inc/Module/Install/Makefile.pm
index a3536a4..7052f36 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 = '0.99';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -215,18 +215,22 @@ sub write {
require ExtUtils::MakeMaker;
if ( $perl_version and $self->_cmp($perl_version, '5.006') >= 0 ) {
- # MakeMaker can complain about module versions that include
- # an underscore, even though its own version may contain one!
- # Hence the funny regexp to get rid of it. See RT #35800
- # for details.
- my $v = $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/;
- $self->build_requires( 'ExtUtils::MakeMaker' => $v );
- $self->configure_requires( 'ExtUtils::MakeMaker' => $v );
+ # This previous attempted to inherit the version of
+ # ExtUtils::MakeMaker in use by the module author, but this
+ # was found to be untenable as some authors build releases
+ # using future dev versions of EU:MM that nobody else has.
+ # Instead, #toolchain suggests we use 6.59 which is the most
+ # stable version on CPAN at time of writing and is, to quote
+ # ribasushi, "not terminally fucked, > and tested enough".
+ # TODO: We will now need to maintain this over time to push
+ # the version up as new versions are released.
+ $self->build_requires( 'ExtUtils::MakeMaker' => 6.59 );
+ $self->configure_requires( 'ExtUtils::MakeMaker' => 6.59 );
} else {
# Allow legacy-compatibility with 5.005 by depending on the
# most recent EU:MM that supported 5.005.
- $self->build_requires( 'ExtUtils::MakeMaker' => 6.42 );
- $self->configure_requires( 'ExtUtils::MakeMaker' => 6.42 );
+ $self->build_requires( 'ExtUtils::MakeMaker' => 6.36 );
+ $self->configure_requires( 'ExtUtils::MakeMaker' => 6.36 );
}
# Generate the MakeMaker params
@@ -241,7 +245,6 @@ in a module, and provide its file path via 'version_from' (or
'all_from' if you prefer) in Makefile.PL.
EOT
- $DB::single = 1;
if ( $self->tests ) {
my @tests = split ' ', $self->tests;
my %seen;
@@ -412,4 +415,4 @@ sub postamble {
__END__
-#line 541
+#line 544
diff --git a/inc/Module/Install/Metadata.pm b/inc/Module/Install/Metadata.pm
index bdeb367..58430f3 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 = '0.99';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -151,15 +151,21 @@ sub install_as_site { $_[0]->installdirs('site') }
sub install_as_vendor { $_[0]->installdirs('vendor') }
sub dynamic_config {
- my $self = shift;
- unless ( @_ ) {
- warn "You MUST provide an explicit true/false value to dynamic_config\n";
- return $self;
+ my $self = shift;
+ my $value = @_ ? shift : 1;
+ if ( $self->{values}->{dynamic_config} ) {
+ # Once dynamic we never change to static, for safety
+ return 0;
}
- $self->{values}->{dynamic_config} = $_[0] ? 1 : 0;
+ $self->{values}->{dynamic_config} = $value ? 1 : 0;
return 1;
}
+# Convenience command
+sub static_config {
+ shift->dynamic_config(0);
+}
+
sub perl_version {
my $self = shift;
return $self->{values}->{perl_version} unless @_;
@@ -170,7 +176,7 @@ sub perl_version {
# Normalize the version
$version = $self->_perl_version($version);
- # We don't support the reall old versions
+ # We don't support the really old versions
unless ( $version >= 5.005 ) {
die "Module::Install only supports 5.005 or newer (use ExtUtils::MakeMaker)\n";
}
@@ -515,6 +521,7 @@ sub __extract_license {
'GNU Free Documentation license' => 'unrestricted', 1,
'GNU Affero General Public License' => 'open_source', 1,
'(?:Free)?BSD license' => 'bsd', 1,
+ 'Artistic license 2\.0' => 'artistic_2', 1,
'Artistic license' => 'artistic', 1,
'Apache (?:Software )?license' => 'apache', 1,
'GPL' => 'gpl', 1,
@@ -550,9 +557,9 @@ sub license_from {
sub _extract_bugtracker {
my @links = $_[0] =~ m#L<(
- \Qhttp://rt.cpan.org/\E[^>]+|
- \Qhttp://github.com/\E[\w_]+/[\w_]+/issues|
- \Qhttp://code.google.com/p/\E[\w_\-]+/issues/list
+ https?\Q://rt.cpan.org/\E[^>]+|
+ https?\Q://github.com/\E[\w_]+/[\w_]+/issues|
+ https?\Q://code.google.com/p/\E[\w_\-]+/issues/list
)>#gx;
my %links;
@links{@links}=();
@@ -581,7 +588,7 @@ sub bugtracker_from {
sub requires_from {
my $self = shift;
my $content = Module::Install::_readperl($_[0]);
- my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+([\d\.]+)/mg;
+ my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+(v?[\d\.]+)/mg;
while ( @requires ) {
my $module = shift @requires;
my $version = shift @requires;
diff --git a/inc/Module/Install/RTx.pm b/inc/Module/Install/RTx.pm
index b780a6c..abf6aea 100644
--- a/inc/Module/Install/RTx.pm
+++ b/inc/Module/Install/RTx.pm
@@ -8,13 +8,13 @@ no warnings 'once';
use Module::Install::Base;
use base 'Module::Install::Base';
-our $VERSION = '0.25';
+our $VERSION = '0.30';
use FindBin;
use File::Glob ();
use File::Basename ();
-my @DIRS = qw(etc lib html bin sbin po var);
+my @DIRS = qw(etc lib html static bin sbin po var);
my @INDEX_DIRS = qw(lib bin sbin);
sub RTx {
@@ -44,8 +44,8 @@ sub RTx {
local @INC = (
$ENV{RTHOME} ? ( $ENV{RTHOME}, "$ENV{RTHOME}/lib" ) : (),
@INC,
- map { ( "$_/rt3/lib", "$_/lib/rt3", "$_/lib" ) } grep $_,
- @prefixes
+ map { ( "$_/rt4/lib", "$_/lib/rt4", "$_/rt3/lib", "$_/lib/rt3", "$_/lib" )
+ } grep $_, @prefixes
);
until ( eval { require RT; $RT::LocalPath } ) {
warn
@@ -60,11 +60,13 @@ sub RTx {
my $local_lib_path = "$RT::LocalPath/lib";
print "Using RT configuration from $INC{'RT.pm'}:\n";
unshift @INC, "$RT::LocalPath/lib" if $RT::LocalPath;
+ unshift @INC, $lib_path;
- $RT::LocalVarPath ||= $RT::VarPath;
- $RT::LocalPoPath ||= $RT::LocalLexiconPath;
- $RT::LocalHtmlPath ||= $RT::MasonComponentRoot;
- $RT::LocalLibPath ||= "$RT::LocalPath/lib";
+ $RT::LocalVarPath ||= $RT::VarPath;
+ $RT::LocalPoPath ||= $RT::LocalLexiconPath;
+ $RT::LocalHtmlPath ||= $RT::MasonComponentRoot;
+ $RT::LocalStaticPath ||= $RT::StaticPath;
+ $RT::LocalLibPath ||= "$RT::LocalPath/lib";
my $with_subdirs = $ENV{WITH_SUBDIRS};
@ARGV = grep { /WITH_SUBDIRS=(.*)/ ? ( ( $with_subdirs = $1 ), 0 ) : 1 }
@@ -128,18 +130,7 @@ install ::
my %has_etc;
if ( File::Glob::bsd_glob("$FindBin::Bin/etc/schema.*") ) {
-
- # got schema, load factory module
$has_etc{schema}++;
- $self->load('RTxFactory');
- $self->postamble(<< ".");
-factory ::
-\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxFactory(qw($RTx $name))"
-
-dropdb ::
-\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxFactory(qw($RTx $name drop))"
-
-.
}
if ( File::Glob::bsd_glob("$FindBin::Bin/etc/acl.*") ) {
$has_etc{acl}++;
@@ -163,30 +154,59 @@ dropdb ::
print "For first-time installation, type 'make initdb'.\n";
my $initdb = '';
$initdb .= <<"." if $has_etc{schema};
-\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(schema))"
+\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(schema \$(NAME) \$(VERSION)))"
.
$initdb .= <<"." if $has_etc{acl};
-\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(acl))"
+\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(acl \$(NAME) \$(VERSION)))"
.
$initdb .= <<"." if $has_etc{initialdata};
-\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(insert))"
+\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(insert \$(NAME) \$(VERSION)))"
.
$self->postamble("initdb ::\n$initdb\n");
$self->postamble("initialize-database ::\n$initdb\n");
}
}
-sub RTxInit {
- unshift @INC, substr( delete( $INC{'RT.pm'} ), 0, -5 ) if $INC{'RT.pm'};
- require RT;
- RT::LoadConfig();
- RT::ConnectToDatabase();
+# stolen from RT::Handle so we work on 3.6 (cmp_versions came in with 3.8)
+{ my %word = (
+ a => -4,
+ alpha => -4,
+ b => -3,
+ beta => -3,
+ pre => -2,
+ rc => -1,
+ head => 9999,
+);
+sub cmp_version($$) {
+ my ($a, $b) = (@_);
+ my @a = grep defined, map { /^[0-9]+$/? $_ : /^[a-zA-Z]+$/? $word{$_}|| -10 : undef }
+ split /([^0-9]+)/, $a;
+ my @b = grep defined, map { /^[0-9]+$/? $_ : /^[a-zA-Z]+$/? $word{$_}|| -10 : undef }
+ split /([^0-9]+)/, $b;
+ @a > @b
+ ? push @b, (0) x (@a- at b)
+ : push @a, (0) x (@b- at a);
+ for ( my $i = 0; $i < @a; $i++ ) {
+ return $a[$i] <=> $b[$i] if $a[$i] <=> $b[$i];
+ }
+ return 0;
+}}
+sub requires_rt {
+ my ($self,$version) = @_;
+
+ # if we're exactly the same version as what we want, silently return
+ return if ($version eq $RT::VERSION);
- die "Cannot load RT" unless $RT::Handle and $RT::DatabaseType;
+ my @sorted = sort cmp_version $version,$RT::VERSION;
+
+ if ($sorted[-1] eq $version) {
+ # should we die?
+ warn "\nWarning: prerequisite RT $version not found. Your installed version of RT ($RT::VERSION) is too old.\n\n";
+ }
}
1;
__END__
-#line 303
+#line 329
diff --git a/inc/Module/Install/ReadmeFromPod.pm b/inc/Module/Install/ReadmeFromPod.pm
index d5d89f4..6a80818 100644
--- a/inc/Module/Install/ReadmeFromPod.pm
+++ b/inc/Module/Install/ReadmeFromPod.pm
@@ -1,36 +1,138 @@
#line 1
package Module::Install::ReadmeFromPod;
+use 5.006;
use strict;
use warnings;
use base qw(Module::Install::Base);
use vars qw($VERSION);
-$VERSION = '0.08';
+$VERSION = '0.20';
sub readme_from {
my $self = shift;
- return unless $Module::Install::AUTHOR;
- my $file = shift || return;
- my $clean = shift;
- require Pod::Text;
- my $parser = Pod::Text->new();
- open README, '> README' or die "$!\n";
- $parser->output_fh( *README );
- $parser->parse_file( $file );
- return 1 unless $clean;
- $self->postamble(<<"END");
-distclean :: license_clean
-
-license_clean:
-\t\$(RM_F) README
-END
+ return unless $self->is_admin;
+
+ # Input file
+ my $in_file = shift || $self->_all_from
+ or die "Can't determine file to make readme_from";
+
+ # Get optional arguments
+ my ($clean, $format, $out_file, $options);
+ my $args = shift;
+ if ( ref $args ) {
+ # Arguments are in a hashref
+ if ( ref($args) ne 'HASH' ) {
+ die "Expected a hashref but got a ".ref($args)."\n";
+ } else {
+ $clean = $args->{'clean'};
+ $format = $args->{'format'};
+ $out_file = $args->{'output_file'};
+ $options = $args->{'options'};
+ }
+ } else {
+ # Arguments are in a list
+ $clean = $args;
+ $format = shift;
+ $out_file = shift;
+ $options = \@_;
+ }
+
+ # Default values;
+ $clean ||= 0;
+ $format ||= 'txt';
+
+ # Generate README
+ print "readme_from $in_file to $format\n";
+ if ($format =~ m/te?xt/) {
+ $out_file = $self->_readme_txt($in_file, $out_file, $options);
+ } elsif ($format =~ m/html?/) {
+ $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 'pdf') {
+ $out_file = $self->_readme_pdf($in_file, $out_file, $options);
+ }
+
+ if ($clean) {
+ $self->clean_files($out_file);
+ }
+
return 1;
}
+
+sub _readme_txt {
+ my ($self, $in_file, $out_file, $options) = @_;
+ $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";
+ $parser->output_fh( *$out_fh );
+ $parser->parse_file( $in_file );
+ close $out_fh;
+ return $out_file;
+}
+
+
+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,
+ );
+ # Remove temporary files if needed
+ for my $file ('pod2htmd.tmp', 'pod2htmi.tmp') {
+ if (-e $file) {
+ unlink $file or warn "Warning: Could not remove file '$file'.\n$!\n";
+ }
+ }
+ return $out_file;
+}
+
+
+sub _readme_man {
+ my ($self, $in_file, $out_file, $options) = @_;
+ $out_file ||= 'README.1';
+ require Pod::Man;
+ my $parser = Pod::Man->new( @$options );
+ $parser->parse_from_file($in_file, $out_file);
+ return $out_file;
+}
+
+
+sub _readme_pdf {
+ my ($self, $in_file, $out_file, $options) = @_;
+ $out_file ||= 'README.pdf';
+ eval { require App::pod2pdf; }
+ 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;
+ return $out_file;
+}
+
+
+sub _all_from {
+ my $self = shift;
+ return unless $self->admin->{extensions};
+ my ($metadata) = grep {
+ ref($_) eq 'Module::Install::Metadata';
+ } @{$self->admin->{extensions}};
+ return unless $metadata;
+ return $metadata->{values}{all_from} || '';
+}
+
'Readme!';
__END__
-#line 89
+#line 254
diff --git a/inc/Module/Install/Win32.pm b/inc/Module/Install/Win32.pm
index a9417aa..eeaa3fe 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 = '0.99';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/WriteAll.pm b/inc/Module/Install/WriteAll.pm
index 75a089f..85d8018 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 = '0.99';
+ $VERSION = '1.06';
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
diff --git a/lib/RT/Extension/ReportSpam.pm b/lib/RT/Extension/ReportSpam.pm
index 86e32ea..db338be 100644
--- a/lib/RT/Extension/ReportSpam.pm
+++ b/lib/RT/Extension/ReportSpam.pm
@@ -4,7 +4,7 @@ use 5.008;
use strict;
use warnings;
-our $VERSION = '0.03';
+our $VERSION = '0.10';
=head1 NAME
@@ -12,7 +12,7 @@ RT::Extension::ReportSpam - mark tickets as spam with one click
=head1 DESCRIPTION
-A simple extension that works with RT 3.6 and newer and allows users
+A simple extension that works with RT 4.0 and newer and allows users
to report a ticket as a spam message.
To find all tickets reported as spam you have to use query builder in
@@ -20,6 +20,11 @@ advanced mode with the following query:
HasAttribute = 'SpamReports'
+=head1 RT 3.8
+
+Users of this extension on RT 3.8 should not upgrade past version 0.03 of this
+extension.
+
=cut
require RT::Tickets;
commit c9a1c89cbeed1af013a5cbda6dcd0bd302a7b49e
Author: Thomas Sibley <trs at bestpractical.com>
Date: Mon Apr 1 17:45:04 2013 -0700
Properly escape JS
diff --git a/html/Ticket/Elements/ReportSpam b/html/Ticket/Elements/ReportSpam
index 394b132..a7f288b 100644
--- a/html/Ticket/Elements/ReportSpam
+++ b/html/Ticket/Elements/ReportSpam
@@ -1,6 +1,6 @@
<span id="toggle-ticket-spam-<% $id %>">
% my $url = $RT::WebPath ."/Helpers/Toggle/TicketSpam?id=". $id;
-<a align="right" href="<% $url %>" onclick="ahah('<% $url |n %>', 'toggle-ticket-spam-<% $id |n %>'); return false;" >
+<a align="right" href="<% $url %>" onclick="ahah(<% $url |j %>, 'toggle-ticket-spam-'+<% $id |j %>); return false;" >
% if ( $reported ) {
<img src="<% $RT::WebPath %>/NoAuth/images/spam.png" alt="<% loc('Not Spam') %>" style="border-style: none;" />
% } else {
commit 3fd324411c1c30903cd4adcff36dc7aa20fde46a
Author: Thomas Sibley <trs at bestpractical.com>
Date: Mon Apr 1 20:46:44 2013 -0700
Switch to the RT 4 menuing system
diff --git a/html/Callbacks/RT-Extension-ReportSpam/Elements/Tabs/Privileged b/html/Callbacks/RT-Extension-ReportSpam/Elements/Tabs/Privileged
new file mode 100644
index 0000000..71d28da
--- /dev/null
+++ b/html/Callbacks/RT-Extension-ReportSpam/Elements/Tabs/Privileged
@@ -0,0 +1,39 @@
+<%init>
+sub build_spam_menu {
+ my $menu = shift;
+ $menu->child(
+ "recent",
+ title => loc('Recent'),
+ path => '/Tools/Spam/Recent.html',
+ );
+ $menu->child(
+ "reported",
+ title => loc('Reported'),
+ path => '/Tools/Spam/Reported.html',
+ );
+ return $menu;
+}
+
+if (my $tools = Menu->child("tools")) {
+ my $spam = $tools->child(
+ "spam",
+ title => loc("Spam"),
+ path => "/Tools/Spam/",
+ );
+ build_spam_menu($spam);
+}
+
+my $request_path = $HTML::Mason::Commands::r->path_info;
+ $request_path =~ s!/{2,}!/!g;
+
+if ($request_path =~ m{^/Ticket/} and my $id = $DECODED_ARGS->{id}) {
+ PageMenu->child(
+ "report-spam",
+ title => "Spam",
+ raw_html => $m->scomp("/Ticket/Elements/ReportSpam", id => $id),
+ );
+}
+elsif ($request_path =~ m{^/Tools/Spam/}) {
+ build_spam_menu( PageMenu() );
+}
+</%init>
diff --git a/html/Callbacks/RT-Extension-ReportSpam/Ticket/Elements/Tabs/Default b/html/Callbacks/RT-Extension-ReportSpam/Ticket/Elements/Tabs/Default
deleted file mode 100644
index 94ef7a6..0000000
--- a/html/Callbacks/RT-Extension-ReportSpam/Ticket/Elements/Tabs/Default
+++ /dev/null
@@ -1,12 +0,0 @@
-<%ARGS>
-$Ticket => undef
-$actions => {}
-</%ARGS>
-<%INIT>
-return unless $Ticket;
-
-$actions->{'_SS'} = {
- html => $m->scomp( '/Ticket/Elements/ReportSpam', id => $Ticket->id ),
-};
-
-</%INIT>
diff --git a/html/Callbacks/RT-Extension-ReportSpam/Tools/Elements/Tabs/Default b/html/Callbacks/RT-Extension-ReportSpam/Tools/Elements/Tabs/Default
deleted file mode 100644
index ebd0509..0000000
--- a/html/Callbacks/RT-Extension-ReportSpam/Tools/Elements/Tabs/Default
+++ /dev/null
@@ -1,9 +0,0 @@
-<%ARGS>
-$tabs => {}
-</%ARGS>
-<%INIT>
-$tabs->{'e'} = {
- title => loc('Spam'),
- path => 'Tools/Spam/',
-},
-</%INIT>
diff --git a/html/Tools/Spam/Elements/Tabs b/html/Tools/Spam/Elements/Tabs
deleted file mode 100644
index 934c0ce..0000000
--- a/html/Tools/Spam/Elements/Tabs
+++ /dev/null
@@ -1,39 +0,0 @@
-<& /Tools/Elements/Tabs,
- current_tab => 'Tools/Spam/',
- subtabs => $tabs,
- current_subtab => $current_tab,
- Title => $Title,
-&>
-
-
-<%INIT>
-my $tabs = {
- a => {
- title => loc('Recent'),
- path => 'Tools/Spam/Recent.html',
- },
- b => {
- title => loc('Reported'),
- path => 'Tools/Spam/Reported.html',
- },
-};
-
-$m->callback( %ARGS, tabs => $tabs );
-
-if ( $subtabs ) {
- foreach my $tab ( values %{$tabs} ) {
- next unless $tab->{'path'} eq $current_tab;
-
- $tab->{"subtabs"} = $subtabs;
- $tab->{"current_subtab"} = $current_subtab;
- }
-}
-</%INIT>
-<%ARGS>
-$current_tab => undef
-
-$subtabs => undef
-$current_subtab => undef
-
-$Title => undef
-</%ARGS>
diff --git a/html/Tools/Spam/Recent.html b/html/Tools/Spam/Recent.html
index 8ec351a..54ac555 100644
--- a/html/Tools/Spam/Recent.html
+++ b/html/Tools/Spam/Recent.html
@@ -1,8 +1,5 @@
-<& /Elements/Header, Title => $title &>
-<& /Tools/Spam/Elements/Tabs,
- Title => $title,
- current_tab => "Tools/Spam/Recent.html",
-&>
+<& /Elements/Header, Title => loc("Recently created tickets") &>
+<& /Elements/Tabs &>
<& /Elements/ListActions, actions => \@results &>
@@ -33,7 +30,6 @@ my $Query =
.' AND Owner = "Nobody"'
.' AND HasNoAttribute= "SpamReports"';
-my $title = loc('Recently created tickets');
my @results;
$Format ||= qq{
diff --git a/html/Tools/Spam/Reported.html b/html/Tools/Spam/Reported.html
index d6d81fb..6b0ae2b 100644
--- a/html/Tools/Spam/Reported.html
+++ b/html/Tools/Spam/Reported.html
@@ -1,8 +1,5 @@
-<& /Elements/Header, Title => $title &>
-<& /Tools/Spam/Elements/Tabs,
- Title => $title,
- current_tab => "Tools/Spam/Reported.html",
-&>
+<& /Elements/Header, Title => loc("Reported tickets") &>
+<& /Elements/Tabs &>
<& /Elements/ListActions, actions => \@results &>
@@ -30,8 +27,6 @@ $Format => undef
</%ARGS>
<%INIT>
my $Query = 'HasAttribute = "SpamReports"';
-
-my $title = loc('Recently created tickets');
my @results;
$Format ||= qq{
diff --git a/html/Tools/Spam/index.html b/html/Tools/Spam/index.html
index 79d603f..022881f 100644
--- a/html/Tools/Spam/index.html
+++ b/html/Tools/Spam/index.html
@@ -1,12 +1,6 @@
-<& /Elements/Header, Title => $title &>
-<& /Tools/Spam/Elements/Tabs,
- Title => $title,
- current_tab => "Tools/Spam/",
-&>
+<& /Elements/Header, Title => loc("Spam handling") &>
+<& /Elements/Tabs &>
<p>
-<% loc('You can either <a href="Recent.html">review recenlty</a> created tickets or <a href="Reported.html">review reported</a> tickets that are still not deleted.') |n %>
+<&|/l_unsafe, '<a href="Recent.html">', '<a href="Reported.html">', '</a>' &>You can either review [_1]recently created[_3] tickets or [_2]all reported[_3] tickets that are still not deleted.</&>
</p>
-<%INIT>
-my $title = loc("Spam handling");
-</%INIT>
commit ecc675174c229e404ae32450d4e0299b82542730
Author: Thomas Sibley <trs at bestpractical.com>
Date: Mon Apr 1 20:47:32 2013 -0700
Grammar typo
diff --git a/html/Tools/Spam/Reported.html b/html/Tools/Spam/Reported.html
index 6b0ae2b..9b6cab8 100644
--- a/html/Tools/Spam/Reported.html
+++ b/html/Tools/Spam/Reported.html
@@ -4,7 +4,7 @@
<& /Elements/ListActions, actions => \@results &>
<p>
-<% loc('Tickets reported as spam by other without rights to delete tickets.') %>
+<% loc('Tickets reported as spam by others without rights to delete tickets.') %>
<% loc('Confirm by clicking "S".') %>
<% loc('If you have rights to delete tickets then they will be deleted.') %>
</p>
commit 08f0a15f120300d506179d173d0a8a90841dbb53
Author: Thomas Sibley <trs at bestpractical.com>
Date: Mon Apr 1 20:50:59 2013 -0700
A reasonable gitignore
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..aeec327
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,14 @@
+Makefile
+Makefile.bak
+Makefile.old
+Makefile.new
+pm_to_blib
+blib/
+MANIFEST.bak
+MANIFEST.new
+MANIFEST.old
+cover_db/
+nytprof/
+*.tar.gz
+*.sw[po]
+/inc/.author
commit e5ffcf185ec188a53ff97c876254af3fd3683c55
Author: Thomas Sibley <trs at bestpractical.com>
Date: Mon Apr 1 22:48:06 2013 -0700
Switch from $RT:: to RT-> style accessors
diff --git a/html/Ticket/Elements/ReportSpam b/html/Ticket/Elements/ReportSpam
index a7f288b..6a3c055 100644
--- a/html/Ticket/Elements/ReportSpam
+++ b/html/Ticket/Elements/ReportSpam
@@ -1,10 +1,10 @@
<span id="toggle-ticket-spam-<% $id %>">
-% my $url = $RT::WebPath ."/Helpers/Toggle/TicketSpam?id=". $id;
+% my $url = RT->Config->Get("WebPath") ."/Helpers/Toggle/TicketSpam?id=". $id;
<a align="right" href="<% $url %>" onclick="ahah(<% $url |j %>, 'toggle-ticket-spam-'+<% $id |j %>); return false;" >
% if ( $reported ) {
-<img src="<% $RT::WebPath %>/NoAuth/images/spam.png" alt="<% loc('Not Spam') %>" style="border-style: none;" />
+<img src="<% RT->Config->Get("WebPath") %>/NoAuth/images/spam.png" alt="<% loc('Not Spam') %>" style="border-style: none;" />
% } else {
-<img src="<% $RT::WebPath %>/NoAuth/images/empty_spam.png" alt="<% loc('Report Spam') %>" style="border-style: none;" />
+<img src="<% RT->Config->Get("WebPath") %>/NoAuth/images/empty_spam.png" alt="<% loc('Report Spam') %>" style="border-style: none;" />
% }
</a>
</span>
@@ -34,27 +34,27 @@ if ( $Toggle ) {
if ( @$reports ) {
if ( $ticket->CurrentUserHasRight('DeleteTicket') ) {
my ($status, $msg) = $ticket->SetStatus('deleted');
- $RT::Logger->error("Couldn't delete ticket: $msg")
+ RT->Logger->error("Couldn't delete ticket: $msg")
unless $status;
}
my ($status, $msg) = $ticket->SetAttribute(
Name => 'SpamReports',
Content => $reports,
);
- $RT::Logger->error("Couldn't set attribute: $msg")
+ RT->Logger->error("Couldn't set attribute: $msg")
unless $status;
} else {
if ( $ticket->Status eq 'deleted'
&& $ticket->CurrentUserHasRight('ModifyTicket')
) {
my ($status, $msg) = $ticket->SetStatus('open');
- $RT::Logger->error("Couldn't delete ticket: $msg")
+ RT->Logger->error("Couldn't delete ticket: $msg")
unless $status;
}
my ($status, $msg) = $ticket->DeleteAttribute(
'SpamReports'
);
- $RT::Logger->error("Couldn't delete attribute: $msg")
+ RT->Logger->error("Couldn't delete attribute: $msg")
unless $status;
}
$reported = !$reported;
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list