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 Search this Thread Display Modes
  #1 (permalink)  
Old 02-02-2007, 04:48 PM
Member
 
Posts: 13
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?
Reply With Quote
  #2 (permalink)  
Old 02-02-2007, 06:48 PM
Former Zimbran
 
Posts: 5,606
Default

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

Thanks!
jh
Reply With Quote
  #3 (permalink)  
Old 03-01-2007, 04:20 PM
Member
 
Posts: 13
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
Reply With Quote
  #4 (permalink)  
Old 03-06-2007, 08:20 AM
Member
 
Posts: 13
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Why Join?

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

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.