From 4b73a80699f7a83f189117ee0676c503c8b903d6 Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 20 Jul 2022 14:23:55 -0600 Subject: [PATCH] Fix missing label / icon in delete folder confirmation Some other et2_dialog->Et2Dialog changes --- mail/js/app.js | 343 ++++++++++++++++++++++++++----------------------- 1 file changed, 181 insertions(+), 162 deletions(-) diff --git a/mail/js/app.js b/mail/js/app.js index c4fea47646..b4e198e5b3 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -911,16 +911,17 @@ app.classes.mail = AppJS.extend( && filemode && filemode.get_value() != content[field]['files']['filemode']) { var filemode_label = filemode.options.select_options[content[field]['files']['filemode']]['label']; - et2_dialog.show_dialog(function(_button){ - if (_button == 2) + Et2Dialog.show_dialog(function (_button) { - compose_et2[0].widgetContainer._inst.submit(); - } - }, - this.egw.lang( - 'Be aware by adding all selected files as %1 mode, it will also change all existing attachments in the list to %2 mode as well. Would you like to proceed?', - filemode_label, filemode_label), - this.egw.lang('Add files as %1', filemode_label), '', et2_dialog.BUTTONS_YES_NO, et2_dialog.WARNING_MESSAGE); + if (_button == Et2Dialog.YES_BUTTON) + { + compose_et2[0].widgetContainer._inst.submit(); + } + }, + this.egw.lang( + 'Be aware by adding all selected files as %1 mode, it will also change all existing attachments in the list to %2 mode as well. Would you like to proceed?', + filemode_label, filemode_label), + this.egw.lang('Add files as %1', filemode_label), '', Et2Dialog.BUTTONS_YES_NO, Et2Dialog.WARNING_MESSAGE); return; } else @@ -1328,20 +1329,21 @@ app.classes.mail = AppJS.extend( typeof dataElem.data.flags.mdnsent == 'undefined' && typeof dataElem.data.flags.mdnnotsent == 'undefined') { var buttons = [ - {text: this.egw.lang("Yes"), id: "mdnsent", image: "check"}, - {text: this.egw.lang("No"), id:"mdnnotsent", image: "cancelled"} + {label: this.egw.lang("Yes"), id: "mdnsent", image: "check"}, + {label: this.egw.lang("No"), id: "mdnnotsent", image: "cancelled"} ]; - et2_dialog.show_dialog(function(_button_id, _value) { - switch (_button_id) + Et2Dialog.show_dialog(function (_button_id, _value) { - case "mdnsent": - egw.jsonq('mail.mail_ui.ajax_sendMDN',[messages]); - egw.jsonq('mail.mail_ui.ajax_flagMessages',['mdnsent', messages, true]); - return; - case "mdnnotsent": - egw.jsonq('mail.mail_ui.ajax_flagMessages',['mdnnotsent', messages, true]); - } - }, + switch (_button_id) + { + case "mdnsent": + egw.jsonq('mail.mail_ui.ajax_sendMDN', [messages]); + egw.jsonq('mail.mail_ui.ajax_flagMessages', ['mdnsent', messages, true]); + return; + case "mdnnotsent": + egw.jsonq('mail.mail_ui.ajax_flagMessages', ['mdnnotsent', messages, true]); + } + }, this.egw.lang("The message sender has requested a response to indicate that you have read this message. Would you like to send a receipt?"), this.egw.lang("Confirm"), messages, buttons); @@ -1577,21 +1579,22 @@ app.classes.mail = AppJS.extend( { var self = this; var buttons = [ - {text: this.egw.lang("Empty Trash and Junk"), id: "cleanup", class: "ui-priority-primary", default: true, image:"delete"}, - {text: this.egw.lang("Cancel"), id:"cancel"} + {label: this.egw.lang("Empty Trash and Junk"), id: "cleanup", class: "ui-priority-primary", default: true, image: "delete"}, + {label: this.egw.lang("Cancel"), id: "cancel"} ]; var server = [{iface:{id: _data.data.profileid+'::'}}]; - et2_dialog.show_dialog(function(_button_id) { - if (_button_id == "cleanup") + Et2Dialog.show_dialog(function (_button_id) { - self.mail_emptySpam (null, server); - self.mail_emptyTrash (null, server); - } - return; - }, - this.egw.lang("Your remaining quota %1 is too low, you may not be able to send/receive further emails.\n Although cleaning up emails in trash or junk folder might help you to get some free space back.\n If that didn't help, please ask your administrator for more quota.", _data.data.quotafreespace), - this.egw.lang("Mail cleanup"), - '', buttons, et2_dialog.WARNING_MESSAGE); + if (_button_id == "cleanup") + { + self.mail_emptySpam(null, server); + self.mail_emptyTrash(null, server); + } + return; + }, + this.egw.lang("Your remaining quota %1 is too low, you may not be able to send/receive further emails.\n Although cleaning up emails in trash or junk folder might help you to get some free space back.\n If that didn't help, please ask your administrator for more quota.", _data.data.quotafreespace), + this.egw.lang("Mail cleanup"), + '', buttons, Et2Dialog.WARNING_MESSAGE); } } }, @@ -2484,8 +2487,8 @@ app.classes.mail = AppJS.extend( if (_confirm) { var buttons = [ - {text: this.egw.lang("Yes"), id: "all", "class": "ui-priority-primary", "default": true, image: 'check'}, - {text: this.egw.lang("Cancel"), id:"cancel"} + {label: this.egw.lang("Yes"), id: "all", "class": "ui-priority-primary", "default": true, image: 'check'}, + {label: this.egw.lang("Cancel"), id: "cancel"} ]; var messageToDisplay = ''; var actionlabel =_action.id; @@ -2525,18 +2528,22 @@ app.classes.mail = AppJS.extend( } messageToDisplay = this.egw.lang("Do you really want to apply %1 to ALL messages in the current view?",this.egw.lang(type?type:_action.id))+" "; } - return et2_dialog.show_dialog(function(_button_id) { - var rv = false; - switch (_button_id) + return Et2Dialog.show_dialog(function (_button_id) { - case "all": - rv = true; - break; - case "cancel": - rv = 'cancel'; - } - if (rv !="cancel") that.lock_tree(); - switch (_action.id) + var rv = false; + switch (_button_id) + { + case "all": + rv = true; + break; + case "cancel": + rv = 'cancel'; + } + if (rv != "cancel") + { + that.lock_tree(); + } + switch (_action.id) { case "delete": that.mail_callDelete(_action, _elems,rv); @@ -3394,29 +3401,33 @@ app.classes.mail = AppJS.extend( if (!_entryId) { var buttons = [ - {text: app.mail.egw.lang('Append'), id: 'append', image: 'check', default:true}, - {text: app.mail.egw.lang('Add as new'), id: 'new', image: 'check'}, - {text: app.mail.egw.lang('Cancel'), id: 'cancel', image: 'check'} + {label: app.mail.egw.lang('Append'), id: 'append', image: 'check', default: true}, + {label: app.mail.egw.lang('Add as new'), id: 'new', image: 'check'}, + {label: app.mail.egw.lang('Cancel'), id: 'cancel', image: 'check'} ]; et2_createWidget("dialog", { - callback: function(_buttons, _value) + callback: function (_buttons, _value) { - if (_buttons == 'cancel') return; + if (_buttons == 'cancel') + { + return; + } if (_buttons == 'append' && _value) { _entryId = _value.id; } - execCallback.call(this,{entryid:_entryId,url:_url}); + execCallback.call(this, {entryid: _entryId, url: _url}); }, title: egw.lang(_title), - buttons: buttons||et2_dialog.BUTTONS_OK_CANCEL, - value:{ - content:{ - appName:_appName // appName to search on its list later - }}, - template: egw.webserverUrl+'/mail/templates/default/integration_to_entry_dialog.xet' - },et2_dialog._create_parent('mail')); + buttons: buttons || Et2Dialog.BUTTONS_OK_CANCEL, + value: { + content: { + appName: _appName // appName to search on its list later + } + }, + template: egw.webserverUrl + '/mail/templates/default/integration_to_entry_dialog.xet' + }, Et2Dialog._create_parent('mail')); } else // there is an entry saved related to this mail's subject { @@ -3699,21 +3710,25 @@ app.classes.mail = AppJS.extend( var ftree = this.et2.getWidgetById(this.nm_index+'[foldertree]'); var OldFolderName = ftree.getLabel(_senders[0].id).replace(this._unseen_regexp,''); var buttons = [ - {text: this.egw.lang("Add"), id: "add", "class": "ui-priority-primary", "default": true}, - {text: this.egw.lang("Cancel"), id:"cancel"} + {label: this.egw.lang("Add"), id: "add", "class": "ui-priority-primary", "default": true}, + {label: this.egw.lang("Cancel"), id: "cancel"} ]; - et2_dialog.show_prompt(function(_button_id, _value) { - var NewFolderName = null; - if (_value.length>0) NewFolderName = _value; - //alert(NewFolderName); - if (NewFolderName && NewFolderName.length>0) + Et2Dialog.show_prompt(function (_button_id, _value) { - switch (_button_id) + var NewFolderName = null; + if (_value.length > 0) { - case "add": - egw.json('mail.mail_ui.ajax_addFolder',[_senders[0].id, NewFolderName]) - .sendRequest(true); - return; + NewFolderName = _value; + } + //alert(NewFolderName); + if (NewFolderName && NewFolderName.length > 0) + { + switch (_button_id) + { + case "add": + egw.json('mail.mail_ui.ajax_addFolder', [_senders[0].id, NewFolderName]) + .sendRequest(true); + return; case "cancel": } } @@ -3735,21 +3750,25 @@ app.classes.mail = AppJS.extend( var ftree = this.et2.getWidgetById(this.nm_index+'[foldertree]'); var OldFolderName = ftree.getLabel(_senders[0].id).replace(this._unseen_regexp,''); var buttons = [ - {text: this.egw.lang("Rename"), id: "rename", "class": "ui-priority-primary", image: 'edit', "default": true}, - {text: this.egw.lang("Cancel"), id:"cancel"} + {label: this.egw.lang("Rename"), id: "rename", "class": "ui-priority-primary", image: 'edit', "default": true}, + {label: this.egw.lang("Cancel"), id: "cancel"} ]; - et2_dialog.show_prompt(function(_button_id, _value) { - var NewFolderName = null; - if (_value.length>0) NewFolderName = _value; - //alert(NewFolderName); - if (NewFolderName && NewFolderName.length>0) + Et2Dialog.show_prompt(function (_button_id, _value) { - switch (_button_id) + var NewFolderName = null; + if (_value.length > 0) { - case "rename": - egw.json('mail.mail_ui.ajax_renameFolder',[_senders[0].id, NewFolderName]) - .sendRequest(true); - return; + NewFolderName = _value; + } + //alert(NewFolderName); + if (NewFolderName && NewFolderName.length > 0) + { + switch (_button_id) + { + case "rename": + egw.json('mail.mail_ui.ajax_renameFolder', [_senders[0].id, NewFolderName]) + .sendRequest(true); + return; case "cancel": } } @@ -3785,27 +3804,28 @@ app.classes.mail = AppJS.extend( var callback = function (_button) { - if (_button == et2_dialog.YES_BUTTON) + if (_button == Et2Dialog.YES_BUTTON) { - egw.appName='mail'; - egw.message (egw.lang('Folder %1 is moving to folder %2',src_label,dest_label )); - egw.loading_prompt('mail_moveFolder', true,'','#egw_fw_basecontainer'); - for(var i = 0; i < _senders.length; i++) + egw.appName = 'mail'; + egw.message(egw.lang('Folder %1 is moving to folder %2', src_label, dest_label)); + egw.loading_prompt('mail_moveFolder', true, '', '#egw_fw_basecontainer'); + for (var i = 0; i < _senders.length; i++) { - egw.jsonq('mail.mail_ui.ajax_MoveFolder',[_senders[i].id, destination.id], + egw.jsonq('mail.mail_ui.ajax_MoveFolder', [_senders[i].id, destination.id], // Move is done (successfully or not), remove loading - function() { + function () + { var id = destination.id.split('::'); //refersh the top parent - ftree.refreshItem(id[0],null); + ftree.refreshItem(id[0], null); egw.loading_prompt('mail_moveFolder', false); } ); } } }; - et2_dialog.show_dialog(callback, this.egw.lang('Are you sure you want to move folder %1 to folder %2?', - src_label, dest_label), this.egw.lang('Move folder'), {},et2_dialog.BUTTONS_YES_NO, et2_dialog.WARNING_MESSAGE); + Et2Dialog.show_dialog(callback, this.egw.lang('Are you sure you want to move folder %1 to folder %2?', + src_label, dest_label), this.egw.lang('Move folder'), {}, Et2Dialog.BUTTONS_YES_NO, Et2Dialog.WARNING_MESSAGE); }, /** @@ -3814,28 +3834,30 @@ app.classes.mail = AppJS.extend( * @param _action * @param _senders - the representation of the tree leaf to be manipulated */ - mail_DeleteFolder: function(_action,_senders) { + mail_DeleteFolder: function(_action,_senders) + { //action.id == 'delete' //_senders.iface.id == target leaf / leaf to edit - var ftree = this.et2.getWidgetById(this.nm_index+'[foldertree]'); - var OldFolderName = ftree.getLabel(_senders[0].id).replace(this._unseen_regexp,''); + var ftree = this.et2.getWidgetById(this.nm_index + '[foldertree]'); + var OldFolderName = ftree.getLabel(_senders[0].id).replace(this._unseen_regexp, ''); var buttons = [ - {text: this.egw.lang("Yes"), id: "delete", "class": "ui-priority-primary", "default": true}, - {text: this.egw.lang("Cancel"), id:"cancel"} + {label: this.egw.lang("Yes"), id: "delete", "class": "ui-priority-primary", "default": true, image: "check"}, + {label: this.egw.lang("Cancel"), id: "cancel", image: "cancel"} ]; - et2_dialog.show_dialog(function(_button_id, _value) { - switch (_button_id) + Et2Dialog.show_dialog(function (_button_id, _value) { - case "delete": - egw.json('mail.mail_ui.ajax_deleteFolder',[_senders[0].id]) - .sendRequest(true); - return; - case "cancel": - } - }, - this.egw.lang("Do you really want to DELETE Folder %1 ?",OldFolderName)+" "+(ftree.hasChildren(_senders[0].id)?this.egw.lang("All subfolders will be deleted too, and all messages in all affected folders will be lost"):this.egw.lang("All messages in the folder will be lost")), - this.egw.lang("DELETE Folder %1 ?",OldFolderName), - OldFolderName, buttons); + switch (_button_id) + { + case "delete": + egw.json('mail.mail_ui.ajax_deleteFolder', [_senders[0].id]) + .sendRequest(true); + return; + case "cancel": + } + }, + this.egw.lang("Do you really want to DELETE Folder %1 ?", OldFolderName) + " " + (ftree.hasChildren(_senders[0].id) ? this.egw.lang("All subfolders will be deleted too, and all messages in all affected folders will be lost") : this.egw.lang("All messages in the folder will be lost")), + this.egw.lang("DELETE Folder %1 ?", OldFolderName), + OldFolderName, buttons); }, /** @@ -4185,13 +4207,13 @@ app.classes.mail = AppJS.extend( var callbackDeleteDialog = function (button_id) { - if (button_id == et2_dialog.YES_BUTTON ) + if (button_id == Et2Dialog.YES_BUTTON) { actionData = _type.parent.data.widget.getArrayMgr('content'); - that._do_action(typeId, actionData['data'],ruleID); + that._do_action(typeId, actionData['data'], ruleID); } }; - et2_dialog.show_dialog(callbackDeleteDialog, this.egw.lang("Do you really want to DELETE this Rule"),this.egw.lang("Delete"), {},et2_dialog.BUTTONS_YES_CANCEL, et2_dialog.WARNING_MESSAGE); + Et2Dialog.show_dialog(callbackDeleteDialog, this.egw.lang("Do you really want to DELETE this Rule"), this.egw.lang("Delete"), {}, Et2Dialog.BUTTONS_YES_CANCEL, Et2Dialog.WARNING_MESSAGE); break; case 'add' : @@ -5102,9 +5124,9 @@ app.classes.mail = AppJS.extend( { const mode = _widget.get_value(); const mode_label = _widget.select_options.filter(option => option.value == mode)[0]?.label; - et2_dialog.alert(this.egw.lang('Be aware that all attachments will be sent as %1!', mode_label), - this.egw.lang('Filemode has been switched to %1', mode_label), - et2_dialog.WARNING_MESSAGE); + Et2Dialog.alert(this.egw.lang('Be aware that all attachments will be sent as %1!', mode_label), + this.egw.lang('Filemode has been switched to %1', mode_label), + Et2Dialog.WARNING_MESSAGE); const content = this.et2.getArrayMgr('content'); const attachments = this.et2.getWidgetById('attachments'); for (let i in content.data.attachments) @@ -5349,22 +5371,22 @@ app.classes.mail = AppJS.extend( else { // switch Mailvelop off again, but warn user he will loose his content - et2_dialog.show_dialog(function (_button_id) - { - if (_button_id == et2_dialog.YES_BUTTON ) + Et2Dialog.show_dialog(function (_button_id) { - self.et2.getWidgetById('mimeType').set_readonly(false); - self.et2.getWidgetById('mail_plaintext').set_disabled(false); - jQuery(self.mailvelope_iframe_selector).remove(); - } - else - { - self.et2.getWidgetById('composeToolbar').checkbox('pgp',true); - } - }, - this.egw.lang('You will loose current message body, unless you save it to your clipboard!'), - this.egw.lang('Switch off encryption?'), - {}, et2_dialog.BUTTONS_YES_NO, et2_dialog.WARNING_MESSAGE, undefined, this.egw); + if (_button_id == Et2Dialog.YES_BUTTON) + { + self.et2.getWidgetById('mimeType').set_readonly(false); + self.et2.getWidgetById('mail_plaintext').set_disabled(false); + jQuery(self.mailvelope_iframe_selector).remove(); + } + else + { + self.et2.getWidgetById('composeToolbar').checkbox('pgp', true); + } + }, + this.egw.lang('You will loose current message body, unless you save it to your clipboard!'), + this.egw.lang('Switch off encryption?'), + {}, Et2Dialog.BUTTONS_YES_NO, Et2Dialog.WARNING_MESSAGE, undefined, this.egw); } }, @@ -5544,7 +5566,7 @@ app.classes.mail = AppJS.extend( this.saveAsDraft(null, 'autosaving').then(function(){ self.compose_saveDraft2fm(_action); }, function(){ - et2_dialog.alert('You need to save the message as draft first before to be able to save it into VFS','Save to filemanager','info'); + Et2Dialog.alert('You need to save the message as draft first before to be able to save it into VFS', 'Save to filemanager', 'info'); }); } }, @@ -5687,7 +5709,7 @@ app.classes.mail = AppJS.extend( var callbackDialog = function(_btn) { egw.appName='mail'; - if (_btn === et2_dialog.YES_BUTTON) + if (_btn === Et2Dialog.YES_BUTTON) { if (tree) { @@ -5696,13 +5718,14 @@ app.classes.mail = AppJS.extend( { var selFldArr = selFolders.split(tree.input.dlmtr); var msg = egw.lang('Deleting %1 folders in progress ...', selFldArr.length); - et2_dialog.long_task(function(_val, _resp){ + Et2Dialog.long_task(function (_val, _resp) + { console.log(_val, _resp); if (_val && _resp.type !== 'error') { var stat = []; var folderName = ''; - for(var i=0;i