Have a warning when searching for an interest that's too long.
Patch by yvi.
diffs (47 lines):
diff -r 0277a739daa7 -r 0de105ba5389 htdocs/interests.bml
--- a/htdocs/interests.bml Tue Jul 06 19:00:40 2010 +0800
+++ b/htdocs/interests.bml Tue Jul 06 20:19:14 2010 +0800
@@ -392,6 +392,16 @@ body<=
my $ret = '';
+ # determine whether the interest is too long: if the interest already
exists, a long interest will result in $e_int and the return value of
LJ::get_interest not matching
+ # if it didn't already exist, we fall back on just checking the length
of $e_int
+ my $exists = $interest;
+ if ( ( $exists && $e_int ne $interest ) || length( $e_int ) >
LJ::CMAX_SITEKEYWORD ) {
+
+ # if the searched-for interest is too long, we use the short
version from here on
+ $interest = $exists ? $interest : substr ( $e_int, 0,
LJ::CMAX_SITEKEYWORD );
+ $ret .= "<?p " . BML::ml( '.error.longinterest', { sitename =>
$LJ::SITENAMESHORT, old_int => $e_int, new_int => $interest, maxlen =>
LJ::CMAX_SITEKEYWORD } ) . " p?>";
+ }
+
$ret .= "<table>";
$ret .= "<tr valign='middle'><td
class='findandmodify'>$ML{'.interested.in'}</td>";
$ret .= "<td class='findandmodify'><form method='get'
action='interests'>";
@@ -407,11 +417,11 @@ body<=
$ret .= "</table>";
# no results
- unless ( $interest ) {
+ unless ( $exists ) {
$ret .= "<?h1 $ML{'.nocomms.header'} h1?><?p ";
- $ret .= BML::ml( '.nocomms.text', { 'int' => $e_int, 'aopts' =>
qq(href="$LJ::SITEROOT/community/create") } );
+ $ret .= BML::ml( '.nocomms.text', { 'int' => $interest, 'aopts' =>
qq(href="$LJ::SITEROOT/community/create") } );
$ret .= " p?><?h1 $ML{'.nousers.header'} h1?><?p ";
- $ret .= BML::ml( '.nousers.text', { 'int' => $e_int,
'aopts_manage' => "href='$LJ::SITEROOT/manage/profile/'", 'aopts_int' =>
"href='$LJ::SITEROOT/interests'" } );
+ $ret .= BML::ml( '.nousers.text', { 'int' => $interest,
'aopts_manage' => "href='$LJ::SITEROOT/manage/profile/'", 'aopts_int' =>
"href='$LJ::SITEROOT/interests'" } );
$ret .= " p?>";
return $ret;
}
diff -r 0277a739daa7 -r 0de105ba5389 htdocs/interests.bml.text
--- a/htdocs/interests.bml.text Tue Jul 06 19:00:40 2010 +0800
+++ b/htdocs/interests.bml.text Tue Jul 06 20:19:14 2010 +0800
@@ -51,6 +51,8 @@ When you're done, click "Save Changes".
.error.findsim_do.intnotfound=Interest wasn't found.
.error.ignored=Sorry, we're unable to help you find users matching the
interests you've provided.
+
+.error.longinterest=As [[sitename]] does not support interests longer than
[[maxlen]] characters, your search for <b>[[old_int]]</b> was converted into a
search for <b>[[new_int]]</b> instead.
.error.nodata=Sorry, interest data currently unavailable.
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog