/usr/share/horde/ansel/lib/View/GalleryRenderer/GalleryLightbox.php is in php-horde-ansel 3.0.5+debian0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | <?php
/**
* @copyright 2008-2016 Horde LLC (http://www.horde.org)
* @author Michael J Rubinsky <mrubinsk@horde.org>
* @category Horde
* @license http://www.horde.org/licenses/gpl GPL
* @package Ansel
*/
/**
* Ansel_View_GalleryRenderer_GalleryLightbox:: Class wraps display of the lightbox
* style gallery views.
*
* Copyright 2008-2016 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.horde.org/licenses/gpl.
*
* @copyright 2008-2016 Horde LLC (http://www.horde.org)
* @author Michael J Rubinsky <mrubinsk@horde.org>
* @category Horde
* @license http://www.horde.org/licenses/gpl GPL
* @package Ansel
*/
class Ansel_View_GalleryRenderer_GalleryLightbox extends Ansel_View_GalleryRenderer_Base
{
public function __construct(Ansel_View_Gallery $view = null)
{
parent::__construct($view);
$this->title = _("Lightbox Gallery");
}
/**
* Perform any tasks that should be performed before the view is rendered.
*/
protected function _init()
{
global $page_output;
if (empty($this->view->image_onclick)) {
$this->view->image_onclick = 'return lb.start(%i);';
}
if (empty($this->view->api)) {
$page_output->addThemeStylesheet('lightbox.css');
$page_output->addScriptFile('scriptaculous/effects.js', 'horde');
$page_output->addScriptFile('lightbox.js');
}
}
/**
* Get the HTML representing this view.
*
* @return string The HTML
*/
public function html()
{
global $conf, $prefs, $registry;
// Initialize the Horde_View instance.
$view = $this->_getHordeView();
// Get JSON data for view
if ($this->mode == Ansel_GalleryMode_Base::MODE_NORMAL) {
$json = Ansel_View_Base::json(
$this->view->gallery,
array(
'full' => !empty($this->view->api),
'perpage' => $this->perpage
)
);
} else {
if (!empty($this->date['day']) && $this->numTiles) {
$json = Ansel_View_Base::json(
$this->view->gallery,
array(
'full' => !empty($this->view->api),
'perpage' => $this->perpage
)
);
} else {
$json = '[]';
}
}
$date_params = Ansel::getDateParameter(array(
'year' => !empty($this->view->year) ? $this->view->year : 0,
'month' => !empty($this->view->month) ? $this->view->month : 0,
'day' => !empty($this->view->day) ? $this->view->day : 0));
$pagerurl = $this->_getPagerUrl();
$graphics_dir = Horde::url(Horde_Themes::img(), true, -1);
$image_text = _("Photo");
$of = _("of");
$flipped = array_flip($date_params);
if (count($flipped) == 1 && !empty($flipped[0])) {
$gallery_url = $pagerurl . '?';
} else {
$gallery_url = $pagerurl . '&';
}
$js = array();
$js[] = <<<EOT
LightboxOptions = {
gallery_json: {$json},
fileLoadingImage: '{$graphics_dir}/lightbox/loading.gif',
fileBottomNavCloseImage: '{$graphics_dir}/lightbox/closelabel.gif',
overlayOpacity: 0.8, // controls transparency of shadow overlay
animate: true, // toggles resizing animations
resizeSpeed: 7, // controls the speed of the image resizing animations (1=slowest and 10=fastest)
borderSize: 10, // if you adjust the padding in the CSS, you will need to update this variable
// Used to write: Image # of #.
labelImage: '{$image_text}',
labelOf: '{$of}',
//URL to return to when the lightbox closes
returnURL: '{$gallery_url}',
startPage: '{$view->page}'
};
document.lb = new Lightbox(LightboxOptions); if (window.location.hash.length) document.lb.start(window.location.hash.substring(1));
EOT;
$GLOBALS['page_output']->addInlineScript($js, true);
// Output js/css here if we are calling via the api
if ($this->view->api) {
Horde::startBuffer();
global $page_output;
$page_output->addThemeStylesheet('lightbox.css');
$page_output->includeStylesheetFiles(array('nobase' => true), true);
foreach (array('prototype.js', 'accesskeys.js', 'scriptaculous/effects.js') as $val) {
$tmp = new Horde_Script_File_JsDir($val, 'horde');
echo $tmp->tag_full;
}
$tmp = new Horde_Script_File_JsDir('lightbox.js');
echo $tmp->tag_full;
$page_output->outputInlineScript();
$html = Horde::endBuffer();
return $html . $view->render('gallery');
}
return $view->render('gallery');
}
}
|