summaryrefslogtreecommitdiff
path: root/program/include/main.inc
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2011-01-18 18:00:57 +0000
committerthomascube <thomas@roundcube.net>2011-01-18 18:00:57 +0000
commit0501b637a3177cce441166b5fcfe27c9bd9fbe0f (patch)
tree5460128ef65d2510a7538c4a0e7336987e090ca1 /program/include/main.inc
parente81a30752b244394b03cbcaa0df254c93b379782 (diff)
Merge branch devel-addressbook (r4193:4382) back into trunk
Diffstat (limited to 'program/include/main.inc')
-rw-r--r--program/include/main.inc41
1 files changed, 26 insertions, 15 deletions
diff --git a/program/include/main.inc b/program/include/main.inc
index 1ddb5f9c4..0815c259f 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -799,7 +799,7 @@ function rcube_table_output($attrib, $table_data, $a_show_cols, $id_col)
// format each col
foreach ($a_show_cols as $col)
- $table->add($col, Q($row_data[$col]));
+ $table->add($col, Q(is_array($row_data[$col]) ? $row_data[$col][0] : $row_data[$col]));
$c++;
}
@@ -819,32 +819,43 @@ function rcube_table_output($attrib, $table_data, $a_show_cols, $id_col)
* @return string HTML field definition
*/
function rcmail_get_edit_field($col, $value, $attrib, $type='text')
- {
+{
+ static $colcounts = array();
+
$fname = '_'.$col;
- $attrib['name'] = $fname;
+ $attrib['name'] = $fname . ($attrib['array'] ? '[]' : '');
+ $attrib['class'] = trim($attrib['class'] . ' ff_' . $col);
- if ($type=='checkbox')
- {
+ if ($type == 'checkbox') {
$attrib['value'] = '1';
$input = new html_checkbox($attrib);
- }
- else if ($type=='textarea')
- {
+ }
+ else if ($type == 'textarea') {
$attrib['cols'] = $attrib['size'];
$input = new html_textarea($attrib);
- }
- else
+ }
+ else if ($type == 'select') {
+ $input = new html_select($attrib);
+ $input->add('---', '');
+ $input->add(array_values($attrib['options']), array_keys($attrib['options']));
+ }
+ else {
+ if ($attrib['type'] != 'text' && $attrib['type'] != 'hidden')
+ $attrib['type'] = 'text';
$input = new html_inputfield($attrib);
+ }
// use value from post
- if (!empty($_POST[$fname]))
- $value = get_input_value($fname, RCUBE_INPUT_POST,
- $type == 'textarea' && strpos($attrib['class'], 'mce_editor')!==false ? true : false);
+ if (isset($_POST[$fname])) {
+ $postvalue = get_input_value($fname, RCUBE_INPUT_POST,
+ $type == 'textarea' && strpos($attrib['class'], 'mce_editor')!==false ? true : false);
+ $value = $attrib['array'] ? $postvalue[intval($colcounts[$col]++)] : $postvalue;
+ }
$out = $input->show($value);
-
+
return $out;
- }
+}
/**