lib/api lib/kolab_html.php
Aleksander Machniak
machniak at kolabsys.com
Tue Oct 29 11:32:13 CET 2013
lib/api/kolab_api_service_form_value.php | 2 +-
lib/kolab_html.php | 21 +++++++++++++--------
2 files changed, 14 insertions(+), 9 deletions(-)
New commits:
commit 2bf0b5568ba47283cc1e5ae2b5ec03b0e22d99a3
Author: Aleksander Machniak <alec at alec.pl>
Date: Tue Oct 29 11:30:36 2013 +0100
Fix handling of mailquota attribute value - it should be a string not an integer (Bug #2414)
Disable quota unit selector when input is readonly.
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);
}
/**
More information about the commits
mailing list