From: <nat...@us...> - 2015-04-20 21:49:14
|
Author: nathangray Date: Mon Apr 20 23:49:05 2015 New Revision: 52550 URL: http://svn.stylite.de/viewvc/egroupware?rev=52550&view=rev Log: 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 Modified: trunk/admin/inc/class.customfields.inc.php trunk/admin/js/app.js trunk/admin/templates/default/customfield_edit.xet Modified: trunk/admin/inc/class.customfields.inc.php URL: http://svn.stylite.de/viewvc/egroupware/trunk/admin/inc/class.customfields.inc.php?rev=52550&r1=52549&r2=52550&view=diff ============================================================================== --- trunk/admin/inc/class.customfields.inc.php (original) +++ trunk/admin/inc/class.customfields.inc.php Mon Apr 20 23:49:05 2015 @@ -300,11 +300,17 @@ { 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 @@ { $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 @@ $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); } Modified: trunk/admin/js/app.js URL: http://svn.stylite.de/viewvc/egroupware/trunk/admin/js/app.js?rev=52550&r1=52549&r2=52550&view=diff ============================================================================== --- trunk/admin/js/app.js (original) +++ trunk/admin/js/app.js Mon Apr 20 23:49:05 2015 @@ -797,7 +797,7 @@ 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); Modified: trunk/admin/templates/default/customfield_edit.xet URL: http://svn.stylite.de/viewvc/egroupware/trunk/admin/templates/default/customfield_edit.xet?rev=52550&r1=52549&r2=52550&view=diff ============================================================================== --- trunk/admin/templates/default/customfield_edit.xet (original) +++ trunk/admin/templates/default/customfield_edit.xet Mon Apr 20 23:49:05 2015 @@ -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> |