diff options
40 files changed, 476 insertions, 164 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 879fee50c..5232deadc 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,34 @@ +Version 1.8.2 +(December 21, 2011 from https://github.com/Elgg/Elgg/tree/1.8) + + Enhancements: + * Added a 404 page + * Widgets controls now using the menu system + * Admins can edit users' account information + * Embed uploader supports uploading into groups + * Add a control panel widget for easy access to cache flushing and upgrading + * Comments now have a unqiue URL with fragment identifier + * JavaScript language files are cacheable + * jQuery form script only loaded when required + + Bugfixes: + * Fixed default widgets + * Fixed activity filtering + * Embedding an image now inserts a medium sized image + * Search plugin only uses mbstring extension if enabled + * Site pages links returned to footer + * Fixed URL creation for users with non-ASCII characters in username + * The wire username parsing supports periods in usernames + * Returned the posting area to the main wire page + * Fixed layout issue on pages with a fragment identifier in URL + * Added support for call elgg_load_js() in header and footer + * Fixed user picker + * Fixed uservalidationbyemail plugin ignoring the actions of other plugins + * Fixed bug preventing the creation of admin users + * Fixed deleting a widget with JavaScript disabled + * Fixed many bugs in the unit/integration tests + + Version 1.8.1 (November 16, 2011 from https://github.com/Elgg/Elgg/tree/1.8) diff --git a/actions/admin/site/flush_cache.php b/actions/admin/site/flush_cache.php new file mode 100644 index 000000000..b81f5fc83 --- /dev/null +++ b/actions/admin/site/flush_cache.php @@ -0,0 +1,10 @@ +<?php +/** + * Flush all the caches + */ + +elgg_invalidate_simplecache(); +elgg_filepath_cache_reset(); + +system_message(elgg_echo('admin:cache:flushed')); +forward(REFERER);
\ No newline at end of file diff --git a/engine/classes/ElggSite.php b/engine/classes/ElggSite.php index 0d03cbd28..2d6238a19 100644 --- a/engine/classes/ElggSite.php +++ b/engine/classes/ElggSite.php @@ -422,7 +422,9 @@ class ElggSite extends ElggEntity { 'ajax/view/js/languages', 'upgrade\.php', 'css/.*', - 'js/.*' + 'js/.*', + 'cache/css/.*', + 'cache/js/.*', ); // include a hook for plugin authors to include public pages diff --git a/engine/lib/admin.php b/engine/lib/admin.php index 3baf2ff61..a191d740b 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -225,6 +225,7 @@ function admin_init() { elgg_register_action('admin/site/update_basic', '', 'admin'); elgg_register_action('admin/site/update_advanced', '', 'admin'); + elgg_register_action('admin/site/flush_cache', '', 'admin'); elgg_register_action('admin/menu/save', '', 'admin'); @@ -301,7 +302,7 @@ function admin_init() { } // widgets - $widgets = array('online_users', 'new_users', 'content_stats', 'admin_welcome'); + $widgets = array('online_users', 'new_users', 'content_stats', 'admin_welcome', 'control_panel'); foreach ($widgets as $widget) { elgg_register_widget_type( $widget, @@ -616,7 +617,7 @@ function elgg_add_admin_widgets($event, $type, $user) { // In the form column => array of handlers in order, top to bottom $adminWidgets = array( - 1 => array('admin_welcome'), + 1 => array('control_panel', 'admin_welcome'), 2 => array('online_users', 'new_users', 'content_stats'), ); diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php index e40ab2e39..bfd40d1e8 100644 --- a/engine/lib/annotations.php +++ b/engine/lib/annotations.php @@ -529,6 +529,20 @@ function elgg_annotation_exists($entity_guid, $annotation_type, $owner_guid = NU } /** + * Return the URL for a comment + * + * @param ElggAnnotation $comment The comment object + * @return string + * @access private + */ +function elgg_comment_url_handler(ElggAnnotation $comment) { + $entity = $comment->getEntity(); + if ($entity) { + return $entity->getURL() . '#item-annotation-' . $comment->id; + } +} + +/** * Register an annotation url handler. * * @param string $function_name The function. @@ -540,11 +554,6 @@ function elgg_register_annotation_url_handler($extender_name = "all", $function_ return elgg_register_extender_url_handler('annotation', $extender_name, $function_name); } -/** Register the hook */ -elgg_register_plugin_hook_handler("export", "all", "export_annotation_plugin_hook", 2); - -elgg_register_plugin_hook_handler('unit_test', 'system', 'annotations_test'); - /** * Register annotation unit tests * @access private @@ -554,3 +563,16 @@ function annotations_test($hook, $type, $value, $params) { $value[] = $CONFIG->path . 'engine/tests/api/annotations.php'; return $value; } + +/** + * Initialize the annotation library + * @access private + */ +function elgg_annotations_init() { + elgg_register_annotation_url_handler('generic_comment', 'elgg_comment_url_handler'); + + elgg_register_plugin_hook_handler("export", "all", "export_annotation_plugin_hook", 2); + elgg_register_plugin_hook_handler('unit_test', 'system', 'annotations_test'); +} + +elgg_register_event_handler('init', 'system', 'elgg_annotations_init'); diff --git a/engine/lib/languages.php b/engine/lib/languages.php index 7607ea3bf..0400843af 100644 --- a/engine/lib/languages.php +++ b/engine/lib/languages.php @@ -301,4 +301,15 @@ function get_missing_language_keys($language) { return false; } +/** + * Initialize the language library + * @access private + */ +function elgg_languages_init() { + $lang = get_current_language(); + elgg_register_simplecache_view("cache/js/languages/$lang"); +} + +elgg_register_event_handler('init', 'system', 'elgg_languages_init'); + register_translations(dirname(dirname(dirname(__FILE__))) . "/languages/"); diff --git a/engine/lib/navigation.php b/engine/lib/navigation.php index 176790188..956ca220a 100644 --- a/engine/lib/navigation.php +++ b/engine/lib/navigation.php @@ -385,6 +385,55 @@ function elgg_entity_menu_setup($hook, $type, $return, $params) { } /** + * Widget menu is a set of widget controls + * @access private + */ +function elgg_widget_menu_setup($hook, $type, $return, $params) { + + $widget = $params['entity']; + $show_edit = elgg_extract('show_edit', $params, true); + + $collapse = array( + 'name' => 'collapse', + 'text' => ' ', + 'href' => "#elgg-widget-content-$widget->guid", + 'class' => 'elgg-widget-collapse-button', + 'rel' => 'toggle', + 'priority' => 1 + ); + $return[] = ElggMenuItem::factory($collapse); + + if ($widget->canEdit()) { + $delete = array( + 'name' => 'delete', + 'text' => elgg_view_icon('delete-alt'), + 'title' => elgg_echo('widget:delete', array($widget->getTitle())), + 'href' => "action/widgets/delete?widget_guid=$widget->guid", + 'is_action' => true, + 'class' => 'elgg-widget-delete-button', + 'id' => "elgg-widget-delete-button-$widget->guid", + 'priority' => 900 + ); + $return[] = ElggMenuItem::factory($delete); + + if ($show_edit) { + $edit = array( + 'name' => 'settings', + 'text' => elgg_view_icon('settings-alt'), + 'title' => elgg_echo('widget:edit'), + 'href' => "#widget-edit-$widget->guid", + 'class' => "elgg-widget-edit-button", + 'rel' => 'toggle', + 'priority' => 800, + ); + $return[] = ElggMenuItem::factory($edit); + } + } + + return $return; +} + +/** * Adds a delete link to "generic_comment" annotations * @access private */ @@ -418,6 +467,7 @@ function elgg_nav_init() { elgg_register_plugin_hook_handler('prepare', 'menu:site', 'elgg_site_menu_setup'); elgg_register_plugin_hook_handler('register', 'menu:river', 'elgg_river_menu_setup'); elgg_register_plugin_hook_handler('register', 'menu:entity', 'elgg_entity_menu_setup'); + elgg_register_plugin_hook_handler('register', 'menu:widget', 'elgg_widget_menu_setup'); elgg_register_plugin_hook_handler('register', 'menu:annotation', 'elgg_annotation_menu_setup'); } diff --git a/engine/lib/output.php b/engine/lib/output.php index 989eca60e..6554481f5 100644 --- a/engine/lib/output.php +++ b/engine/lib/output.php @@ -234,7 +234,7 @@ function elgg_clean_vars(array $vars = array()) { * * @example * elgg_normalize_url(''); // 'http://my.site.com/' - * elgg_normalize_url('dashboard'); // 'http://my.site.com/dashboard' + * elgg_normalize_url('dashboard'); // 'http://my.site.com/dashboard' * elgg_normalize_url('http://google.com/'); // no change * elgg_normalize_url('//google.com/'); // no change * @@ -257,6 +257,11 @@ function elgg_normalize_url($url) { $validated = filter_var($url, FILTER_VALIDATE_URL); } + // work around for handling absoluate IRIs (RFC 3987) - see #4190 + if (!$validated && (strpos($url, 'http:') === 0) || (strpos($url, 'https:') === 0)) { + $validated = true; + } + if ($validated) { // all normal URLs including mailto: return $url; diff --git a/engine/lib/pagehandler.php b/engine/lib/pagehandler.php index aba921416..ffcfc5b6a 100644 --- a/engine/lib/pagehandler.php +++ b/engine/lib/pagehandler.php @@ -110,3 +110,36 @@ function elgg_unregister_page_handler($handler) { unset($CONFIG->pagehandler[$handler]); } + +/** + * Serve an error page + * + * @todo not sending status codes yet + * + * @param string $hook The name of the hook + * @param string $type The type of the hook + * @param bool $result The current value of the hook + * @param array $params Parameters related to the hook + */ +function elgg_error_page_handler($hook, $type, $result, $params) { + if (elgg_view_exists("errors/$type")) { + $content = elgg_view("errors/$type", $params); + } else { + $content = elgg_view("errors/default", $params); + } + $body = elgg_view_layout('error', array('content' => $content)); + echo elgg_view_page($title, $body, 'error'); + exit; +} + +/** + * Initializes the page handler/routing system + * + * @return void + * @access private + */ +function page_handler_init() { + elgg_register_plugin_hook_handler('forward', '404', 'elgg_error_page_handler'); +} + +elgg_register_event_handler('init', 'system', 'page_handler_init'); diff --git a/engine/lib/user_settings.php b/engine/lib/user_settings.php index c71670357..af30d8f0d 100644 --- a/engine/lib/user_settings.php +++ b/engine/lib/user_settings.php @@ -346,6 +346,13 @@ function usersettings_init() { elgg_register_plugin_hook_handler('usersettings:save', 'user', 'users_settings_save'); elgg_register_action("usersettings/save"); + + // 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); } elgg_register_event_handler('init', 'system', 'usersettings_init'); diff --git a/engine/lib/users.php b/engine/lib/users.php index 3a86c1faa..1b3cca799 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -1021,7 +1021,7 @@ function elgg_get_user_validation_status($user_guid) { return; } - if ($md->value) { + if ($md[0]->value) { return true; } @@ -1562,13 +1562,6 @@ function users_init() { elgg_register_widget_type('friends', elgg_echo('friends'), elgg_echo('friends:widget:description')); - // 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 elgg_register_entity_type('user', ''); diff --git a/engine/lib/views.php b/engine/lib/views.php index d3c9ff551..b938dd60e 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -1598,7 +1598,6 @@ function elgg_views_boot() { elgg_load_js('jquery'); elgg_load_js('jquery-ui'); - elgg_load_js('jquery.form'); elgg_load_js('elgg'); elgg_register_simplecache_view('js/lightbox'); diff --git a/engine/lib/widgets.php b/engine/lib/widgets.php index 5d18a16b0..46f34391a 100644 --- a/engine/lib/widgets.php +++ b/engine/lib/widgets.php @@ -332,14 +332,14 @@ function elgg_default_widgets_init() { * @param string $event The event * @param string $type The type of object * @param object $entity The entity being created - * @return null + * @return void * @access private */ function elgg_create_default_widgets($event, $type, $entity) { $default_widget_info = elgg_get_config('default_widget_info'); if (!$default_widget_info || !$entity) { - return null; + return; } $type = $entity->getType(); @@ -347,53 +347,48 @@ function elgg_create_default_widgets($event, $type, $entity) { // event is already guaranteed by the hook registration. // need to check subtype and type. - foreach ($default_widget_info as $temp) { - if ($temp['entity_type'] == $type) { - if ($temp['entity_subtype'] == ELGG_ENTITIES_ANY_VALUE || $temp['entity_subtype'] == $subtype) { - $info = $temp; - break; + foreach ($default_widget_info as $info) { + if ($info['entity_type'] == $type) { + if ($info['entity_subtype'] == ELGG_ENTITIES_ANY_VALUE || $info['entity_subtype'] == $subtype) { + + // need to be able to access everything + $old_ia = elgg_set_ignore_access(true); + elgg_push_context('create_default_widgets'); + + // pull in by widget context with widget owners as the site + // not using elgg_get_widgets() because it sorts by columns and we don't care right now. + $options = array( + 'type' => 'object', + 'subtype' => 'widget', + 'owner_guid' => elgg_get_site_entity()->guid, + 'private_setting_name' => 'context', + 'private_setting_value' => $info['widget_context'], + 'limit' => 0 + ); + + $widgets = elgg_get_entities_from_private_settings($options); + + foreach ($widgets as $widget) { + // change the container and owner + $new_widget = clone $widget; + $new_widget->container_guid = $entity->guid; + $new_widget->owner_guid = $entity->guid; + + // pull in settings + $settings = get_all_private_settings($widget->guid); + + foreach ($settings as $name => $value) { + $new_widget->$name = $value; + } + + $new_widget->save(); + } + + elgg_set_ignore_access($old_ia); + elgg_pop_context(); } } } - - // need to be able to access everything - $old_ia = elgg_get_ignore_access(true); - elgg_push_context('create_default_widgets'); - - // pull in by widget context with widget owners as the site - // not using elgg_get_widgets() because it sorts by columns and we don't care right now. - $options = array( - 'type' => 'object', - 'subtype' => 'widget', - 'owner_guid' => elgg_get_site_entity()->guid, - 'private_setting_name' => 'context', - 'private_setting_value' => $info['widget_context'], - 'limit' => 0 - ); - - $widgets = elgg_get_entities_from_private_settings($options); - - foreach ($widgets as $widget) { - // change the container and owner - $new_widget = clone $widget; - $new_widget->container_guid = $entity->guid; - $new_widget->owner_guid = $entity->guid; - - // pull in settings - $settings = get_all_private_settings($widget->guid); - - foreach ($settings as $name => $value) { - $new_widget->$name = $value; - } - - $new_widget->save(); - } - - elgg_get_ignore_access($old_ia); - elgg_pop_context(); - - // failure here shouldn't stop the event. - return null; } /** diff --git a/js/lib/languages.js b/js/lib/languages.js index ae7ba63e2..bfa858364 100644 --- a/js/lib/languages.js +++ b/js/lib/languages.js @@ -26,16 +26,22 @@ elgg.add_translation = function(lang, translations) { elgg.reload_all_translations = function(language) { var lang = language || elgg.get_language(); - elgg.getJSON('ajax/view/js/languages', { - data: { - language: lang - }, - success: function(json) { - elgg.add_translation(lang, json); - elgg.config.languageReady = true; - elgg.initWhenReady(); - } - }); + var url, options; + if (elgg.config.simplecache_enabled) { + url = 'cache/js/default/languages/' + lang + '.' + elgg.config.lastcache + '.js'; + options = {}; + } else { + url = 'ajax/view/js/languages'; + options = {data: {language: lang}}; + } + + options['success'] = function(json) { + elgg.add_translation(lang, json); + elgg.config.languageReady = true; + elgg.initWhenReady(); + }; + + elgg.getJSON(url, options); }; /** diff --git a/js/lib/ui.userpicker.js b/js/lib/ui.userpicker.js index 8287ba91c..7298da114 100644 --- a/js/lib/ui.userpicker.js +++ b/js/lib/ui.userpicker.js @@ -93,7 +93,7 @@ elgg.userpicker.viewUser = function(info) { html += "<div class='elgg-image'>" + info.icon + "</div>"; html += "<div class='elgg-image-alt'>" + deleteLink + "</div>"; html += "<div class='elgg-body'>" + info.name + "</div>"; - html += "</div"; + html += "</div>"; return html; }; diff --git a/js/lib/ui.widgets.js b/js/lib/ui.widgets.js index f12ae02c1..47e43c876 100644 --- a/js/lib/ui.widgets.js +++ b/js/lib/ui.widgets.js @@ -107,7 +107,7 @@ elgg.ui.widgets.move = function(event, ui) { * @return void */ elgg.ui.widgets.remove = function(event) { - var $widget = $(this).parent().parent(); + var $widget = $(this).closest('.elgg-module-widget'); // if widget type is single instance type, enable the add buton var type = $widget.attr('class'); @@ -190,7 +190,7 @@ elgg.ui.widgets.equalHeight = function(selector) { maxHeight = $(this).height(); } }) - $(selector).css('min-height', maxHeight); + $(selector).css('min-height', maxHeight + 'px'); }; elgg.register_hook_handler('init', 'system', elgg.ui.widgets.init); diff --git a/languages/en.php b/languages/en.php index 17587b178..7d985b82f 100644 --- a/languages/en.php +++ b/languages/en.php @@ -236,6 +236,9 @@ $english = array( 'changebookmark' => 'Please change your bookmark for this page', 'noaccess' => 'This content has been removed, is invalid, or you do not have permission to view it.', + 'error:default' => 'Oops...something went wrong.', + 'error:404' => 'Sorry. We could not find the page that you requested.', + /** * API */ @@ -606,6 +609,12 @@ $english = array( // argh, this is ugly 'admin:widget:admin_welcome:outro' => '<br />Be sure to check out the resources available through the footer links and thank you for using Elgg!', + 'admin:widget:control_panel' => 'Control panel', + 'admin:widget:control_panel:help' => "Provides easy access to common controls", + + 'admin:cache:flush' => 'Flush the caches', + 'admin:cache:flushed' => "The site's caches have been flushed", + 'admin:footer:faq' => 'Administration FAQ', 'admin:footer:manual' => 'Administration Manual', 'admin:footer:community_forums' => 'Elgg Community Forums', diff --git a/mod/developers/start.php b/mod/developers/start.php index 2e3df7663..79ec0655a 100644 --- a/mod/developers/start.php +++ b/mod/developers/start.php @@ -23,6 +23,8 @@ function developers_init() { elgg_register_js('jquery.jstree', 'mod/developers/vendors/jsTree/jquery.jstree.js', 'footer'); elgg_register_css('jquery.jstree', 'mod/developers/vendors/jsTree/themes/default/style.css'); + elgg_load_js('jquery.form'); + elgg_register_js('elgg.dev', 'js/developers/developers.js', 'footer'); elgg_load_js('elgg.dev'); } @@ -166,13 +168,13 @@ function developers_theme_preview_controller($page) { $pages = array( 'buttons', - 'components', - 'forms', - 'grid', + 'components', + 'forms', + 'grid', 'icons', - 'modules', - 'navigation', - 'typography', + 'modules', + 'navigation', + 'typography', ); foreach ($pages as $page_name) { diff --git a/mod/embed/manifest.xml b/mod/embed/manifest.xml index 7ffbc23a4..46ab2df9e 100644 --- a/mod/embed/manifest.xml +++ b/mod/embed/manifest.xml @@ -13,9 +13,10 @@ <type>elgg_release</type> <version>1.8</version> </requires> - <requires> + <suggests> <type>plugin</type> <name>file</name> - </requires> + <version>1.8.1</version> + </suggests> <activate_on_install>true</activate_on_install> </plugin_manifest> diff --git a/mod/embed/start.php b/mod/embed/start.php index 015c0c0e4..a3ccab66b 100644 --- a/mod/embed/start.php +++ b/mod/embed/start.php @@ -37,10 +37,15 @@ function embed_longtext_menu($hook, $type, $items, $vars) { if (elgg_get_context() == 'embed') { return $items; } + + $url = 'embed'; + if (elgg_get_page_owner_guid()) { + $url = 'embed?container_guid=' . elgg_get_page_owner_guid(); + } $items[] = ElggMenuItem::factory(array( 'name' => 'embed', - 'href' => "embed", + 'href' => $url, 'text' => elgg_echo('embed:media'), 'rel' => 'lightbox', 'link_class' => "elgg-longtext-control elgg-lightbox embed-control embed-control-{$vars['id']}", @@ -49,6 +54,7 @@ function embed_longtext_menu($hook, $type, $items, $vars) { elgg_load_js('lightbox'); elgg_load_css('lightbox'); + elgg_load_js('jquery.form'); elgg_load_js('elgg.embed'); return $items; @@ -64,7 +70,9 @@ function embed_longtext_menu($hook, $type, $items, $vars) { */ function embed_select_tab($hook, $type, $items, $vars) { - $tab_name = array_pop(explode('/', full_url())); + // can this ba called from page handler instead? + $page = get_input('page'); + $tab_name = array_pop(explode('/', $page)); foreach ($items as $item) { if ($item->getName() == $tab_name) { $item->setSelected(); @@ -85,6 +93,11 @@ function embed_select_tab($hook, $type, $items, $vars) { */ function embed_page_handler($page) { + $container_guid = (int)get_input('container_guid'); + if ($container_guid) { + elgg_set_page_owner_guid($container_guid); + } + echo elgg_view('embed/layout'); // exit because this is in a modal display. @@ -120,15 +133,17 @@ function embed_list_items($entities, $vars = array()) { */ function embed_get_list_options($options = array()) { + $container_guids = array(elgg_get_logged_in_user_guid()); if (elgg_get_page_owner_guid()) { - $container_guid = elgg_get_page_owner_guid(); - } else { - $container_guid = elgg_get_logged_in_user_guid(); + $page_owner_guid = elgg_get_page_owner_guid(); + if ($page_owner_guid != elgg_get_logged_in_user_guid()) { + $container_guids[] = $page_owner_guid; + } } $defaults = array( 'limit' => 6, - 'container_guid' => $container_guid, + 'container_guids' => $container_guids, 'item_class' => 'embed-item', ); diff --git a/mod/embed/views/default/embed/layout.php b/mod/embed/views/default/embed/layout.php index c1e43f13c..e906160b1 100644 --- a/mod/embed/views/default/embed/layout.php +++ b/mod/embed/views/default/embed/layout.php @@ -21,10 +21,17 @@ if ($selected->getData('view')) { } } + +$container_info = elgg_view('input/hidden', array( + 'name' => 'embed_container_guid', + 'value' => elgg_get_page_owner_guid(), +)); + echo <<<HTML <div class="embed-wrapper"> $title $menu $tab + $container_info </div> HTML; diff --git a/mod/embed/views/default/js/embed/embed.php b/mod/embed/views/default/js/embed/embed.php index 8a8f0290c..5fd534a09 100644 --- a/mod/embed/views/default/js/embed/embed.php +++ b/mod/embed/views/default/js/embed/embed.php @@ -35,7 +35,12 @@ elgg.embed.insert = function(event) { // generalize this based on a css class attached to what should be inserted var content = ' ' + $(this).find(".embed-insert").parent().html() + ' '; - + + // this is a temporary work-around for #3971 + if (content.indexOf('thumbnail.php') != -1) { + content = content.replace('size=small', 'size=medium'); + } + textArea.val(textArea.val() + content); textArea.focus(); @@ -75,9 +80,13 @@ elgg.embed.submit = function(event) { if (response.status >= 0) { var forward = $('input[name=embed_forward]').val(); var url = elgg.normalize_url('embed/tab/' + forward); + url = elgg.embed.addContainerGUID(url); $('.embed-wrapper').parent().load(url); } } + }, + error: function(xhr, status) { + // nothing for now } }); @@ -93,8 +102,27 @@ elgg.embed.submit = function(event) { * @return void */ elgg.embed.forward = function(event) { - $('.embed-wrapper').parent().load($(this).attr('href')); + // make sure container guid is passed + var url = $(this).attr('href'); + url = elgg.embed.addContainerGUID(url); + + $('.embed-wrapper').parent().load(url); event.preventDefault(); }; +/** + * Adds the container guid to a URL + * + * @param {string} url + * @return string + */ +elgg.embed.addContainerGUID = function(url) { + if (url.indexOf('container_guid=') == -1) { + var guid = $('input[name=embed_container_guid]').val(); + return url + '?container_guid=' + guid; + } else { + return url; + } +}; + elgg.register_hook_handler('init', 'system', elgg.embed.init); diff --git a/mod/file/views/default/embed/file_upload/content.php b/mod/file/views/default/embed/file_upload/content.php index 4d3db0d97..8b630c828 100644 --- a/mod/file/views/default/embed/file_upload/content.php +++ b/mod/file/views/default/embed/file_upload/content.php @@ -7,7 +7,8 @@ $form_vars = array( 'enctype' => 'multipart/form-data', 'class' => 'elgg-form-embed', ); -echo elgg_view_form('file/upload', $form_vars); +$body_vars = array('container_guid' => elgg_get_page_owner_guid()); +echo elgg_view_form('file/upload', $form_vars, $body_vars); // the tab we want to be forwarded to after upload is complete echo elgg_view('input/hidden', array( diff --git a/mod/oauth_api/manifest.xml b/mod/oauth_api/manifest.xml index efd3d944f..991be6a22 100644 --- a/mod/oauth_api/manifest.xml +++ b/mod/oauth_api/manifest.xml @@ -18,4 +18,8 @@ <type>plugin</type> <name>oauth_lib</name> </conflicts> + <conflicts> + <type>php_extension</type> + <name>oauth</name> + </conflicts> </plugin_manifest> diff --git a/mod/uservalidationbyemail/lib/functions.php b/mod/uservalidationbyemail/lib/functions.php index eaca374f4..f3091f94d 100644 --- a/mod/uservalidationbyemail/lib/functions.php +++ b/mod/uservalidationbyemail/lib/functions.php @@ -87,7 +87,13 @@ function uservalidationbyemail_get_unvalidated_users_sql_where() { global $CONFIG; $validated_id = get_metastring_id('validated'); - $one_id = get_metastring_id(1); + if ($validated_id === false) { + $validated_id = add_metastring('validated'); + } + $one_id = get_metastring_id('1'); + if ($one_id === false) { + $one_id = add_metastring('1'); + } // thanks to daveb@freenode for the SQL tips! $wheres = array(); diff --git a/mod/uservalidationbyemail/start.php b/mod/uservalidationbyemail/start.php index 8de5d0522..ea59a2e7b 100644 --- a/mod/uservalidationbyemail/start.php +++ b/mod/uservalidationbyemail/start.php @@ -69,6 +69,17 @@ function uservalidationbyemail_disable_new_user($hook, $type, $value, $params) { return; } + // another plugin is requesting that registration be terminated + // no need for uservalidationbyemail + if (!$value) { + return $value; + } + + // has the user already been validated? + if (elgg_get_user_validation_status($user->guid) == true) { + return $value; + } + // disable user to prevent showing up on the site // set context so our canEdit() override works elgg_push_context('uservalidationbyemail_new_user'); diff --git a/views/default/css/elements/layout.php b/views/default/css/elements/layout.php index 42d898439..25a2bffb7 100644 --- a/views/default/css/elements/layout.php +++ b/views/default/css/elements/layout.php @@ -81,6 +81,9 @@ .elgg-layout-two-sidebar { background: transparent url(<?php echo elgg_get_site_url(); ?>_graphics/two_sidebar_background.gif) repeat-y right top; } +.elgg-layout-error { + margin-top: 20px; +} .elgg-sidebar { position: relative; padding: 20px 10px; diff --git a/views/default/css/elements/modules.php b/views/default/css/elements/modules.php index ef85d4dd5..7750c208f 100644 --- a/views/default/css/elements/modules.php +++ b/views/default/css/elements/modules.php @@ -158,16 +158,7 @@ .elgg-module-widget.elgg-state-draggable > .elgg-head { cursor: move; } -.elgg-module-widget > .elgg-head a { - position: absolute; - top: 4px; - display: inline-block; - width: 18px; - height: 18px; - padding: 2px 2px 0 0; -} a.elgg-widget-collapse-button { - left: 5px; color: #c5c5c5; } a.elgg-widget-collapse-button:hover, @@ -181,12 +172,6 @@ a.elgg-widget-collapse-button:before { a.elgg-widget-collapsed:before { content: "\25BA"; } -a.elgg-widget-delete-button { - right: 5px; -} -a.elgg-widget-edit-button { - right: 25px; -} .elgg-module-widget > .elgg-body { background-color: white; width: 100%; diff --git a/views/default/css/elements/navigation.php b/views/default/css/elements/navigation.php index d5b20896a..62f370069 100644 --- a/views/default/css/elements/navigation.php +++ b/views/default/css/elements/navigation.php @@ -534,4 +534,26 @@ *************************************** */ .elgg-menu-extras { margin-bottom: 15px; -}
\ No newline at end of file +} + +/* *************************************** + WIDGET MENU +*************************************** */ +.elgg-menu-widget > li { + position: absolute; + top: 4px; + display: inline-block; + width: 18px; + height: 18px; + padding: 2px 2px 0 0; +} + +.elgg-menu-widget > .elgg-menu-item-collapse { + left: 5px; +} +.elgg-menu-widget > .elgg-menu-item-delete { + right: 5px; +} +.elgg-menu-widget > .elgg-menu-item-settings { + right: 25px; +} diff --git a/views/default/errors/404.php b/views/default/errors/404.php new file mode 100644 index 000000000..8bc35acdd --- /dev/null +++ b/views/default/errors/404.php @@ -0,0 +1,8 @@ +<?php +/** + * Page not found error + */ + +$message = elgg_echo('error:404'); + +echo "<h2>$message</h2>"; diff --git a/views/default/errors/default.php b/views/default/errors/default.php new file mode 100644 index 000000000..a0582eba2 --- /dev/null +++ b/views/default/errors/default.php @@ -0,0 +1,8 @@ +<?php +/** + * General error + */ + +$message = elgg_echo('error:default'); + +echo "<h2>$message</h2>"; diff --git a/views/default/input/userpicker.php b/views/default/input/userpicker.php index 246c462da..91a397e37 100644 --- a/views/default/input/userpicker.php +++ b/views/default/input/userpicker.php @@ -20,6 +20,7 @@ */ elgg_load_js('elgg.userpicker'); +elgg_load_js('jquery.ui.autocomplete.html'); function user_picker_add_user($user_id) { $user = get_entity($user_id); diff --git a/views/default/navigation/menu/default.php b/views/default/navigation/menu/default.php index 0fa391433..006deb3ea 100644 --- a/views/default/navigation/menu/default.php +++ b/views/default/navigation/menu/default.php @@ -2,15 +2,17 @@ /** * Default menu * - * @uses $vars['name'] - * @uses $vars['menu'] - * @uses $vars['class'] - * @uses $vars['show_section_headers'] + * @uses $vars['name'] Name of the menu + * @uses $vars['menu'] Array of menu items + * @uses $vars['class'] Additional CSS class for the menu + * @uses $vars['item_class'] Additional CSS class for each menu item + * @uses $vars['show_section_headers'] Do we show headers for each section? */ // we want css classes to use dashes $vars['name'] = preg_replace('/[^a-z0-9\-]/i', '-', $vars['name']); $headers = elgg_extract('show_section_headers', $vars, false); +$item_class = elgg_extract('item_class', $vars, ''); $class = "elgg-menu elgg-menu-{$vars['name']}"; if (isset($vars['class'])) { @@ -23,6 +25,7 @@ foreach ($vars['menu'] as $section => $menu_items) { 'class' => "$class elgg-menu-{$vars['name']}-$section", 'section' => $section, 'name' => $vars['name'], - 'show_section_headers' => $headers + 'show_section_headers' => $headers, + 'item_class' => $item_class, )); } diff --git a/views/default/navigation/menu/elements/item.php b/views/default/navigation/menu/elements/item.php index 5d6a7e367..22383ce0b 100644 --- a/views/default/navigation/menu/elements/item.php +++ b/views/default/navigation/menu/elements/item.php @@ -4,6 +4,9 @@ * * @package Elgg.Core * @subpackage Navigation + * + * @uses $vars['item'] ElggMenuItem + * @uses $vars['item_class'] Additional CSS class for the menu item */ $item = $vars['item']; @@ -21,6 +24,9 @@ if ($children) { } $item_class = $item->getItemClass(); +if (isset($vars['item_class']) && $vars['item_class']) { + $item_class .= ' ' . $vars['item_class']; +} echo "<li class=\"$item_class\">"; echo $item->getContent(); diff --git a/views/default/navigation/menu/elements/section.php b/views/default/navigation/menu/elements/section.php index 92a259776..c0e9ba750 100644 --- a/views/default/navigation/menu/elements/section.php +++ b/views/default/navigation/menu/elements/section.php @@ -2,15 +2,17 @@ /** * Menu group * - * @uses $vars['items'] - * @uses $vars['class'] - * @uses $vars['name'] - * @uses $vars['section'] - * @uses $vars['show_section_headers'] + * @uses $vars['items'] Array of menu items + * @uses $vars['class'] Additional CSS class for the section + * @uses $vars['name'] Name of the menu + * @uses $vars['section'] The section name + * @uses $vars['item_class'] Additional CSS class for each menu item + * @uses $vars['show_section_headers'] Do we show headers for each section */ $headers = elgg_extract('show_section_headers', $vars, false); $class = elgg_extract('class', $vars, ''); +$item_class = elgg_extract('item_class', $vars, ''); if ($headers) { $name = elgg_extract('name', $vars); @@ -20,6 +22,9 @@ if ($headers) { echo "<ul class=\"$class\">"; foreach ($vars['items'] as $menu_item) { - echo elgg_view('navigation/menu/elements/item', array('item' => $menu_item)); + echo elgg_view('navigation/menu/elements/item', array( + 'item' => $menu_item, + 'item_class' => $item_class, + )); } echo '</ul>'; diff --git a/views/default/navigation/pagination.php b/views/default/navigation/pagination.php index 4df5cf575..ad4689d83 100644 --- a/views/default/navigation/pagination.php +++ b/views/default/navigation/pagination.php @@ -25,7 +25,12 @@ if (!$limit = (int) elgg_extract('limit', $vars, 10)) { $count = (int) elgg_extract('count', $vars, 0); $offset_key = elgg_extract('offset_key', $vars, 'offset'); -$base_url = elgg_extract('baseurl', $vars, current_page_url()); +// some views pass an empty string for base_url +if (isset($vars['base_url']) && $vars['base_url']) { + $base_url = $vars['base_url']; +} else { + $base_url = current_page_url(); +} $num_pages = elgg_extract('num_pages', $vars, 10); $delta = ceil($num_pages / 2); diff --git a/views/default/object/widget/elements/controls.php b/views/default/object/widget/elements/controls.php index 866dcc787..d1d630c4f 100644 --- a/views/default/object/widget/elements/controls.php +++ b/views/default/object/widget/elements/controls.php @@ -6,44 +6,11 @@ * @uses $vars['show_edit'] Whether to show the edit button (true) */ -$widget = $vars['widget']; -$show_edit = elgg_extract('show_edit', $vars, true); - -$params = array( - 'text' => ' ', - 'href' => "#elgg-widget-content-$widget->guid", - 'class' => 'elgg-widget-collapse-button', - 'rel' => 'toggle', -); -$collapse_link = elgg_view('output/url', $params); - -$delete_link = $edit_link = ''; -if ($widget->canEdit()) { - $params = array( - 'text' => elgg_view_icon('delete-alt'), - 'title' => elgg_echo('widget:delete', array($widget->getTitle())), - 'href' => "action/widgets/delete?widget_guid=$widget->guid", - 'is_action' => true, - 'is_trusted' => true, - 'class' => 'elgg-widget-delete-button', - 'id' => "elgg-widget-delete-button-$widget->guid" - ); - $delete_link = elgg_view('output/url', $params); - - if ($show_edit) { - $params = array( - 'text' => elgg_view_icon('settings-alt'), - 'title' => elgg_echo('widget:edit'), - 'href' => "#widget-edit-$widget->guid", - 'class' => "elgg-widget-edit-button", - 'rel' => 'toggle', - ); - $edit_link = elgg_view('output/url', $params); - } -} - -echo <<<___END - $collapse_link - $delete_link - $edit_link -___END; +echo elgg_view_menu('widget', array( + 'entity' => elgg_extract('widget', $vars), + 'params' => array( + 'show_edit' => elgg_extract('show_edit', $vars, true) + ), + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', +)); diff --git a/views/default/page/error.php b/views/default/page/error.php new file mode 100644 index 000000000..b7ba3ae9b --- /dev/null +++ b/views/default/page/error.php @@ -0,0 +1,14 @@ +<?php +/** + * Page shell for errors + * + * This is for errors that are not unhandled exceptions. Those are handled + * through the failsafe viewtype to guarantee that no further exceptions occur. + * An example error would be 404 (page not found). + * + * @uses $vars['title'] The page title + * @uses $vars['body'] The main content of the page + * @uses $vars['sysmessages'] A 2d array of various message registers, passed from system_messages() + */ + +echo elgg_view('page/default', $vars); diff --git a/views/default/page/layouts/error.php b/views/default/page/layouts/error.php new file mode 100644 index 000000000..cdce28a8e --- /dev/null +++ b/views/default/page/layouts/error.php @@ -0,0 +1,12 @@ +<?php +/** + * Error layout + */ + +$class = 'elgg-layout-error'; +if (isset($vars['class'])) { + $class = "$class {$vars['class']}"; +} +$vars['class'] = $class; + +echo elgg_view('page/layouts/one_column', $vars); diff --git a/views/default/widgets/control_panel/content.php b/views/default/widgets/control_panel/content.php new file mode 100644 index 000000000..d2db54bc6 --- /dev/null +++ b/views/default/widgets/control_panel/content.php @@ -0,0 +1,24 @@ +<?php +/** + * Admin control panel widget + */ + +elgg_register_menu_item('admin_control_panel', array( + 'name' => 'flush', + 'text' => elgg_echo('admin:cache:flush'), + 'href' => 'action/admin/site/flush_cache', + 'is_action' => true, + 'link_class' => 'elgg-button elgg-button-action', +)); + +elgg_register_menu_item('admin_control_panel', array( + 'name' => 'upgrade', + 'text' => elgg_echo('upgrade'), + 'href' => 'upgrade.php', + 'link_class' => 'elgg-button elgg-button-action', +)); + +echo elgg_view_menu('admin_control_panel', array( + 'class' => 'elgg-menu-hz', + 'item_class' => 'mrm', +)); |