From c3332e10712c0ec7f3540e54c794fa4dae3532f9 Mon Sep 17 00:00:00 2001 From: cash Date: Wed, 20 Oct 2010 23:46:46 +0000 Subject: Refs #2551 - merged [7051] and [7053] into trunk git-svn-id: http://code.elgg.org/elgg/trunk@7112 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/bookmarks/actions/add.php | 6 ++++++ mod/bookmarks/languages/en.php | 6 ++++-- 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 .= "" . elgg_view('output/confirmlink',array( + $delete .= "" . 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 .= ""; -$info .= "

address}\" target=\"_blank\">{$vars['entity']->title}

"; +$info .= "

{$title}

"; $info .= "

Bookmarked by username}\">{$owner->name} {$friendlytime} {$view_notes}

"; $tags = elgg_view('output/tags', array('tags' => $vars['entity']->tags)); -- cgit v1.2.3