diff options
Diffstat (limited to 'modules/thumbnav')
| -rw-r--r-- | modules/thumbnav/changelog.log | 20 | ||||
| -rw-r--r-- | modules/thumbnav/controllers/admin_thumbnav.php | 65 | ||||
| -rw-r--r-- | modules/thumbnav/css/thumbnav.css | 11 | ||||
| -rw-r--r-- | modules/thumbnav/helpers/thumbnav_block.php | 89 | ||||
| -rw-r--r-- | modules/thumbnav/helpers/thumbnav_event.php | 20 | ||||
| -rw-r--r-- | modules/thumbnav/helpers/thumbnav_theme.php | 8 | ||||
| -rw-r--r-- | modules/thumbnav/module.info | 7 | ||||
| -rw-r--r-- | modules/thumbnav/views/admin_include.html.php | 95 | ||||
| -rw-r--r-- | modules/thumbnav/views/admin_thumbnav.html.php | 10 | ||||
| -rw-r--r-- | modules/thumbnav/views/thumbnav_block.html.php | 5 |
10 files changed, 330 insertions, 0 deletions
diff --git a/modules/thumbnav/changelog.log b/modules/thumbnav/changelog.log new file mode 100644 index 0000000..2efdcc2 --- /dev/null +++ b/modules/thumbnav/changelog.log @@ -0,0 +1,20 @@ +Thumb Navigator Changelog
+
+version 1.8
+- ADMIN: Added option to hide albums from the list
+- Module info adjusted to match new format in G3 3.0.2+
+- Fix: Added translation logic for help info
+- Fix: Added check for security access to the photo
+- Added support for modules which "hack" the item logic - instead of using access functionality, changed to use ->viewable()
+
+version 1.7:
+- Fix opacity settings for IE9
+
+version 1.6:
+- Some minor optimizations in Admin section
+
+version 1.5:
+- Some minor fixes
+
+version 1.4:
+- Fixed uninitialized state for content variable
\ No newline at end of file diff --git a/modules/thumbnav/controllers/admin_thumbnav.php b/modules/thumbnav/controllers/admin_thumbnav.php new file mode 100644 index 0000000..63b4b36 --- /dev/null +++ b/modules/thumbnav/controllers/admin_thumbnav.php @@ -0,0 +1,65 @@ +<?php defined("SYSPATH") or die("No direct script access."); + +class Admin_thumbnav_Controller extends Admin_Controller { + + public function index() { + $view = new Admin_View("admin.html"); + $view->content = new View("admin_thumbnav.html"); + $view->content->form = $this->_get_setting_form(); + $view->content->help = $this->get_edit_form_help(); + print $view; + } + + public function save() { + access::verify_csrf(); + + $form = $this->_get_setting_form(); + if ($form->validate()): + $thumb_count = $form->g_admin_thumbnavcfg->thumb_count->value; + if ($thumb_count==9): + module::clear_var("thumbnav", "thumb_count"); + else: + module::set_var("thumbnav", "thumb_count", $thumb_count); + endif; + if ($form->g_admin_thumbnavcfg->hidealbum->value): + module::set_var("thumbnav", "hide_albums", TRUE); + else: + module::clear_var("thumbnav", "hide_albums"); + endif; + + message::success("Settings have been Saved."); + url::redirect("admin/thumbnav"); + endif; + + $view = new Admin_View("admin.html"); + $view->content = new View("admin_thumbnav.html"); + $view->content->form = $form; + $view->content->help = $this->get_edit_form_help(); + print $view; + } + + private function _get_setting_form() { + $form = new Forge("admin/thumbnav/save", "", "post", array("id" => "g-admin-thumbnav-form")); + $group = $form->group("g_admin_thumbnavcfg")->label(t("Settings")); + $group->input("thumb_count") + ->label(t("Thumbs displayed")) + ->rules("required|valid_digit") + ->value(module::get_var("thumbnav", "thumb_count", 9)); + $group->checkbox("hidealbum")->label(t("Hide Albums in the list")) + ->checked(module::get_var("thumbnav", "hide_albums")); + $form->submit("")->value(t("Save")); + return $form; + } + + protected function get_edit_form_help() { + $help = '<fieldset>'; + $help .= '<legend>Help</legend><ul>'; + $help .= '<li><h3>Settings</h3> + <p>Adjust Max Number of images in the block using <b>Thumbs displayed</b>. Default is 9. + </li>'; + + $help .= '</ul></fieldset>'; + return t($help); + } + +} diff --git a/modules/thumbnav/css/thumbnav.css b/modules/thumbnav/css/thumbnav.css new file mode 100644 index 0000000..549058e --- /dev/null +++ b/modules/thumbnav/css/thumbnav.css @@ -0,0 +1,11 @@ +/* Thumb Navigator ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
+
+.g-thumbnav { text-align: center; padding: 0; }
+.g-navthumb { width: 62px; height: 62px; filter:alpha(opacity=55); opacity:.55; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=55)"; }
+
+.g-thumbnav ul { display: inline-block; padding: 0; margin: 0 0.5em; }
+.g-thumbnav li { float: left; border: transparent 1px solid;}
+.g-thumbnav li.g-current { border-color: #ddd; }
+
+.g-thumbnav li.g-current .g-navthumb,
+.g-navthumb:hover { background: #fff; filter:alpha(opacity=100); opacity:1; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; }
diff --git a/modules/thumbnav/helpers/thumbnav_block.php b/modules/thumbnav/helpers/thumbnav_block.php new file mode 100644 index 0000000..898d691 --- /dev/null +++ b/modules/thumbnav/helpers/thumbnav_block.php @@ -0,0 +1,89 @@ +<?php defined("SYSPATH") or die("No direct script access."); + +class ThumbNav_block_Core { + + static function get_site_list() { + return array("thumbnav_block" => t("Navigator")); + } + + static function get($block_id, $theme) { + $block = ""; + switch ($block_id) { + case "thumbnav_block": + $item = $theme->item; + if ((!isset($item)) or (!$item->is_photo())): // Only should be used in photo pages + break; + endif; + + $hide_albums = module::get_var("thumbnav", "hide_albums", TRUE); + + $siblings = $item->parent()->children(); + $itemlist = Array(); + foreach ($siblings as $sibling): + if (isset($sibling)): + if ($sibling->viewable()): + if (($hide_albums and ($sibling->is_photo())) or (!$hide_albums)): + $itemlist[] = $sibling; + endif; + endif; + endif; + endforeach; + + $current = -1; + $total = count($itemlist); + + $thumb_count = module::get_var("thumbnav", "thumb_count", 9); + $thumb_count = min($thumb_count, $total); + + $shift_right = floor($thumb_count / 2); + $shift_left = $thumb_count - $shift_right - 1; + + for ($i = 1; $i <= $total; $i++): + if ($itemlist[$i-1]->rand_key == $item->rand_key): + $current = $i; + break; + endif; + endfor; + + $content = '<ul>'; + if ($current >= 1): + $first = $current - $shift_left; + $last = $current + $shift_right; + if ($first <= 0): + $last = min($last - $first + 1, $total); + $first = 1; + elseif ($last > $total): + $first = max($first - ($last - $total), 1); + $last = $total; + endif; + + for ($i = $first; $i <= $last; $i++): + $thumb_item = $itemlist[$i - 1]; + + if ($i == $current): + $content .= '<li class="g-current">'; + else: + $content .= '<li>'; + endif; + $content .= '<a href="' . $thumb_item->url() . '" title="' . html::purify($thumb_item->title) . '" target="_self">'; + $content .= $thumb_item->thumb_img(array("class" => "g-navthumb"), 60); + $content .= '</a></li>'; + endfor; + endif; + + $content .= "</ul>"; + $content .= "<div style=\"clear: both;\"></div>"; + + $block = new Block(); + $block->css_id = "g-thumbnav-block"; + $block->title = t("Navigator"); + $block->content = new View("thumbnav_block.html"); + $block->content->player = $content; + break; + } + + return $block; + } +} + +?>
\ No newline at end of file diff --git a/modules/thumbnav/helpers/thumbnav_event.php b/modules/thumbnav/helpers/thumbnav_event.php new file mode 100644 index 0000000..c0e8243 --- /dev/null +++ b/modules/thumbnav/helpers/thumbnav_event.php @@ -0,0 +1,20 @@ +<?php defined("SYSPATH") or die("No direct script access."); +class thumbnav_event_Core { + + static function activate() { + thumbnav::check_config(); + } + + static function deactivate() { + site_status::clear("thumbnav_config"); + } + + static function admin_menu($menu, $theme) { + $menu + ->get("settings_menu") + ->append(Menu::factory("link") + ->id("thumbnav") + ->label(t("Thumb Navigator")) + ->url(url::site("admin/thumbnav"))); + } +} diff --git a/modules/thumbnav/helpers/thumbnav_theme.php b/modules/thumbnav/helpers/thumbnav_theme.php new file mode 100644 index 0000000..6f11b30 --- /dev/null +++ b/modules/thumbnav/helpers/thumbnav_theme.php @@ -0,0 +1,8 @@ +<?php defined("SYSPATH") or die("No direct script access."); + +class ThumbNav_theme_Core { + + static function head($theme) { + $theme->css("thumbnav.css"); + } +}
\ No newline at end of file diff --git a/modules/thumbnav/module.info b/modules/thumbnav/module.info new file mode 100644 index 0000000..fcb03ce --- /dev/null +++ b/modules/thumbnav/module.info @@ -0,0 +1,7 @@ +name = "Thumb Navigator" +description = "Sidebar block: Adds thumb navigation option in Photo View.<br />Version 1.8 | By <a href=http://blog.dragonsoft.us>Serguei Dosyukov</a> | <a href=http://codex.gallery2.org/Gallery3:Modules:thumbnav>Visit plugin Site</a> | <a href=http://gallery.menalto.com/node/95116>Support</a> | <a href=thumbnav>Settings</a>" +version = 18 +author_name = "Serguei Dosyukov" +author_url = "http://blog.dragonsoft.us/gallery-3/" +info_url = "http://codex.gallery2.org/Gallery3:Modules:thumbnav" +discuss_url = "http://gallery.menalto.com/node/95116" diff --git a/modules/thumbnav/views/admin_include.html.php b/modules/thumbnav/views/admin_include.html.php new file mode 100644 index 0000000..1853596 --- /dev/null +++ b/modules/thumbnav/views/admin_include.html.php @@ -0,0 +1,95 @@ +<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Grey Dragon Theme - a custom theme for Gallery 3
+ * This theme was designed and built by Serguei Dosyukov, whose blog you will find at http://blog.dragonsoft.us
+ * Copyright (C) 2009-2011 Serguei Dosyukov
+ *
+ * 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.
+ */
+?>
+<style>
+#g-header { margin-bottom: 10px; }
+#gd-admin { position: relative; font-size: 0.9em; }
+#gd-admin legend { width: 100.5%; padding: 0.4em 0.8em; margin-left: -1.1em; background: url(/themes/greydragon/images/blue-grad.png) #d5e6f2 repeat-x left top; border: #dfdfdf 1px solid; border-top-left-radius: 0.4em; border-top-right-radius: 0.4em; }
+
+.g-admin-left { float: left; width: 53%; }
+.g-admin-right { float: left; width: 46%; margin-left: 1%; margin-top: 1em; }
+.g-admin-right h3 { border-bottom: #a2bdbf 1px solid; margin-top: 0.3em; margin-bottom: 0.3em; }
+
+#gd-admin-head { position: relative; height: auto; clear: both; display: block; overflow: auto; font-size: 11px; padding: 0.4em 0.8em; background-color: #b7c9d6; border: #a2bdbf 1px solid; }
+#gd-admin-title { float: left; color: #333v42; font-weight: bold; font-size: 1.6em; text-shadow: #deeefa 0 1px 0; }
+#gd-admin-hlinks ul { float: right; margin-top: 0.4em; font-size: 11px; }
+#gd-admin-hlinks li { list-style-type: none; float: left; color: #618299; display: inline; }
+#gd-admin-hlinks a { font-weight: bold; font-size: 13px; }
+
+#gd-admin form { border: none; }
+#gd-admin fieldset { border: #ccc 1px solid; border-radius: 0.4em; }
+#gd-admin input.g-error { padding-left: 30px; border: none; }
+#gd-admin input.g-success { background-color: transparent; }
+#gd-admin input.g-warning { background-color: transparent; border: none; }
+#gd-admin p.g-error { padding-left: 30px; border: none; margin-bottom: 0; background-image: none; }
+
+#g-content { padding: 0 1em; width: 97%; font-size: 1em; }
+#g-content form ul li input { display: inline; float: left; margin-right: 0.8em; }
+#g-content form ul li select { display: inline; float: left; margin-right: 0.8em; width: 50.6%; }
+#g-content form ul li input[type='text'] { width: 50%; }
+#g-content form ul li textarea { height: 6em; }
+#g-content form input[type="submit"] { border: #5b86ab 2px solid; padding: 0.3em; color: #fff; background: url(/themes/greydragon/images/button-grad-vs.png) #5580a6 repeat-x left top; }
+#g-content form input[type="submit"]:hover,
+input.ui-state-hover { background-image: url(/themes/greydragon/images/button-grad-active-vs.png); border-color: #2e5475; color: #eaf2fa !important; }
+#g-content form #vercheck, #g-content form #shadowbox, #g-content form #organizecheck { display: none; }
+</style>
+
+<script>
+ $(document).ready( function() {
+ $('form').submit( function() {
+ $('input[type=submit]', this).attr('disabled', 'disabled');
+ });
+ });
+</script>
+
+<?
+ if ($is_module):
+ $admin_info = new ArrayObject(parse_ini_file(MODPATH . $name . "/module.info"), ArrayObject::ARRAY_AS_PROPS);
+ $version = number_format($admin_info->version / 10, 1, '.', '');
+ else:
+ $admin_info = new ArrayObject(parse_ini_file(THEMEPATH . $name . "/theme.info"), ArrayObject::ARRAY_AS_PROPS);
+ $version = $admin_info->version;
+ endif;
+?>
+
+<div id="gd-admin" class="g-block">
+ <div id="gd-admin-head">
+ <div id="gd-admin-title"><?= t($admin_info->name) ?> - <?= $version ?></div>
+ <div id="gd-admin-hlinks">
+ <ul><li><a href="http://blog.dragonsoft.us/gallery-3/" target="_blank"><?= t("Home") ?></a> | </li>
+ <? if (isset($admin_info->discuss_url)): ?>
+ <li><a href="<?= $admin_info->discuss_url; ?>" target="_blank"><?= t("Support") ?></a> | </li>
+ <? endif; ?>
+ <? if (isset($admin_info->info_url)): ?>
+ <li><a href="<?= $admin_info->info_url; ?>" target="_blank"><?= t("Download") ?></a> | </li>
+ <? endif; ?>
+ <? if (isset($admin_info->vote)): ?>
+ <li><a href="<?= $admin_info->vote; ?>" target="_blank"><?= t("Vote") ?></a> | </li>
+ <? endif; ?>
+ <li><a href="http://twitter.com/greydragon_th" target="_blank" title="<?= t("Follow Us on Twitter") ?>"><?= t("Follow Us") ?></a> | </li>
+ <li><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9MWBSVJMWMJEU" target="_blank" ><?= t("Coffee Fund") ?></a> </li>
+ </ul>
+ </div>
+ </div>
+ <div class="g-block-content g-admin-left">
+ <?= $form ?>
+ </div>
+ <div class="g-admin-right">
+ <?= $help ?>
+ </div>
+</div>
diff --git a/modules/thumbnav/views/admin_thumbnav.html.php b/modules/thumbnav/views/admin_thumbnav.html.php new file mode 100644 index 0000000..b542705 --- /dev/null +++ b/modules/thumbnav/views/admin_thumbnav.html.php @@ -0,0 +1,10 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<? + $view = new View("admin_include.html"); + + $view->is_module = TRUE; + $view->name = "thumbnav"; + $view->form = $form; + $view->help = $help; + print $view; +?> diff --git a/modules/thumbnav/views/thumbnav_block.html.php b/modules/thumbnav/views/thumbnav_block.html.php new file mode 100644 index 0000000..d4c2c76 --- /dev/null +++ b/modules/thumbnav/views/thumbnav_block.html.php @@ -0,0 +1,5 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> + +<div class="g-thumbnav"> + <?= $player ?> +</div>
\ No newline at end of file |
