diff options
Diffstat (limited to 'mod/bookmarks/views')
-rw-r--r-- | mod/bookmarks/views/default/bookmarks/bookmarklet.php | 35 | ||||
-rw-r--r-- | mod/bookmarks/views/default/bookmarks/css.php | 3 | ||||
-rw-r--r-- | mod/bookmarks/views/default/bookmarks/group_module.php | 47 | ||||
-rw-r--r-- | mod/bookmarks/views/default/bookmarks/js.php | 12 | ||||
-rw-r--r-- | mod/bookmarks/views/default/bookmarks/sidebar.php | 14 | ||||
-rw-r--r-- | mod/bookmarks/views/default/forms/bookmarks/save.php | 59 | ||||
-rw-r--r-- | mod/bookmarks/views/default/object/bookmarks.php | 127 | ||||
-rw-r--r-- | mod/bookmarks/views/default/river/object/bookmarks/create.php | 15 | ||||
-rw-r--r-- | mod/bookmarks/views/default/widgets/bookmarks/content.php | 32 | ||||
-rw-r--r-- | mod/bookmarks/views/default/widgets/bookmarks/edit.php | 24 | ||||
-rw-r--r-- | mod/bookmarks/views/rss/object/bookmarks.php | 37 |
11 files changed, 405 insertions, 0 deletions
diff --git a/mod/bookmarks/views/default/bookmarks/bookmarklet.php b/mod/bookmarks/views/default/bookmarks/bookmarklet.php new file mode 100644 index 000000000..b3e9737fe --- /dev/null +++ b/mod/bookmarks/views/default/bookmarks/bookmarklet.php @@ -0,0 +1,35 @@ +<?php +/** + * Bookmarklet + * + * @package Bookmarks + */ + +$page_owner = elgg_get_page_owner_entity(); + +if ($page_owner instanceof ElggGroup) { + $title = elgg_echo("bookmarks:this:group", array($page_owner->name)); +} else { + $title = elgg_echo("bookmarks:this"); +} + +$guid = $page_owner->getGUID(); + +if (!$name && ($user = elgg_get_logged_in_user_entity())) { + $name = $user->username; +} + +$url = elgg_get_site_url(); +$img = elgg_view('output/img', array( + 'src' => 'mod/bookmarks/graphics/bookmarklet.gif', + 'alt' => $title, +)); +$bookmarklet = "<a href=\"javascript:location.href='{$url}bookmarks/add/$guid?address='" + . "+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)\">" + . $img . "</a>"; + +?> +<p><?php echo elgg_echo("bookmarks:bookmarklet:description"); ?></p> +<p><?php echo $bookmarklet; ?></p> +<p><?php echo elgg_echo("bookmarks:bookmarklet:descriptionie"); ?></p> +<p><?php echo elgg_echo("bookmarks:bookmarklet:description:conclusion"); ?></p> diff --git a/mod/bookmarks/views/default/bookmarks/css.php b/mod/bookmarks/views/default/bookmarks/css.php new file mode 100644 index 000000000..0d734c847 --- /dev/null +++ b/mod/bookmarks/views/default/bookmarks/css.php @@ -0,0 +1,3 @@ +.elgg-icon-bookmark { + background: transparent url(<?php echo elgg_get_site_url();?>mod/bookmarks/graphics/bookmark.gif); +}
\ No newline at end of file diff --git a/mod/bookmarks/views/default/bookmarks/group_module.php b/mod/bookmarks/views/default/bookmarks/group_module.php new file mode 100644 index 000000000..60a727819 --- /dev/null +++ b/mod/bookmarks/views/default/bookmarks/group_module.php @@ -0,0 +1,47 @@ +<?php +/** + * List most recent bookmarks on group profile page + * + * @package Bookmarks + */ + +$group = elgg_get_page_owner_entity(); + +if ($group->bookmarks_enable == "no") { + return true; +} + +$all_link = elgg_view('output/url', array( + 'href' => "bookmarks/group/$group->guid/all", + 'text' => elgg_echo('link:view:all'), + 'is_trusted' => true, +)); + +elgg_push_context('widgets'); +$options = array( + 'type' => 'object', + 'subtype' => 'bookmarks', + 'container_guid' => elgg_get_page_owner_guid(), + 'limit' => 6, + 'full_view' => false, + 'pagination' => false, +); +$content = elgg_list_entities($options); +elgg_pop_context(); + +if (!$content) { + $content = '<p>' . elgg_echo('bookmarks:none') . '</p>'; +} + +$new_link = elgg_view('output/url', array( + 'href' => "bookmarks/add/$group->guid", + 'text' => elgg_echo('bookmarks:add'), + 'is_trusted' => true, +)); + +echo elgg_view('groups/profile/module', array( + 'title' => elgg_echo('bookmarks:group'), + 'content' => $content, + 'all_link' => $all_link, + 'add_link' => $new_link, +)); diff --git a/mod/bookmarks/views/default/bookmarks/js.php b/mod/bookmarks/views/default/bookmarks/js.php new file mode 100644 index 000000000..c36823c09 --- /dev/null +++ b/mod/bookmarks/views/default/bookmarks/js.php @@ -0,0 +1,12 @@ + +elgg.provide('elgg.bookmarks'); + +elgg.bookmarks.init = function() { + // append the title to the url + var title = document.title; + var e = $('a.elgg-bookmark-page'); + var link = e.attr('href') + '&title=' + encodeURIComponent(title); + e.attr('href', link); +}; + +elgg.register_hook_handler('init', 'system', elgg.bookmarks.init); diff --git a/mod/bookmarks/views/default/bookmarks/sidebar.php b/mod/bookmarks/views/default/bookmarks/sidebar.php new file mode 100644 index 000000000..811284ef3 --- /dev/null +++ b/mod/bookmarks/views/default/bookmarks/sidebar.php @@ -0,0 +1,14 @@ +<?php +/** + * Bookmarks sidebar + */ + +echo elgg_view('page/elements/comments_block', array( + 'subtypes' => 'bookmarks', + 'owner_guid' => elgg_get_page_owner_guid(), +)); + +echo elgg_view('page/elements/tagcloud_block', array( + 'subtypes' => 'bookmarks', + 'owner_guid' => elgg_get_page_owner_guid(), +)); 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..7d064a55b --- /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 extract() +$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 class="elgg-foot"> +<?php + +echo elgg_view('input/hidden', array('name' => 'container_guid', 'value' => $container_guid)); + +if ($guid) { + echo elgg_view('input/hidden', array('name' => '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 new file mode 100644 index 000000000..83bae2b13 --- /dev/null +++ b/mod/bookmarks/views/default/object/bookmarks.php @@ -0,0 +1,127 @@ +<?php +/** + * Elgg bookmark view + * + * @package ElggBookmarks + */ + +$full = elgg_extract('full_view', $vars, FALSE); +$bookmark = elgg_extract('entity', $vars, FALSE); + +if (!$bookmark) { + return; +} + +$owner = $bookmark->getOwnerEntity(); +$owner_icon = elgg_view_entity_icon($owner, 'tiny'); +$container = $bookmark->getContainerEntity(); +$categories = elgg_view('output/categories', $vars); + +$link = elgg_view('output/url', array('href' => $bookmark->address)); +$description = elgg_view('output/longtext', array('value' => $bookmark->description, 'class' => 'pbl')); + +$owner_link = elgg_view('output/url', array( + 'href' => "bookmarks/owner/$owner->username", + 'text' => $owner->name, + 'is_trusted' => true, +)); +$author_text = elgg_echo('byline', array($owner_link)); + +$date = elgg_view_friendly_time($bookmark->time_created); + +$comments_count = $bookmark->countComments(); +//only display if there are commments +if ($comments_count != 0) { + $text = elgg_echo("comments") . " ($comments_count)"; + $comments_link = elgg_view('output/url', array( + 'href' => $bookmark->getURL() . '#comments', + 'text' => $text, + 'is_trusted' => true, + )); +} else { + $comments_link = ''; +} + +$metadata = elgg_view_menu('entity', array( + 'entity' => $vars['entity'], + 'handler' => 'bookmarks', + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', +)); + +$subtitle = "$author_text $date $comments_link $categories"; + +// do not show the metadata and controls in widget view +if (elgg_in_context('widgets')) { + $metadata = ''; +} + +if ($full && !elgg_in_context('gallery')) { + + $params = array( + 'entity' => $bookmark, + 'title' => false, + 'metadata' => $metadata, + 'subtitle' => $subtitle, + ); + $params = $params + $vars; + $summary = elgg_view('object/elements/summary', $params); + + $bookmark_icon = elgg_view_icon('push-pin-alt'); + $body = <<<HTML +<div class="bookmark elgg-content mts"> + $bookmark_icon<span class="elgg-heading-basic mbs">$link</span> + $description +</div> +HTML; + + echo elgg_view('object/elements/full', array( + 'entity' => $bookmark, + 'icon' => $owner_icon, + 'summary' => $summary, + 'body' => $body, + )); + +} elseif (elgg_in_context('gallery')) { + 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; + $display_text = $url; + $excerpt = elgg_get_excerpt($bookmark->description); + if ($excerpt) { + $excerpt = " - $excerpt"; + } + + if (strlen($url) > 25) { + $bits = parse_url($url); + if (isset($bits['host'])) { + $display_text = $bits['host']; + } else { + $display_text = elgg_get_excerpt($url, 100); + } + } + + $link = elgg_view('output/url', array( + 'href' => $bookmark->address, + 'text' => $display_text, + )); + + $content = elgg_view_icon('push-pin-alt') . "$link{$excerpt}"; + + $params = array( + 'entity' => $bookmark, + 'metadata' => $metadata, + 'subtitle' => $subtitle, + 'content' => $content, + ); + $params = $params + $vars; + $body = elgg_view('object/elements/summary', $params); + + echo elgg_view_image_block($owner_icon, $body); +} diff --git a/mod/bookmarks/views/default/river/object/bookmarks/create.php b/mod/bookmarks/views/default/river/object/bookmarks/create.php new file mode 100644 index 000000000..388f54ac9 --- /dev/null +++ b/mod/bookmarks/views/default/river/object/bookmarks/create.php @@ -0,0 +1,15 @@ +<?php +/** + * New bookmarks river entry + * + * @package Bookmarks + */ + +$object = $vars['item']->getObjectEntity(); +$excerpt = elgg_get_excerpt($object->description); + +echo elgg_view('river/elements/layout', array( + 'item' => $vars['item'], + 'message' => $excerpt, + 'attachments' => elgg_view('output/url', array('href' => $object->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..0b85017fc --- /dev/null +++ b/mod/bookmarks/views/default/widgets/bookmarks/content.php @@ -0,0 +1,32 @@ +<?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 = "bookmarks/owner/" . elgg_get_page_owner_entity()->username; + $more_link = elgg_view('output/url', array( + 'href' => $url, + 'text' => elgg_echo('bookmarks:more'), + 'is_trusted' => true, + )); + 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 new file mode 100644 index 000000000..ed9c7fd88 --- /dev/null +++ b/mod/bookmarks/views/default/widgets/bookmarks/edit.php @@ -0,0 +1,24 @@ +<?php +/** + * Elgg bookmark widget edit view + * + * @package Bookmarks + */ + +// set default value +if (!isset($vars['entity']->num_display)) { + $vars['entity']->num_display = 4; +} + +$params = array( + 'name' => 'params[num_display]', + 'value' => $vars['entity']->num_display, + 'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), +); +$dropdown = elgg_view('input/dropdown', $params); + +?> +<div> + <?php echo elgg_echo('bookmarks:numbertodisplay'); ?>: + <?php echo $dropdown; ?> +</div> diff --git a/mod/bookmarks/views/rss/object/bookmarks.php b/mod/bookmarks/views/rss/object/bookmarks.php new file mode 100644 index 000000000..1abda4710 --- /dev/null +++ b/mod/bookmarks/views/rss/object/bookmarks.php @@ -0,0 +1,37 @@ +<?php +/** + * Bookmark RSS object view + * + * @package ElggBookmarks + */ + +$title = $vars['entity']->title; +if (empty($title)) { + $title = strip_tags($vars['entity']->description); + $title = elgg_get_excerpt($title, 32); +} + +$permalink = htmlspecialchars($vars['entity']->getURL(), ENT_NOQUOTES, 'UTF-8'); +$pubdate = date('r', $vars['entity']->getTimeCreated()); + +$url_text = elgg_echo('bookmarks:address'); +$link = elgg_view('output/url', array('href' => $vars['entity']->address)); +$description = $vars['entity']->description . "<p>$url_text: $link</p>"; + +$creator = elgg_view('page/components/creator', $vars); +$georss = elgg_view('page/components/georss', $vars); +$extension = elgg_view('extensions/item'); + +$item = <<<__HTML +<item> + <guid isPermaLink="true">$permalink</guid> + <pubDate>$pubdate</pubDate> + <link>$permalink</link> + <title><![CDATA[$title]]></title> + <description><![CDATA[$description]]></description> + $creator$georss$extension +</item> + +__HTML; + +echo $item; |