diff options
author | Aleksander Machniak <alec@alec.pl> | 2013-10-29 11:30:36 +0100 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2013-10-29 11:30:36 +0100 |
commit | 2bf0b5568ba47283cc1e5ae2b5ec03b0e22d99a3 (patch) | |
tree | c3c5e84c401d5b77472283b70302e051aa13edd5 | |
parent | 6c2720f7e3ecb1789e71750339f8cd853a1b365c (diff) | |
download | webadmin-2bf0b5568ba47283cc1e5ae2b5ec03b0e22d99a3.tar.gz |
Fix handling of mailquota attribute value - it should be a string not an integer (Bug #2414)
Disable quota unit selector when input is readonly.
-rw-r--r-- | lib/api/kolab_api_service_form_value.php | 2 | ||||
-rw-r--r-- | lib/kolab_html.php | 21 |
2 files changed, 14 insertions, 9 deletions
diff --git a/lib/api/kolab_api_service_form_value.php b/lib/api/kolab_api_service_form_value.php index acffcd3..df1d29e 100644 --- a/lib/api/kolab_api_service_form_value.php +++ b/lib/api/kolab_api_service_form_value.php @@ -1192,7 +1192,7 @@ class kolab_api_service_form_value extends kolab_api_service } } - return (int) $value; + return (string) intval($value); } private function validate_mailalternateaddress($value, $postdata = array(), $validation_type = null) diff --git a/lib/kolab_html.php b/lib/kolab_html.php index 8b296f8..8567bb0 100644 --- a/lib/kolab_html.php +++ b/lib/kolab_html.php @@ -162,9 +162,6 @@ class kolab_html */ public static function inputquota($attribs = array()) { - $elem_attribs = array_merge(self::$input_attribs, self::$input_event_attribs, - self::$common_attribs, self::$event_attribs); - if ($attribs['value'] % 1024 == 0) { if ($attribs['value'] >= 1024) { $attribs['value'] /= 1024; @@ -176,10 +173,19 @@ class kolab_html } } - $options = array(); + $select = array( + 'name' => $attribs['name'] . '-unit', + 'readonly' => !empty($attribs['readonly']), + 'disabled' => !empty($attribs['readonly']), + 'options' => array(), + ); + foreach (array('kb', 'mb', 'gb') as $u) { - $options[] = '<option value="' . $u . '"' . ($unit == $u ? ' selected' : '') . '>' - . strtoupper($u) . '</option>'; + $select['options'][] = array( + 'value' => $u, + 'content' => strtoupper($u), + 'selected' => $unit == $u, + ); } $attribs['data-type'] = 'quota'; @@ -188,8 +194,7 @@ class kolab_html $attribs['size'] = 10; } - return sprintf('<input%s /><select name="%s-unit">%s</select>', - self::attrib_string($attribs, $elem_attribs), $attribs['name'], implode($options)); + return self::input($attribs) . self::select($select); } /** |