From 2108bdc13622bf71eddb10c9f906ecc8ca7daac1 Mon Sep 17 00:00:00 2001 From: nbm Date: Tue, 3 Jan 2006 19:44:54 +0000 Subject: [PATCH] Add an admin page to manage plugins - currently can view and disable/enable plugins. --- plugins/ktcore/admin/plugins.php | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ templates/ktcore/plugins/list.smarty | 26 ++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 0 deletions(-) create mode 100755 plugins/ktcore/admin/plugins.php create mode 100644 templates/ktcore/plugins/list.smarty diff --git a/plugins/ktcore/admin/plugins.php b/plugins/ktcore/admin/plugins.php new file mode 100755 index 0000000..7110ae8 --- /dev/null +++ b/plugins/ktcore/admin/plugins.php @@ -0,0 +1,55 @@ +aBreadcrumbs[] = array( + 'url' => $_SERVER['PHP_SELF'], + 'name' => _('Plugins'), + ); + return parent::check(); + } + + function do_main() { + $aPlugins = KTPluginEntity::getList(); + $aEnabledPluginIds = KTPluginEntity::getEnabledPlugins(); + + $oTemplating =& KTTemplating::getSingleton(); + $oTemplate =& $oTemplating->loadTemplate('ktcore/plugins/list'); + $oTemplate->setData(array( + 'context' => $this, + 'plugins' => $aPlugins, + 'enabled_plugins' => $aEnabledPluginIds, + )); + return $oTemplate; + } + + function do_update() { + $sTable = KTUtil::getTableName('plugins'); + $aIds = KTUtil::arrayGet($_REQUEST, 'pluginids'); + $sIds = DBUtil::paramArray($aIds); + $sQuery = sprintf('UPDATE %s SET disabled = true WHERE id NOT IN (%s)', $sTable, $sIds); + DBUtil::runQuery(array($sQuery, $aIds)); + $sQuery = sprintf('UPDATE %s SET disabled = false WHERE id IN (%s)', $sTable, $sIds); + DBUtil::runQuery(array($sQuery, $aIds)); + $this->successRedirectToMain('Plugins updated'); + } + + function do_reread() { + KTPluginUtil::registerPlugins(); + $this->successRedirectToMain('Plugins read from the filesystem'); + } +} + +?> diff --git a/templates/ktcore/plugins/list.smarty b/templates/ktcore/plugins/list.smarty new file mode 100644 index 0000000..cf2cb71 --- /dev/null +++ b/templates/ktcore/plugins/list.smarty @@ -0,0 +1,26 @@ +

Plugins

+ +{if $plugins} +
+ +{entity_checkboxes entities=$plugins selected=$enabled_plugins +method=getNamespace assign=boxes name="pluginids"} +{foreach from=$boxes item=box} +{$box}
+{/foreach} + + +
+{/if} + +

Read plugins from filesystem

+ +

If you have moved your document management +system on the filesystem, or installed or removed plugins, the plugins +must be re-read from the filesystem

+ +
+ + +
+ -- libgit2 0.21.4