summaryrefslogtreecommitdiff
path: root/src/views/pages
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2011-09-06 23:44:39 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2011-09-06 23:44:39 -0400
commit6f6cd6b1ede633a7db06b5e40919eb1cc4279713 (patch)
treed4aec88459559db6a7510895399b180bf982d337 /src/views/pages
parent710e269b328ec055f90d4521ef8806fa1b4ea83a (diff)
Differentiate between when we want checkboxes to be booleans, or bit arrays.
For the booleans, we use a hidden input to send false back if they aren't selected. * Template.class.php: rename inputBool() to inputBoolArray(), create new inputBool() * index.html.php: use a hidden input to send false when an checkbox isn't selected. * individual.html.php: add inputBool() function, use $t->inputBoolArray() in inputArray()
Diffstat (limited to 'src/views/pages')
-rw-r--r--src/views/pages/users/index.html.php4
-rw-r--r--src/views/pages/users/individual.html.php9
2 files changed, 11 insertions, 2 deletions
diff --git a/src/views/pages/users/index.html.php b/src/views/pages/users/index.html.php
index c268c87..ade4dea 100644
--- a/src/views/pages/users/index.html.php
+++ b/src/views/pages/users/index.html.php
@@ -23,6 +23,8 @@ foreach ($users as $user) {
$t->openTag('tr');
foreach ($attribs as $attrib) {
+ $t->openTag('td');
+
$props = $user[$attrib['key']];
$value = $props['value'];
@@ -36,6 +38,7 @@ foreach ($users as $user) {
if ($bool) $arr['disabled'] = $disabled;
}
if ($bool) {
+ $t->tag('input', array('type'=>'hidden', 'name'=>$post_key, 'value'=>'false'));
if ($value==true) {
$arr['checked'] = 'checked';
}
@@ -46,7 +49,6 @@ foreach ($users as $user) {
$arr['type'] = 'text';
}
- $t->openTag('td');
$t->tag('input', $arr);
$t->closeTag('td');
}
diff --git a/src/views/pages/users/individual.html.php b/src/views/pages/users/individual.html.php
index 9e3048a..6b23e0e 100644
--- a/src/views/pages/users/individual.html.php
+++ b/src/views/pages/users/individual.html.php
@@ -15,12 +15,19 @@ function inputTextarea($user, $key, $label, $hint='') {
!$user->canEdit());
}
+function inputBool($user, $key, $label, $hint='') {
+ global $VARS; $t = $VARS['template'];
+ $current_setting = $user->getConf($key)=='true';
+ $t->inputBool("user_$key", $label, $hint, $current_setting,
+ !$user->canEdit());
+}
+
function inputArray($user, $key, $arr) {
global $VARS; $t = $VARS['template'];
$defaults = $user->getConfArray($key);
foreach ($arr as $value => $label) {
- $t->inputBool($name, $value, $label,
+ $t->inputBoolArray($key, $value, $label,
in_array($value, $defaults), !$user->canEdit());
}
}