ZCS 6.0:Zimlet Developers Guide:Examples:Panel Item Drag Source Details
ZCS 6.0: Zimlet Developer Guide:Examples:Panel Item Drag Source Details
Introduction | Getting Started | Dev Environment Setup | Developing Zimlets | Advanced Concepts | API Specifications | Example Zimlets |
Description
This zimlet will display in the Zimlet panel. It registered to accept drag-n-drop items of types: appointment, contact, conversation, mail messages, tasks and briefcase items. When items of those types are dropped on the panel item, the Zimlet Handler Object com_zimbra_example_paneldragsourcedetails_HandlerObject.prototype.doDrop(obj)
is called and the handler can process the dropped obj
. This zimlet shows how to do basic processing and retrieval of common properties of each of the drop item objects.
Definition File
<zimlet name="com_zimbra_example_paneldragsourcedetails" version="1.0" description="Demos panel zimlet that accepts drag source objects"> <include>com_zimbra_example_paneldragsourcedetails.js</include> <handlerObject>com_zimbra_example_paneldragsourcedetails_HandlerObject</handlerObject> <zimletPanelItem label="Drag Source Details"> <toolTipText>Drag-and-drop an object</toolTipText> <dragSource type="ZmAppt" /> <dragSource type="ZmContact" /> <dragSource type="ZmConv" /> <dragSource type="ZmMailMsg" /> <dragSource type="ZmTask" /> <dragSource type="ZmBriefcaseItem" /> </zimletPanelItem> </zimlet>
Handler Object
Here is a code snippet for retrieving basic properties of a mail message:
var msg = obj.srcObj; // {ZmMailMsg} var unread = msg.isUnread; // {Boolean} var hasattach = msg.hasAttach; // {Boolean} var subject= msg.subject; // {String} var tags = msg.tags; // {Array} var messageid = msg.messageId; // {String} var fromAddresses = msg.getAddresses(AjxEmailAddress.FROM); if (fromAddresses) { var fromArray = fromAddresses.getArray(); for (var i=0; i< fromArray.length; i++) { var addr = fromArray[i]; var address = addr.getAddress(); // {String} var name = addr.getName(); // {String} var typestr = addr.getTypeAsString(); // {String} var displayName = addr.getDispName(); // {String} } } var toAddresses = msg.getAddresses(AjxEmailAddress.TO); var ccAddresses = msg.getAddresses(AjxEmailAddress.CC);
This code shows getting a few properties from the contact object:
var contact = obj; // {ZmContact} var fn = contact.firstName; // {String} var ln = contact.lastName; // {String} var email = contact.email; // {String} var homePhone = contact.homePhone; // {String} var otherPhone = contact.otherPhone; // {String} var workPhone = contact.workPhone; // {String} var email = contact.email; // {String} var email2 = contact.email2; // {String} var email3 = contact.email3; // {String}
Download
Zimlet Package | com_zimbra_example_paneldragsourcedetails.zip |
Useful Links