more flexible <select> declaration
fix array export in ConfigFile
This commit is contained in:
@@ -83,6 +83,7 @@ $cfg_db['Export']['format'] = array('codegen', 'csv', 'excel', 'htmlexcel',
|
|||||||
'yaml');
|
'yaml');
|
||||||
$cfg_db['Export']['compression'] = array('none', 'zip', 'gzip', 'bzip2');
|
$cfg_db['Export']['compression'] = array('none', 'zip', 'gzip', 'bzip2');
|
||||||
$cfg_db['Export']['charset'] = array_merge(array(''), $GLOBALS['cfg']['AvailableCharsets']);
|
$cfg_db['Export']['charset'] = array_merge(array(''), $GLOBALS['cfg']['AvailableCharsets']);
|
||||||
|
$cfg_db['Export']['codegen_format'] = array('#', 'NHibernate C# DO', 'NHibernate XML');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default values overrides
|
* Default values overrides
|
||||||
|
@@ -512,7 +512,7 @@ class ConfigFile
|
|||||||
// string keys: $cfg[key][subkey] = value
|
// string keys: $cfg[key][subkey] = value
|
||||||
foreach ($var_value as $k => $v) {
|
foreach ($var_value as $k => $v) {
|
||||||
$k = preg_replace('/[^A-Za-z0-9_]/', '_', $k);
|
$k = preg_replace('/[^A-Za-z0-9_]/', '_', $k);
|
||||||
$ret = "\$cfg['$var_name']['$k'] = " . var_export($v, true) . ';' . $crlf;
|
$ret .= "\$cfg['$var_name']['$k'] = " . var_export($v, true) . ';' . $crlf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
|
@@ -88,7 +88,13 @@ class Form
|
|||||||
trigger_error("$option_path - not a static value list", E_USER_ERROR);
|
trigger_error("$option_path - not a static value list", E_USER_ERROR);
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
return $value;
|
// convert value list array('a', 'b') to array('a' => 'a', 'b' => 'b')
|
||||||
|
// and array('#', 'a', 'b') to array('a', 'b')
|
||||||
|
if ($value[0] == '#') {
|
||||||
|
array_shift($value);
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
return array_combine($value, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -320,11 +320,7 @@ class FormDisplay
|
|||||||
break;
|
break;
|
||||||
case 'select':
|
case 'select':
|
||||||
$type = 'select';
|
$type = 'select';
|
||||||
$opts['values'] = array();
|
$opts['values'] = $form->getOptionValueList($form->fields[$field]);
|
||||||
$values = $form->getOptionValueList($form->fields[$field]);
|
|
||||||
foreach ($values as $v) {
|
|
||||||
$opts['values'][$v] = $v;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'array':
|
case 'array':
|
||||||
$type = 'list';
|
$type = 'list';
|
||||||
@@ -508,7 +504,7 @@ class FormDisplay
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'select':
|
case 'select':
|
||||||
if (!$this->_validateSelect($_POST[$key], $form->getOptionValueList($system_path))) {
|
if (!$this->_validateSelect($_POST[$key], array_keys($form->getOptionValueList($system_path)))) {
|
||||||
$this->errors[$work_path][] = __('Incorrect value');
|
$this->errors[$work_path][] = __('Incorrect value');
|
||||||
$result = false;
|
$result = false;
|
||||||
continue;
|
continue;
|
||||||
|
Reference in New Issue
Block a user