aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/lib/navigation.php35
-rw-r--r--mod/blog/lib/blog.php6
-rw-r--r--mod/bookmarks/pages/bookmarks/add.php1
-rw-r--r--mod/bookmarks/pages/bookmarks/all.php2
-rw-r--r--mod/bookmarks/pages/bookmarks/bookmarklet.php2
-rw-r--r--mod/bookmarks/pages/bookmarks/edit.php1
-rw-r--r--mod/bookmarks/pages/bookmarks/friends.php2
-rw-r--r--mod/bookmarks/pages/bookmarks/owner.php2
-rw-r--r--mod/file/pages/file/edit.php1
-rw-r--r--mod/file/pages/file/friends.php1
-rw-r--r--mod/file/pages/file/owner.php5
-rw-r--r--mod/file/pages/file/search.php1
-rw-r--r--mod/file/pages/file/upload.php1
-rw-r--r--mod/file/pages/file/view.php8
-rw-r--r--mod/file/pages/file/world.php2
-rw-r--r--mod/groups/lib/discussion.php9
-rw-r--r--mod/groups/lib/groups.php64
-rw-r--r--mod/groups/views/default/groups/profile/buttons.php57
-rw-r--r--mod/members/pages/members/index.php1
-rw-r--r--mod/messageboard/pages/messageboard/owner.php1
-rw-r--r--mod/messages/pages/messages/inbox.php2
-rw-r--r--mod/messages/pages/messages/read.php11
-rw-r--r--mod/messages/pages/messages/send.php1
-rw-r--r--mod/messages/pages/messages/sent.php2
-rw-r--r--mod/messages/views/default/messages/js.php4
-rw-r--r--mod/pages/pages/pages/edit.php1
-rw-r--r--mod/pages/pages/pages/friends.php2
-rw-r--r--mod/pages/pages/pages/history.php1
-rw-r--r--mod/pages/pages/pages/new.php1
-rw-r--r--mod/pages/pages/pages/owner.php2
-rw-r--r--mod/pages/pages/pages/revision.php1
-rw-r--r--mod/pages/pages/pages/view.php12
-rw-r--r--mod/pages/pages/pages/world.php2
-rw-r--r--mod/thewire/pages/thewire/everyone.php1
-rw-r--r--mod/thewire/pages/thewire/friends.php1
-rw-r--r--mod/thewire/pages/thewire/owner.php1
-rw-r--r--mod/thewire/pages/thewire/previous.php1
-rw-r--r--mod/thewire/pages/thewire/reply.php1
-rw-r--r--mod/thewire/pages/thewire/tag.php1
-rw-r--r--mod/thewire/pages/thewire/thread.php1
-rw-r--r--pages/river.php1
-rw-r--r--views/default/page/layouts/content.php1
-rw-r--r--views/default/page/layouts/content/header.php30
43 files changed, 145 insertions, 138 deletions
diff --git a/engine/lib/navigation.php b/engine/lib/navigation.php
index 4b2c998a2..1cb289654 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..d13b2244e 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,7 +256,6 @@ function blog_get_page_content_edit($page, $guid = 0, $revision = NULL) {
elgg_load_js('elgg.blog');
$return = array(
- 'buttons' => '',
'filter' => '',
);
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..c47ad0ab2 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);
@@ -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/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/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/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">