Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
 
Go Back   Zimbra - Forums > Zimbra Collaboration Suite > Zimlets

Welcome to the Zimbra - Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-21-2009, 04:30 PM
Intermediate Member
 
Posts: 17
Default [SOLVED] adding a button to the compose toolbar in ZCS 6

I'm working on updating our Zimlets for compatibility with ZCS 6 and have hit a bit of a snag. We have a ZImlet that adds a button next to the "Add Attachment" button in the compose toolbar. It's working fine in ZCS 5.0.x. However, on ZCS 6 the button does not show up, and I haven't yet been able to figure out how to get it to show up. Does anyone have any info or links to info about how to make this work with v6? Here's what we're doing for v5:

var composeCtrlr = appCtxt.getApp(ZmApp.MAIL).getComposeController();
composeCtrlr.initComposeView(true); // call lazy init method for compose view
var toolbar = composeCtrlr._toolbar;
this._composeView = composeCtrlr._composeView;

// add the button to the compose toolbar
ZmMsg.myButton = "My Button";
ZmMsg.myButtonTooltip = "Button description";
ZmOperation.registerOp("MY_BUTTON", {textKey:"myButton", tooltipKey:"myButtonTooltip", image:"Attachment"});
ZmOperation.defineOperation("MY_BUTTON", {});
toolbar.addOp("MY_BUTTON", 5);
toolbar.addSelectionListener("MY_BUTTON", new AjxListener(this, this._myButtonListener));

I've been trying to dig into the code to figure out what's going on but have been unable to reliably use Firebug to debug through the code in dev=1 mode. I did see that the mail app can have multiple sessions with their own compose controllers now. I'm guessing I need to figure out and use the right session id to get the right compose controller to modify or something?

Any help would be greatly appreciated, thanks.
Reply With Quote
  #2 (permalink)  
Old 10-21-2009, 05:04 PM
Intermediate Member
 
Posts: 17
Default

OK, I got the button to show up! This is kind of cool. There is some kind of initialization event notification for Zimlets now, as seen in this line of ZmComposeController.js:

appCtxt.notifyZimlets("initializeToolbar", [this._app, tb, this, this.viewId], {waitUntilLoaded:true});

All I had to do was move my code into a method of my Zimlet named "initializeToolbar" and it got called at the right time and was passed references to the right app, controller, toolbar, and view id.

My_Zimlet.prototype.initializeToolbar =
function(app, toolbar, composeController, viewId) {
// check view id, apparently this event is fired for all toolbars, not just compose toolbar
if (viewId.indexOf(ZmId.VIEW_COMPOSE) == 0) {
// code for modifying the compose toolbar here
}
}

Last edited by sdouglass : 10-21-2009 at 06:31 PM.
Reply With Quote
Reply


Thread Tools
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

Zimbrablog.com




 

Search Engine Optimization by vBSEO 3.1.0