initial 'emaildownloader' zimlet
This commit is contained in:
commit
1589c2c092
|
@ -0,0 +1,17 @@
|
||||||
|
#
|
||||||
|
# ***** BEGIN LICENSE BLOCK *****
|
||||||
|
# Zimbra Collaboration Suite Web Client
|
||||||
|
# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Zimbra, Inc.
|
||||||
|
#
|
||||||
|
# The contents of this file are subject to the Zimbra Public License
|
||||||
|
# Version 1.3 ("License"); you may not use this file except in
|
||||||
|
# compliance with the License. You may obtain a copy of the License at
|
||||||
|
# http://www.zimbra.com/license.
|
||||||
|
#
|
||||||
|
# Software distributed under the License is distributed on an "AS IS"
|
||||||
|
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
|
||||||
|
# ***** END LICENSE BLOCK *****
|
||||||
|
|
||||||
|
EmailDownloaderZimlet_panel_label = Downloader
|
||||||
|
EmailDownloader_panel_tooltip = Drag-n-Drop to download one or more Emails(.eml), Contacts(.vcf) or Appointments(.ics) to your computer
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
<zimlet name="com_zimbra_emaildownloader" version="1.0" label="Downloader" description="Drag-n-Drop to download one or more Emails(.eml), Contacts(.vcf) or Appointments(.ics) to your computer">
|
||||||
|
<include>emaildownloader.js</include>
|
||||||
|
<includeCSS>emaildownloader.css</includeCSS>
|
||||||
|
<resource>emaildownloader-icon.gif</resource>
|
||||||
|
<handlerObject>com_zimbra_emaildownloader_HandlerObject</handlerObject>
|
||||||
|
<zimletPanelItem label="${msg.EmailDownloaderZimlet_panel_label}" icon="emaildownloader-panelIcon">
|
||||||
|
<toolTipText>${msg.EmailDownloader_panel_tooltip}</toolTipText>
|
||||||
|
<dragSource type="ZmConv" />
|
||||||
|
<dragSource type="ZmMailMsg"/>
|
||||||
|
<dragSource type="ZmContact" />
|
||||||
|
<dragSource type="ZmAppt" />
|
||||||
|
|
||||||
|
</zimletPanelItem>
|
||||||
|
</zimlet>
|
||||||
|
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 104 B |
|
@ -0,0 +1,6 @@
|
||||||
|
.Imgemaildownloader-panelIcon {
|
||||||
|
background: url("emaildownloader-icon.gif") no-repeat 0 0;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
|
@ -0,0 +1,99 @@
|
||||||
|
/*
|
||||||
|
* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Zimbra Collaboration Suite Zimlets
|
||||||
|
* Copyright (C) 2009, 2010 Zimbra, Inc.
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Zimbra Public License
|
||||||
|
* Version 1.3 ("License"); you may not use this file except in
|
||||||
|
* compliance with the License. You may obtain a copy of the License at
|
||||||
|
* http://www.zimbra.com/license.
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS"
|
||||||
|
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
|
||||||
|
* ***** END LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows downloading a single email message.
|
||||||
|
*
|
||||||
|
* @author Raja Rao DV
|
||||||
|
*/
|
||||||
|
function com_zimbra_emaildownloader_HandlerObject() {
|
||||||
|
}
|
||||||
|
|
||||||
|
com_zimbra_emaildownloader_HandlerObject.prototype = new ZmZimletBase();
|
||||||
|
com_zimbra_emaildownloader_HandlerObject.prototype.constructor = com_zimbra_emaildownloader_HandlerObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simplify handler object
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
var EmailDownloaderZimlet = com_zimbra_emaildownloader_HandlerObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by the framework on an droppedItem drop.
|
||||||
|
*
|
||||||
|
* @param {ZmConv|ZmMailMsg} droppedItem the dropped message object
|
||||||
|
*/
|
||||||
|
EmailDownloaderZimlet.prototype.doDrop =
|
||||||
|
function(droppedItem) {
|
||||||
|
var ids = [];
|
||||||
|
var msgObjs = [];
|
||||||
|
var fmt = "zip";
|
||||||
|
if(droppedItem instanceof Array) {
|
||||||
|
for(var i =0; i < droppedItem.length; i++) {
|
||||||
|
var obj = droppedItem[i].srcObj ? droppedItem[i].srcObj : droppedItem[i];
|
||||||
|
if(obj.type == "CONV") {
|
||||||
|
ids = ids.concat(this._getMsgIdsFromConv(obj));
|
||||||
|
} else if(obj.type == "MSG") {
|
||||||
|
ids.push(obj.id);
|
||||||
|
} else if(obj.TYPE == "ZmContact") {
|
||||||
|
ids.push(obj.id);
|
||||||
|
} else if(obj.TYPE == "ZmAppt" || obj.type == "APPT") {
|
||||||
|
ids.push(obj.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var obj = droppedItem.srcObj ? droppedItem.srcObj : droppedItem;
|
||||||
|
if (obj.type == "CONV"){
|
||||||
|
ids = this._getMsgIdsFromConv(obj);
|
||||||
|
} else if(obj.type == "MSG") {
|
||||||
|
ids.push(obj.id);
|
||||||
|
} else if(obj.TYPE == "ZmContact") {
|
||||||
|
ids.push(obj.id);
|
||||||
|
fmt = "vcf";
|
||||||
|
} else if(obj.TYPE == "ZmAppt" || obj.type == "APPT") {
|
||||||
|
ids.push(obj.id);
|
||||||
|
fmt = "ics";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var url = [];
|
||||||
|
var i = 0;
|
||||||
|
var proto = location.protocol;
|
||||||
|
var port = Number(location.port);
|
||||||
|
url[i++] = proto;
|
||||||
|
url[i++] = "//";
|
||||||
|
url[i++] = location.hostname;
|
||||||
|
if (port && ((proto == ZmSetting.PROTO_HTTP && port != ZmSetting.HTTP_DEFAULT_PORT)
|
||||||
|
|| (proto == ZmSetting.PROTO_HTTPS && port != ZmSetting.HTTPS_DEFAULT_PORT))) {
|
||||||
|
url[i++] = ":";
|
||||||
|
url[i++] = port;
|
||||||
|
}
|
||||||
|
url[i++] = "/home/";
|
||||||
|
url[i++]= AjxStringUtil.urlComponentEncode(appCtxt.getActiveAccount().name);
|
||||||
|
url[i++] = "/?fmt=";
|
||||||
|
url[i++] = fmt;
|
||||||
|
url[i++] = "&list=";
|
||||||
|
url[i++] = ids.join(",");
|
||||||
|
url[i++] = "&filename=ZimbraItems";
|
||||||
|
|
||||||
|
var getUrl = url.join("");
|
||||||
|
window.open(getUrl, "_blank");
|
||||||
|
};
|
||||||
|
|
||||||
|
EmailDownloaderZimlet.prototype._getMsgIdsFromConv =
|
||||||
|
function(convSrcObj) {
|
||||||
|
convSrcObj.load();
|
||||||
|
return convSrcObj.msgIds;
|
||||||
|
};
|
Reference in New Issue