Fix smime indicators in preview

This commit is contained in:
Hadi Nategh 2022-07-28 16:39:47 +02:00
parent 76b8a783e5
commit cfd12b4ec9
5 changed files with 46 additions and 38 deletions

View File

@ -1121,7 +1121,6 @@ app.classes.mail = AppJS.extend(
sel_options.attachmentsBlock = {actions:actions}; sel_options.attachmentsBlock = {actions:actions};
} }
mailPreview.set_value({content:data, sel_options:sel_options}); mailPreview.set_value({content:data, sel_options:sel_options});
if (selected && selected.length>1) if (selected && selected.length>1)
@ -1145,6 +1144,8 @@ app.classes.mail = AppJS.extend(
var IframeHandle = this.et2.getWidgetById('messageIFRAME'); var IframeHandle = this.et2.getWidgetById('messageIFRAME');
IframeHandle.set_src('about:blank'); 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 // show iframe, in case we hide it from mailvelopes one and remove that
jQuery(IframeHandle.getDOMNode()).show() jQuery(IframeHandle.getDOMNode()).show()
.next(this.mailvelope_iframe_selector).remove(); .next(this.mailvelope_iframe_selector).remove();
@ -5891,7 +5892,7 @@ app.classes.mail = AppJS.extend(
this.set_smimeAttachmentsMobile(_attachments); this.set_smimeAttachmentsMobile(_attachments);
return; 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 content = this.et2.getArrayMgr('content');
var mailPreview = this.et2.getWidgetById('mailPreviewContainer'); var mailPreview = this.et2.getWidgetById('mailPreviewContainer');
if (attachmentArea && _attachments && _attachments.length > 0) if (attachmentArea && _attachments && _attachments.length > 0)
@ -5901,7 +5902,7 @@ app.classes.mail = AppJS.extend(
this.et2.setArrayMgr('contnet', content); this.et2.setArrayMgr('contnet', content);
attachmentArea.getDOMNode().classList.remove('loading'); attachmentArea.getDOMNode().classList.remove('loading');
attachmentArea.set_value({content:_attachments}); attachmentArea.set_value({content:_attachments});
if (attachmentArea.id == 'previewAttachmentArea') if (attachmentArea.id == 'attachmentsBlock')
{ {
var a_node = attachmentArea.getDOMNode(); var a_node = attachmentArea.getDOMNode();
var m_node = mailPreview.getDOMNode(); var m_node = mailPreview.getDOMNode();
@ -5951,43 +5952,43 @@ app.classes.mail = AppJS.extend(
if (attachmentArea) attachmentArea.getDOMNode().classList.remove('loading'); if (attachmentArea) attachmentArea.getDOMNode().classList.remove('loading');
var smime_signature = et2_object.getWidgetById('smime_signature'); var smime_signature = et2_object.getWidgetById('smime_signature');
var smime_encryption = et2_object.getWidgetById('smime_encryption'); var smime_encryption = et2_object.getWidgetById('smime_encryption');
var $mail_container = egwIsMobile()? jQuery('.mail-d-h1').next() : var mail_container = egwIsMobile()? document.getElementsByClassName('mail-d-h1').next() :
egw(window).is_popup() ? jQuery('.mailDisplayContainer'): egw(window).is_popup() ? document.getElementsByClassName('mailDisplayContainer'):
jQuery(et2_object.getWidgetById('mailPreviewContainer').getDOMNode()); et2_object.getWidgetById('mailPreviewContainer').getDOMNode();
smime_signature.set_disabled(!data.signed); smime_signature.set_disabled(!data.signed);
smime_encryption.set_disabled(!data.encrypted); smime_encryption.set_disabled(!data.encrypted);
if (!data.signed) if (!data.signed)
{ {
this.smime_clear_flags([$mail_container]); this.smime_clear_flags([mail_container]);
return; return;
} }
else if (data.verify) 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_class(data.class);
smime_signature.set_statustext(data.msg); smime_signature.set_statustext(data.msg);
} }
else if (!data.verify && data.cert) 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_class(data.class);
smime_signature.set_statustext(data.msg); smime_signature.set_statustext(data.msg);
} }
else if (!data.verify && !data.cert) 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_class(data.class);
smime_signature.set_statustext(data.msg); smime_signature.set_statustext(data.msg);
} }
if (data.unknownemail) 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); 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); self.smime_certAddToContact(data,true);
}).addClass('et2_clickable'); }).addClass('et2_clickable');
jQuery(smime_encryption.getDOMNode()).on('click',function(){ jQuery(smime_encryption.getDOMNode()).off().on('click',function(){
self.smime_certAddToContact(data, true); self.smime_certAddToContact(data, true);
}).addClass('et2_clickable'); }).addClass('et2_clickable');
}, },
@ -6001,9 +6002,9 @@ app.classes.mail = AppJS.extend(
{ {
for(var i=0;i<_nodes.length;i++) 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].classList.remove(...['smime_cert_verified',
_nodes[i].removeClass(smime_classes); 'smime_cert_notverified',
_nodes[i].off('click'); 'smime_cert_notvalid', 'smime_cert_unknownemail']);
} }
}, },

View File

@ -961,35 +961,38 @@ div.mailComposeHeaderSection>table {
.header_row_right.vertical_splitter {float:left;} .header_row_right.vertical_splitter {float:left;}
.header_row_right.vertical_splitter div#mail-index_mail-index-vacationnotice .et2_vbox {margin-right: 0;} .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; border-top: 4px solid #8dff95 !important;
} }
img.smime_cert_notverified { et2-image.smime_cert_notverified {
background: #8dff95; background: #8dff95;
} }
div.smime_cert_verified { et2-box.smime_cert_verified {
border-top: 4px solid #1ab82c !important; border-top: 4px solid #1ab82c !important;
} }
div.smime_cert_unknownemail { et2-box.smime_cert_unknownemail {
border-top: 4px solid #a28cff !important; border-top: 4px solid #a28cff !important;
} }
img.smime_cert_verified { et2-image.smime_cert_verified {
background: #1ab82c; background: #1ab82c;
} }
div.smime_cert_notvalid { et2-box.smime_cert_notvalid {
border-top: 4px solid #e90052 !important; border-top: 4px solid #e90052 !important;
} }
img.smime_cert_notvalid { et2-image.smime_cert_notvalid {
background: #e90052; background: #e90052;
} }
img.smime_cert_unknownemail { et2-image.smime_cert_unknownemail {
background: #a28cff; background: #a28cff;
} }
.mailPreviewHeaders.smimeIcons et2-image { .mailPreviewHeaders.smimeIcons et2-image {
width: 24px; width: 24px;
} }
.mailPreviewHeaders.smimeIcons {
display: flex;
justify-content: end;
}
#mail-compose tr.mailComposeHeaders { #mail-compose tr.mailComposeHeaders {
border-top: 1px solid silver; border-top: 1px solid silver;
} }

View File

@ -12,10 +12,10 @@
hover_action="app.mail.modifyMessageSubjectDialog" hover_action="app.mail.modifyMessageSubjectDialog"
hover_action_title="Modify subject of this message"/> hover_action_title="Modify subject of this message"/>
<hbox class="mailPreviewHeaders smimeIcons"> <hbox class="mailPreviewHeaders smimeIcons">
<image id="smime_signature" src="smime_sign" statustext="Smime signed message" disabled="true" <image id="smime_signature" src="smime_sign" statustext="Smime signed message" disabled="!@smime=smime_sign"
align="right" width="24"/> align="right" width="24"/>
<image id="smime_encryption" src="smime_encrypt" statustext="Smime encrypted message" <image id="smime_encryption" src="smime_encrypt" statustext="Smime encrypted message"
disabled="true" align="right" width="24"/> disabled="!@smime=smime_encrypt" align="right" width="24"/>
</hbox> </hbox>
</hbox> </hbox>

View File

@ -31,10 +31,10 @@
hover_action="app.mail.modifyMessageSubjectDialog" hover_action="app.mail.modifyMessageSubjectDialog"
hover_action_title="Modify subject of this message"/> hover_action_title="Modify subject of this message"/>
<hbox class="mailPreviewHeaders smimeIcons"> <hbox class="mailPreviewHeaders smimeIcons">
<image id="smimeSignature" src="smime_sign" statustext="Smime signed message" disabled="true" <image id="smime_signature" src="smime_sign" statustext="Smime signed message" disabled="!@smime=smime_sign"
align="right" width="24"/> align="right" width="24"/>
<image id="smimeEncryption" src="smime_encrypt" statustext="Smime encrypted message" <image id="smime_encryption" src="smime_encrypt" statustext="Smime encrypted message"
disabled="true" align="right" width="24"/> disabled="!@smime=smime_encrypt" align="right" width="24"/>
</hbox> </hbox>
</hbox> </hbox>
<hbox width="100%" class="mailPreviewHeaders"> <hbox width="100%" class="mailPreviewHeaders">

View File

@ -926,33 +926,37 @@ div.mailComposeHeaderSection > table {
.header_row_right.vertical_splitter div#mail-index_mail-index-vacationnotice .et2_vbox { .header_row_right.vertical_splitter div#mail-index_mail-index-vacationnotice .et2_vbox {
margin-right: 0; margin-right: 0;
} }
div.smime_cert_notverified { et2-box.smime_cert_notverified {
border-top: 4px solid #8dff95 !important; border-top: 4px solid #8dff95 !important;
} }
img.smime_cert_notverified { et2-image.smime_cert_notverified {
background: #8dff95; background: #8dff95;
} }
div.smime_cert_verified { et2-box.smime_cert_verified {
border-top: 4px solid #1ab82c !important; border-top: 4px solid #1ab82c !important;
} }
div.smime_cert_unknownemail { et2-box.smime_cert_unknownemail {
border-top: 4px solid #a28cff !important; border-top: 4px solid #a28cff !important;
} }
img.smime_cert_verified { et2-image.smime_cert_verified {
background: #1ab82c; background: #1ab82c;
} }
div.smime_cert_notvalid { et2-box.smime_cert_notvalid {
border-top: 4px solid #e90052 !important; border-top: 4px solid #e90052 !important;
} }
img.smime_cert_notvalid { et2-image.smime_cert_notvalid {
background: #e90052; background: #e90052;
} }
img.smime_cert_unknownemail { et2-image.smime_cert_unknownemail {
background: #a28cff; background: #a28cff;
} }
.mailPreviewHeaders.smimeIcons et2-image { .mailPreviewHeaders.smimeIcons et2-image {
width: 24px; width: 24px;
} }
.mailPreviewHeaders.smimeIcons {
display: flex;
justify-content: end;
}
#mail-compose tr.mailComposeHeaders { #mail-compose tr.mailComposeHeaders {
border-top: 1px solid silver; border-top: 1px solid silver;
} }