comparison mgallery.php @ 347:7da360685721

Implement show_keywords setting.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 06 Sep 2023 13:04:41 +0300
parents 9fbec6399cdd
children 596196f2b0c5
comparison
equal deleted inserted replaced
346:4425fe467c81 347:7da360685721
48 ], 48 ],
49 49
50 "page_up_navi_button_title" => [ 50 "page_up_navi_button_title" => [
51 "fi" => "Takaisin galleriasivulle.", 51 "fi" => "Takaisin galleriasivulle.",
52 "en" => "Back to gallery page.", 52 "en" => "Back to gallery page.",
53 ],
54
55 "image_keywords_prefix" => [
56 "fi" => "Avainsanat: ",
57 "en" => "Keywords: ",
58 ],
59
60 "image_keywords_suffix" => [
61 "fi" => "",
62 "en" => "",
53 ], 63 ],
54 ]; 64 ];
55 65
56 66
57 // 67 //
284 else 294 else
285 return ""; 295 return "";
286 } 296 }
287 297
288 298
289 function mgPrintTable($class, $galPath, &$galEntries, &$galIndex, $start, $limit) 299 function mgGetImageKeywords(&$galData, &$data, $fmt1, $fmt2)
300 {
301 global $galShowKeywords;
302 $showKeywords = isset($galData["show_keywords"]) ? $galData["show_keywords"] : $galShowKeywords;
303
304 if (is_array($showKeywords) && isset($data["keywords"]) && is_array($data["keywords"]))
305 {
306 if (array_intersect($showKeywords, ["*", "all"]))
307 $tmp = $data["keywords"];
308 else
309 $tmp = array_intersect($showKeywords, $data["keywords"]);
310
311 if (count($tmp) > 0)
312 return $fmt1.implode(", ", array_map("chentities", $tmp)).$fmt2;
313 }
314 return "";
315 }
316
317
318 function mgPrintTable($class, $galData, $galPath, &$galEntries, &$galIndex, $start, $limit)
290 { 319 {
291 global $galAlbumIcon, $galTNPath, $galTNFormat, 320 global $galAlbumIcon, $galTNPath, $galTNFormat,
292 $galImageURL, $galUseCoverImages; 321 $galImageURL, $galUseCoverImages;
293 322
294 $galCount = count($galIndex); 323 $galCount = count($galIndex);
312 echo 341 echo
313 " <div class=\"imageBox\" title=\"".mgGetImageTitleStr($data, $filename). 342 " <div class=\"imageBox\" title=\"".mgGetImageTitleStr($data, $filename).
314 "\"><a href=\"".mgGetURL($galPath, $filename)."\"><img src=\"". 343 "\"><a href=\"".mgGetURL($galPath, $filename)."\"><img src=\"".
315 mgGetImageURL(isset($data["path"]) ? $data["path"] : $galPath, $galTNPath, $filename, $galTNFormat). 344 mgGetImageURL(isset($data["path"]) ? $data["path"] : $galPath, $galTNPath, $filename, $galTNFormat).
316 "\" alt=\"".dhentities($filename)."\"></a></div>\n". 345 "\" alt=\"".dhentities($filename)."\"></a></div>\n".
317 mgGetArr($data, "caption", " <div class=\"imageCaption\">%1</div>\n", "", "chentities"); 346 mgGetArr($data, "caption", " <div class=\"imageCaption\">%1</div>\n", "", "chentities").
347 mgGetImageKeywords($galData, $data, " <div class=\"imageKeywords\">(", ")</div>\n");
318 /* 348 /*
319 if ($mode == "") 349 if ($mode == "")
320 { 350 {
321 echo 351 echo
322 " <select class=\"dropdown\" id=\"dd".$data["base"]."\" name=\"dd".$data["base"]. 352 " <select class=\"dropdown\" id=\"dd".$data["base"]."\" name=\"dd".$data["base"].
488 $galBasePath = mgGetSetting("base_path"); 518 $galBasePath = mgGetSetting("base_path");
489 $galBaseURL = mgGetSetting("base_url"); 519 $galBaseURL = mgGetSetting("base_url");
490 $galImageURL = mgGetSetting("image_url", mgGetSetting("base_url")); 520 $galImageURL = mgGetSetting("image_url", mgGetSetting("base_url"));
491 521
492 $galUseCoverImages = mgGetSetting("cover_images"); 522 $galUseCoverImages = mgGetSetting("cover_images");
523 $galShowKeywords = mgGetSetting("show_keywords");
493 524
494 $galAlbumIcon = mgGetSetting("album_icon"); 525 $galAlbumIcon = mgGetSetting("album_icon");
495 $galCleanURLS = mgGetSetting("clean_urls"); 526 $galCleanURLS = mgGetSetting("clean_urls");
496 $galTNPath = mgGetSetting("tn_path"); 527 $galTNPath = mgGetSetting("tn_path");
497 $galMedPath = mgGetSetting("med_path"); 528 $galMedPath = mgGetSetting("med_path");
500 531
501 $galMode = mgGetRequestItem("mode", "view", TRUE); 532 $galMode = mgGetRequestItem("mode", "view", TRUE);
502 $galPath = mgGetRequestItem("path", ".", TRUE); 533 $galPath = mgGetRequestItem("path", ".", TRUE);
503 $galPageIndex = intval(mgGetRequestItem("index", 0, TRUE)); 534 $galPageIndex = intval(mgGetRequestItem("index", 0, TRUE));
504 $galImage = mgGetRequestItem("image", FALSE, TRUE); 535 $galImage = mgGetRequestItem("image", FALSE, TRUE);
536
505 537
506 if (is_string($galImage)) 538 if (is_string($galImage))
507 $galImage = basename($galImage); 539 $galImage = basename($galImage);
508 540
509 if (($pageTimeZone = mgGetSetting("timezone")) !== NULL) 541 if (($pageTimeZone = mgGetSetting("timezone")) !== NULL)
615 "\" alt=\"".chentities($galImage)."\">". 647 "\" alt=\"".chentities($galImage)."\">".
616 "</div>\n". 648 "</div>\n".
617 mgGetNaviControlImageBoxJS($galPath, $galImagesIndex, $galEntries, $index, "nextBtm", 1)."\n". 649 mgGetNaviControlImageBoxJS($galPath, $galImagesIndex, $galEntries, $index, "nextBtm", 1)."\n".
618 mgGetNaviControlImageBox($galPath, $galImagesIndex, $galEntries, $index, "next", 1)."\n". 650 mgGetNaviControlImageBox($galPath, $galImagesIndex, $galEntries, $index, "next", 1)."\n".
619 "</div>\n". // pageImageBox 651 "</div>\n". // pageImageBox
620 (isset($data["caption"]) ? "<div id=\"pageImageCaption\" class=\"imageCaption\">".mgGetArrStr($data, "caption", "%1")."</div>\n" : ""). 652 (isset($data["caption"]) ?
621 // infoBox 653 "<div id=\"pageImageCaption\" class=\"imageCaption\">".mgGetArrStr($data, "caption", "%1").
654 mgGetImageKeywords($galData, $data, " (".mgQM("image_keywords_prefix"), mgQM("image_keywords_suffix").")")."</div>\n" :
655 mgGetImageKeywords($galData, $data, "<div id=\"pageImageCaption\" class=\"imageCaption\">".mgQM("image_keywords_prefix"), mgQM("image_keywords_suffix")."</div>\n")
656 );
657 // infoBox
658 echo
622 "<div id=\"infoBox\">\n". 659 "<div id=\"infoBox\">\n".
623 mgGetArr($data, "datetime", "<span class=\"infoDateTime\">%1</span>\n", "", "mgTimeStr"). 660 mgGetArr($data, "datetime", "<span class=\"infoDateTime\">%1</span>\n", "", "mgTimeStr").
624 implode(",\n", array_filter($list, function($a) { return $a !== NULL; }))."\n". 661 implode(",\n", array_filter($list, function($a) { return $a !== NULL; }))."\n".
625 "<a id=\"imageLink\" href=\"". 662 "<a id=\"imageLink\" href=\"".
626 mgCleanPathStr($galImageURL.$gpath."/".$galImage)."\">". 663 mgCleanPathStr($galImageURL.$gpath."/".$galImage)."\">".
707 echo "<div class=\"albumHeaderText\">".$headerText."</div>\n"; 744 echo "<div class=\"albumHeaderText\">".$headerText."</div>\n";
708 } 745 }
709 746
710 echo mgGetPageInfoHeaderEnd(); 747 echo mgGetPageInfoHeaderEnd();
711 748
712 mgPrintTable("albumTable", $galPath, $galEntries, $galAlbumsIndex, 0, FALSE); 749 mgPrintTable("albumTable", $galData, $galPath, $galEntries, $galAlbumsIndex, 0, FALSE);
713 mgPrintTable("imageTable", $galPath, $galEntries, $galImagesIndex, 0, FALSE); 750 mgPrintTable("imageTable", $galData, $galPath, $galEntries, $galImagesIndex, 0, FALSE);
714 } 751 }
715 752
716 mgPrintPageFooter(); 753 mgPrintPageFooter();
717 ?> 754 ?>