aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/bookmarks/actions/bookmarks/add.php82
-rw-r--r--mod/bookmarks/actions/bookmarks/delete.php40
-rw-r--r--mod/bookmarks/actions/bookmarks/save.php66
-rw-r--r--mod/bookmarks/lib/bookmarks.php43
-rw-r--r--mod/bookmarks/pages/add.php45
-rw-r--r--mod/bookmarks/pages/edit.php36
-rw-r--r--mod/bookmarks/pages/inbox.php28
-rw-r--r--mod/bookmarks/pages/view.php3
-rw-r--r--mod/bookmarks/start.php86
-rw-r--r--mod/bookmarks/views/default/forms/bookmarks/save.php59
-rw-r--r--mod/bookmarks/views/default/object/bookmarks.php10
-rw-r--r--mod/bookmarks/views/default/widgets/bookmarks/content.php31
-rw-r--r--mod/bookmarks/views/default/widgets/bookmarks/edit.php32
-rw-r--r--mod/bookmarks/views/default/widgets/bookmarks/view.php65
14 files changed, 344 insertions, 282 deletions
diff --git a/mod/bookmarks/actions/bookmarks/add.php b/mod/bookmarks/actions/bookmarks/add.php
deleted file mode 100644
index 7d8204ca5..000000000
--- a/mod/bookmarks/actions/bookmarks/add.php
+++ /dev/null
@@ -1,82 +0,0 @@
-<?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
index 48b4a2dd8..d28d84660 100644
--- a/mod/bookmarks/actions/bookmarks/delete.php
+++ b/mod/bookmarks/actions/bookmarks/delete.php
@@ -1,29 +1,17 @@
<?php
+/**
+ * Delete a bookmark
+ *
+ * @package Bookmarks
+ */
- /**
- * Elgg bookmarks delete action
- *
- * @package ElggBookmarks
- */
+$guid = get_input('guid');
+$bookmark = get_entity($guid);
- $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
+if (elgg_instanceof($bookmark, 'object', 'bookmarks') && $bookmark->canEdit() && $bookmark->delete()) {
+ system_message(elgg_echo("bookmarks:delete:success"));
+ forward(REFERER);
+} else {
+ register_error(elgg_echo("bookmarks:delete:failed"));
+ forward(REFERER);
+} \ No newline at end of file
diff --git a/mod/bookmarks/actions/bookmarks/save.php b/mod/bookmarks/actions/bookmarks/save.php
new file mode 100644
index 000000000..abb60314a
--- /dev/null
+++ b/mod/bookmarks/actions/bookmarks/save.php
@@ -0,0 +1,66 @@
+<?php
+/**
+* Elgg bookmarks save action
+*
+* @package Bookmarks
+*/
+
+gatekeeper();
+
+elgg_make_sticky_form('bookmarks');
+
+$title = strip_tags(get_input('title'));
+$description = get_input('description');
+$address = get_input('address');
+$access_id = get_input('access_id');
+$tags = get_input('tags');
+$guid = get_input('guid');
+$share = get_input('share');
+$container_guid = get_input('container_guid', elgg_get_logged_in_user_guid());
+
+if (!$title || !$address || !filter_var($address, FILTER_VALIDATE_URL)) {
+ register_error(elgg_echo('bookmarks:save:failed'));
+ forward(REFERER);
+}
+
+if ($guid == 0) {
+ $bookmark = new ElggObject;
+ $bookmark->subtype = "bookmarks";
+ $bookmark->container_guid = (int)get_input('container_guid', $_SESSION['user']->getGUID());
+ $new = true;
+} else {
+ $bookmark = get_entity($guid);
+ if (!$bookmark->canEdit()) {
+ system_message(elgg_echo('bookmarks:save:failed'));
+ forward(REFERRER);
+ }
+}
+
+$tagarray = string_to_tag_array($tags);
+
+$bookmark->title = $title;
+$bookmark->address = $address;
+$bookmark->description = $description;
+$bookmark->access_id = $access_id;
+$bookmark->tags = $tagarray;
+
+if ($bookmark->save()) {
+ // @todo
+ if (is_array($shares) && sizeof($shares) > 0) {
+ foreach($shares as $share) {
+ $share = (int) $share;
+ add_entity_relationship($bookmark->getGUID(), 'share', $share);
+ }
+ }
+ system_message(elgg_echo('bookmarks:save:success'));
+
+ //add to river only if new
+ if ($new) {
+ add_to_river('river/object/bookmarks/create','create', elgg_get_logged_in_user_guid(), $bookmark->getGUID());
+ }
+
+ forward($bookmark->getURL());
+} else {
+ register_error(elgg_echo('bookmarks:save:failed'));
+ forward("pg/bookmarks");
+}
diff --git a/mod/bookmarks/lib/bookmarks.php b/mod/bookmarks/lib/bookmarks.php
new file mode 100644
index 000000000..0ac333152
--- /dev/null
+++ b/mod/bookmarks/lib/bookmarks.php
@@ -0,0 +1,43 @@
+<?php
+/**
+ * Bookmarks helper functions
+ *
+ * @package Bookmarks
+ */
+
+/**
+ * Prepare the upload/edit form variables
+ *
+ * @param ElggObject $bookmark A bookmark object.
+ * @return array
+ */
+function bookmarks_prepare_form_vars($bookmark = null) {
+ // input names => defaults
+ $values = array(
+ 'title' => '',
+ 'address' => '',
+ 'description' => '',
+ 'access_id' => ACCESS_DEFAULT,
+ 'tags' => '',
+ 'shares' => array(),
+ 'container_guid' => elgg_get_page_owner_guid(),
+ 'guid' => null,
+ 'entity' => $bookmark,
+ );
+
+ if ($bookmark) {
+ foreach (array_keys($values) as $field) {
+ $values[$field] = $bookmark->$field;
+ }
+ }
+
+ if (elgg_is_sticky_form('bookmarks')) {
+ foreach (array_keys($values) as $field) {
+ $values[$field] = elgg_get_sticky_value('bookmarks', $field);
+ }
+ }
+
+ elgg_clear_sticky_form('bookmarks');
+
+ return $values;
+}
diff --git a/mod/bookmarks/pages/add.php b/mod/bookmarks/pages/add.php
index 17e1e6fa4..5a61c2e96 100644
--- a/mod/bookmarks/pages/add.php
+++ b/mod/bookmarks/pages/add.php
@@ -1,36 +1,35 @@
<?php
-
/**
- * Elgg bookmarks plugin add bookmark page
+ * Add bookmark page
*
* @package ElggBookmarks
*/
gatekeeper();
+$bookmark_guid = get_input('guid');
+$bookmark = get_entity($bookmark_guid);
+$container_guid = (int) get_input('container_guid');
+$container = get_entity($container_guid);
-// 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());
+// for groups.
+$page_owner = $container;
+if (elgg_instanceof($container, 'object')) {
+ $page_owner = $container->getContainerEntity();
}
-if ($page_owner instanceof ElggGroup)
- $container = $page_owner->guid;
-$area2 .= elgg_view_title(elgg_echo('bookmarks:this'), false);
+elgg_set_page_owner_guid($page_owner->getGUID());
-// 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));
-}
+$title = elgg_echo('bookmarks:add');
+elgg_push_breadcrumb($title);
+
+$vars = bookmarks_prepare_form_vars();
+$content = elgg_view_form('bookmarks/save', array(), $vars);
-// Format page
-$body = elgg_view_layout('two_column_left_sidebar', $area1, $area2);
+$body = elgg_view_layout('content', array(
+ 'filter' => '',
+ 'buttons' => '',
+ 'content' => $content,
+ 'title' => $title,
+));
-// Draw it
-page_draw(elgg_echo('bookmarks:add'),$body);
+echo elgg_view_page($title, $body); \ No newline at end of file
diff --git a/mod/bookmarks/pages/edit.php b/mod/bookmarks/pages/edit.php
new file mode 100644
index 000000000..1c74a592a
--- /dev/null
+++ b/mod/bookmarks/pages/edit.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Add bookmark page
+ *
+ * @package ElggBookmarks
+ */
+
+gatekeeper();
+$bookmark_guid = get_input('guid');
+$bookmark = get_entity($bookmark_guid);
+$container_guid = (int) get_input('container_guid');
+$container = get_entity($container_guid);
+
+if (!elgg_instanceof($bookmark, 'object', 'bookmarks')) {
+ register_error(elgg_echo('bookmarks:unknown_bookmark'));
+ forward(REFERRER);
+}
+
+// for groups.
+$container = $bookmark->getContainerEntity();
+elgg_set_page_owner_guid($container->getGUID());
+
+$title = elgg_echo('bookmarks:edit');
+elgg_push_breadcrumb($title);
+
+$vars = bookmarks_prepare_form_vars($bookmark);
+$content = elgg_view_form('bookmarks/save', array(), $vars);
+
+$body = elgg_view_layout('content', array(
+ 'filter' => '',
+ 'buttons' => '',
+ 'content' => $content,
+ 'title' => $title,
+));
+
+echo elgg_view_page($title, $body); \ No newline at end of file
diff --git a/mod/bookmarks/pages/inbox.php b/mod/bookmarks/pages/inbox.php
deleted file mode 100644
index 061a51e18..000000000
--- a/mod/bookmarks/pages/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/pages/view.php b/mod/bookmarks/pages/view.php
index 6b4b839b1..131a0b52b 100644
--- a/mod/bookmarks/pages/view.php
+++ b/mod/bookmarks/pages/view.php
@@ -10,9 +10,8 @@ $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 = $owner->name;
-$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 {
diff --git a/mod/bookmarks/start.php b/mod/bookmarks/start.php
index 98449d0d1..a4cba4805 100644
--- a/mod/bookmarks/start.php
+++ b/mod/bookmarks/start.php
@@ -5,9 +5,24 @@
* @package ElggBookmarks
*/
+elgg_register_event_handler('init', 'system', 'bookmarks_init');
+elgg_register_event_handler('pagesetup', 'system', 'bookmarks_pagesetup');
+
+/**
+ * Bookmark init
+ */
function bookmarks_init() {
global $CONFIG;
+ $root = dirname(__FILE__);
+
+ elgg_register_library('elgg:bookmarks', "$root/lib/bookmarks.php");
+ $action_path = "$root/actions/bookmarks";
+
+ elgg_register_action('bookmarks/save', "$action_path/save.php", 'logged_in');
+ elgg_register_action('bookmarks/delete', "$action_path/delete.php", 'logged_in');
+ elgg_register_action('bookmarks/share', "$action_path/share.php", 'logged_in');
+
//add a tools menu option
$item = new ElggMenuItem('bookmarks', elgg_echo('bookmarks'), 'pg/bookmarks/all');
elgg_register_menu_item('site', $item);
@@ -102,18 +117,28 @@ function bookmarks_pagesetup() {
}
/**
- * Bookmarks page handler
- * Expects URLs like:
- * pg/bookmarks/username/[friends||items||add||edit||bookmarklet]
+ * Dispatcher for bookmarks.
+ *
+ * URLs take the form of
+ * All bookmarks: pg/bookmarks/all
+ * User's bookmarks: pg/bookmarks/owner/<username>
+ * Friends' bookmarks: pg/bookmarks/friends/<username>
+ * View bookmark: pg/bookmarks/view/<guid>/<title>
+ * New bookmark: pg/bookmarks/add/<guid> (container: user, group, parent)
+ * Edit bookmark: pg/bookmarks/edit/<guid>
+ * Group bookmarks: pg/bookmarks/group/<guid>/owner
+ * Bookmarklet: pg/bookmarks/bookmarklet/<guid> (user)
*
+ * Title is ignored
*
- * @param array $page From the page_handler function
- * @return true|false Depending on success
+ * @param array $page
*/
function bookmarks_page_handler($page) {
- global $CONFIG;
+ elgg_load_library('elgg:bookmarks');
- // group usernames
+ elgg_push_breadcrumb(elgg_echo('bookmarks'), 'pg/bookmarks/all');
+
+ // old group usernames
if (substr_count($page[0], 'group:')) {
preg_match('/group\:([0-9]+)/i', $page[0], $matches);
$guid = $matches[1];
@@ -128,42 +153,44 @@ function bookmarks_page_handler($page) {
bookmarks_url_forwarder($page);
}
-
$pages = dirname(__FILE__) . '/pages';
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":
+
+ case "friends":
set_input('username', $page[1]);
+ include "$pages/friends.php";
+ break;
+
+ case "read":
+ case "view":
+ set_input('guid', $page[1]);
+ include "$pages/view.php";
+ break;
+
+ case "add":
+ set_input('container_guid', $page[1]);
include "$pages/add.php";
break;
+
case "edit":
- set_input('bookmark', $page[1]);
- include "$pages/add.php";
+ set_input('guid', $page[1]);
+ include "$pages/edit.php";
break;
+
case "bookmarklet":
set_input('username', $page[1]);
include "$pages/bookmarklet.php";
break;
+
default:
return false;
}
@@ -273,13 +300,4 @@ function bookmarks_notify_message($hook, $entity_type, $returnvalue, $params) {
}
return null;
-}
-
-elgg_register_event_handler('init', 'system', 'bookmarks_init');
-elgg_register_event_handler('pagesetup', 'system', 'bookmarks_pagesetup');
-
-// Register actions
-$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
+} \ No newline at end of file
diff --git a/mod/bookmarks/views/default/forms/bookmarks/save.php b/mod/bookmarks/views/default/forms/bookmarks/save.php
new file mode 100644
index 000000000..9b15b542f
--- /dev/null
+++ b/mod/bookmarks/views/default/forms/bookmarks/save.php
@@ -0,0 +1,59 @@
+<?php
+/**
+ * Edit / add a bookmark
+ *
+ * @package Bookmarks
+ */
+
+// once elgg_view stops throwing all sorts of junk into $vars, we can use
+$title = elgg_extract('title', $vars, '');
+$desc = elgg_extract('description', $vars, '');
+$address = elgg_extract('address', $vars, '');
+$tags = elgg_extract('tags', $vars, '');
+$access_id = elgg_extract('access_id', $vars, ACCESS_DEFAULT);
+$container_guid = elgg_extract('container_guid', $vars);
+$guid = elgg_extract('guid', $vars, null);
+$shares = elgg_extract('shares', $vars, array());
+
+?>
+<div>
+ <label><?php echo elgg_echo('title'); ?></label><br />
+ <?php echo elgg_view('input/text', array('name' => 'title', 'value' => $title)); ?>
+</div>
+<div>
+ <label><?php echo elgg_echo('bookmarks:address'); ?></label><br />
+ <?php echo elgg_view('input/text', array('name' => 'address', 'value' => $address)); ?>
+</div>
+<div>
+ <label><?php echo elgg_echo('description'); ?></label>
+ <?php echo elgg_view('input/longtext', array('name' => 'description', 'value' => $desc)); ?>
+</div>
+<div>
+ <label><?php echo elgg_echo('tags'); ?></label>
+ <?php echo elgg_view('input/tags', array('name' => 'tags', 'value' => $tags)); ?>
+</div>
+<?php
+
+$categories = elgg_view('input/categories', $vars);
+if ($categories) {
+ echo $categories;
+}
+
+?>
+<div>
+ <label><?php echo elgg_echo('access'); ?></label><br />
+ <?php echo elgg_view('input/access', array('name' => 'access_id', 'value' => $access_id)); ?>
+</div>
+<div>
+<?php
+
+echo elgg_view('input/hidden', array('name' => 'container_guid', 'value' => $container_guid));
+
+if ($guid) {
+ echo elgg_view('input/hidden', array('name' => 'bookmark_guid', 'value' => $guid));
+}
+
+echo elgg_view('input/submit', array('value' => elgg_echo("save")));
+
+?>
+</div> \ 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 aa7694fb6..abb14ab1f 100644
--- a/mod/bookmarks/views/default/object/bookmarks.php
+++ b/mod/bookmarks/views/default/object/bookmarks.php
@@ -74,10 +74,12 @@ $bookmark_info
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>';
+ echo <<<HTML
+<div class="bookmarks-gallery-item">
+ <h3>$bookmark->title</h3>
+ <p class='subtitle'>$owner_link $date</p>
+</div>
+HTML;
} else {
// brief view
$url = $bookmark->address;
diff --git a/mod/bookmarks/views/default/widgets/bookmarks/content.php b/mod/bookmarks/views/default/widgets/bookmarks/content.php
new file mode 100644
index 000000000..5f9f469d1
--- /dev/null
+++ b/mod/bookmarks/views/default/widgets/bookmarks/content.php
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Elgg bookmarks widget
+ *
+ * @package Bookmarks
+ */
+
+$max = (int) $vars['entity']->num_display;
+
+$options = array(
+ 'type' => 'object',
+ 'subtype' => 'bookmarks',
+ 'container_guid' => $vars['entity']->owner_guid,
+ 'limit' => $max,
+ 'full_view' => FALSE,
+ 'pagination' => FALSE,
+);
+$content = elgg_list_entities($options);
+
+echo $content;
+
+if ($content) {
+ $url = "pg/bookmarks/owner/" . elgg_get_page_owner_entity()->username;
+ $more_link = elgg_view('output/url', array(
+ 'href' => $url,
+ 'text' => elgg_echo('bookmarks:more'),
+ ));
+ echo "<span class=\"elgg-widget-more\">$more_link</span>";
+} else {
+ echo elgg_echo('bookmarks:none');
+}
diff --git a/mod/bookmarks/views/default/widgets/bookmarks/edit.php b/mod/bookmarks/views/default/widgets/bookmarks/edit.php
index edb6afdf2..f31b7660f 100644
--- a/mod/bookmarks/views/default/widgets/bookmarks/edit.php
+++ b/mod/bookmarks/views/default/widgets/bookmarks/edit.php
@@ -1,28 +1,24 @@
<?php
/**
* Elgg bookmark widget edit view
- *
- * @package ElggBookmarks
+ *
+ * @package Bookmarks
*/
// set default value
-if (!isset($vars['entity']->num_display)) {
- $vars['entity']->num_display = 4;
+if (!isset($vars['entity']->max_display)) {
+ $vars['entity']->max_display = 4;
}
-?>
-<p>
- <?php echo elgg_echo('bookmarks:numbertodisplay'); ?>:
- <select name="params[num_display]">
-<?php
-for ($i=1; $i<=10; $i++) {
- $selected = '';
- if ($vars['entity']->num_display == $i) {
- $selected = "selected='selected'";
- }
+$params = array(
+ 'name' => 'params[max_display]',
+ 'value' => $vars['entity']->max_display,
+ 'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
+);
+$dropdown = elgg_view('input/dropdown', $params);
- echo " <option value='{$i}' $selected >{$i}</option>\n";
-}
?>
- </select>
-</p> \ No newline at end of file
+<div>
+ <?php echo elgg_echo('bookmarks:max_display'); ?>:
+ <?php echo $dropdown; ?>
+</div>
diff --git a/mod/bookmarks/views/default/widgets/bookmarks/view.php b/mod/bookmarks/views/default/widgets/bookmarks/view.php
deleted file mode 100644
index 6a5c7476a..000000000
--- a/mod/bookmarks/views/default/widgets/bookmarks/view.php
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php //@todo JS 1.8: Remove inline JS, use elgg-toggle ?>
-<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;
-
-//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($shares){
-
- foreach($shares as $s){
-
- //get the owner
- $owner = $s->getOwnerEntity();
-
- //get the time
- $friendlytime = elgg_view_friendly_time($s->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 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>";
-
- }
-
- $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