diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-10-20 23:46:46 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-10-20 23:46:46 +0000 |
commit | c3332e10712c0ec7f3540e54c794fa4dae3532f9 (patch) | |
tree | 900952540757a2ee85ce71b291095cf8d65a7891 | |
parent | 7bbb0ca2fb7e205074a9009f7604cb2c289cca73 (diff) | |
download | elgg-c3332e10712c0ec7f3540e54c794fa4dae3532f9.tar.gz elgg-c3332e10712c0ec7f3540e54c794fa4dae3532f9.tar.bz2 |
Refs #2551 - merged [7051] and [7053] into trunk
git-svn-id: http://code.elgg.org/elgg/trunk@7112 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | mod/bookmarks/actions/add.php | 6 | ||||
-rw-r--r-- | mod/bookmarks/languages/en.php | 6 | ||||
-rw-r--r-- | mod/bookmarks/views/default/object/bookmarks.php | 14 |
3 files changed, 21 insertions, 5 deletions
diff --git a/mod/bookmarks/actions/add.php b/mod/bookmarks/actions/add.php index 6aa3bf889..eee849ff6 100644 --- a/mod/bookmarks/actions/add.php +++ b/mod/bookmarks/actions/add.php @@ -18,6 +18,12 @@ $notes = get_input('notes'); $access = get_input('access'); $tags = get_input('tags'); $tagarray = string_to_tag_array($tags); + +if (!$title || !$address) { + register_error(elgg_echo('bookmarks:save:failed')); + forward(REFERER); +} + //create a new bookmark object $entity = new ElggObject; $entity->subtype = "bookmarks"; diff --git a/mod/bookmarks/languages/en.php b/mod/bookmarks/languages/en.php index 6f64e7e16..e0c4a9e08 100644 --- a/mod/bookmarks/languages/en.php +++ b/mod/bookmarks/languages/en.php @@ -69,6 +69,8 @@ $english = array( 'bookmarks:bookmarklet:description:conclusion' => "You can then bookmark any webpage you visit by clicking the button in your browsers toolbar.", + 'bookmarks:no_title' => 'No title', + /** * Status messages */ @@ -80,8 +82,8 @@ $english = array( * Error messages */ - 'bookmarks:save:failed' => "Your bookmarked item could not be saved. Please try again.", - 'bookmarks:delete:failed' => "Your bookmarked item could not be deleted. Please try again.", + 'bookmarks:save:failed' => "Your bookmarked item could not be saved. Make sure you've entered a title and address and then try again.", + 'bookmarks:delete:failed' => "Your bookmarked item could not be deleted.", ); diff --git a/mod/bookmarks/views/default/object/bookmarks.php b/mod/bookmarks/views/default/object/bookmarks.php index 67ba1bd91..4dcb53605 100644 --- a/mod/bookmarks/views/default/object/bookmarks.php +++ b/mod/bookmarks/views/default/object/bookmarks.php @@ -11,7 +11,15 @@ $owner = $vars['entity']->getOwnerEntity(); $friendlytime = elgg_view_friendly_time($vars['entity']->time_created); -$parsed_url = parse_url($vars['entity']->address); +$address = $vars['entity']->address; + +// you used to be able to add without titles, which created unclickable bookmarks +// putting a fake title in so you can click on it. +if (!$title = $vars['entity']->title) { + $title = elgg_echo('bookmarks:no_title'); +} + +$parsed_url = parse_url($address); $faviconurl = $parsed_url['scheme'] . "://" . $parsed_url['host'] . "/favicon.ico"; //sort out the access level for display @@ -51,7 +59,7 @@ if (@file_exists($faviconurl)) { //delete if($vars['entity']->canEdit()){ -$delete .= "<span class='delete_button'>" . elgg_view('output/confirmlink',array( + $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"), @@ -72,7 +80,7 @@ if($vars['entity']->canEdit()){ $info .= "</div>"; -$info .= "<p class='entity_title'><a href=\"{$vars['entity']->address}\" target=\"_blank\">{$vars['entity']->title}</a></p>"; +$info .= "<p class='entity_title'><a href=\"{$address}\" target=\"_blank\">{$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)); |