1
0

Added installer. Added check for gallery core version. Some cleanup

This commit is contained in:
hukoeth 2010-08-11 20:32:43 +08:00 committed by Tim Almdal
parent 20615273c3
commit 6d31beec13
5 changed files with 65 additions and 5 deletions

View File

@ -29,7 +29,9 @@ class Admin_Moduleorder_Controller extends Admin_Controller {
$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,6 +18,17 @@
* 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")

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,4 +1,5 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<? if (module::get_version("gallery") > 31): ?>
<script type="text/javascript">
$(function() {
@ -20,9 +21,16 @@
document.moduleorder.submit();
}
</script>
<? endif ?>
<div id="g-block-admin" class="g-block ui-helper-clearfix">
<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>
@ -46,5 +54,6 @@
<input type="hidden" name="modulelist" value="">
</form>
</div>
<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>