[Bins] please support customized date strings

Martin Michlmayr tbm at cyrius.com
Mon May 9 12:48:12 BST 2005


Package: bins
Version: 1.1.27-2
Severity: wishlist
Tags: patch

BINS always uses the "%c" date format string for its "generated on <foo>"
message.  Unfortunately, this deviates from the string I normally use
in my homepage.  It would therefore be nice if there was an option to
customize the format used for the date.

Below is a patch for this.  It adds a dateString variable (which
defaults to "%c"), changes GENERATED_DATE accordingly and also adds a
DATE variable which contains the date without the leading "on".



diff -urN bins-1.1.27/bins bins-1.1.27.new/bins
--- bins-1.1.27/bins	2004-10-24 19:46:23.000000000 +0100
+++ bins-1.1.27.new/bins	2005-05-09 12:27:58.938943968 +0100
@@ -130,6 +130,9 @@
 			      # static-files directory.
 			      # The name should be unique for the entire album.
 
+   dateString => "%c",        # Specify the format of the date string; this
+                              # accepts all formats supported by date(1).
+
    excludeBackgroundImage => 1, # If set to 1, the image with the name given
                                 # in backgroundImage will be excluded from
 				# the current directory.
@@ -801,32 +804,6 @@
 		  });
 $defaultConfig{colorsSubs} = \%colorsSubs;
 
-# Strings to translate in the HTML template pages (if I18N is used)
-my %intlSubs = (  STRING_THUMBNAILS   => _("thumbnails"),
-		  STRING_IMAGELIST    => _("Image List"),
-		  STRING_HOME => _("Home"),
-		  STRING_UP   => _("Up one album"),
-		  STRING_PREV => _("previous"),
-		  STRING_NEXT => _("next"),
-		  STRING_FIRST => _("first"),
-		  STRING_LAST => _("last"),
-		  STRING_SUBALBUMS => _("Sub Albums"),
-		  STRING_INTHISALBUM => _("In This Album"),
-		  STRING_BACKTOTHEIMAGE => _("Back to the image"),
-		  STRING_IMAGE => _("Image"),
-		  STRING_ALBUMTREE => _("Album Tree"),
-		  STRING_ALBUMGENERATEDBY => _("Album generated by"),
-                  STRING_FEEDBACK => _("Send Feedback"),
-                  STRING_YOURIMAGE => _("Your Image"),
-                  STRING_YOURALBUM => _("Your Album"),
-		  BINS_VERSION             => "1.1.27",
-		  ENCODING                 => $defaultConfig{htmlEncoding},
-		  GENERATED_DATE       => _("on ").
-		                          local2html(strftime("%c", localtime)),
-		  BINS_ID =>
-		  '<!--$Id: bins,v 1.162 2004/10/24 18:04:07 jerome Exp $-->',
-	       );
-
 # @knownImageExtentions defines file extensions that BINS can handle as
 # input image. BINS _should_ handle all input format of ImageMagick
 # (see ImageMagick(1) man page), but there is some formats that cause
@@ -880,6 +857,7 @@
 sub trimWhiteSpace;
 sub stringToBool;
 sub ignoreSet;
+sub getIntlSubs;
 
 sub generateThumbnailPages;
 sub generateThumbEntry;
@@ -2263,12 +2241,45 @@
     $templateParameters{HOME_LINK} = $configHash->{homeURL};
     $templateParameters{FEEDBACK_LINK} = $configHash->{feedbackMail};
     $templateParameters{PATH_SHOW_ICON} = $configHash->{pathShowIcon};
+    $templateParameters{DATE} = strftime($configHash->{dateString}, localtime);
 
     renderTemplate("subalbum", $albumdir.$album."index.html",
 		   \%templateParameters, $configHash);
 }
 
 
+sub getIntlSubs{
+    my $configHash = shift;
+    # Strings to translate in the HTML template pages (if I18N is used)
+    my %intlSubs = (  STRING_THUMBNAILS   => _("thumbnails"),
+		  STRING_IMAGELIST    => _("Image List"),
+		  STRING_HOME => _("Home"),
+		  STRING_UP   => _("Up one album"),
+		  STRING_PREV => _("previous"),
+		  STRING_NEXT => _("next"),
+		  STRING_FIRST => _("first"),
+		  STRING_LAST => _("last"),
+		  STRING_SUBALBUMS => _("Sub Albums"),
+		  STRING_INTHISALBUM => _("In This Album"),
+		  STRING_BACKTOTHEIMAGE => _("Back to the image"),
+		  STRING_IMAGE => _("Image"),
+		  STRING_ALBUMTREE => _("Album Tree"),
+		  STRING_ALBUMGENERATEDBY => _("Album generated by"),
+                  STRING_FEEDBACK => _("Send Feedback"),
+                  STRING_YOURIMAGE => _("Your Image"),
+                  STRING_YOURALBUM => _("Your Album"),
+		  BINS_VERSION             => "1.1.27",
+		  ENCODING                 => $defaultConfig{htmlEncoding},
+		  GENERATED_DATE       => _("on ").
+		                          local2html(strftime($configHash->{dateString},
+		                          localtime)),
+		  BINS_ID =>
+		  '<!--$Id: bins,v 1.162 2004/10/24 18:04:07 jerome Exp $-->',
+	       );
+    return \%intlSubs;
+}
+
+
 sub getAlbumInfo{
     my $album      = shift(@_);
     my $configHash = shift(@_);
@@ -2704,7 +2715,7 @@
   $subs_hash{CUSTOM_CSS} = $configHash->{customStyleSheet};
 
   my @array;
-  push @array, {NAV_NAME => $intlSubs{STRING_BACKTOTHEIMAGE},
+  push @array, {NAV_NAME => getIntlSubs($configHash)->{STRING_BACKTOTHEIMAGE},
                 NAV_LINK => "javascript:history.back();",
                 NAV_ICON => "back.png",
 		NAV_ID => "back"};
@@ -3474,7 +3485,7 @@
   %{$templateParameters} =
     (%{$templateParameters},
      %{$configHash->{colorsSubs}{$configHash->{colorStyle}}},
-     %intlSubs,
+     %{getIntlSubs($configHash)},
     );
 
   # open the html template
Binary files bins-1.1.27/doc/.bins_man.html.swp and bins-1.1.27.new/doc/.bins_man.html.swp differ
diff -urN bins-1.1.27/doc/bins.sgml bins-1.1.27.new/doc/bins.sgml
--- bins-1.1.27/doc/bins.sgml	2004-10-24 19:46:23.000000000 +0100
+++ bins-1.1.27.new/doc/bins.sgml	2005-05-09 11:32:11.000000000 +0100
@@ -430,6 +430,15 @@
 	    </varlistentry>
 
 	    <varlistentry>
+	      <term>dateString</term>
+	      <listitem>
+		<para>Specify the format of the date string.  This variable
+		accepts all formats supported by <command>date(1)</command>.
+		</para>
+	      </listitem>
+	    </varlistentry>
+
+	    <varlistentry>
 	      <term>defaultSize</term>
 	      <listitem>
 		<para>Size to use when user clicks directly on the


-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.10-1-686
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages bins depends on:
ii  libglade-gnome0            1:0.17-3      Library to load .glade files at ru
ii  libglade-perl              0.61-1        Glade-perl runtime modules
ii  libgladexml-perl           0.7009-2      Perl module for the libglade libra
ii  libgnome-perl              0.7009-2      Perl module for the gnome and zvt 
ii  libgtk-imlib-perl          0.7009-2      Perl module for the gdkimlib libra
ii  libhtml-clean-perl         0.8-7         Cleans up HTML code for web browse
ii  libhtml-parser-perl        3.45-2        A collection of modules that parse
ii  libhtml-template-perl      2.6-2         HTML::Template : A module for usin
ii  libimage-info-perl         1.16-2        allows extraction of meta informat
ii  libimage-size-perl         2.992-1       determine the size of images in se
ii  libio-string-perl          1.05-1        Emulate IO::File interface for in-
ii  libjpeg-progs              6b-10         Programs for manipulating JPEG fil
ii  liblocale-gettext-perl     1.04-1        Using libc functions for internati
ii  libtext-iconv-perl         1.2-3         Convert between character sets in 
ii  liburi-perl                1.35-1        Manipulates and accesses URI strin
ii  libxml-grove-perl          0.46alpha-11  Perl module for accessing parsed *
ii  libxml-handler-yawriter-pe 0.23-5        Perl module for writing XML docume
ii  libxml-perl                0.08-1        Perl modules for working with XML
ii  libxml-writer-perl         0.531-1       Perl module for writing XML docume
ii  libxml-xql-perl            0.68-4        Perl module for querying XML tree 
ii  perlmagick                 6:6.0.6.2-2.2 A perl interface to the libMagick 

-- no debconf information

-- 
Martin Michlmayr
http://www.cyrius.com/


More information about the Bins mailing list