aboutsummaryrefslogtreecommitdiff
path: root/mod/bookmarks/views/default/object/bookmarks.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-03-03 23:15:07 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-03-03 23:15:07 +0000
commit0320936f29dd83534b5af386a981131be7981a9a (patch)
tree1d524f4a43c5974bf10b1177a8935754ee176ec5 /mod/bookmarks/views/default/object/bookmarks.php
parente2ba75ce7dad46f87c43b7ef256e79053af5566e (diff)
downloadelgg-0320936f29dd83534b5af386a981131be7981a9a.tar.gz
elgg-0320936f29dd83534b5af386a981131be7981a9a.tar.bz2
Updated bookmarks with new interface.
git-svn-id: http://code.elgg.org/elgg/trunk@5266 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/bookmarks/views/default/object/bookmarks.php')
-rw-r--r--mod/bookmarks/views/default/object/bookmarks.php223
1 files changed, 80 insertions, 143 deletions
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> &nbsp;
- <?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