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

(New page: {| cellspacing="0" cellpadding="5" style="border: 1px solid rgb(153, 153, 170); margin: 0pt 0.5em 0.5em 0pt; float: none; background-color: rgb(249, 249, 255);" |[[Image:zdg-6-menu-icon-zi...)
(No difference)

Revision as of 21:30, 19 February 2010

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

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. Then 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 types


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


Verified Against: Zimbra Collaboration Suite 6.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: 2010-02-19



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