diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php
index 66fc98f750..196de3030c 100644
--- a/mail/inc/class.mail_compose.inc.php
+++ b/mail/inc/class.mail_compose.inc.php
@@ -33,7 +33,7 @@ class mail_compose
'reply' => True,
'replyAll' => True,
'selectFolder' => True,
- 'addAtachment' => True,
+ 'attachFromVFS' => True,
'action' => True
);
@@ -131,6 +131,12 @@ class mail_compose
return strtr ($string, $trans_tbl);
}
+ function attachFromVFS($target, $path=null)
+ {
+ error_log(__METHOD__.__LINE__.array2string($path));
+ return "var path=".json_encode($path)."; opener.app.mail.compose_closeVfsSelector(path);";
+ }
+
function action()
{
$formData['identity'] = (int)$_POST['identity'];
@@ -276,8 +282,18 @@ class mail_compose
{
//error_log(__METHOD__.__LINE__.array2string($_REQUEST));
error_log(__METHOD__.__LINE__.array2string($_content));
-$CAtFStart = array2string($_content);
+
if (isset($_GET['reply_id'])) $replyID = $_GET['reply_id'];
+ if (is_array($_content['uploadForCompose']))
+ {
+ foreach ($_content['uploadForCompose'] as $i => &$upload)
+ {
+ if (!isset($upload['file'])) $upload['file'] = $upload['tmp_name'];
+ $tmp_filename = mail_bo::checkFileBasics($upload,'compose',false);
+ $upload['file'] = $upload['tmp_name'] = $tmp_filename;
+ }
+ }
+$CAtFStart = array2string($_content);
// read the data from session
// all values are empty for a new compose window
$insertSigOnTop = false;
@@ -890,32 +906,6 @@ $CAtFStart = array2string($_content);
$this->t->set_var("toggle_editormode", lang("Editor type").": ");
}
*/
- // attachments
- if (is_array($sessionData['attachments']) && count($sessionData['attachments']) > 0)
- {
- $imgClearLeft = common::image('felamimail','clear_left');
- $tableRows = array();
- foreach((array)$sessionData['attachments'] as $id => $attachment) {
- $tempArray = array (
- '1' => $attachment['name'], '.1' => 'width="40%"',
- '2' => mime_magic::mime2label($attachment['type']),
- '3' => egw_vfs::hsize($attachment['size']), '.3' => "style='text-align:right;'",
- '4' => ' ', '.4' => 'width="10%"',
- '5' => "composeID."','$id')\">",
- );
- $tableRows[] = $tempArray;
- }
-
- if(count($tableRows) > 0) {
- $table = html::table($tableRows, "style='width:100%'");
- }
-// $this->t->set_var('attachment_rows',$table);
- }
- else
- {
-// $this->t->set_var('attachment_rows','');
- }
-
// signature stuff set earlier
$sel_options['signatureID'] = $selectSignatures;
$content['signatureID'] = ($presetSig ? $presetSig : $sessionData['signatureID']);
diff --git a/mail/inc/class.mail_hooks.inc.php b/mail/inc/class.mail_hooks.inc.php
index c3093602b6..69c4e98f71 100644
--- a/mail/inc/class.mail_hooks.inc.php
+++ b/mail/inc/class.mail_hooks.inc.php
@@ -81,23 +81,23 @@ class mail_hooks
'menuaction' => 'mail.mail_ui.displayMessage',
),
'view_id' => 'id',
- 'view_popup' => '850xegw_getWindowOuterHeight()',
+ 'view_popup' => '870xegw_getWindowOuterHeight()',
'view_list' => 'mail.mail_ui.index',
'add' => array(
'menuaction' => 'mail.mail_compose.compose',
),
- 'add_popup' => '850xegw_getWindowOuterHeight()',
+ 'add_popup' => '870xegw_getWindowOuterHeight()',
'edit' => array(
'menuaction' => 'mail.mail_compose.compose',
),
'edit_id' => 'id',
- 'edit_popup' => '850xegw_getWindowOuterHeight()',
+ 'edit_popup' => '870xegw_getWindowOuterHeight()',
// register fmail as handler for .eml files
'mime' => array(
'message/rfc822' => array(
'menuaction' => 'felamimail.uifelamimail.importMessageFromVFS2DraftAndDisplay',
//'menuaction' => 'mail.mail_ui.importMessageFromVFS2DraftAndDisplay',
- 'mime_popup' => '850xegw_getWindowOuterHeight()',
+ 'mime_popup' => '870xegw_getWindowOuterHeight()',
'mime_url' => 'formData[file]',
),
),
@@ -836,7 +836,7 @@ class mail_hooks
);
$file += array(
- 'import message' => "javascript:egw_openWindowCentered2('".egw::link('/index.php', $linkData,false)."','importMessageDialog',700,125,'no','$appname');",
+ 'import message' => "javascript:egw_openWindowCentered2('".egw::link('/index.php', $linkData,false)."','importMessageDialog',870,125,'no','$appname');",
);
}
diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php
index f738ec6fa8..ffa244cf14 100644
--- a/mail/inc/class.mail_ui.inc.php
+++ b/mail/inc/class.mail_ui.inc.php
@@ -1155,7 +1155,6 @@ unset($query['actions']);
//error_log(__METHOD__.__LINE__.array2string($rows));
$endtime = microtime(true) - $starttime;
//error_log(__METHOD__.__LINE__.' SelectedFolder:'.$query['selectedFolder'].' Start:'.$query['start'].' NumRows:'.$query['num_rows'].' Took:'.$endtime);
-
return $rowsFetched['messages'];
}
@@ -1335,6 +1334,8 @@ unset($query['actions']);
}
//_debug_array($header);
+ $imageTag = '';
+ $imageHTMLBlock = '';
if (in_array("attachments", $cols))
{
if($header['mimetype'] == 'multipart/mixed' ||
@@ -1348,16 +1349,9 @@ unset($query['actions']);
substr($header['mimetype'],0,5) == 'video' ||
$header['mimetype'] == 'multipart/alternative')
{
- $linkDataAttachments = array (
- 'menuaction' => 'mail.uidisplay.displayAttachments',
- 'showHeader' => 'false',
- 'mailbox' => base64_encode($_folderName),
- 'uid' => $header['uid'],
- 'id' => $header['id'],
- );
- $windowName = 'displayMessage_'.$header['uid'];
-
$image = html::image('mail','attach');
+ $imageTag = '';
+ $imageHTMLBlock = '';
if (//$header['mimetype'] != 'multipart/mixed' &&
$header['mimetype'] != 'multipart/signed'
)
@@ -1368,11 +1362,23 @@ unset($query['actions']);
$this->mail_bo->reopen($_folderName);
}
$attachments = $this->mail_bo->getMessageAttachments($header['uid'],$_partID='', $_structure='', $fetchEmbeddedImages=true, $fetchTextCalendar=false, $resolveTNEF=false);
- if (count($attachments)<1) $image = ' ';
+ if (count($attachments)<1)
+ {
+ $image = ' ';
+ }
+ if (count($attachments)==1)
+ {
+ $imageHTMLBlock = self::createAttachmentBlock($attachments, $data['row_id'], $header['uid'], $_folder);
+ $imageTag = json_encode($attachments);
+ $image = html::image('mail','attach',$attachments[0]['name'].(!empty($attachments[0]['mimeType'])?' ('.$attachments[0]['mimeType'].')':''));
+ }
+ }
+ if (count($attachments)>1)
+ {
+ $imageHTMLBlock = self::createAttachmentBlock($attachments, $data['row_id'], $header['uid'], $_folder);
+ $imageTag = json_encode($attachments);
+ $image = html::image('mail','attach',lang('%1 attachments',count($attachments)));
}
- if (count($attachments)>0) $image = "link('/index.php',$linkDataAttachments)."', '".$windowName."', this); return false;\"
- title=\"".$header['subject']."\">".$image."";
$attachmentFlag = $image;
} else {
@@ -1408,7 +1414,7 @@ unset($query['actions']);
}
$linkData = array
(
- 'menuaction' => 'mail.uicompose.compose',
+ 'menuaction' => 'mail.mail_compose.compose',
'send_to' => base64_encode($senderAddress)
);
$windowName = 'compose_'.$header['uid'];
@@ -1456,7 +1462,7 @@ unset($query['actions']);
/*
$linkData = array
(
- 'menuaction' => 'mail.uicompose.compose',
+ 'menuaction' => 'mail.mail_compose.compose',
'send_to' => base64_encode($senderAddress)
);
$windowName = 'compose_'.$header['uid'];
@@ -1467,14 +1473,6 @@ unset($query['actions']);
}
if (in_array("date", $cols))
{
- /*
- if ($dateToday == mail_bo::_strtotime($header['date'],'Y-m-d')) {
- $dateShort = mail_bo::_strtotime($header['date'],($GLOBALS['egw_info']['user']['preferences']['common']['timeformat']==12?'h:i:s a':'H:i:s'));
- } else {
- $dateShort = mail_bo::_strtotime($header['date'],str_replace('Y','y',$GLOBALS['egw_info']['user']['preferences']['common']['dateformat']).' '.
- ($GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == 12 ? 'h:i a' : 'H:i'));
- }
- */
$data["date"] = $header['date'];//$dateShort;//''.$dateShort.'';
}
if (in_array("modified", $cols))
@@ -1496,6 +1494,8 @@ unset($query['actions']);
//$this->t->set_var('phpgw_images',EGW_IMAGES);
//$result["data"] = $data;
$data["class"] = implode(' ', $css_styles);
+ $data['attachmentsPresent'] = $imageTag;
+ $data['attachmentsBlock'] = $imageHTMLBlock;
$rv[] = $data;
//error_log(__METHOD__.__LINE__.array2string($result));
}
@@ -1773,7 +1773,7 @@ unset($query['actions']);
break;
}
//error_log(__METHOD__.__LINE__.$linkView);
- $attachmentHTML[$key]['link_view'] = ''.
+ $attachmentHTML[$key]['link_view'] = ''.
($value['name'] ? ( $filename ? $filename : $value['name'] ) : lang('(no subject)')).
'';
@@ -1823,7 +1823,7 @@ unset($query['actions']);
$attachmentHTMLBlock="";
foreach ((array)$attachmentHTML as $row)
{
- $attachmentHTMLBlock .= "".$row['link_view'].' | ';
+ $attachmentHTMLBlock .= "
".$row['link_view'].' | ';
$attachmentHTMLBlock .= "".$row['mimetype'].' | ';
$attachmentHTMLBlock .= "".$row['size'].' | ';
$attachmentHTMLBlock .= "".$row['link_save'].' |
';
diff --git a/mail/js/app.js b/mail/js/app.js
index 3e6061f941..69e30948e7 100644
--- a/mail/js/app.js
+++ b/mail/js/app.js
@@ -80,6 +80,8 @@ app.mail = AppJS.extend(
case 'mail.display':
isDisplay=true;
break;
+ case 'mail.compose':
+
}
}
//alert('action about to go down');
@@ -91,14 +93,14 @@ app.mail = AppJS.extend(
body.node.parentNode.style.top=subject.node.offsetTop+40+'px';
var app_registry = egw.link_get_registry(this.appname);
//console.log(app_registry);
- w=850;
+ w=870;
if (typeof app_registry['view'] != 'undefined' && typeof app_registry['view_popup'] != 'undefined' )
{
var w_h =app_registry['view_popup'].split('x');
if (w_h[1] == 'egw_getWindowOuterHeight()') w_h[1] = (screen.availHeight>egw_getWindowOuterHeight()?screen.availHeight:egw_getWindowOuterHeight());
}
- //alert('resizing to'+(w_h[0]?w_h[0]:850)+','+(w_h[1]?w_h[1]:egw_getWindowOuterHeight()));
- window.resizeTo((w_h[0]?w_h[0]:850),(w_h[1]?w_h[1]:(screen.availHeight>egw_getWindowOuterHeight()?screen.availHeight:egw_getWindowOuterHeight())));
+ //alert('resizing to'+(w_h[0]?w_h[0]:870)+','+(w_h[1]?w_h[1]:egw_getWindowOuterHeight()));
+ window.resizeTo((w_h[0]?w_h[0]:870),(w_h[1]?w_h[1]:(screen.availHeight>egw_getWindowOuterHeight()?screen.availHeight:egw_getWindowOuterHeight())));
}
},
@@ -224,25 +226,25 @@ app.mail = AppJS.extend(
{
url += 'menuaction=mail.mail_compose.composeFromDraft';
url += '&id='+_elems[0].id;
- egw_openWindowCentered(url,'composeasnew_'+_elems[0].id,700,egw_getWindowOuterHeight());
+ egw_openWindowCentered(url,'composeasnew_'+_elems[0].id,870,egw_getWindowOuterHeight());
}
if (_action.id == 'composeasnew')
{
url += 'menuaction=mail.mail_compose.composeAsNew';
url += '&reply_id='+_elems[0].id;
- egw_openWindowCentered(url,'composeasnew_'+_elems[0].id,700,egw_getWindowOuterHeight());
+ egw_openWindowCentered(url,'composeasnew_'+_elems[0].id,870,egw_getWindowOuterHeight());
}
if (_action.id == 'reply')
{
url += 'menuaction=mail.mail_compose.reply';
url += '&reply_id='+_elems[0].id;
- egw_openWindowCentered(url,'reply_'+_elems[0].id,700,egw_getWindowOuterHeight());
+ egw_openWindowCentered(url,'reply_'+_elems[0].id,870,egw_getWindowOuterHeight());
}
if (_action.id == 'reply_all')
{
url += 'menuaction=mail.mail_compose.replyAll';
url += '&reply_id='+_elems[0].id;
- egw_openWindowCentered(url,'replyAll_'+_elems[0].id,700,egw_getWindowOuterHeight());
+ egw_openWindowCentered(url,'replyAll_'+_elems[0].id,870,egw_getWindowOuterHeight());
}
if (_action.id == 'forward'||_action.id == 'forwardinline'||_action.id == 'forwardasattach')
{
@@ -256,7 +258,7 @@ app.mail = AppJS.extend(
url += 'menuaction=mail.mail_compose.forward';
url += '&reply_id='+_elems[0].id;
url += '&mode=forwardinline';
- egw_openWindowCentered(url,'forward_'+_elems[0].id,700,egw_getWindowOuterHeight());
+ egw_openWindowCentered(url,'forward_'+_elems[0].id,870,egw_getWindowOuterHeight());
}
}
},
@@ -331,7 +333,7 @@ app.mail = AppJS.extend(
sMessageList= 'AsForward&forwardmails=1&folder='+activeFolderB64+'&reply_id='+sMessageList.substring(0,sMessageList.length-1);
}
//alert(sMessageList);
- egw_openWindowCentered(_url+sMessageList,'compose',700,egw_getWindowOuterHeight());
+ egw_openWindowCentered(_url+sMessageList,'compose',870,egw_getWindowOuterHeight());
}
//ToDo: reset message selection
},
@@ -381,6 +383,10 @@ app.mail = AppJS.extend(
var _id = this.mail_fetchCurrentlyFocussed(selected);
dataElem = egw.dataGetUIDdata(_id);
}
+ //get_class does not exist yet
+ //var pAAClass = etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('previewAttachmentArea').get_class();
+ //console.log(pAAClass);
+ etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('previewAttachmentArea').set_class('previewAttachmentArea');
if(typeof selected == 'undefined' || selected.length == 0 || selected.length > 1 || typeof dataElem =='undefined')
{
this.mail_fetchCurrentlyFocussed();
@@ -389,6 +395,8 @@ app.mail = AppJS.extend(
etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('previewToAddress').set_value("");
etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('previewDate').set_value("");
etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('previewSubject').set_value("");
+ etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('previewAttachmentArea').set_value("");
+ etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('previewAttachmentArea').set_class('previewAttachmentArea noContent');
var IframeHandle = etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('messageIFRAME');
IframeHandle.set_src(egw.link('/index.php',{menuaction:'mail.mail_ui.loadEmailBody',_messageID:""}));
this.mail_disablePreviewArea(true);
@@ -402,7 +410,10 @@ app.mail = AppJS.extend(
etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('previewToAddress').set_value(dataElem.data.toaddress);
etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('previewDate').set_value(dataElem.data.date);
etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('previewSubject').set_value(subject);
+ etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('previewAttachmentArea').set_value((dataElem.data.attachmentsBlock.length>1?dataElem.data.attachmentsBlock:''));
+ if (dataElem.data.attachmentsBlock.length<1) etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('previewAttachmentArea').set_class('previewAttachmentArea noContent');
var IframeHandle = etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('messageIFRAME');
+ //console.log(IframeHandle);
IframeHandle.set_src(egw.link('/index.php',{menuaction:'mail.mail_ui.loadEmailBody',_messageID:_id}));
var messages = {};
messages['msg'] = [_id];
@@ -844,7 +855,7 @@ app.mail = AppJS.extend(
*/
mail_displayHeaderLines: function(_url) {
// only used by right clickaction
- egw_openWindowCentered(_url,'mail_display_headerLines','700','600',window.outerWidth/2,window.outerHeight/2);
+ egw_openWindowCentered(_url,'mail_display_headerLines','870','600',window.outerWidth/2,window.outerHeight/2);
},
/**
@@ -1174,14 +1185,16 @@ app.mail = AppJS.extend(
},
import_displayVfsSelector: function(_ref) {
- var ref = this.et2.getWidgetById(_ref);
+ //var ref = this.et2.getWidgetById(_ref);
//console.log(ref);
+ cInst= this.et2.getInstanceManager();
+ console.log(cInst);
this.mail_fileSelectorWindow = egw().open_link(egw.link('/index.php', {
menuaction: 'filemanager.filemanager_select.select',
- mode: 'open',
- method: 'mail.mail_ui.setImportMessageFromVFS',
- id: ref.value[0],//represents the target where to import to
- }), 'mail_import_vfsSelector', '640x580');
+ mode: (_ref=='import'?'open':'open-multiple'),
+ method: (_ref=='import'?'mail.mail_ui.setImportMessageFromVFS':'mail.mail_compose.attachFromVFS'),
+ id: _ref,//represents the target where to import to
+ }), 'mail_'+(_ref=='import'?'import':'compose')+'_vfsSelector', '640x580');
},
import_closeVfsSelector: function(_ref) {
@@ -1204,6 +1217,25 @@ app.mail = AppJS.extend(
//vfsfile._parent._parent._parent.parentNode.et2_obj.submit();
},
+ compose_closeVfsSelector: function(_ref) {
+ // names used here to access the popupwindows must be available, else it fails
+ // names used here are assigned in app.mail.import_displayVfsSelector and class.mail_hooks.inc.php
+ this.mail_fileSelectorWindow = window.open('','mail_compose_vfsSelector');
+ this.mail_fileSelectorWindow.close();
+
+ var vfsfile = this.et2.getWidgetById('vfsfile');
+ console.log(vfsfile);
+ console.log(_ref);
+ //vfsfile.input[0].value=_ref;
+ //console.log(vfsfile.input[0].value,folder.value[0]);
+ //composeMessageDialog = egw().open_link(egw.link('/index.php', {
+ // menuaction: 'mail.mail_compose.compose',
+ // file: vfsfile.input[0].value
+ //}), 'importMessageDialog', '640x580');
+ //composeMessageDialog.focus();
+ //vfsfile._parent._parent._parent.parentNode.et2_obj.submit();
+ },
+
/**
* Send names of uploaded files (again) to server, to process them: either copy to vfs or ask overwrite/rename
*
diff --git a/mail/templates/default/app.css b/mail/templates/default/app.css
index c628b1bac7..d1e08495a0 100644
--- a/mail/templates/default/app.css
+++ b/mail/templates/default/app.css
@@ -277,6 +277,12 @@ pre {
width: 100%;
overflow: hidden;
}
+.useEllipsis {
+ text-overflow: ellipsis;
+ width: 250px;
+ white-space: nowrap;
+ overflow: hidden;
+}
/*
influence the tree display and scrolling behavior
*/
@@ -326,11 +332,29 @@ input[type=button] {
#mail-index_mailPreviewContainer {
position: absolute;
border: 1px solid silver;
- top: 55px;
+ top: 60px;
bottom: 0;
left: 3px;
right: 0;
}
+#mail-index_previewAttachmentArea {
+ background-color:#efefdf;
+ max-height: 10%;
+ max-width: 50%;
+ position: absolute;
+ overflow:scroll;
+ overflow-x:hidden;
+ right: 0;
+ top: 25px;
+ border: 1px solid red;
+ opacity: 1;
+ -moz-opacity:1:
+ filter: Alpha(opacity=100);
+}
+#mail-index_previewAttachmentArea.noContent {
+ border:0px !important;
+}
+
.mailDisplayContainer, .mailDisplayAttachments {
display: block;
display: -moz-inline-stack;
diff --git a/mail/templates/default/compose.xet b/mail/templates/default/compose.xet
index 6c846b8080..f5c1eedc07 100644
--- a/mail/templates/default/compose.xet
+++ b/mail/templates/default/compose.xet
@@ -10,6 +10,8 @@
+
+
-
+
>
diff --git a/mail/templates/default/index.xet b/mail/templates/default/index.xet
index e20a75a833..9db366318b 100644
--- a/mail/templates/default/index.xet
+++ b/mail/templates/default/index.xet
@@ -61,6 +61,9 @@
+
+
+