Archived
1
0
Fork 0

allow embedded use (fixes #56)

This commit is contained in:
Jan Dittberner 2009-07-12 16:11:02 +00:00
parent 68ca59cac4
commit 050caa5830
4 changed files with 11 additions and 9 deletions

View file

@ -377,7 +377,7 @@ function getAllThumbnails(&$thumbinfo) {
$retval = array(); $retval = array();
foreach ($thumbinfo[2] as $basename => $data) { foreach ($thumbinfo[2] as $basename => $data) {
$retval[] = array('src' => $configuration['gallerydir'] . DIRECTORY_SEPARATOR . $data[0], $retval[] = array('src' => $configuration['gallerypath'] . DIRECTORY_SEPARATOR . $data[0],
'sizes' => $data[1][3], 'sizes' => $data[1][3],
'alt' => getImageLabel($thumbinfo[1], $basename)); 'alt' => getImageLabel($thumbinfo[1], $basename));
} }

View file

@ -28,7 +28,8 @@
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
require('includes/template.class.php'); $dir = dirname(realpath(__file__));
require("$dir" . DIRECTORY_SEPARATOR . "template.class.php");
/** /**
* Theme class. * Theme class.
@ -66,7 +67,7 @@ class Theme {
*/ */
function __construct($name, &$configuration) { function __construct($name, &$configuration) {
$themeini = realpath(implode(DIRECTORY_SEPARATOR, $themeini = realpath(implode(DIRECTORY_SEPARATOR,
array('themes', $name, 'theme.ini'))); array($configuration['themedir'], $name, 'theme.ini')));
if (!$themeini) { if (!$themeini) {
die("invalid theme $name"); die("invalid theme $name");
} }

View file

@ -32,7 +32,7 @@
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
$basedir = dirname(__file__); $basedir = realpath(dirname(__file__));
/** /**
* Inkludiert die Funktionsbibliothek. * Inkludiert die Funktionsbibliothek.
@ -59,16 +59,17 @@ $template = $theme->getTemplate();
if ($theme->themetype == 'horizontal') { if ($theme->themetype == 'horizontal') {
$inlinestyles = sprintf("#scrollable { width:%dpx; }\n", $thumbinfo[0]); $inlinestyles = sprintf("#scrollable { width:%dpx; }\n", $thumbinfo[0]);
$inlinescript = "var themetype='horizontal';"; $inlinescript = array("var themetype='horizontal';");
} else { } else {
$inlinestyles = sprintf("#scrollable { height:%dpx; }\n", $thumbinfo[0]); $inlinestyles = sprintf("#scrollable { height:%dpx; }\n", $thumbinfo[0]);
$inlinescript = "var themetype='vertical';"; $inlinescript = array("var themetype='vertical';");
} }
$inlinescript[] = "var basepath='" . $configuration['basepath'] . "';";
$template->assign('scripts', $scripts); $template->assign('scripts', $scripts);
$template->assign('styles', $styles); $template->assign('styles', $styles);
$template->assign('inlinestyle', $inlinestyles); $template->assign('inlinestyle', $inlinestyles);
$template->assign('inlinescript', $inlinescript); $template->assign('inlinescript', implode("\n", $inlinescript));
$template->assign('title', getGalleryTitle($thumbinfo)); $template->assign('title', getGalleryTitle($thumbinfo));
$template->assign('gallerylinks', getGalleryLinks()); $template->assign('gallerylinks', getGalleryLinks());
$template->assign('thumbnails', getAllThumbnails($thumbinfo)); $template->assign('thumbnails', getAllThumbnails($thumbinfo));

View file

@ -51,7 +51,7 @@ function getPathParts(imagesrc) {
} }
function updateContentImage(pathParts) { function updateContentImage(pathParts) {
$.getJSON("ajaxrequest.php", { $.get(basepath + "ajaxrequest.php", {
"imagename" : pathParts.filename, "imagename" : pathParts.filename,
"galleryname" : pathParts.gallery "galleryname" : pathParts.gallery
}, function(data, textStatus) { }, function(data, textStatus) {
@ -61,7 +61,7 @@ function updateContentImage(pathParts) {
$("#content_main a").attr("href", data["full"]); $("#content_main a").attr("href", data["full"]);
$("#content_main a").attr("title", data["label"]); $("#content_main a").attr("title", data["label"]);
document.title = data["title"]; document.title = data["title"];
}); }, 'json');
} }
$(document).ready(function() { $(document).ready(function() {