aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-17 03:52:00 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-17 03:52:00 +0000
commit52c1eea1c0dd1f73c7d21d91198c418b47cbcec5 (patch)
tree28b717bbfdac9e91531daf05d93a9b49e435a25a
parent5a9dfa444ec1807b7b73b9e86fe219a0055731c3 (diff)
downloadelgg-52c1eea1c0dd1f73c7d21d91198c418b47cbcec5.tar.gz
elgg-52c1eea1c0dd1f73c7d21d91198c418b47cbcec5.tar.bz2
Fixes #2680: Added group support to bookmarks plugin.
git-svn-id: http://code.elgg.org/elgg/trunk@8269 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--mod/bookmarks/lib/bookmarks.php2
-rw-r--r--mod/bookmarks/pages/add.php2
-rw-r--r--mod/bookmarks/pages/edit.php3
-rw-r--r--mod/bookmarks/pages/owner.php20
-rw-r--r--mod/bookmarks/start.php8
5 files changed, 24 insertions, 11 deletions
diff --git a/mod/bookmarks/lib/bookmarks.php b/mod/bookmarks/lib/bookmarks.php
index 3ffda737d..815330e2c 100644
--- a/mod/bookmarks/lib/bookmarks.php
+++ b/mod/bookmarks/lib/bookmarks.php
@@ -6,7 +6,7 @@
*/
/**
- * Prepare the upload/edit form variables
+ * Prepare the add/edit form variables
*
* @param ElggObject $bookmark A bookmark object.
* @return array
diff --git a/mod/bookmarks/pages/add.php b/mod/bookmarks/pages/add.php
index 77b9a0bd0..c748daca5 100644
--- a/mod/bookmarks/pages/add.php
+++ b/mod/bookmarks/pages/add.php
@@ -5,8 +5,6 @@
* @package Bookmarks
*/
-gatekeeper();
-
$bookmark_guid = get_input('guid');
$bookmark = get_entity($bookmark_guid);
$container_guid = (int) get_input('container_guid');
diff --git a/mod/bookmarks/pages/edit.php b/mod/bookmarks/pages/edit.php
index 1c74a592a..7b055e699 100644
--- a/mod/bookmarks/pages/edit.php
+++ b/mod/bookmarks/pages/edit.php
@@ -5,13 +5,12 @@
* @package ElggBookmarks
*/
-gatekeeper();
$bookmark_guid = get_input('guid');
$bookmark = get_entity($bookmark_guid);
$container_guid = (int) get_input('container_guid');
$container = get_entity($container_guid);
-if (!elgg_instanceof($bookmark, 'object', 'bookmarks')) {
+if (!elgg_instanceof($bookmark, 'object', 'bookmarks') || !$bookmark->canEdit()) {
register_error(elgg_echo('bookmarks:unknown_bookmark'));
forward(REFERRER);
}
diff --git a/mod/bookmarks/pages/owner.php b/mod/bookmarks/pages/owner.php
index 2216b593f..c11d6628e 100644
--- a/mod/bookmarks/pages/owner.php
+++ b/mod/bookmarks/pages/owner.php
@@ -5,11 +5,10 @@
* @package Bookmarks
*/
+$guid = get_input('guid');
+
+elgg_set_page_owner_guid($guid);
$page_owner = elgg_get_page_owner_entity();
-if (!$page_owner) {
- $page_owner = elgg_get_logged_in_user_guid();
- elgg_set_page_owner_guid($page_owner);
-}
elgg_push_breadcrumb($page_owner->name);
@@ -17,17 +16,26 @@ $offset = (int)get_input('offset', 0);
$content .= elgg_list_entities(array(
'type' => 'object',
'subtype' => 'bookmarks',
- 'owner_guid' => $page_owner->guid,
+ 'container_guid' => $page_owner->guid,
'limit' => 10,
'offset' => $offset,
'full_view' => false,
'view_toggle_type' => false
));
+if (!$content) {
+ $content = elgg_echo('bookmarks:none');
+}
+
$title = elgg_echo('bookmarks:owner', array($page_owner->name));
+$filter_context = '';
+if ($page_owner->getGUID() == elgg_get_logged_in_user_guid()) {
+ $filter_context = 'mine';
+}
+
$body = elgg_view_layout('content', array(
- 'filter_context' => 'mine',
+ 'filter_context' => $filter_context,
'content' => $content,
'title' => $title
));
diff --git a/mod/bookmarks/start.php b/mod/bookmarks/start.php
index 90dd89f18..00a640644 100644
--- a/mod/bookmarks/start.php
+++ b/mod/bookmarks/start.php
@@ -117,15 +117,23 @@ function bookmarks_page_handler($page) {
break;
case "add":
+ gatekeeper();
set_input('container_guid', $page[1]);
include "$pages/add.php";
break;
case "edit":
+ gatekeeper();
set_input('guid', $page[1]);
include "$pages/edit.php";
break;
+ case 'group':
+ group_gatekeeper();
+ set_input('guid', $page[1]);
+ include "$pages/owner.php";
+ break;
+
case "bookmarklet":
set_input('container_guid', $page[1]);
include "$pages/bookmarklet.php";