From a52e0772526a9edb9b4e4e2cacf4eae3d9486384 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 30 Jun 2010 09:21:39 +0000 Subject: [PATCH] Added plugin Information git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18881 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../dbPluginStatus/class_dbPluginStatus.inc | 69 +++++++++++++++++++ .../dashBoard/dbPluginStatus/contents.tpl | 2 +- 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/gosa-core/plugins/generic/dashBoard/dbPluginStatus/class_dbPluginStatus.inc b/gosa-core/plugins/generic/dashBoard/dbPluginStatus/class_dbPluginStatus.inc index fe699877c..cea0e835f 100644 --- a/gosa-core/plugins/generic/dashBoard/dbPluginStatus/class_dbPluginStatus.inc +++ b/gosa-core/plugins/generic/dashBoard/dbPluginStatus/class_dbPluginStatus.inc @@ -2,20 +2,89 @@ class dbPluginStatus extends plugin { + + var $installedPlugins = array(); + var $disabledPlugins = array(); + + // The HTML list containing the plugin data. + var $pluginList = NULL; + function __construct($config) { + // Construct the class parent::__construct($config, NULL); + + // Collect plugin information already collected by GOsa. + $this->installedPlugins = $this->config->configRegistry->getListOfPlugins(); + $this->disabledPlugins = $this->config->configRegistry->getDisabledPlugins(); + + // Construct the plugin list. + $this->pluginList= new sortableListing($this->gosaLoginRestriction); + $this->pluginList->setDeleteable(false); + $this->pluginList->setEditable(false); + $this->pluginList->setColspecs(array('*')); + $this->pluginList->setWidth("100%"); + $this->pluginList->setHeight("200px"); + $this->pluginList->setAcl("rwcdm"); + } function execute() { $smarty = get_smarty(); + + // Build up list data + $data = $lData = array(); + foreach($this->installedPlugins as $plugin => $plInfo){ + + // Build plugin name + $name = $plugin; + if(isset($plInfo['plShortName'])){ + $name = $plInfo['plShortName']; + } + + // Build plugin description + $desc = "-"; + if(isset($plInfo['plDescription'])){ + $desc = $plInfo['plDescription']; + } + + // Detect the plugin status + $status = 'OK'; + if(isset($this->disabledPlugins[$plugin])){ + $status = 'Failure'; + + // Check if an invalid schema is the reason + $reasons = $this->config->configRegistry->getSchemaResults(); + if(isset($plInfo['plRequirements']['ldapSchema'])){ + foreach($plInfo['plRequirements']['ldapSchema'] as $class => $requirements){ + if(isset($reasons['versionMismatch'][$class])){ + $reason = strip_tags($reasons['versionMismatch'][$class]); + $status = ""._("Version mismatch").""; + } + if(isset($reasons['missing'][$class])){ + $reason = strip_tags($reasons['missing'][$class]); + $status = ""._("Schema missing").""; + } + } + } + } + + // Add entry/line to the list + $data[$plugin] = $plInfo; + $lData[$plugin] = array('data' => array($name,$desc, $status)); + } + $this->pluginList->setListData($data,$lData); + $this->pluginList->update(); + $smarty->assign('pluginList', $this->pluginList->render()); return($smarty->fetch(get_template_path('dbPluginStatus/contents.tpl', TRUE))); } function save_object() { parent::save_object(); + + $this->pluginList->save_object(); } function save() diff --git a/gosa-core/plugins/generic/dashBoard/dbPluginStatus/contents.tpl b/gosa-core/plugins/generic/dashBoard/dbPluginStatus/contents.tpl index 345e6aef7..6612e1068 100644 --- a/gosa-core/plugins/generic/dashBoard/dbPluginStatus/contents.tpl +++ b/gosa-core/plugins/generic/dashBoard/dbPluginStatus/contents.tpl @@ -1 +1 @@ -Test +{$pluginList} -- 2.30.2