initRes ? array( 'largealbumview/main.css' => new CSSFile(), ) : array(); } /* check album requests to redirect automatically to large view */ public function handleRequest(Request &$request) { /* redirect album action index to large */ if ($request->action[0] == '') { $album = Factory::createAlbum($request->album); $file = Factory::createFile($request->file, $album); if ((!$file || !$file->isAvailable()) && $album->getFilesNamed(self::$_largeTriggerFile)) { /* redirect to large view */ header('Location: '.Lonely::model()->server.Lonely::model()->rootScript.$album->getPath().'large', true, 302); exit; } } /* let others handle the request */ return true; } /* returns links displayed at top of albums */ public function albumLinksEvent(Album $album) { return count($album->getFiles()) ? array(array('url' => Lonely::model()->rootScript.$album->getPath().'large', 'label' => 'large')) : array(); } /* show all images of an album */ public function lonelyLargeAction(Request $request) { $lonely = Lonely::model(); /* file requested */ if ($request->file) { $lonely->error(); } $album = Factory::createAlbum($request->album); /* album requested */ if ($album->isAvailable()) { $this->initRes = true; $html = "
\n\n"; /* parent albums */ $parents = $album->getParents(); /* title */ $title = $album->getName(); foreach ($parents as $element) { $title .= " - ".$element->getName(); } $lonely->HTMLTitle = $title; /* breadcrumbs */ if (count($parents)) { $html .= "\t
\n". "\t\t\n". "\t
\n\n"; } /* album text */ $albumText = $album->getText(); $html .= $albumText ? "\t
".$albumText."
\n\n" : ""; /* links */ $html2 = ""; foreach ($lonely->callEvent('albumLinks', $album) as $name => $datas) { foreach ($datas as $data) { if ($name == 'LargeAlbumViewModule') { $html2 .= "\t\t
  • ".\LonelyGallery\escape($data['label'])."
  • \n"; } else { $html2 .= "\t\t
  • ".\LonelyGallery\escape($data['label'])."
  • \n"; } } } if ($html2 != "") { $html .= "\t\n\n"; } /* files */ $html .= "\t
    "; $action = $lonely->defaultFileAction; if (count($files = $album->getFiles())) { foreach ($files as $file) { /* image */ $name = \LonelyGallery\escape($file->getName()); $html .= "\t\t
    \n"; /* preview */ $html .= "\t\t\t
    getId()."\" class=\"preview-box\">\n". "\t\t\t\t".$file->getPreviewHTML()."\n". "\t\t\t
    \n\n"; /* info */ if ($file instanceof ContentFile || $file->showTitle) { $html .= "\t\t\t
    \n". "\t\t\t\t

    \n". "\t\t\t\t\trootScript.$file->getPath().'/'.$action)."\">".$name."\n". "\t\t\t\t

    \n". "\t\t\t
    \n"; } $html .= "\t\t
    \n"; } } /* empty album */ else if (!count($albums)) { if (empty($request->album)) { $html .= "\t

    This gallery is empty. Try adding some image files to the directory you placed this script in. You can also have albums by creating directories.

    \n\n"; } else { $html .= "\t

    This album is empty.

    \n\n"; } } $html .= "\t
    "; $html .= "
    \n"; $lonely->HTMLContent = $html; $lonely->display(); exit; } /* nothing requested */ $lonely->error(); } } class CSSFile extends \LonelyGallery\CSSFile { public function whenModified() { return filemtime(__FILE__); } public function getContent() { return <<<'CSS' #content > .album.largealbumview { margin: 0; } #content > .album.largealbumview > .file { margin-left: 0; margin-right: 0; } #content > .album.largealbumview > *:not(.file) { margin-left: 8px; margin-right: 8px; } #content > .album.largealbumview > .file { margin-bottom: 20px; margin-top: 20px; } #content > .album.largealbumview > .file > .preview-box { line-height: 100%; min-height: 0; } CSS; } } ?>