From 4d79a87eb67251d17df3bec69e5b6eb2c0acd754 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 8 Nov 2010 16:44:57 +0000 Subject: [PATCH] - web: show prefs bools as checkboxes rather than radio yes/no svn path=/trunk/boinc/; revision=22634 --- checkin_notes | 6 ++++++ html/inc/prefs_util.inc | 21 +++++++-------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/checkin_notes b/checkin_notes index 5913083496..dd260e7a0b 100644 --- a/checkin_notes +++ b/checkin_notes @@ -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 diff --git a/html/inc/prefs_util.inc b/html/inc/prefs_util.inc index 4ddd4ff6d7..bb1b16e275 100644 --- a/html/inc/prefs_util.inc +++ b/html/inc/prefs_util.inc @@ -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 "" - .tra("yes") - ." tag value=$disp_yes " - .($val?"checked":"") - ."> " - .tra("no") - ." tag value=$disp_no " - .($val?"":"checked") + ."tag " + . ($checked?"checked":"") ."> "; } 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;