aboutsummaryrefslogtreecommitdiff
path: root/views/default/admin/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'views/default/admin/plugins')
-rw-r--r--views/default/admin/plugins/advanced.php43
-rw-r--r--views/default/admin/plugins/simple.php78
2 files changed, 65 insertions, 56 deletions
diff --git a/views/default/admin/plugins/advanced.php b/views/default/admin/plugins/advanced.php
index ead930090..1138ace4f 100644
--- a/views/default/admin/plugins/advanced.php
+++ b/views/default/admin/plugins/advanced.php
@@ -4,25 +4,25 @@
*
* Shows a list of all plugins sorted by load order.
*
- * @package Elgg
- * @subpackage Core
+ * @package Elgg.Core
+ * @subpackage Admin.Plugins
*/
-regenerate_plugin_list();
-$installed_plugins = get_installed_plugins();
-$plugin_list = array();
-$show_category = get_input('category', NULL);
+elgg_generate_plugin_entities();
+$installed_plugins = elgg_get_plugins('any');
+$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) {
- $plugin_categories = $plugin['manifest']['category'];
+foreach ($installed_plugins as $plugin) {
+ $plugin_categories = $plugin->manifest->getCategories();
// handle plugins that don't declare categories
- if ((!$plugin_categories && $show_category) || ($show_category && !in_array($show_category, $plugin_categories))) {
+ // unset them here because this is the list we foreach
+ if ($show_category && !in_array($show_category, $plugin_categories)) {
unset($installed_plugins[$id]);
}
@@ -57,9 +57,13 @@ $category_form = elgg_view('input/form', array(
// Page Header elements
$title = elgg_view_title(elgg_echo('admin:plugins'));
-// @todo Until "en/disable all" means "All plugins on this page" hide when not looking at all.
+// @todo Until "en/deactivate all" means "All plugins on this page" hide when not looking at all.
if (!isset($show_category) || empty($show_category)) {
- $buttons = "<a class='elgg-action-button' href=\"{$CONFIG->url}action/admin/plugins/enableall?__elgg_token=$token&amp;__elgg_ts=$ts\">".elgg_echo('enableall')."</a> <a class='elgg-action-button disabled' href=\"{$CONFIG->url}action/admin/plugins/disableall?__elgg_token=$token&amp;__elgg_ts=$ts\">".elgg_echo('disableall')."</a> ";
+ $activate_url = "{$CONFIG->url}action/admin/plugins/activate_all?__elgg_token=$token&amp;__elgg_ts=$ts";
+ $deactivate_url = "{$CONFIG->url}action/admin/plugins/deactivate_all?__elgg_token=$token&amp;__elgg_ts=$ts";
+
+ $buttons = "<a class='elgg-action-button' href=\"$activate_url\">" . elgg_echo('admin:plugins:activate_all') . '</a> ';
+ $buttons .= "<a class='elgg-action-button disabled' href=\"$deactivate_url\">" . elgg_echo('admin:plugins:deactivate_all') . '</a> ';
$buttons .= "<br /><br />";
} else {
$buttons = '';
@@ -76,25 +80,12 @@ $buttons .= $category_form;
<br />
<?php
-$limit = get_input('limit', 10);
-$offset = get_input('offset', 0);
-
-$plugin_list = get_plugin_list();
-$max = 0;
-foreach($plugin_list as $key => $foo) {
- if ($key > $max) $max = $key;
-}
-
// Display list of plugins
-$n = 0;
-foreach ($installed_plugins as $plugin => $data) {
+foreach ($installed_plugins as $plugin) {
echo elgg_view('admin/components/plugin', array(
'plugin' => $plugin,
- 'details' => $data,
- 'maxorder' => $max,
- 'order' => array_search($plugin, $plugin_list)
+ 'max_priority' => $max_priority
));
- $n++;
}
?>
<script type="text/javascript">
diff --git a/views/default/admin/plugins/simple.php b/views/default/admin/plugins/simple.php
index e53ecb0c1..d9be51a29 100644
--- a/views/default/admin/plugins/simple.php
+++ b/views/default/admin/plugins/simple.php
@@ -8,22 +8,20 @@
* @subpackage Core
*/
-regenerate_plugin_list();
-$installed_plugins = get_installed_plugins();
+elgg_generate_plugin_entities();
+$installed_plugins = elgg_get_plugins('any');
$plugin_list = array();
$title = elgg_view_title(elgg_echo('admin:plugins'));
-foreach ($installed_plugins as $installed_name => $plugin) {
- if (!isset($plugin['manifest']['admin_interface']) || $plugin['manifest']['admin_interface'] == 'advanced') {
- continue;
+foreach ($installed_plugins as $plugin) {
+ $interface = $plugin->manifest->getAdminInterface();
+ if ($interface == 'simple') {
+ $plugin_list[$plugin->manifest->getName()] = $plugin;
}
-
- $plugin['installed_name'] = $installed_name;
-
- $plugin_list[$plugin['manifest']['name']] = $plugin;
}
ksort($plugin_list);
+
$form_body .= <<<___END
<div id="content_header" class="clearfix">
<div class="content-header-title">$title</div>
@@ -31,10 +29,21 @@ $form_body .= <<<___END
<ul class="admin_plugins margin-top">
___END;
-foreach ($plugin_list as $name => $info) {
- $manifest = $info['manifest'];
- $version_valid = (isset($manifest['elgg_version'])) ? check_plugin_compatibility($manifest['elgg_version']) : FALSE;
- if ($info['active']) {
+$actions_base = '/action/admin/plugins/';
+$ts = time();
+$token = generate_action_token($ts);
+
+foreach ($plugin_list as $name => $plugin) {
+ $plugin_guid = $plugin->guid;
+ $plugin_id = $plugin->getID();
+ $active = $plugin->isActive();
+ $can_activate = $plugin->canActivate();
+ $author = $plugin->manifest->getAuthor();
+ $version = $plugin->manifest->getVersion();
+ $website = $plugin->manifest->getWebsite();
+ $description = $plugin->manifest->getDescription();
+
+ if ($active) {
$active_class = 'active';
$checked = 'checked="checked"';
} else {
@@ -42,41 +51,50 @@ foreach ($plugin_list as $name => $info) {
$checked = '';
}
- $author = $link = $version = $settings = '';
+ if ($can_activate) {
+ $disabled = '';
+ } else {
+ $disabled = 'disabled="disabled"';
+ $description .= '<p>' . elgg_echo('admin:plugins:simple:cannot_activate') . '</p>';
+ }
+
+ $description = elgg_view('output/longtext', array('value' => $description));
+
+ $author_html = $link_html = $version_html = $settings_html = '';
- if (isset($manifest['author'])) {
- $author = elgg_echo('admin:plugins:author', array($manifest['author']));
+ if ($author) {
+ $author_html = elgg_echo('admin:plugins:author', array($author));
}
- if (isset($manifest['version'])) {
- $version = ' | ' . elgg_echo('admin:plugins:version', array($manifest['version']));
+ if ($version) {
+ $version_html = ' | ' . elgg_echo('admin:plugins:version', array($version));
}
- if (isset($manifest['website'])) {
- $link = " | <a href=\"{$manifest['website']}\">" . elgg_echo('admin:plugins:plugin_website') . '</a>';
+ if ($website) {
+ $link_html = " | <a href=\"$website\">" . elgg_echo('admin:plugins:plugin_website') . '</a>';
}
- if (elgg_view_exists("settings/{$info['installed_name']}/edit")) {
- $settings_href = elgg_get_site_url()."pg/admin/plugin_settings/{$info['installed_name']}";
- $settings = " | <a class='plugin_settings link' href='$settings_href'>". elgg_echo('settings') ."</a>";
+ if (elgg_view_exists("settings/$plugin_id/edit")) {
+ $settings_href = elgg_get_site_url() . "pg/admin/plugin_settings/$plugin_id";
+ $settings_html = " | <a class='plugin_settings link' href='$settings_href'>" . elgg_echo('settings') . "</a>";
}
$form_body .= <<<___END
<li class="plugin_details $active_class">
<span class="plugin_controls">
- <input type="checkbox" id="{$info['installed_name']}" class="plugin_enabled" $checked name="enabled_plugins[]" value="{$info['installed_name']}"/>
- <label for="{$info['installed_name']}">$name</label>
+ <input type="checkbox" id="$plugin_guid" class="plugin_enabled" $checked $disabled name="active_plugin_guids[]" value="$plugin_guid"/>
+ <label for="$plugin_guid">$name</label>
</span>
<span class="plugin_info">
<span class="plugin_description">
- {$manifest['description']}
+ $description
</span>
<span class="plugin_metadata small">
- $author
- $version
- $link
- $settings
+ $author_html
+ $version_html
+ $link_html
+ $settings_html
</span>
</span>
</li>