-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New module: carousel not on GIT before
- Loading branch information
Showing
13 changed files
with
876 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,183 @@ | |||
<?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_Carousel_Controller extends Admin_Controller { | |||
public function index() { | |||
print $this->_get_view(); | |||
} | |||
|
|||
public function handler() { | |||
access::verify_csrf(); | |||
|
|||
$form = $this->_get_form(); | |||
if ($form->validate()) { | |||
module::set_var( | |||
"carousel", "circular", $form->carousel->circular->value); | |||
module::set_var( | |||
"carousel", "autoscroll", $form->carousel->autoscroll->value); | |||
module::set_var( | |||
"carousel", "autostart", $form->carousel->autostart->value); | |||
module::set_var( | |||
"carousel", "speed", $form->carousel->speed->value); | |||
module::set_var( | |||
"carousel", "mousewheel", $form->carousel->mousewheel->value); | |||
|
|||
module::set_var( | |||
"carousel", "title2", $form->recent->title2->value); | |||
module::set_var( | |||
"carousel", "thumbsize2", $form->recent->thumbsize2->value); | |||
module::set_var( | |||
"carousel", "visible2", $form->recent->visible2->value); | |||
module::set_var( | |||
"carousel", "quantity2", $form->recent->quantity2->value); | |||
module::set_var( | |||
"carousel", "onphoto2", $form->recent->onphoto2->value); | |||
module::set_var( | |||
"carousel", "onalbum2", $form->recent->onalbum2->value); | |||
|
|||
module::set_var( | |||
"carousel", "title3", $form->popular->title3->value); | |||
module::set_var( | |||
"carousel", "thumbsize3", $form->popular->thumbsize3->value); | |||
module::set_var( | |||
"carousel", "visible3", $form->popular->visible3->value); | |||
module::set_var( | |||
"carousel", "quantity3", $form->popular->quantity3->value); | |||
module::set_var( | |||
"carousel", "onphoto3", $form->popular->onphoto3->value); | |||
module::set_var( | |||
"carousel", "onalbum3", $form->popular->onalbum3->value); | |||
|
|||
module::set_var( | |||
"carousel", "title", $form->random->title->value); | |||
module::set_var( | |||
"carousel", "thumbsize", $form->random->thumbsize->value); | |||
module::set_var( | |||
"carousel", "visible", $form->random->visible->value); | |||
module::set_var( | |||
"carousel", "quantity", $form->random->quantity->value); | |||
module::set_var( | |||
"carousel", "onphoto", $form->random->onphoto->value); | |||
module::set_var( | |||
"carousel", "onalbum", $form->random->onalbum->value); | |||
|
|||
message::success(t("Your settings have been saved.")); | |||
url::redirect("admin/carousel"); | |||
} | |||
print $this->_get_view($form); | |||
} | |||
|
|||
private function _get_view($form=null) { | |||
$v = new Admin_View("admin.html"); | |||
$v->content = new View("admin_carousel.html"); | |||
$v->content->form = empty($form) ? $this->_get_form() : $form; | |||
return $v; | |||
} | |||
|
|||
private function _get_form() { | |||
for ($i = 5; $i <= 50; $i+=5) { | |||
$range[$i] = "$i"; | |||
} | |||
$shortrange = array(); | |||
for ($i = 1; $i < 21; $i++) { | |||
$key=((float)$i / 2); | |||
$shortrange["$key"] = sprintf("%.1f", (float)$i / 2); | |||
} | |||
if (module::get_var("carousel", "autoscroll") == true) { | |||
$disableme == "false"; | |||
} else { | |||
$disableme == "true"; | |||
} | |||
$form = new Forge("admin/carousel/handler", "", "post", array("id" => "g-admin-form")); | |||
|
|||
$group = $form->group("carousel")->label(t("General carousel settings")); | |||
$group->checkbox("circular")->label(t('Enable the carousel to be circular so it starts over again from the beggining.')) | |||
->checked(module::get_var("carousel", "circular", "0")); | |||
$group->checkbox("autoscroll")->label(t('Carousel should auto scroll. Toggle value to change settings below.')) | |||
->onClick("toggle()") | |||
->id("autoscroll") | |||
->checked(module::get_var("carousel", "autoscroll", "0")); | |||
$group->input("autostart")->label(t("Enter the value of the auto start. (800)")) | |||
->value(module::get_var("carousel", "autostart", "800")) | |||
->id("auto") | |||
->disabled("false") | |||
->rules("valid_numeric|length[1,5]"); | |||
$group->input("speed")->label(t('Enter the scrolling speed of the carousel. (1000)')) | |||
->value(module::get_var("carousel", "speed", "1000")) | |||
->id("speed") | |||
->disabled($disableme) | |||
->rules("valid_numeric|length[1,5]"); | |||
$group->checkbox("mousewheel")->label(t('Enable mouse wheel. Allows for mouse wheel to scroll items.')) | |||
->checked(module::get_var("carousel", "mousewheel", "0")); | |||
|
|||
$group = $form->group("recent")->label(t("Recent carousel block")); | |||
$group->input("title2")->label(t('Enter the title of the recent block.')) | |||
->value(module::get_var("carousel", "title2", "Recent items")); | |||
$group->input("thumbsize2")->label(t('Enter the size of the thumbs. (pixels)')) | |||
->value(module::get_var("carousel", "thumbsize2", "200")) | |||
->rules("valid_numeric|length[2,3]"); | |||
$group->dropdown("visible2")->label(t('Enter number of thumbs to show. (height of carousel)')) | |||
->options($shortrange) | |||
->selected(module::get_var("carousel", "visible2", "1")); | |||
$group->dropdown("quantity2")->label(t("Choose the toal quantity of thumbs in recent carousel.")) | |||
->options($range) | |||
->selected(module::get_var("carousel", "quantity2", "25")); | |||
$group->checkbox("onalbum2")->label(t("Show on album & collection pages")) | |||
->checked(module::get_var("carousel", "onalbum2", "0")); | |||
$group->checkbox("onphoto2")->label(t("Show on photo pages")) | |||
->checked(module::get_var("carousel", "onphoto2", "0")); | |||
|
|||
$group = $form->group("popular")->label(t("Popular carousel block")); | |||
$group->input("title3")->label(t('Enter the title of the popular block.')) | |||
->value(module::get_var("carousel", "title3", "Popular items")); | |||
$group->input("thumbsize3")->label(t('Enter the thumb size. (pixels)')) | |||
->value(module::get_var("carousel", "thumbsize3", "200")) | |||
->rules("valid_numeric|length[2,3]"); | |||
$group->dropdown("visible3")->label(t('Enter number of thumbs to show. (height of carousel)')) | |||
->options($shortrange) | |||
->selected(module::get_var("carousel", "visible3", "1")); | |||
$group->dropdown("quantity3")->label(t("Choose the toal quantity of thumbs in popular carousel.")) | |||
->options($range) | |||
->selected(module::get_var("carousel", "quantity3", "25")); | |||
$group->checkbox("onalbum3")->label(t("Show on album & collection pages")) | |||
->checked(module::get_var("carousel", "onalbum3", "0")); | |||
$group->checkbox("onphoto3")->label(t("Show on photo pages")) | |||
->checked(module::get_var("carousel", "onphoto3", "0")); | |||
|
|||
$group = $form->group("random")->label(t("Random carousel block. Some issues with smaller galleries.")); | |||
$group->input("title")->label(t('Enter the title of the random block.')) | |||
->value(module::get_var("carousel", "title", "Random items")); | |||
$group->input("thumbsize")->label(t('Enter the thumb size. (pixels)')) | |||
->value(module::get_var("carousel", "thumbsize", "200")) | |||
->rules("valid_numeric|length[2,3]"); | |||
$group->dropdown("visible")->label(t('Enter number of thumbs to show. (height of carousel)')) | |||
->options($shortrange) | |||
->selected(module::get_var("carousel", "visible", "1")); | |||
$group->dropdown("quantity")->label(t("Choose the toal quantity of thumbs in random carousel.")) | |||
->options($range) | |||
->selected(module::get_var("carousel", "quantity", "25")); | |||
$group->checkbox("onalbum")->label(t("Show on album & collection pages")) | |||
->checked(module::get_var("carousel", "onalbum", "0")); | |||
$group->checkbox("onphoto")->label(t("Show on photo pages")) | |||
->checked(module::get_var("carousel", "onphoto", "0")); | |||
|
|||
$form->submit("submit")->value(t("Save")); | |||
return $form; | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,30 @@ | |||
.jcarousel-container { | |||
-moz-border-radius: 10px; | |||
background: #F0F6F9; | |||
border: 1px solid #346F97; | |||
} | |||
|
|||
.jcarousel-container-vertical { | |||
width: 75px; | |||
height: 245px; | |||
padding: 40px 20px; | |||
} | |||
|
|||
.jcarousel-clip-vertical { | |||
width: 75px; | |||
height: 245px; | |||
} | |||
|
|||
.jcarousel-item { | |||
width: 75px; | |||
height: 75px; | |||
} | |||
|
|||
.jcarousel-item-vertical { | |||
margin-bottom: 10px; | |||
} | |||
|
|||
.jcarousel-item-placeholder { | |||
background: #fff; | |||
color: #000; | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,61 @@ | |||
<?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 carousel_block_Core { | |||
static function get_site_list() { | |||
return array( | |||
"carousel_recent" => t("Recent items carousel"), | |||
"carousel_popular" => t("Popular items carousel"), | |||
"carousel_random" => t("Random items carousel")); | |||
} | |||
|
|||
static function get($block_id, $theme) { | |||
$block = ""; | |||
switch ($block_id) { | |||
case "carousel_recent": | |||
if (module::get_var("carousel", "onalbum2") && $theme->page_type == "collection" || | |||
module::get_var("carousel", "onphoto2") && $theme->page_type == "item") { | |||
$block = new Block(); | |||
$block->css_id = "g-carousel-rec"; | |||
$block->title = module::get_var("carousel", "title2", "Recent items"); | |||
$block->content = new View("carousel_recent.html"); | |||
} | |||
break; | |||
case "carousel_popular": | |||
if (module::get_var("carousel", "onalbum3") && $theme->page_type == "collection" || | |||
module::get_var("carousel", "onphoto3") && $theme->page_type == "item") { | |||
$block = new Block(); | |||
$block->css_id = "g-carousel-pop"; | |||
$block->title = module::get_var("carousel", "title3", "Popular items"); | |||
$block->content = new View("carousel_popular.html"); | |||
} | |||
break; | |||
case "carousel_random": | |||
if (module::get_var("carousel", "onalbum") && $theme->page_type == "collection" || | |||
module::get_var("carousel", "onphoto") && $theme->page_type == "item") { | |||
$block = new Block(); | |||
$block->css_id = "g-carousel-ran"; | |||
$block->title = module::get_var("carousel", "title", "Random items"); | |||
$block->content = new View("carousel_random.html"); | |||
} | |||
break; | |||
} | |||
return $block; | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,28 @@ | |||
<?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 carousel_event_Core { | |||
static function admin_menu($menu, $theme) { | |||
$menu->get("settings_menu") | |||
->append(Menu::factory("link") | |||
->id("carousel_menu") | |||
->label(t("Carousel")) | |||
->url(url::site("admin/carousel"))); | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,24 @@ | |||
<?php defined("SYSPATH") or die("No direct script access."); | |||
/** | |||
* Gallery - a web based photo album viewer and editor | |||
* Copyright (C) 2000-2010 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 carousel_theme_Core { | |||
static function head($theme) { | |||
return $theme->script("jcarousellite.min.js"); | |||
} | |||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.