retitle 337012 libapache-gallery-perl: please add <directory>.folder support 
for files as well
found 337012 0.99-svn060811-1
tags 337012 + upstream
tags 337012 + patch
thanks

Hi Francesco!

I cc:ed Apache::Gallery author, given that AFAIK the user mailing lists
does not work anymore <http://apachegallery.dk/?p=mailinglists>.

On Wed, 02 Nov 2005 09:05:53 +0100, Francesco Potorti` wrote:
> The feature provided by GalleryUnderscoresToSpaces for folder names
> would be very useful for file nemes too.

This is #348724, as I explained there [1] there are two different issues
in this bug and given that you had opened another one with a patch, I
just retitled this one for the second issue below.

[1] <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=348724#10>.

> Similarly, it would be useful to be able to change the displayed name of
> a file the same way it is done for directories using a <direcory>.folder file.

Well, I do not see the point for this, but the second patch attached
adds it, using <file>.file instead.  Still, the "original" filename is
hardcoded in the HTML, as it was the case for <directory>.folder.

The first patch fixes the behavior of <directory>.folder with the
'bright' template and the 'next folder' link (trivial fix).

NB, it is a bit unfortunate that 'folder' was chosen instead of
'directory' for the file extension, for two reasons:

1) 'folder' is actually used only in this specific feature, while all
   the times there is a reference/error/message 'directory' is used
   instead.

2) I was trying to find something similar for directory<->folder WRT to
   files, but with no available.  Having had <directory>.directory and
   <file>.file to specify the shown names would have been more
   consistent.

Given the above note, I would say a better option would be to do the
mentioned change for <directory>.directory.  If agreed, I would be glad
to provide a patch which implements that, still keeping the old schema
working (but with the new one, .directory, taking precedence).

Thx, bye,
Gismo / Luca

diff -Naur Apache-Gallery-1.0.1_Debian-337197-2/Changes Apache-Gallery-1.0.1/Changes
--- Apache-Gallery-1.0.1_Debian-337197-2/Changes	2011-03-18 00:11:52.803632461 +0100
+++ Apache-Gallery-1.0.1/Changes	2011-03-24 23:48:08.285981818 +0100
@@ -3,8 +3,10 @@
 
 Revision history for Perl extension Apache::Gallery.
 
-1.0.2~1 Fri Mar 18 00:05:49 CET 2011
+1.0.2~1 Thu Mar 24 23:48:07 CET 2011
 
+	- Fixed counter typo for <directory>.folder in next directory
+	  menu item.  (Luca Capello)
 	- Fixed spelling typos in Gallery.pm and README.  (Luca Capello)
 	- GalleryCacheDir defaults to /var/cache/www/ per the FHS-2.3.
 	  (Debian bug #337197, Luca Capello)
diff -Naur Apache-Gallery-1.0.1_Debian-337197-2/lib/Apache/Gallery.pm Apache-Gallery-1.0.1/lib/Apache/Gallery.pm
--- Apache-Gallery-1.0.1_Debian-337197-2/lib/Apache/Gallery.pm	2011-03-18 00:11:52.803632461 +0100
+++ Apache-Gallery-1.0.1/lib/Apache/Gallery.pm	2011-03-24 23:45:56.314290123 +0100
@@ -499,7 +499,7 @@
 					}
 					if ($neightbour_counter < scalar @neighbour_directories - 1) {
 						my $linktext = $neighbour_directories[$neightbour_counter+1];
-						if (-e $parent_filename.'/'.$neighbour_directories[$neightbour_counter-1] . ".folder") {
+						if (-e $parent_filename.'/'.$neighbour_directories[$neightbour_counter+1] . ".folder") {
 							$linktext = get_filecontent($parent_filename.'/'.$neighbour_directories[$neightbour_counter+1] . ".folder");
 						}
 						my %info = (
diff -Naur Apache-Gallery-1.0.1_Debian-337012-1/Changes Apache-Gallery-1.0.1/Changes
--- Apache-Gallery-1.0.1_Debian-337012-1/Changes	2011-03-24 23:53:52.544647203 +0100
+++ Apache-Gallery-1.0.1/Changes	2011-03-25 00:01:49.602262905 +0100
@@ -3,10 +3,12 @@
 
 Revision history for Perl extension Apache::Gallery.
 
-1.0.2~1 Thu Mar 24 23:48:07 CET 2011
+1.0.2~1 Fri Mar 25 00:01:48 CET 2011
 
 	- Fixed counter typo for <directory>.folder in next directory
 	  menu item.  (Luca Capello)
+	- Added support for online file renaming through <file>.file.
+	  (Debian bug #337012, Luca Capello)
 	- Fixed spelling typos in Gallery.pm and README.  (Luca Capello)
 	- GalleryCacheDir defaults to /var/cache/www/ per the FHS-2.3.
 	  (Debian bug #337197, Luca Capello)
diff -Naur Apache-Gallery-1.0.1_Debian-337012-1/lib/Apache/Gallery.pm Apache-Gallery-1.0.1/lib/Apache/Gallery.pm
--- Apache-Gallery-1.0.1_Debian-337012-1/lib/Apache/Gallery.pm	2011-03-24 23:53:52.548647283 +0100
+++ Apache-Gallery-1.0.1/lib/Apache/Gallery.pm	2011-03-24 23:28:16.321456462 +0100
@@ -385,9 +385,14 @@
 						$filetype = "unknown";
 					}
 
-					# Debian bug #348724 <http://bugs.debian.org/348724>
+					# Debian bug #337012 <http://bugs.debian.org/337012>
 					# not images
 					my $filetitle = $file;
+					if (-e $thumbfilename . ".file") {
+						$filetitle = get_filecontent($thumbfilename . ".file");
+					}
+
+					# Debian bug #348724 <http://bugs.debian.org/348724>
 					$filetitle =~ s/_/ /g if $r->dir_config('GalleryUnderscoresToSpaces');
 
 					$tpl_vars{FILES} .=
@@ -414,9 +419,14 @@
 
 					my $rotate = readfile_getnum($r, $imageinfo, $thumbfilename.".rotate");
 
-					# Debian bug #348724 <http://bugs.debian.org/348724>
+					# Debian bug #337012 <http://bugs.debian.org/337012>
 					# HTML <img> tag, alt attribute
 					my $filetitle = $file;
+					if (-e $thumbfilename . ".file") {
+						$filetitle = get_filecontent($thumbfilename . ".file");
+					}
+
+					# Debian bug #348724 <http://bugs.debian.org/348724>
 					$filetitle =~ s/_/ /g if $r->dir_config('GalleryUnderscoresToSpaces');
 
 					my %file_vars = (FILEURL => uri_escape($fileurl, $escape_rule),
@@ -642,9 +652,14 @@
 					my ($thumbnailwidth, $thumbnailheight) = get_thumbnailsize($r, $orig_width, $orig_height);	
 					my $imageinfo = get_imageinfo($r, $path.$prevpicture, $type, $orig_width, $orig_height);
 					my $cached = get_scaled_picture_name($path.$prevpicture, $thumbnailwidth, $thumbnailheight);
+					# Debian bug #337012 <http://bugs.debian.org/337012>
+					my $prevpicture_title = $prevpicture;
+					if (-e $path."/".$prevpicture . ".file") {
+						$prevpicture_title = get_filecontent($path."/".$prevpicture . ".file");
+					}
 					my %nav_vars;
 					$nav_vars{URL}       = uri_escape($prevpicture, $escape_rule);
-					$nav_vars{FILENAME}  = $prevpicture;
+					$nav_vars{FILENAME}  = $prevpicture_title;
 					$nav_vars{WIDTH}     = $width;
 					$nav_vars{PICTURE}   = uri_escape(".cache/$cached", $escape_rule);
 					$nav_vars{DIRECTION} = "&laquo; <u>p</u>rev";
@@ -665,9 +680,14 @@
 					my ($thumbnailwidth, $thumbnailheight) = get_thumbnailsize($r, $orig_width, $orig_height);	
 					my $imageinfo = get_imageinfo($r, $path.$nextpicture, $type, $thumbnailwidth, $thumbnailheight);
 					my $cached = get_scaled_picture_name($path.$nextpicture, $thumbnailwidth, $thumbnailheight);
+					# Debian bug #337012 <http://bugs.debian.org/337012>
+					my $nextpicture_title = $nextpicture;
+					if (-e $path."/".$nextpicture . ".file") {
+						$nextpicture_title = get_filecontent($path."/".$nextpicture . ".file");
+					}
 					my %nav_vars;
 					$nav_vars{URL}       = uri_escape($nextpicture, $escape_rule);
-					$nav_vars{FILENAME}  = $nextpicture;
+					$nav_vars{FILENAME}  = $nextpicture_title;
 					$nav_vars{WIDTH}     = $width;
 					$nav_vars{PICTURE}   = uri_escape(".cache/$cached", $escape_rule);
 					$nav_vars{DIRECTION} = "<u>n</u>ext &raquo;";
@@ -1453,6 +1473,10 @@
 	my $picturename;
 	if (-f $filename) {
 		$picturename = pop(@links);	
+		# Debian bug #337012 <http://bugs.debian.org/337012>
+		if (-e $filename . ".file") {
+			$picturename = get_filecontent($filename . ".file");
+		}
 	}
 
 	if ($r->uri eq $root_path) {
@@ -1971,6 +1995,10 @@
 the folder, but can be changed by creating a file <directory>.folder
 with the visible name of the folder.
 
+Similarly, the visible name of any file is by default identical to the
+name of the file, but can be changed by creating a file <file>.file
+with the visible name of the file.
+
 It is also possible to set GalleryCommentExifKey to the name of an EXIF
 field containing the comment, e.g. ImageDescription. The EXIF comment is
 overridden by the .comment file if it exists.
diff -Naur Apache-Gallery-1.0.1_Debian-337012-1/README Apache-Gallery-1.0.1/README
--- Apache-Gallery-1.0.1_Debian-337012-1/README	2011-03-18 00:11:52.803632461 +0100
+++ Apache-Gallery-1.0.1/README	2011-03-24 23:43:42.954167643 +0100
@@ -287,6 +287,10 @@
         of the folder, but can be changed by creating a file
         <directory>.folder with the visible name of the folder.
 
+        Similarly, the visible name of any file is by default identical to the
+        name of the file, but can be changed by creating a file <file>.file
+        with the visible name of the file.
+
         It is also possible to set GalleryCommentExifKey to the name of an
         EXIF field containing the comment, e.g. ImageDescription. The EXIF
         comment is overridden by the .comment file if it exists.

Attachment: pgpyhAn6rATRS.pgp
Description: PGP signature

Reply via email to