Quote:
Originally Posted by rrao It works for me since I wrote it  . you just need to get the code that adds button on toolbars Code: com_zimbra_discover.prototype.initToolbarButton = function() {
if (!appCtxt.get(ZmSetting.MAIL_ENABLED))
this._toolbar = true;
if (this._toolbar)
return;
// Add the discover Button to the conversation page
var viewid = appCtxt.getAppViewMgr().getCurrentViewId();
if(viewid == ZmId.VIEW_CONVLIST) {
this._cnvController = AjxDispatcher.run("GetConvListController");
this._cnvController._discover = this;
if (!this._cnvController._toolbar) {
// initialize the conv controller's toolbar
this._cnvController._initializeToolBar();
}
this._toolbar = this._cnvController._toolbar.CLV;
} else if(viewid == ZmId.VIEW_TRAD) {
this._tradController = AjxDispatcher.run("GetTradController");
this._tradController._discover = this;
if (!this._tradController._toolbar) {
// initialize the trad controller's toolbar
this._tradController._initializeToolBar();
}
this._toolbar = this._tradController._toolbar.TV;
}
if(!this._toolbar)
return;//dont add button
var indx = this._toolbar.getItemCount() + 1;
// Add button to toolbar
if (!this._toolbar.getButton(com_zimbra_discover.discover)) {
ZmMsg.discoverlabel = "discover!";
ZmMsg.discovertip = "Opens websites based on topics of your choice";
var btn = this._toolbar.createOp(
com_zimbra_discover.discover,
{
text : ZmMsg.discoverlabel,
tooltip : ZmMsg.discovertip,
index :indx,
image : "dy-panelIcon"
}
);
btn.addSelectionListener(new AjxListener(this, this.discBtnListener));
}
}; |
Is it possible to add the button to both the traditional and conversation toolbars at the same time? I'm trying to use this code and it seems that if the user starts in normal view the button gets added, but if the switch to conversation view there's no button. The reverse is also true.