diff options
31 files changed, 102 insertions, 167 deletions
diff --git a/engine/lib/notification.php b/engine/lib/notification.php index 5a96b9623..5b53a4a10 100644 --- a/engine/lib/notification.php +++ b/engine/lib/notification.php @@ -360,7 +360,7 @@ function notification_init() { register_notification_handler("email", "email_notify_handler"); // Add settings view to user settings & register action - extend_elgg_settings_page('usersettings/notifications', 'usersettings/user'); + elgg_extend_view('forms/account/settings', 'core/settings/account/notifications'); elgg_register_plugin_hook_handler('usersettings:save', 'user', 'notification_user_settings_save'); } diff --git a/engine/lib/statistics.php b/engine/lib/statistics.php index 085584317..578985fd0 100644 --- a/engine/lib/statistics.php +++ b/engine/lib/statistics.php @@ -110,8 +110,8 @@ function get_online_users() { * @return void */ function statistics_init() { - extend_elgg_settings_page('usersettings/statistics_opt/online', 'usersettings/statistics'); - extend_elgg_settings_page('usersettings/statistics_opt/numentities', 'usersettings/statistics'); + elgg_extend_view('core/settings/statistics', 'core/settings/statistics/online'); + elgg_extend_view('core/settings/statistics', 'core/settings/statistics/numentities'); } /// Register init function diff --git a/engine/lib/users.php b/engine/lib/users.php index 076f7b9f7..4e34586a3 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -1544,25 +1544,12 @@ function users_init() { elgg_register_widget_type('friends', elgg_echo("friends"), elgg_echo('friends:widget:description')); - // User name change - extend_elgg_settings_page('user/settings/name', 'usersettings/user', 1); - //elgg_register_action("user/name"); - - // User password change - extend_elgg_settings_page('user/settings/password', 'usersettings/user', 1); - //elgg_register_action("user/password"); - - // Add email settings - extend_elgg_settings_page('user/settings/email', 'usersettings/user', 1); - //elgg_register_action("email/save"); - - // Add language settings - extend_elgg_settings_page('user/settings/language', 'usersettings/user', 1); - - // Add default access settings - extend_elgg_settings_page('user/settings/default_access', 'usersettings/user', 1); - - //elgg_register_action("user/language"); + // extend the account settings form + elgg_extend_view('forms/account/settings', 'core/settings/account/name', 100); + elgg_extend_view('forms/account/settings', 'core/settings/account/password', 100); + elgg_extend_view('forms/account/settings', 'core/settings/account/email', 100); + elgg_extend_view('forms/account/settings', 'core/settings/account/language', 100); + elgg_extend_view('forms/account/settings', 'core/settings/account/default_access', 100); // Register the user type register_entity_type('user', ''); diff --git a/engine/lib/usersettings.php b/engine/lib/usersettings.php index 1696dd1cd..7192ea0fa 100644 --- a/engine/lib/usersettings.php +++ b/engine/lib/usersettings.php @@ -26,9 +26,12 @@ * @param int $priority Optional priority to govern the appearance in the list. * * @return bool + * @deprecated 1.8 Extend oone of the views in core/settings */ function extend_elgg_settings_page($new_settings_view, $view = 'usersettings/main', $priority = 500) { + // see views: /core/settings + elgg_deprecated_notice("extend_elgg_settings_page has been deprecated. Extend on of the settings views instead", 1.8); return elgg_extend_view($view, $new_settings_view, $priority); } @@ -66,24 +69,28 @@ function usersettings_pagesetup() { function usersettings_page_handler($page) { global $CONFIG; - $path = $CONFIG->path . "pages/settings/index.php"; + if (!isset($page[0])) { + $page[0] = 'user'; + } - if ($page[0]) { - switch ($page[0]) { - case 'user': - $path = $CONFIG->path . "pages/settings/user.php"; - break; - case 'statistics': - $path = $CONFIG->path . "pages/settings/statistics.php"; - break; - case 'plugins': - $path = $CONFIG->path . "pages/settings/plugins.php"; - break; - } + switch ($page[0]) { + case 'statistics': + $path = $CONFIG->path . "pages/settings/statistics.php"; + break; + case 'plugins': + $path = $CONFIG->path . "pages/settings/tools.php"; + break; + case 'user': + default: + $path = $CONFIG->path . "pages/settings/account.php"; + break; } if ($page[1]) { - set_input('username', $page[1]); + $user = get_user_by_username($page[1]); + elgg_set_page_owner_guid($user->guid); + } else { + elgg_set_page_owner_guid(get_loggedin_userid()); } require($path); diff --git a/mod/notifications/start.php b/mod/notifications/start.php index 15b079bda..57099dc4c 100644 --- a/mod/notifications/start.php +++ b/mod/notifications/start.php @@ -18,7 +18,7 @@ function notifications_plugin_init() { // Unset the default notification settings elgg_unregister_plugin_hook_handler('usersettings:save', 'user', 'notification_user-settings_save'); - elgg_unextend_view('usersettings/user', 'usersettings/notifications'); + elgg_unextend_view('core/settings/account', 'core/settings/account/notifications'); // update notifications based on relationships changing elgg_register_event_handler('delete', 'member', 'notifications_relationship_remove'); diff --git a/pages/settings/account.php b/pages/settings/account.php new file mode 100644 index 000000000..88e916658 --- /dev/null +++ b/pages/settings/account.php @@ -0,0 +1,27 @@ +<?php +/** + * Elgg user account settings. + * + * @package Elgg + * @subpackage Core + */ + +// Only logged in users +gatekeeper(); + +// Make sure we don't open a security hole ... +if ((!elgg_get_page_owner()) || (!elgg_get_page_owner()->canEdit())) { + set_page_owner(get_loggedin_userid()); +} + +$title = elgg_echo('usersettings:user'); + +$content .= elgg_view('core/settings/account'); + +$params = array( + 'content' => $content, + 'title' => $title, +); +$body = elgg_view_layout('one_sidebar', $params); + +echo elgg_view_page($title, $body); diff --git a/pages/settings/index.php b/pages/settings/index.php deleted file mode 100644 index dbc8c87da..000000000 --- a/pages/settings/index.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php -/** - * Elgg user settings system index - * - * @package Elgg - * @subpackage Core - */ - -if (!elgg_get_page_owner_guid()) { - set_page_owner(get_loggedin_userid()); -} - -// Make sure we don't open a security hole ... -if ((!elgg_get_page_owner()) || (!elgg_get_page_owner()->canEdit())) { - set_page_owner(get_loggedin_userid()); -} - -// Forward to the user settings -forward('pg/settings/user/' . elgg_get_page_owner()->username . "/");
\ No newline at end of file diff --git a/pages/settings/statistics.php b/pages/settings/statistics.php index 741003308..165c31e8e 100644 --- a/pages/settings/statistics.php +++ b/pages/settings/statistics.php @@ -6,7 +6,7 @@ * @subpackage Core */ -// Make sure only valid admin users can see this +// Only logged in users gatekeeper(); // Make sure we don't open a security hole ... @@ -14,9 +14,14 @@ if ((!elgg_get_page_owner()) || (!elgg_get_page_owner()->canEdit())) { set_page_owner(get_loggedin_userid()); } -$content = elgg_view_title(elgg_echo("usersettings:statistics")); -$content .= elgg_view("usersettings/statistics"); +$title = elgg_echo("usersettings:statistics"); -$body = elgg_view_layout('one_column_with_sidebar', array('content' => $content)); +$content = elgg_view("core/settings/statistics"); -echo elgg_view_page(elgg_echo("usersettings:statistics"), $body); +$params = array( + 'content' => $content, + 'title' => $title, +); +$body = elgg_view_layout('one_sidebar', array('content' => $content)); + +echo elgg_view_page($title, $body); diff --git a/pages/settings/plugins.php b/pages/settings/tools.php index 657519d38..e1c247581 100644 --- a/pages/settings/plugins.php +++ b/pages/settings/tools.php @@ -1,6 +1,6 @@ <?php /** - * Elgg user plugin settings. + * Elgg user tools settings * * @package Elgg * @subpackage Core @@ -14,10 +14,15 @@ if ((!elgg_get_page_owner()) || (!elgg_get_page_owner()->canEdit())) { set_page_owner(get_loggedin_userid()); } -$content = elgg_view_title(elgg_echo("usersettings:plugins")); -$content .= elgg_view("usersettings/plugins", +$title = elgg_echo("usersettings:plugins"); + +$content = elgg_view("core/settings/tools", array('installed_plugins' => get_installed_plugins())); -$body = elgg_view_layout('one_column_with_sidebar', array('content' => $content)); +$params = array( + 'content' => $content, + 'title' => $title, +); +$body = elgg_view_layout('one_sidebar', $params); -echo elgg_view_page(elgg_echo("usersettings:plugins"), $body); +echo elgg_view_page($title, $body); diff --git a/pages/settings/user.php b/pages/settings/user.php deleted file mode 100644 index 2a530548c..000000000 --- a/pages/settings/user.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php -/** - * Elgg user account settings. - * - * @package Elgg - * @subpackage Core - */ - -// Make sure only valid admin users can see this -gatekeeper(); - -// Make sure we don't open a security hole ... -if ((!elgg_get_page_owner()) || (!elgg_get_page_owner()->canEdit())) { - set_page_owner(get_loggedin_userid()); -} - -$content = elgg_view_title(elgg_echo('usersettings:user')); -$content .= elgg_view("usersettings/form"); - -$body = elgg_view_layout("one_column_with_sidebar", array('content' => $content)); - -echo elgg_view_page(elgg_echo("usersettings:user"), $body); diff --git a/views/default/core/settings/account.php b/views/default/core/settings/account.php new file mode 100644 index 000000000..86afb8ba1 --- /dev/null +++ b/views/default/core/settings/account.php @@ -0,0 +1,15 @@ +<?php +/** + * Account settings form wrapper + * + * @package Elgg + * @subpackage Core + */ + +$form_body = elgg_view("forms/account/settings"); +$form_body .= '<div class="divider"></div>'; +$form_body .= '<p>'; +$form_body .= elgg_view('input/submit', array('value' => elgg_echo('save'))); +$form_body .= '</p>'; + +echo elgg_view('input/form', array('action' => "action/usersettings/save", 'body' => $form_body)); diff --git a/views/default/user/settings/default_access.php b/views/default/core/settings/account/default_access.php index e7c280198..e7c280198 100644 --- a/views/default/user/settings/default_access.php +++ b/views/default/core/settings/account/default_access.php diff --git a/views/default/user/settings/email.php b/views/default/core/settings/account/email.php index 396f8e79b..396f8e79b 100644 --- a/views/default/user/settings/email.php +++ b/views/default/core/settings/account/email.php diff --git a/views/default/user/settings/language.php b/views/default/core/settings/account/language.php index ada133791..ada133791 100644 --- a/views/default/user/settings/language.php +++ b/views/default/core/settings/account/language.php diff --git a/views/default/user/settings/name.php b/views/default/core/settings/account/name.php index fad6c488f..fad6c488f 100644 --- a/views/default/user/settings/name.php +++ b/views/default/core/settings/account/name.php diff --git a/views/default/usersettings/notifications.php b/views/default/core/settings/account/notifications.php index afb142ebe..afb142ebe 100644 --- a/views/default/usersettings/notifications.php +++ b/views/default/core/settings/account/notifications.php diff --git a/views/default/user/settings/password.php b/views/default/core/settings/account/password.php index 0bd7f38f8..0bd7f38f8 100644 --- a/views/default/user/settings/password.php +++ b/views/default/core/settings/account/password.php diff --git a/views/default/core/settings/statistics.php b/views/default/core/settings/statistics.php new file mode 100644 index 000000000..1d7a5b052 --- /dev/null +++ b/views/default/core/settings/statistics.php @@ -0,0 +1,6 @@ +<?php +/** + * User statitsics + * + * Blank view that can be extended + */ diff --git a/views/default/usersettings/statistics_opt/numentities.php b/views/default/core/settings/statistics/numentities.php index 10d2b7c68..10d2b7c68 100644 --- a/views/default/usersettings/statistics_opt/numentities.php +++ b/views/default/core/settings/statistics/numentities.php diff --git a/views/default/usersettings/statistics_opt/online.php b/views/default/core/settings/statistics/online.php index dc24130cd..dc24130cd 100644 --- a/views/default/usersettings/statistics_opt/online.php +++ b/views/default/core/settings/statistics/online.php diff --git a/views/default/usersettings/plugins.php b/views/default/core/settings/tools.php index c4df9e26b..8f5ee4af6 100644 --- a/views/default/usersettings/plugins.php +++ b/views/default/core/settings/tools.php @@ -20,6 +20,6 @@ $count = count($installed_plugins); $n = 0; foreach ($installed_plugins as $plugin => $data) { if (is_plugin_enabled($plugin)) { - echo elgg_view("usersettings/plugins_opt/plugin", array('plugin' => $plugin, 'details' => $data)); + echo elgg_view("core/settings/tools/plugin", array('plugin' => $plugin, 'details' => $data)); } }
\ No newline at end of file diff --git a/views/default/usersettings/plugins_opt/plugin.php b/views/default/core/settings/tools/plugin.php index 981d8d937..981d8d937 100644 --- a/views/default/usersettings/plugins_opt/plugin.php +++ b/views/default/core/settings/tools/plugin.php diff --git a/views/default/forms/account/settings.php b/views/default/forms/account/settings.php new file mode 100644 index 000000000..b3d9bbc7f --- /dev/null +++ b/views/default/forms/account/settings.php @@ -0,0 +1 @@ +<?php diff --git a/views/default/page/elements/topbar.php b/views/default/page/elements/topbar.php index 2f4436d6c..134cfec55 100644 --- a/views/default/page/elements/topbar.php +++ b/views/default/page/elements/topbar.php @@ -53,7 +53,7 @@ echo elgg_view('elgg_topbar/extend', $vars); // user settings echo elgg_view('output/url', array( - 'href' => elgg_get_site_url() . 'pg/settings/', + 'href' => elgg_get_site_url() . "pg/settings/user/{$user->username}", 'text' => '<span class="elgg-icon elgg-icon-settings"></span>' . elgg_echo('settings'), 'class' => 'alt', )); diff --git a/views/default/usersettings/form.php b/views/default/usersettings/form.php deleted file mode 100644 index 2e3526aa3..000000000 --- a/views/default/usersettings/form.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * @package Elgg - * @subpackage Core - */ - -$form_body = elgg_view("usersettings/user"); -$form_body .= "<div class='divider'></div>".elgg_view('input/submit', array('value' => elgg_echo('save'), 'class' => 'submit-button usersettings_save')); - -echo elgg_view('input/form', array('action' => "action/usersettings/save", 'body' => $form_body));
\ No newline at end of file diff --git a/views/default/usersettings/main.php b/views/default/usersettings/main.php deleted file mode 100644 index d1cf85448..000000000 --- a/views/default/usersettings/main.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php -/** - * Elgg user main settings page. - * Functions for adding and manipulating options on the user settings panel. - * - * @package Elgg - * @subpackage Core - */ - -// Description of what's going on -echo elgg_view('output/longtext', array('value' => elgg_echo("usersettings:description"))); diff --git a/views/default/usersettings/main_opt/plugins.php b/views/default/usersettings/main_opt/plugins.php deleted file mode 100644 index ab5743d36..000000000 --- a/views/default/usersettings/main_opt/plugins.php +++ /dev/null @@ -1,15 +0,0 @@ -<?php -/** - * Elgg plugin sub-component on the main menu. - * - * @package Elgg - * @subpackage Core - */ - -global $CONFIG; -?> -<div class="menu_admin_option"> - <h2><?php echo elgg_echo('usersettings:plugins'); ?> </h2> - <p><?php echo elgg_echo('usersettings:plugins:opt:description'); ?><br /> - <a href="<?php echo elgg_get_site_url() . "pg/settings/plugins/"; ?>"><?php echo elgg_echo('usersettings:plugins:opt:linktext'); ?></a></p> -</div>
\ No newline at end of file diff --git a/views/default/usersettings/main_opt/statistics.php b/views/default/usersettings/main_opt/statistics.php deleted file mode 100644 index 0f3872143..000000000 --- a/views/default/usersettings/main_opt/statistics.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php -/** - * Elgg satistics sub-component on the main menu. - * - * @package Elgg - * @subpackage Core - */ -?> -<div class="menu_admin_option"> - <h2><?php echo elgg_echo('usersettings:statistics'); ?> </h2> - <p><?php echo elgg_echo('usersettings:statistics:opt:description'); ?><br /> - <a href="<?php echo elgg_get_site_url() . "pg/settings/statistics/"; ?>"><?php echo elgg_echo('usersettings:statistics:opt:linktext'); ?></a></p> -</div> diff --git a/views/default/usersettings/main_opt/user.php b/views/default/usersettings/main_opt/user.php deleted file mode 100644 index d9f2b5677..000000000 --- a/views/default/usersettings/main_opt/user.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php -/** - * Elgg user sub-component on the main menu. - * - * @package Elgg - * @subpackage Core - */ -?> -<div class="menu_admin_option"> - <h2><?php echo elgg_echo('usersettings:user'); ?> </h2> - <p><?php echo elgg_echo('usersettings:user:opt:description'); ?><br /> - <a href="<?php echo elgg_get_site_url() . "pg/settings/user/"; ?>"><?php echo elgg_echo('usersettings:user:opt:linktext'); ?></a></p> -</div>
\ No newline at end of file diff --git a/views/default/usersettings/statistics.php b/views/default/usersettings/statistics.php deleted file mode 100644 index c90d14c6d..000000000 --- a/views/default/usersettings/statistics.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php -/** - * Elgg settings specific user settings. - * - * @package Elgg - * @subpackage Core - */ - -?>
\ No newline at end of file diff --git a/views/default/usersettings/user.php b/views/default/usersettings/user.php deleted file mode 100644 index c6a56a14e..000000000 --- a/views/default/usersettings/user.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php -/** - * @package Elgg - * @subpackage Core - */ -?>
\ No newline at end of file |