- web: show prefs bools as checkboxes rather than radio yes/no

svn path=/trunk/boinc/; revision=22634
This commit is contained in:
David Anderson 2010-11-08 16:44:57 +00:00
parent de944b928e
commit 4d79a87eb6
2 changed files with 13 additions and 14 deletions

View File

@ -7886,3 +7886,9 @@ David 05 Nov 2010
rr_sim.cpp
html/ops/
manage_app_versions.php
David 08 Nov 2010
- web: show prefs bools as checkboxes rather than radio yes/no
html/inc/
prefs_util.inc

View File

@ -96,28 +96,21 @@ class PREF_BOOL extends PREF {
function show_form($prefs, $error) {
$tag = $this->tag;
if ($this->invert) {
$disp_yes = "no";
$disp_no = "yes";
$val = !$prefs->$tag;
$checked = !$prefs->$tag;
} else {
$disp_yes = "yes";
$disp_no = "no";
$val = $prefs->$tag;
$checked = $prefs->$tag;
}
echo "<td class=fieldvalue>"
.tra("yes")
." <input type=radio name=$this->tag value=$disp_yes "
.($val?"checked":"")
."> "
.tra("no")
." <input type=radio name=$this->tag value=$disp_no "
.($val?"":"checked")
."<input type=checkbox name=$this->tag "
. ($checked?"checked":"")
."></td>
";
}
function parse_form(&$prefs, &$error) {
$tag = $this->tag;
$prefs->$tag = ($_GET[$tag] == 'yes');
$val = array_key_exists($tag, $_GET);
if ($this->invert) $val = !$val;
$prefs->$tag = $val;
}
function xml_string($prefs) {
$tag = $this->tag;