Added installer. Added check for gallery core version. Some cleanup
This commit is contained in:
parent
20615273c3
commit
6d31beec13
@ -29,7 +29,9 @@ class Admin_Moduleorder_Controller extends Admin_Controller {
|
|||||||
$view->content->csrf = access::csrf_token();
|
$view->content->csrf = access::csrf_token();
|
||||||
$view->content->available = new View("admin_moduleorder_blocks.html");
|
$view->content->available = new View("admin_moduleorder_blocks.html");
|
||||||
$view->content->active = new View("admin_moduleorder_blocks.html");
|
$view->content->active = new View("admin_moduleorder_blocks.html");
|
||||||
|
if (module::get_version("gallery") > 31) {
|
||||||
$view->content->available->modules = $this->_get_modules();
|
$view->content->available->modules = $this->_get_modules();
|
||||||
|
}
|
||||||
return $view;
|
return $view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +76,7 @@ class Admin_Moduleorder_Controller extends Admin_Controller {
|
|||||||
|
|
||||||
private function _get_modules() {
|
private function _get_modules() {
|
||||||
$active_blocks = array();
|
$active_blocks = array();
|
||||||
$available_modules = module_manager::get_available_site_modules();
|
$available_modules = moduleorder::get_available_site_modules();
|
||||||
return $available_modules;
|
return $available_modules;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* 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() {
|
static function get_available_site_modules() {
|
||||||
return self::_get_modules();
|
return self::_get_modules();
|
||||||
}
|
}
|
@ -18,6 +18,17 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
class moduleorder_event_Core {
|
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) {
|
static function admin_menu($menu, $theme) {
|
||||||
$menu->get("settings_menu")
|
$menu->get("settings_menu")
|
||||||
->append(Menu::factory("link")
|
->append(Menu::factory("link")
|
||||||
|
38
modules/moduleorder/helpers/moduleorder_installer.php
Normal file
38
modules/moduleorder/helpers/moduleorder_installer.php
Normal 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");
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||||
|
<? if (module::get_version("gallery") > 31): ?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
@ -20,9 +21,16 @@
|
|||||||
document.moduleorder.submit();
|
document.moduleorder.submit();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<? endif ?>
|
||||||
|
|
||||||
<div id="g-block-admin" class="g-block ui-helper-clearfix">
|
<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>
|
<p>
|
||||||
<?= t("Select and drag blocks to change the order. Click 'Save' to save your changes.") ?>
|
<?= t("Select and drag blocks to change the order. Click 'Save' to save your changes.") ?>
|
||||||
</p>
|
</p>
|
||||||
@ -47,4 +55,5 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
|
Reference in New Issue
Block a user