Seitentitel wird aus Galerie- und Bildtitel zusammengesetzt (fixes #26)
This commit is contained in:
		
							parent
							
								
									4dcb9470b6
								
							
						
					
					
						commit
						f8a89b7ca1
					
				
					 3 changed files with 50 additions and 16 deletions
				
			
		|  | @ -99,13 +99,16 @@ function getGalleryConfig($galleryname = null) { | |||
|  * @bug @a data sollte @a label heißen | ||||
|  */ | ||||
| function getImgInfo($galleryname, $imagename) { | ||||
|   $label = getImageLabel($galleryname, $imagename); | ||||
|   $gallerylabel = getGalleryLabel($galleryname); | ||||
|   return array("name" => $imagename, | ||||
|                "data" => getImageLabel($galleryname, $imagename), | ||||
|                "data" => $label, | ||||
|                "preview" => GALLERYPREFIX . DIRECTORY_SEPARATOR . | ||||
|                getScaledImage($galleryname, $imagename, | ||||
|                               $GLOBALS["previewwidth"], false), | ||||
|                "full" => GALLERYPREFIX . DIRECTORY_SEPARATOR . $galleryname . | ||||
|                DIRECTORY_SEPARATOR . $imagename | ||||
|                DIRECTORY_SEPARATOR . $imagename, | ||||
|                "title" => sprintf("%s :: %s", $gallerylabel, $label) | ||||
|                ); | ||||
| } | ||||
| 
 | ||||
|  | @ -139,10 +142,31 @@ function getImageLabel($galleryname, $imagename) { | |||
| } | ||||
| 
 | ||||
| /** | ||||
|  * Liefert die aktuelle Gallerie. Die Gallerie kann entweder im | ||||
|  * GET-Parameter @c galleryname stehen, als Wert @a default in der @a | ||||
|  * gallery-Sektion der zentralen galleryinfo.ini angegeben werden oder | ||||
|  * es wird das erste Unterverzeichnis von GALLERYPREFIX verwendet. | ||||
|  * Liefert das Label der Galerie. Das Label wird aus dem Wert @a title | ||||
|  * der Sektion @a gallery der @c galleryinfo.ini der Galerie | ||||
|  * geholt. Falls dieser Wert nicht definiert ist, wird der Name der | ||||
|  * Galerie zurückgegeben. | ||||
|  * | ||||
|  * @param $galleryname Galeriename | ||||
|  * | ||||
|  * @return Label der Galerie | ||||
|  */ | ||||
| function getGalleryLabel($galleryname) { | ||||
|   $inidata = getGalleryConfig($galleryname); | ||||
|   if ($inidata[GALLERYSEC]['title']) { | ||||
|     $label = $inidata[GALLERYSEC]['title']; | ||||
|   } else { | ||||
|     $label = $galleryname; | ||||
|   } | ||||
|   return $label; | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * Liefert die aktuelle Galerie. Die Galerie kann entweder im | ||||
|  * GET-Parameter @c galleryname stehen, als Wert @a default in der | ||||
|  * Sektion @a gallery der zentralen @c galleryinfo.ini angegeben | ||||
|  * werden oder es wird das erste Unterverzeichnis von @c GALLERYPREFIX | ||||
|  * verwendet. | ||||
|  * | ||||
|  * @return Galeriename | ||||
|  */ | ||||
|  | @ -277,17 +301,11 @@ function getGalleryLinks() { | |||
|                 GLOB_ONLYDIR) as $directory) { | ||||
|     $basename = basename($directory); | ||||
|     if (galleryExists($basename)) { | ||||
|       $inidata = getGalleryConfig($basename); | ||||
|       if ($inidata[GALLERYSEC]['title']) { | ||||
|         $label = $inidata[GALLERYSEC]['title']; | ||||
|       } else { | ||||
|         $label = $basename; | ||||
|       } | ||||
|       $url = sprintf('index.php?galleryname=%s', urlencode($basename)); | ||||
|       $retval[] = array('gallery' => $basename, | ||||
|                         'label' => getGalleryLabel($basename), | ||||
|                         'url' => $url); | ||||
|     } | ||||
|     $retval[] = array('gallery' => $basename, | ||||
|                       'label' => $label, | ||||
|                       'url' => $url); | ||||
|   } | ||||
|   return $retval; | ||||
| } | ||||
|  | @ -358,3 +376,18 @@ function renderDescription(&$thumbinfo) { | |||
|     break; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * Gibt den Titeltext für die Galerie aus. | ||||
|  * | ||||
|  * @param &$thumbinfo Referenz auf ein Array, wie es von | ||||
|  * getThumbNailInfo() zurückgegeben wird | ||||
|  * | ||||
|  * @return Inhalt für das title-Tag auf der Ausgabeseite | ||||
|  */ | ||||
| function getGalleryTitle(&$thumbinfo) { | ||||
|   foreach ($thumbinfo[2] as $basename => $data) { | ||||
|     return htmlentities(sprintf("%s :: %s", getGalleryLabel($thumbinfo[1]), | ||||
|                                 getImageLabel($thumbinfo[1], $basename))); | ||||
|   } | ||||
| } | ||||
|  |  | |||
|  | @ -52,7 +52,7 @@ $thumbinfo = getThumbNailInfo($gallery); | |||
|  "-//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd"> | ||||
| <head> | ||||
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | ||||
| <title>Bilderframework</title> | ||||
| <title><?php print getGalleryTitle($thumbinfo); ?></title>
 | ||||
| <link rel="stylesheet" type="text/css" href="css/main.css" /> | ||||
| <link rel="stylesheet" href="css/format.css" type="text/css" /> | ||||
| <link rel="stylesheet" href="css/jquery.lightbox.css" type="text/css" /> | ||||
|  |  | |||
|  | @ -60,6 +60,7 @@ function updateContentImage(pathParts) { | |||
|         $("#content_main img").attr("src", data["preview"]); | ||||
|         $("#content_main a").attr("href", data["full"]); | ||||
|         $("#content_main a").attr("title", data["data"]); | ||||
|         document.title = data["title"]; | ||||
|     }); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Reference in a new issue