diff options
63 files changed, 187 insertions, 172 deletions
diff --git a/engine/lib/navigation.php b/engine/lib/navigation.php index 48a3659f6..cdf3d0f67 100644 --- a/engine/lib/navigation.php +++ b/engine/lib/navigation.php @@ -154,6 +154,41 @@ function elgg_is_menu_item_registered($menu_name, $item_name) { } /** + * Convenience function for registering an add content button to title menu + * + * The add URL must be $handler/add/$guid where $guid is the guid of the page owner. + * The label of the button is "$handler:add" so that must be defined in a + * language file. + * + * @param string $handler The handler to use or null to autodetect from context + * @return void + * @since 1.8.0 + */ +function elgg_register_add_button($handler = null) { + if (elgg_is_logged_in()) { + + if (!$handler) { + $handler = elgg_get_context(); + } + + $owner = elgg_get_page_owner_entity(); + if (!$owner) { + // no owns the page so this is probably an all site list page + $owner = elgg_get_logged_in_user_entity(); + } + if ($owner && $owner->canWriteToContainer()) { + $guid = $owner->getGUID(); + elgg_register_menu_item('title', array( + 'name' => 'add', + 'href' => "$handler/add/$guid", + 'text' => elgg_echo("$handler:add"), + 'link_class' => 'elgg-button elgg-button-action', + )); + } + } +} + +/** * Adds a breadcrumb to the breadcrumbs stack. * * @param string $title The title to display diff --git a/mod/blog/lib/blog.php b/mod/blog/lib/blog.php index 4d1edd50e..0f81597eb 100644 --- a/mod/blog/lib/blog.php +++ b/mod/blog/lib/blog.php @@ -92,6 +92,8 @@ function blog_get_page_content_list($container_guid = NULL) { elgg_push_breadcrumb(elgg_echo('blog:blogs')); } + elgg_register_add_button(); + // show all posts for admin or users looking at their own blogs // show only published posts for other users. if (!(elgg_is_admin_logged_in() || (elgg_is_logged_in() && $container_guid == $loggedin_userid))) { @@ -129,6 +131,8 @@ function blog_get_page_content_friends($user_guid) { elgg_push_breadcrumb($crumbs_title, "blog/owner/{$user->username}"); elgg_push_breadcrumb(elgg_echo('friends')); + elgg_register_add_button(); + if (!$friends = get_user_friends($user_guid, ELGG_ENTITIES_ANY_VALUE, 0)) { $return['content'] .= elgg_echo('friends:none:you'); return $return; @@ -235,7 +239,6 @@ function blog_get_page_content_archive($owner_guid, $lower = 0, $upper = 0) { return array( 'content' => $content, 'title' => $title, - 'buttons' => '', 'filter' => '', ); } @@ -253,13 +256,13 @@ function blog_get_page_content_edit($page, $guid = 0, $revision = NULL) { elgg_load_js('elgg.blog'); $return = array( - 'buttons' => '', 'filter' => '', ); $vars = array(); $vars['id'] = 'blog-post-edit'; $vars['name'] = 'blog_post'; + $vars['class'] = 'elgg-form-alt'; if ($page == 'edit') { $blog = get_entity((int)$guid); diff --git a/mod/blog/views/default/forms/blog/save.php b/mod/blog/views/default/forms/blog/save.php index d99f45f01..79309b6ef 100644 --- a/mod/blog/views/default/forms/blog/save.php +++ b/mod/blog/views/default/forms/blog/save.php @@ -150,7 +150,7 @@ $body_input $categories_input -<div class="elgg-form-footer-alt"> +<div class="elgg-foot"> <div class="elgg-subtext mbm"> $save_status <span class="blog-save-status-time">$saved</span> </div> diff --git a/mod/bookmarks/pages/bookmarks/add.php b/mod/bookmarks/pages/bookmarks/add.php index c7fd3cf79..d80d4a4bc 100644 --- a/mod/bookmarks/pages/bookmarks/add.php +++ b/mod/bookmarks/pages/bookmarks/add.php @@ -15,7 +15,6 @@ $content = elgg_view_form('bookmarks/save', array(), $vars); $body = elgg_view_layout('content', array( 'filter' => '', - 'buttons' => '', 'content' => $content, 'title' => $title, )); diff --git a/mod/bookmarks/pages/bookmarks/all.php b/mod/bookmarks/pages/bookmarks/all.php index ec0f85e2b..7b3f2059c 100644 --- a/mod/bookmarks/pages/bookmarks/all.php +++ b/mod/bookmarks/pages/bookmarks/all.php @@ -8,6 +8,8 @@ elgg_pop_breadcrumb(); elgg_push_breadcrumb(elgg_echo('bookmarks')); +elgg_register_add_button(); + $offset = (int)get_input('offset', 0); $content = elgg_list_entities(array( 'type' => 'object', diff --git a/mod/bookmarks/pages/bookmarks/bookmarklet.php b/mod/bookmarks/pages/bookmarks/bookmarklet.php index 99866e385..510229339 100644 --- a/mod/bookmarks/pages/bookmarks/bookmarklet.php +++ b/mod/bookmarks/pages/bookmarks/bookmarklet.php @@ -25,6 +25,8 @@ if ($page_owner instanceof ElggGroup) { elgg_push_breadcrumb($title); +elgg_register_add_button(); + $content = elgg_view("bookmarks/bookmarklet"); $body = elgg_view_layout('content', array( diff --git a/mod/bookmarks/pages/bookmarks/edit.php b/mod/bookmarks/pages/bookmarks/edit.php index 24513a960..93b143c36 100644 --- a/mod/bookmarks/pages/bookmarks/edit.php +++ b/mod/bookmarks/pages/bookmarks/edit.php @@ -23,7 +23,6 @@ $content = elgg_view_form('bookmarks/save', array(), $vars); $body = elgg_view_layout('content', array( 'filter' => '', - 'buttons' => '', 'content' => $content, 'title' => $title, )); diff --git a/mod/bookmarks/pages/bookmarks/friends.php b/mod/bookmarks/pages/bookmarks/friends.php index 6e3f77cf6..ef5f078f5 100644 --- a/mod/bookmarks/pages/bookmarks/friends.php +++ b/mod/bookmarks/pages/bookmarks/friends.php @@ -10,6 +10,8 @@ $owner = elgg_get_page_owner_entity(); elgg_push_breadcrumb($owner->name, "bookmarks/owner/$owner->username"); elgg_push_breadcrumb(elgg_echo('friends')); +elgg_register_add_button(); + $title = elgg_echo('bookmarks:friends'); $content = list_user_friends_objects($owner->guid, 'bookmarks', 10, false); diff --git a/mod/bookmarks/pages/bookmarks/owner.php b/mod/bookmarks/pages/bookmarks/owner.php index f12d1d83f..46a22080d 100644 --- a/mod/bookmarks/pages/bookmarks/owner.php +++ b/mod/bookmarks/pages/bookmarks/owner.php @@ -9,6 +9,8 @@ $page_owner = elgg_get_page_owner_entity(); elgg_push_breadcrumb($page_owner->name); +elgg_register_add_button(); + $offset = (int)get_input('offset', 0); $content .= elgg_list_entities(array( 'type' => 'object', diff --git a/mod/file/pages/file/edit.php b/mod/file/pages/file/edit.php index 66529af0b..b396c6e9b 100644 --- a/mod/file/pages/file/edit.php +++ b/mod/file/pages/file/edit.php @@ -35,7 +35,6 @@ $body = elgg_view_layout('content', array( 'content' => $content, 'title' => $title, 'filter' => '', - 'buttons' => '', )); echo elgg_view_page($title, $body); diff --git a/mod/file/pages/file/friends.php b/mod/file/pages/file/friends.php index fc23e1d1e..7bde42962 100644 --- a/mod/file/pages/file/friends.php +++ b/mod/file/pages/file/friends.php @@ -11,6 +11,7 @@ elgg_push_breadcrumb(elgg_echo('file'), "file/all"); elgg_push_breadcrumb($owner->name, "file/owner/$owner->username"); elgg_push_breadcrumb(elgg_echo('friends')); +elgg_register_add_button(); $title = elgg_echo("file:friends"); diff --git a/mod/file/pages/file/owner.php b/mod/file/pages/file/owner.php index a01e9cd22..2244de095 100644 --- a/mod/file/pages/file/owner.php +++ b/mod/file/pages/file/owner.php @@ -13,6 +13,8 @@ $owner = elgg_get_page_owner_entity(); elgg_push_breadcrumb(elgg_echo('file'), "file/all"); elgg_push_breadcrumb($owner->name); +elgg_register_add_button(); + $params = array(); if ($owner->guid == elgg_get_logged_in_user_guid()) { @@ -20,9 +22,8 @@ if ($owner->guid == elgg_get_logged_in_user_guid()) { $params['filter_context'] = 'mine'; } else if (elgg_instanceof($owner, 'user')) { // someone else's files - // do not show button or select a tab when viewing someone else's posts + // do not show select a tab when viewing someone else's posts $params['filter_context'] = 'none'; - $params['buttons'] = ''; } else { // group files $params['filter'] = ''; diff --git a/mod/file/pages/file/search.php b/mod/file/pages/file/search.php index 77c92f444..cffe67e0c 100644 --- a/mod/file/pages/file/search.php +++ b/mod/file/pages/file/search.php @@ -86,7 +86,6 @@ if ($tag) { $body = elgg_view_layout('content', array( 'filter' => '', - 'buttons' => '', 'content' => $content, 'title' => $title, 'sidebar' => $sidebar, diff --git a/mod/file/pages/file/upload.php b/mod/file/pages/file/upload.php index d97cc038d..3aa25b6db 100644 --- a/mod/file/pages/file/upload.php +++ b/mod/file/pages/file/upload.php @@ -32,7 +32,6 @@ $body = elgg_view_layout('content', array( 'content' => $content, 'title' => $title, 'filter' => '', - 'buttons' => '', )); echo elgg_view_page($title, $body); diff --git a/mod/file/pages/file/view.php b/mod/file/pages/file/view.php index 4b395d20d..50c55a74f 100644 --- a/mod/file/pages/file/view.php +++ b/mod/file/pages/file/view.php @@ -25,17 +25,17 @@ elgg_push_breadcrumb($title); $content = elgg_view_entity($file, array('full_view' => true)); $content .= elgg_view_comments($file); -$download = elgg_view('output/url', array( +elgg_register_menu_item('title', array( + 'name' => 'download', + 'text' => elgg_echo('file:download'), 'href' => "mod/file/download.php?file_guid=$file->guid", - 'text' => elgg_echo("file:download"), - 'class' => 'elgg-button elgg-button-action float-alt', + 'link_class' => 'elgg-button elgg-button-action', )); $body = elgg_view_layout('content', array( 'content' => $content, 'title' => $title, 'filter' => '', - 'buttons' => $download, )); echo elgg_view_page($title, $body); diff --git a/mod/file/pages/file/world.php b/mod/file/pages/file/world.php index bfe965084..560743bed 100644 --- a/mod/file/pages/file/world.php +++ b/mod/file/pages/file/world.php @@ -7,6 +7,8 @@ elgg_push_breadcrumb(elgg_echo('file')); +elgg_register_add_button(); + $limit = get_input("limit", 10); $title = elgg_echo('file:all'); diff --git a/mod/groups/lib/discussion.php b/mod/groups/lib/discussion.php index 342115c81..52df7e18d 100644 --- a/mod/groups/lib/discussion.php +++ b/mod/groups/lib/discussion.php @@ -23,7 +23,6 @@ function discussion_handle_all_page() { 'content' => $content, 'title' => elgg_echo('discussion:latest'), 'filter' => '', - 'buttons' => '', ); $body = elgg_view_layout('content', $params); @@ -46,6 +45,8 @@ function discussion_handle_list_page($guid) { } elgg_push_breadcrumb($group->name); + elgg_register_add_button(); + group_gatekeeper(); $title = elgg_echo('item:object:groupforumtopic'); @@ -67,10 +68,6 @@ function discussion_handle_list_page($guid) { 'filter' => '', ); - if (!$group->canWriteToContainer()) { - $params['buttons'] = ''; - } - $body = elgg_view_layout('content', $params); echo elgg_view_page($title, $body); @@ -131,7 +128,6 @@ function discussion_handle_edit_page($type, $guid) { 'content' => $content, 'title' => $title, 'filter' => '', - 'buttons' => '', ); $body = elgg_view_layout('content', $params); @@ -190,7 +186,6 @@ function discussion_handle_view_page($guid) { 'content' => $content, 'title' => $topic->title, 'filter' => '', - 'buttons' => '', ); $body = elgg_view_layout('content', $params); diff --git a/mod/groups/lib/groups.php b/mod/groups/lib/groups.php index c3986e53c..2747f360b 100644 --- a/mod/groups/lib/groups.php +++ b/mod/groups/lib/groups.php @@ -12,6 +12,8 @@ function groups_handle_all_page() { elgg_pop_breadcrumb(); elgg_push_breadcrumb(elgg_echo('groups')); + elgg_register_add_button(); + $selected_tab = get_input('filter', 'newest'); switch ($selected_tab) { @@ -81,7 +83,6 @@ function groups_search_page() { 'content' => $content, 'sidebar' => $sidebar, 'filter' => false, - 'buttons' => false, 'title' => $title, ); $body = elgg_view_layout('content', $params); @@ -99,6 +100,8 @@ function groups_handle_owned_page() { $title = elgg_echo('groups:owned'); elgg_push_breadcrumb($title); + elgg_register_add_button(); + $content = elgg_list_entities(array( 'type' => 'group', 'owner_guid' => elgg_get_page_owner_guid(), @@ -125,6 +128,8 @@ function groups_handle_mine_page() { $title = elgg_echo('groups:yours'); elgg_push_breadcrumb($title); + elgg_register_add_button(); + $content = elgg_list_entities_from_relationship_count(array( 'type' => 'group', 'relationship' => 'member', @@ -175,7 +180,6 @@ function groups_handle_edit_page($page, $guid = 0) { 'content' => $content, 'title' => $title, 'filter' => '', - 'buttons' => '', ); $body = elgg_view_layout('content', $params); @@ -201,7 +205,6 @@ function groups_handle_invitations_page() { 'content' => $content, 'title' => $title, 'filter' => '', - 'buttons' => '', ); $body = elgg_view_layout('content', $params); @@ -234,11 +237,12 @@ function groups_handle_profile_page($guid) { $sidebar = ''; } + groups_register_profile_buttons($group); + $params = array( 'content' => $content, 'sidebar' => $sidebar, 'title' => $group->name, - 'buttons' => elgg_view('groups/profile/buttons', array('entity' => $group)), 'filter' => '', ); $body = elgg_view_layout('content', $params); @@ -280,7 +284,6 @@ function groups_handle_activity_page($guid) { $params = array( 'content' => $content, 'title' => $title, - 'buttons' => '', 'filter' => '', ); $body = elgg_view_layout('content', $params); @@ -320,7 +323,6 @@ function groups_handle_members_page($guid) { $params = array( 'content' => $content, 'title' => $title, - 'buttons' => '', 'filter' => '', ); $body = elgg_view_layout('content', $params); @@ -348,7 +350,7 @@ function groups_handle_invite_page($guid) { if ($group && $group->canEdit()) { $content = elgg_view_form('groups/invite', array( 'id' => 'invite_to_group', - 'class' => 'mtm', + 'class' => 'elgg-form-alt mtm', ), array( 'entity' => $group, )); @@ -359,7 +361,6 @@ function groups_handle_invite_page($guid) { $params = array( 'content' => $content, 'title' => $title, - 'buttons' => '', 'filter' => '', ); $body = elgg_view_layout('content', $params); @@ -403,10 +404,57 @@ function groups_handle_requests_page($guid) { $params = array( 'content' => $content, 'title' => $title, - 'buttons' => '', 'filter' => '', ); $body = elgg_view_layout('content', $params); echo elgg_view_page($title, $body); } + +/** + * Registers the buttons for title area of the group profile page + * + * @param ElggGroup $group + */ +function groups_register_profile_buttons($group) { + + $actions = array(); + + // group owners + if ($group->canEdit()) { + // edit and invite + $url = elgg_get_site_url() . "groups/edit/{$group->getGUID()}"; + $actions[$url] = elgg_echo('groups:edit'); + $url = elgg_get_site_url() . "groups/invite/{$group->getGUID()}"; + $actions[$url] = elgg_echo('groups:invite'); + } + + // group members + if ($group->isMember($user)) { + // leave + $url = elgg_get_site_url() . "action/groups/leave?group_guid={$group->getGUID()}"; + $url = elgg_add_action_tokens_to_url($url); + $actions[$url] = 'groups:leave'; + } else { + // join - admins can always join. + $url = elgg_get_site_url() . "action/groups/join?group_guid={$group->getGUID()}"; + $url = elgg_add_action_tokens_to_url($url); + if ($group->isPublicMembership() || $group->canEdit()) { + $actions[$url] = 'groups:join'; + } else { + // request membership + $actions[$url] = 'groups:joinrequest'; + } + } + + if ($actions) { + foreach ($actions as $url => $text) { + elgg_register_menu_item('title', array( + 'name' => $text, + 'href' => $url, + 'text' => elgg_echo($text), + 'link_class' => 'elgg-button elgg-button-action', + )); + } + } +} diff --git a/mod/groups/views/default/forms/groups/edit.php b/mod/groups/views/default/forms/groups/edit.php index b67134c63..26436ef01 100644 --- a/mod/groups/views/default/forms/groups/edit.php +++ b/mod/groups/views/default/forms/groups/edit.php @@ -126,7 +126,7 @@ if ($tools) { } } ?> -<div class="elgg-form-footer-alt"> +<div class="elgg-foot"> <?php if (isset($vars['entity'])) { diff --git a/mod/groups/views/default/forms/groups/invite.php b/mod/groups/views/default/forms/groups/invite.php index 83139c2ee..ef3131782 100644 --- a/mod/groups/views/default/forms/groups/invite.php +++ b/mod/groups/views/default/forms/groups/invite.php @@ -12,7 +12,7 @@ $friends = elgg_get_logged_in_user_entity()->getFriends('', 0); if ($friends) { echo elgg_view('input/friendspicker', array('entities' => $friends, 'name' => 'user_guid', 'highlight' => 'all')); - echo '<div class="elgg-form-footer">'; + echo '<div class="elgg-foot">'; echo elgg_view('input/hidden', array('name' => 'forward_url', 'value' => $forward_url)); echo elgg_view('input/hidden', array('name' => 'group_guid', 'value' => $group->guid)); echo elgg_view('input/submit', array('value' => elgg_echo('invite'))); diff --git a/mod/groups/views/default/groups/edit.php b/mod/groups/views/default/groups/edit.php index 5076cc49a..24a1c3f1e 100644 --- a/mod/groups/views/default/groups/edit.php +++ b/mod/groups/views/default/groups/edit.php @@ -7,6 +7,9 @@ $entity = elgg_extract('entity', $vars, null); -$form_vars = array('enctype' => 'multipart/form-data'); +$form_vars = array( + 'enctype' => 'multipart/form-data', + 'class' => 'elgg-form-alt', +); $body_vars = array('entity' => $entity); echo elgg_view_form('groups/edit', $form_vars, $body_vars); diff --git a/mod/groups/views/default/groups/profile/buttons.php b/mod/groups/views/default/groups/profile/buttons.php deleted file mode 100644 index 55e99f59c..000000000 --- a/mod/groups/views/default/groups/profile/buttons.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php -/** - * Content header action buttons - * - * @uses $vars['entity'] - * - * @todo This should be done by registering menu items with the page actions menu - */ - -if (!elgg_is_logged_in()) { - return true; -} - - -$actions = array(); - -// group owners -if ($vars['entity']->canEdit()) { - // edit and invite - $url = elgg_get_site_url() . "groups/edit/{$vars['entity']->getGUID()}"; - $actions[$url] = elgg_echo('groups:edit'); - $url = elgg_get_site_url() . "groups/invite/{$vars['entity']->getGUID()}"; - $actions[$url] = elgg_echo('groups:invite'); -} - -// group members -if ($vars['entity']->isMember($user)) { - // leave - $url = elgg_get_site_url() . "action/groups/leave?group_guid={$vars['entity']->getGUID()}"; - $url = elgg_add_action_tokens_to_url($url); - $actions[$url] = elgg_echo('groups:leave'); -} else { - // join - admins can always join. - $url = elgg_get_site_url() . "action/groups/join?group_guid={$vars['entity']->getGUID()}"; - $url = elgg_add_action_tokens_to_url($url); - if ($vars['entity']->isPublicMembership() || $vars['entity']->canEdit()) { - $actions[$url] = elgg_echo('groups:join'); - } else { - // request membership - $actions[$url] = elgg_echo('groups:joinrequest'); - } -} - -// display action buttons -if ($actions) { - echo '<ul class="elgg-menu elgg-menu-title elgg-menu-hz">'; - foreach ($actions as $url => $action) { - echo '<li>'; - echo elgg_view('output/url', array( - 'text' => $action, - 'href' => $url, - 'class' => 'elgg-button elgg-button-action', - )); - echo '</li>'; - } - echo '</ul>'; -} diff --git a/mod/members/pages/members/index.php b/mod/members/pages/members/index.php index 4f23c6322..330ef66bf 100644 --- a/mod/members/pages/members/index.php +++ b/mod/members/pages/members/index.php @@ -28,7 +28,6 @@ $params = array( 'content' => $content, 'sidebar' => elgg_view('members/sidebar'), 'title' => $title . " ($num_members)", - 'buttons' => '', 'filter_override' => elgg_view('members/nav', array('selected' => $vars['page'])), ); diff --git a/mod/messageboard/pages/messageboard/owner.php b/mod/messageboard/pages/messageboard/owner.php index 241ad64f2..2c854d4f3 100644 --- a/mod/messageboard/pages/messageboard/owner.php +++ b/mod/messageboard/pages/messageboard/owner.php @@ -48,7 +48,6 @@ if (!$content) { $vars = array( 'filter' => false, - 'buttons' => false, 'content' => $content, 'title' => $title, 'reverse_order_by' => true diff --git a/mod/messages/pages/messages/inbox.php b/mod/messages/pages/messages/inbox.php index 4b2d11bbf..96712a193 100644 --- a/mod/messages/pages/messages/inbox.php +++ b/mod/messages/pages/messages/inbox.php @@ -15,6 +15,8 @@ if (!$page_owner) { elgg_push_breadcrumb(elgg_echo('messages:inbox')); +elgg_register_add_button(); + $title = elgg_echo('messages:user', array($page_owner->name)); $list = elgg_list_entities_from_metadata(array( diff --git a/mod/messages/pages/messages/read.php b/mod/messages/pages/messages/read.php index 9bedbd08a..310485ee2 100644 --- a/mod/messages/pages/messages/read.php +++ b/mod/messages/pages/messages/read.php @@ -26,7 +26,6 @@ if ($page_owner->getGUID() == $message->toId) { } elgg_push_breadcrumb($title); -$buttons = ''; $content = elgg_view_entity($message, array('full_view' => true)); if ($inbox) { $form_params = array( @@ -38,12 +37,13 @@ if ($inbox) { $content .= elgg_view_form('messages/reply', $form_params, $body_params); if (elgg_get_logged_in_user_guid() == elgg_get_page_owner_guid()) { - $buttons = elgg_view('output/url', array( + elgg_register_menu_item('title', array( + 'name' => 'reply', + 'href' => '#messages-reply-form', 'text' => elgg_echo('messages:answer'), - 'class' => 'elgg-button elgg-button-action', - 'id' => 'messages-show-reply', + 'link_class' => 'elgg-button elgg-button-action', + 'rel' => 'toggle', )); - $buttons = "<ul class=\"elgg-menu elgg-menu-title\"><li>$buttons</li></ul>"; } } @@ -51,7 +51,6 @@ $body = elgg_view_layout('content', array( 'content' => $content, 'title' => $title, 'filter' => '', - 'buttons' => $buttons, )); echo elgg_view_page($title, $body); diff --git a/mod/messages/pages/messages/send.php b/mod/messages/pages/messages/send.php index 884c20cca..02d430df7 100644 --- a/mod/messages/pages/messages/send.php +++ b/mod/messages/pages/messages/send.php @@ -22,7 +22,6 @@ $body = elgg_view_layout('content', array( 'content' => $content, 'title' => $title, 'filter' => '', - 'buttons' => '', )); echo elgg_view_page($title, $body); diff --git a/mod/messages/pages/messages/sent.php b/mod/messages/pages/messages/sent.php index f884643e0..edf2b29fb 100644 --- a/mod/messages/pages/messages/sent.php +++ b/mod/messages/pages/messages/sent.php @@ -15,6 +15,8 @@ if (!$page_owner) { elgg_push_breadcrumb(elgg_echo('messages:sent')); +elgg_register_add_button(); + $title = elgg_echo('messages:sentmessages', array($page_owner->name)); $list = elgg_list_entities_from_metadata(array( diff --git a/mod/messages/views/default/messages/js.php b/mod/messages/views/default/messages/js.php index 5f6b476e7..39f93e645 100644 --- a/mod/messages/views/default/messages/js.php +++ b/mod/messages/views/default/messages/js.php @@ -3,8 +3,4 @@ $(function() { $("#messages-toggle").click(function() { $('input[type=checkbox]').click(); }); - - $("#messages-show-reply").click(function() { - $('#messages-reply-form').slideToggle('medium'); - }); }); diff --git a/mod/notifications/views/default/forms/notificationsettings/save.php b/mod/notifications/views/default/forms/notificationsettings/save.php index 0306080b8..ff32d8558 100644 --- a/mod/notifications/views/default/forms/notificationsettings/save.php +++ b/mod/notifications/views/default/forms/notificationsettings/save.php @@ -5,4 +5,9 @@ echo elgg_view('notifications/subscriptions/personal'); echo elgg_view('notifications/subscriptions/collections'); -echo elgg_view('notifications/subscriptions/forminternals');
\ No newline at end of file +echo elgg_view('notifications/subscriptions/forminternals'); + +?> +<div class="elgg-foot"> +<?php echo elgg_view('input/submit', array('value' => elgg_echo('save'))); ?> +</div> diff --git a/mod/notifications/views/default/notifications/subscriptions/form.php b/mod/notifications/views/default/notifications/subscriptions/form.php index 008e98554..f2f6238f9 100644 --- a/mod/notifications/views/default/notifications/subscriptions/form.php +++ b/mod/notifications/views/default/notifications/subscriptions/form.php @@ -8,4 +8,4 @@ echo elgg_view('subscriptions/form/additions',$vars); // Display a description -echo elgg_view_form('notificationsettings/save'); +echo elgg_view_form('notificationsettings/save', array('class' => 'elgg-form-alt')); diff --git a/mod/notifications/views/default/notifications/subscriptions/forminternals.php b/mod/notifications/views/default/notifications/subscriptions/forminternals.php index b059db487..106eadc54 100644 --- a/mod/notifications/views/default/notifications/subscriptions/forminternals.php +++ b/mod/notifications/views/default/notifications/subscriptions/forminternals.php @@ -324,12 +324,4 @@ if (!isset($vars['replacement'])) { } ?> - - <div class="elgg-form-footer-alt"> -<?php -echo elgg_view('input/submit', array( - 'value' => elgg_echo('save'), -)); -?> - </p> </div> diff --git a/mod/pages/pages/pages/edit.php b/mod/pages/pages/pages/edit.php index 8e530084b..e6c2ea015 100644 --- a/mod/pages/pages/pages/edit.php +++ b/mod/pages/pages/pages/edit.php @@ -34,7 +34,6 @@ if ($page->canEdit()) { $body = elgg_view_layout('content', array( 'filter' => '', - 'buttons' => '', 'content' => $content, 'title' => $title, )); diff --git a/mod/pages/pages/pages/friends.php b/mod/pages/pages/pages/friends.php index 13aa28578..88f26c45d 100644 --- a/mod/pages/pages/pages/friends.php +++ b/mod/pages/pages/pages/friends.php @@ -13,6 +13,8 @@ if (!$owner) { elgg_push_breadcrumb($owner->name, "pages/owner/$owner->username"); elgg_push_breadcrumb(elgg_echo('friends')); +elgg_register_add_button(); + $title = elgg_echo('pages:friends'); $content = list_user_friends_objects($owner->guid, 'page_top', 10, false); diff --git a/mod/pages/pages/pages/history.php b/mod/pages/pages/pages/history.php index a7ef57b6b..a63b37a7a 100644 --- a/mod/pages/pages/pages/history.php +++ b/mod/pages/pages/pages/history.php @@ -34,7 +34,6 @@ $content = list_annotations($page_guid, 'page', 20, false); $body = elgg_view_layout('content', array( 'filter' => '', - 'buttons' => '', 'content' => $content, 'title' => $title, 'sidebar' => elgg_view('pages/sidebar/navigation', array('page' => $page)), diff --git a/mod/pages/pages/pages/new.php b/mod/pages/pages/pages/new.php index 42a8e04e1..7cab2facb 100644 --- a/mod/pages/pages/pages/new.php +++ b/mod/pages/pages/pages/new.php @@ -30,7 +30,6 @@ $content = elgg_view_form('pages/edit', array(), $vars); $body = elgg_view_layout('content', array( 'filter' => '', - 'buttons' => '', 'content' => $content, 'title' => $title, )); diff --git a/mod/pages/pages/pages/owner.php b/mod/pages/pages/pages/owner.php index c1169085f..312b56a54 100644 --- a/mod/pages/pages/pages/owner.php +++ b/mod/pages/pages/pages/owner.php @@ -17,6 +17,8 @@ $title = elgg_echo('pages:owner', array($owner->name)); elgg_push_breadcrumb($owner->name); +elgg_register_add_button(); + $content = elgg_list_entities(array( 'types' => 'object', 'subtypes' => 'page_top', diff --git a/mod/pages/pages/pages/revision.php b/mod/pages/pages/pages/revision.php index 83d72286c..66a36e4e7 100644 --- a/mod/pages/pages/pages/revision.php +++ b/mod/pages/pages/pages/revision.php @@ -45,7 +45,6 @@ $sidebar = elgg_view('pages/sidebar/history', array('page' => $page)); $body = elgg_view_layout('content', array( 'filter' => '', - 'buttons' => '', 'content' => $content, 'title' => $title, 'sidebar' => $sidebar, diff --git a/mod/pages/pages/pages/view.php b/mod/pages/pages/pages/view.php index 06064d993..5dfb76b55 100644 --- a/mod/pages/pages/pages/view.php +++ b/mod/pages/pages/pages/view.php @@ -32,20 +32,18 @@ elgg_push_breadcrumb($title); $content = elgg_view_entity($page, array('full_view' => true)); $content .= elgg_view_comments($page); -$buttons = ''; if (elgg_get_logged_in_user_guid() == $page->getOwnerGuid()) { $url = "pages/add/$page->guid"; - $buttons = elgg_view('output/url', array( - 'text' => elgg_echo('pages:newchild'), + elgg_register_menu_item('title', array( + 'name' => 'subpage', 'href' => $url, - 'class' => 'elgg-button elgg-button-action', - )); - $buttons = "<ul class=\"elgg-menu elgg-menu-title\"><li>$buttons</li></ul>"; + 'text' => elgg_echo('pages:newchild'), + 'link_class' => 'elgg-button elgg-button-action', + )); } $body = elgg_view_layout('content', array( 'filter' => '', - 'buttons' => $buttons, 'content' => $content, 'title' => $title, 'sidebar' => elgg_view('pages/sidebar/navigation'), diff --git a/mod/pages/pages/pages/world.php b/mod/pages/pages/pages/world.php index 267670144..9237a820e 100644 --- a/mod/pages/pages/pages/world.php +++ b/mod/pages/pages/pages/world.php @@ -10,6 +10,8 @@ $title = elgg_echo('pages:all'); elgg_pop_breadcrumb(); elgg_push_breadcrumb(elgg_echo('pages')); +elgg_register_add_button(); + $content = elgg_list_entities(array( 'types' => 'object', 'subtypes' => 'page_top', diff --git a/mod/thewire/pages/thewire/everyone.php b/mod/thewire/pages/thewire/everyone.php index e3d38ace5..26586c71c 100644 --- a/mod/thewire/pages/thewire/everyone.php +++ b/mod/thewire/pages/thewire/everyone.php @@ -23,7 +23,6 @@ $body = elgg_view_layout('content', array( 'filter_context' => 'all', 'content' => $content, 'title' => $title, - 'buttons' => false, 'sidebar' => elgg_view('thewire/sidebar'), )); diff --git a/mod/thewire/pages/thewire/friends.php b/mod/thewire/pages/thewire/friends.php index ab452aa55..0dfdcada9 100644 --- a/mod/thewire/pages/thewire/friends.php +++ b/mod/thewire/pages/thewire/friends.php @@ -17,7 +17,6 @@ $body = elgg_view_layout('content', array( 'filter_context' => 'friends', 'content' => $content, 'title' => $title, - 'buttons' => false, )); echo elgg_view_page($title, $body); diff --git a/mod/thewire/pages/thewire/owner.php b/mod/thewire/pages/thewire/owner.php index d61307990..6a16ef51d 100644 --- a/mod/thewire/pages/thewire/owner.php +++ b/mod/thewire/pages/thewire/owner.php @@ -27,7 +27,6 @@ $body = elgg_view_layout('content', array( 'filter_context' => 'mine', 'content' => $content, 'title' => $title, - 'buttons' => false, 'sidebar' => elgg_view('thewire/sidebar'), )); diff --git a/mod/thewire/pages/thewire/previous.php b/mod/thewire/pages/thewire/previous.php index 45c1e1095..a3f1cb01c 100644 --- a/mod/thewire/pages/thewire/previous.php +++ b/mod/thewire/pages/thewire/previous.php @@ -15,7 +15,6 @@ $body = elgg_view_layout('content', array( 'filter' => false, 'content' => $body, 'title' => $title, - 'buttons' => false, )); echo elgg_view_page($title, $body);
\ No newline at end of file diff --git a/mod/thewire/pages/thewire/reply.php b/mod/thewire/pages/thewire/reply.php index 826d513b6..a3d3ea017 100644 --- a/mod/thewire/pages/thewire/reply.php +++ b/mod/thewire/pages/thewire/reply.php @@ -22,7 +22,6 @@ $body = elgg_view_layout('content', array( 'filter' => false, 'content' => $content, 'title' => $title, - 'buttons' => false, )); echo elgg_view_page($title, $body); diff --git a/mod/thewire/pages/thewire/tag.php b/mod/thewire/pages/thewire/tag.php index 53f9e9db9..1c88030ec 100644 --- a/mod/thewire/pages/thewire/tag.php +++ b/mod/thewire/pages/thewire/tag.php @@ -30,7 +30,6 @@ $body = elgg_view_layout('content', array( 'filter' => false, 'content' => $content, 'title' => $title, - 'buttons' => false, )); echo elgg_view_page($title, $body); diff --git a/mod/thewire/pages/thewire/thread.php b/mod/thewire/pages/thewire/thread.php index 5c32a8400..ec2709430 100644 --- a/mod/thewire/pages/thewire/thread.php +++ b/mod/thewire/pages/thewire/thread.php @@ -22,7 +22,6 @@ $body = elgg_view_layout('content', array( 'filter' => false, 'content' => $content, 'title' => $title, - 'buttons' => false, )); echo elgg_view_page($title, $body); diff --git a/pages/river.php b/pages/river.php index 7f2fce3d6..fa559d59b 100644 --- a/pages/river.php +++ b/pages/river.php @@ -49,7 +49,6 @@ $sidebar = elgg_view('core/river/sidebar'); $params = array( 'content' => $content . $activity, 'sidebar' => $sidebar, - 'buttons' => '', 'filter_context' => $page_filter, 'class' => 'elgg-river-layout', ); diff --git a/views/default/core/settings/account.php b/views/default/core/settings/account.php index 22a58c58a..0c3792ece 100644 --- a/views/default/core/settings/account.php +++ b/views/default/core/settings/account.php @@ -6,4 +6,4 @@ * @subpackage Core */ -echo elgg_view_form('usersettings/save');
\ No newline at end of file +echo elgg_view_form('usersettings/save', array('class' => 'elgg-form-alt'));
\ No newline at end of file diff --git a/views/default/css/elements/forms.php b/views/default/css/elements/forms.php index af7b2be19..5924b8134 100644 --- a/views/default/css/elements/forms.php +++ b/views/default/css/elements/forms.php @@ -16,9 +16,7 @@ fieldset > div { fieldset > div:last-child { margin-bottom: 0; } -.elgg-form-footer { -} -.elgg-form-footer-alt { +.elgg-form-alt > fieldset > .elgg-foot { border-top: 1px solid #CCC; padding: 10px 0; } diff --git a/views/default/forms/avatar/crop.php b/views/default/forms/avatar/crop.php index 3deec66bd..68b5a69eb 100644 --- a/views/default/forms/avatar/crop.php +++ b/views/default/forms/avatar/crop.php @@ -11,7 +11,7 @@ $master_image = $vars['entity']->getIcon('master'); <div class="clearfix"> <img id="user-avatar" class="mrl" src="<?php echo $master_image; ?>" alt="<?php echo elgg_echo('avatar'); ?>" /> </div> -<div> +<div class="elgg-foot"> <?php $coords = array('x1', 'x2', 'y1', 'y2'); foreach ($coords as $coord) { diff --git a/views/default/forms/avatar/upload.php b/views/default/forms/avatar/upload.php index b099b8c4c..d91e8575e 100644 --- a/views/default/forms/avatar/upload.php +++ b/views/default/forms/avatar/upload.php @@ -10,7 +10,7 @@ <label><?php echo elgg_echo("avatar:upload"); ?></label><br /> <?php echo elgg_view("input/file",array('name' => 'avatar')); ?> </div> -<div class="elgg-form-footer"> +<div class="elgg-foot"> <?php echo elgg_view('input/hidden', array('name' => 'guid', 'value' => $vars['entity']->guid)); ?> <?php echo elgg_view('input/submit', array('value' => elgg_echo('upload'))); ?> </div> diff --git a/views/default/forms/comments/add.php b/views/default/forms/comments/add.php index 40e574338..9acabf3ea 100644 --- a/views/default/forms/comments/add.php +++ b/views/default/forms/comments/add.php @@ -22,7 +22,7 @@ if (isset($vars['entity']) && elgg_is_logged_in()) { <label><?php echo elgg_echo("generic_comments:add"); ?></label> <?php echo elgg_view('input/longtext', array('name' => 'generic_comment')); ?> </div> - <div> + <div class="elgg-foot"> <?php echo elgg_view('input/submit', array('value' => elgg_echo("generic_comments:post"))); ?> diff --git a/views/default/forms/friends/collections/add.php b/views/default/forms/friends/collections/add.php index 644c7adb9..04c87346b 100644 --- a/views/default/forms/friends/collections/add.php +++ b/views/default/forms/friends/collections/add.php @@ -42,7 +42,7 @@ echo elgg_view('input/friendspicker', array( )); echo "</div>"; -echo "<div>"; +echo '<div class="elgg-foot">'; if (isset($vars['collection'])) { echo elgg_view('input/hidden', array( 'name' => 'collection_id', @@ -50,4 +50,4 @@ if (isset($vars['collection'])) { )); } echo elgg_view('input/submit', array('name' => 'submit', 'value' => elgg_echo('save'))); -echo "</div>"; +echo '</div>'; diff --git a/views/default/forms/plugins/settings/save.php b/views/default/forms/plugins/settings/save.php index efe6d7792..c3d8f231f 100644 --- a/views/default/forms/plugins/settings/save.php +++ b/views/default/forms/plugins/settings/save.php @@ -24,8 +24,8 @@ if (elgg_view_exists("{$type}settings/$plugin_id/edit")) { echo elgg_view("plugins/$plugin_id/{$type}settings", $vars); } -echo "<div>"; +echo '<div class="elgg-foot">'; echo elgg_view('input/hidden', array('name' => 'plugin_id', 'value' => $plugin_id)); echo elgg_view('input/hidden', array('name' => 'user_guid', 'value' => $user_guid)); echo elgg_view('input/submit', array('value' => elgg_echo('save'))); -echo "</div>"; +echo '</div>'; diff --git a/views/default/forms/profile/edit.php b/views/default/forms/profile/edit.php index aaf9ac01e..222935344 100644 --- a/views/default/forms/profile/edit.php +++ b/views/default/forms/profile/edit.php @@ -59,7 +59,7 @@ if (is_array($profile_fields) && count($profile_fields) > 0) { } } ?> -<div> +<div class="elgg-foot"> <?php echo elgg_view('input/hidden', array('name' => 'guid', 'value' => $vars['entity']->guid)); echo elgg_view('input/submit', array('value' => elgg_echo('save'))); diff --git a/views/default/forms/user/requestnewpassword.php b/views/default/forms/user/requestnewpassword.php index 970938327..22357e728 100644 --- a/views/default/forms/user/requestnewpassword.php +++ b/views/default/forms/user/requestnewpassword.php @@ -15,7 +15,7 @@ <?php echo elgg_view('input/text', array('name' => 'username')); ?> </div> <?php echo elgg_view('input/captcha'); ?> -<div> +<div class="elgg-foot"> <?php echo elgg_view('input/submit', array('value' => elgg_echo('request'))); ?> </div> <?php //@todo JS 1.8: no ?> diff --git a/views/default/forms/useradd.php b/views/default/forms/useradd.php index fcb93a6c6..66f8846e2 100644 --- a/views/default/forms/useradd.php +++ b/views/default/forms/useradd.php @@ -80,6 +80,6 @@ if ($admin_option) { } ?> -<div> +<div class="elgg-foot"> <?php echo elgg_view('input/submit', array('value' => elgg_echo('register'))); ?> </div>
\ No newline at end of file diff --git a/views/default/forms/usersettings/save.php b/views/default/forms/usersettings/save.php index 35871144b..ea53f2571 100644 --- a/views/default/forms/usersettings/save.php +++ b/views/default/forms/usersettings/save.php @@ -1,7 +1,7 @@ <?php $form_body = elgg_view("forms/account/settings"); -$form_body .= '<div class="elgg-form-footer-alt">'; +$form_body .= '<div class="elgg-foot">'; $form_body .= elgg_view('input/submit', array('value' => elgg_echo('save'))); $form_body .= '</div>'; diff --git a/views/default/forms/widgets/save.php b/views/default/forms/widgets/save.php index aeef37429..4ba911cb5 100644 --- a/views/default/forms/widgets/save.php +++ b/views/default/forms/widgets/save.php @@ -32,7 +32,7 @@ $body = <<<___END <div> $access </div> - <div> + <div class="elgg-foot"> $hidden $submit </div> diff --git a/views/default/input/form.php b/views/default/input/form.php index 6d5824cd8..df30133b3 100644 --- a/views/default/input/form.php +++ b/views/default/input/form.php @@ -1,14 +1,17 @@ <?php /** * Create a form for data submission. - * Use this view for forms rather than creating a form tag in the wild as it provides - * extra security which help prevent CSRF attacks. + * Use this view for forms as it provides protection against CSRF attacks. * * @package Elgg * @subpackage Core * * @uses $vars['body'] The body of the form (made up of other input/xxx views and html + * @uses $vars['action'] The action URL of the form + * @uses $vars['method'] The submit method: post (default) or get + * @uses $vars['enctype'] Set to 'multipart/form-data' if uploading a file * @uses $vars['disable_security'] turn off CSRF security by setting to true + * @uses $vars['class'] Additional class for the form */ $defaults = array( @@ -18,6 +21,12 @@ $defaults = array( $vars = array_merge($defaults, $vars); +if (isset($vars['class'])) { + $vars['class'] = "elgg-form {$vars['class']}"; +} else { + $vars['class'] = 'elgg-form'; +} + $vars['action'] = elgg_normalize_url($vars['action']); $vars['method'] = strtolower($vars['method']); @@ -32,4 +41,4 @@ unset($vars['disable_security']); $attributes = elgg_format_attributes($vars); -echo "<form $attributes><fieldset>$body</fieldset></form>";
\ No newline at end of file +echo "<form $attributes><fieldset>$body</fieldset></form>"; diff --git a/views/default/page/layouts/content.php b/views/default/page/layouts/content.php index 35d695f0a..c406c9faf 100644 --- a/views/default/page/layouts/content.php +++ b/views/default/page/layouts/content.php @@ -10,7 +10,6 @@ * @uses $vars['filter'] HTML of the content area filter (override) * @uses $vars['title'] Title text (override) * @uses $vars['context'] Page context (override) - * @uses $vars['buttons'] Content header buttons (override) * @uses $vars['filter_context'] Filter context: everyone, friends, mine * @uses $vars['class'] Additional class to apply to layout */ diff --git a/views/default/page/layouts/content/header.php b/views/default/page/layouts/content/header.php index 403da8a0a..345163bdd 100644 --- a/views/default/page/layouts/content/header.php +++ b/views/default/page/layouts/content/header.php @@ -7,9 +7,13 @@ * @uses $vars['header_override'] HTML for overriding the default header (override) * @uses $vars['title'] Title text (override) * @uses $vars['context'] Page context (override) - * @uses $vars['buttons'] Content header buttons (override) */ +if (isset($vars['buttons'])) { + // it was a bad idea to implement buttons with a pass through + elgg_deprecated_notice("Use elgg_register_menu_item() to register for the title menu", 1.0); +} + if (isset($vars['header_override'])) { echo $vars['header_override']; return true; @@ -22,27 +26,13 @@ if ($context) { $title = elgg_echo($context); } - if (isset($vars['buttons'])) { + if (isset($vars['buttons']) && $vars['buttons']) { $buttons = $vars['buttons']; } else { - if (elgg_is_logged_in() && $context) { - $owner = elgg_get_page_owner_entity(); - if (!$owner) { - // this is probably an all page - $owner = elgg_get_logged_in_user_entity(); - } - if ($owner && $owner->canWriteToContainer()) { - $guid = $owner->getGUID(); - elgg_register_menu_item('title', array( - 'name' => 'add', - 'href' => elgg_extract('new_link', $vars, "$context/add/$guid"), - 'text' => elgg_echo("$context:add"), - 'link_class' => 'elgg-button elgg-button-action', - )); - } - } - - $buttons = elgg_view_menu('title', array('sort_by' => 'priority', 'class' => 'elgg-menu-hz')); + $buttons = elgg_view_menu('title', array( + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', + )); } echo <<<HTML <div class="elgg-head clearfix"> |