diff options
author | Brett Profitt <brett.profitt@gmail.com> | 2011-06-18 19:56:33 -0400 |
---|---|---|
committer | Brett Profitt <brett.profitt@gmail.com> | 2011-06-18 19:56:33 -0400 |
commit | ec7b94a64aef23b85866ecdac8e8acc712d29bb6 (patch) | |
tree | a108205c3fa0b694d8ce0ebaafd259480d6b530a /views/default/admin | |
parent | c80ba5aa03264dd64c20ed8ae222e87f9371a44d (diff) | |
parent | 2b68a4d217c35a5587c462620789493cf2804ba2 (diff) | |
download | elgg-ec7b94a64aef23b85866ecdac8e8acc712d29bb6.tar.gz elgg-ec7b94a64aef23b85866ecdac8e8acc712d29bb6.tar.bz2 |
Merge branch 'master' of github.com:Elgg/Elgg
Diffstat (limited to 'views/default/admin')
-rw-r--r-- | views/default/admin/plugin_settings.php | 2 | ||||
-rw-r--r-- | views/default/admin/plugins.php | 177 | ||||
-rw-r--r-- | views/default/admin/plugins/advanced.php | 91 | ||||
-rw-r--r-- | views/default/admin/plugins/simple.php | 11 |
4 files changed, 178 insertions, 103 deletions
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.php b/views/default/admin/plugins.php new file mode 100644 index 000000000..1aa899fcc --- /dev/null +++ b/views/default/admin/plugins.php @@ -0,0 +1,177 @@ +<?php +/** + * Elgg administration plugin screen + * + * Shows a list of plugins that can be sorted and filtered. + * + * @package Elgg.Core + * @subpackage Admin.Plugins + */ + +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. +// @todo this could be cached somewhere after have the manifest loaded +$categories = array(); + +foreach ($installed_plugins as $id => $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"); + } + } + } +} + +$guids = array(); +foreach ($installed_plugins as $plugin) { + $guids[] = $plugin->getGUID(); +} + +// 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', + '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', + 'method' => 'get', + 'disable_security' => true, +), array( + 'sort' => $sort, + 'sort_options' => $sort_options, + 'category' => $show_category, +)); + +$buttons = "<div class=\"clearfix mbm\">"; +$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 .= "</div>"; + +$buttons .= $category_form . $sort_form; + +// construct page header +?> +<div id="content_header" class="mbm clearfix"> + <div class="content-header-options"><?php echo $buttons ?></div> +</div> + +<div id="elgg-plugin-list"> +<?php + +$options = array( + 'limit' => 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); + +?> +</div>
\ 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 02e9ae58b..000000000 --- a/views/default/admin/plugins/advanced.php +++ /dev/null @@ -1,91 +0,0 @@ -<?php -/** - * Elgg administration advanced plugin screen - * - * Shows a list of all plugins sorted by load order. - * - * @package Elgg.Core - * @subpackage Admin.Plugins - */ - -elgg_generate_plugin_entities(); -$installed_plugins = elgg_get_plugins('any', true); -$show_category = get_input('category', null); - -// Get a list of the all categories -// and trim down the plugin list if we're not viewing all categories. -// @todo this could be cached somewhere after have the manifest loaded -$categories = array(); - -foreach ($installed_plugins as $id => $plugin) { - if (!$plugin->isValid()) { - continue; - } - - $plugin_categories = $plugin->manifest->getCategories(); - - // 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]); - } - - if (isset($plugin_categories)) { - foreach ($plugin_categories as $category) { - if (!array_key_exists($category, $categories)) { - $categories[$category] = elgg_echo("admin:plugins:category:$category"); - } - } - } -} - -$categories = array_merge(array('' => elgg_echo('admin:plugins:category:all')), $categories); - -$category_dropdown = elgg_view('input/dropdown', array( - 'name' => 'category', - 'options_values' => $categories, - 'value' => $show_category -)); - -$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', - 'action' => 'admin/plugins/advanced', - 'disable_security' => true, -)); - -// @todo Until "en/deactivate all" means "All plugins on this page" hide when not looking at all. -if (!isset($show_category) || empty($show_category)) { - $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 = "<div class=\"mbl\">"; - $buttons .= "<a class='elgg-button elgg-button-action' href=\"$activate_url\">" . elgg_echo('admin:plugins:activate_all') . '</a> '; - $buttons .= "<a class='elgg-button elgg-button-cancel' href=\"$deactivate_url\">" . elgg_echo('admin:plugins:deactivate_all') . '</a> '; - $buttons .= "</div>"; -} else { - $buttons = ''; -} - -$buttons .= $category_form; - -// construct page header -?> -<div id="content_header" class="mbm clearfix"> - <div class="content-header-options"><?php echo $buttons ?></div> -</div> - -<div id="elgg-plugin-list"> -<?php - -echo elgg_view_entity_list($installed_plugins, 0, 0, 0, true, false, false); - -?> -</div>
\ No newline at end of file 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 @@ -<?php -/** - * Elgg administration simple plugin screen - * - * Shows an alphabetical list of "simple" plugins. - * - * @package Elgg - * @subpackage Core - */ - -echo elgg_view_form('admin/plugins/simple_update_states', array('class' => 'admin_plugins_simpleview')); |