1
0

Merge branch 'master' of github.com:gallery/gallery3-contrib

This commit is contained in:
Bharat Mediratta 2010-08-17 21:02:14 -07:00
commit 5103ffce45
6 changed files with 76 additions and 21 deletions

View File

@ -24,12 +24,14 @@ class Admin_Moduleorder_Controller extends Admin_Controller {
private function _get_view() {
$view = new Admin_View("admin.html");
$view->page_title = t("Manage Module Order");
$view->page_title = t("Manage module order");
$view->content = new View("admin_moduleorder.html");
$view->content->csrf = access::csrf_token();
$view->content->available = new View("admin_moduleorder_blocks.html");
$view->content->active = new View("admin_moduleorder_blocks.html");
$view->content->available->modules = $this->_get_modules();
if (module::get_version("gallery") > 31) {
$view->content->available->modules = $this->_get_modules();
}
return $view;
}
@ -74,7 +76,7 @@ class Admin_Moduleorder_Controller extends Admin_Controller {
private function _get_modules() {
$active_blocks = array();
$available_modules = module_manager::get_available_site_modules();
$available_modules = moduleorder::get_available_site_modules();
return $available_modules;
}
}

View File

@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class module_manager_Core {
class moduleorder_Core {
static function get_available_site_modules() {
return self::_get_modules();
}
@ -29,4 +29,4 @@ class module_manager_Core {
}
return $modules;
}
}
}

View File

@ -18,11 +18,22 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class moduleorder_event_Core {
static function module_change($changes) {
// Gallery version must be >= 32
if (module::get_version("gallery") < 32) {
site_status::warning(
t("The module 'Module Order' requires Gallery core version of 32 or higher."),
"moduleorder_needs_higherversion");
} else {
site_status::clear("moduleorder_needs_higherversion");
}
}
static function admin_menu($menu, $theme) {
$menu->get("settings_menu")
->append(Menu::factory("link")
->id("moduleorder_menu")
->label(t("Manage Module Order"))
->label(t("Module order"))
->url(url::site("admin/moduleorder")));
}
}

View File

@ -0,0 +1,38 @@
<?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 moduleorder_installer {
static function install() {
// Set the module's version number.
module::set_version("moduleorder", 1);
}
static function upgrade($version) {
module::set_version("moduleorder", $version = 1);
}
static function deactivate() {
// Clear the require higher core version message.
site_status::clear("moduleorder_needs_higherversion");
}
static function uninstall() {
module::delete("moduleorder");
}
}

View File

@ -1,8 +1,6 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<? if (module::get_version("gallery") > 31): ?>
<script type="text/javascript">
$(document).ready(function(){
$(".g-admin-blocks-list").height($(".g-admin-blocks-list").height());
});
$(function() {
$(".g-admin-blocks-list ul").sortable({
@ -23,23 +21,27 @@
document.moduleorder.submit();
}
</script>
<? endif ?>
<div id="g-block-admin" class="g-block ui-helper-clearfix">
<h1> <?= t("Manage Module Order") ?> </h1>
<h1> <?= t("Manage module order") ?> </h1>
<? if (module::get_version("gallery") < 32): ?>
<h2> <?= t("Warning") ?> </h2>
<p>
<?= t("You must have Gallery core version of 32 or higher installed to use this module. Please update your installation.") ?>
</p>
<? else: ?>
<p>
<?= t("Select and drag blocks to change the order. Click 'Save' to save your changes.") ?>
</p>
<h2> <?= t("Important notes") ?> </h2>
<p>
<?= t("You will only need to change this order in rare circumstances (e.g. if two modules display content at the bottom of the image and you want to change the order in which this content is being shown). If everything on your Gallery Site is looking normal then please do not touch this.") ?>
</p>
<h2> <?= t("Notes") ?> </h2>
<p>
<?= t("The core module ('gallery') and the identity provider module (default is 'user') cannot be sorted and are therefore hidden from this list.") ?>
</p>
<div class="g-block-content">
<div id="g-site-blocks">
<div class="g-admin-blocks-list g-left">
<div class="g-admin-blocks-list g-left" style="float: none !important;">
<h3><?= t("Installed Modules") ?></h3>
<div>
<ul id="g-active-blocks" class="g-sortable-blocks">
@ -48,9 +50,10 @@
</div>
</div>
</div>
<form name="moduleorder" action="<?= url::site("admin/moduleorder/update?csrf={$csrf}") ?>" method="post">
<input type="hidden" name="modulelist" value="">
</form>
</div>
<form name="moduleorder" action="<?= url::site("admin/moduleorder/update?csrf={$csrf}") ?>" method="post">
<input type="hidden" name="modulelist" value="">
</form>
<a class="ui-state-default ui-corner-all" style="padding: 5px;" href="javascript: buildmodulelist()">Save</a>
<a class="ui-state-default ui-corner-all" style="padding: 5px;" href="javascript: buildmodulelist()">Save</a>
<? endif ?>
</div>

View File

@ -1,9 +1,10 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<? $indent_provider = module::get_var("gallery", "identity_provider") ?>
<? foreach ($modules as $ref => $text): ?>
<? if ($text == "gallery" || $text == $indent_provider): ?>
<? $moduleinfo = module::info($text) ?>
<? if ($text == "gallery" || $text == $indent_provider || $moduleinfo->name == ""): ?>
<li style="background-color:#A8A8A8; margin:0.5em; padding:0.3em 0.8em; display: none" ref="<?= $ref ?>"><?= $text ?></li>
<? else: ?>
<li class="g-draggable" ref="<?= $ref ?>"><?= $text ?></li>
<li class="g-draggable" ref="<?= $ref ?>"><?= $moduleinfo->name ?></li>
<? endif ?>
<? endforeach ?>