pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/www/p5-Apache-Gallery Make this work w/ Apache2 (and a...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/421eeb8e5fcc
branches:  trunk
changeset: 511526:421eeb8e5fcc
user:      kim <kim%pkgsrc.org@localhost>
date:      Sun Apr 16 14:19:25 2006 +0000

description:
Make this work w/ Apache2 (and ap2-perl).

Remove some HTML output from the code that should be controlled only by
the templates ('&nbsp;' when no navigation, extra '<br>' elements).

Add controls for directory separator in menus and the text labels for
the navigation elements.

diffstat:

 www/p5-Apache-Gallery/Makefile         |    7 +-
 www/p5-Apache-Gallery/distinfo         |    4 +-
 www/p5-Apache-Gallery/patches/patch-aa |  306 ++++++++++++++++++++++++++++++++-
 3 files changed, 306 insertions(+), 11 deletions(-)

diffs (truncated from 375 to 300 lines):

diff -r 8bb6c73232f6 -r 421eeb8e5fcc www/p5-Apache-Gallery/Makefile
--- a/www/p5-Apache-Gallery/Makefile    Sun Apr 16 12:12:47 2006 +0000
+++ b/www/p5-Apache-Gallery/Makefile    Sun Apr 16 14:19:25 2006 +0000
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.33 2006/02/05 23:11:27 joerg Exp $
+# $NetBSD: Makefile,v 1.34 2006/04/16 14:19:25 kim Exp $
 #
 
 DISTNAME=      Apache-Gallery-0.9.1
 PKGNAME=       p5-${DISTNAME}
-PKGREVISION=   3
+PKGREVISION=   5
 SVR4_PKGNAME=  p5aga
 CATEGORIES=    www graphics perl5
 MASTER_SITES=  ${MASTER_SITE_PERL_CPAN:=Apache/}
@@ -66,6 +66,9 @@
        @${MV} -f ${WRKSRC}/templates/new/gallery.css \
            ${WRKSRC}/htdocs/gallery-new.css
 
+pre-configure:
+       @${RM} -f ${WRKSRC}/lib/Apache/Gallery.pm.orig
+
 post-build:
        @for j in default new; \
        do \
diff -r 8bb6c73232f6 -r 421eeb8e5fcc www/p5-Apache-Gallery/distinfo
--- a/www/p5-Apache-Gallery/distinfo    Sun Apr 16 12:12:47 2006 +0000
+++ b/www/p5-Apache-Gallery/distinfo    Sun Apr 16 14:19:25 2006 +0000
@@ -1,6 +1,6 @@
-$NetBSD: distinfo,v 1.7 2005/02/24 14:08:35 wiz Exp $
+$NetBSD: distinfo,v 1.8 2006/04/16 14:19:25 kim Exp $
 
 SHA1 (Apache-Gallery-0.9.1.tar.gz) = e818c89d2b9a6d1aa63bacf149c4a259e6323284
 RMD160 (Apache-Gallery-0.9.1.tar.gz) = 015f9921520c5c3fe382b5e3b7d358b96ddd4be7
 Size (Apache-Gallery-0.9.1.tar.gz) = 82230 bytes
-SHA1 (patch-aa) = b1f3de71ecdfdc320288c8a70bc1817da22845e3
+SHA1 (patch-aa) = ba3246c428255c752fe2a3877072cf4de0f6c86d
diff -r 8bb6c73232f6 -r 421eeb8e5fcc www/p5-Apache-Gallery/patches/patch-aa
--- a/www/p5-Apache-Gallery/patches/patch-aa    Sun Apr 16 12:12:47 2006 +0000
+++ b/www/p5-Apache-Gallery/patches/patch-aa    Sun Apr 16 14:19:25 2006 +0000
@@ -1,7 +1,114 @@
-$NetBSD: patch-aa,v 1.6 2005/01/23 18:26:39 kim Exp $
+$NetBSD: patch-aa,v 1.7 2006/04/16 14:19:25 kim Exp $
 
---- lib/Apache/Gallery.pm.orig 2005-01-23 12:02:39.000000000 -0500
-+++ lib/Apache/Gallery.pm      2005-01-23 12:06:13.000000000 -0500
+--- lib/Apache/Gallery.pm.orig 2004-09-12 00:53:05.000000000 +0300
++++ lib/Apache/Gallery.pm      2006-04-16 16:43:43.000000000 +0300
+@@ -13,22 +13,22 @@
+ 
+       eval('require mod_perl;');
+       if ( $@ ) {
+-              require Apache2::mod_perl;
++              require mod_perl2;
+       }
+ 
+       $::MP2 = ($mod_perl::VERSION >= 1.99);
+       
+       if ($::MP2) {
+-              require Apache2;
+-              require Apache::Server;
+-              require Apache::RequestRec;
+-              require Apache::Log;
++              #require Apache2;
++              #require Apache2::Server;
++              require Apache2::RequestRec;
++              require Apache2::Log;
+               require APR::Table;
+-              require Apache::RequestIO;
+-              require Apache::SubRequest;
+-              require Apache::Const;
++              require Apache2::RequestIO;
++              require Apache2::SubRequest;
++              require Apache2::Const;
+       
+-              Apache::Const->import(-compile => 'OK','DECLINED','FORBIDDEN','NOT_FOUND');
++              Apache2::Const->import(-compile => 'OK','DECLINED','FORBIDDEN','NOT_FOUND');
+       
+       }
+       else {
+@@ -84,10 +84,10 @@
+               }
+ 
+       if (-f $filename or -d $filename) {
+-                      return $::MP2 ? Apache::OK() : Apache::Constants::OK();
++                      return $::MP2 ? Apache2::Const::OK() : Apache::Constants::OK();
+               }
+               else {
+-                      return $::MP2 ? Apache::NOT_FOUND() : Apache::Constants::NOT_FOUND();
++                      return $::MP2 ? Apache2::Const::NOT_FOUND() : Apache::Constants::NOT_FOUND();
+               }
+       }
+ 
+@@ -105,7 +105,7 @@
+               }
+ 
+               $r->print($content);
+-              return $::MP2 ? Apache::OK() : Apache::Constants::OK();
++              return $::MP2 ? Apache2::Const::OK() : Apache::Constants::OK();
+       }
+       
+       # Selectmode providing checkboxes beside all thumbnails
+@@ -113,7 +113,7 @@
+       
+       # Let Apache serve icons without us modifying the request
+       if ($r->uri =~ m/^\/icons/i) {
+-              return $::MP2 ? Apache::DECLINED() : Apache::Constants::DECLINED();
++              return $::MP2 ? Apache2::Const::DECLINED() : Apache::Constants::DECLINED();
+       }
+       # Lookup the file in the cache and scale the image if the cached
+       # image does not exist
+@@ -142,7 +142,7 @@
+ 
+               if ($::MP2) {
+                       $r->sendfile($file);
+-                      return Apache::OK();
++                      return Apache2::Const::OK();
+               }
+               else {
+                       $r->path_info('');
+@@ -157,7 +157,7 @@
+ 
+       unless (-f $filename or -d $filename) {
+               show_error($r, 404, "404!", "No such file or directory: ".uri_escape($r->uri, $escape_rule));
+-              return $::MP2 ? Apache::OK() : Apache::Constants::OK();
++              return $::MP2 ? Apache2::Const::OK() : Apache::Constants::OK();
+       }
+ 
+       my $doc_pattern = $r->dir_config('GalleryDocFile');
+@@ -171,14 +171,14 @@
+ 
+       # Let Apache serve files we don't know how to handle anyway
+       if (-f $filename && $filename !~ m/$img_pattern/i) {
+-              return $::MP2 ? Apache::DECLINED() : Apache::Constants::DECLINED();
++              return $::MP2 ? Apache2::Const::DECLINED() : Apache::Constants::DECLINED();
+       }
+ 
+       if (-d $filename) {
+ 
+               unless (-d cache_dir($r, 0)) {
+                       unless (create_cache($r, cache_dir($r, 0))) {
+-                              return $::MP2 ? Apache::OK() : Apache::Constants::OK();
++                              return $::MP2 ? Apache2::Const::OK() : Apache::Constants::OK();
+                       }
+               }
+ 
+@@ -198,7 +198,7 @@
+ 
+               unless (opendir (DIR, $filename)) {
+                       show_error ($r, 500, $!, "Unable to access directory $filename: $!");
+-                      return $::MP2 ? Apache::OK() : Apache::Constants::OK();
++                      return $::MP2 ? Apache2::Const::OK() : Apache::Constants::OK();
+               }
+ 
+               $tpl_vars{MENU} = generate_menu($r);
 @@ -253,9 +253,28 @@
  
                # Combine directories and files to one listing
@@ -43,7 +150,143 @@
                                        }
  
                                        $dirtitle = $dirtitle ? $dirtitle : $file;
-@@ -1226,6 +1245,7 @@
+@@ -393,7 +412,7 @@
+               if (-f $topdir . '.comment') {
+                       my $comment_ref = get_comment($topdir . '.comment');
+                       my %comment_vars;
+-                      $comment_vars{COMMENT} = $comment_ref->{COMMENT} . '<br>' if $comment_ref->{COMMENT};
++                      $comment_vars{COMMENT} = $comment_ref->{COMMENT} if $comment_ref->{COMMENT};
+                       $comment_vars{TITLE} = $comment_ref->{TITLE} if $comment_ref->{TITLE};
+                       $tpl_vars{DIRCOMMENT} = fill_in_file($tpl_vars{comment},
+                                                            HASH => \%comment_vars,
+@@ -420,7 +439,7 @@
+               }
+ 
+               $r->print($tpl_vars{MAIN});
+-              return $::MP2 ? Apache::OK() : Apache::Constants::OK();
++              return $::MP2 ? Apache2::Const::OK() : Apache::Constants::OK();
+ 
+       }
+       else {
+@@ -429,9 +448,9 @@
+               if (defined($ENV{QUERY_STRING}) && $ENV{QUERY_STRING} eq 'orig') {
+                       if ($r->dir_config('GalleryAllowOriginal') ? 1 : 0) {
+                               $r->filename($filename);
+-                              return $::MP2 ? Apache::DECLINED() : Apache::Constants::DECLINED();
++                              return $::MP2 ? Apache2::Const::DECLINED() : Apache::Constants::DECLINED();
+                       } else {
+-                              return $::MP2 ? Apache::FORBIDDEN() : Apache::Constants::FORBIDDEN();
++                              return $::MP2 ? Apache2::Const::FORBIDDEN() : Apache::Constants::FORBIDDEN();
+                       }
+               }
+       
+@@ -443,7 +462,7 @@
+ 
+               unless (-d $cache_path) {
+                       unless (create_cache($r, $cache_path)) {
+-                              return $::MP2 ? Apache::OK() : Apache::Constants::OK();
++                              return $::MP2 ? Apache2::Const::OK() : Apache::Constants::OK();
+                       }
+               }
+ 
+@@ -465,7 +484,7 @@
+               if ($cgi->param('width')) {
+                       unless ((grep $cgi->param('width') == $_, @sizes) or ($cgi->param('width') == $original_size)) {
+                               show_error($r, 200, "Invalid width", "The specified width is invalid");
+-                              return $::MP2 ? Apache::OK() : Apache::Constants::OK();
++                              return $::MP2 ? Apache2::Const::OK() : Apache::Constants::OK();
+                       }
+ 
+                       $width = $cgi->param('width');
+@@ -534,7 +553,7 @@
+ 
+               unless (opendir(DATADIR, $path)) {
+                       show_error($r, 500, "Unable to access directory", "Unable to access directory $path");
+-                      return $::MP2 ? Apache::OK() : Apache::Constants::OK();
++                      return $::MP2 ? Apache2::Const::OK() : Apache::Constants::OK();
+               }
+               my @pictures = grep { /$img_pattern/i } readdir (DATADIR);
+               closedir(DATADIR);
+@@ -542,6 +561,9 @@
+ 
+               $tpl_vars{TOTAL} = scalar @pictures;
+ 
++              my $prevtext = (defined($r->dir_config('GalleryPreviousText')) ? $r->dir_config('GalleryPreviousText') : '&laquo; prev' );
++              my $nexttext = (defined($r->dir_config('GalleryNextText')) ? $r->dir_config('GalleryNextText') : 'next &raquo;' );
++
+               my $prevpicture;
+               my $nextpicture;
+       
+@@ -567,13 +589,13 @@
+                                       $nav_vars{FILENAME}  = $prevpicture;
+                                       $nav_vars{WIDTH}     = $width;
+                                       $nav_vars{PICTURE}   = uri_escape(".cache/$cached", $escape_rule);
+-                                      $nav_vars{DIRECTION} = "&laquo; prev";
++                                      $nav_vars{DIRECTION} = $prevtext;
+                                       $tpl_vars{BACK} = fill_in_file($tpl_vars{navpicture},
+                                                                      HASH => \%nav_vars,
+                                                                     );
+                               }
+                               else {
+-                                      $tpl_vars{BACK} = "&nbsp";
++                                      $tpl_vars{BACK} = '';
+                               }
+ 
+                               $nextpicture = $pictures[$i+1];
+@@ -591,14 +613,14 @@
+                                       $nav_vars{FILENAME}  = $nextpicture;
+                                       $nav_vars{WIDTH}     = $width;
+                                       $nav_vars{PICTURE}   = uri_escape(".cache/$cached", $escape_rule);
+-                                      $nav_vars{DIRECTION} = "next &raquo;";
++                                      $nav_vars{DIRECTION} = $nexttext;
+ 
+                                       $tpl_vars{NEXT} = fill_in_file($tpl_vars{navpicture},
+                                                       HASH => \%nav_vars
+                                       );
+                               }
+                               else {
+-                                      $tpl_vars{NEXT} = "&nbsp;";
++                                      $tpl_vars{NEXT} = '';
+                               }
+                       }
+               }
+@@ -607,7 +629,7 @@
+               if (-f $path . '/' . $picfilename . '.comment') {
+                       my $comment_ref = get_comment($path . '/' . $picfilename . '.comment');
+                       $foundcomment = 1;
+-                      $tpl_vars{COMMENT} = $comment_ref->{COMMENT} . '<br>' if $comment_ref->{COMMENT};
++                      $tpl_vars{COMMENT} = $comment_ref->{COMMENT} if $comment_ref->{COMMENT};
+                       $tpl_vars{TITLE} = $comment_ref->{TITLE} if $comment_ref->{TITLE};
+               } else {
+                       $tpl_vars{COMMENT} = '';
+@@ -749,7 +771,7 @@
+ 
+                       unless ((grep $cgi->param('slideshow') == $_, @slideshow_intervals)) {
+                               show_error($r, 200, "Invalid interval", "Invalid slideshow interval choosen");
+-                              return $::MP2 ? Apache::OK() : Apache::Constants::OK();
++                              return $::MP2 ? Apache2::Const::OK() : Apache::Constants::OK();
+                       }
+ 
+                       $tpl_vars{URL} = uri_escape($nextpicture, $escape_rule);
+@@ -781,7 +803,7 @@
+               }
+ 
+               $r->print($tpl_vars{MAIN});
+-              return $::MP2 ? Apache::OK() : Apache::Constants::OK();
++              return $::MP2 ? Apache2::Const::OK() : Apache::Constants::OK();
+ 
+       }
+ 
+@@ -1040,7 +1062,7 @@
+                                               }
+                                       } 
+                                       elsif (ref($element) eq 'HASH') {
+-                                              $value .= "<br>{ ";
++                                              $value .= " { ";
+                                       foreach (sort keys %{$element}) {
+                                                       $value .= "$_ = " . $element->{$_} . ' ';
+                                               }
+@@ -1226,6 +1248,7 @@



Home | Main Index | Thread Index | Old Index