ZCS 6.0:Zimlet Developers Guide:Examples:Panel Item Drag Source Details

ZCS 6.0: Zimlet Developer Guide:Examples:Panel Item Drag Source Details

   KB 3404        Last updated on 07/13/2015  

(0 votes)
 - This article is a Community contribution and may include unsupported customizations.
 - This article is a Work in Progress, and may be unfinished or missing sections.
Zdg-6-menu-icon-zimbra.jpg Introduction Zdg-6-menu-icon-green-flag.png Getting Started Zdg-6-menu-icon-terminal.png Dev Environment Setup Zdg-6-menu-icon-gear.png Developing Zimlets Zdg-6-menu-icon-advanced.jpg Advanced Concepts Zdg-6-menu-icon-library.jpg API Specifications Zdg-6-menu-icon-checkbox.jpg Example Zimlets


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">
  <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" />

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}


Zimlet Package com_zimbra_example_paneldragsourcedetails.zip

Useful Links

Verified Against: Zimbra Collaboration Server 7.0 Date Created: 02/01/2010
Article ID: https://wiki.zimbra.com/index.php?title=ZCS_6.0:Zimlet_Developers_Guide:Examples:Panel_Item_Drag_Source_Details Date Modified: 07/13/2015

Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »

Jump to: navigation, search