2009-05-12 23:46:03 +00:00
|
|
|
<?php defined("SYSPATH") or die("No direct script access.");
|
|
|
|
|
/**
|
|
|
|
|
* Gallery - a web based photo album viewer and editor
|
2009-05-13 20:04:58 +00:00
|
|
|
* Copyright (C) 2000-2009 Bharat Mediratta
|
2009-05-12 23:46:03 +00:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or (at
|
|
|
|
|
* your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
*/
|
|
|
|
|
class slideshow_event_Core {
|
|
|
|
|
static function module_change($changes) {
|
2009-05-26 05:28:59 +00:00
|
|
|
if (!module::is_active("rss") || in_array("rss", $changes->deactivate)) {
|
2009-05-12 23:46:03 +00:00
|
|
|
site_status::warning(
|
|
|
|
|
t("The Slideshow module requires the RSS module. " .
|
2009-05-26 05:28:59 +00:00
|
|
|
"<a href=\"%url\">Activate the RSS module now</a>",
|
2009-08-31 02:12:01 -07:00
|
|
|
array("url" => html::mark_clean(url::site("admin/modules")))),
|
2009-05-12 23:46:03 +00:00
|
|
|
"slideshow_needs_rss");
|
|
|
|
|
} else {
|
|
|
|
|
site_status::clear("slideshow_needs_rss");
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-07-28 13:47:22 -07:00
|
|
|
|
|
|
|
|
static function album_menu($menu, $theme) {
|
2009-09-01 20:13:23 -07:00
|
|
|
$descendants_count = ORM::factory("item", $theme->item()->id)
|
2009-11-26 19:25:09 -08:00
|
|
|
->descendants_count(array(array("type", "=", "photo")));
|
2009-08-27 15:04:14 -07:00
|
|
|
if ($descendants_count > 1) {
|
2009-09-01 20:13:23 -07:00
|
|
|
$menu->append(Menu::factory("link")
|
|
|
|
|
->id("slideshow")
|
|
|
|
|
->label(t("View slideshow"))
|
2009-11-15 21:56:55 -08:00
|
|
|
->url("javascript:PicLensLite.start(" .
|
|
|
|
|
"{maxScale:0,feedUrl:'" . self::_feed_url($theme) . "'})")
|
2009-10-04 00:27:22 -06:00
|
|
|
->css_id("g-slideshow-link"));
|
2009-08-27 15:04:14 -07:00
|
|
|
}
|
2009-07-28 13:47:22 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static function photo_menu($menu, $theme) {
|
2009-09-01 20:13:23 -07:00
|
|
|
$menu->append(Menu::factory("link")
|
|
|
|
|
->id("slideshow")
|
|
|
|
|
->label(t("View slideshow"))
|
2009-11-15 21:56:55 -08:00
|
|
|
->url("javascript:PicLensLite.start(" .
|
|
|
|
|
"{maxScale:0,feedUrl:'" . self::_feed_url($theme) . "'})")
|
2009-10-04 00:27:22 -06:00
|
|
|
->css_id("g-slideshow-link"));
|
2009-07-28 13:47:22 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static function tag_menu($menu, $theme) {
|
2009-09-01 20:13:23 -07:00
|
|
|
$menu->append(Menu::factory("link")
|
|
|
|
|
->id("slideshow")
|
|
|
|
|
->label(t("View slideshow"))
|
2009-11-15 21:56:55 -08:00
|
|
|
->url("javascript:PicLensLite.start(" .
|
|
|
|
|
"{maxScale:0,feedUrl:'" . self::_feed_url($theme) . "'})")
|
2009-10-04 00:27:22 -06:00
|
|
|
->css_id("g-slideshow-link"));
|
2009-09-01 20:13:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static function _feed_url($theme) {
|
|
|
|
|
if ($item = $theme->item()) {
|
|
|
|
|
if (!$item->is_album()) {
|
|
|
|
|
$item = $item->parent();
|
|
|
|
|
}
|
2009-11-15 21:56:55 -08:00
|
|
|
return rss::url("gallery/album/{$item->id}?page_size=100");
|
2009-09-01 20:13:23 -07:00
|
|
|
} else {
|
2009-11-15 21:56:55 -08:00
|
|
|
return rss::url("tag/tag/{$theme->tag()->id}?page_size=100");
|
2009-09-01 20:13:23 -07:00
|
|
|
}
|
2009-07-28 13:47:22 -07:00
|
|
|
}
|
2009-05-12 23:46:03 +00:00
|
|
|
}
|