]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Further cleanup of bookmarks. Moved bookmarklet to plugin. Pulled in the 1.7 bookmark...
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 17 Feb 2011 04:55:37 +0000 (04:55 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 17 Feb 2011 04:55:37 +0000 (04:55 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@8273 36083f99-b078-4883-b0ff-0f9b5a30f544

mod/bookmarks/graphics/bookmark.gif [new file with mode: 0644]
mod/bookmarks/graphics/bookmarklet.gif [moved from _graphics/elgg_bookmarklet.gif with 100% similarity]
mod/bookmarks/start.php
mod/bookmarks/views/default/bookmarks/bookmarklet.php
mod/bookmarks/views/default/bookmarks/css.php [new file with mode: 0644]
mod/bookmarks/views/default/bookmarks/js.php [new file with mode: 0644]
mod/bookmarks/views/default/bookmarks/page_links.php [new file with mode: 0644]

diff --git a/mod/bookmarks/graphics/bookmark.gif b/mod/bookmarks/graphics/bookmark.gif
new file mode 100644 (file)
index 0000000..55c5e3e
Binary files /dev/null and b/mod/bookmarks/graphics/bookmark.gif differ
index 1fd9768a116907dcaae65ac1d37d8da9705fc3bf..31c4147416b2d6d4b7321e4b36682ff481ef8fda 100644 (file)
@@ -28,13 +28,16 @@ function bookmarks_init() {
                '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')) {
@@ -280,10 +283,6 @@ function bookmarks_user_hover_menu($hook, $type, $return, $params) {
  */
 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();
index 119b9d107c2e345e517c2f3517e8d6e74d12cad7..42bd1e9138cb2080d6085116b53cd20d95692567 100644 (file)
@@ -23,7 +23,7 @@ $url = elgg_get_site_url();
 
 $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>
diff --git a/mod/bookmarks/views/default/bookmarks/css.php b/mod/bookmarks/views/default/bookmarks/css.php
new file mode 100644 (file)
index 0000000..0d734c8
--- /dev/null
@@ -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/js.php b/mod/bookmarks/views/default/bookmarks/js.php
new file mode 100644 (file)
index 0000000..35dc82f
--- /dev/null
@@ -0,0 +1,11 @@
+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
diff --git a/mod/bookmarks/views/default/bookmarks/page_links.php b/mod/bookmarks/views/default/bookmarks/page_links.php
new file mode 100644 (file)
index 0000000..79678a4
--- /dev/null
@@ -0,0 +1,16 @@
+<?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',
+));