Results 1 to 2 of 2

Thread: [SOLVED] adding a button to the compose toolbar in ZCS 6

  1. #1
    Join Date
    Oct 2005
    Location
    Emeryville, CA US
    Posts
    22
    Rep Power
    10

    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.

  2. #2
    Join Date
    Oct 2005
    Location
    Emeryville, CA US
    Posts
    22
    Rep Power
    10

    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.

Similar Threads

  1. migrate20070809-Signatures.pl?
    By j.mc in forum Installation
    Replies: 4
    Last Post: 06-11-2008, 10:52 AM
  2. Replies: 13
    Last Post: 07-20-2007, 04:21 AM
  3. Is it started or not
    By kwelipatton in forum Installation
    Replies: 10
    Last Post: 03-28-2006, 11:11 PM
  4. Replies: 13
    Last Post: 10-31-2005, 04:22 PM
  5. Certify Error on (re)install
    By rodrigoccurvo in forum Installation
    Replies: 4
    Last Post: 09-23-2005, 10:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •