From 9a68be3c337ed98475535ab6b0483f53073678e1 Mon Sep 17 00:00:00 2001 From: brettp Date: Tue, 24 May 2011 17:59:51 +0000 Subject: 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 --- views/default/object/plugin/advanced.php | 61 +++++++++++++++++++------------- 1 file changed, 37 insertions(+), 24 deletions(-) (limited to 'views/default/object') 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 "

$message

"; + if ($active) { + $message = elgg_echo('admin:plugins:warning:unmet_dependencies_active'); + echo "

$message

"; + } else { + $message = elgg_echo('admin:plugins:warning:unmet_dependencies'); + echo "

$message

"; + } } ?> -- cgit v1.2.3