Index: trunk/kernel/parser.php
===================================================================
diff -u -r2462 -r2492
--- trunk/kernel/parser.php (.../parser.php) (revision 2462)
+++ trunk/kernel/parser.php (.../parser.php) (revision 2492)
@@ -556,6 +556,46 @@
return $o;
}
+ function m_form_custom_options($attribs = array())
+ {
+ global $FormValues, $objSession;
+ $html_attribs = ExtraAttributes($attribs);
+
+ $form = $attribs['_form'];
+ $field = $attribs['_field'];
+
+ $application =& kApplication::Instance();
+ $item_type = $application->getUnitOption($attribs['_prefix'], 'ItemType');
+
+ $sql = 'SELECT ValueList FROM '.GetTablePrefix().'CustomField WHERE FieldName = %s AND Type = %s';
+ $values = $application->DB->GetOne( sprintf($sql, $application->DB->qstr($field), $item_type ) );
+ if(!$values) return '';
+
+ if( GetVar($field) )
+ {
+ $value = GetVar($field);
+ }
+ else
+ {
+ $value = $FormValues[$form][$field];
+ if( is_array($value) ) $value = $value['value'];
+ }
+
+ $ret = '';
+ $values = explode(',', $values);
+ $option_tpl = '';
+ foreach($values as $mixed_value)
+ {
+ $mixed_value = explode('=', $mixed_value);
+ $label = substr($mixed_value[1],0,1) == '+' ? substr($mixed_value[1],1,strlen($mixed_value[1])) : language($mixed_value[1]);
+ $selected = $mixed_value[0] == $value ? ' selected' : '';
+ $ret .= sprintf($option_tpl, $mixed_value[0], $selected, $label);
+ }
+
+ return $ret;
+ }
+
+
/*
@description: creates an form TEXTAREA field. All extra attributes are passed to the TEXTAREA tag
@attrib: _Form:: Form name for the field
@@ -576,7 +616,9 @@
}
else
{
- $value = inp_htmlize($FormValues[$attribs["_form"]][$field]);
+ $value = $FormValues[$form][$field];
+ if (is_array($value)) $value = $value['value'];
+ $value = inp_htmlize($value);
}
$ret = "";
@@ -610,12 +652,15 @@
$isthumb = (int)getArrayValue($attribs,'_thumbnail');
$imgname = getArrayValue($attribs,'_imagename');
$maxsize = getArrayValue($attribs,'_maxsize');
+ $is_default = getArrayValue($attribs, '_default');
$ret = "";
$ret .= "";
$ret .= "";
$ret .= "";
$ret .= "";
+ if($is_default) $ret .= '';
+
if( getArrayValue($attribs,'_required') )
{
$ret .= "";