View Single Post
  #2 (permalink)  
Old 05-03-2006, 12:13 PM
JoshuaPrismon JoshuaPrismon is offline
Zimlet Guru & Moderator
 
Posts: 431
Default Trick - Get your treeitem for a zimlet in Ruby on Rails

One of the features I really want is to have a user be able to drag their calender event, or email directly to a Treeitem, and have that be the only thing needed to add time to their project.

Unfortunitly this isn't documented inside of the zimlet specification. It is how the treeitem is grabbed internally in the ZimletBase class, but it probably still is verboten. Use at your own risk.

This code is also important because it shows you how to get the context. That allows you to get very useful things like the user's username and primary email address.


Code:
Org_Technicaldetails_Projects.prototype._getRootNode = function()
{
 
       /// Note that the following code may suddenly combust into flames, 
       /// sparking a reaction that will end all life on earth. Not documented
       /// in the zimlet spec, so use at your own risk. 
 
        var appCtxt = this.getAppCtxt();
        var ctrl = appCtxt.getOverviewController();

        var treeView = ctrl.getTreeView(ZmZimbraMail._OVERVIEW_ID, ZmOrganizer.ZIMLET);
        _treeRootNode = treeView.getTreeItemById(this.xmlObj().getOrganizer().id);
        _treeRootNode.setText("This is my icon for my zimlet); 
};
Reply With Quote