fix a problem regarding the deletion from messages from display-popup; handle glitch of name used for downloading attachments

This commit is contained in:
Klaus Leithoff 2014-02-12 10:56:44 +00:00
parent 3ec6ffe264
commit 934650c64a
3 changed files with 54 additions and 15 deletions

View File

@ -1875,13 +1875,15 @@ class mail_compose
//Import failed, download content anyway //Import failed, download content anyway
} }
} }
header ("Content-Type: ".$attachment['type']."; name=\"". $attachment['filename'] ."\""); //error_log(__METHOD__.__LINE__.'->'.array2string($attachment));
$filename = ($attachment['name']?$attachment['name']:($attachment['filename']?$attachment['filename']:$mailbox.'_uid'.$uid.'_part'.$part));
header ("Content-Type: ".$attachment['type']."; name=\"". $filename ."\"");
if($_GET['mode'] == "save") { if($_GET['mode'] == "save") {
// ask for download // ask for download
header ("Content-Disposition: attachment; filename=\"". $attachment['filename'] ."\""); header ("Content-Disposition: attachment; filename=\"". $filename ."\"");
} else { } else {
// display it // display it
header ("Content-Disposition: inline; filename=\"". $attachment['filename'] ."\""); header ("Content-Disposition: inline; filename=\"". $filename ."\"");
} }
header("Expires: 0"); header("Expires: 0");
// the next headers are for IE and SSL // the next headers are for IE and SSL

View File

@ -408,7 +408,8 @@ class mail_ui
// Tree does support this one // Tree does support this one
'add' => array( 'add' => array(
'caption' => 'Add Folder', 'caption' => 'Add Folder',
'onExecute' => 'javaScript:app.mail.mail_AddFolder' 'onExecute' => 'javaScript:app.mail.mail_AddFolder',
'enabled' => 'javaScript:app.mail.mail_CheckFolderNoSelect',
), ),
'edit' => array( 'edit' => array(
'caption' => 'Rename Folder', 'caption' => 'Rename Folder',
@ -2457,14 +2458,14 @@ unset($query['actions']);
} }
} }
//error_log(__METHOD__.__LINE__.'->'.array2string($attachment)); //error_log(__METHOD__.__LINE__.'->'.array2string($attachment));
$filename = ($attachment['filename']?$attachment['filename']:$mailbox.'_uid'.$uid.'_part'.$part); $filename = ($attachment['name']?$attachment['name']:($attachment['filename']?$attachment['filename']:$mailbox.'_uid'.$uid.'_part'.$part));
header ("Content-Type: ".$attachment['type']."; name=\"". $filename ."\""); header ("Content-Type: ".$attachment['type']."; name=\"". $filename ."\"");
if($_GET['mode'] == "save") { if($_GET['mode'] == "save") {
// ask for download // ask for download
header ("Content-Disposition: attachment; filename=\"". $filename ."\""); header ("Content-Disposition: attachment; filename=\"". $filename ."\"");
} else { } else {
// display it // display it
header ("Content-Disposition: inline; filename=\"". $attachment['filename'] ."\""); header ("Content-Disposition: inline; filename=\"". $filename ."\"");
} }
header("Expires: 0"); header("Expires: 0");
// the next headers are for IE and SSL // the next headers are for IE and SSL

View File

@ -9,6 +9,10 @@
* @version $Id$ * @version $Id$
*/ */
/*egw:uses
phpgwapi.jquery.jquery.base64;
*/
/** /**
* UI for mail * UI for mail
* *
@ -1072,6 +1076,21 @@ app.classes.mail = AppJS.extend(
*/ */
_unseen_regexp: / \([0-9]+\)$/, _unseen_regexp: / \([0-9]+\)$/,
/**
* mail_splitRowId
*/
mail_splitRowId: function(_rowID)
{
res = _rowID.split('::');
// as a rowID is perceeded by app::, should be mail!
if (res.length==4 && parseInt(res[0])!=NaN )
{
// we have an own created rowID; prepend app=mail
res.unshift('mail');
}
return res;
},
/** /**
* Delete mails - actually calls the backend function for deletion * Delete mails - actually calls the backend function for deletion
* takes in all arguments * takes in all arguments
@ -1080,21 +1099,31 @@ app.classes.mail = AppJS.extend(
*/ */
mail_deleteMessages: function(_msg,_action,_calledFromPopup) mail_deleteMessages: function(_msg,_action,_calledFromPopup)
{ {
var message, ftree, _foldernode, displayname;
ftree = this.et2.getWidgetById(this.nm_index+'[foldertree]'); ftree = this.et2.getWidgetById(this.nm_index+'[foldertree]');
var _foldernode = ftree.getSelectedNode(); if (ftree)
{
_foldernode = ftree.getSelectedNode();
var displayname = _foldernode.label.replace(this._unseen_regexp, ''); displayname = _foldernode.label.replace(this._unseen_regexp, '');
}
else
{
message = this.mail_splitRowId(_msg['msg'][0]);
if (message[3]) _foldernode = displayname = jQuery.base64Decode(message[3]);
}
// Tell server // Tell server
egw.json('mail.mail_ui.ajax_deleteMessages',[_msg,(typeof _action == 'undefined'?'no':_action)]) egw.json('mail.mail_ui.ajax_deleteMessages',[_msg,(typeof _action == 'undefined'?'no':_action)])
.sendRequest(true); .sendRequest(true);
// Update list // Update list
var ids = []; //var ids = [];
for (var i = 0; i < _msg['msg'].length; i++) //for (var i = 0; i < _msg['msg'].length; i++)
{ //{
ids.push(_msg['msg'][i].replace(/mail::/,'')); // ids.push(_msg['msg'][i].replace(/mail::/,''));
} //}
egw_refresh(this.egw.lang("deleted %1 messages in %2",_msg['msg'].length,displayname),'mail',ids,'delete'); //egw_refresh(this.egw.lang("deleted %1 messages in %2",_msg['msg'].length,(displayname?displayname:egw.lang('current folder'))),'mail',ids,'delete');
egw_message(this.egw.lang("deleted %1 messages in %2",_msg['msg'].length,(displayname?displayname:egw.lang('current Folder'))));
}, },
/** /**
@ -1104,7 +1133,14 @@ app.classes.mail = AppJS.extend(
*/ */
mail_deleteMessagesShowResult: function(_msg) mail_deleteMessagesShowResult: function(_msg)
{ {
egw_message(_msg['egw_message']); // Update list
var ids = [];
for (var i = 0; i < _msg['msg'].length; i++)
{
ids.push(_msg['msg'][i].replace(/mail::/,''));
}
//egw_message(_msg['egw_message']);
egw_refresh(_msg['egw_message'],'mail',ids,'delete');
}, },
/** /**