Add save all attachments as zip to mail display popup

This commit is contained in:
Nathan Gray 2014-07-03 17:17:54 +00:00
parent 0de1db26bd
commit 99e28b96b3
3 changed files with 18 additions and 2 deletions

View File

@ -2098,6 +2098,10 @@ class mail_ui
$rowID = $_requesteddata['id'];
//unset($_REQUEST);
}
if($_requesteddata['mail_displayattachments'][0]['save_zip'])
{
$this->download_zip($_requesteddata['mail_id']);
}
$preventRedirect=false;
if(isset($_GET['id'])) $rowID = $_GET['id'];
if(isset($_GET['part'])) $partID = $_GET['part'];
@ -2829,6 +2833,17 @@ class mail_ui
function download_zip($message_id)
{
// First, get all attachment IDs
if(!is_numeric($message_id))
{
$hA = self::splitRowID($message_id);
$message_id = $hA['msgUID'];
$mailbox = $hA['folder'];
}
else
{
$mailbox = $this->mail_bo->sessionData['mailbox'];
}
$attachments = $this->mail_bo->getMessageAttachments($message_id);
// put them in VFS so they can be zipped
@ -2845,9 +2860,9 @@ class mail_ui
}
$file_list = array();
$this->mail_bo->reopen($mailbox);
foreach($attachments as $file)
{
$this->mail_bo->reopen($this->mail_bo->sessionData['mailbox']);
$attachment = $this->mail_bo->getAttachment($message_id,$file['partID'],$file['is_winmail'],false);
if (!($fp = egw_vfs::fopen($path.$file['filename'],'wb')) ||

View File

@ -78,6 +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"/>
</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="widget.getInstanceManager().postSubmit();" label="Save as Zip"/>
</row>
</rows>
</grid>