aboutsummaryrefslogtreecommitdiff
path: root/mod/bookmarks
diff options
context:
space:
mode:
Diffstat (limited to 'mod/bookmarks')
-rw-r--r--mod/bookmarks/actions/add.php49
-rw-r--r--mod/bookmarks/actions/bookmarks/add.php82
-rw-r--r--mod/bookmarks/actions/bookmarks/delete.php29
-rw-r--r--[-rwxr-xr-x]mod/bookmarks/actions/bookmarks/edit.php (renamed from mod/bookmarks/actions/edit.php)0
-rw-r--r--mod/bookmarks/actions/delete.php20
-rwxr-xr-xmod/bookmarks/actions/reference.php34
-rwxr-xr-xmod/bookmarks/actions/remove.php34
-rw-r--r--mod/bookmarks/bookmarklet.php10
-rw-r--r--mod/bookmarks/languages/en.php69
-rw-r--r--mod/bookmarks/pages/add.php36
-rw-r--r--mod/bookmarks/pages/all.php36
-rw-r--r--mod/bookmarks/pages/friends.php33
-rw-r--r--mod/bookmarks/pages/inbox.php28
-rw-r--r--mod/bookmarks/pages/owner.php39
-rw-r--r--mod/bookmarks/pages/view.php36
-rw-r--r--mod/bookmarks/start.php303
-rw-r--r--mod/bookmarks/views/default/bookmarks/bookmarklet.php2
-rw-r--r--mod/bookmarks/views/default/bookmarks/css.php46
-rw-r--r--mod/bookmarks/views/default/bookmarks/form.php204
-rwxr-xr-xmod/bookmarks/views/default/bookmarks/group_bookmarks.php35
-rw-r--r--mod/bookmarks/views/default/bookmarks/groupprofile_bookmarks.php34
-rw-r--r--mod/bookmarks/views/default/bookmarks/owner_block.php10
-rw-r--r--mod/bookmarks/views/default/bookmarks/sharing.php80
-rwxr-xr-xmod/bookmarks/views/default/bookmarks/stats.php7
-rw-r--r--mod/bookmarks/views/default/object/bookmarks.php173
-rw-r--r--mod/bookmarks/views/default/river/object/bookmarks/annotate.php10
-rw-r--r--mod/bookmarks/views/default/river/object/bookmarks/create.php39
-rw-r--r--mod/bookmarks/views/default/widgets/bookmarks/view.php86
-rw-r--r--mod/bookmarks/views/rss/object/bookmarks.php27
29 files changed, 853 insertions, 738 deletions
diff --git a/mod/bookmarks/actions/add.php b/mod/bookmarks/actions/add.php
deleted file mode 100644
index b17ce76a4..000000000
--- a/mod/bookmarks/actions/add.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-/**
- * Elgg bookmarks add/save action
- *
- * @package ElggBookmarks
- */
-
-//set some required variables
-$title = strip_tags(get_input('title'));
-$address = get_input('address');
-$notes = get_input('notes');
-$access = get_input('access');
-$tags = get_input('tags');
-$tagarray = string_to_tag_array($tags);
-
-if (!$title || !$address) {
- register_error(elgg_echo('bookmarks:save:failed'));
- forward(REFERER);
-}
-
-// don't allow malicious code.
-// put this in a context of a link so HTMLawed knows how to filter correctly.
-$xss_test = "<a href=\"$address\"></a>";
-if ($xss_test != filter_tags($xss_test)) {
- register_error(elgg_echo('bookmarks:save:failed'));
- forward(REFERER);
-}
-
-//create a new bookmark object
-$entity = new ElggObject;
-$entity->subtype = "bookmarks";
-$entity->owner_guid = get_loggedin_userid();
-$entity->container_guid = (int)get_input('container_guid', get_loggedin_userid());
-$entity->title = $title;
-$entity->description = $notes;
-$entity->address = $address;
-$entity->access_id = $access;
-$entity->link_version = create_wire_url_code();//returns a random code in the form {{L:1hp56}}
-$entity->tags = $tagarray;
-
-if ($entity->save()) {
- system_message(elgg_echo('bookmarks:save:success'));
- //add to river
- add_to_river('river/object/bookmarks/create','create',get_loggedin_userid(),$entity->guid);
-} else {
- register_error(elgg_echo('bookmarks:save:failed'));
-}
-$account = get_entity((int)get_input('container_guid', get_loggedin_userid()));
-forward("pg/bookmarks/" . $account->username); \ No newline at end of file
diff --git a/mod/bookmarks/actions/bookmarks/add.php b/mod/bookmarks/actions/bookmarks/add.php
new file mode 100644
index 000000000..7d8204ca5
--- /dev/null
+++ b/mod/bookmarks/actions/bookmarks/add.php
@@ -0,0 +1,82 @@
+<?php
+/**
+* Elgg bookmarks add/save action
+*
+* @package ElggBookmarks
+*/
+
+gatekeeper();
+
+$title = strip_tags(get_input('title'));
+$guid = get_input('bookmark_guid',0);
+$description = get_input('description');
+$address = get_input('address');
+$access = get_input('access');
+$shares = get_input('shares',array());
+
+if (!$title || !$address) {
+ register_error(elgg_echo('bookmarks:save:failed'));
+ forward(REFERER);
+}
+
+// don't allow malicious code.
+// put this in a context of a link so HTMLawed knows how to filter correctly.
+$xss_test = "<a href=\"$address\"></a>";
+if ($xss_test != filter_tags($xss_test)) {
+ register_error(elgg_echo('bookmarks:save:failed'));
+ forward(REFERER);
+}
+
+$tags = get_input('tags');
+$tagarray = string_to_tag_array($tags);
+
+$new_bookmark = FALSE;
+if ($guid == 0) {
+ $entity = new ElggObject;
+ $entity->subtype = "bookmarks";
+ $entity->owner_guid = $_SESSION['user']->getGUID();
+ $entity->container_guid = (int)get_input('container_guid', $_SESSION['user']->getGUID());
+
+ $new_bookmark = TRUE;
+
+} else {
+
+ $canedit = false;
+ if ($entity = get_entity($guid)) {
+ if ($entity->canEdit()) {
+ $canedit = true;
+ }
+ }
+ if (!$canedit) {
+ system_message(elgg_echo('notfound'));
+ forward("pg/bookmarks");
+ }
+
+}
+
+$entity->title = $title;
+$entity->address = $address;
+$entity->description = $description;
+$entity->access_id = $access;
+$entity->tags = $tagarray;
+
+if ($entity->save()) {
+ $entity->clearRelationships();
+ $entity->shares = $shares;
+
+ if (is_array($shares) && sizeof($shares) > 0) {
+ foreach($shares as $share) {
+ $share = (int) $share;
+ add_entity_relationship($entity->getGUID(), 'share', $share);
+ }
+ }
+ system_message(elgg_echo('bookmarks:save:success'));
+ //add to river
+ if ($new_bookmark) {
+ add_to_river('river/object/bookmarks/create','create',$_SESSION['user']->guid,$entity->guid);
+ }
+ forward($entity->getURL());
+} else {
+ register_error(elgg_echo('bookmarks:save:failed'));
+ forward("pg/bookmarks");
+}
diff --git a/mod/bookmarks/actions/bookmarks/delete.php b/mod/bookmarks/actions/bookmarks/delete.php
new file mode 100644
index 000000000..48b4a2dd8
--- /dev/null
+++ b/mod/bookmarks/actions/bookmarks/delete.php
@@ -0,0 +1,29 @@
+<?php
+
+ /**
+ * Elgg bookmarks delete action
+ *
+ * @package ElggBookmarks
+ */
+
+ $guid = get_input('bookmark_guid',0);
+ if ($entity = get_entity($guid)) {
+
+ $container = get_entity($entity->container_guid);
+ if ($entity->canEdit()) {
+
+ if ($entity->delete()) {
+
+ system_message(elgg_echo("bookmarks:delete:success"));
+ forward("pg/bookmarks/owner/$container->username/");
+
+ }
+
+ }
+
+ }
+
+ register_error(elgg_echo("bookmarks:delete:failed"));
+ forward(REFERER);
+
+?> \ No newline at end of file
diff --git a/mod/bookmarks/actions/edit.php b/mod/bookmarks/actions/bookmarks/edit.php
index 87de1c5e2..87de1c5e2 100755..100644
--- a/mod/bookmarks/actions/edit.php
+++ b/mod/bookmarks/actions/bookmarks/edit.php
diff --git a/mod/bookmarks/actions/delete.php b/mod/bookmarks/actions/delete.php
deleted file mode 100644
index 23de80146..000000000
--- a/mod/bookmarks/actions/delete.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-/**
- * Elgg bookmarks delete action
- *
- * @package ElggBookmarks
- */
-
-$guid = get_input('bookmark_guid',0);
-if ($entity = get_entity($guid)) {
- if ($entity->canEdit()) {
- $container = get_entity($entity->container_guid);
- if ($entity->delete()) {
- system_message(elgg_echo("bookmarks:delete:success"));
- forward("pg/bookmarks/$container->username/");
- }
- }
-}
-
-register_error(elgg_echo("bookmarks:delete:failed"));
-forward(REFERER); \ No newline at end of file
diff --git a/mod/bookmarks/actions/reference.php b/mod/bookmarks/actions/reference.php
deleted file mode 100755
index 515ac1ed1..000000000
--- a/mod/bookmarks/actions/reference.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-/**
- * Elgg bookmarks add as reference
- * Guid one is the object, guid two is the bookmark, 'reference' is the relationship name
- */
-
-//set some variables
-$object_guid = get_input('object_guid');
-$bookmark_guid = get_input('reference');
-$object = get_entity($object_guid);
-$bookmark = get_entity($bookmark_guid);
-//check both the object and bookmark exist
-if($bookmark && $object){
- //check the user can add a reference
- if($object->canEdit()){
- //create a relationship between the object and bookmark
- if(add_entity_relationship($object_guid, "reference", $bookmark_guid)){
- // Success message
- system_message(elgg_echo("bookmarks:referenceadded"));
- }else{
- // Failure message
- system_message(elgg_echo("bookmarks:referenceerror"));
- }
- }else{
- // Failure message
- system_message(elgg_echo("bookmarks:referenceerror"));
- }
-}else{
- // Failure message
- system_message(elgg_echo("bookmarks:referenceerror"));
-}
-
-forward($object->getURL()); \ No newline at end of file
diff --git a/mod/bookmarks/actions/remove.php b/mod/bookmarks/actions/remove.php
deleted file mode 100755
index f704a5cc3..000000000
--- a/mod/bookmarks/actions/remove.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-/**
- * Elgg bookmarks remove a reference
- * Guid one is the object, guid two is the bookmark, 'reference' is the relationship name
- */
-
-//set some variables
-$object_guid = get_input('object_guid');
-$bookmark_guid = get_input('bookmark');
-$object = get_entity($object_guid);
-$bookmark = get_entity($bookmark_guid);
-//check both the object and bookmark exist
-if($bookmark && $object){
- //check the user can add a reference
- if($object->canEdit()){
- //remove the relationship between the object and bookmark
- if(remove_entity_relationship($object_guid, "reference", $bookmark_guid)){
- // Success message
- system_message(elgg_echo("bookmarks:removed"));
- }else{
- // Failure message
- system_message(elgg_echo("bookmarks:removederror"));
- }
- }else{
- // Failure message
- system_message(elgg_echo("bookmarks:removederror"));
- }
-}else{
- // Failure message
- system_message(elgg_echo("bookmarks:removederror"));
-}
-
-forward($object->getURL()); \ No newline at end of file
diff --git a/mod/bookmarks/bookmarklet.php b/mod/bookmarks/bookmarklet.php
index 8f97905f9..cfd03ac67 100644
--- a/mod/bookmarks/bookmarklet.php
+++ b/mod/bookmarks/bookmarklet.php
@@ -1,16 +1,16 @@
<?php
/**
- * Elgg bookmarks plugin bookmarklet page
- *
- * @package ElggBookmarks
- */
+* Elgg bookmarks plugin bookmarklet page
+*
+* @package ElggBookmarks
+*/
// Start engine
require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
gatekeeper();
-
+
// Get the current page's owner
$page_owner = elgg_get_page_owner_entity();
if ($page_owner === false || is_null($page_owner) && (get_loggedin_user())) {
diff --git a/mod/bookmarks/languages/en.php b/mod/bookmarks/languages/en.php
index 6e0ebc8f1..91f07d69b 100644
--- a/mod/bookmarks/languages/en.php
+++ b/mod/bookmarks/languages/en.php
@@ -5,69 +5,60 @@ $english = array(
/**
* Menu items and titles
*/
-
'bookmarks' => "Bookmarks",
- 'bookmarks:add' => "Bookmark something",
- 'bookmarks:read' => "Bookmark list",
+ 'bookmarks:add' => "Add bookmark",
+ 'bookmarks:owner' => "%s's bookmarks",
'bookmarks:friends' => "Friends' bookmarks",
- 'bookmarks:all' => "All site bookmarks",
- 'bookmarks:user' => "%s's bookmarks",
- 'bookmarks:group' => "Group bookmarks",
+ 'bookmarks:everyone' => "All site bookmarks",
'bookmarks:this' => "Bookmark this",
- 'bookmarks:ingroup' => "in the group",
'bookmarks:this:group' => "Bookmark in %s",
'bookmarks:bookmarklet' => "Get bookmarklet",
- 'bookmarks:bookmarklet:group' => "Get community bookmarklet",
- 'bookmarks:browser_bookmarklet' => 'Browser Bookmarklet',
+ 'bookmarks:bookmarklet:group' => "Get group bookmarklet",
'bookmarks:inbox' => "Bookmarks inbox",
- 'bookmarks:more' => "View note",
- 'bookmarks:yours' => "My bookmarks",
+ 'bookmarks:morebookmarks' => "More bookmarks",
+ 'bookmarks:more' => "More",
'bookmarks:shareditem' => "Bookmarked item",
'bookmarks:with' => "Share with",
- 'bookmarks:new' => "Add a Bookmark",
+ 'bookmarks:new' => "A new bookmarked item",
'bookmarks:via' => "via bookmarks",
'bookmarks:address' => "Address of the resource to bookmark",
- 'bookmarks:addnote' => "Add a note",
+ 'bookmarks:none' => 'No bookmarks',
+
'bookmarks:delete:confirm' => "Are you sure you want to delete this resource?",
- 'bookmarks:url' => 'URL',
+
'bookmarks:numbertodisplay' => 'Number of bookmarked items to display',
- 'bookmarks:edit:success' => "Bookmark successfully edited",
- 'bookmarks:edit:fail' => "There was a problem editing that bookmark, please try again.",
+
'bookmarks:shared' => "Bookmarked",
'bookmarks:visit' => "Visit resource",
'bookmarks:recent' => "Recent bookmarks",
- 'bookmarks:stats' => "Bookmark stats",
- 'bookmarks:resources' => "resources bookmarked",
- 'bookmarks:river:create' => 'bookmarked',
+
+ 'bookmarks:river:created' => '%s bookmarked',
+ 'bookmarks:river:annotate' => 'a comment on this bookmarked item',
+ 'bookmarks:river:item' => 'an item',
'item:object:bookmarks' => 'Bookmarked items',
- 'bookmarks:enablebookmarks' => 'Enable group bookmarks',
- 'bookmarks:referenceadded' => 'You have added that bookmark as a reference',
- 'bookmarks:referenceerror' => 'There was a problem adding that bookmark as a reference',
- 'bookmarks:none' => 'You don\'t have any bookmarks',
- 'bookmarks:addref' => 'Add a reference',
- 'bookmarks:removed' => 'You have now removed that reference',
- 'bookmarks:removederror' => ' There was a problem removing that reference',
- 'bookmarks:remove:confirm' => 'Are you sure you want to remove this reference?',
+ 'bookmarks:group' => 'Group bookmarks',
+ 'groups:enablebookmarks' => 'Enable group bookmarks',
+ 'bookmarks:nogroup' => 'This group does not have any bookmarks yet',
+ 'bookmarks:more' => 'More bookmarks',
+
+ 'bookmarks:no_title' => 'No title',
/**
- * More text
+ * Widget and bookmarklet
*/
-
'bookmarks:widget:description' =>
- "This widget displays your latest bookmarks.",
+ "This widget displays your latest bookmarks.",
'bookmarks:bookmarklet:description' =>
- "The bookmarklet allows you to share a url with your friends, or just bookmark it for yourself. To use it, simply drag the button above to your browser's links bar.",
+ "The bookmarks bookmarklet allows you to share any resource you find on the web with your friends, or just bookmark it for yourself. To use it, simply drag the following button to your browser's links bar:",
- 'bookmarks:bookmarklet:descriptionie' =>
- "If you are using Internet Explorer, you will need to right click on the bookmarklet icon, and select 'add to favorites', and then the Links bar.",
+ 'bookmarks:bookmarklet:descriptionie' =>
+ "If you are using Internet Explorer, you will need to right click on the bookmarklet icon, select 'add to favorites', and then the Links bar.",
'bookmarks:bookmarklet:description:conclusion' =>
- "You can then bookmark any webpage you visit by clicking the button in your browsers toolbar.",
-
- 'bookmarks:no_title' => 'No title',
+ "You can then save any page you visit by clicking it at any time.",
/**
* Status messages
@@ -81,9 +72,7 @@ $english = array(
*/
'bookmarks:save:failed' => "Your bookmarked item could not be saved. Make sure you've entered a title and address and then try again.",
- 'bookmarks:delete:failed' => "Your bookmarked item could not be deleted.",
-
-
+ 'bookmarks:delete:failed' => "Your bookmarked item could not be deleted. Please try again.",
);
-add_translation("en", $english); \ No newline at end of file
+add_translation('en', $english); \ No newline at end of file
diff --git a/mod/bookmarks/pages/add.php b/mod/bookmarks/pages/add.php
new file mode 100644
index 000000000..17e1e6fa4
--- /dev/null
+++ b/mod/bookmarks/pages/add.php
@@ -0,0 +1,36 @@
+<?php
+
+/**
+ * Elgg bookmarks plugin add bookmark page
+ *
+ * @package ElggBookmarks
+ */
+
+gatekeeper();
+
+// Get the current page's owner
+$page_owner = page_owner_entity();
+if ($page_owner === false || is_null($page_owner)) {
+ $page_owner = $_SESSION['user'];
+ set_page_owner($page_owner->getGUID());
+}
+if ($page_owner instanceof ElggGroup)
+ $container = $page_owner->guid;
+
+$area2 .= elgg_view_title(elgg_echo('bookmarks:this'), false);
+
+// If we've been given a bookmark to edit, grab it
+if ($this_guid = get_input('bookmark',0)) {
+ $entity = get_entity($this_guid);
+ if ($entity->canEdit()) {
+ $area2 .= elgg_view('bookmarks/form',array('entity' => $entity, 'container_guid' => $container));
+ }
+} else {
+ $area2 .= elgg_view('bookmarks/form', array('container_guid' => $container));
+}
+
+// Format page
+$body = elgg_view_layout('two_column_left_sidebar', $area1, $area2);
+
+// Draw it
+page_draw(elgg_echo('bookmarks:add'),$body);
diff --git a/mod/bookmarks/pages/all.php b/mod/bookmarks/pages/all.php
new file mode 100644
index 000000000..2bde462ba
--- /dev/null
+++ b/mod/bookmarks/pages/all.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Elgg bookmarks plugin everyone page
+ *
+ * @package ElggBookmarks
+ */
+
+elgg_push_context('bookmarks');
+elgg_push_breadcrumb(elgg_echo('bookmarks'));
+
+$page_owner = elgg_get_page_owner_entity();
+if (!$page_owner) {
+ $page_owner = get_loggedin_userid();
+ elgg_set_page_owner_guid($page_owner);
+}
+
+$offset = (int)get_input('offset', 0);
+$content .= elgg_list_entities(array(
+ 'type' => 'object',
+ 'subtype' => 'bookmarks',
+ 'limit' => 10,
+ 'offset' => $offset,
+ 'full_view' => false,
+ 'view_toggle_type' => false
+));
+
+$title = elgg_echo('bookmarks:everyone');
+
+$body = elgg_view_layout('content', array(
+ 'filter_context' => 'all',
+ 'content' => $content,
+ 'title' => $title
+));
+
+echo elgg_view_page($title, $body);
+elgg_pop_context(); \ No newline at end of file
diff --git a/mod/bookmarks/pages/friends.php b/mod/bookmarks/pages/friends.php
new file mode 100644
index 000000000..5c930434b
--- /dev/null
+++ b/mod/bookmarks/pages/friends.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Elgg bookmarks plugin friends page
+ *
+ * @package ElggBookmarks
+ */
+$guid = get_input('guid');
+
+elgg_set_page_owner_guid($guid);
+$owner = elgg_get_page_owner_entity();
+
+elgg_push_context('bookmarks');
+elgg_push_breadcrumb(elgg_echo('bookmarks'), 'pg/bookmarks/all');
+elgg_push_breadcrumb($owner->name, "pg/bookmarks/owner/$owner->username");
+elgg_push_breadcrumb(elgg_echo('friends'));
+
+$title = elgg_echo('bookmarks:friends');
+
+$content = list_user_friends_objects($owner->guid, 'bookmarks', 10, false);
+if (!$content) {
+ $content = elgg_echo('bookmarks:none');
+}
+
+$params = array(
+ 'filter_context' => 'friends',
+ 'content' => $content,
+ 'title' => $title,
+);
+
+$body = elgg_view_layout('content', $params);
+
+echo elgg_view_page($title, $body);
+elgg_pop_context(); \ No newline at end of file
diff --git a/mod/bookmarks/pages/inbox.php b/mod/bookmarks/pages/inbox.php
new file mode 100644
index 000000000..061a51e18
--- /dev/null
+++ b/mod/bookmarks/pages/inbox.php
@@ -0,0 +1,28 @@
+<?php
+
+ /**
+ * Elgg bookmarks plugin inbox page
+ *
+ * @package ElggBookmarks
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.org/
+ */
+
+ // Start engine
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+ // List bookmarks
+ $area2 = elgg_view_title(elgg_echo('bookmarks:inbox'));
+ set_context('search');
+ $area2 .= list_entities_from_relationship('share',page_owner(),true,'object','bookmarks');
+ set_context('bookmarks');
+
+ // Format page
+ $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2);
+
+ // Draw it
+ page_draw(elgg_echo('bookmarks:inbox'),$body);
+
+?> \ No newline at end of file
diff --git a/mod/bookmarks/pages/owner.php b/mod/bookmarks/pages/owner.php
new file mode 100644
index 000000000..1e45bc518
--- /dev/null
+++ b/mod/bookmarks/pages/owner.php
@@ -0,0 +1,39 @@
+<?php
+/**
+ * Elgg bookmarks plugin everyone page
+ *
+ * @package ElggBookmarks
+ */
+
+elgg_push_context('bookmarks');
+elgg_push_breadcrumb(elgg_echo('bookmarks'), 'pg/bookmarks/all');
+
+$page_owner = elgg_get_page_owner_entity();
+if (!$page_owner) {
+ $page_owner = get_loggedin_userid();
+ elgg_set_page_owner_guid($page_owner);
+}
+
+elgg_push_breadcrumb($page_owner->name, "pg/bookmarks/owner/$page_owner->username");
+
+$offset = (int)get_input('offset', 0);
+$content .= elgg_list_entities(array(
+ 'type' => 'object',
+ 'subtype' => 'bookmarks',
+ 'owner_guid' => $page_owner->guid,
+ 'limit' => 10,
+ 'offset' => $offset,
+ 'full_view' => false,
+ 'view_toggle_type' => false
+));
+
+$title = elgg_echo('bookmarks:owner', array($page_owner->name));
+
+$body = elgg_view_layout('content', array(
+ 'filter_context' => 'mine',
+ 'content' => $content,
+ 'title' => $title
+));
+
+echo elgg_view_page($title, $body);
+elgg_pop_context(); \ No newline at end of file
diff --git a/mod/bookmarks/pages/view.php b/mod/bookmarks/pages/view.php
new file mode 100644
index 000000000..6b4b839b1
--- /dev/null
+++ b/mod/bookmarks/pages/view.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * View a bookmark
+ *
+ * @package ElggBookmarks
+ */
+
+$bookmark = get_entity(get_input('guid'));
+
+elgg_set_page_owner_guid($bookmark->getContainerGUID());
+$owner = elgg_get_page_owner_entity();
+
+elgg_push_breadcrumb(elgg_echo('bookmarks'), 'pg/bookmarks/all');
+
+$crumbs_title = elgg_echo('blog:owned_blogs', array($owner->name));
+if (elgg_instanceof($owner, 'group')) {
+ elgg_push_breadcrumb($crumbs_title, "pg/bookmarks/group/$owner->guid/owner");
+} else {
+ elgg_push_breadcrumb($crumbs_title, "pg/bookmarks/owner/$owner->username");
+}
+
+$title = $bookmark->title;
+
+elgg_push_breadcrumb($title);
+
+$content = elgg_view_entity($bookmark, true);
+$content .= elgg_view_comments($bookmark);
+
+$body = elgg_view_layout('content', array(
+ 'content' => $content,
+ 'title' => $title,
+ 'filter' => '',
+ 'header' => '',
+));
+
+echo elgg_view_page($title, $body);
diff --git a/mod/bookmarks/start.php b/mod/bookmarks/start.php
index bed077864..b7e2e5df9 100644
--- a/mod/bookmarks/start.php
+++ b/mod/bookmarks/start.php
@@ -5,13 +5,11 @@
* @package ElggBookmarks
*/
-// Bookmarks initialisation function
function bookmarks_init() {
- // Grab the config global
global $CONFIG;
//add a tools menu option
- $item = new ElggMenuItem('bookmarks', elgg_echo('bookmarks'), 'pg/bookmarks');
+ $item = new ElggMenuItem('bookmarks', elgg_echo('bookmarks'), 'pg/bookmarks/all');
elgg_register_menu_item('site', $item);
// Register a page handler, so we can have nice URLs
@@ -56,16 +54,51 @@ function bookmarks_init() {
function bookmarks_pagesetup() {
global $CONFIG;
- $page_owner = elgg_get_page_owner_entity();
+ $page_owner = page_owner_entity();
- // Add group bookmark menu item
- if (isloggedin()) {
- if ($page_owner instanceof ElggGroup && elgg_get_context() == 'groups') {
- if ($page_owner->bookmarks_enable != "no") {
- //add_submenu_item(elgg_echo("bookmarks:group",array($page_owner->name), "pg/bookmarks/" . $page_owner->username . '/items'));
+ //add submenu options
+ if (get_context() == "bookmarks") {
+
+ if (isloggedin()) {
+ // link to add bookmark form
+ if ($page_owner instanceof ElggGroup) {
+ if ($page_owner->isMember(get_loggedin_user())) {
+ add_submenu_item(elgg_echo('bookmarks:add'), $CONFIG->wwwroot."pg/bookmarks/add/" . $page_owner->username);
+ }
+ } else {
+ add_submenu_item(elgg_echo('bookmarks:add'), $CONFIG->wwwroot."pg/bookmarks/add/" . $_SESSION['user']->username);
+ add_submenu_item(elgg_echo('bookmarks:inbox'),$CONFIG->wwwroot."pg/bookmarks/inbox/" . $_SESSION['user']->username);
+ }
+ if (page_owner()) {
+ add_submenu_item(sprintf(elgg_echo('bookmarks:read'), $page_owner->name),$CONFIG->wwwroot."pg/bookmarks/owner/" . $page_owner->username);
+ }
+ if (!$page_owner instanceof ElggGroup) {
+ add_submenu_item(elgg_echo('bookmarks:friends'),$CONFIG->wwwroot."pg/bookmarks/friends/" . $_SESSION['user']->username);
+ }
+ }
+
+ if (!$page_owner instanceof ElggGroup) {
+ add_submenu_item(elgg_echo('bookmarks:everyone'),$CONFIG->wwwroot."pg/bookmarks/all/");
+ }
+
+ // Bookmarklet
+ if ((isloggedin()) && (page_owner()) && (can_write_to_container(0, page_owner()))) {
+
+ $bmtext = elgg_echo('bookmarks:bookmarklet');
+ if ($page_owner instanceof ElggGroup) {
+ $bmtext = elgg_echo('bookmarks:bookmarklet:group');
}
+ add_submenu_item($bmtext, $CONFIG->wwwroot . "pg/bookmarks/bookmarklet/{$page_owner->username}/");
}
+
}
+
+ if ($page_owner instanceof ElggGroup && get_context() == 'groups') {
+ if ($page_owner->bookmarks_enable != "no") {
+ add_submenu_item(sprintf(elgg_echo("bookmarks:group"),$page_owner->name), $CONFIG->wwwroot . "pg/bookmarks/owner/" . $page_owner->username);
+ }
+ }
+
}
/**
@@ -95,172 +128,47 @@ function bookmarks_page_handler($page) {
bookmarks_url_forwarder($page);
}
- set_input('username', $page[1]);
- $owner = get_user_by_username($page[1]);
- //$owner = elgg_get_page_owner();
- $owner_name = $owner->username;
-
- // owner name passed but invalid.
- if ($owner_name && !$owner) {
- $sidebar = elgg_view('bookmarks/sidebar', array('object_type' => 'bookmarks'));
- $content = elgg_echo("bookmarks:unknown_user");
-
- $params = array(
- 'content' => $content,
- 'sidebar' => $sidebar,
- );
- $body = elgg_view_layout('one_column_with_sidebar', $params);
- echo elgg_view_page(elgg_echo("bookmarks:user", array(elgg_get_page_owner_entity()->name)), $body);
-
- return FALSE;
- }
-
- $logged_in_user = get_loggedin_user();
- $section = (isset($page[0])) ? $page[0] : $section = 'items';
-
- //don't show the all site bookmarks breadcrumb when on the all site bookmarks page
- if(elgg_get_page_owner_guid() != 0){
- elgg_push_breadcrumb(elgg_echo('bookmarks:all'), $CONFIG->wwwroot . 'pg/bookmarks/');
- }
-
- if ($owner) {
- switch($section) {
- case 'friends':
- elgg_push_breadcrumb(elgg_echo('bookmarks:friends', array($owner->name)));
-
- $content = list_user_friends_objects($owner->getGUID(), 'bookmarks', 10, false, false);
- $context = ($owner == $logged_in_user) ? 'friends' : '';
- break;
-
- default:
- case 'items':
- elgg_push_breadcrumb(elgg_echo('bookmarks:user', array($owner->name)));
-
- group_gatekeeper();
- $options = array(
- 'type' => 'object',
- 'subtype' => 'bookmarks'
- );
-
- if ($owner instanceof ElggGroup) {
- $options['container_guid'] = $owner->getGUID();
- } else {
- $options['owner_guid'] = $owner->getGUID();
- }
-
- $content = elgg_list_entities($options);
-
- if (!$content && ($owner == $logged_in_user)) {
- $content = elgg_view('help/bookmarks');
- }
-
- $context = ($owner == $logged_in_user) ? 'mine' : '';
- break;
-
- case 'add':
- gatekeeper();
- elgg_push_breadcrumb(elgg_echo('bookmarks:add'));
-
- $vars = array();
- if ($owner instanceof ElggGroup) {
- $vars['container_guid'] = $owner->getGUID();
- }
-
- $context = 'action';
- $content = elgg_view('bookmarks/form', $vars);
- break;
-
- case 'edit':
- gatekeeper();
-
- elgg_push_breadcrumb(elgg_echo('bookmarks:edit'));
-
- $vars = array();
- // this will never be the case.
- if ($owner instanceof ElggGroup) {
- $vars['container_guid'] = $owner->getGUID();
- }
-
- $bookmark = (isset($page[2])) ? get_entity($page[2]) : FALSE;
-
- if ($bookmark && elgg_instanceof($bookmark, 'object', 'bookmarks') && $bookmark->canEdit()) {
- $vars['entity'] = $bookmark;
- $context = 'action';
- $content = elgg_view('bookmarks/form', $vars);
- } else {
- $content = elgg_echo('bookmarks:cannot_find_bookmark');
- }
-
- break;
-
- // I don't think this is used.
- case 'bookmarklet':
- gatekeeper();
-
- $content = elgg_view_title(elgg_echo('bookmarks:bookmarklet'));
- $content .= elgg_view('bookmarks/bookmarklet');
-
- break;
- }
-
- } else {
- // no owner name passed, show everything.
- $content = elgg_list_entities(array('type' => 'object', 'subtype' => 'bookmarks'));
- $context = 'everyone';
- }
-
- // sidebar
- if ($logged_in_user != $owner) {
- $area3 = elgg_view('bookmarks/ownerblock');
- }
-
- $sidebar = elgg_view('bookmarks/sidebar', array('object_type' => 'bookmarks'));
- if (isloggedin()){
- $sidebar .= elgg_view('bookmarks/bookmarklet');
- }
-
- // main content
- //if ($owner != $logged_in_user || $context == 'action') {
- $header = elgg_view('navigation/breadcrumbs');
- //}
- //if no user is set
- if(!$owner_name){
- $owner_name = get_loggedin_user()->username;
- }
+ $pages = dirname(__FILE__) . '/pages';
- //select the header depending on whether a user is looking at their bookmarks or someone elses
- if($owner){
- if ($owner != $logged_in_user && !($owner instanceof ElggGroup)) {
- $header .= elgg_view("page/elements/content_header_member", array(
- 'type' => 'bookmarks'
- ));
- }else{
- $header .= elgg_view("page/elements/content_header", array(
- 'context' => $context,
- 'type' => 'bookmarks',
- 'all_link' => "pg/bookmarks/",
- 'new_link' => "pg/bookmarks/add/{$owner_name}"
- ));
- }
- }else{
- $header .= elgg_view("page/elements/content_header", array(
- 'context' => $context,
- 'type' => 'bookmarks',
- 'all_link' => "pg/bookmarks/",
- 'new_link' => "pg/bookmarks/add/{$owner_name}"
- ));
+ switch ($page[0]) {
+ case "read":
+ case "view":
+ set_input('guid', $page[1]);
+ include "$pages/view.php";
+ break;
+ case "friends":
+ set_input('username', $page[1]);
+ include "$pages/friends.php";
+ break;
+ case "all":
+ include "$pages/all.php";
+ break;
+ case "inbox":
+ set_input('username', $page[1]);
+ include "$pages/inbox.php";
+ break;
+ case "owner":
+ set_input('username', $page[1]);
+ include "$pages/owner.php";
+ break;
+ case "add":
+ set_input('username', $page[1]);
+ include "$pages/add.php";
+ break;
+ case "edit":
+ set_input('bookmark', $page[1]);
+ include "$pages/add.php";
+ break;
+ case "bookmarklet":
+ set_input('username', $page[1]);
+ include "$pages/bookmarklet.php";
+ break;
+ default:
+ return false;
}
- $content = $header . $content;
- $params = array(
- 'content' => $content,
- 'sidebar' => $sidebar,
- );
- $body = elgg_view_layout('two_sidebar', $params);
- echo elgg_view_page(elgg_echo("bookmarks:user", array(elgg_get_page_owner_entity()->name)), $body);
-
- return TRUE;
+ return true;
}
/**
@@ -277,7 +185,7 @@ function bookmarks_url_forwarder($page) {
switch ($page[1]) {
case "read":
- $url = "{$CONFIG->wwwroot}pg/bookmarks/read/{$page[2]}/{$page[3]}";
+ $url = "{$CONFIG->wwwroot}pg/bookmarks/view/{$page[2]}/{$page[3]}";
break;
case "inbox":
$url = "{$CONFIG->wwwroot}pg/bookmarks/inbox/{$page[0]}/";
@@ -307,11 +215,11 @@ function bookmarks_url_forwarder($page) {
* @return string bookmarked item URL
*/
function bookmark_url($entity) {
-
global $CONFIG;
+
$title = $entity->title;
$title = elgg_get_friendly_title($title);
- return "pg/bookmarks/" . $entity->getOwnerEntity()->username . "/read/" . $entity->getGUID() . "/" . $title;
+ return $CONFIG->url . "pg/bookmarks/view/" . $entity->getGUID() . "/" . $title;
}
/**
@@ -367,46 +275,11 @@ function bookmarks_notify_message($hook, $entity_type, $returnvalue, $params) {
return null;
}
-/**
- * A function to generate an internal code to put on the wire in place of the full url
- * to save space.
- **/
-
-function create_wire_url_code(){
- $chars = "abcdefghijkmnopqrstuvwxyz023456789";
- srand((double)microtime()*1000000);
- $i = 0;
- $code = '';
-
- while ($i <= 4) {
- $num = rand() % 33;
- $tmp = substr($chars, $num, 1);
- $code = $code . $tmp;
- $i++;
- }
- $code = "{{L:" . $code . "}}";
- return $code;
-}
-
-function bookmarks_profile_menu($hook, $entity_type, $return_value, $params) {
- global $CONFIG;
-
- $return_value[] = array(
- 'text' => elgg_echo('bookmarks'),
- 'href' => "pg/bookmarks/{$params['owner']->username}",
- );
-
- return $return_value;
-}
-
-// Make sure the initialisation function is called on initialisation
-elgg_register_event_handler('init','system','bookmarks_init');
-elgg_register_event_handler('pagesetup','system','bookmarks_pagesetup');
+elgg_register_event_handler('init', 'system', 'bookmarks_init');
+elgg_register_event_handler('pagesetup', 'system', 'bookmarks_pagesetup');
// Register actions
-global $CONFIG;
-elgg_register_action('bookmarks/add', $CONFIG->pluginspath . "bookmarks/actions/add.php");
-elgg_register_action('bookmarks/edit', $CONFIG->pluginspath . "bookmarks/actions/edit.php");
-elgg_register_action('bookmarks/delete', $CONFIG->pluginspath . "bookmarks/actions/delete.php");
-elgg_register_action('bookmarks/reference', $CONFIG->pluginspath . "bookmarks/actions/reference.php");
-elgg_register_action('bookmarks/remove', $CONFIG->pluginspath . "bookmarks/actions/remove.php");
+$action_path = dirname(__FILE__) . '/actions/bookmarks';
+
+elgg_register_action('bookmarks/add', "$action_path/add.php", 'logged_in');
+elgg_register_action('bookmarks/delete', "$action_path/delete.php", 'logged_in'); \ No newline at end of file
diff --git a/mod/bookmarks/views/default/bookmarks/bookmarklet.php b/mod/bookmarks/views/default/bookmarks/bookmarklet.php
index 75d3686b9..bb2cf885e 100644
--- a/mod/bookmarks/views/default/bookmarks/bookmarklet.php
+++ b/mod/bookmarks/views/default/bookmarks/bookmarklet.php
@@ -1,7 +1,7 @@
<?php
/**
* Elgg get bookmarks bookmarklet view
- *
+ *
* @package ElggBookmarks
*/
diff --git a/mod/bookmarks/views/default/bookmarks/css.php b/mod/bookmarks/views/default/bookmarks/css.php
deleted file mode 100644
index 30df44744..000000000
--- a/mod/bookmarks/views/default/bookmarks/css.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-/**
- * Elgg bookmarks CSS
- *
- * @package ElggBookmarks
- */
-?>
-
-.bookmark_note {
- margin:0 0 0 5px;
-}
-.note {
- margin-top:5px;
-}
-
-
-/* BOOKMARKS WIDGET
-.collapsable_box_content .ContentWrapper.bookmarks {
- margin-bottom:5px;
- line-height:1.2em;
-}
-.collapsable_box_content .ContentWrapper.bookmarks .share_desc {
- display:none;
- line-height: 1.2em;
-}
-.collapsable_box_content .ContentWrapper.bookmarks .share_desc p {
- margin:0 0 5px 0;
-}
-.collapsable_box_content .ContentWrapper.bookmarks .river_object_bookmarks_create p {
- min-height:17px;
- padding:0 0 0 17px;
-}
-.collapsable_box_content .ContentWrapper.bookmarks .shares_timestamp {
- color:#666666;
- margin:0;
- padding:0 0 0 17px;
-}
-.collapsable_box_content .ContentWrapper.bookmarks .shares_title {
- margin:0;
- line-height: 1.1em;
-}
-.collapsable_box_content .ContentWrapper.bookmarks.more {
- margin:0 10px;
- padding:5px 10px;
-}
-*/
diff --git a/mod/bookmarks/views/default/bookmarks/form.php b/mod/bookmarks/views/default/bookmarks/form.php
index 12cd76ba7..2131f7cd8 100644
--- a/mod/bookmarks/views/default/bookmarks/form.php
+++ b/mod/bookmarks/views/default/bookmarks/form.php
@@ -1,109 +1,133 @@
<?php
/**
- * Elgg bookmarks plugin form
- *
- * @package ElggBookmarks
- */
+* Elgg bookmarks plugin form
+*
+* @package ElggBookmarks
+*/
if(isset($vars['entity'])){
$guid = $vars['entity']->guid;
$title = $vars['entity']->title;
+ $description = $vars['entity']->description;
$address = $vars['entity']->address;
- $access_id = $vars['entity']->access_id;
$tags = $vars['entity']->tags;
- $notes = $vars['entity']->description;
- $owner = get_entity($vars['entity']->container_guid);
- $url = "action/bookmarks/edit";
-}else{
- //set some variables
- $guid = '';
+ $access_id = $vars['entity']->access_id;
+ $shares = $vars['entity']->shares;
+ $owner = $vars['entity']->getOwnerEntity();
+ $highlight = 'default';
+
+} else {
+ $guid = 0;
$title = get_input('title',"");
$title = stripslashes($title); // strip slashes from URL encoded apostrophes
+ $description = "";
$address = get_input('address',"");
- $notes = '';
+ $highlight = 'all';
+
if ($address == "previous")
$address = $_SERVER['HTTP_REFERER'];
$tags = array();
- if(elgg_get_page_owner_entity() instanceof ElggGroup){
- //if in a group, set the access level to default to the group
- $access_id = elgg_get_page_owner_entity()->group_acl;
- }else{
- $access_id = get_default_access(get_loggedin_user());
+
+ if (defined('ACCESS_DEFAULT')) {
+ $access_id = ACCESS_DEFAULT;
+ } else {
+ $access_id = 0;
}
- $owner = get_loggedin_user();
- $url = "action/bookmarks/add";
+ $shares = array();
+ $owner = page_owner_entity();
}
+
?>
-<form id="bookmark_edit_form" class="margin-top" action="<?php echo elgg_get_site_url() . $url; ?>" method="post">
- <?php echo elgg_view('input/securitytoken'); ?>
- <p>
- <label>
- <?php echo elgg_echo('title'); ?>
- <?php
- echo elgg_view('input/text',array(
- 'internalname' => 'title',
- 'value' => $title,
- ));
- ?>
- </label>
- </p>
- <p>
- <label>
- <?php echo elgg_echo('bookmarks:address'); ?>
- <?php
- echo elgg_view('input/url',array(
- 'internalname' => 'address',
- 'value' => $address,
- ));
- ?>
- </label>
- </p>
- <p>
- <label>
- <?php echo elgg_echo('bookmarks:addnote'); ?>
- <br />
- <?php
-
- echo elgg_view('input/text',array(
- 'internalname' => 'notes',
- 'value' => $notes,
- ));
-
- ?>
- </label>
- </p>
- <p>
- <label>
- <?php echo elgg_echo('tags'); ?>
- <?php
- echo elgg_view('input/tags',array(
- 'internalname' => 'tags',
- 'value' => $tags,
- ));
- ?>
- </label>
- </p>
- <p>
- <label>
- <?php echo elgg_echo('access'); ?>
- <?php
- //if it is a group, pull out the group access view
- if(elgg_get_page_owner_entity() instanceof ElggGroup){
- $access_options = group_access_options($owner);
- echo elgg_view('input/access', array('internalname' => 'access',
- 'value' => $access_id,
- 'options' => $access_options));
- }else{
- echo elgg_view('input/access', array('internalname' => 'access',
- 'value' => $access_id));
- }
- ?>
- </label>
- </p>
- <p>
- <?php echo $vars['container_guid'] ? elgg_view('input/hidden', array('internalname' => 'container_guid', 'value' => $vars['container_guid'])) : ""; ?>
- <input type="hidden" value="<?php echo $guid; ?>" name="guid" />
- <input type="submit" onfocus="blur()" value="<?php echo elgg_echo('save'); ?>" />
- </p>
+<div class="contentWrapper">
+<form action="<?php echo $vars['url']; ?>action/bookmarks/add" method="post">
+<?php echo elgg_view('input/securitytoken'); ?>
+<p>
+ <label>
+ <?php echo elgg_echo('title'); ?>
+ <?php
+
+ echo elgg_view('input/text',array(
+ 'internalname' => 'title',
+ 'value' => $title,
+ ));
+
+ ?>
+ </label>
+</p>
+<p>
+ <label>
+ <?php echo elgg_echo('bookmarks:address'); ?>
+ <?php
+
+ echo elgg_view('input/url',array(
+ 'internalname' => 'address',
+ 'value' => $address,
+ ));
+
+ ?>
+ </label>
+</p>
+<p class="longtext_editarea">
+ <label>
+ <?php echo elgg_echo('description'); ?>
+ <br />
+ <?php
+
+ echo elgg_view('input/longtext',array(
+ 'internalname' => 'description',
+ 'value' => $description,
+ ));
+
+ ?>
+ </label>
+</p>
+<p>
+ <label>
+ <?php echo elgg_echo('tags'); ?>
+ <?php
+
+ echo elgg_view('input/tags',array(
+ 'internalname' => 'tags',
+ 'value' => $tags,
+ ));
+
+ ?>
+ </label>
+</p>
+ <?php
+
+ //echo elgg_view('bookmarks/sharing',array('shares' => $shares, 'owner' => $owner));
+ if ($friends = elgg_get_entities_from_relationship(array('relationship' => 'friend', 'relationship_guid' => $owner->getGUID(), 'inverse_relationship' => FALSE, 'type' => 'user', 'limit' => 9999))) {
+?>
+<p>
+ <label><?php echo elgg_echo("bookmarks:with"); ?></label><br />
+<?php
+ echo elgg_view('friends/picker',array('entities' => $friends, 'internalname' => 'shares', 'highlight' => $highlight));
+?>
+</p>
+<?php
+ }
+
+ ?>
+<p>
+ <label>
+ <?php echo elgg_echo('access'); ?>
+ <?php
+
+ echo elgg_view('input/access',array(
+ 'internalname' => 'access',
+ 'value' => $access_id,
+ ));
+
+ ?>
+ </label>
+</p>
+<p>
+ <?php echo $vars['container_guid'] ? elgg_view('input/hidden', array('internalname' => 'container_guid', 'value' => $vars['container_guid'])) : ""; ?>
+ <input type="hidden" name="bookmark_guid" value="<?php echo $guid; ?>" />
+ <input type="submit" value="<?php echo elgg_echo('save'); ?>" />
+</p>
+
</form>
+</div> \ No newline at end of file
diff --git a/mod/bookmarks/views/default/bookmarks/group_bookmarks.php b/mod/bookmarks/views/default/bookmarks/group_bookmarks.php
deleted file mode 100755
index dd1b6aa9c..000000000
--- a/mod/bookmarks/views/default/bookmarks/group_bookmarks.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-//grab the groups bookmarks
-$bookmarks = elgg_get_entities(array('type' => 'object', 'subtype' => 'bookmarks',
- 'container_guids' => elgg_get_page_owner_guid(), 'limit' => 6));
-?>
-<div class="group_tool_widget bookmarks">
-<span class="group_widget_link"><a href="<?php echo elgg_get_site_url() . "pg/bookmarks/" . elgg_get_page_owner_entity()->username; ?>"><?php echo elgg_echo('link:view:all')?></a></span>
-<h3><?php echo elgg_echo('bookmarks:group') ?></h3>
-<?php
-if($bookmarks){
- foreach($bookmarks as $b){
-
- //get the owner
- $owner = $b->getOwnerEntity();
-
- //get the time
- $friendlytime = elgg_view_friendly_time($b->time_created);
-
- $info = "<div class='entity-listing-icon'>" . elgg_view('profile/icon',array('entity' => $b->getOwnerEntity(), 'size' => 'tiny')) . "</div>";
-
- //get the bookmark entries body
- $info .= "<div class='entity-listing-info'><p class='entity-title'><a href=\"{$b->address}\">{$b->title}</a></p>";
-
- //get the user details
- $info .= "<p class='entity-subtext'>{$friendlytime}</p>";
- $info .= "</div>";
- //display
- echo "<div class='entity-listing clearfix'>" . $info . "</div>";
- }
-} else {
- $create_bookmark = elgg_get_site_url() . "pg/bookmarks/" . elgg_get_page_owner_entity()->username . "/add";
- echo "<p class='margin-top'><a href=\"{$create_bookmark}\">" . elgg_echo("bookmarks:new") . "</a></p>";
-}
-echo "</div>"; \ No newline at end of file
diff --git a/mod/bookmarks/views/default/bookmarks/groupprofile_bookmarks.php b/mod/bookmarks/views/default/bookmarks/groupprofile_bookmarks.php
new file mode 100644
index 000000000..ad8095d11
--- /dev/null
+++ b/mod/bookmarks/views/default/bookmarks/groupprofile_bookmarks.php
@@ -0,0 +1,34 @@
+<?php
+
+/**
+ * List most recent bookmarks on group profile page
+ */
+
+if ($vars['entity']->bookmarks_enable != 'no') {
+?>
+
+<div class="group_widget">
+<h2><?php echo elgg_echo('bookmarks:group'); ?></h2>
+<?php
+ $context = get_context();
+ set_context('search');
+ $content = elgg_list_entities(array('types' => 'object',
+ 'subtypes' => 'bookmarks',
+ 'container_guid' => $vars['entity']->guid,
+ 'limit' => 5,
+ 'full_view' => FALSE,
+ 'pagination' => FALSE));
+ set_context($context);
+
+ if ($content) {
+ echo $content;
+
+ $more_url = "{$vars['url']}pg/bookmarks/owner/group:{$vars['entity']->guid}/";
+ echo "<div class=\"forum_latest\"><a href=\"$more_url\">" . elgg_echo('bookmarks:more') . "</a></div>";
+ } else {
+ echo "<div class=\"forum_latest\">" . elgg_echo("bookmarks:nogroup") . "</div>";
+ }
+?>
+</div>
+<?php
+} \ No newline at end of file
diff --git a/mod/bookmarks/views/default/bookmarks/owner_block.php b/mod/bookmarks/views/default/bookmarks/owner_block.php
new file mode 100644
index 000000000..654ff9152
--- /dev/null
+++ b/mod/bookmarks/views/default/bookmarks/owner_block.php
@@ -0,0 +1,10 @@
+<?php
+
+$label = elgg_echo('bookmarks:this');
+$user = get_loggedin_user();
+$url = "'" . $vars['url'] . "pg/bookmarks/add/{$user->username}?address='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)";
+
+?>
+<div id="owner_block_bookmark_this">
+<a href="javascript:location.href=<?php echo $url; ?>"><?php echo $label ?></a>
+</div>
diff --git a/mod/bookmarks/views/default/bookmarks/sharing.php b/mod/bookmarks/views/default/bookmarks/sharing.php
new file mode 100644
index 000000000..63738d94d
--- /dev/null
+++ b/mod/bookmarks/views/default/bookmarks/sharing.php
@@ -0,0 +1,80 @@
+<?php
+
+ $owner = $vars['owner'];
+ if ($friends = elgg_get_entities_from_relationship(array('relationship' => 'friend', 'relationship_guid' => $owner->getGUID(), 'inverse_relationship' => FALSE, 'type' => 'user', 'limit' => 9999))) {
+
+?>
+
+<table border="0" cellspacing="0" cellpadding="0">
+
+<?php
+
+ $col = 0;
+ foreach($friends as $friend) {
+
+ if ($col == 0) echo "<tr>";
+
+ $label = elgg_view("profile/icon",array('entity' => $friend, 'size' => 'tiny'));
+ $options[$label] = $friend->getGUID();
+
+?>
+
+ <td>
+
+ <input type="checkbox" name="shares[]" value="<?php echo $options[$label]; ?>" />
+
+ </td>
+
+ <td >
+
+ <div style="width: 25px; margin-bottom: 15px;">
+ <?php
+
+ echo $label;
+
+ ?>
+ </div>
+ </td>
+ <td style="width: 300px; padding: 5px;">
+ <?php
+
+ echo $friend->name;
+
+ ?>
+ </td>
+<?php
+
+
+ $col++;
+
+ if ($col == 3) {
+
+ $col = 0;
+ echo "</tr>";
+
+ }
+
+
+ }
+ if ($col != 3) {
+ echo "</tr>";
+ }
+
+
+?>
+
+</table>
+
+<?php
+
+ /*echo elgg_view('input/checkboxes',array(
+
+ 'internalname' => 'shares',
+ 'options' => $options,
+ 'value' => $vars['shares'],
+
+ )); */
+
+ }
+
+?> \ No newline at end of file
diff --git a/mod/bookmarks/views/default/bookmarks/stats.php b/mod/bookmarks/views/default/bookmarks/stats.php
deleted file mode 100755
index 77c3d703f..000000000
--- a/mod/bookmarks/views/default/bookmarks/stats.php
+++ /dev/null
@@ -1,7 +0,0 @@
-<?php
-/**
- * All site bookmark stats
- **/
-
-echo "<h3>".elgg_echo('bookmarks:stats')."</h3>";
-echo "<p>". $vars['count'] . " " . elgg_echo('bookmarks:resources') .".</p>"; \ No newline at end of file
diff --git a/mod/bookmarks/views/default/object/bookmarks.php b/mod/bookmarks/views/default/object/bookmarks.php
index f90a2f355..ccb02457c 100644
--- a/mod/bookmarks/views/default/object/bookmarks.php
+++ b/mod/bookmarks/views/default/object/bookmarks.php
@@ -5,91 +5,108 @@
* @package ElggBookmarks
*/
-$owner = $vars['entity']->getOwnerEntity();
-$friendlytime = elgg_view_friendly_time($vars['entity']->time_created);
-$address = $vars['entity']->address;
-
-// you used to be able to add without titles, which created unclickable bookmarks
-// putting a fake title in so you can click on it.
-if (!$title = $vars['entity']->title) {
- $title = elgg_echo('bookmarks:no_title');
-}
+$full = elgg_get_array_value('full', $vars, FALSE);
+$bookmark = elgg_get_array_value('entity', $vars, FALSE);
-$a_tag_visit = filter_tags("<a href=\"{$address}\">" . elgg_echo('bookmarks:visit') . "</a>");
-$a_tag_title = filter_tags("<a href=\"{$address}\">$title</a>");
-
-
-$parsed_url = parse_url($address);
-$faviconurl = $parsed_url['scheme'] . "://" . $parsed_url['host'] . "/favicon.ico";
-
-//sort out the access level for display
-$object_acl = get_readable_access_level($vars['entity']->access_id);
-//files with these access level don't need an icon
-$general_access = array('Public', 'Logged in users', 'Friends');
-//set the right class for access level display - need it to set on groups and shared access only
-$is_group = get_entity($vars['entity']->container_guid);
-if($is_group instanceof ElggGroup){
- //get the membership type open/closed
- $membership = $is_group->membership;
- //we decided to show that the item is in a group, rather than its actual access level
- $object_acl = "Group: " . $is_group->name;
- if($membership == 2)
- $access_level = "class='access_level group_open'";
- else
- $access_level = "class='access_level group_closed'";
-}elseif($object_acl == 'Private'){
- $access_level = "class='access_level private'";
-}else{
- if(!in_array($object_acl, $general_access))
- $access_level = "class='access_level shared_collection'";
- else
- $access_level = "class='access_level entity_access'";
+if (!$bookmark) {
+ return;
}
-if($vars['entity']->description != '')
- $view_notes = "<a class='link' onclick=\"elgg_slide_toggle(this,'.entity-listing','.note');\">note</a>";
-else
- $view_notes = '';
-if (@file_exists($faviconurl)) {
- $icon = "<img src=\"{$faviconurl}\" />";
+$owner = $bookmark->getOwnerEntity();
+$container = $bookmark->getContainerEntity();
+$categories = elgg_view('categories/view', $vars);
+
+$link = filter_tags(elgg_view('output/url', array('href' => $bookmark->address)));
+$description = elgg_view('output/longtext', array('value' => $bookmark->description, 'class' => 'pbl'));
+
+$owner_link = elgg_view('output/url', array(
+ 'href' => "pg/file/owner/$owner->username",
+ 'text' => $owner->name,
+));
+$author_text = elgg_echo('blog:author_by_line', array($owner_link));
+
+$tags = elgg_view('output/tags', array('tags' => $bookmark->tags));
+$date = elgg_view_friendly_time($bookmark->time_created);
+
+$comments_count = elgg_count_comments($bookmark);
+//only display if there are commments
+if ($comments_count != 0) {
+ $text = elgg_echo("comments") . " ($comments_count)";
+ $comments_link = elgg_view('output/url', array(
+ 'href' => $bookmark->getURL() . '#comments',
+ 'text' => $text,
+ ));
} else {
- $icon = elgg_view("profile/icon", array('entity' => $owner,'size' => 'tiny',));
-}
-
-
-//delete
-if($vars['entity']->canEdit()){
- $delete .= "<span class='delete-button'>" . elgg_view('output/confirmlink',array(
- 'href' => "action/bookmarks/delete?bookmark_guid=" . $vars['entity']->guid,
- 'text' => elgg_echo("delete"),
- 'confirm' => elgg_echo("bookmarks:delete:confirm"),
- )) . "</span>";
-}
-
-$info = "<div class='entity-metadata'><span {$access_level}>{$object_acl}</span>";
-
-// include a view for plugins to extend
-$info .= elgg_view("bookmarks/options",array('entity' => $vars['entity']));
-$info .= elgg_view_likes($vars['entity']); // include likes
-
-//include edit and delete options
-if($vars['entity']->canEdit()){
- $info .= "<span class='entity-edit'><a href=\"".elgg_get_site_url()."pg/bookmarks/{$owner->username}/edit/{$vars['entity']->getGUID()}\">" . elgg_echo('edit') . "</a></span>";
- $info .= $delete;
+ $comments_link = '';
}
- $info .= "</div>";
+$metadata = elgg_view('layout/objects/list/metadata', array(
+ 'entity' => $bookmark,
+ 'handler' => 'bookmarks',
+));
-$info .= "<p class='entity-title'>$a_tag_title</p>";
-$info .= "<p class='entity-subtext'>Bookmarked by <a href=\"".elgg_get_site_url()."pg/bookmarks/{$owner->username}\">{$owner->name}</a> {$friendlytime} {$view_notes}</p>";
+$subtitle = "$author_text $date $categories $comments_link";
-$tags = elgg_view('output/tags', array('tags' => $vars['entity']->tags));
-if (!empty($tags)) {
- $info .= '<p class="tags">' . $tags . '</p>';
-}
-if($view_notes != ''){
- $info .= "<div class='note hidden'>". $vars['entity']->description . "</div>";
+// do not show the metadata and controls in widget view
+if (elgg_in_context('widgets')) {
+ $metadata = '';
}
-//display
-echo elgg_view_listing($icon, $info);
+if ($full && !elgg_in_context('gallery')) {
+ $header = elgg_view_title($bookmark->title);
+
+ $params = array(
+ 'entity' => $bookmark,
+ 'title' => false,
+ 'metadata' => $metadata,
+ 'subtitle' => $subtitle,
+ 'tags' => $tags,
+ );
+ $bookmark_info = elgg_view('layout/objects/list/body', $params);
+
+ echo <<<HTML
+$header
+$bookmark_info
+<div class="bookmark elgg-content">
+ <span class="elgg-icon elgg-icon-following"></span><h3 class="pbl">$link</h3>
+ $description
+</div>
+HTML;
+
+} elseif (elgg_in_context('gallery')) {
+ echo '<div class="bookmarks-gallery-item">';
+ echo "<h3>" . $bookmark->title . "</h3>";
+ echo "<p class='subtitle'>$owner_link $date</p>";
+ echo '</div>';
+} else {
+ // brief view
+ $url = $bookmark->address;
+ $display_text = $url;
+ $excerpt = elgg_get_excerpt($bookmark->description);
+
+ if (strlen($url) > 25) {
+ $bits = parse_url($url);
+ if (isset($bits['host'])) {
+ $display_text = $bits['host'];
+ } else {
+ $display_text = elgg_get_excerpt($url, 100);
+ }
+ }
+
+ $link = filter_tags(elgg_view('output/url', array(
+ 'href' => $bookmark->address,
+ 'text' => $display_text
+ )));
+
+ $content = "<span class=\"elgg-icon elgg-icon-following\"></span>$link - $excerpt";
+
+ $params = array(
+ 'entity' => $bookmark,
+ 'metadata' => $metadata,
+ 'subtitle' => $subtitle,
+ 'tags' => $tags,
+ 'content' => $content,
+ );
+
+ echo elgg_view('layout/objects/list/body', $params);
+} \ No newline at end of file
diff --git a/mod/bookmarks/views/default/river/object/bookmarks/annotate.php b/mod/bookmarks/views/default/river/object/bookmarks/annotate.php
new file mode 100644
index 000000000..8db8a6581
--- /dev/null
+++ b/mod/bookmarks/views/default/river/object/bookmarks/annotate.php
@@ -0,0 +1,10 @@
+<?php
+$statement = $vars['statement'];
+$performed_by = $statement->getSubject();
+$object = $statement->getObject();
+
+$url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";
+$string = sprintf(elgg_echo("bookmarks:river:annotate"),$url) . " ";
+$string .= "<a href=\"" . $object->getURL() . "\">" . elgg_echo("bookmarks:river:item") . "</a>";
+
+echo $string; \ No newline at end of file
diff --git a/mod/bookmarks/views/default/river/object/bookmarks/create.php b/mod/bookmarks/views/default/river/object/bookmarks/create.php
index bd07db089..82ea75af7 100644
--- a/mod/bookmarks/views/default/river/object/bookmarks/create.php
+++ b/mod/bookmarks/views/default/river/object/bookmarks/create.php
@@ -1,35 +1,10 @@
<?php
-/**
- * Bookmarks river view.
- */
+$performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject();
+$object = get_entity($vars['item']->object_guid);
+$url = $object->getURL();
-$object = $vars['item']->getObjectEntity();
-$excerpt = strip_tags($object->description);
-$excerpt = elgg_get_excerpt($excerpt);
+$url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";
+$string = sprintf(elgg_echo("bookmarks:river:created"),$url) . " ";
+$string .= "<a href=\"" . $object->getURL() . "\">" . $object->title . "</a>"; //elgg_echo("bookmarks:river:item") . "</a>";
-$params = array(
- 'href' => $object->address,
- 'text' => $object->title,
-);
-$link = elgg_view('output/url', $params);
-
-$group_string = '';
-$container = $object->getContainerEntity();
-if ($container instanceof ElggGroup) {
- $params = array(
- 'href' => $container->getURL(),
- 'text' => $container->name,
- );
- $group_link = elgg_view('output/url', $params);
- $group_string = elgg_echo('river:ingroup', array($group_link));
-}
-
-echo elgg_echo('bookmarks:river:create');
-
-echo " $link $group_string";
-
-if ($excerpt) {
- echo '<div class="elgg-river-content">';
- echo $excerpt;
- echo '</div>';
-}
+echo $string;
diff --git a/mod/bookmarks/views/default/widgets/bookmarks/view.php b/mod/bookmarks/views/default/widgets/bookmarks/view.php
index 6babbcd20..f9bbf5488 100644
--- a/mod/bookmarks/views/default/widgets/bookmarks/view.php
+++ b/mod/bookmarks/views/default/widgets/bookmarks/view.php
@@ -1,57 +1,65 @@
+
+<script type="text/javascript">
+$(document).ready(function () {
+ $('a.share_more_info').click(function () {
+ $(this.parentNode).children("[class=share_desc]").slideToggle("fast");
+ return false;
+ });
+}); /* end document ready function */
+</script>
+
<?php
-/**
- * Elgg bookmark widget view
- *
- * @package ElggBookmarks
- */
//get the num of shares the user want to display
$num = $vars['entity']->num_display;
-$options = array(
- 'type' => 'object',
- 'subtype' => 'bookmarks',
- 'container_guid' => $vars['entity']->owner_guid,
- 'limit' => $num,
-);
-$bookmarks = elgg_get_entities($options);
-
-$options['count'] = true;
-$num_bookmarks = elgg_get_entities($options);
-
+//if no number has been set, default to 4
+if(!$num)
+ $num = 4;
+
+//grab the users bookmarked items
+$shares = elgg_get_entities(array('types' => 'object', 'subtypes' => 'bookmarks', 'container_guid' => $vars['entity']->owner_guid, 'limit' => $num, 'offset' => 0));
-if ($bookmarks) {
-
- foreach ($bookmarks as $b) {
+if($shares){
+ foreach($shares as $s){
+
//get the owner
- $owner = $b->getOwnerEntity();
+ $owner = $s->getOwnerEntity();
//get the time
- $friendlytime = elgg_view_friendly_time($b->time_created);
+ $friendlytime = elgg_view_friendly_time($s->time_created);
- //get the bookmark title
- $info = "<div class='river_object_bookmarks_create'><p class=\"shares_title\"><a href=\"{$b->address}\">{$b->title}</a></p></div>";
+ //get the user icon
+ $icon = elgg_view(
+ "profile/icon", array(
+ 'entity' => $owner,
+ 'size' => 'tiny',
+ )
+ );
+ //get the bookmark title
+ $info = "<p class=\"shares_title\"><a href=\"{$s->getURL()}\">{$s->title}</a></p>";
+
//get the user details
- $info .= "<p class=\"shares_timestamp\"><small>{$friendlytime} ";
+ $info .= "<p class=\"shares_timestamp\"><small><a href=\"{$owner->getURL()}\">{$owner->name}</a> {$friendlytime}</small></p>";
//get the bookmark description
- if ($b->description) {
- $info .= "<a href=\"javascript:void(0);\" class=\"share_more_info\">" . elgg_echo('bookmarks:more') . "</a></small></p><div class=\"share_desc\"><p>{$b->description}</p></div>";
- } else {
- $info .= "</small></p>";
- }
-
- //display
- echo "<div class='ContentWrapper bookmarks'>";
- echo "<div class='shares_widget-content'>" . $info . "</div></div>";
- }
+ if($s->description)
+ $info .= "<a href=\"javascript:void(0);\" class=\"share_more_info\">".elgg_echo('bookmarks:more')."</a><br /><div class=\"share_desc\"><p>{$s->description}</p></div>";
+
+ //display
+ echo "<div class=\"shares_widget_wrapper\">";
+ echo "<div class=\"shares_widget_icon\">" . $icon . "</div>";
+ echo "<div class=\"shares_widget_content\">" . $info . "</div>";
+ echo "</div>";
- if ($num_bookmarks > $num) {
- $user_inbox = elgg_get_site_url() . "pg/bookmarks/" . elgg_get_page_owner_entity()->username;
- echo "<div class='ContentWrapper bookmarks more'><a href=\"{$user_inbox}\">" . elgg_echo('bookmarks:read') . "</a></div>";
}
-} else {
- echo "<div class='ContentWrapper'>" . elgg_echo("bookmarks:widget:description") . "</div>";
+
+ $user_inbox = $vars['url'] . "pg/bookmarks/owner/" . page_owner_entity()->username;
+ echo "<div class=\"widget_more_wrapper\"><a href=\"{$user_inbox}\">".elgg_echo('bookmarks:morebookmarks')."</a></div>";
+
}
+
+
+?> \ No newline at end of file
diff --git a/mod/bookmarks/views/rss/object/bookmarks.php b/mod/bookmarks/views/rss/object/bookmarks.php
index f17ae87d7..8e88485f1 100644
--- a/mod/bookmarks/views/rss/object/bookmarks.php
+++ b/mod/bookmarks/views/rss/object/bookmarks.php
@@ -4,19 +4,20 @@
*
* @package ElggBookmarks
*/
- $title = $vars['entity']->title;
- if (empty($title)) {
- $title = substr($vars['entity']->description,0,32);
- if (strlen($vars['entity']->description) > 32)
- $title .= " ...";
- }
+
+$title = $vars['entity']->title;
+if (empty($title)) {
+ $title = substr($vars['entity']->description,0,32);
+ if (strlen($vars['entity']->description) > 32)
+ $title .= " ...";
+}
?>
- <item>
- <guid isPermaLink='true'><?php echo $vars['entity']->getURL(); ?></guid>
- <pubDate><?php echo date("r",$vars['entity']->time_created) ?></pubDate>
- <link><?php echo $vars['entity']->address; ?></link>
- <title><![CDATA[<?php echo $title; ?>]]></title>
- <description><![CDATA[<?php echo (autop($vars['entity']->description)); ?>]]></description>
- </item>
+<item>
+ <guid isPermaLink='true'><?php echo $vars['entity']->getURL(); ?></guid>
+ <pubDate><?php echo date("r",$vars['entity']->time_created) ?></pubDate>
+ <link><?php echo $vars['entity']->address; ?></link>
+ <title><![CDATA[<?php echo $title; ?>]]></title>
+ <description><![CDATA[<?php echo (autop($vars['entity']->description)); ?>]]></description>
+</item>