From 711eac89341c50ee2d500f81acb41a642f5439c4 Mon Sep 17 00:00:00 2001 From: ralf Date: Wed, 20 Jul 2022 19:11:59 +0200 Subject: [PATCH] fix Admin > Mail account to work in master: - using [] and back for saving - remove TS code switching multiple on and off via previously removed button --> must not be back-ported to 21.1! --- admin/inc/class.admin_mail.inc.php | 17 ++++---- admin/js/app.ts | 54 ------------------------- admin/templates/default/mailaccount.xet | 8 ++-- 3 files changed, 11 insertions(+), 68 deletions(-) diff --git a/admin/inc/class.admin_mail.inc.php b/admin/inc/class.admin_mail.inc.php index a0504fd033..d3d676806e 100644 --- a/admin/inc/class.admin_mail.inc.php +++ b/admin/inc/class.admin_mail.inc.php @@ -1199,7 +1199,7 @@ class admin_mail // admin access to account with no credentials available if ($this->is_admin && (empty($content['acc_imap_username']) || empty($content['acc_imap_host']) || $content['called_for'])) { - // cant connection to imap --> allow free entries in taglists + // can't connection to imap --> allow free entries in taglists foreach(array('acc_folder_sent', 'acc_folder_trash', 'acc_folder_draft', 'acc_folder_template', 'acc_folder_junk') as $folder) { $tpl->setElementAttribute($folder, 'allowFreeEntries', true); @@ -1335,11 +1335,6 @@ class admin_mail } Framework::message($msg ? $msg : (string)$_GET['msg'], $msg_type); - if (is_array($content['account_id']) && count($content['account_id']) > 1) - { - $tpl->setElementAttribute('account_id', 'multiple', true); - $readonlys['button[multiple]'] = true; - } // when called by admin for existing accounts, display further administrative actions if ($content['called_for'] && (int)$content['acc_id'] > 0) { @@ -1411,11 +1406,15 @@ class admin_mail if (!is_array($account_id)) { - $account_id = explode(',', $account_id); + $account_id = $account_id ? explode(',', $account_id) : []; } - if (($k = array_search($back?'':'0', $account_id)) !== false) + if ($back && !$account_id) { - $account_id[$k] = $back ? '0' : ''; + $account_id = 0; + } + if (!$back && count($account_id) === 1 && !current($account_id)) + { + $account_id = []; } } diff --git a/admin/js/app.ts b/admin/js/app.ts index 59e65b7a9b..c78de0d372 100644 --- a/admin/js/app.ts +++ b/admin/js/app.ts @@ -131,9 +131,6 @@ class AdminApp extends EgwApp this.cf_type_change(null,widget); break; - case 'admin.mailaccount': - this.account_hide_not_applying(); - break; case 'admin.cmds': var selected = this.et2.getWidgetById('nm').getSelection(); if (selected && selected.ids.length == 1) @@ -1293,57 +1290,6 @@ class AdminApp extends EgwApp this.et2.getWidgetById('acc_sieve_enabled').set_value(1); } - /** - * Hide not applying fields, used as: - * - onchange handler on account_id - * - called from et2_ready for emailadmin.account template - * - * @param {object} _event event-object or information about event - * @param {et2_baseWidget} _widget widget causing the event - */ - account_hide_not_applying(_event?, _widget?) - { - var account_id = this.et2.getWidgetById('account_id'); - var ids = account_id && account_id.get_value ? account_id.get_value() : []; - if (typeof ids == 'string') ids = ids.split(','); - - var multiple = ids.length >= 2 || ids[0] === '' || ids[0] < 0; - //alert('multiple='+(multiple?'true':'false')+': '+ids.join(',')); - - // initial call - if (typeof _widget == 'undefined') - { - if (!multiple) - { - jQuery('.emailadmin_no_single').hide(); - } - if (!this.egw.user('apps').admin) - { - jQuery('.emailadmin_no_user,#button\\[multiple\\]').hide(); - } - if (ids.length == 1) - { - // switch back to single selectbox - account_id.set_multiple(false); - } - } - // switched to single user - else if (!multiple) - { - jQuery('.emailadmin_no_single').fadeOut(); - // switch back to single selectbox - account_id.set_multiple(false); - this.et2.getWidgetById('button[multiple]').set_disabled(false); - } - // switched to multiple user - else - { - jQuery('.emailadmin_no_single').fadeIn(); - } - if (_event && _event.stopPropagation) _event.stopPropagation(); - return false; - } - /** * Callback if user changed account selction * diff --git a/admin/templates/default/mailaccount.xet b/admin/templates/default/mailaccount.xet index a117ae77f4..b44a5837b6 100644 --- a/admin/templates/default/mailaccount.xet +++ b/admin/templates/default/mailaccount.xet @@ -260,12 +260,12 @@ - + - + @@ -342,9 +342,7 @@ - +