Branch 'kolab-webadmin-3.1' - lib/api lib/kolab_html.php
Aleksander Machniak
machniak at kolabsys.com
Tue Oct 29 11:33:29 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 83036257cf3a5731fcc687ba6b41f6be9c42e53a
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 cb7fa34..1bed5f0 100644
--- a/lib/api/kolab_api_service_form_value.php
+++ b/lib/api/kolab_api_service_form_value.php
@@ -1195,7 +1195,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