different approach on calling bulk-download (all attachments in one archive)

This commit is contained in:
Klaus Leithoff 2014-07-08 12:01:29 +00:00
parent 55722f4520
commit 096f753a59
4 changed files with 33 additions and 4 deletions

View File

@ -29,6 +29,7 @@ class mail_ui
'displayMessage' => True,
'displayImage' => True,
'getAttachment' => True,
'download_zip' => True,
'saveMessage' => True,
'vfsSaveAttachment' => True,
'vfsSaveMessage' => True,
@ -424,6 +425,7 @@ class mail_ui
}
//error_log(__METHOD__.__LINE__.' SessionFolder:'.$sessionFolder.' isToSchema:'.$toSchema);
//_debug_array($content);
//if (is_array($content)) error_log(__METHOD__.__LINE__.array2string($content));
if (!is_array($content))
{
$content = array(
@ -2830,10 +2832,11 @@ class mail_ui
* Zip all attachments and send to user
* @param string $message_id
*/
function download_zip($message_id)
function download_zip($message_id=null)
{
//error_log(__METHOD__.__LINE__.$message_id);
// First, get all attachment IDs
if(isset($_GET['id'])) $message_id = $_GET['id'];
//error_log(__METHOD__.__LINE__.$message_id);
if(!is_numeric($message_id))
{
$hA = self::splitRowID($message_id);

View File

@ -2225,6 +2225,32 @@ app.classes.mail = AppJS.extend(
document.location = url;
},
saveAllAttachmentsToZip: function(tag_info, widget)
{
var mailid;
var attgrid;
if (this.mail_isMainWindow)
{
mailid = this.mail_currentlyFocussed;//this.et2.getArrayMgr("content").getEntry('mail_id');
var p = widget.getParent();
var cont = p.getArrayMgr("content").data;
attgrid = cont[widget.id.replace(/\[save\]/,'')];
}
else
{
mailid = this.et2.getArrayMgr("content").getEntry('mail_id');
attgrid = this.et2.getArrayMgr("content").getEntry('mail_displayattachments')[widget.id.replace(/\[save\]/,'')];
}
var url = window.egw_webserverUrl+'/index.php?';
var width;
var height;
var windowName ='mail';
url += 'menuaction=mail.mail_ui.download_zip'; // todo compose for Draft folder
url += '&mode=save';
url += '&id='+mailid;
document.location = url;
},
saveAttachmentToVFS: function(tag_info, widget)
{
var mailid;

View File

@ -78,7 +78,7 @@
<buttononly id="${row}[save]" value="save" image="fileexport" onclick="app.mail.saveAttachment"/>
<buttononly id="${row}[saveAsVFS]" value="save" image="filemanager/navbar" onclick="app.mail.saveAttachmentToVFS"/>
<buttononly class="$row_cont[classSaveAllPossiblyDisabled]" id="${row}[save_all]" value="save_all" image="mail/save_all" onclick="app.mail.saveAllAttachmentsToVFS"/>
<buttononly class="$row_cont[classSaveAllPossiblyDisabled]" id="${row}[save_zip]" value="save_zip" image="mail/save_all" onclick="widget.getInstanceManager().postSubmit();" label="Save as Zip"/>
<buttononly class="$row_cont[classSaveAllPossiblyDisabled]" id="${row}[save_zip]" value="save_zip" image="mail/save_all" onclick="app.mail.saveAllAttachmentsToZip" label="Save as Zip"/>
</row>
</rows>
</grid>

View File

@ -102,7 +102,7 @@
<buttononly id="${row}[save]" value="save" image="fileexport" onclick="app.mail.saveAttachment"/>
<buttononly id="${row}[saveAsVFS]" value="save" image="filemanager/navbar" onclick="app.mail.saveAttachmentToVFS"/>
<buttononly class="$row_cont[classSaveAllPossiblyDisabled]" id="${row}[save_all]" value="save_all" image="mail/save_all" onclick="app.mail.saveAllAttachmentsToVFS"/>
<buttononly class="$row_cont[classSaveAllPossiblyDisabled]" id="${row}[save_zip]" value="save_zip" image="mail/save_all" onclick="widget.getInstanceManager().postSubmit();" label="Save as Zip"/>
<buttononly class="$row_cont[classSaveAllPossiblyDisabled]" id="${row}[save_zip]" value="save_zip" image="mail/save_all" onclick="app.mail.saveAllAttachmentsToZip" label="Save as Zip"/>
</row>
</rows>
</grid>