From cfd12b4ec9384ccef3717e5b53e2900d5183ed2f Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Thu, 28 Jul 2022 16:39:47 +0200 Subject: [PATCH] Fix smime indicators in preview --- mail/js/app.js | 33 +++++++++++++++--------------- mail/templates/default/app.css | 21 +++++++++++-------- mail/templates/default/display.xet | 4 ++-- mail/templates/default/index.xet | 6 +++--- mail/templates/pixelegg/app.css | 20 ++++++++++-------- 5 files changed, 46 insertions(+), 38 deletions(-) diff --git a/mail/js/app.js b/mail/js/app.js index 3b985802fb..737470ddc3 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -1121,7 +1121,6 @@ app.classes.mail = AppJS.extend( sel_options.attachmentsBlock = {actions:actions}; } - mailPreview.set_value({content:data, sel_options:sel_options}); if (selected && selected.length>1) @@ -1145,6 +1144,8 @@ app.classes.mail = AppJS.extend( var IframeHandle = this.et2.getWidgetById('messageIFRAME'); IframeHandle.set_src('about:blank'); + this.smime_clear_flags([this.et2.getWidgetById('mailPreviewContainer').getDOMNode()]); + // show iframe, in case we hide it from mailvelopes one and remove that jQuery(IframeHandle.getDOMNode()).show() .next(this.mailvelope_iframe_selector).remove(); @@ -5891,7 +5892,7 @@ app.classes.mail = AppJS.extend( this.set_smimeAttachmentsMobile(_attachments); return; } - var attachmentArea = this.et2.getWidgetById(egw(window).is_popup()?'mail_displayattachments':'previewAttachmentArea'); + var attachmentArea = this.et2.getWidgetById(egw(window).is_popup()?'mail_displayattachments':'attachmentsBlock'); var content = this.et2.getArrayMgr('content'); var mailPreview = this.et2.getWidgetById('mailPreviewContainer'); if (attachmentArea && _attachments && _attachments.length > 0) @@ -5901,7 +5902,7 @@ app.classes.mail = AppJS.extend( this.et2.setArrayMgr('contnet', content); attachmentArea.getDOMNode().classList.remove('loading'); attachmentArea.set_value({content:_attachments}); - if (attachmentArea.id == 'previewAttachmentArea') + if (attachmentArea.id == 'attachmentsBlock') { var a_node = attachmentArea.getDOMNode(); var m_node = mailPreview.getDOMNode(); @@ -5951,43 +5952,43 @@ app.classes.mail = AppJS.extend( if (attachmentArea) attachmentArea.getDOMNode().classList.remove('loading'); var smime_signature = et2_object.getWidgetById('smime_signature'); var smime_encryption = et2_object.getWidgetById('smime_encryption'); - var $mail_container = egwIsMobile()? jQuery('.mail-d-h1').next() : - egw(window).is_popup() ? jQuery('.mailDisplayContainer'): - jQuery(et2_object.getWidgetById('mailPreviewContainer').getDOMNode()); + var mail_container = egwIsMobile()? document.getElementsByClassName('mail-d-h1').next() : + egw(window).is_popup() ? document.getElementsByClassName('mailDisplayContainer'): + et2_object.getWidgetById('mailPreviewContainer').getDOMNode(); smime_signature.set_disabled(!data.signed); smime_encryption.set_disabled(!data.encrypted); if (!data.signed) { - this.smime_clear_flags([$mail_container]); + this.smime_clear_flags([mail_container]); return; } else if (data.verify) { - $mail_container.addClass((data.class='smime_cert_verified')); + mail_container.classList.add((data.class='smime_cert_verified')); smime_signature.set_class(data.class); smime_signature.set_statustext(data.msg); } else if (!data.verify && data.cert) { - $mail_container.addClass((data.class='smime_cert_notverified')); + mail_container.classList.add((data.class='smime_cert_notverified')); smime_signature.set_class(data.class); smime_signature.set_statustext(data.msg); } else if (!data.verify && !data.cert) { - $mail_container.addClass((data.class='smime_cert_notvalid')); + mail_container.classList.add((data.class='smime_cert_notvalid')); smime_signature.set_class(data.class); smime_signature.set_statustext(data.msg); } if (data.unknownemail) { - $mail_container.addClass((data.class='smime_cert_unknownemail')); + mail_container.classList.add((data.class='smime_cert_unknownemail')); smime_signature.set_class(data.class); } - jQuery(smime_signature.getDOMNode(), smime_encryption.getDOMNode()).on('click',function(){ + jQuery(smime_signature.getDOMNode(), smime_encryption.getDOMNode()).off().on('click',function(){ self.smime_certAddToContact(data,true); }).addClass('et2_clickable'); - jQuery(smime_encryption.getDOMNode()).on('click',function(){ + jQuery(smime_encryption.getDOMNode()).off().on('click',function(){ self.smime_certAddToContact(data, true); }).addClass('et2_clickable'); }, @@ -6001,9 +6002,9 @@ app.classes.mail = AppJS.extend( { for(var i=0;i<_nodes.length;i++) { - var smime_classes = 'smime_cert_verified smime_cert_notverified smime_cert_notvalid smime_cert_unknownemail'; - _nodes[i].removeClass(smime_classes); - _nodes[i].off('click'); + _nodes[i].classList.remove(...['smime_cert_verified', + 'smime_cert_notverified', + 'smime_cert_notvalid', 'smime_cert_unknownemail']); } }, diff --git a/mail/templates/default/app.css b/mail/templates/default/app.css index 1d085886da..ac86f7a914 100644 --- a/mail/templates/default/app.css +++ b/mail/templates/default/app.css @@ -961,35 +961,38 @@ div.mailComposeHeaderSection>table { .header_row_right.vertical_splitter {float:left;} .header_row_right.vertical_splitter div#mail-index_mail-index-vacationnotice .et2_vbox {margin-right: 0;} -div.smime_cert_notverified { +et2-box.smime_cert_notverified { border-top: 4px solid #8dff95 !important; } -img.smime_cert_notverified { +et2-image.smime_cert_notverified { background: #8dff95; } -div.smime_cert_verified { +et2-box.smime_cert_verified { border-top: 4px solid #1ab82c !important; } -div.smime_cert_unknownemail { +et2-box.smime_cert_unknownemail { border-top: 4px solid #a28cff !important; } -img.smime_cert_verified { +et2-image.smime_cert_verified { background: #1ab82c; } -div.smime_cert_notvalid { +et2-box.smime_cert_notvalid { border-top: 4px solid #e90052 !important; } -img.smime_cert_notvalid { +et2-image.smime_cert_notvalid { background: #e90052; } -img.smime_cert_unknownemail { +et2-image.smime_cert_unknownemail { background: #a28cff; } .mailPreviewHeaders.smimeIcons et2-image { width: 24px; } - +.mailPreviewHeaders.smimeIcons { + display: flex; + justify-content: end; +} #mail-compose tr.mailComposeHeaders { border-top: 1px solid silver; } diff --git a/mail/templates/default/display.xet b/mail/templates/default/display.xet index 6f1885e4ef..ed7786bebb 100644 --- a/mail/templates/default/display.xet +++ b/mail/templates/default/display.xet @@ -12,10 +12,10 @@ hover_action="app.mail.modifyMessageSubjectDialog" hover_action_title="Modify subject of this message"/> - + disabled="!@smime=smime_encrypt" align="right" width="24"/> diff --git a/mail/templates/default/index.xet b/mail/templates/default/index.xet index d78f1782dd..1892761718 100644 --- a/mail/templates/default/index.xet +++ b/mail/templates/default/index.xet @@ -31,10 +31,10 @@ hover_action="app.mail.modifyMessageSubjectDialog" hover_action_title="Modify subject of this message"/> - - + diff --git a/mail/templates/pixelegg/app.css b/mail/templates/pixelegg/app.css index 2e12125f09..b872398ba1 100755 --- a/mail/templates/pixelegg/app.css +++ b/mail/templates/pixelegg/app.css @@ -926,33 +926,37 @@ div.mailComposeHeaderSection > table { .header_row_right.vertical_splitter div#mail-index_mail-index-vacationnotice .et2_vbox { margin-right: 0; } -div.smime_cert_notverified { +et2-box.smime_cert_notverified { border-top: 4px solid #8dff95 !important; } -img.smime_cert_notverified { +et2-image.smime_cert_notverified { background: #8dff95; } -div.smime_cert_verified { +et2-box.smime_cert_verified { border-top: 4px solid #1ab82c !important; } -div.smime_cert_unknownemail { +et2-box.smime_cert_unknownemail { border-top: 4px solid #a28cff !important; } -img.smime_cert_verified { +et2-image.smime_cert_verified { background: #1ab82c; } -div.smime_cert_notvalid { +et2-box.smime_cert_notvalid { border-top: 4px solid #e90052 !important; } -img.smime_cert_notvalid { +et2-image.smime_cert_notvalid { background: #e90052; } -img.smime_cert_unknownemail { +et2-image.smime_cert_unknownemail { background: #a28cff; } .mailPreviewHeaders.smimeIcons et2-image { width: 24px; } +.mailPreviewHeaders.smimeIcons { + display: flex; + justify-content: end; +} #mail-compose tr.mailComposeHeaders { border-top: 1px solid silver; }