aboutsummaryrefslogtreecommitdiff
path: root/mod/bookmarks/views/default
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-06-11 20:29:38 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-06-11 20:29:38 +0000
commitab4679de45c9608f9a87f90a1093ae3a2ae6559d (patch)
tree18b1e42fd58661a47d0c277cbb29f598b0f9010a /mod/bookmarks/views/default
parent77cd2c85d946eb6bc15612e6c415ca866ead2b8a (diff)
downloadelgg-ab4679de45c9608f9a87f90a1093ae3a2ae6559d.tar.gz
elgg-ab4679de45c9608f9a87f90a1093ae3a2ae6559d.tar.bz2
Small code cleanup on bookmarks.
Added better logic for determining the username to use when adding a bookmark via the bookmarklet. git-svn-id: http://code.elgg.org/elgg/trunk@6461 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/bookmarks/views/default')
-rw-r--r--mod/bookmarks/views/default/bookmarks/bookmarklet.php25
1 files changed, 17 insertions, 8 deletions
diff --git a/mod/bookmarks/views/default/bookmarks/bookmarklet.php b/mod/bookmarks/views/default/bookmarks/bookmarklet.php
index 4ff05c68a..c12b461e3 100644
--- a/mod/bookmarks/views/default/bookmarks/bookmarklet.php
+++ b/mod/bookmarks/views/default/bookmarks/bookmarklet.php
@@ -1,7 +1,7 @@
<?php
/**
* Elgg get bookmarks bookmarklet 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>
@@ -9,19 +9,28 @@
* @link http://elgg.org/
*/
-$page_owner = $vars['pg_owner'];
-
+$page_owner = page_owner_entity();
$bookmarktext = elgg_echo("bookmarks:this");
-if ($page_owner instanceof ElggGroup)
- $bookmarktext = sprintf(elgg_echo("bookmarks:this:group"), $page_owner->name)
+
+if ($page_owner instanceof ElggGroup) {
+ $bookmarktext = sprintf(elgg_echo("bookmarks:this:group"), $page_owner->name);
+ $name = "group:$page_owner->guid";
+} else {
+ $name = $page_owner->username;
+}
+
+if (!$name && ($user = get_loggedin_user())) {
+ $name = $user->username;
+}
+
?>
-<h3>Browser Bookmarklet</h3>
-<a href="javascript:location.href='<?php echo $vars['url']; ?>pg/bookmarks/<?php echo page_owner_entity()->username; ?>/add?address='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)"> <img src="<?php echo $vars['url']; ?>_graphics/elgg_bookmarklet.gif" border="0" title="<?php echo elgg_echo('bookmarks:this');?>" /> </a>
+<h3><?php echo elgg_echo('bookmarks:browser_bookmarklet')?></h3>
+<a href="javascript:location.href='<?php echo $vars['url']; ?>pg/bookmarks/<?php echo $name; ?>/add?address='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)"> <img src="<?php echo $vars['url']; ?>_graphics/elgg_bookmarklet.gif" border="0" title="<?php echo elgg_echo('bookmarks:this');?>" /> </a>
<br />
<a class="link" onclick="elgg_slide_toggle(this,'#elgg_sidebar','.bookmarklet');">Instructions</a>
<div class="bookmarklet hidden">
<p><?php echo elgg_echo("bookmarks:bookmarklet:description"); ?></p>
<p><?php echo elgg_echo("bookmarks:bookmarklet:descriptionie"); ?></p>
- <p><?php echo elgg_echo("bookmarks:bookmarklet:description:conclusion"); ?></p>
+ <p><?php echo elgg_echo("bookmarks:bookmarklet:description:conclusion"); ?></p>
</div> \ No newline at end of file