changeset 235:028291a78acb

Get rid of the "use tables" option.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 27 Mar 2018 15:12:02 +0300
parents ca5f13c8f535
children 9803200bc7f8
files basic.css example.cfg mgallery.inc.php mgallery.php
diffstat 4 files changed, 9 insertions(+), 64 deletions(-) [+]
line wrap: on
line diff
--- a/basic.css	Tue Mar 27 11:34:26 2018 +0300
+++ b/basic.css	Tue Mar 27 15:12:02 2018 +0300
@@ -144,20 +144,17 @@
 	width: 100%;
 	background: #454;
 	margin-bottom: 1em;
-}
-
-div.galleryTable {
 	display: flex;
 	flex-wrap: wrap;
 }
 
-div.galleryEntry {
+.galleryEntry {
 	width: 12em;
 	padding: 1em;
 	text-align: center;
 }
 
-div.galleryEntry img {
+.galleryEntry img {
 	width: 100%;
 }
 
@@ -177,7 +174,7 @@
 	color: #f00;
 }
 
-div.galleryTable .galleryEntry {
+.galleryTable .galleryEntry {
 	display: inline-block;
 	vertical-align: middle;
 }
@@ -438,7 +435,7 @@
 			font-size: 1.4em;
 		}
 
-		div.galleryEntry {
+		.galleryEntry {
 			width: 40%;
 		}
 
--- a/example.cfg	Tue Mar 27 11:34:26 2018 +0300
+++ b/example.cfg	Tue Mar 27 15:12:02 2018 +0300
@@ -27,11 +27,6 @@
 ; If disabled, album_icon will be always used for cover image
 cover_images         = yes
 
-; Use table elements? If disabled, CSS is responsible for formatting
-use_tables           = yes
-
-; Number of image entries per table row, if use_tables enabled
-album_row_limit      = 6
 
 ;;;
 ;;; Important paths and urls
--- a/mgallery.inc.php	Tue Mar 27 11:34:26 2018 +0300
+++ b/mgallery.inc.php	Tue Mar 27 15:12:02 2018 +0300
@@ -70,9 +70,6 @@
   "cover_images"     => [MG_BOOL, TRUE],
   "album_icon"       => [MG_STR, "album_sm.png"],
 
-  "use_tables"       => [MG_BOOL, FALSE],
-  "album_row_limit"  => [MG_INT, 5],
-
   "title_prefix"     => [MG_STR, ""],
   "title_sep"        => [MG_STR, " - "],
   "page_info"        => [MG_STR, "Powered by <b>MGallery ".$mgProgVersion."</b> &copy; Copyright ".$mgProgCopyright],
--- a/mgallery.php	Tue Mar 27 11:34:26 2018 +0300
+++ b/mgallery.php	Tue Mar 27 15:12:02 2018 +0300
@@ -268,7 +268,7 @@
 
 function mgPrintTable($class, &$galEntries, &$galIndex, $start, $limit)
 {
-  global $galAlbumIcon, $galPath, $galTNPath, $galImageURL, $galUseCoverImages, $galUseTables;
+  global $galAlbumIcon, $galPath, $galTNPath, $galImageURL, $galUseCoverImages;
 
   $galCount = count($galIndex);
   if ($start >= $galCount)
@@ -277,22 +277,14 @@
   $end = ($limit === FALSE) ? $galCount : $start + $limit;
   if ($end > $galCount) $end = $galCount;
 
-  $rowLimit = mgGetSetting("album_row_limit");
-  $n = 0;
-
-  echo "<".($galUseTables ? "table" : "div")." class=\"galleryTable ".$class."\">\n";
+  echo "<div class=\"galleryTable ".$class."\">\n";
 
   for ($index = $start; $index < $end; $index++)
   {
     $filename = &$galIndex[$index];
     $data = &$galEntries[$filename];
 
-    if ($galUseTables && $n == 0) echo " <tr>\n";
-
-    if ($galUseTables)
-      echo "  <td class=\"galleryEntry\" id=\"cd".$data["base"]."\">\n";
-    else
-      echo "  <div class=\"galleryEntry\">\n";
+    echo "  <div class=\"galleryEntry\">\n";
 
     if ($data["type"] == 0)
     {
@@ -350,34 +342,10 @@
         "</div></a>\n";
     }
 
-    if ($galUseTables)
-    {
-      echo "  </td>\n";
-      if (++$n >= $rowLimit)
-      {
-        echo " </tr>\n";
-        $n = 0;
-      }
-    }
-    else
-      echo "  </div>\n";
+    echo "  </div>\n";
   }
 
-  if ($galUseTables)
-  {
-    if ($n > 0)
-    {
-      while ($n++ < $rowLimit)
-        echo "  <td></td>\n";
-      echo " </tr>\n";
-    }
-    echo "</table>\n";
-  }
-  else
-  {
-    echo "</div>\n";
-  }
-
+  echo "</div>\n";
   return $index;
 }
 
@@ -485,7 +453,6 @@
 $galImageURL = mgGetSetting("image_url", mgGetSetting("base_url"));
 
 $galUseCoverImages = mgGetSetting("cover_images");
-$galUseTables = mgGetSetting("use_tables");
 
 $galAlbumIcon = mgGetSetting("album_icon");
 $galCleanURLS = mgGetSetting("clean_urls");
@@ -525,17 +492,6 @@
 }
 
 
-// Check "tables" setting
-if (isset($_REQUEST["tables"]))
-{
-  $galUseTables = mgGetRequestItem("tables", FALSE, TRUE);
-  mgSetCookie("mgtables", $galUseTables ? 1 : 0);
-}
-else
-if (isset($_COOKIE["mgtables"]))
-  $galUseTables = intval($_COOKIE["mgtables"]);
-
-
 //
 // Attempt to read the data cache file
 //