diff options
author | kim <kim> | 2006-04-16 14:19:25 +0000 |
---|---|---|
committer | kim <kim> | 2006-04-16 14:19:25 +0000 |
commit | 6fd6bec736fd93853d05dea6a564758471b3c430 (patch) | |
tree | 99a8eac379675c43a6402261310e2f426f56f23c /www | |
parent | e0a7743bba3b18d7dbe0c44722330bcbda7dc3fd (diff) | |
download | pkgsrc-6fd6bec736fd93853d05dea6a564758471b3c430.tar.gz |
Make this work w/ Apache2 (and ap2-perl).
Remove some HTML output from the code that should be controlled only by
the templates (' ' when no navigation, extra '<br>' elements).
Add controls for directory separator in menus and the text labels for
the navigation elements.
Diffstat (limited to 'www')
-rw-r--r-- | www/p5-Apache-Gallery/Makefile | 7 | ||||
-rw-r--r-- | www/p5-Apache-Gallery/distinfo | 4 | ||||
-rw-r--r-- | www/p5-Apache-Gallery/patches/patch-aa | 306 |
3 files changed, 306 insertions, 11 deletions
diff --git a/www/p5-Apache-Gallery/Makefile b/www/p5-Apache-Gallery/Makefile index 483e8fda6aa..ba55b5be59c 100644 --- a/www/p5-Apache-Gallery/Makefile +++ b/www/p5-Apache-Gallery/Makefile @@ -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 @@ post-patch: @${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 --git a/www/p5-Apache-Gallery/distinfo b/www/p5-Apache-Gallery/distinfo index f7766943709..0b7e896edcb 100644 --- a/www/p5-Apache-Gallery/distinfo +++ b/www/p5-Apache-Gallery/distinfo @@ -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 --git a/www/p5-Apache-Gallery/patches/patch-aa b/www/p5-Apache-Gallery/patches/patch-aa index 37509ca47f3..54027f9f5ea 100644 --- a/www/p5-Apache-Gallery/patches/patch-aa +++ b/www/p5-Apache-Gallery/patches/patch-aa @@ -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 @@ $NetBSD: patch-aa,v 1.6 2005/01/23 18:26:39 kim Exp $ } $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') : '« prev' ); ++ my $nexttext = (defined($r->dir_config('GalleryNextText')) ? $r->dir_config('GalleryNextText') : 'next »' ); ++ + 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} = "« prev"; ++ $nav_vars{DIRECTION} = $prevtext; + $tpl_vars{BACK} = fill_in_file($tpl_vars{navpicture}, + HASH => \%nav_vars, + ); + } + else { +- $tpl_vars{BACK} = " "; ++ $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 »"; ++ $nav_vars{DIRECTION} = $nexttext; + + $tpl_vars{NEXT} = fill_in_file($tpl_vars{navpicture}, + HASH => \%nav_vars + ); + } + else { +- $tpl_vars{NEXT} = " "; ++ $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 @@ sub get_filecontent { my $file = shift; @@ -51,15 +294,41 @@ $NetBSD: patch-aa,v 1.6 2005/01/23 18:26:39 kim Exp $ open(FH, $file) or return undef; my $content = ''; { -@@ -1233,6 +1253,7 @@ +@@ -1233,6 +1256,8 @@ $content = <FH>; } close(FH); -+ $content =~ s/\n/<BR>\n/g if $fold; ++ chomp($content); ++ $content =~ s/\n/<br \/>\n/g if $fold; return $content; } -@@ -1333,7 +1354,7 @@ +@@ -1252,7 +1277,6 @@ + } + + while (<FH>) { +- chomp; + $comment_ref->{COMMENT} .= $_; + } + close(FH); +@@ -1319,6 +1343,8 @@ + return qq{ <a href="/">$root_text</a> }; + } + ++ my $delim = (defined($r->dir_config('GalleryMenuSeparator')) ? $r->dir_config('GalleryMenuSeparator') : ' / ' ); ++ + my $menu; + my $menuurl; + foreach my $link (@links) { +@@ -1326,23 +1352,26 @@ + $menuurl .= $link."/"; + my $linktext = $link; + unless (length($link)) { +- $linktext = "$root_text "; ++ $linktext = $root_text; + } + else { + $dirname = File::Spec->catdir($dirname, $link); if (-e $dirname . ".folder") { @@ -68,3 +337,26 @@ $NetBSD: patch-aa,v 1.6 2005/01/23 18:26:39 kim Exp $ } } +- $menu .= "<a href=\"".uri_escape($menuurl, $escape_rule)."\">$linktext</a> / "; ++ if (length($menu)) { ++ $menu .= $delim; ++ } ++ $menu .= '<a href="' . uri_escape($menuurl, $escape_rule) . '">' . $linktext . '</a>'; + + } + + if (-f $filename) { +- $menu .= $picturename; ++ $menu .= $delim . $picturename; + } + else { + +@@ -1752,7 +1781,7 @@ + Example: + + TITLE: This is the new title of the page +- And this is the comment.<br> ++ And this is the comment.<br /> + And this is line two of the comment. + + The visible name of the folder is by default identical to the name of |