Added a text-box that displays how many more chars the user can write in the signature.

Also made changes to make this file HTML 4.01 transitional valid.

svn path=/trunk/boinc/; revision=4842
This commit is contained in:
Janus B. Kristensen 2004-12-14 02:54:29 +00:00
parent ba79e58d58
commit eec295c40d
1 changed files with 37 additions and 23 deletions

View File

@ -9,18 +9,29 @@ $user = get_logged_in_user();
$user = getForumPreferences($user); $user = getForumPreferences($user);
page_head("Edit message board preferences"); page_head("Edit message board preferences");
echo "<script type=\"text/javascript\">
function textCounter(field, countfield, maxlimit)
{
/*
* Input-Parameter: field name;
* the remaining count field;
* max. Characters.
*/
if (field.value.length > maxlimit) // If the input length is greater than allowed
field.value =field.value.substring(0, maxlimit); // no typing is allowed
else
countfield.value = maxlimit - field.value.length // the number of the remaining chars is displayed
}
</script>";
start_table(); start_table();
row2("Reset preferences<br><font size=-2>Use this button to reset preferences to the defaults</font>", row2("Reset preferences<br><font size=-2>Use this button to reset preferences to the defaults</font>",
"<form method=post action=\"edit_forum_preferences_action.php\"><input type=\"submit\" value=\"Reset preferences\"></form>"); "<form method=\"post\" action=\"edit_forum_preferences_action.php\"><input type=\"submit\" value=\"Reset preferences\"></form>");
echo "<form method=\"post\" action=\"edit_forum_preferences_action.php\" enctype=\"multipart/form-data\">"; echo "<form method=\"post\" action=\"edit_forum_preferences_action.php\" enctype=\"multipart/form-data\">";
if ($user->avatar_type==0){ if ($user->avatar_type==0){
$zero_select="checked=true"; $zero_select="checked=\"checked\"";
} elseif($user->avatar_type==1){ } elseif($user->avatar_type==1){
$one_select="checked=true"; $one_select="checked=\"checked\"";
$avatar_url=$user->avatar; $avatar_url=$user->avatar;
} elseif($user->avatar_type==2){ } elseif($user->avatar_type==2){
$two_select="checked=true"; $two_select="checked=true";
@ -40,7 +51,7 @@ if ($user->avatar!=""){
"<img src=\"".$user->avatar."\" width=\"100\" height=\"100\">"); "<img src=\"".$user->avatar."\" width=\"100\" height=\"100\">");
} }
row2("Sort styles<br><font size=-2>How to sort the replies in the message board and Q&A areas</font>", row2("Sort styles<br><font size=-2>How to sort the replies in the message board and Q&amp;A areas</font>",
" "
<table> <table>
<tr><td>Message threadlist:</td><td>".select_from_array("forum_sort", $forum_sort_styles, getSortStyle($user,"forum"))."</td></tr> <tr><td>Message threadlist:</td><td>".select_from_array("forum_sort", $forum_sort_styles, getSortStyle($user,"forum"))."</td></tr>
@ -50,9 +61,9 @@ row2("Sort styles<br><font size=-2>How to sort the replies in the message board
</table>" </table>"
); );
if ($user->link_popup==1){$forum_link_externally="checked=\"true\"";} else {$forum_link_externally="";} if ($user->link_popup==1){$forum_link_externally="checked=\"checked\"";} else {$forum_link_externally="";}
if ($user->images_as_links==1){$forum_image_as_link="checked=\"true\"";} else {$forum_image_as_link="";} if ($user->images_as_links==1){$forum_image_as_link="checked=\"checked\"";} else {$forum_image_as_link="";}
if ($user->jump_to_unread==1){$forum_jump_to_unread="checked=\"true\"";} else {$forum_jump_to_unread="";} if ($user->jump_to_unread==1){$forum_jump_to_unread="checked=\"checked\"";} else {$forum_jump_to_unread="";}
row2("Display and Behavior". row2("Display and Behavior".
"<br><font size=-2>How to treat links and images in the forum<br>and how to act on unread posts</font>", "<br><font size=-2>How to treat links and images in the forum<br>and how to act on unread posts</font>",
@ -63,8 +74,8 @@ row2("Display and Behavior".
</td></tr></table>" </td></tr></table>"
); );
if ($user->hide_avatars==1){$forum_hide_avatars="checked=\"true\"";} else {$forum_hide_avatars="";} if ($user->hide_avatars==1){$forum_hide_avatars="checked=\"checked\"";} else {$forum_hide_avatars="";}
if ($user->hide_signatures==1){$forum_hide_signatures="checked=\"true\"";} else {$forum_hide_signatures="";} if ($user->hide_signatures==1){$forum_hide_signatures="checked=\"checked\"";} else {$forum_hide_signatures="";}
$forum_low_rating_threshold= $user->low_rating_threshold; $forum_low_rating_threshold= $user->low_rating_threshold;
$forum_high_rating_threshold= $user->high_rating_threshold; $forum_high_rating_threshold= $user->high_rating_threshold;
row2("Filtering". row2("Filtering".
@ -74,8 +85,8 @@ row2("Filtering".
<input type=\"checkbox\" name=\"forum_hide_signatures\" ".$forum_hide_signatures."> Hide signatures<br> <input type=\"checkbox\" name=\"forum_hide_signatures\" ".$forum_hide_signatures."> Hide signatures<br>
</td></tr></table> </td></tr></table>
<table width=\"380\"> <table width=\"380\">
<tr><td width=\"32\"><input type=\"input\" name=\"forum_low_rating_threshold\" value=\"".$forum_low_rating_threshold."\" style=\"width: 30px;\"></td><td>Filter threshold (default: ".DEFAULT_LOW_RATING_THRESHOLD.")</td></tr> <tr><td width=\"32\"><input type=\"text\" name=\"forum_low_rating_threshold\" value=\"".$forum_low_rating_threshold."\" style=\"width: 30px;\"></td><td>Filter threshold (default: ".DEFAULT_LOW_RATING_THRESHOLD.")</td></tr>
<tr><td><input type=\"input\" name=\"forum_high_rating_threshold\" value=\"".$forum_high_rating_threshold."\" style=\"width: 30px;\"></td><td>Emphasize threshold (default: ".DEFAULT_HIGH_RATING_THRESHOLD.")</td></tr> <tr><td><input type=\"text\" name=\"forum_high_rating_threshold\" value=\"".$forum_high_rating_threshold."\" style=\"width: 30px;\"></td><td>Emphasize threshold (default: ".DEFAULT_HIGH_RATING_THRESHOLD.")</td></tr>
<tr><td colspan=2> <tr><td colspan=2>
Anything rated lower than the filter threshold will be filtered and anything rated higher than the emphasize threshold will be emphasized. Anything rated lower than the filter threshold will be filtered and anything rated higher than the emphasize threshold will be emphasized.
</td></tr> </td></tr>
@ -84,13 +95,17 @@ row2("Filtering".
); );
if ($user->no_signature_by_default==0){$enable_signature="checked=\"true\"";} else {$enable_signature="";} if ($user->no_signature_by_default==0){$enable_signature="checked=\"checked\"";} else {$enable_signature="";}
$signature=stripslashes($user->signature);
$maxlen=250;
row2("Signature for message boards". row2("Signature for message boards".
"<br><a href=html.php><font size=-2>May contain HTML tags</font></a><font size=-2><br>Max length (including newlines) is 250 chars.", "<br><a href=\"html.php\"><font size=-2>May contain HTML tags</font></a><font size=-2><br>Max length (including newlines) is $maxlen chars.</font>",
" "<table><tr><td>
<textarea name=signature rows=4 cols=50>".stripslashes($user->signature)."</textarea> <textarea name=\"signature\" rows=4 cols=50 id=\"signature\" onkeydown=\"textCounter(this.form.signature, this.form.remLen,$maxlen);\"
<br><input type=\"checkbox\" name=\"signature_enable\" ".$enable_signature."> Attach signature by default" onkeyup=\"textCounter(this.form.signature, this.form.remLen,250);\">".$signature."</textarea>
); <br><input name=\"remLen\" type=\"text\" id=\"remLen\" value=\"".($maxlen-strlen($signature))."\" size=\"3\" maxlength=\"3\" readonly> chars remaining
<br><input type=\"checkbox\" name=\"signature_enable\" ".$enable_signature."> Attach signature by default
</td></tr></table>");
if ($user->signature!=""){ if ($user->signature!=""){
row2("Signature preview". row2("Signature preview".
"<br><font size=-2>This is how your signature will look in the forums</font>", "<br><font size=-2>This is how your signature will look in the forums</font>",
@ -98,8 +113,7 @@ row2("Signature preview".
); );
} }
row2("", "<input type=submit value='Update info'>"); row2("", "<input type=submit value='Update info'>");
end_table();
echo "</form>\n"; echo "</form>\n";
end_table();
page_tail(); page_tail();
?> ?>