From 782fd909b042740f736b8c668f74d47a43f703f3 Mon Sep 17 00:00:00 2001 From: ewinslow Date: Tue, 15 Feb 2011 00:42:44 +0000 Subject: Replaced all occurrences of register_page_handler in core with elgg_register_page_handler git-svn-id: http://code.elgg.org/elgg/trunk@8244 36083f99-b078-4883-b0ff-0f9b5a30f544 --- documentation/stubs/config.php | 2 +- engine/handlers/page_handler.php | 4 +- engine/lib/admin.php | 4 +- engine/lib/cron.php | 2 +- engine/lib/elgglib.php | 4 +- engine/lib/entities.php | 2 +- engine/lib/input.php | 2 +- engine/lib/pagehandler.php | 2 +- engine/lib/river.php | 2 +- engine/lib/tags.php | 14 ++++-- engine/lib/user_settings.php | 2 +- engine/lib/users.php | 22 ++++----- js/lib/friends_picker.js | 91 +++++++++++++++++++++++++++++++++++++ mod/blog/start.php | 2 +- mod/bookmarks/start.php | 2 +- mod/categories/start.php | 2 +- mod/developers/start.php | 2 +- mod/diagnostics/start.php | 2 +- mod/embed/start.php | 2 +- mod/externalpages/start.php | 2 +- mod/file/start.php | 2 +- mod/groups/start.php | 6 +-- mod/invitefriends/start.php | 2 +- mod/messageboard/start.php | 2 +- mod/messages/start.php | 2 +- mod/notifications/start.php | 2 +- mod/pages/start.php | 2 +- mod/profile/start.php | 2 +- mod/reportedcontent/start.php | 2 +- mod/search/start.php | 2 +- mod/thewire/start.php | 2 +- mod/twitterservice/start.php | 2 +- mod/uservalidationbyemail/start.php | 2 +- 33 files changed, 146 insertions(+), 51 deletions(-) create mode 100644 js/lib/friends_picker.js diff --git a/documentation/stubs/config.php b/documentation/stubs/config.php index 86ba54e6d..19e76c8ae 100644 --- a/documentation/stubs/config.php +++ b/documentation/stubs/config.php @@ -106,7 +106,7 @@ $CONFIG->registered_tag_metadata_names; /** * An associative array of page handlers and their function names. * - * Page handlers must be registered by {@link register_page_handler()} and + * Page handlers must be registered by {@link elgg_register_page_handler()} and * will be dispatched by {@link engine/handlers/pagehandler.php} to the * proper function. * diff --git a/engine/handlers/page_handler.php b/engine/handlers/page_handler.php index 69dbea79a..c71e820b2 100644 --- a/engine/handlers/page_handler.php +++ b/engine/handlers/page_handler.php @@ -4,11 +4,11 @@ * * This file dispatches pages. It is called via a URL rewrite in .htaccess * from http://site/pg/handler/page1/page2. The first element after 'pg/' is - * the page handler name as registered by {@link register_page_handler()}. + * the page handler name as registered by {@link elgg_register_page_handler()}. * The rest of the string is sent to {@link page_handler()}. * * {@link page_handler()} explodes the pages string by / and sends it to - * the page handler function as registered by {@link register_page_handler()}. + * the page handler function as registered by {@link elgg_register_page_handler()}. * If a valid page handler isn't found, plugins have a chance to provide a 404. * * @package Elgg.Core diff --git a/engine/lib/admin.php b/engine/lib/admin.php index 2384a9278..6d0b60101 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -221,8 +221,8 @@ function admin_init() { ); } - register_page_handler('admin', 'admin_settings_page_handler'); - register_page_handler('admin_plugin_screenshot', 'admin_plugin_screenshot_page_handler'); + elgg_register_page_handler('admin', 'admin_settings_page_handler'); + elgg_register_page_handler('admin_plugin_screenshot', 'admin_plugin_screenshot_page_handler'); } /** diff --git a/engine/lib/cron.php b/engine/lib/cron.php index f216e0b2d..ef0cf17b2 100644 --- a/engine/lib/cron.php +++ b/engine/lib/cron.php @@ -13,7 +13,7 @@ */ function cron_init() { // Register a pagehandler for cron - register_page_handler('cron', 'cron_page_handler'); + elgg_register_page_handler('cron', 'cron_page_handler'); // register a hook for Walled Garden public pages elgg_register_plugin_hook_handler('public_pages', 'walled_garden', 'cron_public_pages'); diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 95330844d..fbd33b219 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -1834,8 +1834,8 @@ function elgg_init() { elgg_register_action('likes/add'); elgg_register_action('likes/delete'); - register_page_handler('js', 'js_page_handler'); - register_page_handler('css', 'css_page_handler'); + elgg_register_page_handler('js', 'js_page_handler'); + elgg_register_page_handler('css', 'css_page_handler'); // Trigger the shutdown:system event upon PHP shutdown. register_shutdown_function('_elgg_shutdown_hook'); diff --git a/engine/lib/entities.php b/engine/lib/entities.php index db0e0fddd..81c14da4d 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -2202,7 +2202,7 @@ function entities_test($hook, $type, $value, $params) { * @elgg_event_handler init system */ function entities_init() { - register_page_handler('view', 'entities_page_handler'); + elgg_register_page_handler('view', 'entities_page_handler'); elgg_register_plugin_hook_handler('unit_test', 'system', 'entities_test'); diff --git a/engine/lib/input.php b/engine/lib/input.php index db43f9a24..0d34db8ae 100644 --- a/engine/lib/input.php +++ b/engine/lib/input.php @@ -353,7 +353,7 @@ function input_livesearch_page_handler($page) { */ function input_init() { // register an endpoint for live search / autocomplete. - register_page_handler('livesearch', 'input_livesearch_page_handler'); + elgg_register_page_handler('livesearch', 'input_livesearch_page_handler'); if (ini_get_bool('magic_quotes_gpc')) { diff --git a/engine/lib/pagehandler.php b/engine/lib/pagehandler.php index 937b962db..1fa073c1e 100644 --- a/engine/lib/pagehandler.php +++ b/engine/lib/pagehandler.php @@ -88,7 +88,7 @@ function elgg_register_page_handler($handler, $function) { /** * Unregister a page handler for an identifier * - * Note: to replace a page handler, call register_page_handler() + * Note: to replace a page handler, call elgg_register_page_handler() * * @param string $handler The page type identifier * diff --git a/engine/lib/river.php b/engine/lib/river.php index 2c8925393..43a1c38d5 100644 --- a/engine/lib/river.php +++ b/engine/lib/river.php @@ -531,7 +531,7 @@ function elgg_river_page_handler($page) { * Initialize river library */ function elgg_river_init() { - register_page_handler('activity', 'elgg_river_page_handler'); + elgg_register_page_handler('activity', 'elgg_river_page_handler'); $item = new ElggMenuItem('activity', elgg_echo('activity'), 'pg/activity'); elgg_register_menu_item('site', $item); } diff --git a/engine/lib/tags.php b/engine/lib/tags.php index c952a8bab..32d48eff2 100644 --- a/engine/lib/tags.php +++ b/engine/lib/tags.php @@ -314,11 +314,6 @@ function elgg_get_registered_tag_metadata_names() { return $names; } -// register the standard tags metadata name -elgg_register_tag_metadata_name('tags'); - -register_page_handler('tags', 'elgg_tagcloud_page_handler'); - /** * Page hander for tags * @@ -343,3 +338,12 @@ function elgg_tagcloud_page_handler($page) { break; } } + +function elgg_tags_init() { + // register the standard tags metadata name + elgg_register_tag_metadata_name('tags'); + + elgg_register_page_handler('tags', 'elgg_tagcloud_page_handler'); +} + +elgg_register_event_handler('init', 'system', 'elgg_tags_init'); \ No newline at end of file diff --git a/engine/lib/user_settings.php b/engine/lib/user_settings.php index e3688d7f7..0247dc5d9 100644 --- a/engine/lib/user_settings.php +++ b/engine/lib/user_settings.php @@ -315,7 +315,7 @@ function usersettings_page_handler($page) { * @return void */ function usersettings_init() { - register_page_handler('settings', 'usersettings_page_handler'); + elgg_register_page_handler('settings', 'usersettings_page_handler'); elgg_register_plugin_hook_handler('usersettings:save', 'user', 'users_settings_save'); diff --git a/engine/lib/users.php b/engine/lib/users.php index 8d8c7fb64..ce325f21e 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -1486,17 +1486,17 @@ function users_pagesetup() { function users_init() { global $CONFIG; - register_page_handler('friends', 'friends_page_handler'); - register_page_handler('friendsof', 'friends_of_page_handler'); - register_page_handler('dashboard', 'dashboard_page_handler'); - register_page_handler('register', 'registration_page_handler'); - register_page_handler('resetpassword', 'elgg_user_resetpassword_page_handler'); - register_page_handler('login', 'elgg_user_login_page_handler'); - register_page_handler('members', 'elgg_members_page_handler'); - register_page_handler('avatar', 'elgg_avatar_page_handler'); - register_page_handler('profile', 'elgg_profile_page_handler'); - - //register_page_handler('collections', 'collections_page_handler'); + elgg_register_page_handler('friends', 'friends_page_handler'); + elgg_register_page_handler('friendsof', 'friends_of_page_handler'); + elgg_register_page_handler('dashboard', 'dashboard_page_handler'); + elgg_register_page_handler('register', 'registration_page_handler'); + elgg_register_page_handler('resetpassword', 'elgg_user_resetpassword_page_handler'); + elgg_register_page_handler('login', 'elgg_user_login_page_handler'); + elgg_register_page_handler('members', 'elgg_members_page_handler'); + elgg_register_page_handler('avatar', 'elgg_avatar_page_handler'); + elgg_register_page_handler('profile', 'elgg_profile_page_handler'); + + //elgg_register_page_handler('collections', 'collections_page_handler'); $item = new ElggMenuItem('members', elgg_echo('members'), 'pg/members'); elgg_register_menu_item('site', $item); diff --git a/js/lib/friends_picker.js b/js/lib/friends_picker.js new file mode 100644 index 000000000..9257c40fc --- /dev/null +++ b/js/lib/friends_picker.js @@ -0,0 +1,91 @@ +/* + elgg friendsPicker plugin + adapted from Niall Doherty's excellent Coda-Slider - http://www.ndoherty.com/coda-slider + */ + + +jQuery.fn.friendsPicker = function(iterator) { + + var settings; + settings = $.extend({ easeFunc: "easeOutExpo", easeTime: 1000, toolTip: false }, settings); + + return this.each(function() { + + var container = $(this); + container.addClass("friends-picker"); + // set panelwidth manually as it's hidden initially - adjust this value for different themes/pagewidths + var panelWidth = 730; + + // count the panels in the container + var panelCount = container.find("div.panel").size(); + // calculate the width of all the panels lined up end-to-end + var friendsPicker_containerWidth = panelWidth*panelCount; + // specify width for the friendsPicker_container + container.find("div.friends-picker-container").css("width" , friendsPicker_containerWidth); + + // global variables for container.each function below + var friendsPickerNavigationWidth = 0; + var currentPanel = 1; + + // generate appropriate nav for each container + container.each(function(i) { + // generate Left and Right arrows + $(this).before("
Left<\/div>"); + $(this).after("
Right<\/div>"); + + // generate a-z tabs + $(this).before("