aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-05-24 17:59:51 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-05-24 17:59:51 +0000
commit9a68be3c337ed98475535ab6b0483f53073678e1 (patch)
tree78f0da0350b8c5635f571ae0938cd1830dfc3fe7
parent22fd09fa332ed11118e8cc81e82dd2497b874ac5 (diff)
downloadelgg-9a68be3c337ed98475535ab6b0483f53073678e1.tar.gz
elgg-9a68be3c337ed98475535ab6b0483f53073678e1.tar.bz2
Fixes #3467. Fixed bugs in priority deps. Can now disable active plugins with unmet dependencies.
git-svn-id: http://code.elgg.org/elgg/trunk@9111 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--engine/classes/ElggPluginPackage.php13
-rw-r--r--languages/en.php1
-rw-r--r--views/default/css/admin.php9
-rw-r--r--views/default/object/plugin/advanced.php61
4 files changed, 50 insertions, 34 deletions
diff --git a/engine/classes/ElggPluginPackage.php b/engine/classes/ElggPluginPackage.php
index 9aa4af8bf..977b72d76 100644
--- a/engine/classes/ElggPluginPackage.php
+++ b/engine/classes/ElggPluginPackage.php
@@ -457,16 +457,11 @@ class ElggPluginPackage {
// grab the ElggPlugin using this package.
$plugin_package = elgg_get_plugin_from_id($this->getID());
$plugin_priority = $plugin_package->getPriority();
+ $test_plugin = elgg_get_plugin_from_id($dep['plugin']);
- foreach ($plugins as $test_plugin) {
- if ($test_plugin->getID() == $dep['plugin']) {
- break;
- }
- }
-
- // If this isn't a plugin or there are no active plugins,
- // we can't satisfy this dep.
- if (!$plugin_package || !$plugins) {
+ // If this isn't a plugin or the plugin isn't installed or active
+ // priority doesn't matter. Use requires to check if a plugin is active.
+ if (!$plugin_package || !$test_plugin || !$test_plugin->isActive()) {
return array(
'status' => true,
'value' => 'uninstalled'
diff --git a/languages/en.php b/languages/en.php
index 509de7fb0..83fb66dad 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -661,6 +661,7 @@ $english = array(
'admin:plugins:simple_simple_fail' => 'Could not save settings.',
'admin:plugins:simple_simple_success' => 'Settings saved.',
'admin:plugins:simple:cannot_activate' => 'Cannot activate this plugin. Check the advanced plugin admin area for more information.',
+ 'admin:plugins:warning:unmet_dependencies_active' => 'This plugin is active but has unmet dependencies. You may encounter problems. See "more info" below for details.',
'admin:plugins:dependencies:type' => 'Type',
'admin:plugins:dependencies:name' => 'Name',
diff --git a/views/default/css/admin.php b/views/default/css/admin.php
index c4dacad91..744211a20 100644
--- a/views/default/css/admin.php
+++ b/views/default/css/admin.php
@@ -1179,12 +1179,19 @@ ul.admin_plugins {
.elgg-plugin.elgg-state-inactive {
background: #dedede;
}
-.elgg-dependency.elgg-state-error {
+
+.elgg-state-error {
background: #fbe3e4;
color: #8a1f11;
border-color: #fbc2c4;
font-weight: bold;
}
+.elgg-state-warning {
+ background: #fbedb5;
+ color: #000000;
+ border-color: #fbe58b;
+ font-weight: bold;
+}
.admin_notices {
padding-bottom: 15px;
diff --git a/views/default/object/plugin/advanced.php b/views/default/object/plugin/advanced.php
index 9aed4163c..56e680ad5 100644
--- a/views/default/object/plugin/advanced.php
+++ b/views/default/object/plugin/advanced.php
@@ -20,7 +20,6 @@ $actions_base = '/action/admin/plugins/';
$ts = time();
$token = generate_action_token($ts);
-$active_class = ($active && $can_activate) ? 'elgg-state-active' : 'elgg-state-inactive';
// build reordering links
$links = '';
@@ -80,33 +79,42 @@ if ($priority < $max_priority) {
}
// activate / deactivate links
-if ($can_activate) {
- if ($active) {
- $action = 'deactivate';
- $class = 'elgg-button-cancel';
- } else {
- $action = 'activate';
- $class = 'elgg-button-submit';
+
+// always let them deactivate
+$options = array(
+ 'is_action' => true
+);
+if ($active) {
+ $active_class = 'elgg-state-active';
+ $action = 'deactivate';
+ $options['text'] = elgg_echo('deactivate');
+ $options['class'] = "elgg-button elgg-button-cancel";
+
+ if (!$can_activate) {
+ $active_class = 'elgg-state-active';
+ $options['class'] = 'elgg-button elgg-state-warning';
}
+} else if ($can_activate) {
+ $active_class = 'elgg-state-inactive';
+ $action = 'activate';
+ $options['text'] = elgg_echo('activate');
+ $options['class'] = "elgg-button elgg-button-submit";
+} else {
+ $active_class = 'elgg-state-inactive';
+ $action = '';
+ $options['text'] = elgg_echo('admin:plugins:cannot_activate');
+ $options['class'] = "elgg-button elgg-button-disabled";
+ $options['disabled'] = 'disabled';
+}
+if ($action) {
$url = elgg_http_add_url_query_elements($actions_base . $action, array(
- 'plugin_guids[]' => $plugin->guid,
- 'is_action' => true
+ 'plugin_guids[]' => $plugin->guid
));
- $action_button = elgg_view('output/url', array(
- 'href' => $url,
- 'text' => elgg_echo($action),
- 'is_action' => true,
- 'class' => "elgg-button $class"
- ));
-} else {
- $action_button = elgg_view('output/url', array(
- 'text' => elgg_echo('admin:plugins:cannot_activate'),
- 'disabled' => 'disabled',
- 'class' => "elgg-button elgg-button-action elgg-state-disabled"
- ));
+ $options['href'] = $url;
}
+$action_button = elgg_view('output/url', $options);
// Display categories
$categories_html = '';
@@ -202,8 +210,13 @@ if (elgg_view_exists($settings_view_old) || elgg_view_exists($settings_view_new)
}
if (!$can_activate) {
- $message = elgg_echo('admin:plugins:warning:unmet_dependencies');
- echo "<p class=\"elgg-state-error\">$message</p>";
+ if ($active) {
+ $message = elgg_echo('admin:plugins:warning:unmet_dependencies_active');
+ echo "<p class=\"elgg-state-warning\">$message</p>";
+ } else {
+ $message = elgg_echo('admin:plugins:warning:unmet_dependencies');
+ echo "<p class=\"elgg-state-error\">$message</p>";
+ }
}
?>