Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Main Toolbar

  1. #1
    Join Date
    May 2008
    Posts
    17
    Rep Power
    7

    Default Main Toolbar

    Does anyone know how to get the main toolbar?
    There are examples of how to add a button to the Compose toolbar, but I have been having trouble finding a way to add a button to the main toolbar. That is, the toolbar with Mail, Address Book, Calendar, Tasks,...

    L. Jay

  2. #2
    Join Date
    Nov 2006
    Posts
    14
    Rep Power
    9

    Default

    ZmApp.registerApp adds buttons to that tab control. It also defines a lot of other data for an app. Definitely not a trivial thing to do.

  3. #3
    Join Date
    May 2008
    Posts
    17
    Rep Power
    7

    Smile Alternative Method

    We were able to do this a little easier by creating a ZmChicletButton and adding it to the appChooser. It was still tricky, but probably not as complicated as using ZmApp.registerApp.
    I'm not sure if this is a bad way to do it, but it seems to work great.

  4. #4
    Join Date
    Nov 2006
    Posts
    14
    Rep Power
    9

    Default

    No, that's not a bad way to do it at all.

  5. #5
    Join Date
    Sep 2008
    Posts
    98
    Rep Power
    7

    Default

    hi, anybody have running example

  6. #6
    Join Date
    Sep 2005
    Posts
    187
    Rep Power
    10

    Default

    Quote Originally Posted by gregor View Post
    hi, anybody have running example
    check out com_zimbra_discover zimlet (in gallery.zimbra.com) It shows you how to add toolbar buttons to conversation view and traditional views. There will be easier way to achieve that in 6.x
    Bugzilla - Wiki - Downloads - Before posting... Search!

  7. #7
    Join Date
    Sep 2008
    Posts
    98
    Rep Power
    7

    Default

    thanks for the hint but the zimlet does not work with my release, does it work on your zwc?
    source: Get or contribute Zimlets, UI themes, and languages in the Zimbra Gallery - discover!

  8. #8
    Join Date
    Sep 2005
    Posts
    187
    Rep Power
    10

    Default

    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));
    	}
    };
    Bugzilla - Wiki - Downloads - Before posting... Search!

  9. #9
    Join Date
    Apr 2008
    Location
    Vancouver, BC
    Posts
    54
    Rep Power
    7

    Default

    Quote Originally Posted by rrao View Post
    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.

  10. #10
    Join Date
    Sep 2005
    Posts
    187
    Rep Power
    10

    Default

    There is a way to make it work even when user changes the views.
    There is a zimlet hook called onShowView which is called by core-zimbra whenever there is a change in view. And you can do whatever you need when that is called.
    Here is an example usage:
    Code:
    com_zimbra_myzimlet.prototype.onShowView = function(viewId, isNewView) {
          if(viewid != ZmId.VIEW_CONVLIST || viewid != ZmId.VIEW_TRAD)
                 return;
    
          if...
          <add code to check if traditional and conversation view already has button, if so exit from funtion>
    
           //call inittoolbar to add button..
            this.initToolbarButton();
    };



    PS: I wouldn't generally add it in this context since users don't change views on a daily basis and also due to performance reasons since this method is called for all views. You might want to make-sure you do all proper checks before using this.
    Bugzilla - Wiki - Downloads - Before posting... Search!

Similar Threads

  1. A Zimbra Toolbar?
    By jholder in forum Users
    Replies: 29
    Last Post: 03-03-2011, 01:51 AM
  2. Zimbra Address Book Toolbar Button
    By jonnybravo in forum Zimlets
    Replies: 0
    Last Post: 05-28-2008, 10:31 AM
  3. How can i add buttons to the compose toolbar?
    By MyMoon in forum Developers
    Replies: 1
    Last Post: 10-05-2007, 09:08 AM
  4. [SOLVED] Remove main domain!
    By zibra in forum Administrators
    Replies: 11
    Last Post: 09-27-2007, 09:50 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
  •