diff options
27 files changed, 880 insertions, 1005 deletions
diff --git a/mod/bookmarks/actions/add.php b/mod/bookmarks/actions/add.php index a074719b1..be2f79f82 100644 --- a/mod/bookmarks/actions/add.php +++ b/mod/bookmarks/actions/add.php @@ -1,72 +1,41 @@ <?php - - /** - * Elgg bookmarks add/save action - * - * @package ElggBookmarks - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ - */ +/** + * Elgg bookmarks add/save action + * + * @package ElggBookmarks + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider <info@elgg.com> + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ - gatekeeper(); - - $title = 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()); +gatekeeper(); +action_gatekeeper(); +//set some required variables +$title = 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); +//create a new bookmark object +$entity = new ElggObject; +$entity->subtype = "bookmarks"; +$entity->owner_guid = get_loggedin_user()->getGUID(); +$entity->container_guid = (int)get_input('container_guid', get_loggedin_user()->getGUID()); +$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; - $tags = get_input('tags'); - $tagarray = string_to_tag_array($tags); - - 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()); - - } 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 - 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"); - } - -?> +if ($entity->save()) { + system_message(elgg_echo('bookmarks:save:success')); + //add to river + add_to_river('river/object/bookmarks/create','create',$_SESSION['user']->guid,$entity->guid); +} else { + register_error(elgg_echo('bookmarks:save:failed')); +} +$account = get_entity((int)get_input('container_guid', get_loggedin_user()->getGUID())); +forward("pg/bookmarks/" . $account->username);
\ No newline at end of file diff --git a/mod/bookmarks/actions/delete.php b/mod/bookmarks/actions/delete.php index 217197b24..5a35d44f5 100644 --- a/mod/bookmarks/actions/delete.php +++ b/mod/bookmarks/actions/delete.php @@ -1,32 +1,23 @@ <?php +/** + * Elgg bookmarks delete action + * + * @package ElggBookmarks + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider <info@elgg.com> + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ - /** - * Elgg bookmarks delete action - * - * @package ElggBookmarks - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ - */ - - $guid = get_input('bookmark_guid',0); - if ($entity = get_entity($guid)) { - - if ($entity->canEdit()) { - - if ($entity->delete()) { - - system_message(elgg_echo("bookmarks:delete:success")); - forward("pg/bookmarks/"); - - } - - } - +$guid = get_input('bookmark_guid',0); +if ($entity = get_entity($guid)) { + if ($entity->canEdit()) { + if ($entity->delete()) { + system_message(elgg_echo("bookmarks:delete:success")); + forward($_SERVER['HTTP_REFERER']); } + } +} - register_error(elgg_echo("bookmarks:delete:failed")); - forward("pg/bookmarks/"); - -?>
\ No newline at end of file +register_error(elgg_echo("bookmarks:delete:failed")); +forward($_SERVER['HTTP_REFERER']);
\ No newline at end of file diff --git a/mod/bookmarks/actions/edit.php b/mod/bookmarks/actions/edit.php new file mode 100755 index 000000000..16e324154 --- /dev/null +++ b/mod/bookmarks/actions/edit.php @@ -0,0 +1,35 @@ +<?php
+/**
+ * Elgg bookmarks edit action
+ *
+ */
+
+gatekeeper();
+action_gatekeeper();
+//set some required variables
+$guid = get_input('guid');
+$title = 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);
+
+// Make sure we actually have permission to edit
+$bookmark = get_entity($guid);
+if ($bookmark->getSubtype() == "bookmarks" && $bookmark->canEdit()) {
+ $bookmark->title = $title;
+ $bookmark->description = $notes;
+ $bookmark->address = $address;
+ $bookmark->access_id = $access;
+ $bookmark->tags = $tagarray;
+ if ($bookmark->save()) {
+ system_message(elgg_echo('bookmarks:edit:success'));
+ } else {
+ system_message(elgg_echo('bookmarks:edit:fail'));
+ }
+}else{
+ system_message(elgg_echo('bookmarks:edit:fail'));
+}
+$account = get_entity($bookmark->container_guid);
+forward("pg/bookmarks/" . $account->username);
\ No newline at end of file diff --git a/mod/bookmarks/actions/reference.php b/mod/bookmarks/actions/reference.php new file mode 100755 index 000000000..ae79b78cd --- /dev/null +++ b/mod/bookmarks/actions/reference.php @@ -0,0 +1,34 @@ +<?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 new file mode 100755 index 000000000..b8b1ad6a3 --- /dev/null +++ b/mod/bookmarks/actions/remove.php @@ -0,0 +1,34 @@ +<?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/add.php b/mod/bookmarks/add.php index 030cec450..60c094a4b 100644 --- a/mod/bookmarks/add.php +++ b/mod/bookmarks/add.php @@ -1,46 +1,53 @@ <?php +/** + * Elgg bookmarks plugin add bookmark page + * + * @package ElggBookmarks + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider <info@elgg.com> + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ - /** - * Elgg bookmarks plugin add bookmark page - * - * @package ElggBookmarks - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ - */ - - // Start engine - require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); +// Start engine +require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - // You need to be logged in for this one - gatekeeper(); +// You need to be logged in for this one +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; +// 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)); - } +//set breadcrumbs +$area1 = elgg_view('page_elements/breadcrumbs', array('object_type' => 'bookmarks')); + +// get the filter menu +$area1 .= elgg_view('page_elements/content_header', array('context' => "action", 'type' => 'bookmarks')); + +// 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)); +} + +$area3 = elgg_view('bookmarks/ownerblock'); +// if logged in, get the bookmarklet +$area3 .= elgg_view("bookmarks/bookmarklet_menu_option"); +//include a view for plugins to extend +$area3 .= elgg_view("bookmarks/sidebar_options", array("object_type" => 'bookmarks')); - // Format page - $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2); +// Format page +$body = elgg_view_layout('one_column_with_sidebar', $area3, $area1.$area2); - // Draw it - page_draw(elgg_echo('bookmarks:add'),$body); - -?>
\ No newline at end of file +// Draw it +echo page_draw(elgg_echo('bookmarks:add'),$body);
\ No newline at end of file diff --git a/mod/bookmarks/all.php b/mod/bookmarks/all.php new file mode 100644 index 000000000..1dcf8c898 --- /dev/null +++ b/mod/bookmarks/all.php @@ -0,0 +1,44 @@ +<?php +/** + * Elgg bookmarks plugin everyone page + * + * @package ElggBookmarks + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider <info@elgg.com> + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ + +// Start engine +require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + +// 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($_SESSION['guid']); +} + +// get the filter menu +$area1 = elgg_view('page_elements/content_header', array('context' => "everyone", 'type' => 'bookmarks')); + +// List bookmarks +set_context('search'); +$area2 .= list_entities('object','bookmarks'); +set_context('bookmarks'); + +// if logged in, get the bookmarklet +if(isloggedin()){ + $area3 = elgg_view("bookmarks/bookmarklet_menu_option"); + //include a view for plugins to extend + $area3 .= elgg_view("bookmarks/favourite", array("object_type" => 'bookmarks')); +} +//include a view for plugins to extend +$area3 .= elgg_view("bookmarks/sidebar_options", array("object_type" => 'bookmarks')); +//include stats +$area3 .= elgg_view("bookmarks/stats"); +// Format page +$body = elgg_view_layout('one_column_with_sidebar', $area3, $area1.$area2); + +// Draw it +echo page_draw(elgg_echo('bookmarks:all'),$body);
\ No newline at end of file diff --git a/mod/bookmarks/bookmarklet.php b/mod/bookmarks/bookmarklet.php index 7e24a55c6..c8a488f13 100644 --- a/mod/bookmarks/bookmarklet.php +++ b/mod/bookmarks/bookmarklet.php @@ -1,35 +1,39 @@ <?php - /** - * Elgg bookmarks plugin bookmarklet 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/ - */ +/** + * Elgg bookmarks plugin bookmarklet 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"); +// Start engine +require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - gatekeeper(); +gatekeeper(); - // Get the current page's owner - $page_owner = page_owner_entity(); - if ($page_owner === false || is_null($page_owner) && ($_SESSION['user'])) { - $page_owner = $_SESSION['user']; - set_page_owner($page_owner->getGUID()); - } +// Get the current page's owner +$page_owner = page_owner_entity(); +if ($page_owner === false || is_null($page_owner) && ($_SESSION['user'])) { + $page_owner = $_SESSION['user']; + set_page_owner($page_owner->getGUID()); +} - // List bookmarks - $area2 = elgg_view_title(elgg_echo('bookmarks:bookmarklet')); - $area2 .= elgg_view('bookmarks/bookmarklet', array('pg_owner' => $page_owner)); +// get the content area header +$area1 = elgg_view('page_elements/content_header', array('context' => "mine", 'type' => 'bookmarks')); - // Format page - $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2); +// List bookmarks +$area2 = elgg_view_title(elgg_echo('bookmarks:bookmarklet')); +$area2 .= elgg_view('bookmarks/bookmarklet', array('pg_owner' => $page_owner)); - // Draw it - page_draw(elgg_echo('bookmarks:bookmarklet'),$body); - -?>
\ No newline at end of file +// if logged in, get the bookmarklet +$area3 = elgg_view("bookmarks/bookmarklet_menu_option"); + +// Format page +$body = elgg_view_layout('one_column_with_sidebar', $area3, $area1.$area2); + +// Draw it +echo page_draw(elgg_echo('bookmarks:bookmarklet'),$body);
\ No newline at end of file diff --git a/mod/bookmarks/everyone.php b/mod/bookmarks/everyone.php deleted file mode 100644 index 70e60da2c..000000000 --- a/mod/bookmarks/everyone.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php - - /** - * Elgg bookmarks plugin everyone page - * - * @package ElggBookmarks - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ - */ - - // Start engine - require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - - // 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($_SESSION['guid']); - } - - // List bookmarks - $area2 = elgg_view_title(elgg_echo('bookmarks:everyone')); - set_context('search'); - $area2 .= elgg_list_entities(array('type' => 'object', 'subtype' => 'bookmarks', 'limit' => 10, 'full_view' => FALSE, 'view_toggle_type' => FALSE)); - set_context('bookmarks'); - - // Format page - $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2); - - // Draw it - page_draw(elgg_echo('bookmarks:everyone'),$body); - -?>
\ No newline at end of file diff --git a/mod/bookmarks/friends.php b/mod/bookmarks/friends.php index 8d61f47d2..a327043d6 100644 --- a/mod/bookmarks/friends.php +++ b/mod/bookmarks/friends.php @@ -1,28 +1,33 @@ <?php +/** + * Elgg bookmarks plugin friends' 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/ + */ - /** - * Elgg bookmarks plugin friends' 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"); +// Start engine +require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + +// get the filter menu +$area1 = elgg_view("page_elements/content_header", array('context' => "friends", 'type' => 'bookmarks')); + +// List bookmarks +set_context('search'); +$area2 .= list_user_friends_objects(page_owner(),'bookmarks',10,false,false); +set_context('bookmarks'); - // List bookmarks - $area2 = elgg_view_title(elgg_echo('bookmarks:friends')); - set_context('search'); - $area2 .= list_user_friends_objects(page_owner(),'bookmarks',10,false,false); - set_context('bookmarks'); +// sidebar options +$area3 = elgg_view("bookmarks/sidebar_options", array("object_type" => 'bookmarks')); - // Format page - $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2); +// if logged in, get the bookmarklet +$area3 .= elgg_view("bookmarks/bookmarklet_menu_option"); - // Draw it - page_draw(elgg_echo('bookmarks:friends'),$body); - -?>
\ No newline at end of file +// Format page +$body = elgg_view_layout('one_column_with_sidebar', $area3, $area1.$area2); + +// Draw it +echo page_draw(elgg_echo('bookmarks:friends'),$body);
\ No newline at end of file diff --git a/mod/bookmarks/inbox.php b/mod/bookmarks/inbox.php deleted file mode 100644 index 061a51e18..000000000 --- a/mod/bookmarks/inbox.php +++ /dev/null @@ -1,28 +0,0 @@ -<?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/index.php b/mod/bookmarks/index.php index 195327ebe..f319ceb63 100644 --- a/mod/bookmarks/index.php +++ b/mod/bookmarks/index.php @@ -1,36 +1,61 @@ <?php +/** + * Elgg bookmarks plugin index page + * + * @package ElggBookmarks + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider <info@elgg.com> + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ - /** - * Elgg bookmarks plugin index page - * - * @package ElggBookmarks - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ - */ +global $CONFIG; - // Start engine - require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - - $page_owner = page_owner_entity(); - if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; - set_page_owner($page_owner->getGUID()); - } - - $title = sprintf(elgg_echo('bookmarks:read'), $page_owner->name); - - // List bookmarks - $area2 = elgg_view_title($title); - set_context('search'); - $area2 .= elgg_list_entities(array('type' => 'object', 'subtype' => 'bookmarks', 'container_guid' => page_owner(), 'limit' => 10, 'full_view' => FALSE, 'view_type_toggle' => FALSE)); - set_context('bookmarks'); - - // Format page - $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2); +// Start engine +require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + +$page_owner = page_owner_entity(); +if ($page_owner === false || is_null($page_owner)) { + $page_owner = $_SESSION['user']; + set_page_owner($page_owner->getGUID()); +} - // Draw it - page_draw($title, $body); +//set bookmarks header +if(page_owner()== get_loggedin_user()->guid){ + $area1 .= elgg_view('page_elements/content_header', array('context' => "own", 'type' => 'bookmarks')); +}else{ + $area1 .= elgg_view('page_elements/breadcrumbs', array( + 'breadcrumb_root_url' => $CONFIG->wwwroot."mod/bookmarks/all.php", + 'breadcrumb_root_text' => elgg_echo('bookmarks:all'), + 'breadcrumb_currentpage' => sprintf(elgg_echo("bookmarks:user"),$page_owner->name) + )); + + $area1 .= elgg_view('page_elements/content_header_member', array('type' => 'bookmarks')); +} + +// List bookmarks +set_context('search'); +$bookmarks = list_entities('object','bookmarks',page_owner()); +if(!$bookmarks && ($page_owner->guid == get_loggedin_user()->guid)) + $bookmarks = elgg_view('help/bookmarks'); +$area2 .= $bookmarks; +set_context('bookmarks'); -?>
\ No newline at end of file +//if the logged in user is not looking at their stuff, display the ownerblock +if(page_owner() != get_loggedin_user()->guid){ + $area3 = elgg_view('bookmarks/ownerblock'); +}else{ + if(isloggedin()){ + //include a view for plugins to extend + $area3 = elgg_view("bookmarks/favourite", array("object_type" => 'bookmarks')); + // if logged in, get the bookmarklet + $area3 .= elgg_view("bookmarks/bookmarklet_menu_option"); + } +} +//include a view for plugins to extend +$area3 .= elgg_view("bookmarks/sidebar_options", array("object_type" => 'bookmarks')); +// Format page +$body = elgg_view_layout('one_column_with_sidebar', $area3, $area1.$area2); + +// Draw it +echo page_draw(sprintf(elgg_echo("bookmarks:user"),page_owner_entity()->name), $body);
\ No newline at end of file diff --git a/mod/bookmarks/languages/en.php b/mod/bookmarks/languages/en.php index da8476aa2..ee3056975 100644 --- a/mod/bookmarks/languages/en.php +++ b/mod/bookmarks/languages/en.php @@ -1,79 +1,89 @@ <?php - $english = array( - - /** - * Menu items and titles - */ - - 'bookmarks' => "Bookmarks", - 'bookmarks:add' => "Add bookmark", - 'bookmarks:read' => "%s's bookmarked items", - 'bookmarks:friends' => "Friends' bookmarks", - 'bookmarks:everyone' => "All site bookmarks", - 'bookmarks:this' => "Bookmark this", - 'bookmarks:this:group' => "Bookmark in %s", - 'bookmarks:bookmarklet' => "Get bookmarklet", - 'bookmarks:bookmarklet:group' => "Get group bookmarklet", - 'bookmarks:inbox' => "Bookmarks inbox", - 'bookmarks:more' => "More", - 'bookmarks:shareditem' => "Bookmarked item", - 'bookmarks:with' => "Share with", - 'bookmarks:new' => "A new bookmarked item", - 'bookmarks:via' => "via bookmarks", - 'bookmarks:address' => "Address of the resource to bookmark", - - 'bookmarks:delete:confirm' => "Are you sure you want to delete this resource?", - - 'bookmarks:numbertodisplay' => 'Number of bookmarked items to display', - - 'bookmarks:shared' => "Bookmarked", - 'bookmarks:visit' => "Visit resource", - 'bookmarks:recent' => "Recent bookmarks", - - '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:group' => 'Group bookmarks', - 'bookmarks:enablebookmarks' => 'Enable group bookmarks', - - - /** - * More text - */ - - 'bookmarks:widget:description' => - "This widget is designed for your dashboard and will show you the latest items in your bookmarks inbox.", - - 'bookmarks:bookmarklet:description' => - "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, select 'add to favorites', and then the Links bar.", - - 'bookmarks:bookmarklet:description:conclusion' => - "You can then save any page you visit by clicking it at any time.", - - /** - * Status messages - */ - - 'bookmarks:save:success' => "Your item was successfully bookmarked.", - 'bookmarks:delete:success' => "Your bookmarked item was successfully deleted.", - - /** - * Error messages - */ - - 'bookmarks:save:failed' => "Your bookmarked item could not be saved. Please try again.", - 'bookmarks:delete:failed' => "Your bookmarked item could not be deleted. Please try again.", - - - ); - - add_translation("en",$english); +$english = array( + + /** + * Menu items and titles + */ + + 'bookmarks' => "Bookmarks", + 'bookmarks:add' => "Bookmark something", + 'bookmarks:read' => "Bookmark list", + 'bookmarks:friends' => "Friends' bookmarks", + 'bookmarks:all' => "All site bookmarks", + 'bookmarks:user' => "%s's bookmarks", + 'bookmarks:workgroup' => "Work Group bookmarks", + 'bookmarks:this' => "Bookmark this", + 'bookmarks:this:group' => "Bookmark in %s", + 'bookmarks:bookmarklet' => "Get bookmarklet", + 'bookmarks:bookmarklet:group' => "Get community bookmarklet", + 'bookmarks:inbox' => "Bookmarks inbox", + 'bookmarks:more' => "View note", + 'bookmarks:yours' => "My bookmarks", + 'bookmarks:shareditem' => "Bookmarked item", + 'bookmarks:with' => "Share with", + 'bookmarks:new' => "Add a Bookmark", + 'bookmarks:via' => "via bookmarks", + 'bookmarks:address' => "Address of the resource to bookmark", + 'bookmarks:addnote' => "Add a note", + '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:river:created' => '%s bookmarked', + 'bookmarks:river:annotate' => 'posted a comment on this bookmarked item', + 'bookmarks:river:item' => 'an item', + + 'item:object:bookmarks' => 'Bookmarked items', + + 'bookmarks:group' => 'Community bookmarks', + 'bookmarks:enablebookmarks' => 'Enable community 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?', + + /** + * More text + */ + + 'bookmarks:widget:description' => + "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.", + + '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:description:conclusion' => + "You can then bookmark any webpage you visit by clicking the button in your browsers toolbar.", + + /** + * Status messages + */ + + 'bookmarks:save:success' => "Your item was successfully bookmarked.", + 'bookmarks:delete:success' => "Your bookmarked item was successfully deleted.", + + /** + * Error messages + */ + + 'bookmarks:save:failed' => "Your bookmarked item could not be saved. Please try again.", + 'bookmarks:delete:failed' => "Your bookmarked item could not be deleted. Please try again.", + + +); + +add_translation("en",$english); ?>
\ No newline at end of file diff --git a/mod/bookmarks/start.php b/mod/bookmarks/start.php index 9b7e1566b..b775bf9b1 100644 --- a/mod/bookmarks/start.php +++ b/mod/bookmarks/start.php @@ -1,5 +1,4 @@ <?php - /** * Elgg Bookmarks plugin * @@ -12,23 +11,19 @@ // Bookmarks initialisation function function bookmarks_init() { - // Grab the config global global $CONFIG; //add a tools menu option if (isloggedin()) { - add_menu(elgg_echo('bookmarks'), $CONFIG->wwwroot . "pg/bookmarks/" . $_SESSION['user']->username . '/items'); - - // add "bookmark this" to owner block - elgg_extend_view('owner_block/extend', 'bookmarks/owner_block'); + add_menu(elgg_echo('bookmarks:yours'), $CONFIG->wwwroot . "pg/bookmarks/" . $_SESSION['user']->username . '/items'); } // Register a page handler, so we can have nice URLs - register_page_handler('bookmarks','bookmarks_page_handler'); + register_page_handler('bookmarks', 'bookmarks_page_handler'); // Add our CSS - elgg_extend_view('css','bookmarks/css'); + elgg_extend_view('css', 'bookmarks/css'); // Register granular notification for this type if (is_callable('register_notification_object')) { @@ -58,52 +53,38 @@ function bookmarks_init() { */ function bookmarks_pagesetup() { global $CONFIG; - - $page_owner = page_owner_entity(); - + + // Set up menu for logged in users //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/" . $page_owner->username . "/add"); - } - } else { - add_submenu_item(elgg_echo('bookmarks:add'), $CONFIG->wwwroot."pg/bookmarks/" . $_SESSION['user']->username . "/add"); - add_submenu_item(elgg_echo('bookmarks:inbox'),$CONFIG->wwwroot."pg/bookmarks/" . $_SESSION['user']->username . "/inbox"); - } if (page_owner()) { - add_submenu_item(sprintf(elgg_echo('bookmarks:read'), $page_owner->name),$CONFIG->wwwroot."pg/bookmarks/" . $page_owner->username . "/items"); + $page_owner = page_owner_entity(); + add_submenu_item(elgg_echo('bookmarks:read'),$CONFIG->wwwroot."pg/bookmarks/" . $page_owner->username . "/items"); } - if (!$page_owner instanceof ElggGroup) { - add_submenu_item(elgg_echo('bookmarks:friends'),$CONFIG->wwwroot."pg/bookmarks/" . $_SESSION['user']->username . "/friends"); + if(!$page_owner instanceof ElggGroup) + add_submenu_item(elgg_echo('bookmarks:friends'),$CONFIG->wwwroot."pg/bookmarks/" . $_SESSION['user']->username . "/friends"); } - } - - if (!$page_owner instanceof ElggGroup) { - add_submenu_item(elgg_echo('bookmarks:everyone'),$CONFIG->wwwroot."mod/bookmarks/everyone.php"); - } - - // 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'); + if(!$page_owner instanceof ElggGroup) + add_submenu_item(elgg_echo('bookmarks:everyone'),$CONFIG->wwwroot."mod/bookmarks/everyone.php"); + + // Bookmarklet + if ((isloggedin()) && (page_owner()) && (can_write_to_container(0, page_owner()))) { + $page_owner = page_owner_entity(); + $bmtext = elgg_echo('bookmarks:bookmarklet'); + if ($page_owner instanceof ElggGroup) + $bmtext = elgg_echo('bookmarks:bookmarklet:group'); + add_submenu_item($bmtext, $CONFIG->wwwroot . "pg/bookmarks/{$page_owner->username}/bookmarklet"); } - add_submenu_item($bmtext, $CONFIG->wwwroot . "pg/bookmarks/{$page_owner->username}/bookmarklet"); } - - } - - 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/" . $page_owner->username . '/items'); - } - } - + + $page_owner = page_owner_entity(); + + 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/" . $page_owner->username . '/items'); + } + } } /** @@ -122,23 +103,25 @@ function bookmarks_page_handler($page) { // The second part dictates what we're doing if (isset($page[1])) { switch($page[1]) { - case "read": set_input('guid',$page[2]); - require(dirname(dirname(dirname(__FILE__))) . "/entities/index.php"); + case "friends": + include(dirname(__FILE__) . "/friends.php"); return true; break; - case "friends": include(dirname(__FILE__) . "/friends.php"); + case "items": + include(dirname(__FILE__) . "/index.php"); return true; break; - case "inbox": include(dirname(__FILE__) . "/inbox.php"); + case "add": + include(dirname(__FILE__) . "/add.php"); return true; break; - case "items": include(dirname(__FILE__) . "/index.php"); + case "edit": + set_input('bookmark',$page[2]); + include(dirname(__FILE__) . "/add.php"); return true; break; - case "add": include(dirname(__FILE__) . "/add.php"); - return true; - break; - case "bookmarklet": include(dirname(__FILE__) . "/bookmarklet.php"); + case "bookmarklet": + include(dirname(__FILE__) . "/bookmarklet.php"); return true; break; } @@ -201,6 +184,26 @@ 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; +} // Make sure the initialisation function is called on initialisation register_elgg_event_handler('init','system','bookmarks_init'); @@ -209,6 +212,7 @@ register_elgg_event_handler('pagesetup','system','bookmarks_pagesetup'); // Register actions global $CONFIG; register_action('bookmarks/add',false,$CONFIG->pluginspath . "bookmarks/actions/add.php"); +register_action('bookmarks/edit',false,$CONFIG->pluginspath . "bookmarks/actions/edit.php"); register_action('bookmarks/delete',false,$CONFIG->pluginspath . "bookmarks/actions/delete.php"); - -?>
\ No newline at end of file +register_action('bookmarks/reference',false,$CONFIG->pluginspath . "bookmarks/actions/reference.php"); +register_action('bookmarks/remove',false,$CONFIG->pluginspath . "bookmarks/actions/remove.php");
\ 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 b7a4757f6..88e456de6 100644 --- a/mod/bookmarks/views/default/bookmarks/bookmarklet.php +++ b/mod/bookmarks/views/default/bookmarks/bookmarklet.php @@ -1,32 +1,31 @@ <?php +/** + * Elgg get bookmarks bookmarklet view + * + * @package ElggBookmarks + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider <info@elgg.com> + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ - /** - * Elgg get bookmarks bookmarklet view - * - * @package ElggBookmarks - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ - */ +$page_owner = $vars['pg_owner']; - $page_owner = $vars['pg_owner']; - - $bookmarktext = elgg_echo("bookmarks:this"); - if ($page_owner instanceof ElggGroup) - $bookmarktext = sprintf(elgg_echo("bookmarks:this:group"), $page_owner->name) +$bookmarktext = elgg_echo("bookmarks:this"); +if ($page_owner instanceof ElggGroup) + $bookmarktext = sprintf(elgg_echo("bookmarks:this:group"), $page_owner->name) ?> - <div class="contentWrapper"> - <p> - <?php echo elgg_echo("bookmarks:bookmarklet:description"); ?> - </p> - <p class="sharing_bookmarklet"> - <a href="javascript:location.href='<?php echo $vars['url']; ?>pg/bookmarks/<?php echo $page_owner->username; ?>/add?address='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)"> <img src="<?php echo $vars['url']; ?>_graphics/elgg_bookmarklet.gif" border="0" title="<?php echo $bookmarktext ?>" /> </a> - </p> - <p> - <?php echo elgg_echo("bookmarks:bookmarklet:descriptionie"); ?> - </p> - <p> - <?php echo elgg_echo("bookmarks:bookmarklet:description:conclusion"); ?> - </p> - </div>
\ No newline at end of file +<div class="contentWrapper"> +<p> + <?php echo elgg_echo("bookmarks:bookmarklet:description"); ?> +</p> +<p class="sharing_bookmarklet"> + <a href="javascript:location.href='<?php echo $vars['url']; ?>pg/bookmarks/<?php echo $page_owner->username; ?>/add?address='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)"> <img src="<?php echo $vars['url']; ?>_graphics/elgg_bookmarklet.gif" border="0" title="<?php echo $bookmarktext ?>" /> </a> +</p> +<p> + <?php echo elgg_echo("bookmarks:bookmarklet:descriptionie"); ?> +</p> +<p> + <?php echo elgg_echo("bookmarks:bookmarklet:description:conclusion"); ?> +</p> +</div>
\ No newline at end of file diff --git a/mod/bookmarks/views/default/bookmarks/bookmarklet_menu_option.php b/mod/bookmarks/views/default/bookmarks/bookmarklet_menu_option.php new file mode 100755 index 000000000..6af2e5a1d --- /dev/null +++ b/mod/bookmarks/views/default/bookmarks/bookmarklet_menu_option.php @@ -0,0 +1,23 @@ +<?php
+/**
+ * bookmarklet tool
+ **/
+$page_owner = page_owner_entity();
+?>
+<h3>Browser Bookmarklet</h3>
+<a href="javascript:location.href='<?php echo $vars['url']; ?>pg/bookmarks/<?php echo $page_owner->username; ?>/add?address='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)"> <img src="<?php echo $vars['url']; ?>_graphics/elgg_bookmarklet.gif" border="0" title="<?php echo elgg_echo('bookmarks:this');?>" /> </a>
+<br />
+<a href="#" onclick="elgg_slide_toggle(this,'#elgg_sidebar','.bookmarklet');">Instructions</a>
+
+<div class="bookmarklet hidden">
+ <p>
+ <?php echo elgg_echo("bookmarks:bookmarklet:description"); ?>
+ </p>
+ <p>
+ <?php echo elgg_echo("bookmarks:bookmarklet:descriptionie"); ?>
+ </p>
+
+ <p>
+ <?php echo elgg_echo("bookmarks:bookmarklet:description:conclusion"); ?>
+ </p>
+</div>
\ No newline at end of file diff --git a/mod/bookmarks/views/default/bookmarks/css.php b/mod/bookmarks/views/default/bookmarks/css.php index 71d2d9ed6..94ba3768f 100644 --- a/mod/bookmarks/views/default/bookmarks/css.php +++ b/mod/bookmarks/views/default/bookmarks/css.php @@ -1,125 +1,51 @@ <?php - - /** - * Elgg bookmarks CSS - * - * @package ElggBookmarks - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ - */ - +/** + * Elgg bookmarks CSS + * + * @package ElggBookmarks + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider <info@elgg.com> + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ ?> -.sharing_item { - -} - -.sharing_item_owner { - font-size: 90%; - margin: 10px 0 0 0; - color:#666666; -} - -.sharing_item_owner .icon { - float: left; - margin-right: 5px; - -} -.sharing_item_title h3 { - font-size: 150%; - margin-bottom: 5px; -} -.sharing_item_title h3 a { - text-decoration: none; -} -.sharing_item_description p { - margin:0; - padding:0 0 5px 0; -} -.sharing_item_tags { - background:transparent url(<?php echo $vars['url']; ?>_graphics/icon_tag.gif) no-repeat scroll left 2px; - margin:0; - padding:0 0 0 14px; -} - -.sharing_item_address a { - font: 12px/100% Arial, Helvetica, sans-serif; - font-weight: bold; - color: #ffffff; - background:#4690d6; - border: 1px solid #4690d6; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - width: auto; - height: 25px; - padding: 2px 6px 2px 6px; - margin:10px 0 10px 0; +.bookmark_note { + margin:0 0 0 5px; cursor: pointer; } -.sharing_item_address a:hover { - background: #0054a7; - border: 1px solid #0054a7; - text-decoration: none; -} -.sharing_item_controls p { - margin:0; +.note { + margin-top:5px; } - -/* SHARES WIDGET VIEW */ -.shares_widget_wrapper { - background-color: white; - margin:0 10px 5px 10px; - padding:5px; - -webkit-border-radius: 8px; - -moz-border-radius: 8px; -} -.shares_widget_icon { - float: left; - margin-right: 10px; -} -.shares_timestamp { - color:#666666; - margin:0; +/* BOOKMARKS WIDGET +.collapsable_box_content .ContentWrapper.bookmarks { + margin-bottom:5px; + line-height:1.2em; } -.share_desc { +.collapsable_box_content .ContentWrapper.bookmarks .share_desc { display:none; line-height: 1.2em; } -.shares_widget_content { - margin-left: 35px; +.collapsable_box_content .ContentWrapper.bookmarks .share_desc p { + margin:0 0 5px 0; } -.shares_title { - margin:0; - line-height: 1.2em; +.collapsable_box_content .ContentWrapper.bookmarks .river_object_bookmarks_create p { + min-height:17px; + padding:0 0 0 17px; } - -/* timestamp and user info in gallery and list view */ -.search_listing_info .shares_gallery_user, -.share_gallery_info .shares_gallery_user, -.share_gallery_info .shares_gallery_comments { +.collapsable_box_content .ContentWrapper.bookmarks .shares_timestamp { color:#666666; margin:0; - font-size: 90%; -} - - -/* *************************************** -PAGE-OWNER BLOCK -*************************************** */ -#owner_block_bookmark_this { - padding:5px 0 0 0; + padding:0 0 0 17px; } -#owner_block_bookmark_this a { - font-size: 90%; - color:#999999; - padding:0 0 4px 20px; - background: url(<?php echo $vars['url']; ?>_graphics/icon_bookmarkthis.gif) no-repeat left top; +.collapsable_box_content .ContentWrapper.bookmarks .shares_title { + margin:0; + line-height: 1.1em; } -#owner_block_bookmark_this a:hover { - color: #0054a7; +.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 94897d0b0..0052cccf9 100644 --- a/mod/bookmarks/views/default/bookmarks/form.php +++ b/mod/bookmarks/views/default/bookmarks/form.php @@ -1,139 +1,111 @@ <?php - /** - * Elgg bookmarks plugin form - * - * @package ElggBookmarks - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ - */ - - // Have we been supplied with an entity? - if (isset($vars['entity'])) { - - $guid = $vars['entity']->getGUID(); - $title = $vars['entity']->title; - $description = $vars['entity']->description; - $address = $vars['entity']->address; - $tags = $vars['entity']->tags; - $access_id = $vars['entity']->access_id; - $shares = $vars['entity']->shares; - $owner = $vars['entity']->getOwnerEntity(); - $highlight = 'default'; - - } else { - - $guid = 0; - $title = get_input('title',""); - $description = ""; - $address = get_input('address',""); - $highlight = 'all'; - - if ($address == "previous") - $address = $_SERVER['HTTP_REFERER']; - $tags = array(); - - if (defined('ACCESS_DEFAULT')) - $access_id = ACCESS_DEFAULT; - else - $access_id = 0; - $shares = array(); - $owner = $vars['user']; - - } +/** + * Elgg bookmarks plugin form + * + * @package ElggBookmarks + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider <info@elgg.com> + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ +if(isset($vars['entity'])){ + $guid = $vars['entity']->guid; + $title = $vars['entity']->title; + $address = $vars['entity']->address; + $access_id = $vars['entity']->access_id; + $tags = $vars['entity']->tags; + $notes = $vars['entity']->description; + $url = "action/bookmarks/edit"; +}else{ + //set some variables + $guid = ''; + $title = get_input('title',""); + $address = get_input('address',""); + $notes = ''; + if ($address == "previous") + $address = $_SERVER['HTTP_REFERER']; + $tags = array(); + if(page_owner_entity() instanceof ElggGroup){ + //if in a group, set the access level to default to the group + $access_id = page_owner_entity()->group_acl; + }else{ + $access_id = get_default_access(get_loggedin_user()); + } + $owner = $vars['user']; + $url = "action/bookmarks/add"; +} ?> -<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> +<form class="action" action="<?php echo $vars['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('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 - } + echo elgg_view('input/text',array( + 'internalname' => 'notes', + 'value' => $notes, + )); ?> - <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 + </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(page_owner_entity() instanceof ElggGroup){ + $access_options = group_access_options(page_owner_entity()); + 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> +</form>
\ 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 deleted file mode 100644 index 2cc8f6118..000000000 --- a/mod/bookmarks/views/default/bookmarks/owner_block.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -$label = elgg_echo('bookmarks:this'); -$url = "'" . $vars['url'] . "mod/bookmarks/add.php?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 deleted file mode 100644 index 63738d94d..000000000 --- a/mod/bookmarks/views/default/bookmarks/sharing.php +++ /dev/null @@ -1,80 +0,0 @@ -<?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 new file mode 100755 index 000000000..cd47a94cc --- /dev/null +++ b/mod/bookmarks/views/default/bookmarks/stats.php @@ -0,0 +1,10 @@ +<?php
+/**
+ * All site bookmark stats
+ **/
+
+$count_bookmarks = get_entities("object", "bookmarks",0,"",10,0,true,0,null,0,0);
+$count_bookmark_comments = count_annotations(0, "object", "bookmarks","generic_comment");
+
+echo "<h3>Bookmark stats</h3>";
+echo "<p>".$count_bookmarks . " resources bookmarked.</p>";
diff --git a/mod/bookmarks/views/default/object/bookmarks.php b/mod/bookmarks/views/default/object/bookmarks.php index 45ed46769..95baf5f54 100644 --- a/mod/bookmarks/views/default/object/bookmarks.php +++ b/mod/bookmarks/views/default/object/bookmarks.php @@ -1,145 +1,82 @@ <?php - - /** - * Elgg bookmark view - * - * @package ElggBookmarks - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ - */ - - $owner = $vars['entity']->getOwnerEntity(); - $friendlytime = friendly_time($vars['entity']->time_created); - - if (get_context() == "search") { - - if (get_input('search_viewtype') == "gallery") { - - $parsed_url = parse_url($vars['entity']->address); - $faviconurl = $parsed_url['scheme'] . "://" . $parsed_url['host'] . "/favicon.ico"; - - $info = "<p class=\"shares_gallery_title\">". elgg_echo("bookmarks:shared") .": <a href=\"{$vars['entity']->getURL()}\">{$vars['entity']->title}</a> (<a href=\"{$vars['entity']->address}\">".elgg_echo('bookmarks:visit')."</a>)</p>"; - $info .= "<p class=\"shares_gallery_user\">By: <a href=\"{$vars['url']}pg/bookmarks/{$owner->username}\">{$owner->name}</a> <span class=\"shared_timestamp\">{$friendlytime}</span></p>"; - $numcomments = elgg_count_comments($vars['entity']); - if ($numcomments) - $info .= "<p class=\"shares_gallery_comments\"><a href=\"{$vars['entity']->getURL()}\">".sprintf(elgg_echo("comments")). " (" . $numcomments . ")</a></p>"; - - //display - echo "<div class=\"share_gallery_view\">"; - echo "<div class=\"share_gallery_info\">" . $info . "</div>"; - echo "</div>"; - - - } else { - - $parsed_url = parse_url($vars['entity']->address); - $faviconurl = $parsed_url['scheme'] . "://" . $parsed_url['host'] . "/favicon.ico"; - if (@file_exists($faviconurl)) { - $icon = "<img src=\"{$faviconurl}\" />"; - } else { - $icon = elgg_view( - "profile/icon", array( - 'entity' => $owner, - 'size' => 'small', - ) - ); - } - - $info = "<p class=\"shares_gallery_title\">". elgg_echo("bookmarks:shared") .": <a href=\"{$vars['entity']->getURL()}\">{$vars['entity']->title}</a> (<a href=\"{$vars['entity']->address}\">".elgg_echo('bookmarks:visit')."</a>)</p>"; - $info .= "<p class=\"owner_timestamp\"><a href=\"{$vars['url']}pg/bookmarks/{$owner->username}\">{$owner->name}</a> {$friendlytime}"; - $numcomments = elgg_count_comments($vars['entity']); - if ($numcomments) - $info .= ", <a href=\"{$vars['entity']->getURL()}\">".sprintf(elgg_echo("comments")). " (" . $numcomments . ")</a>"; - $info .= "</p>"; - echo elgg_view_listing($icon, $info); - - } - - } else { - -?> - <?php echo elgg_view_title(elgg_echo('bookmarks:shareditem'), false); ?> - <div class="contentWrapper"> - <div class="sharing_item"> +/** + * Elgg bookmark view + * + * @package ElggBookmarks + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider <info@elgg.com> + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ + +$owner = $vars['entity']->getOwnerEntity(); +$friendlytime = friendly_time($vars['entity']->time_created); +$parsed_url = parse_url($vars['entity']->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='group_open'"; + else + $access_level = "class='group_closed'"; +}elseif($object_acl == 'Private'){ + $access_level = "class='private'"; +}else{ + if(!in_array($object_acl, $general_access)) + $access_level = "class='shared_collection'"; + else + $access_level = "class='entity_access'"; +} + +if($vars['entity']->description != '') + $view_notes = "<a class='bookmark_note' onclick=\"elgg_slide_toggle(this,'.entity_listing','.note');\">note</a>"; +else + $view_notes = ''; +if (@file_exists($faviconurl)) { + $icon = "<img src=\"{$faviconurl}\" />"; +} 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' => $vars['url'] . "action/bookmarks/delete?bookmark_guid=" . $vars['entity']->guid, + 'text' => elgg_echo("delete"), + 'confirm' => elgg_echo("bookmarks:delete:confirm"), + )) . "</span>"; +} + + $info = "<div class='entity_metadata'><table><tr><td><span {$access_level}>{$object_acl}</span></td>"; + +//include edit and delete options +if($vars['entity']->canEdit()){ + $info .= "<td class='entity_edit'><a href=\"{$vars['url']}pg/bookmarks/{$owner->username}/edit/{$vars['entity']->getGUID()}\">" . elgg_echo('edit') . "</a></td>"; + $info .= "<td class='entity_delete'>".$delete."</td>"; +} + $info .= "</tr></table></div>"; + +$info .= "<p class='entity_title'><a href=\"{$vars['entity']->address}\">{$vars['entity']->title}</a></p>"; +$info .= "<p class='entity_subtext'>Bookmarked by <a href=\"{$vars['url']}pg/bookmarks/{$owner->username}\">{$owner->name}</a> {$friendlytime} {$view_notes}</p>"; + +$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>"; +} - <div class="sharing_item_title"> - <h3> - <a href="<?php echo $vars['entity']->address; ?>"><?php echo $vars['entity']->title; ?></a> - </h3> - </div> - <div class="sharing_item_owner"> - <p> - <b><a href="<?php echo $vars['url']; ?>pg/bookmarks/<?php echo $owner->username; ?>"><?php echo $owner->name; ?></a></b> - <?php echo $friendlytime; ?> - </p> - </div> - <div class="sharing_item_description"> - <?php echo elgg_view('output/longtext', array('value' => $vars['entity']->description)); ?> - </div> -<?php - - $tags = $vars['entity']->tags; - if (!empty($tags)) { - -?> - <div class="sharing_item_tags"> - <p> - <?php echo elgg_view('output/tags',array('value' => $vars['entity']->tags)); ?> - </p> - </div> -<?php - - } - -?> - <div class="sharing_item_address"> - <p> - <?php - - //echo elgg_view('output/url',array('value' => $vars['entity']->address)); - - ?> - <a href="<?php echo $vars['entity']->address; ?>"><?php echo elgg_echo('bookmarks:visit'); ?></a> - </p> - </div> - <?php - - if ($vars['entity']->canEdit()) { - - ?> - <div class="sharing_item_controls"> - <p> - <a href="<?php echo $vars['url']; ?>mod/bookmarks/add.php?bookmark=<?php echo $vars['entity']->getGUID(); ?>"><?php echo elgg_echo('edit'); ?></a> - <?php - echo elgg_view('output/confirmlink',array( - - 'href' => $vars['url'] . "action/bookmarks/delete?bookmark_guid=" . $vars['entity']->getGUID(), - 'text' => elgg_echo("delete"), - 'confirm' => elgg_echo("bookmarks:delete:confirm"), - - )); - ?> - </p> - </div> - <?php - - } - - ?> - - </div> - </div> -<?php - - if ($vars['full']) - echo elgg_view_comments($vars['entity']); - -?> - -<?php - - } - -?>
\ No newline at end of file +//display +echo elgg_view_listing($icon, $info);
\ 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 deleted file mode 100644 index ce3945a2d..000000000 --- a/mod/bookmarks/views/default/river/object/bookmarks/annotate.php +++ /dev/null @@ -1,13 +0,0 @@ -<?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>"; - -?> - -<?php 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 9e89a95de..1c55c0bb2 100644 --- a/mod/bookmarks/views/default/river/object/bookmarks/create.php +++ b/mod/bookmarks/views/default/river/object/bookmarks/create.php @@ -1,15 +1,18 @@ <?php +/** + * Elgg bookmark river entry view + * + * @package ElggBookmarks + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider <info@elgg.com> + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ - $performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject(); - $object = get_entity($vars['item']->object_guid); - $url = $object->getURL(); - - $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>"; - -?> - -<?php - echo $string; -?>
\ No newline at end of file +$performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject(); +$object = get_entity($vars['item']->object_guid); +$url = $object->getURL(); +$url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; +$string = "<div class=\"river_content_title\">" . sprintf(elgg_echo("bookmarks:river:created"),$url) . " "; +$string .= "<a href=\"" . $object->address . "\">" . $object->title . "</a> <span class=\"river_item_time\">" . friendly_time($object->time_updated) . "</span></div>"; //elgg_echo("bookmarks:river:item") . "</a></div>"; +echo $string;
\ No newline at end of file diff --git a/mod/bookmarks/views/default/widgets/bookmarks/edit.php b/mod/bookmarks/views/default/widgets/bookmarks/edit.php index c399fd6d1..2ae8af6e4 100644 --- a/mod/bookmarks/views/default/widgets/bookmarks/edit.php +++ b/mod/bookmarks/views/default/widgets/bookmarks/edit.php @@ -1,18 +1,27 @@ <?php +/** + * Elgg bookmark widget edit view + * + * @package ElggBookmarks + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider <info@elgg.com> + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ ?> - <p> - <?php echo elgg_echo('bookmarks:numbertodisplay'); ?>: - <select name="params[num_display]"> - <option value="1" <?php if($vars['entity']->num_display == 1) echo "SELECTED"; ?>>1</option> - <option value="2" <?php if($vars['entity']->num_display == 2) echo "SELECTED"; ?>>2</option> - <option value="3" <?php if($vars['entity']->num_display == 3) echo "SELECTED"; ?>>3</option> - <option value="4" <?php if($vars['entity']->num_display == 4) echo "SELECTED"; ?>>4</option> - <option value="5" <?php if($vars['entity']->num_display == 5) echo "SELECTED"; ?>>5</option> - <option value="6" <?php if($vars['entity']->num_display == 6) echo "SELECTED"; ?>>6</option> - <option value="7" <?php if($vars['entity']->num_display == 7) echo "SELECTED"; ?>>7</option> - <option value="8" <?php if($vars['entity']->num_display == 8) echo "SELECTED"; ?>>8</option> - <option value="9" <?php if($vars['entity']->num_display == 9) echo "SELECTED"; ?>>9</option> - <option value="10" <?php if($vars['entity']->num_display == 10) echo "SELECTED"; ?>>10</option> - </select> - </p>
\ No newline at end of file +<p> + <?php echo elgg_echo('bookmarks:numbertodisplay'); ?>: + <select name="params[num_display]"> + <option value="1" <?php if($vars['entity']->num_display == 1) echo "SELECTED"; ?>>1</option> + <option value="2" <?php if($vars['entity']->num_display == 2) echo "SELECTED"; ?>>2</option> + <option value="3" <?php if($vars['entity']->num_display == 3) echo "SELECTED"; ?>>3</option> + <option value="4" <?php if($vars['entity']->num_display == 4) echo "SELECTED"; ?>>4</option> + <option value="5" <?php if($vars['entity']->num_display == 5) echo "SELECTED"; ?>>5</option> + <option value="6" <?php if($vars['entity']->num_display == 6) echo "SELECTED"; ?>>6</option> + <option value="7" <?php if($vars['entity']->num_display == 7) echo "SELECTED"; ?>>7</option> + <option value="8" <?php if($vars['entity']->num_display == 8) echo "SELECTED"; ?>>8</option> + <option value="9" <?php if($vars['entity']->num_display == 9) echo "SELECTED"; ?>>9</option> + <option value="10" <?php if($vars['entity']->num_display == 10) echo "SELECTED"; ?>>10</option> + </select> +</p>
\ No newline at end of file diff --git a/mod/bookmarks/views/default/widgets/bookmarks/view.php b/mod/bookmarks/views/default/widgets/bookmarks/view.php index b7c35d2b8..482a4e3d9 100644 --- a/mod/bookmarks/views/default/widgets/bookmarks/view.php +++ b/mod/bookmarks/views/default/widgets/bookmarks/view.php @@ -1,65 +1,56 @@ - -<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 - - //get the num of shares the user want to display - $num = $vars['entity']->num_display; +<?php +/** + * Elgg bookmark widget view + * + * @package ElggBookmarks + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider <info@elgg.com> + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ + +//get the num of shares the user want to display +$num = $vars['entity']->num_display; - //if no number has been set, default to 4 - if(!$num) - $num = 4; +//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)); +//grab the users bookmarked items +$bookmarks = get_entities('object', 'bookmarks',$vars['entity']->owner_guid, "", $num, 0, false); - if($shares){ +if($bookmarks){ - foreach($shares as $s){ + foreach($bookmarks as $b){ - //get the owner - $owner = $s->getOwnerEntity(); + //get the owner + $owner = $b->getOwnerEntity(); - //get the time - $friendlytime = friendly_time($s->time_created); + //get the time + $friendlytime = friendly_time($b->time_created); - //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 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 details - $info .= "<p class=\"shares_timestamp\"><small><a href=\"{$owner->getURL()}\">{$owner->name}</a> {$friendlytime}</small></p>"; - - //get the bookmark description - 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>"; + //get the user details + $info .= "<p class=\"shares_timestamp\"><small>{$friendlytime} "; + + //get the bookmark description + if($s->description) + $info .= "<a href=\"javascript:void(0);\" class=\"share_more_info\">".elgg_echo('bookmarks:more')."</a></small></p><div class=\"share_desc\"><p>{$s->description}</p></div>"; + else + $info .= "</small></p>"; + + //display + echo "<div class='ContentWrapper bookmarks'>"; + echo "<div class='shares_widget_content'>" . $info . "</div></div>"; - } + } - $user_inbox = $vars['url'] . "pg/bookmarks/" . page_owner_entity()->username . "/inbox"; - echo "<div class=\"shares_widget_wrapper\"><a href=\"{$user_inbox}\">".elgg_echo('bookmarks:inbox')."</a></div>"; + $user_inbox = $vars['url'] . "pg/bookmarks/" . page_owner_entity()->username; + if (get_entities('object', 'bookmarks', $vars['entity']->container_guid, '', '', '', true) > $num) + echo "<div class='ContentWrapper bookmarks more'><a href=\"{$user_inbox}\">".elgg_echo('bookmarks:read')."</a></div>"; - } - - - ?>
\ No newline at end of file +} else { + echo "<div class='ContentWrapper'>" . elgg_echo("bookmarks:widget:description") . "</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 0dc38186e..0a9a46333 100644 --- a/mod/bookmarks/views/rss/object/bookmarks.php +++ b/mod/bookmarks/views/rss/object/bookmarks.php @@ -1,5 +1,13 @@ <?php - +/** + * Elgg bookmark rss view + * + * @package ElggBookmarks + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider <info@elgg.com> + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ $title = $vars['entity']->title; if (empty($title)) { $title = substr($vars['entity']->description,0,32); |