diff options
author | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-22 00:12:17 +0000 |
---|---|---|
committer | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-22 00:12:17 +0000 |
commit | 00ea6e1ddd446c61c6ccd956989b4b9a1cd60119 (patch) | |
tree | 4d3d546d88326fd976a8f75c0b4d4dac9b54ef1b /views/default | |
parent | 8439fcf13d794780c89925896b8aaca521c14e30 (diff) | |
download | elgg-00ea6e1ddd446c61c6ccd956989b4b9a1cd60119.tar.gz elgg-00ea6e1ddd446c61c6ccd956989b4b9a1cd60119.tar.bz2 |
Refs #2950: Cleanup of plugin-related view structure
git-svn-id: http://code.elgg.org/elgg/trunk@8394 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default')
-rw-r--r-- | views/default/admin/plugin_settings.php (renamed from views/default/admin/components/plugin_settings.php) | 0 | ||||
-rw-r--r-- | views/default/admin/plugins/advanced.php | 9 | ||||
-rw-r--r-- | views/default/core/settings/tools.php | 18 | ||||
-rw-r--r-- | views/default/core/settings/tools/plugin.php | 39 | ||||
-rw-r--r-- | views/default/forms/admin/plugins/simple_update_states.php | 74 | ||||
-rw-r--r-- | views/default/forms/plugins/usersettings/save.php | 1 | ||||
-rw-r--r-- | views/default/js/admin.php | 12 | ||||
-rw-r--r-- | views/default/object/plugin.php | 18 | ||||
-rw-r--r-- | views/default/object/plugin/advanced.php (renamed from views/default/admin/components/plugin.php) | 16 | ||||
-rw-r--r-- | views/default/object/plugin/elements/dependencies.php (renamed from views/default/admin/components/plugin_dependencies.php) | 0 | ||||
-rw-r--r-- | views/default/object/plugin/invalid.php (renamed from views/default/admin/components/invalid_plugin.php) | 3 | ||||
-rw-r--r-- | views/default/object/plugin/simple.php | 63 |
12 files changed, 99 insertions, 154 deletions
diff --git a/views/default/admin/components/plugin_settings.php b/views/default/admin/plugin_settings.php index c2801cec3..c2801cec3 100644 --- a/views/default/admin/components/plugin_settings.php +++ b/views/default/admin/plugin_settings.php diff --git a/views/default/admin/plugins/advanced.php b/views/default/admin/plugins/advanced.php index 6b32035f3..8b12cd899 100644 --- a/views/default/admin/plugins/advanced.php +++ b/views/default/admin/plugins/advanced.php @@ -82,12 +82,7 @@ $buttons .= $category_form; <div id="elgg-plugin-list"> <?php -// Display list of plugins -foreach ($installed_plugins as $plugin) { - $view = ($plugin->isValid()) ? 'admin/components/plugin' : 'admin/components/invalid_plugin'; - echo elgg_view($view, array( - 'plugin' => $plugin - )); -} + 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/core/settings/tools.php b/views/default/core/settings/tools.php index 73af8d738..3836b7ef1 100644 --- a/views/default/core/settings/tools.php +++ b/views/default/core/settings/tools.php @@ -9,9 +9,10 @@ */ // Description of what's going on -echo "<div class='user-settings margin-top'>" - . elgg_view('output/longtext', array('value' => elgg_echo("usersettings:plugins:description"))) - . "</div>"; +echo elgg_view('output/longtext', array( + 'value' => elgg_echo("usersettings:plugins:description"), + 'class' => 'user-settings mtm', +)); $limit = get_input('limit', 10); $offset = get_input('offset', 0); @@ -20,10 +21,13 @@ $offset = get_input('offset', 0); $installed_plugins = $vars['installed_plugins']; $count = count($installed_plugins); -// Display list of plugins -$n = 0; + +// Display all plugins' usersettings forms foreach ($installed_plugins as $plugin) { - if ($plugin->isActive()) { - echo elgg_view("core/settings/tools/plugin", array('plugin' => $plugin)); + $plugin_id = $plugin->getID(); + if ($plugin->isActive() && elgg_view_exists("usersettings/$plugin_id/edit")) { + $title = $plugin->manifest->getName(); + $body = elgg_view_form('plugins/usersettings/save', array(), array('entity' => $plugin)); + echo elgg_view_module('info', $title, $body); } }
\ No newline at end of file diff --git a/views/default/core/settings/tools/plugin.php b/views/default/core/settings/tools/plugin.php deleted file mode 100644 index 88d366a8a..000000000 --- a/views/default/core/settings/tools/plugin.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php -/** - * This displays a plugin's user settings. - * - * @uses ElggPlugin $vars['plugin'] The plugin to show settings for. - * - * @package Elgg.Core - * @subpackage Plugins.Settings - */ - - -$plugin = $vars['plugin']; -$plugin_id = $plugin->getID(); -$user_guid = $vars['user_guid']; - -if (!$user_guid) { - $user_guid = elgg_get_logged_in_user_guid(); -} - -if (elgg_view("usersettings/$plugin_id/edit")) { -?> - -<div class="elgg-module elgg-module-info"> - <div class="elgg-head"> - <h3><?php echo $plugin->manifest->getName(); ?></h3> - </div> - <div class="elgg-body"> - <div id="<?php echo $plugin_id; ?>_settings"> - <?php echo elgg_view("object/plugin", array( - 'plugin' => $plugin, - 'entity' => elgg_get_all_plugin_user_settings($plugin_id, $user_guid), - 'type' => 'user' - )); - ?> - </div> - </div> -</div> -<?php -}
\ No newline at end of file diff --git a/views/default/forms/admin/plugins/simple_update_states.php b/views/default/forms/admin/plugins/simple_update_states.php index bf9f4e4c1..938eddb26 100644 --- a/views/default/forms/admin/plugins/simple_update_states.php +++ b/views/default/forms/admin/plugins/simple_update_states.php @@ -24,78 +24,6 @@ foreach ($installed_plugins as $plugin) { ksort($plugin_list); -echo <<<___END - <ul> -___END; - -$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 = 'elgg-state-active'; - $checked = 'checked="checked"'; - } else { - $active_class = 'elgg-state-inactive'; - $checked = ''; - } - - 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)); - - $plugin_footer = '<ul class="elgg-menu elgg-menu-footer">'; - - if ($author) { - $plugin_footer .= '<li>' . elgg_echo('admin:plugins:author', array($author)) . '</li>'; - } - - if ($version) { - $plugin_footer .= '<li>' . elgg_echo('admin:plugins:version', array($version)) . '</li>'; - } - - if ($website) { - $plugin_footer .= "<li><a href=\"$website\">" . elgg_echo('admin:plugins:plugin_website') . '</a></li>'; - } - - if (elgg_view_exists("settings/$plugin_id/edit")) { - $settings_href = elgg_get_site_url() . "pg/admin/plugin_settings/$plugin_id"; - $plugin_footer .= "<li><a class='plugin_settings link' href='$settings_href'>" . elgg_echo('settings') . "</a></li>"; - } - - $plugin_footer .= "</ul>"; - - echo <<<___END - <li class="elgg-plugin $active_class"> - <div class="elgg-grid"> - <div class="elgg-col elgg-col-1of5"> - <input type="checkbox" id="$plugin_guid" $checked $disabled name="active_plugin_guids[]" value="$plugin_guid"/> - <label for="$plugin_guid">$name</label> - </div> - <div class="elgg-col elgg-col-4of5"> - $description - $plugin_footer - </div> - </div> - </li> -___END; -} - -echo '</ul>'; +echo elgg_view_entity_list($plugin_list, 0, 0, 0, false, false, false); echo elgg_view('input/submit', array('value' => elgg_echo('save'))); echo elgg_view('input/reset', array('value' => elgg_echo('reset'))); diff --git a/views/default/forms/plugins/usersettings/save.php b/views/default/forms/plugins/usersettings/save.php index 8532cdfd1..bf243ae6b 100644 --- a/views/default/forms/plugins/usersettings/save.php +++ b/views/default/forms/plugins/usersettings/save.php @@ -1,4 +1,5 @@ <?php $vars['type'] = 'user'; +// Can't use elgg_view_form() because it overrides the $vars['action'] parameter echo elgg_view('forms/plugins/settings/save', $vars);
\ No newline at end of file diff --git a/views/default/js/admin.php b/views/default/js/admin.php index 603d0f066..c146597e5 100644 --- a/views/default/js/admin.php +++ b/views/default/js/admin.php @@ -8,19 +8,13 @@ elgg.provide('elgg.admin'); elgg.admin.init = function () { - // display manifest info - <?php //@todo Use elgg-toggler pattern ?> - $('a.manifest_details.link').click(function() { - elgg_slide_toggle($(this), '.elgg-plugin', '.manifest_file'); - }); - // plugin screenshot modal $('.elgg-plugin-screenshot a').click(elgg.admin.displayPluginScreenshot); // draggable plugin reordering - $('#elgg-plugin-list').sortable({ - items: 'div.elgg-state-draggable', - handle: 'h3.elgg-head', + $('#elgg-plugin-list > ul').sortable({ + items: 'li:has(> .elgg-state-draggable)', + handle: '.elgg-head', forcePlaceholderSize: true, placeholder: 'elgg-widget-placeholder', opacity: 0.8, diff --git a/views/default/object/plugin.php b/views/default/object/plugin.php index e9cacca35..af1ccd677 100644 --- a/views/default/object/plugin.php +++ b/views/default/object/plugin.php @@ -5,18 +5,14 @@ * @package Elgg.Core * @subpackage Plugins * - * @todo This view really should be used to display visualization on the admin panel, \ - * rather than emitting the settings forms */ -// Do we want to show admin settings or user settings -$type = elgg_extract('type', $vars, ''); +$plugin = $vars['entity']; -if ($type != 'user') { - $type = ''; +if (!$plugin->isValid()) { + echo elgg_view('object/plugin/invalid', $vars); +} elseif ($vars['full']) { + echo elgg_view('object/plugin/advanced', $vars); +} else { + echo elgg_view('object/plugin/simple', $vars); } - -?> -<div> - <?php echo elgg_view_form("plugins/{$type}settings/save", array(), $vars); ?> -</div>
\ No newline at end of file diff --git a/views/default/admin/components/plugin.php b/views/default/object/plugin/advanced.php index 7549ea8ca..f6a760af4 100644 --- a/views/default/admin/components/plugin.php +++ b/views/default/object/plugin/advanced.php @@ -9,7 +9,7 @@ * @subpackage Plugins */ -$plugin = $vars['plugin']; +$plugin = $vars['entity']; $priority = $plugin->getPriority(); $active = $plugin->isActive(); @@ -152,12 +152,12 @@ $license = elgg_view('output/text', array('value' => $plugin->manifest->getLicen ?> -<div id="elgg-plugin-<?php echo $plugin->guid; ?>" class="elgg-state-draggable elgg-plugin <?php echo $active_class ?>"> +<div class="elgg-state-draggable elgg-plugin <?php echo $active_class ?>" id="elgg-plugin-<?php echo $plugin->guid; ?>"> <div class="elgg-image-block"> <div class="elgg-image-alt"> - <div class="elgg-list-metadata"> + <ul class="elgg-list-metadata"> <?php echo "$links"; ?> - </div> + </ul> <div class="clearfloat right mtm"> <?php echo $action_button; ?> </div> @@ -170,7 +170,9 @@ if (elgg_view_exists($settings_view)) { $settings_link = "<a class='plugin_settings small link' href='$link'>[" . elgg_echo('settings') . "]</a>"; } ?> - <h3 class="elgg-head"><?php echo $plugin->manifest->getName() . " $version $settings_link"; ?></h3> + <div class="elgg-head"> + <h3><?php echo $plugin->manifest->getName(). " $version $settings_link"; ?></h3> + </div> <?php if ($plugin->manifest->getApiVersion() < 1.8) { $reqs = $plugin->manifest->getRequires(); @@ -189,10 +191,10 @@ if (elgg_view_exists($settings_view)) { <div class="plugin_description"><?php echo $description; ?></div> <p class="plugin_author"><?php echo $author . ' - ' . $website; ?></p> - <div class="pts"><a class="elgg-toggle" id="elgg-toggler-plugin-manifest-<?php echo $plugin->getID(); ?>"><?php echo elgg_echo("admin:plugins:label:moreinfo"); ?></a></div> + <div class="pts"><a class="elgg-toggler elgg-toggles-elgg-plugin-manifest-<?php echo $plugin->getID(); ?>"><?php echo elgg_echo("admin:plugins:label:moreinfo"); ?></a></div> </div> </div> - <div class="hidden manifest_file" id="elgg-togglee-plugin-manifest-<?php echo $plugin->getID(); ?>"> + <div class="hidden manifest_file" id="elgg-plugin-manifest-<?php echo $plugin->getID(); ?>"> <?php if ($screenshots_html) { diff --git a/views/default/admin/components/plugin_dependencies.php b/views/default/object/plugin/elements/dependencies.php index ea2b3a188..ea2b3a188 100644 --- a/views/default/admin/components/plugin_dependencies.php +++ b/views/default/object/plugin/elements/dependencies.php diff --git a/views/default/admin/components/invalid_plugin.php b/views/default/object/plugin/invalid.php index 97c1bacf4..7fd5d6f5e 100644 --- a/views/default/admin/components/invalid_plugin.php +++ b/views/default/object/plugin/invalid.php @@ -10,7 +10,8 @@ * @subpackage Plugins */ -$plugin = elgg_extract('plugin', $vars); +$plugin = $vars['entity']; + $id = $plugin->getID(); $path = htmlspecialchars($plugin->getPath()); $message = elgg_echo('admin:plugins:warning:invalid', array($id)); diff --git a/views/default/object/plugin/simple.php b/views/default/object/plugin/simple.php new file mode 100644 index 000000000..49ef58313 --- /dev/null +++ b/views/default/object/plugin/simple.php @@ -0,0 +1,63 @@ +<?php +$plugin = $vars['entity']; + +$plugin_guid = $plugin->guid; +$plugin_id = $plugin->getID(); +$active = $plugin->isActive(); +$can_activate = $plugin->canActivate(); +$name = $plugin->manifest->getName(); +$author = $plugin->manifest->getAuthor(); +$version = $plugin->manifest->getVersion(); +$website = $plugin->manifest->getWebsite(); +$description = $plugin->manifest->getDescription(); + +if ($active) { + $active_class = 'elgg-state-active'; + $checked = 'checked="checked"'; +} else { + $active_class = 'elgg-state-inactive'; + $checked = ''; +} + +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)); + +$plugin_footer = '<ul class="elgg-menu elgg-menu-footer">'; + +if ($author) { + $plugin_footer .= '<li>' . elgg_echo('admin:plugins:author', array($author)) . '</li>'; +} + +if ($version) { + $plugin_footer .= '<li>' . elgg_echo('admin:plugins:version', array($version)) . '</li>'; +} + +if ($website) { + $plugin_footer .= "<li><a href=\"$website\">" . elgg_echo('admin:plugins:plugin_website') . '</a></li>'; +} + +if (elgg_view_exists("settings/$plugin_id/edit")) { + $settings_href = elgg_get_site_url() . "pg/admin/plugin_settings/$plugin_id"; + $plugin_footer .= "<li><a class='plugin_settings link' href='$settings_href'>" . elgg_echo('settings') . "</a></li>"; +} + +$plugin_footer .= "</ul>"; + +echo <<<___END + <div class="elgg-plugin $active_class elgg-grid"> + <div class="elgg-col elgg-col-1of5"> + <input type="checkbox" id="$plugin_guid" $checked $disabled name="active_plugin_guids[]" value="$plugin_guid"/> + <label for="$plugin_guid">$name</label> + </div> + <div class="elgg-col elgg-col-4of5"> + $description + $plugin_footer + </div> + </div> +___END; |