[Bins] [PATCH] cosmetic fix for non-specified background with joi templates

David Pfitzner dwpfitzner at earthlink.net
Sun Sep 28 00:28:26 BST 2003


Attached is a patch with a cosmetic fix to bins-1.1.23:

If you use the joi templates (or maybe others) and the config does not 
specify
backgroundImage, then the output html (eg index.html) includes eg:

<body background="static.joi/">

That URL is a directory, not an image, so the result for the user is 
that no background
image is displayed, which is correct.  But my web server was configured 
to treat a
request for a directory not containing index.html as an error, so I got 
lots of spurious
entries in the error log.

The template actually checks whether BG_IMAGE is defined, but bins 
always sets
BG_IMAGE to at least STATIC_PATH (plus image name if specified).  The 
attached
patch fixes this with the result that the corresponding output becomes 
simply eg

<body>

when backgroundImage is not specified.

Regards,
-- David
-------------- next part --------------
--- bins-1.1.23	2003-09-27 21:44:57.000000000 -0700
+++ bins-1.1.23-dwp1	2003-09-27 22:54:35.000000000 -0700
@@ -1203,8 +1203,12 @@
 
     #beVerboseN("Generate tree Table html:\n $tableHTML ", 3);
     $subsHash{STATIC_PATH} = "static.".$configHash->{templateStyle};
-    $subsHash{BG_IMAGE} =
-      $subsHash{STATIC_PATH}."/".$configHash->{backgroundImage};
+    if ($configHash->{backgroundImage}) {
+	# Do not set this if not configured, so that template
+	# can check for whether defined.
+	$subsHash{BG_IMAGE} =
+	    $subsHash{STATIC_PATH}."/".$configHash->{backgroundImage};
+    }
     $subsHash{CUSTOM_CSS} = $configHash->{customStyleSheet};
     $subsHash{HOME_LINK} = $configHash->{homeURL};
     $subsHash{ALBUM_THUMB} = $configHash->{treePreview};
@@ -1905,8 +1909,12 @@
     $finalsubs{XLINK} = getXLinks($xlinksRef);
     $finalsubs{STATIC_PATH} = 
       getRootDir($album)."static.".$configHash->{templateStyle};
-    $finalsubs{BG_IMAGE} =
-      $finalsubs{STATIC_PATH}."/".$configHash->{backgroundImage};
+    if ($configHash->{backgroundImage}) {
+	# Do not set this if not configured, so that template
+	# can check for whether defined.
+	$finalsubs{BG_IMAGE} =
+	    $finalsubs{STATIC_PATH}."/".$configHash->{backgroundImage};
+    }
     $finalsubs{CUSTOM_CSS} = $configHash->{customStyleSheet};
     $finalsubs{ROOT_PATH} = getRootDir($album);
 
@@ -2108,8 +2116,12 @@
     }
     $templateParameters{STATIC_PATH} =
       getRootDir($album)."static.".$configHash->{templateStyle};
-    $templateParameters{BG_IMAGE} =
-      $templateParameters{STATIC_PATH}."/".$configHash->{backgroundImage};
+    if ($configHash->{backgroundImage}) {
+	# Do not set this if not configured, so that template
+	# can check for whether defined.
+	$templateParameters{BG_IMAGE} =
+	    $templateParameters{STATIC_PATH}."/".$configHash->{backgroundImage};
+    }
     $templateParameters{CUSTOM_CSS} = $configHash->{customStyleSheet};
 
     $templateParameters{HOME_LINK} = $configHash->{homeURL};
@@ -2404,8 +2416,12 @@
   $subsHash{XLINK} = getXLinks(\@xlinkList);
   $subsHash{STATIC_PATH} = 
     getRootDir($album)."static.".$configHash->{templateStyle};
-  $subsHash{BG_IMAGE} =
-    $subsHash{STATIC_PATH}."/".$configHash->{backgroundImage};
+  if ($configHash->{backgroundImage}) {
+      # Do not set this if not configured, so that template
+      # can check for whether defined.
+      $subsHash{BG_IMAGE} =
+	  $subsHash{STATIC_PATH}."/".$configHash->{backgroundImage};
+  }
   $subsHash{CUSTOM_CSS} = $configHash->{customStyleSheet};
   $subsHash{HOME_LINK} = $configHash->{homeURL};
   $subsHash{FEEDBACK_LINK} = $configHash->{feedbackMail};
@@ -3116,8 +3132,12 @@
     getRootDir($album)."static.".$configHash->{templateStyle};
   $subs_hash{HOME_LINK} = $configHash->{homeURL};
   $subs_hash{FEEDBACK_LINK} = $configHash->{feedbackMail};
-  $subs_hash{BG_IMAGE} =
-    $subs_hash{STATIC_PATH}."/".$configHash->{backgroundImage};
+  if ($configHash->{backgroundImage}) {
+      # Do not set this if not configured, so that template
+      # can check for whether defined.
+      $subs_hash{BG_IMAGE} =
+	  $subs_hash{STATIC_PATH}."/".$configHash->{backgroundImage};
+  }
   $subs_hash{CUSTOM_CSS} = $configHash->{customStyleSheet};
   $subs_hash{PATH_IMG_NUM} = $configHash->{pathImgNum};
   $subs_hash{PATH_SHOW_ICON} = $configHash->{pathShowIcon};


More information about the Bins mailing list