fix sorting for mail app; try to get importMessage from VFS working -> ui form must get data from vfs openFile dialog and submitted when not in form context. still not working; ...

This commit is contained in:
Klaus Leithoff 2013-09-23 08:33:30 +00:00
parent 1c42747547
commit 3bdc5577d8
6 changed files with 83 additions and 6 deletions

View File

@ -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);

View File

@ -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
{

View File

@ -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');",
);
}

View File

@ -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));

View File

@ -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
*

View File

@ -8,7 +8,15 @@
<description value="Store to Folder"/>
<taglist id="FOLDER" width="50%" autocomplete_url='mail.mail_compose.ajax_searchFolder' autocomplete_params='' maxSelection="1" allowFreeEntries="false" onclick="app.mail.address_click"/>
</hbox>
<file statustext="Select file to import into Folder" onFinish="app.mail.uploadForImport" mime="/^message\//i" id="uploadForImport" drop_target ="mail-importMessage_divImportArea"/>
<hbox span="all">
<description value="Local Filestore"/>
<file statustext="Select file to import into Folder" onFinish="app.mail.uploadForImport" mime="/^message\//i" id="uploadForImport" drop_target ="mail-importMessage_divImportArea"/>
<description value="or"/>
</hbox>
<hbox span="all">
<description value="Select from EGroupware Filestore"/> <textbox align="left" width="30%" id="vfsfile" />
<buttononly id="selectFromVFSForImport" value="Select" image="filemanager/navbar" onclick="app.mail.import_displayVfsSelector('FOLDER')" />
</hbox>
</vbox>>
</template>
</overlay>