diff options
33 files changed, 329 insertions, 128 deletions
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 5c44d4076..3ccb146fb 100644 --- a/engine/classes/ElggSite.php +++ b/engine/classes/ElggSite.php @@ -424,7 +424,9 @@ class ElggSite extends ElggEntity { 'xml-rpc\.php', 'mt/mt-xmlrpc\.cgi', '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/entities.php b/engine/lib/entities.php index dbb5ee695..daced6740 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -669,7 +669,10 @@ function get_entity($guid) { static $newentity_cache; $new_entity = false; - if (!is_numeric($guid)) { + // We could also use: if (!(int) $guid) { return FALSE }, + // but that evaluates to a false positive for $guid = TRUE. + // This is a bit slower, but more thorough. + if (!is_numeric($guid) || $guid === 0 || $guid === '0') { return FALSE; } 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 60bcc72cd..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; @@ -306,6 +311,9 @@ function elgg_get_friendly_title($title) { } //$title = iconv('UTF-8', 'ASCII//TRANSLIT', $title); + + // use A-Za-z0-9_ instead of \w because \w is locale sensitive + $title = preg_replace("/[^A-Za-z0-9_ ]/", "", $title); $title = preg_replace("/[^\w ]/", "", $title); $title = str_replace(" ", "-", $title); $title = str_replace("--", "-", $title); 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/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 6435d2147..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'); @@ -124,15 +124,9 @@ elgg.ui.widgets.remove = function(event) { $widget.remove(); - // elgg-widget-delete-button-<guid> - var id = $(this).attr('id'); - id = id.substr(id.indexOf('elgg-widget-delete-button-') + "elgg-widget-delete-button-".length); + // delete the widget through ajax + elgg.action($(this).attr('href')); - elgg.action('widgets/delete', { - data: { - widget_guid: id - } - }); event.preventDefault(); }; @@ -196,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 eecb2f1aa..93099c98f 100644 --- a/languages/en.php +++ b/languages/en.php @@ -613,6 +613,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/profile/start.php b/mod/profile/start.php index adee838fc..abe044632 100644 --- a/mod/profile/start.php +++ b/mod/profile/start.php @@ -73,7 +73,7 @@ function profile_page_handler($page) { // use the core profile edit page $base_dir = elgg_get_root_path(); require "{$base_dir}pages/profile/edit.php"; - return; + return true; } // main profile page 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/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/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 6d06d28bc..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?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/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', +)); |