forked from extern/egroupware
Customfields:
- fix options/attributes not saved under some cirumstances - fix subsequent changes not saved if you click Apply the first time
This commit is contained in:
parent
25a9811121
commit
a627dea3d6
@ -335,6 +335,11 @@ class customfields
|
||||
}
|
||||
}
|
||||
egw_customfields::update($update_content);
|
||||
if(!$cf_id)
|
||||
{
|
||||
$this->fields = egw_customfields::get($this->appname,true);
|
||||
$cf_id = (int)$this->fields[$content['cf_name']]['id'];
|
||||
}
|
||||
egw_framework::refresh_opener('Saved', 'admin', $cf_id, 'edit');
|
||||
if ($action != 'save')
|
||||
{
|
||||
@ -380,8 +385,12 @@ class customfields
|
||||
{
|
||||
$readonlys['cf_name'] = true;
|
||||
}
|
||||
$content['cf_values'] = json_decode($content['cf_values'], true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$readonlys['button[delete]'] = true;
|
||||
}
|
||||
$content['cf_values'] = json_decode($content['cf_values'], true);
|
||||
if (is_array($content['cf_values']))
|
||||
{
|
||||
$values = '';
|
||||
@ -420,14 +429,6 @@ class customfields
|
||||
$content['statustext'] = $content['options'][$content['cf_type']];
|
||||
$content['attributes'] = self::$type_attribute_flags;
|
||||
|
||||
// Start disabled, but don't set read-only as that changes the widget to readonly
|
||||
$this->tmpl->setElementAttribute('cf_len', 'disabled', true);
|
||||
$this->tmpl->setElementAttribute('cf_rows', 'disabled', true);
|
||||
foreach(array('cf_len','cf_rows','cf_values') as $field)
|
||||
{
|
||||
$this->tmpl->setElementAttribute($field, 'disabled', !self::$type_attribute_flags[$content['cf_type']][$field]);
|
||||
}
|
||||
|
||||
$this->tmpl->exec('admin.customfields.edit',$content,$sel_options,$readonlys,array(
|
||||
'cf_id' => $cf_id,
|
||||
'cf_app' => $this->appname,
|
||||
|
@ -798,8 +798,8 @@ app.classes.admin = AppJS.extend(
|
||||
var root = widget.getRoot();
|
||||
var attributes = widget.getArrayMgr('content').getEntry('attributes['+widget.getValue()+']')||{};
|
||||
root.getWidgetById('cf_values').set_statustext(widget.egw().lang(widget.getArrayMgr('content').getEntry('options['+widget.getValue()+']')||''));
|
||||
root.getWidgetById('cf_len').set_disabled(!attributes.cf_len);
|
||||
root.getWidgetById('cf_rows').set_disabled(!attributes.cf_rows);
|
||||
root.getWidgetById('cf_values').set_disabled(!attributes.cf_values);
|
||||
jQuery(root.getWidgetById('cf_len').getDOMNode()).toggle(attributes.cf_len && true);
|
||||
jQuery(root.getWidgetById('cf_rows').getDOMNode()).toggle(attributes.cf_rows && true);
|
||||
jQuery(root.getWidgetById('cf_values').getParentDOMNode()).toggle(attributes.cf_values && true);
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user