From 82593cd2bc056da73caa1b1e981c5a9ead0f1bf2 Mon Sep 17 00:00:00 2001 From: brettp Date: Wed, 27 Apr 2011 02:37:16 +0000 Subject: Refs #3362. Plugins don't check deps upon boot. Made package and manifest private properties of ElggPlugin and added ->getPackage() and ->getManifest(). git-svn-id: http://code.elgg.org/elgg/trunk@9030 36083f99-b078-4883-b0ff-0f9b5a30f544 --- actions/admin/plugins/activate.php | 2 +- actions/admin/plugins/activate_all.php | 4 ++-- actions/admin/plugins/deactivate.php | 4 ++-- actions/admin/plugins/deactivate_all.php | 4 ++-- actions/admin/plugins/set_priority.php | 4 ++-- actions/admin/plugins/simple_update_states.php | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) (limited to 'actions/admin') diff --git a/actions/admin/plugins/activate.php b/actions/admin/plugins/activate.php index 0d930b27f..e04ee6298 100644 --- a/actions/admin/plugins/activate.php +++ b/actions/admin/plugins/activate.php @@ -29,7 +29,7 @@ foreach ($plugin_guids as $guid) { if ($plugin->activate()) { $activated_guids[] = $guid; } else { - register_error(elgg_echo('admin:plugins:activate:no', array($plugin->manifest->getName()))); + register_error(elgg_echo('admin:plugins:activate:no', array($plugin->getManifest()->getName()))); } } diff --git a/actions/admin/plugins/activate_all.php b/actions/admin/plugins/activate_all.php index 25802ce2e..0f0352877 100644 --- a/actions/admin/plugins/activate_all.php +++ b/actions/admin/plugins/activate_all.php @@ -13,9 +13,9 @@ $plugins = elgg_get_plugins('inactive'); foreach ($plugins as $plugin) { if ($plugin->activate()) { - //system_message(elgg_echo('admin:plugins:activate:yes', array($plugin->manifest->getName()))); + //system_message(elgg_echo('admin:plugins:activate:yes', array($plugin->getManifest()->getName()))); } else { - register_error(elgg_echo('admin:plugins:activate:no', array($plugin->manifest->getName()))); + register_error(elgg_echo('admin:plugins:activate:no', array($plugin->getManifest()->getName()))); } } diff --git a/actions/admin/plugins/deactivate.php b/actions/admin/plugins/deactivate.php index 74c78e0fc..9ec620e13 100644 --- a/actions/admin/plugins/deactivate.php +++ b/actions/admin/plugins/deactivate.php @@ -26,9 +26,9 @@ foreach ($plugin_guids as $guid) { } if ($plugin->deactivate()) { - //system_message(elgg_echo('admin:plugins:deactivate:yes', array($plugin->manifest->getName()))); + //system_message(elgg_echo('admin:plugins:deactivate:yes', array($plugin->getManifest()->getName()))); } else { - register_error(elgg_echo('admin:plugins:deactivate:no', array($plugin->manifest->getName()))); + register_error(elgg_echo('admin:plugins:deactivate:no', array($plugin->getManifest()->getName()))); } } diff --git a/actions/admin/plugins/deactivate_all.php b/actions/admin/plugins/deactivate_all.php index f1bea0a2c..446cad8c0 100644 --- a/actions/admin/plugins/deactivate_all.php +++ b/actions/admin/plugins/deactivate_all.php @@ -13,9 +13,9 @@ $plugins = elgg_get_plugins('active'); foreach ($plugins as $plugin) { if ($plugin->deactivate()) { - //system_message(elgg_echo('admin:plugins:deactivate:yes', array($plugin->manifest->getName()))); + //system_message(elgg_echo('admin:plugins:deactivate:yes', array($plugin->getManifest()->getName()))); } else { - register_error(elgg_echo('admin:plugins:deactivate:no', array($plugin->manifest->getName()))); + register_error(elgg_echo('admin:plugins:deactivate:no', array($plugin->getManifest()->getName()))); } } diff --git a/actions/admin/plugins/set_priority.php b/actions/admin/plugins/set_priority.php index fd7857e49..702aae91b 100644 --- a/actions/admin/plugins/set_priority.php +++ b/actions/admin/plugins/set_priority.php @@ -25,9 +25,9 @@ if (!($plugin instanceof ElggPlugin)) { } if ($plugin->setPriority($priority)) { - //system_message(elgg_echo('admin:plugins:set_priority:yes', array($plugin->manifest->getName()))); + //system_message(elgg_echo('admin:plugins:set_priority:yes', array($plugin->getManifest()->getName()))); } else { - register_error(elgg_echo('admin:plugins:set_priority:no', array($plugin->manifest->getName()))); + register_error(elgg_echo('admin:plugins:set_priority:no', array($plugin->getManifest()->getName()))); } // don't regenerate the simplecache because the plugin won't be diff --git a/actions/admin/plugins/simple_update_states.php b/actions/admin/plugins/simple_update_states.php index 662a5c3dd..7601013a7 100644 --- a/actions/admin/plugins/simple_update_states.php +++ b/actions/admin/plugins/simple_update_states.php @@ -22,7 +22,7 @@ $success = TRUE; foreach ($installed_plugins as $plugin) { // this is only for simple plugins. - if ($plugin->manifest->getAdminInterface() != 'simple') { + if ($plugin->getManifest()->getAdminInterface() != 'simple') { continue; } -- cgit v1.2.3 From 64045426f4eb5150c46dd2534058c3522bbe6ecf Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 9 Jun 2011 20:19:08 +0000 Subject: Fixes #2871 activate all/deactivate all now sensitive to filtering git-svn-id: http://code.elgg.org/elgg/trunk@9158 36083f99-b078-4883-b0ff-0f9b5a30f544 --- actions/admin/plugins/activate_all.php | 20 ++++++---- actions/admin/plugins/deactivate_all.php | 20 ++++++---- views/default/admin/plugins.php | 44 ++++++++++++---------- views/default/css/admin.php | 7 ++++ views/default/forms/admin/plugins/change_state.php | 20 ++++++++++ 5 files changed, 76 insertions(+), 35 deletions(-) create mode 100644 views/default/forms/admin/plugins/change_state.php (limited to 'actions/admin') diff --git a/actions/admin/plugins/activate_all.php b/actions/admin/plugins/activate_all.php index 0f0352877..19eb82142 100644 --- a/actions/admin/plugins/activate_all.php +++ b/actions/admin/plugins/activate_all.php @@ -1,21 +1,25 @@ activate()) { - //system_message(elgg_echo('admin:plugins:activate:yes', array($plugin->getManifest()->getName()))); - } else { - register_error(elgg_echo('admin:plugins:activate:no', array($plugin->getManifest()->getName()))); +foreach ($guids as $guid) { + $plugin = get_entity($guid); + if (!$plugin->isActive()) { + if ($plugin->activate()) { + //system_message(elgg_echo('admin:plugins:activate:yes', array($plugin->getManifest()->getName()))); + } else { + register_error(elgg_echo('admin:plugins:activate:no', array($plugin->getManifest()->getName()))); + } } } diff --git a/actions/admin/plugins/deactivate_all.php b/actions/admin/plugins/deactivate_all.php index 446cad8c0..436a3ad30 100644 --- a/actions/admin/plugins/deactivate_all.php +++ b/actions/admin/plugins/deactivate_all.php @@ -1,21 +1,25 @@ deactivate()) { - //system_message(elgg_echo('admin:plugins:deactivate:yes', array($plugin->getManifest()->getName()))); - } else { - register_error(elgg_echo('admin:plugins:deactivate:no', array($plugin->getManifest()->getName()))); +foreach ($guids as $guid) { + $plugin = get_entity($guid); + if ($plugin->isActive()) { + if ($plugin->deactivate()) { + //system_message(elgg_echo('admin:plugins:activate:yes', array($plugin->getManifest()->getName()))); + } else { + register_error(elgg_echo('admin:plugins:deactivate:no', array($plugin->getManifest()->getName()))); + } } } diff --git a/views/default/admin/plugins.php b/views/default/admin/plugins.php index 9f426fae2..1aa899fcc 100644 --- a/views/default/admin/plugins.php +++ b/views/default/admin/plugins.php @@ -1,8 +1,8 @@ $plugin) { } } +$guids = array(); +foreach ($installed_plugins as $plugin) { + $guids[] = $plugin->getGUID(); +} + // sort plugins switch ($sort) { case 'date': @@ -99,7 +104,7 @@ if (!array_key_exists($show_category, $categories)) { } $category_form = elgg_view_form('admin/plugins/filter', array( - 'action' => 'admin/plugins/advanced', + 'action' => 'admin/plugins', 'method' => 'get', 'disable_security' => true, ), array( @@ -120,7 +125,7 @@ if (!array_key_exists($sort, $sort_options)) { } $sort_form = elgg_view_form('admin/plugins/sort', array( - 'action' => 'admin/plugins/advanced', + 'action' => 'admin/plugins', 'method' => 'get', 'disable_security' => true, ), array( @@ -129,21 +134,22 @@ $sort_form = elgg_view_form('admin/plugins/sort', array( 'category' => $show_category, )); - -// @todo Until "en/deactivate all" means "All plugins on this page" hide when not looking at all. -if ($show_category == 'all') { - $activate_url = "action/admin/plugins/activate_all"; - $activate_url = elgg_add_action_tokens_to_url($activate_url); - $deactivate_url = "action/admin/plugins/deactivate_all"; - $deactivate_url = elgg_add_action_tokens_to_url($deactivate_url); - - $buttons = ""; -} else { - $buttons = ''; -} +$buttons = "
"; +$buttons .= elgg_view_form('admin/plugins/change_state', array( + 'action' => 'action/admin/plugins/activate_all', + 'class' => 'float', +), array( + 'guids' => $guids, + 'action' => 'activate', +)); +$buttons .= elgg_view_form('admin/plugins/change_state', array( + 'action' => 'action/admin/plugins/deactivate_all', + 'class' => 'float', +), array( + 'guids' => $guids, + 'action' => 'deactivate', +)); +$buttons .= "
"; $buttons .= $category_form . $sort_form; diff --git a/views/default/css/admin.php b/views/default/css/admin.php index 744211a20..e04bdc568 100644 --- a/views/default/css/admin.php +++ b/views/default/css/admin.php @@ -158,6 +158,13 @@ table.mceLayout { .center { text-align: center; } +.float { + float: left; +} +.float-alt { + float: right; +} + /* *************************************** PAGE WRAPPER *************************************** */ diff --git a/views/default/forms/admin/plugins/change_state.php b/views/default/forms/admin/plugins/change_state.php new file mode 100644 index 000000000..ba5d873e7 --- /dev/null +++ b/views/default/forms/admin/plugins/change_state.php @@ -0,0 +1,20 @@ + 'guids', + 'value' => $guids, +)); + +echo elgg_view('input/submit', array( + 'value' => elgg_echo("admin:plugins:{$vars['action']}_all"), + 'class' => 'elgg-button elgg-button-action' +)); -- cgit v1.2.3 From ce395de063d23c691d47204b351f50f5a1958b58 Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 9 Jun 2011 21:05:34 +0000 Subject: Refs #2871 Forgot to update the forwarding for activate/deactivate actions git-svn-id: http://code.elgg.org/elgg/trunk@9161 36083f99-b078-4883-b0ff-0f9b5a30f544 --- actions/admin/plugins/activate.php | 7 ++++++- actions/admin/plugins/deactivate.php | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'actions/admin') diff --git a/actions/admin/plugins/activate.php b/actions/admin/plugins/activate.php index e04ee6298..feb986b27 100644 --- a/actions/admin/plugins/activate.php +++ b/actions/admin/plugins/activate.php @@ -39,7 +39,12 @@ elgg_invalidate_simplecache(); elgg_filepath_cache_reset(); if (count($activated_guids) === 1) { - forward("admin/plugins/advanced#elgg-plugin-" . $plugin_guids[0]); + $url = 'admin/plugins'; + $query = (string)parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY); + if ($query) { + $url .= "?$query"; + } + forward($url . '#elgg-plugin-' . $plugin_guids[0]); } else { forward(REFERER); } \ No newline at end of file diff --git a/actions/admin/plugins/deactivate.php b/actions/admin/plugins/deactivate.php index 9ec620e13..6c9a55c15 100644 --- a/actions/admin/plugins/deactivate.php +++ b/actions/admin/plugins/deactivate.php @@ -38,7 +38,12 @@ elgg_invalidate_simplecache(); elgg_filepath_cache_reset(); if (count($plugin_guids) == 1) { - forward("admin/plugins/advanced#elgg-plugin-" . $plugin_guids[0]); + $url = 'admin/plugins'; + $query = (string)parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY); + if ($query) { + $url .= "?$query"; + } + forward($url . '#elgg-plugin-' . $plugin_guids[0]); } else { forward(REFERER); } -- cgit v1.2.3