Results 1 to 4 of 4

Thread: Adding buttons, the Zm, and IE

Hybrid View

  1. #1
    Join Date
    Jul 2006
    Posts
    13
    Rep Power
    9

    Default Adding buttons, the Zm, and IE

    I am working on a zimlet that adds some buttons on the fly, basically stealing from the salesforce zimlet (thanks Marc). The following works fine in FF, but not IE. Furthermore, it only seems to fail when the page is refreshed.

    Code:
      //NOTE:  Op SETUP defined earlier
      this._quickOpDesc = ZmOperation.defineOperation(null, ZmOperation.SETUP[ZmOperation.NEW_VIDEOMAIL]);
      
      // Get the mail toolbar
      this._mailCtrl = appCtxt.getApp(ZmZimbraMail.MAIL_APP).getMailListController();
      debugger;
      if(!this._mailCtrl._toolbar) {
        // initialize the mail list controller's toolbar
        this._mailCtrl._initializeToolBar();
      }
      // Best I could figure out in the debugger
      this._mailToolbar = this._mailCtrl._toolbar[appCtxt.getCurrentViewId() || 0];
      
      // Insert buttons into the mail toolbar
      ZmOperation.addOperation(this._mailToolbar, this._quickOpDesc.id, this._mailToolbar._buttons, 2);
    In IE, this._mailToolbar ends up undefined. I think it has something to do with the way this._mailCtrl._toolbar is declared as an empty object (in ZmListController:
    Code:
    	this._toolbar = {};		// ZmButtonToolbar (one per view)
    ...yet later treated as an array...
    Code:
    this._toolbar[view] = new ZmButtonToolBar(...)
    IE doesn't seems to not want to reference the contents by an index. Of course, since it is impossible to see what is going on in IE, who knows.

    Any ideas on this?

  2. #2
    Join Date
    Oct 2005
    Location
    Thatcher, AZ
    Posts
    5,606
    Rep Power
    21

    Default

    Hi!
    I've forwarded this thread on to one of our developers, and you should get a reply soon.

    Thanks!
    jh

  3. #3
    Join Date
    Jul 2006
    Posts
    13
    Rep Power
    9

    Exclamation Slightly different issue, same zimlet

    Well, the business logic has changed on this, so that I am creating the buttons later. Somehow the timing made the issue go away.

    But, I still need some help getting toolbar buttons added by a zimlet. We are approaching a release, so I really need to get this resolved. The current issue is that I can't get buttons added to the By Message View to do anything, it's like the listeners I define get wiped out before I can click.

    Here is some code

    Code:
    // Create our operations. 
    this._quickOpDesc = ZmOperation.defineOperation(null, ZmOperation.SETUP[ZmOperation.NEW_VIDEOMAIL]); // Op set up earlier, all good
    // Get the mail toolbar
    this._mailCtrl = appCtxt.getApp(ZmZimbraMail.MAIL_APP).getTradController();
    
    try {
      this._mailCtrl._initializeToolBar(this._mailCtrl._defaultView());
    } catch (ex) {
      Com_Rs_Video.log.warn("Problem initializing Message toolbar, ignoring " + ex);
    }
    if (!this._mailCtrl._toolbar instanceof ZmButtonToolBar) {
      this._mailToolbar = this._mailCtrl._toolbar;
    } else {
      this._mailToolbar = this._mailCtrl._toolbar[this._mailCtrl._defaultView()];
    }
    //// Add an operation button and keep in toolbar _buttons[]
    ZmOperation.addOperation(this._mailToolbar, this._quickOpDesc.id, this._mailToolbar._buttons, 2);
    // Add listener
    this._mailToolbar.addSelectionListener(this._quickOpDesc.id, new AjxListener(this, Com_Rs_Video._newVideoMsgListener));
    Note that this code is executed after the page has been rendered. Also note that I am able to add buttons that work to the ZmConvListController using nearly identical code.

    After lots of time in Firebug, I narrowed it down to DwtButton.prototype._mouseUpListener, specifically the evaluation of
    Code:
    if(this.isListenerRegistered(DwtEvent.SELECTION))
    This is the difference between buttons that work and those that don't. This test evaluates to false with my new button. When I do:
    this._mailToolbar._buttons[this._quickOpDesc.id].isListenerRegistered(DwtEvent.SELECTION) from in the debugger console, right after the code above, it evaluates to true.
    So I have to conclude that something is changing the state when switching to the By Message view. I don't know if this is a bug, or if there is something else I need to do. Help would be much appreciated.

    - John Troxel

  4. #4
    Join Date
    Jul 2006
    Posts
    13
    Rep Power
    9

    Default I found it

    ...and it was NOT a Zmbra bug.

    Turned out to be a copy-and-paste error:
    Code:
      ZmOperation.addOperation(this._convToolbar, this._quickOpDesc.id, this._mailToolbar._buttons, 2);
    I was sending the wrong toolbar butons for the opHash parameter.

    - JT

Posting Permissions

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