diff options
Diffstat (limited to 'views/default')
-rw-r--r-- | views/default/admin/components/plugin_settings.php | 35 | ||||
-rw-r--r-- | views/default/core/settings/tools.php | 6 | ||||
-rw-r--r-- | views/default/core/settings/tools/plugin.php | 14 | ||||
-rw-r--r-- | views/default/object/plugin.php | 27 |
4 files changed, 51 insertions, 31 deletions
diff --git a/views/default/admin/components/plugin_settings.php b/views/default/admin/components/plugin_settings.php index d5e25b4c1..8179728ed 100644 --- a/views/default/admin/components/plugin_settings.php +++ b/views/default/admin/components/plugin_settings.php @@ -2,30 +2,33 @@ /** * Elgg plugin settings * - * @package Elgg - * @subpackage Core + * @uses ElggPlugin $vars['plugin'] The plugin object to display settings for. + * + * @package Elgg.Core + * @subpackage Plugins.Settings */ $plugin = $vars['plugin']; -$plugin_info = load_plugin_manifest($plugin); - -$form_body = elgg_view("settings/{$plugin}/edit", $vars); -$form_body .= elgg_view('input/hidden', array('internalname' => 'plugin', 'value' => $plugin)); -$form_body .= elgg_view('input/submit', array('value' => elgg_echo('save'))); -//$form_body .= elgg_view('input/reset', array('value' => elgg_echo('reset'))); +$plugin_id = $plugin->getID(); +if (elgg_view("settings/$plugin_id/edit")) { ?> -<div class="elgg-module elgg-module-inline"> + +<div class="elgg-module elgg-module-info"> <div class="elgg-head"> - <h3><?php echo $plugin_info['name']; ?></h3> + <h3><?php echo $plugin->manifest->getName(); ?></h3> </div> <div class="elgg-body"> - <?php - echo elgg_view('input/form', array( - 'body' => $form_body, - 'internalid' => 'plugin_settings', - 'action' => "action/plugins/settings/save", + <div id="<?php echo $plugin_id; ?>_settings"> + <?php echo elgg_view("object/plugin", array( + 'plugin' => $plugin, + // in for backward compatibility + 'entity' => $plugin, + 'type' => 'admin' )); - ?> + ?> + </div> </div> </div> +<?php +}
\ No newline at end of file diff --git a/views/default/core/settings/tools.php b/views/default/core/settings/tools.php index e280e0d8e..73af8d738 100644 --- a/views/default/core/settings/tools.php +++ b/views/default/core/settings/tools.php @@ -2,8 +2,10 @@ /** * Elgg plugin specific user settings. * - * @package Elgg - * @subpackage Core + * @uses array $vars['installed_plugins'] An array of plugins as returned by elgg_get_plugins() + * + * @package Elgg.Core + * @subpackage Plugins.Settings */ // Description of what's going on diff --git a/views/default/core/settings/tools/plugin.php b/views/default/core/settings/tools/plugin.php index ab25e7fb8..89e08bb64 100644 --- a/views/default/core/settings/tools/plugin.php +++ b/views/default/core/settings/tools/plugin.php @@ -2,30 +2,34 @@ /** * This displays a plugin's user settings. * - * @package Elgg.Plugin - * @subpackage 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 = $details['user_guid']; +$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; ?>_settings"> + <div id="<?php echo $plugin_id; ?>_settings"> <?php echo elgg_view("object/plugin", array( 'plugin' => $plugin, 'entity' => find_plugin_usersettings($plugin_id, $user_guid), - 'prefix' => 'user' + 'type' => 'user' )); ?> </div> diff --git a/views/default/object/plugin.php b/views/default/object/plugin.php index 054931a38..b3bb6eb93 100644 --- a/views/default/object/plugin.php +++ b/views/default/object/plugin.php @@ -1,21 +1,32 @@ <?php /** - * Elgg plugin + * Used to show plugin user settings. * - * @package Elgg - * @subpackage Core + * @package Elgg.Core + * @subpackage Plugins */ -$entity = $vars['entity']; $plugin = $vars['plugin']; $plugin_id = $plugin->getID(); -$prefix = $vars['prefix']; // Do we want to show admin settings (default) or user settings +$user_guid = elgg_get_array_value('user_guid', $vars, elgg_get_logged_in_user_guid()); -$form_body = elgg_view("{$prefix}settings/{$plugin_id}/edit", $vars) - . "<p>" . elgg_view('input/hidden', array('internalname' => 'plugin', 'value' => $plugin_id)) +// Do we want to show admin settings or user settings +$type = elgg_get_array_value('type', $vars, ''); + +if ($type == 'user') { + $view = "{$type}settings/{$plugin_id}/edit"; + $action = "action/plugins/usersettings/save"; +} else { + $view = "settings/{$plugin_id}/edit"; + $action = "action/plugins/settings/save"; +} + +$form_body = elgg_view($view, $vars) + . "<p>" . elgg_view('input/hidden', array('internalname' => 'plugin_id', 'value' => $plugin_id)) + . elgg_view('input/hidden', array('internalname' => 'user_guid', 'value' => $user_guid)) . elgg_view('input/submit', array('value' => elgg_echo('save'))) . "</p>"; ?> <div> - <?php echo elgg_view('input/form', array('body' => $form_body, 'action' => "action/plugins/{$prefix}settings/save")); ?> + <?php echo elgg_view('input/form', array('body' => $form_body, 'action' => $action)); ?> </div>
\ No newline at end of file |