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 --- views/default/admin/plugin_settings.php | 2 +- views/default/admin/plugins/advanced.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'views/default/admin') diff --git a/views/default/admin/plugin_settings.php b/views/default/admin/plugin_settings.php index 7473768c0..c75492270 100644 --- a/views/default/admin/plugin_settings.php +++ b/views/default/admin/plugin_settings.php @@ -17,7 +17,7 @@ $vars['entity'] = $plugin; $settings = false; if (elgg_view_exists("settings/$plugin_id/edit") || elgg_view_exists("plugins/$plugin_id/settings")) { - $title = $plugin->manifest->getName(); + $title = $plugin->getManifest()->getName(); $params = array('id' => "$plugin_id-settings"); $body = elgg_view_form("plugins/settings/save", $params, $vars); diff --git a/views/default/admin/plugins/advanced.php b/views/default/admin/plugins/advanced.php index 02e9ae58b..550154fcd 100644 --- a/views/default/admin/plugins/advanced.php +++ b/views/default/admin/plugins/advanced.php @@ -22,7 +22,7 @@ foreach ($installed_plugins as $id => $plugin) { continue; } - $plugin_categories = $plugin->manifest->getCategories(); + $plugin_categories = $plugin->getManifest()->getCategories(); // handle plugins that don't declare categories // unset them here because this is the list we foreach -- cgit v1.2.3 From 9672142684f84dd26f2520f8f33979e1c638041e Mon Sep 17 00:00:00 2001 From: brettp Date: Wed, 27 Apr 2011 03:02:43 +0000 Subject: Refs #3362. Removed use of $show_bad in elgg_get_plugins(). git-svn-id: http://code.elgg.org/elgg/trunk@9031 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/plugins.php | 3 ++- views/default/admin/plugins/advanced.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'views/default/admin') diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php index 5aed3065a..31b69ce3d 100644 --- a/engine/lib/plugins.php +++ b/engine/lib/plugins.php @@ -380,6 +380,7 @@ function elgg_get_plugins($status = 'active', $site_guid = null) { $plugins = elgg_get_entities_from_relationship($options); elgg_set_ignore_access($old_ia); + $cache[$cache_hash] = $plugins; return $plugins; } @@ -397,7 +398,7 @@ function elgg_get_plugins($status = 'active', $site_guid = null) { function elgg_set_plugin_priorities(array $order) { $name = elgg_namespace_plugin_private_setting('internal', 'priority'); - $plugins = elgg_get_plugins('any', true); + $plugins = elgg_get_plugins('any'); if (!$plugins) { return false; } diff --git a/views/default/admin/plugins/advanced.php b/views/default/admin/plugins/advanced.php index 550154fcd..ea72bab5a 100644 --- a/views/default/admin/plugins/advanced.php +++ b/views/default/admin/plugins/advanced.php @@ -9,7 +9,7 @@ */ elgg_generate_plugin_entities(); -$installed_plugins = elgg_get_plugins('any', true); +$installed_plugins = elgg_get_plugins('any'); $show_category = get_input('category', null); // Get a list of the all categories -- cgit v1.2.3 From cd02daf8a7594b64b575eda24a9d452f27f612cf Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 14 May 2011 17:17:22 +0000 Subject: sorting plugin categories before display git-svn-id: http://code.elgg.org/elgg/trunk@9069 36083f99-b078-4883-b0ff-0f9b5a30f544 --- views/default/admin/plugins/advanced.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'views/default/admin') diff --git a/views/default/admin/plugins/advanced.php b/views/default/admin/plugins/advanced.php index ea72bab5a..4cefa0b3e 100644 --- a/views/default/admin/plugins/advanced.php +++ b/views/default/admin/plugins/advanced.php @@ -39,6 +39,8 @@ foreach ($installed_plugins as $id => $plugin) { } } +asort($categories); + $categories = array_merge(array('' => elgg_echo('admin:plugins:category:all')), $categories); $category_dropdown = elgg_view('input/dropdown', array( -- cgit v1.2.3 From a7274e5b6ade1a47e2bda837ddf01b5a2087c198 Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 9 Jun 2011 17:50:25 +0000 Subject: Refs #2871 filter plugins by active/inactive state git-svn-id: http://code.elgg.org/elgg/trunk@9152 36083f99-b078-4883-b0ff-0f9b5a30f544 --- languages/en.php | 2 ++ views/default/admin/plugins/advanced.php | 35 +++++++++++++++++++++++++++----- 2 files changed, 32 insertions(+), 5 deletions(-) (limited to 'views/default/admin') diff --git a/languages/en.php b/languages/en.php index 46ac19a34..a3ee4e421 100644 --- a/languages/en.php +++ b/languages/en.php @@ -594,6 +594,8 @@ $english = array( 'admin:footer:blog' => 'Elgg Blog', 'admin:plugins:category:all' => 'All plugins', + 'admin:plugins:category:active' => 'Active plugins', + 'admin:plugins:category:inactive' => 'Inactive plugins', 'admin:plugins:category:admin' => 'Admin', 'admin:plugins:category:bundled' => 'Bundled', 'admin:plugins:category:content' => 'Content', diff --git a/views/default/admin/plugins/advanced.php b/views/default/admin/plugins/advanced.php index 4cefa0b3e..dad1b778d 100644 --- a/views/default/admin/plugins/advanced.php +++ b/views/default/admin/plugins/advanced.php @@ -10,7 +10,7 @@ elgg_generate_plugin_entities(); $installed_plugins = elgg_get_plugins('any'); -$show_category = get_input('category', null); +$show_category = get_input('category', 'all'); // Get a list of the all categories // and trim down the plugin list if we're not viewing all categories. @@ -26,9 +26,28 @@ foreach ($installed_plugins as $id => $plugin) { // handle plugins that don't declare categories // unset them here because this is the list we foreach - if ($show_category && !in_array($show_category, $plugin_categories)) { - unset($installed_plugins[$id]); + switch ($show_category) { + case 'all': + break; + case 'active': + if (!$plugin->isActive()) { + unset($installed_plugins[$id]); + } + break; + case 'inactive': + if ($plugin->isActive()) { + unset($installed_plugins[$id]); + } + break; + default: + if (!in_array($show_category, $plugin_categories)) { + unset($installed_plugins[$id]); + } + break; } + //if ($show_category && !in_array($show_category, $plugin_categories)) { + // unset($installed_plugins[$id]); + //} if (isset($plugin_categories)) { foreach ($plugin_categories as $category) { @@ -41,7 +60,13 @@ foreach ($installed_plugins as $id => $plugin) { asort($categories); -$categories = array_merge(array('' => elgg_echo('admin:plugins:category:all')), $categories); +$common_categories = array( + 'all' => elgg_echo('admin:plugins:category:all'), + 'active' => elgg_echo('admin:plugins:category:active'), + 'inactive' => elgg_echo('admin:plugins:category:inactive'), +); + +$categories = array_merge($common_categories, $categories); $category_dropdown = elgg_view('input/dropdown', array( 'name' => 'category', @@ -62,7 +87,7 @@ $category_form = elgg_view('input/form', array( )); // @todo Until "en/deactivate all" means "All plugins on this page" hide when not looking at all. -if (!isset($show_category) || empty($show_category)) { +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"; -- cgit v1.2.3 From 92819a1cd4ac44607c35de069a1edf8ef5bc4048 Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 9 Jun 2011 18:49:15 +0000 Subject: Refs #2871 adding sorting to advanced plugin page git-svn-id: http://code.elgg.org/elgg/trunk@9153 36083f99-b078-4883-b0ff-0f9b5a30f544 --- languages/en.php | 4 ++ views/default/admin/plugins/advanced.php | 76 ++++++++++++++++++++++------ views/default/forms/admin/plugins/filter.php | 24 +++++++++ views/default/forms/admin/plugins/sort.php | 24 +++++++++ 4 files changed, 112 insertions(+), 16 deletions(-) create mode 100644 views/default/forms/admin/plugins/filter.php create mode 100644 views/default/forms/admin/plugins/sort.php (limited to 'views/default/admin') diff --git a/languages/en.php b/languages/en.php index a3ee4e421..923647882 100644 --- a/languages/en.php +++ b/languages/en.php @@ -609,6 +609,10 @@ $english = array( 'admin:plugins:category:theme' => 'Themes', 'admin:plugins:category:widget' => 'Widgets', + 'admin:plugins:sort:priority' => 'Priority', + 'admin:plugins:sort:alpha' => 'Alphabetical', + 'admin:plugins:sort:date' => 'Newest', + 'admin:plugins:markdown:unknown_plugin' => 'Unknown plugin.', 'admin:plugins:markdown:unknown_file' => 'Unknown file.', diff --git a/views/default/admin/plugins/advanced.php b/views/default/admin/plugins/advanced.php index dad1b778d..deae9dcdd 100644 --- a/views/default/admin/plugins/advanced.php +++ b/views/default/admin/plugins/advanced.php @@ -11,6 +11,7 @@ elgg_generate_plugin_entities(); $installed_plugins = elgg_get_plugins('any'); $show_category = get_input('category', 'all'); +$sort = get_input('sort', 'priority'); // Get a list of the all categories // and trim down the plugin list if we're not viewing all categories. @@ -45,9 +46,6 @@ foreach ($installed_plugins as $id => $plugin) { } break; } - //if ($show_category && !in_array($show_category, $plugin_categories)) { - // unset($installed_plugins[$id]); - //} if (isset($plugin_categories)) { foreach ($plugin_categories as $category) { @@ -58,6 +56,34 @@ foreach ($installed_plugins as $id => $plugin) { } } +// sort plugins +switch ($sort) { + case 'date': + $plugin_list = array(); + foreach ($installed_plugins as $plugin) { + $create_date = $plugin->getTimeCreated(); + while (isset($plugin_list[$create_date])) { + $create_date++; + } + $plugin_list[$create_date] = $plugin; + } + krsort($plugin_list); + break; + case 'alpha': + $plugin_list = array(); + foreach ($installed_plugins as $plugin) { + $plugin_list[$plugin->getManifest()->getName()] = $plugin; + } + ksort($plugin_list); + break; + case 'priority': + default: + $plugin_list = $installed_plugins; + break; +} + + + asort($categories); $common_categories = array( @@ -67,25 +93,43 @@ $common_categories = array( ); $categories = array_merge($common_categories, $categories); +// security - only want a defined option +if (!array_key_exists($show_category, $categories)) { + $show_category = reset($categories); +} -$category_dropdown = elgg_view('input/dropdown', array( - 'name' => 'category', - 'options_values' => $categories, - 'value' => $show_category +$category_form = elgg_view_form('admin/plugins/filter', array( + 'action' => 'admin/plugins/advanced', + 'method' => 'get', + 'disable_security' => true, +), array( + 'category' => $show_category, + 'category_options' => $categories, + 'sort' => $sort, )); -$category_button = elgg_view('input/submit', array( - 'value' => elgg_echo('filter'), - 'class' => 'elgg-button elgg-button-action' -)); -$category_form = elgg_view('input/form', array( - 'body' => $category_dropdown . $category_button, - 'method' => 'get', +$sort_options = array( + 'priority' => elgg_echo('admin:plugins:sort:priority'), + 'alpha' => elgg_echo('admin:plugins:sort:alpha'), + 'date' => elgg_echo('admin:plugins:sort:date'), +); +// security - only want a defined option +if (!array_key_exists($sort, $sort_options)) { + $sort = reset($sort_options); +} + +$sort_form = elgg_view_form('admin/plugins/sort', array( 'action' => 'admin/plugins/advanced', + 'method' => 'get', 'disable_security' => true, +), array( + 'sort' => $sort, + 'sort_options' => $sort_options, + '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"; @@ -101,7 +145,7 @@ if ($show_category == 'all') { $buttons = ''; } -$buttons .= $category_form; +$buttons .= $category_form . $sort_form; // construct page header ?> @@ -112,7 +156,7 @@ $buttons .= $category_form;
\ No newline at end of file diff --git a/views/default/forms/admin/plugins/filter.php b/views/default/forms/admin/plugins/filter.php new file mode 100644 index 000000000..d00906e6a --- /dev/null +++ b/views/default/forms/admin/plugins/filter.php @@ -0,0 +1,24 @@ + 'category', + 'options_values' => $vars['category_options'], + 'value' => $vars['category'], +)); + +echo elgg_view('input/hidden', array( + 'name' => 'sort', + 'value' => $vars['sort'], +)); + +echo elgg_view('input/submit', array( + 'value' => elgg_echo('filter'), + 'class' => 'elgg-button elgg-button-action', +)); diff --git a/views/default/forms/admin/plugins/sort.php b/views/default/forms/admin/plugins/sort.php new file mode 100644 index 000000000..284e085e6 --- /dev/null +++ b/views/default/forms/admin/plugins/sort.php @@ -0,0 +1,24 @@ + 'sort', + 'options_values' => $vars['sort_options'], + 'value' => $vars['sort'], +)); + +echo elgg_view('input/hidden', array( + 'name' => 'category', + 'value' => $vars['category'], +)); + +echo elgg_view('input/submit', array( + 'value' => elgg_echo('sort'), + 'class' => 'elgg-button elgg-button-action' +)); -- cgit v1.2.3 From 727ba0b25e7b5737dcffb3061b96dba5f1a7f034 Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 9 Jun 2011 19:11:55 +0000 Subject: Refs #2871 only showing links for changing priority when all plugins are shown in priority order git-svn-id: http://code.elgg.org/elgg/trunk@9154 36083f99-b078-4883-b0ff-0f9b5a30f544 --- views/default/admin/plugins/advanced.php | 11 ++- views/default/object/plugin/advanced.php | 100 +++++++++++---------- .../object/plugin/elements/dependencies.php | 2 +- 3 files changed, 65 insertions(+), 48 deletions(-) (limited to 'views/default/admin') diff --git a/views/default/admin/plugins/advanced.php b/views/default/admin/plugins/advanced.php index deae9dcdd..9f426fae2 100644 --- a/views/default/admin/plugins/advanced.php +++ b/views/default/admin/plugins/advanced.php @@ -156,7 +156,16 @@ $buttons .= $category_form . $sort_form;
0, + 'full_view' => true, + 'list_type_toggle' => false, + 'pagination' => false, +); +if ($show_category == 'all' && $sort == 'priority') { + $options['display_reordering'] = true; +} +echo elgg_view_entity_list($plugin_list, $options); ?>
\ No newline at end of file diff --git a/views/default/object/plugin/advanced.php b/views/default/object/plugin/advanced.php index 56e680ad5..21c99f619 100644 --- a/views/default/object/plugin/advanced.php +++ b/views/default/object/plugin/advanced.php @@ -5,11 +5,15 @@ * This file renders a plugin for the admin screen, including active/deactive, * manifest details & display plugin settings. * + * @uses $vars['entity'] + * @uses $vars['display_reordering'] Do we display the priority reordering links? + * * @package Elgg.Core * @subpackage Plugins */ $plugin = $vars['entity']; +$reordering = elgg_extract('display_reordering', $vars, false); $priority = $plugin->getPriority(); $active = $plugin->isActive(); @@ -24,58 +28,60 @@ $token = generate_action_token($ts); // build reordering links $links = ''; -// top and up link only if not at top -if ($priority > 1) { - $top_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array( - 'plugin_guid' => $plugin->guid, - 'priority' => 'first', - 'is_action' => true - )); +if ($reordering) { + // top and up link only if not at top + if ($priority > 1) { + $top_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array( + 'plugin_guid' => $plugin->guid, + 'priority' => 'first', + 'is_action' => true + )); - $links .= "
  • " . elgg_view('output/url', array( - 'href' => $top_url, - 'text' => elgg_echo('top'), - 'is_action' => true - )) . "
  • "; + $links .= "
  • " . elgg_view('output/url', array( + 'href' => $top_url, + 'text' => elgg_echo('top'), + 'is_action' => true + )) . "
  • "; - $up_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array( - 'plugin_guid' => $plugin->guid, - 'priority' => '-1', - 'is_action' => true - )); + $up_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array( + 'plugin_guid' => $plugin->guid, + 'priority' => '-1', + 'is_action' => true + )); - $links .= "
  • " . elgg_view('output/url', array( - 'href' => $up_url, - 'text' => elgg_echo('up'), - 'is_action' => true - )) . "
  • "; -} + $links .= "
  • " . elgg_view('output/url', array( + 'href' => $up_url, + 'text' => elgg_echo('up'), + 'is_action' => true + )) . "
  • "; + } -// down and bottom links only if not at bottom -if ($priority < $max_priority) { - $down_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array( - 'plugin_guid' => $plugin->guid, - 'priority' => '+1', - 'is_action' => true - )); + // down and bottom links only if not at bottom + if ($priority < $max_priority) { + $down_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array( + 'plugin_guid' => $plugin->guid, + 'priority' => '+1', + 'is_action' => true + )); - $links .= "
  • " . elgg_view('output/url', array( - 'href' => $down_url, - 'text' => elgg_echo('down'), - 'is_action' => true - )) . "
  • "; + $links .= "
  • " . elgg_view('output/url', array( + 'href' => $down_url, + 'text' => elgg_echo('down'), + 'is_action' => true + )) . "
  • "; - $bottom_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array( - 'plugin_guid' => $plugin->guid, - 'priority' => 'last', - 'is_action' => true - )); + $bottom_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array( + 'plugin_guid' => $plugin->guid, + 'priority' => 'last', + 'is_action' => true + )); - $links .= "
  • " . elgg_view('output/url', array( - 'href' => $bottom_url, - 'text' => elgg_echo('bottom'), - 'is_action' => true - )) . "
  • "; + $links .= "
  • " . elgg_view('output/url', array( + 'href' => $bottom_url, + 'text' => elgg_echo('bottom'), + 'is_action' => true + )) . "
  • "; + } } // activate / deactivate links @@ -181,9 +187,11 @@ if ($files) {
    + +
    diff --git a/views/default/object/plugin/elements/dependencies.php b/views/default/object/plugin/elements/dependencies.php index f4d1ccc5a..5f4aa4392 100644 --- a/views/default/object/plugin/elements/dependencies.php +++ b/views/default/object/plugin/elements/dependencies.php @@ -20,7 +20,7 @@ foreach ($columns as $column) { echo "$column"; } -echo ''; +echo ''; $row = 'odd'; foreach ($deps as $dep) { -- cgit v1.2.3 From 977ab26af244f793440301a3bd4f35d45b1dd0b1 Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 9 Jun 2011 19:35:05 +0000 Subject: Refs #2871 promoted advanced plugins up to be a primary menu git-svn-id: http://code.elgg.org/elgg/trunk@9156 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/admin.php | 13 ++- views/default/admin/plugins.php | 171 +++++++++++++++++++++++++++++++ views/default/admin/plugins/advanced.php | 171 ------------------------------- 3 files changed, 181 insertions(+), 174 deletions(-) create mode 100644 views/default/admin/plugins.php delete mode 100644 views/default/admin/plugins/advanced.php (limited to 'views/default/admin') diff --git a/engine/lib/admin.php b/engine/lib/admin.php index 8016a2fd6..7c41fc24e 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -262,11 +262,18 @@ function admin_init() { // configure // plugins - elgg_register_admin_menu_item('configure', 'plugins', null, 10); - elgg_register_admin_menu_item('configure', 'simple', 'plugins', 10); - elgg_register_admin_menu_item('configure', 'advanced', 'plugins', 20); + elgg_register_menu_item('page', array( + 'name' => 'plugins', + 'href' => 'admin/plugins', + 'text' => elgg_echo('admin:plugins'), + 'context' => 'admin', + 'priority' => 75, + 'section' => 'configure' + )); // settings + elgg_register_admin_menu_item('configure', 'appearance', null, 50); + elgg_register_admin_menu_item('configure', 'settings', null, 100); elgg_register_admin_menu_item('configure', 'basic', 'settings', 10); elgg_register_admin_menu_item('configure', 'advanced', 'settings', 20); elgg_register_admin_menu_item('configure', 'menu_items', 'appearance', 30); diff --git a/views/default/admin/plugins.php b/views/default/admin/plugins.php new file mode 100644 index 000000000..9f426fae2 --- /dev/null +++ b/views/default/admin/plugins.php @@ -0,0 +1,171 @@ + $plugin) { + if (!$plugin->isValid()) { + continue; + } + + $plugin_categories = $plugin->getManifest()->getCategories(); + + // handle plugins that don't declare categories + // unset them here because this is the list we foreach + switch ($show_category) { + case 'all': + break; + case 'active': + if (!$plugin->isActive()) { + unset($installed_plugins[$id]); + } + break; + case 'inactive': + if ($plugin->isActive()) { + unset($installed_plugins[$id]); + } + break; + default: + if (!in_array($show_category, $plugin_categories)) { + unset($installed_plugins[$id]); + } + break; + } + + if (isset($plugin_categories)) { + foreach ($plugin_categories as $category) { + if (!array_key_exists($category, $categories)) { + $categories[$category] = elgg_echo("admin:plugins:category:$category"); + } + } + } +} + +// sort plugins +switch ($sort) { + case 'date': + $plugin_list = array(); + foreach ($installed_plugins as $plugin) { + $create_date = $plugin->getTimeCreated(); + while (isset($plugin_list[$create_date])) { + $create_date++; + } + $plugin_list[$create_date] = $plugin; + } + krsort($plugin_list); + break; + case 'alpha': + $plugin_list = array(); + foreach ($installed_plugins as $plugin) { + $plugin_list[$plugin->getManifest()->getName()] = $plugin; + } + ksort($plugin_list); + break; + case 'priority': + default: + $plugin_list = $installed_plugins; + break; +} + + + +asort($categories); + +$common_categories = array( + 'all' => elgg_echo('admin:plugins:category:all'), + 'active' => elgg_echo('admin:plugins:category:active'), + 'inactive' => elgg_echo('admin:plugins:category:inactive'), +); + +$categories = array_merge($common_categories, $categories); +// security - only want a defined option +if (!array_key_exists($show_category, $categories)) { + $show_category = reset($categories); +} + +$category_form = elgg_view_form('admin/plugins/filter', array( + 'action' => 'admin/plugins/advanced', + 'method' => 'get', + 'disable_security' => true, +), array( + 'category' => $show_category, + 'category_options' => $categories, + 'sort' => $sort, +)); + + +$sort_options = array( + 'priority' => elgg_echo('admin:plugins:sort:priority'), + 'alpha' => elgg_echo('admin:plugins:sort:alpha'), + 'date' => elgg_echo('admin:plugins:sort:date'), +); +// security - only want a defined option +if (!array_key_exists($sort, $sort_options)) { + $sort = reset($sort_options); +} + +$sort_form = elgg_view_form('admin/plugins/sort', array( + 'action' => 'admin/plugins/advanced', + 'method' => 'get', + 'disable_security' => true, +), array( + 'sort' => $sort, + 'sort_options' => $sort_options, + '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 .= $category_form . $sort_form; + +// construct page header +?> +
    +
    +
    + +
    + 0, + 'full_view' => true, + 'list_type_toggle' => false, + 'pagination' => false, +); +if ($show_category == 'all' && $sort == 'priority') { + $options['display_reordering'] = true; +} +echo elgg_view_entity_list($plugin_list, $options); + +?> +
    \ No newline at end of file diff --git a/views/default/admin/plugins/advanced.php b/views/default/admin/plugins/advanced.php deleted file mode 100644 index 9f426fae2..000000000 --- a/views/default/admin/plugins/advanced.php +++ /dev/null @@ -1,171 +0,0 @@ - $plugin) { - if (!$plugin->isValid()) { - continue; - } - - $plugin_categories = $plugin->getManifest()->getCategories(); - - // handle plugins that don't declare categories - // unset them here because this is the list we foreach - switch ($show_category) { - case 'all': - break; - case 'active': - if (!$plugin->isActive()) { - unset($installed_plugins[$id]); - } - break; - case 'inactive': - if ($plugin->isActive()) { - unset($installed_plugins[$id]); - } - break; - default: - if (!in_array($show_category, $plugin_categories)) { - unset($installed_plugins[$id]); - } - break; - } - - if (isset($plugin_categories)) { - foreach ($plugin_categories as $category) { - if (!array_key_exists($category, $categories)) { - $categories[$category] = elgg_echo("admin:plugins:category:$category"); - } - } - } -} - -// sort plugins -switch ($sort) { - case 'date': - $plugin_list = array(); - foreach ($installed_plugins as $plugin) { - $create_date = $plugin->getTimeCreated(); - while (isset($plugin_list[$create_date])) { - $create_date++; - } - $plugin_list[$create_date] = $plugin; - } - krsort($plugin_list); - break; - case 'alpha': - $plugin_list = array(); - foreach ($installed_plugins as $plugin) { - $plugin_list[$plugin->getManifest()->getName()] = $plugin; - } - ksort($plugin_list); - break; - case 'priority': - default: - $plugin_list = $installed_plugins; - break; -} - - - -asort($categories); - -$common_categories = array( - 'all' => elgg_echo('admin:plugins:category:all'), - 'active' => elgg_echo('admin:plugins:category:active'), - 'inactive' => elgg_echo('admin:plugins:category:inactive'), -); - -$categories = array_merge($common_categories, $categories); -// security - only want a defined option -if (!array_key_exists($show_category, $categories)) { - $show_category = reset($categories); -} - -$category_form = elgg_view_form('admin/plugins/filter', array( - 'action' => 'admin/plugins/advanced', - 'method' => 'get', - 'disable_security' => true, -), array( - 'category' => $show_category, - 'category_options' => $categories, - 'sort' => $sort, -)); - - -$sort_options = array( - 'priority' => elgg_echo('admin:plugins:sort:priority'), - 'alpha' => elgg_echo('admin:plugins:sort:alpha'), - 'date' => elgg_echo('admin:plugins:sort:date'), -); -// security - only want a defined option -if (!array_key_exists($sort, $sort_options)) { - $sort = reset($sort_options); -} - -$sort_form = elgg_view_form('admin/plugins/sort', array( - 'action' => 'admin/plugins/advanced', - 'method' => 'get', - 'disable_security' => true, -), array( - 'sort' => $sort, - 'sort_options' => $sort_options, - '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 .= $category_form . $sort_form; - -// construct page header -?> -
    -
    -
    - -
    - 0, - 'full_view' => true, - 'list_type_toggle' => false, - 'pagination' => false, -); -if ($show_category == 'all' && $sort == 'priority') { - $options['display_reordering'] = true; -} -echo elgg_view_entity_list($plugin_list, $options); - -?> -
    \ No newline at end of file -- cgit v1.2.3 From 4886371c1709f5b098226e362986796b960f4e54 Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 9 Jun 2011 19:39:55 +0000 Subject: Refs #2871 removed the simple plugins page git-svn-id: http://code.elgg.org/elgg/trunk@9157 36083f99-b078-4883-b0ff-0f9b5a30f544 --- views/default/admin/plugins/simple.php | 11 --------- .../forms/admin/plugins/simple_update_states.php | 28 ---------------------- 2 files changed, 39 deletions(-) delete mode 100644 views/default/admin/plugins/simple.php delete mode 100644 views/default/forms/admin/plugins/simple_update_states.php (limited to 'views/default/admin') diff --git a/views/default/admin/plugins/simple.php b/views/default/admin/plugins/simple.php deleted file mode 100644 index 28c1cc25e..000000000 --- a/views/default/admin/plugins/simple.php +++ /dev/null @@ -1,11 +0,0 @@ - 'admin_plugins_simpleview')); diff --git a/views/default/forms/admin/plugins/simple_update_states.php b/views/default/forms/admin/plugins/simple_update_states.php deleted file mode 100644 index cc1c1a710..000000000 --- a/views/default/forms/admin/plugins/simple_update_states.php +++ /dev/null @@ -1,28 +0,0 @@ -isValid()) { - continue; - } - $interface = $plugin->getManifest()->getAdminInterface(); - if ($interface == 'simple') { - $plugin_list[$plugin->getManifest()->getName()] = $plugin; - } -} - -ksort($plugin_list); - -echo elgg_view_entity_list($plugin_list, 0, 0, 0, false, false, false); -echo elgg_view('input/submit', array('value' => elgg_echo('save'))); -- 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 'views/default/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