diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-16 22:00:32 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-16 22:00:32 +0000 |
commit | e45c0d4a62e6bc0f5aa2cd0522987123a9b457c7 (patch) | |
tree | 06644a4bd5a764c8dda28cec6125ac5ead486e11 /mod/bookmarks/pages | |
parent | 851b6f87d426ff60d21eeafd6d63ff241bb18b82 (diff) | |
download | elgg-e45c0d4a62e6bc0f5aa2cd0522987123a9b457c7.tar.gz elgg-e45c0d4a62e6bc0f5aa2cd0522987123a9b457c7.tar.bz2 |
Refs #2680. Bookmarks revamp, part 2.
git-svn-id: http://code.elgg.org/elgg/trunk@8264 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/bookmarks/pages')
-rw-r--r-- | mod/bookmarks/pages/add.php | 45 | ||||
-rw-r--r-- | mod/bookmarks/pages/edit.php | 36 | ||||
-rw-r--r-- | mod/bookmarks/pages/inbox.php | 28 | ||||
-rw-r--r-- | mod/bookmarks/pages/view.php | 3 |
4 files changed, 59 insertions, 53 deletions
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 { |