comparison mgallery.php @ 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 e618280253ca
children 80cbbdc3f14d
comparison
equal deleted inserted replaced
234:ca5f13c8f535 235:028291a78acb
266 } 266 }
267 267
268 268
269 function mgPrintTable($class, &$galEntries, &$galIndex, $start, $limit) 269 function mgPrintTable($class, &$galEntries, &$galIndex, $start, $limit)
270 { 270 {
271 global $galAlbumIcon, $galPath, $galTNPath, $galImageURL, $galUseCoverImages, $galUseTables; 271 global $galAlbumIcon, $galPath, $galTNPath, $galImageURL, $galUseCoverImages;
272 272
273 $galCount = count($galIndex); 273 $galCount = count($galIndex);
274 if ($start >= $galCount) 274 if ($start >= $galCount)
275 return $start; 275 return $start;
276 276
277 $end = ($limit === FALSE) ? $galCount : $start + $limit; 277 $end = ($limit === FALSE) ? $galCount : $start + $limit;
278 if ($end > $galCount) $end = $galCount; 278 if ($end > $galCount) $end = $galCount;
279 279
280 $rowLimit = mgGetSetting("album_row_limit"); 280 echo "<div class=\"galleryTable ".$class."\">\n";
281 $n = 0;
282
283 echo "<".($galUseTables ? "table" : "div")." class=\"galleryTable ".$class."\">\n";
284 281
285 for ($index = $start; $index < $end; $index++) 282 for ($index = $start; $index < $end; $index++)
286 { 283 {
287 $filename = &$galIndex[$index]; 284 $filename = &$galIndex[$index];
288 $data = &$galEntries[$filename]; 285 $data = &$galEntries[$filename];
289 286
290 if ($galUseTables && $n == 0) echo " <tr>\n"; 287 echo " <div class=\"galleryEntry\">\n";
291
292 if ($galUseTables)
293 echo " <td class=\"galleryEntry\" id=\"cd".$data["base"]."\">\n";
294 else
295 echo " <div class=\"galleryEntry\">\n";
296 288
297 if ($data["type"] == 0) 289 if ($data["type"] == 0)
298 { 290 {
299 echo 291 echo
300 " <div class=\"imageBox\" title=\"".mgGetImageTitleStr($filename, $data). 292 " <div class=\"imageBox\" title=\"".mgGetImageTitleStr($filename, $data).
348 " <div class=\"albumTitle\">". 340 " <div class=\"albumTitle\">".
349 mgGetTrans($data["caption"], "chentities"). 341 mgGetTrans($data["caption"], "chentities").
350 "</div></a>\n"; 342 "</div></a>\n";
351 } 343 }
352 344
353 if ($galUseTables) 345 echo " </div>\n";
354 { 346 }
355 echo " </td>\n"; 347
356 if (++$n >= $rowLimit) 348 echo "</div>\n";
357 {
358 echo " </tr>\n";
359 $n = 0;
360 }
361 }
362 else
363 echo " </div>\n";
364 }
365
366 if ($galUseTables)
367 {
368 if ($n > 0)
369 {
370 while ($n++ < $rowLimit)
371 echo " <td></td>\n";
372 echo " </tr>\n";
373 }
374 echo "</table>\n";
375 }
376 else
377 {
378 echo "</div>\n";
379 }
380
381 return $index; 349 return $index;
382 } 350 }
383 351
384 352
385 function mgTimeStr($stamp) 353 function mgTimeStr($stamp)
483 $galBasePath = mgGetSetting("base_path"); 451 $galBasePath = mgGetSetting("base_path");
484 $galBaseURL = mgGetSetting("base_url"); 452 $galBaseURL = mgGetSetting("base_url");
485 $galImageURL = mgGetSetting("image_url", mgGetSetting("base_url")); 453 $galImageURL = mgGetSetting("image_url", mgGetSetting("base_url"));
486 454
487 $galUseCoverImages = mgGetSetting("cover_images"); 455 $galUseCoverImages = mgGetSetting("cover_images");
488 $galUseTables = mgGetSetting("use_tables");
489 456
490 $galAlbumIcon = mgGetSetting("album_icon"); 457 $galAlbumIcon = mgGetSetting("album_icon");
491 $galCleanURLS = mgGetSetting("clean_urls"); 458 $galCleanURLS = mgGetSetting("clean_urls");
492 $galTNPath = mgGetSetting("tn_path"); 459 $galTNPath = mgGetSetting("tn_path");
493 $galMedPath = mgGetSetting("med_path"); 460 $galMedPath = mgGetSetting("med_path");
521 { 488 {
522 $tmp = strtolower($_COOKIE["mglang"]); 489 $tmp = strtolower($_COOKIE["mglang"]);
523 if (array_key_exists($tmp, $pageLanguages)) 490 if (array_key_exists($tmp, $pageLanguages))
524 $pageLang = $tmp; 491 $pageLang = $tmp;
525 } 492 }
526
527
528 // Check "tables" setting
529 if (isset($_REQUEST["tables"]))
530 {
531 $galUseTables = mgGetRequestItem("tables", FALSE, TRUE);
532 mgSetCookie("mgtables", $galUseTables ? 1 : 0);
533 }
534 else
535 if (isset($_COOKIE["mgtables"]))
536 $galUseTables = intval($_COOKIE["mgtables"]);
537 493
538 494
539 // 495 //
540 // Attempt to read the data cache file 496 // Attempt to read the data cache file
541 // 497 //