changeset 101:00bcbe2473ff

Work on the page structure / element layout and clean up the header/footer code.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 19 Sep 2016 17:25:07 +0300
parents f74307f05696
children f8e6e0f2471d
files mgallery.php
diffstat 1 files changed, 29 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/mgallery.php	Sun Sep 18 20:49:03 2016 +0300
+++ b/mgallery.php	Mon Sep 19 17:25:07 2016 +0300
@@ -91,7 +91,7 @@
 }
 
 
-function mgPrintPageHeader($pageTitle, $pageExtra = "", $useContents = TRUE)
+function mgPrintPageHeader($pageTitle, $pageExtra = "")
 {
   global $pageCSS, $pageCSSIndex, $pageCharset, $pageAuthor, $pageCSSData, $pageUrchin;
 
@@ -150,17 +150,16 @@
 
   echo "<div id=\"messageBox\"></div>\n";
 
-  if ($useContents)
-    echo "<div id=\"contents\">\n";
+  echo "<div id=\"contents\">\n";
 }
 
 
-function mgPrintPageFooter($useContents = TRUE)
+function mgPrintPageFooter()
 {
-  if ($useContents)
-    echo "</div>\n";
-
-  echo "</body>\n</html>\n";
+  echo
+    mgGetPageInfoFooter().
+    "</div>\n".
+    "</body>\n</html>\n";
 }
 
 
@@ -443,10 +442,24 @@
 }
 
 
-function mgPrintPageInfoFooter()
+function mgGetPageInfoHeaderStart()
+{
+  return "<div id=\"pageInfoHeader\">\n";
+}
+
+
+function mgGetPageInfoHeaderEnd()
+{
+  return "</div>";
+}
+
+
+function mgGetPageInfoFooter()
 {
   if (($str = mgGetSetting("page_info")) !== FALSE)
-    echo "<div class=\"pageInfoFooter\">".$str."</div>";
+    return "<div id=\"pageInfoFooter\"><div>".$str."</div></div>";
+  else
+    return "";
 }
 
 
@@ -586,8 +599,7 @@
 
   //echo "<p>filename=: '".$filename."', X: galData=".intval(isset($galData)).", galEntries=".intval(isset($galEntries))."\n";
 
-  mgPrintPageInfoFooter();
-  mgPrintPageFooter(TRUE);
+  mgPrintPageFooter();
   exit;
 }
 
@@ -617,7 +629,7 @@
   $pageTitle = $galTitlePrefix.$galTitleSep.mgGetTrans($galData["caption"])." - ".$galImage;
   mgPrintPageHeader($pageTitle);
   echo
-    "<div id=\"pageInfoHeader\">\n".
+    mgGetPageInfoHeaderStart().
     mgGetLanguageSelector().
     "<h1>".chentities($pageTitle)."</h1>\n";
 
@@ -628,7 +640,7 @@
     echo mgGetNaviControls($galImagesIndex, $index, $naviFlags);
 
   echo
-    "</div>\n".
+    mgGetPageInfoHeaderEnd().
     "<div id=\"imageCBox\">\n".
     mgGetNaviControlImageBoxJS($galImagesIndex, $index, "prevBtm", -1)."\n".
     mgGetNaviControlImageBox($galImagesIndex, $index, "prev", -1)."\n".
@@ -796,7 +808,7 @@
   $pageTitle = $galTitlePrefix.mgGetArr($galData, "caption", " - %1", "", "chentities");
   mgPrintPageHeader($pageTitle);
   echo
-    "<div id=\"pageInfoHeader\">\n".
+    mgGetPageInfoHeaderStart().
     mgGetLanguageSelector().
     "<h1>".$pageTitle."</h1>\n";
 
@@ -826,12 +838,11 @@
     echo "<div class=\"albumHeaderText\">".$headerText."</div>\n";
   }
 
-  echo "</div>\n";
+  echo mgGetPageInfoHeaderEnd();
 
   mgPrintTable("albumTable", $galEntries, $galAlbumsIndex, 0, FALSE);
   mgPrintTable("imageTable", $galEntries, $galImagesIndex, 0, FALSE);
 }
 
-mgPrintPageInfoFooter();
-mgPrintPageFooter(TRUE);
+mgPrintPageFooter();
 ?>
\ No newline at end of file