diff --git a/mail/inc/class.mail_bo.inc.php b/mail/inc/class.mail_bo.inc.php
index 165ce1d1fc..3fe5d8e486 100644
--- a/mail/inc/class.mail_bo.inc.php
+++ b/mail/inc/class.mail_bo.inc.php
@@ -626,6 +626,7 @@ class mail_bo
function openConnection($_icServerID=0, $_adminConnection=false)
{
static $isError;
+ if ($_icServerID==0 && !empty($this->profileID))$_icServerID = $this->profileID;
//error_log(__METHOD__.__LINE__.'->'.$_icServerID.' called from '.function_backtrace());
if (is_null($isError)) $isError = egw_cache::getCache(egw_cache::INSTANCE,'email','icServerIMAP_connectionError'.trim($GLOBALS['egw_info']['user']['account_id']),null,array(),$expiration=60*5);
if ( isset($isError[$_icServerID]) || (($this->icServer instanceof defaultimap) && PEAR::isError($this->icServer->_connectionErrorObject)))
@@ -1479,12 +1480,25 @@ class mail_bo
}
else
{
- switch($_sort) {
+ switch(strtoupper($_sort)) {
+ case 'FROMADDRESS':
+ $retValue = 'FROM';
+ break;
+ case 'TOADDRESS':
+ $retValue = 'TO';
+ break;
+ case 'SUBJECT':
+ $retValue = 'SUBJECT';
+ break;
+ case 'SIZE':
+ $retValue = 'SIZE';
+ break;
case 'UID': // should be equivalent to INTERNALDATE, which is ARRIVAL, which should be highest (latest) uid should be newest date
case 'ARRIVAL':
case 'INTERNALDATE':
$retValue = 'ARRIVAL';
break;
+ case 'DATE':
default:
$retValue = 'DATE';
break;
@@ -2538,6 +2552,7 @@ class mail_bo
if(!empty($folderInfo) && isset($folderInfo[$this->profileID][$_folder]) &&
($folderInfo[$this->profileID][$_folder] instanceof PEAR_Error) || $folderInfo[$this->profileID][$_folder] !== true)
{
+ if ($folderInfo[$this->profileID][$_folder] instanceof PEAR_Error) error_log(__METHOD__.__LINE__.array2string($folderInfo[$this->profileID][$_folder]->message));
$folderInfo[$this->profileID][$_folder] = false; // set to false, whatever it was (to have a valid returnvalue for the static return)
}
egw_cache::setCache(egw_cache::INSTANCE,'email','icServerFolderExistsInfo'.trim($GLOBALS['egw_info']['user']['account_id']),$folderInfo,$expiration=60*5);
diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php
index 65449a24fc..66fc98f750 100644
--- a/mail/inc/class.mail_compose.inc.php
+++ b/mail/inc/class.mail_compose.inc.php
@@ -276,7 +276,7 @@ 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'];
// read the data from session
// all values are empty for a new compose window
@@ -966,6 +966,7 @@ class mail_compose
$content['SENDER'] = (empty($content['SENDER'])?($selectedSender?(array)$selectedSender:''):$content['SENDER']);
$content['is_html'] = ($this->sessionData['mimeType'] == 'html'?true:'');
$content['is_plain'] = ($this->sessionData['mimeType'] == 'html'?'':true);
+$content['mail_'.($this->sessionData['mimeType'] == 'html'?'html':'plain').'text'] =$CAtFStart.$content['mail_'.($this->sessionData['mimeType'] == 'html'?'html':'plain').'text'];
}
else
{
diff --git a/mail/inc/class.mail_hooks.inc.php b/mail/inc/class.mail_hooks.inc.php
index 8e0c7c3783..c3093602b6 100644
--- a/mail/inc/class.mail_hooks.inc.php
+++ b/mail/inc/class.mail_hooks.inc.php
@@ -836,7 +836,7 @@ class mail_hooks
);
$file += array(
- 'import message' => "javascript:egw_openWindowCentered2('".egw::link('/index.php', $linkData,false)."','import',700,125,'no','$appname');",
+ 'import message' => "javascript:egw_openWindowCentered2('".egw::link('/index.php', $linkData,false)."','importMessageDialog',700,125,'no','$appname');",
);
}
diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php
index 2ebc9a3e6e..30abe585c2 100644
--- a/mail/inc/class.mail_ui.inc.php
+++ b/mail/inc/class.mail_ui.inc.php
@@ -1033,7 +1033,7 @@ class mail_ui
{
unset($query['actions']);
//_debug_array($query);
-//error_log(__METHOD__.__LINE__.array2string($query));
+//error_log(__METHOD__.__LINE__.array2string($query['order']).'->'.array2string($query['sort']));
//error_log(__METHOD__.__LINE__.' SelectedFolder:'.$query['selectedFolder'].' Start:'.$query['start'].' NumRows:'.$query['num_rows']);
$starttime = microtime(true);
//error_log(__METHOD__.__LINE__.array2string($query['search']));
@@ -1078,7 +1078,7 @@ unset($query['actions']);
{
$filter['status'] = $query['filter'];
}
- $reverse = ($query['order']=='ASC'?false:true);
+ $reverse = ($query['sort']=='ASC'?false:true);
//error_log(__METHOD__.__LINE__.' maxMessages:'.$maxMessages.' Offset:'.$offset.' Filter:'.array2string($this->sessionData['messageFilter']));
if ($maxMessages > 75)
{
@@ -2701,12 +2701,34 @@ blockquote[type=cite] {
return 'background="'.$imageURL.'"';
}
+ function setImportMessageFromVFS($target, $path=null)
+ {
+ return "opener.app.mail.import_closeVfsSelector('$path');";
+ }
+
+ function importMessageFromVFS($target, $path=null)
+ {
+ //error_log(__METHOD__.__LINE__.array2string(array('target'=>$target,'file'=>$path)));
+ $content['divImportArea']['FOLDER'][0]=$target;
+ $content['divImportArea']['uploadForImport'] = array(
+ 'name' => egw_vfs::basename($path),
+ 'type' => egw_vfs::mime_content_type($path),
+ 'file' => egw_vfs::PREFIX.$path,
+ 'size' => filesize(egw_vfs::PREFIX.$path),
+ );
+ //$this->importMessage($content);
+ return "window.close();";
+
+ }
+
/**
* importMessage
*/
function importMessage($content=null)
{
//error_log(__METHOD__.__LINE__.$this->mail_bo->getDraftFolder());
+error_log(__METHOD__.__LINE__.array2string($_GET));
+error_log(__METHOD__.__LINE__.array2string($content));
if (!empty($content))
{
//error_log(__METHOD__.__LINE__.array2string($content));
diff --git a/mail/js/app.js b/mail/js/app.js
index 9c54db8724..7c0d06208f 100644
--- a/mail/js/app.js
+++ b/mail/js/app.js
@@ -28,6 +28,7 @@ app.mail = AppJS.extend(
mail_previewAreaActive: true, // we start with the area active
nm_index: 'nm', // nm nome of index
+ mail_fileSelectorWindow: null,
/**
* Initialize javascript for this application
@@ -1172,6 +1173,36 @@ app.mail = AppJS.extend(
}
},
+ import_displayVfsSelector: function(_ref) {
+ var ref = this.et2.getWidgetById(_ref);
+ //console.log(ref);
+ 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');
+ },
+
+ import_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_import_vfsSelector');
+ importMessageDialog = window.open('','importMessageDialog');
+ this.mail_fileSelectorWindow.close();
+ var vfsfile = importMessageDialog.app.mail.et2.getWidgetById('vfsfile');
+ //console.log(vfsfile);
+ vfsfile.input[0].value=_ref;
+ var folder = importMessageDialog.app.mail.et2.getWidgetById('FOLDER');
+ //console.log(vfsfile.input[0].value,folder.value[0]);
+ importMessageDialog.close();
+ egw().open_link(egw.link('/index.php', {
+ menuaction: 'mail.mail_ui.importMessage',
+ content: {fi: vfsfile.input[0].value, fo: folder.value[0]},//represents the target where to import to
+ }), 'mail_display', '640x580');
+ //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/importMessage.xet b/mail/templates/default/importMessage.xet
index 163da9e926..d253aab041 100644
--- a/mail/templates/default/importMessage.xet
+++ b/mail/templates/default/importMessage.xet
@@ -8,7 +8,15 @@
-
+
+
+
+
+
+
+
+
+
>