1
0

Initial commit of MiniSlide Show module.

This commit is contained in:
rWatcher 2009-08-21 16:15:21 -04:00
parent de6809c46a
commit a24bb6aef5
7 changed files with 318 additions and 0 deletions

View File

@ -0,0 +1,127 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2009 Bharat Mediratta
*
* 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 Admin_Minislideshow_Controller extends Admin_Controller {
public function index() {
// Generate a new admin page.
$view = new Admin_View("admin.html");
$view->content = new View("admin_minislideshow.html");
$view->content->minislideshow_form = $this->_get_admin_form();
print $view;
}
public function saveprefs() {
// Process the admin form.
// Prevent Cross Site Request Forgery
access::verify_csrf();
// Save user specified settings to the database.
$str_slideshow_url = Input::instance()->post("slideshow_url");
module::set_var("minislideshow", "slideshow_url", $str_slideshow_url);
$str_slideshow_shuffle = Input::instance()->post("shuffle");
module::set_var("minislideshow", "shuffle", $str_slideshow_shuffle);
$str_slideshow_dropshadow = Input::instance()->post("dropshadow");
module::set_var("minislideshow", "dropshadow", $str_slideshow_dropshadow);
$str_slideshow_show_title = Input::instance()->post("show_title");
module::set_var("minislideshow", "show_title", $str_slideshow_show_title);
$str_slideshow_trans_in_type = Input::instance()->post("trans_in_type");
module::set_var("minislideshow", "trans_in_type", $str_slideshow_trans_in_type);
$str_slideshow_trans_out_type = Input::instance()->post("trans_out_type");
module::set_var("minislideshow", "trans_out_type", $str_slideshow_trans_out_type);
$str_slideshow_mask = Input::instance()->post("mask");
module::set_var("minislideshow", "mask", $str_slideshow_mask);
$str_slideshow_use_full_image = Input::instance()->post("use_full_image");
module::set_var("minislideshow", "use_full_image", $str_slideshow_use_full_image);
$str_slideshow_delay = Input::instance()->post("delay");
module::set_var("minislideshow", "delay", $str_slideshow_delay);
// Display a success message and load the admin screen.
message::success(t("Your Settings Have Been Saved."));
$view = new Admin_View("admin.html");
$view->content = new View("admin_minislideshow.html");
$view->content->minislideshow_form = $this->_get_admin_form();
print $view;
}
private function _get_admin_form() {
// Generate a form for configuring the slideshow.
// Make a new Form.
$form = new Forge("admin/minislideshow/saveprefs", "", "post",
array("id" => "gMinislideshowAdminForm"));
// Get location of slideshow files.
$group_slideshow_files = $form->group("Minislideshow");
$group_slideshow_files->input("slideshow_url")
->label(t("URL to your minislideshow.swf"))
->value(module::get_var("minislideshow", "slideshow_url"));
// Get additional settings for the slideshow.
$group_slideshow_settings = $form->group("MinislideshowSettings");
$group_slideshow_settings->label(t("MiniSlide Show Settings"));
$group_slideshow_settings->dropdown('shuffle')
->label(t("Shuffle:"))
->options(array('true'=>'True', ''=>'False'))
->selected(module::get_var("minislideshow", "shuffle"));
$group_slideshow_settings->dropdown('dropshadow')
->label(t("Drop Shadow:"))
->options(array('true'=>'True', ''=>'False'))
->selected(module::get_var("minislideshow", "dropshadow"));
$group_slideshow_settings->dropdown('show_title')
->label(t("Show Title:"))
->options(array('top'=>'Top', 'bottom'=>'Bottom', ''=>'False'))
->selected(module::get_var("minislideshow", "show_title"));
$group_slideshow_settings->dropdown('trans_in_type')
->label(t("Transition In:"))
->options(array('Blinds'=>'Blinds', ''=>'Fade', 'Fly'=>'Fly', 'Iris'=>'Iris', 'Photo'=>'Photo', 'PixelDissolve'=>'Pixel Dissolve', 'Rotate'=>'Rotate', 'Squeeze'=>'Squeeze', 'Wipe'=>'Wipe', 'Zoom'=>'Zoom', 'Random'=>'Random'))
->selected(module::get_var("minislideshow", "trans_in_type"));
$group_slideshow_settings->dropdown('trans_out_type')
->label(t("Transition Out:"))
->options(array('Blinds'=>'Blinds', ''=>'Fade', 'Fly'=>'Fly', 'Iris'=>'Iris', 'Photo'=>'Photo', 'PixelDissolve'=>'Pixel Dissolve', 'Rotate'=>'Rotate', 'Squeeze'=>'Squeeze', 'Wipe'=>'Wipe', 'Zoom'=>'Zoom', 'Random'=>'Random'))
->selected(module::get_var("minislideshow", "trans_out_type"));
$group_slideshow_settings->dropdown('mask')
->label(t("Mask:"))
->options(array(''=>'None', 'circleMask'=>'Circle', 'roundedMask'=>'Rounded Corners', 'starMask'=>'Star'))
->selected(module::get_var("minislideshow", "mask"));
$group_slideshow_settings->dropdown('use_full_image')
->label(t("Use Full Image:"))
->options(array('true', 'false', 'Use Resize'))
->selected(module::get_var("minislideshow", "use_full_image"));
$group_slideshow_settings->input("delay")
->label(t("Delay:"))
->value(module::get_var("minislideshow", "delay"));
// Add a save button to the form.
$form->submit("SaveSettings")->value(t("Save"));
// Return the newly generated form.
return $form;
}
}

View File

@ -0,0 +1,69 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2009 Bharat Mediratta
*
* 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 MiniSlideShow_Controller extends Controller {
public function showslideshow($item_id) {
// Generate the Dialog Box to display the slideshow in.
$view = new View("minislideshow_dialog.html");
// Figure out if the user has the necessary privlidges to view the album.
$item = ORM::factory("item", $item_id);
if ($item->is_album()) {
$view->item_id = $item->id;
} else {
$view->item_id = $item->parent_id;
$item = ORM::factory("item", $item_id);
}
access::required("view", $item);
// Generate additional slideshow parameters from database values.
$slideshow_params = "";
if (module::get_var("minislideshow", "shuffle") != "") {
$slideshow_params = $slideshow_params . "&shuffle=" . module::get_var("minislideshow", "shuffle");
}
if (module::get_var("minislideshow", "dropshadow") != "") {
$slideshow_params = $slideshow_params . "&showDropShadow=" . module::get_var("minislideshow", "dropshadow");
}
if (module::get_var("minislideshow", "show_title") != "") {
$slideshow_params = $slideshow_params . "&showTitle=" . module::get_var("minislideshow", "show_title");
}
if (module::get_var("minislideshow", "trans_in_type") != "") {
$slideshow_params = $slideshow_params . "&transInType=" . module::get_var("minislideshow", "trans_in_type");
}
if (module::get_var("minislideshow", "trans_out_type") != "") {
$slideshow_params = $slideshow_params . "&transOutType=" . module::get_var("minislideshow", "trans_out_type");
}
if (module::get_var("minislideshow", "mask") != "") {
$slideshow_params = $slideshow_params . "&" . module::get_var("minislideshow", "mask") . "=true";
}
if (module::get_var("minislideshow", "use_full_image") != "") {
$slideshow_params = $slideshow_params . "&useFull=true";
if (module::get_var("minislideshow", "use_full_image") != "2") {
$slideshow_params = $slideshow_params . "useResizes=true";
}
}
if (module::get_var("minislideshow", "delay") != "") {
$slideshow_params = $slideshow_params . "&delay=" . module::get_var("minislideshow", "delay");
}
$view->slideshow_params = $slideshow_params;
// Display the slideshow.
print $view;
}
}

View File

@ -0,0 +1,64 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2009 Bharat Mediratta
*
* 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 minislideshow_event_Core {
static function admin_menu($menu, $theme) {
// Add a menu option to the admin screen for configuring the slideshow.
$menu->get("settings_menu")
->append(Menu::factory("link")
->id("minislideshow")
->label(t("MiniSlide Show settings"))
->url(url::site("admin/minislideshow")));
}
static function module_change($changes) {
// Display a warning message if the RSS module is not installed.
if (!module::is_active("rss") || in_array("rss", $changes->deactivate)) {
site_status::warning(
t("The MiniSlide Show module requires the RSS module. " .
"<a href=\"%url\">Activate the RSS module now</a>",
array("url" => url::site("admin/modules"))),
"minislideshow_needs_rss");
} else {
site_status::clear("minislideshow_needs_rss");
}
}
static function album_menu($menu, $theme) {
// Add an option to access the slideshow from the album view.
$menu
->append(Menu::factory("link")
->id("minislideshow")
->label(t("View MiniSlide Show"))
->url(url::site("minislideshow/showslideshow/" . $theme->item()))
->css_class("gDialogLink")
->css_id("gSlideshowLink"));
}
static function photo_menu($menu, $theme) {
// Add an option to access the slideshow from the photo view.
$menu
->append(Menu::factory("link")
->id("minislideshow")
->label(t("View MiniSlide Show"))
->url(url::site("minislideshow/showslideshow/" . $theme->item()))
->css_class("gDialogLink")
->css_id("gSlideshowLink"));
}
}

View File

@ -0,0 +1,32 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2009 Bharat Mediratta
*
* 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 minislideshow_installer {
static function install() {
module::set_version("minislideshow", 1);
}
static function deactivate() {
site_status::clear("minislideshow_needs_rss");
}
static function uninstall() {
module::delete("minislideshow");
}
}

View File

@ -0,0 +1,3 @@
name = "MiniSlide Show"
description = "Display MiniSlide Show on your Gallery."
version = 1

View File

@ -0,0 +1,5 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<div id="gMinislideshowAdmin">
<h2> <?= t("MiniSlide Show Settings") ?> </h2>
<?= $minislideshow_form ?>
</div>

View File

@ -0,0 +1,18 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<style>
input[type="text"] {
width: 95%;
}
</style>
<h1 style="display: none;"><?= t("MiniSlide Show") ?></h1>
<div id="gMiniSlideshow">
<embed src="<?= module::get_var("minislideshow", "slideshow_url") ?>" width="485" height="300"
align="middle" pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" name="minislide" wmode="transparent"
allowFullscreen="true" allowScriptAccess="always" quality="high"
flashvars="xmlUrl=<?= url::site("rss/feed/gallery/album/" . $item_id, "http") ?><?=$slideshow_params ?>"></embed>
<table><tr>
<td>Embed:</td>
<td><input type="text" onclick="this.focus(); this.select();" value="<embed src=&quot;<?= module::get_var("minislideshow", "slideshow_url") ?>&quot; width=&quot;485&quot; height=&quot;300&quot; align=&quot;middle&quot; pluginspage=&quot;http://www.macromedia.com/go/getflashplayer&quot; type=&quot;application/x-shockwave-flash&quot; name=&quot;minislide&quot; wmode=&quot;transparent&quot; allowFullscreen=&quot;true&quot; allowScriptAccess=&quot;always&quot; quality=&quot;high&quot; flashvars=&quot;xmlUrl=<?= url::site("rss/feed/gallery/album/" . $item_id, "http") ?><?=$slideshow_params ?>&quot;></embed>" readonly></td>
</tr></table>
</div>