diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-01-05 04:36:07 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-01-05 04:36:07 +0000 |
commit | f2123cdc42c8da21a297158fbb655f72bc92edce (patch) | |
tree | 6eb8c0a4492e5dddd29a87ad68a4ecadc7f01230 /views/default/admin/plugins/simple.php | |
parent | 252c054437ac1d3ad43aca1e71ebb936b55d60d2 (diff) | |
download | elgg-f2123cdc42c8da21a297158fbb655f72bc92edce.tar.gz elgg-f2123cdc42c8da21a297158fbb655f72bc92edce.tar.bz2 |
Fixes #2760. Refs #2759. Updated plugin admin actions to use the new system. Added plugin dependency views in admin. ElggPluginPackage->checkDependencies() now returns the detected value.
git-svn-id: http://code.elgg.org/elgg/trunk@7838 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/admin/plugins/simple.php')
-rw-r--r-- | views/default/admin/plugins/simple.php | 78 |
1 files changed, 48 insertions, 30 deletions
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> |