Mercurial > hg > fapweb
changeset 12:358534308c61
Clean up some of the html item generation code.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 06 Dec 2012 14:48:23 +0200 |
parents | c10bf196390f |
children | cb4af708e295 |
files | msite.inc.php |
diffstat | 1 files changed, 20 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/msite.inc.php Thu Dec 06 14:45:07 2012 +0200 +++ b/msite.inc.php Thu Dec 06 14:48:23 2012 +0200 @@ -202,20 +202,28 @@ } +function stGetIDName($name, $id, $prefix = "") +{ + return + ($id != "" ? "id=\"".$prefix.$name.$id."\" " : ""). + ($name != "" ? "name=\"".$prefix.$name.$id."\" " : ""); +} + + function stGetFormCheckBoxInput($name, $id, $prefix, $checked, $label, $extra = "") { return - "<input ".$extra." type=\"checkbox\" id=\"".$prefix.$name.$id."\" ". - "name=\"".$prefix.$name.$id."\" ".($checked ? "checked=\"checked\" " : "")." />". - ($label != "" ? "<label for=\"".$prefix.$name.$id."\">".$label."</label>" : ""); + "<input ".$extra." type=\"checkbox\" ".stGetIDName($name, $id, $prefix). + ($checked ? "checked=\"checked\" " : "")." />". + ($label != "" ? "<label for=\"".$name."\">".$label."</label>" : ""); } function stGetFormButtonInput($name, $id, $prefix, $label, $onclick = "") { return - "<input type=\"button\" id=\"".$prefix.$name.$id."\" ". - "name=\"".$name."\" value=\"".$label."\" ". + "<input type=\"button\" ".stGetIDName($name, $id, $prefix). + "value=\"".$label."\" ". ($onclick != "" ? "onClick=\"".$onclick."\"" : "")." />"; } @@ -223,8 +231,8 @@ function stGetFormTextArea($rows, $cols, $name, $id, $prefix, $value, $extra = "") { return - "<textarea ".$extra." id=\"".$prefix.$name.$id."\" ". - "name=\"".$name."\" rows=\"".$rows."\" cols=\"".$cols."\">". + "<textarea ".$extra." ".stGetIDName($name, $id, $prefix). + "rows=\"".$rows."\" cols=\"".$cols."\">". (isset($value) ? chentities($value) : ""). "</textarea>"; } @@ -233,8 +241,8 @@ function stGetFormTextInput($size, $len, $name, $id, $prefix, $value, $extra = "") { return - "<input ".$extra." type=\"text\" id=\"".$prefix.$name.$id."\" ". - "name=\"".$name."\" size=\"".$size."\" maxlength=\"".$len."\"". + "<input ".$extra." type=\"text\" ".stGetIDName($name, $id, $prefix). + "size=\"".$size."\" maxlength=\"".$len."\"". (isset($value) ? " value=\"".chentities($value)."\"" : ""). " />"; } @@ -250,7 +258,9 @@ function stGetFormHiddenInput($name, $value) { - return "<input type=\"hidden\" name=\"".$name."\" value=\"".chentities($value)."\" />"; + return + "<input type=\"hidden\" name=\"".$name. + "\" value=\"".chentities($value)."\" />"; }