mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-08-18 20:39:13 +02:00
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:
@@ -335,6 +335,11 @@ class customfields
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
egw_customfields::update($update_content);
|
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');
|
egw_framework::refresh_opener('Saved', 'admin', $cf_id, 'edit');
|
||||||
if ($action != 'save')
|
if ($action != 'save')
|
||||||
{
|
{
|
||||||
@@ -380,8 +385,12 @@ class customfields
|
|||||||
{
|
{
|
||||||
$readonlys['cf_name'] = true;
|
$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']))
|
if (is_array($content['cf_values']))
|
||||||
{
|
{
|
||||||
$values = '';
|
$values = '';
|
||||||
@@ -420,14 +429,6 @@ class customfields
|
|||||||
$content['statustext'] = $content['options'][$content['cf_type']];
|
$content['statustext'] = $content['options'][$content['cf_type']];
|
||||||
$content['attributes'] = self::$type_attribute_flags;
|
$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(
|
$this->tmpl->exec('admin.customfields.edit',$content,$sel_options,$readonlys,array(
|
||||||
'cf_id' => $cf_id,
|
'cf_id' => $cf_id,
|
||||||
'cf_app' => $this->appname,
|
'cf_app' => $this->appname,
|
||||||
|
@@ -798,8 +798,8 @@ app.classes.admin = AppJS.extend(
|
|||||||
var root = widget.getRoot();
|
var root = widget.getRoot();
|
||||||
var attributes = widget.getArrayMgr('content').getEntry('attributes['+widget.getValue()+']')||{};
|
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_values').set_statustext(widget.egw().lang(widget.getArrayMgr('content').getEntry('options['+widget.getValue()+']')||''));
|
||||||
root.getWidgetById('cf_len').set_disabled(!attributes.cf_len);
|
jQuery(root.getWidgetById('cf_len').getDOMNode()).toggle(attributes.cf_len && true);
|
||||||
root.getWidgetById('cf_rows').set_disabled(!attributes.cf_rows);
|
jQuery(root.getWidgetById('cf_rows').getDOMNode()).toggle(attributes.cf_rows && true);
|
||||||
root.getWidgetById('cf_values').set_disabled(!attributes.cf_values);
|
jQuery(root.getWidgetById('cf_values').getParentDOMNode()).toggle(attributes.cf_values && true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user