Customfields:

- add missing delete button confirm
- fix some js bugs when changing type
- add accidentally removed check for overwriting an existing field
- make cf_name read-only after it is set
This commit is contained in:
Nathan Gray 2015-04-20 21:49:05 +00:00
parent 53363be626
commit 25a9811121
3 changed files with 14 additions and 3 deletions

View File

@ -300,11 +300,17 @@ class customfields
{
case 'delete':
$this->so->delete($cf_id);
egw_framework::refresh_opener('Saved', 'admin', $cf_id /* Conflicts with accounts 'delete'*/);
egw_framework::refresh_opener('Deleted', 'admin', $cf_id /* Conflicts with accounts 'delete'*/);
egw_framework::window_close();
break;
case 'save':
case 'apply':
if(!$cf_id && $this->fields[$content['cf_name']])
{
egw_framework::message(lang("Field '%1' already exists !!!",$content['cf_name']),'error');
$content['cf_name'] = '';
break;
}
if(empty($content['cf_label']))
{
$content['cf_label'] = $content['cf_name'];
@ -370,6 +376,10 @@ class customfields
{
$content['cf_private'] = explode(',',$content['cf_private']);
}
if($content['cf_name'])
{
$readonlys['cf_name'] = true;
}
}
$content['cf_values'] = json_decode($content['cf_values'], true);
if (is_array($content['cf_values']))
@ -421,6 +431,7 @@ class customfields
$this->tmpl->exec('admin.customfields.edit',$content,$sel_options,$readonlys,array(
'cf_id' => $cf_id,
'cf_app' => $this->appname,
'cf_name' => $content['cf_name'],
'use_private' => $this->use_private,
),2);
}

View File

@ -797,7 +797,7 @@ app.classes.admin = AppJS.extend(
cf_type_change: function(e,widget) {
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_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);

View File

@ -61,7 +61,7 @@
<button statustext="Apply the changes" label="Apply" id="button[apply]" image="apply" background_image="1"/>
<button statustext="leave without saveing the entry" label="Cancel" id="button[cancel]" onclick="window.close();" image="cancel" background_image="1"/>
</hbox>
<button align="right" statustext="delete this entry" label="Delete" id="button[delete]" image="delete" background_image="1" span="all"/>
<button align="right" statustext="delete this entry" label="Delete" id="button[delete]" image="delete" onclick="et2_dialog.confirm(widget,'Delete this entry?','Delete')" background_image="1" span="all"/>
</row>
</rows>
</grid>