Fix mail compose dialog and implements consistent attachments block

This commit is contained in:
Hadi Nategh 2022-08-31 12:26:39 +02:00
parent 38d7604115
commit b83f2f5847
4 changed files with 44 additions and 25 deletions

View File

@ -1384,6 +1384,10 @@ class mail_compose
$attach['filemode_title'] = lang(Vfs\Sharing::$modes[$attach['filemode_icon']]['label'] ?? ''); $attach['filemode_title'] = lang(Vfs\Sharing::$modes[$attach['filemode_icon']]['label'] ?? '');
} }
} }
else
{
unset($content['attachments']);
}
if (isset($content['to'])) $content['to'] = self::resolveEmailAddressList($content['to']); if (isset($content['to'])) $content['to'] = self::resolveEmailAddressList($content['to']);
$content['html_toolbar'] = empty(Mail::$mailConfig['html_toolbar']) ? $content['html_toolbar'] = empty(Mail::$mailConfig['html_toolbar']) ?

View File

@ -4518,17 +4518,8 @@ app.classes.mail = AppJS.extend(
var bodyH = egw_getWindowInnerHeight(); var bodyH = egw_getWindowInnerHeight();
var textArea = this.et2.getWidgetById('mail_plaintext'); var textArea = this.et2.getWidgetById('mail_plaintext');
var $headerSec = jQuery('.mailComposeHeaderSection'); var $headerSec = jQuery('.mailComposeHeaderSection');
var attachments = this.et2.getWidgetById('attachments');
var content = this.et2.getArrayMgr('content').data; var content = this.et2.getArrayMgr('content').data;
// @var arrbitary int represents px
// Visible height of attachment progress
var prgV_H = 150;
// @var arrbitary int represents px
// Visible height of attchements list
var attchV_H = 68;
if (typeof textArea != 'undefined' && textArea != null) if (typeof textArea != 'undefined' && textArea != null)
{ {
if (textArea.getParent().disabled) if (textArea.getParent().disabled)
@ -4536,11 +4527,11 @@ app.classes.mail = AppJS.extend(
textArea = this.et2.getWidgetById('mail_htmltext'); textArea = this.et2.getWidgetById('mail_htmltext');
} }
// Tolerate values base on plain text or html, in order to calculate freespaces // Tolerate values base on plain text or html, in order to calculate freespaces
var textAreaDelta = textArea.id == "mail_htmltext"?20:40; var textAreaDelta = textArea.id == "mail_htmltext"?120:40;
// while attachments are in progress take progress visiblity into account // while attachments are in progress take progress visiblity into account
// otherwise the attachment progress is finished and consider attachments list // otherwise the attachment progress is finished and consider attachments list
var delta = (attachments.table.find('li').length>0 && attachments.table.height() > 0)? prgV_H: (content.attachments? attchV_H: textAreaDelta); var delta = textAreaDelta;
var bodySize = (bodyH - Math.round($headerSec.height() + $headerSec.offset().top) - delta); var bodySize = (bodyH - Math.round($headerSec.height() + $headerSec.offset().top) - delta);

View File

@ -281,7 +281,6 @@ pre {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
word-wrap: break-word; word-wrap: break-word;
max-width: 0px;
} }
#mail-index { #mail-index {
position: relative position: relative

View File

@ -24,7 +24,7 @@
<grid width="100%" resize_ratio="0"> <grid width="100%" resize_ratio="0">
<columns> <columns>
<column widtd="10%"/> <column width="10%"/>
<column width="84%"/> <column width="84%"/>
<column width="6%"/> <column width="6%"/>
</columns> </columns>
@ -86,19 +86,28 @@
</grid> </grid>
</vbox> </vbox>
<vbox class="mailComposeBodySection" width="100%"> <vbox class="mailComposeBodySection" width="100%">
<old-hbox disabled="@is_plain" class="mailComposeBody mailComposeHtmlContainer"> <et2-details toggleAlign="left" title="@attachmentsBlockTitle" toggleOnHover="true" class="attachments" hoist="true" disabled="!@attachments">
<htmlarea name="mail_htmltext" id="mail_htmltext" statusbar="false" menubar="false" toolbar="@html_toolbar" imageUpload="link_to" expand_toolbar="true" height="478px" width="100%" resize_ratio="0"/> <hbox slot="summary">
</old-hbox> <grid class="previewAttachmentArea egwGridView_grid" >
<old-hbox disabled="@is_html" class="mailComposeBody mailComposeTextContainer"> <columns>
<textbox multiline="true" rows="40" cols="120" width="100%" span="all" no_lang="1" name="mail_plaintext" id="mail_plaintext" resize_ratio="0"/> <column width= "3%"/>
</old-hbox> <column disabled="!@showtempname" width="10%"/>
<vbox class="et2_file mailUploadSection" disabled="@no_griddata"> <column width="85%"/>
<hbox> <column width="8%"/>
<select id="filemode" label="Send files as" onchange="app.mail.check_sharing_filemode"/> <column width="" />
<date id="expiration" label="Expiration" blur="@expiration_blur" data_format="Y-m-d"/> </columns>
<passwd id="password" blur="password protect" statustext="Only makes sense, if you transport password through a different channel / outside of this mail to recipients!"/> <rows>
<row class="row attachmentRow">
<image src="@attachments[0][filemode_icon]" statustext="@attachments[0][filemode_title]"/>
<description id="attachments[0][tmp_name]"/>
<description class="useEllipsis et2_link" id="attachments[0][name]" no_lang="1" onclick="app.mail.displayUploadedFile"/>
<vfs-size align="right" id="attachments[0][size]" />
<button id="delete[@attachments[0][tmp_name]]" value="Delete" image="delete"/>
</row>
</rows>
</grid>
</hbox> </hbox>
<grid id="attachments" width="100%" maxheight="165" class="egwGridView_grid" resize_ratio="0"> <grid id="attachments" class="previewAttachmentArea egwGridView_grid">
<columns> <columns>
<column width= "3%"/> <column width= "3%"/>
<column disabled="!@showtempname" width="10%"/> <column disabled="!@showtempname" width="10%"/>
@ -116,6 +125,22 @@
</row> </row>
</rows> </rows>
</grid> </grid>
</et2-details>
<old-hbox disabled="@is_plain" class="mailComposeBody mailComposeHtmlContainer">
<htmlarea name="mail_htmltext" id="mail_htmltext" statusbar="false" menubar="false" toolbar="@html_toolbar" imageUpload="link_to" expand_toolbar="true" height="478px" width="100%" resize_ratio="0"/>
</old-hbox>
<old-hbox disabled="@is_html" class="mailComposeBody mailComposeTextContainer">
<textbox multiline="true" rows="40" cols="120" width="100%" span="all" no_lang="1" name="mail_plaintext" id="mail_plaintext" resize_ratio="0"/>
</old-hbox>
<vbox class="et2_file mailUploadSection" disabled="@no_griddata">
<hbox>
<select id="filemode" label="Send files as" onchange="app.mail.check_sharing_filemode"/>
<hbox>
<description value="Expiration"/>
<date id="expiration" blur="@expiration_blur" data_format="Y-m-d"/>
</hbox>
<passwd id="password" blur="password protect" statustext="Only makes sense, if you transport password through a different channel / outside of this mail to recipients!"/>
</hbox>
</vbox> </vbox>
</vbox> </vbox>
</template> </template>