'title' => elgg_echo('bookmarks'),
'url' => 'pg/bookmarks/all'
));
+
elgg_register_plugin_hook_handler('register', 'menu:page', 'bookmarks_page_menu');
elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'bookmarks_owner_block_menu');
elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'bookmarks_user_hover_menu');
-
elgg_register_page_handler('bookmarks', 'bookmarks_page_handler');
+
elgg_extend_view('css/screen', 'bookmarks/css');
+ elgg_extend_view('js/elgg', 'bookmarks/js');
+ elgg_extend_view('page/links', 'bookmarks/page_links');
// Register granular notification for this type
if (is_callable('register_notification_object')) {
*/
function bookmarks_page_menu($hook, $type, $return, $params) {
if (elgg_is_logged_in()) {
- $url = 'pg/bookmarks/add/' . elgg_get_logged_in_user_guid()
- . '?address=' . urlencode(current_page_url());
- $return[] = new ElggMenuItem('bookmark_this_page', elgg_echo('bookmarks:this'), $url);
-
// only show bookmarklet in bookmark pages
if (elgg_in_context('bookmarks')) {
$page_owner = elgg_get_page_owner_entity();
$bookmarklet = "<a href=\"javascript:location.href='{$url}pg/bookmarks/add/$guid?address='"
. "+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)\">"
- . "<img src=\"{$url}_graphics/elgg_bookmarklet.gif\" border=\"0\" title=\"$title\" /> </a>";
+ . "<img src=\"{$url}mod/bookmarks/graphics/bookmarklet.gif\" border=\"0\" title=\"$title\" /> </a>";
?>
<p><?php echo elgg_echo("bookmarks:bookmarklet:description"); ?></p>
--- /dev/null
+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_event_handler('init', 'system', elgg.bookmarks.init);
\ No newline at end of file
--- /dev/null
+<?php
+/**
+ * Shows a "Bookmark this" link and icon
+ */
+$url = 'pg/bookmarks/add/' . elgg_get_logged_in_user_guid()
+ . '?address=' . urlencode(current_page_url());
+ $return[] = new ElggMenuItem('bookmark_this_page', elgg_echo('bookmarks:this'), $url);
+
+echo elgg_view('output/url', array(
+ 'text' => '<span class="elgg-icon elgg-icon-bookmark"></span>',
+ 'href' => $url,
+ 'title' => $label,
+ 'rel' => 'nofollow',
+ 'encode_text' => false,
+ 'class' => 'right elgg-bookmark-page',
+));