Difference between revisions of "Zimlet cookbook based on JavaScript API"
(New page: == Mail == == Calendar == == AddressBook == == Notebook == == Tasks == == Briefcase == == General(Common to all apps modules ) ==) |
(→Mail) |
||
Line 1: | Line 1: | ||
== Mail == | == Mail == | ||
+ | 1. How to get access to an email's to,cc,bcc,subject, body information when its drag-dropped onto Zimlet's panel Item? | ||
+ | First off we need to allow message(ZmMailMsg) or conversation(ZmConv) to be dragged onto Zimlet Panel Item. | ||
+ | <pre> | ||
+ | <zimletPanelItem label="Zimlet Name" icon="Zimlet-panelIcon"> | ||
+ | <dragSource type="ZmConv" /> | ||
+ | <dragSource type="ZmMailMsg" /> | ||
+ | </zimletPanelItem> | ||
+ | </pre> | ||
+ | |||
+ | Then, within the Zimlet's Javascript file, we need to override 'doDrop' function. | ||
+ | <pre> | ||
+ | com_zimbra_coloredemails.prototype.doDrop = | ||
+ | function(zmObject) { | ||
+ | |||
+ | }; | ||
+ | </pre> | ||
+ | |||
+ | The email dropped(zmObject) can be either a conversation or a single email. This zmObject internally has an object called 'srcObj' (aka source-object) and contains the real or actual Zimbra Object that was dropped. Once we get access to this, we can access all the properties and even functions. | ||
+ | <pre> | ||
+ | com_zimbra_coloredemails.prototype.doDrop = | ||
+ | function(zmObject) { | ||
+ | var msgObj = zmObject.srcObj;//get access to source-object | ||
+ | |||
+ | if (zmObject.type == "CONV") {//if its a conversation i.e. "ZmConv"... | ||
+ | msgObj = zmObject.getFirstHotMsg();//get the first loaded message "ZmMailMsg" object | ||
+ | } | ||
+ | |||
+ | //At this point we have a single message "ZmMailMsg" object and we can access all its properties. | ||
+ | |||
+ | msgObj. | ||
+ | }; | ||
+ | </pre> | ||
+ | |||
== Calendar == | == Calendar == | ||
== AddressBook == | == AddressBook == |
Revision as of 05:08, 31 March 2009
Contents
1. How to get access to an email's to,cc,bcc,subject, body information when its drag-dropped onto Zimlet's panel Item? First off we need to allow message(ZmMailMsg) or conversation(ZmConv) to be dragged onto Zimlet Panel Item.
<zimletPanelItem label="Zimlet Name" icon="Zimlet-panelIcon"> <dragSource type="ZmConv" /> <dragSource type="ZmMailMsg" /> </zimletPanelItem>
Then, within the Zimlet's Javascript file, we need to override 'doDrop' function.
com_zimbra_coloredemails.prototype.doDrop = function(zmObject) { };
The email dropped(zmObject) can be either a conversation or a single email. This zmObject internally has an object called 'srcObj' (aka source-object) and contains the real or actual Zimbra Object that was dropped. Once we get access to this, we can access all the properties and even functions.
com_zimbra_coloredemails.prototype.doDrop = function(zmObject) { var msgObj = zmObject.srcObj;//get access to source-object if (zmObject.type == "CONV") {//if its a conversation i.e. "ZmConv"... msgObj = zmObject.getFirstHotMsg();//get the first loaded message "ZmMailMsg" object } //At this point we have a single message "ZmMailMsg" object and we can access all its properties. msgObj. };