Results 1 to 5 of 5

Thread: zimlet with compose toolbar button

  1. #1
    ruddy32 is offline New Member
    Join Date
    Dec 2009
    Posts
    4
    Rep Power
    5

    Default zimlet with compose toolbar button

    Hi,
    I'm trying to add a new custom button in the email compose toolbar. The button seems to be add by the javascript module, but the button does not appear in the toolbar.
    I have the same behavior using the sms simlet that I use as source code example.
    Is it a zimbra bug? A problem with my zimbra server configuration?
    Thanks.

  2. #2
    rrao is offline Zimbra Employee
    Join Date
    Sep 2005
    Posts
    187
    Rep Power
    9

    Default

    SMS Zimlet needs to be upgraded to work for 6.x. In 6.x we support multiple compose (and compose in tabs). Also in 6.x we have a newer api initializeToolbar that helps to easily add toolbar buttons.

    The code below adds button to compose
    Code:
    com_zimbra_hellotoolbarbtns.prototype.initializeToolbar =
    function(app, toolbar, controller, view) {
    
    	//for compose view since 6.x supports multiple compose tabs(and has dynamic ids)	that look like “123_COMPOSE_DWT123”
    	if(viewId.indexOf("COMPOSE")  >=0){
    		//get the index of View menu so we can display it after that.
    		var buttonIndex = -1;
    		for (var i = 0, count = toolbar.opList.length; i < count; i++) {
    			if (toolbar.opList[i] == ZmOperation.VIEW_MENU) {
    				buttonIndex = i + 1;
    				break;
    			}
    		}
    		//create params obj with button details
    		var buttonArgs = {
    			text    : "Toolbar Button",
    			tooltip: "This button shows up in Conversation view, traditional view, and in convlist view",
    			index: buttonIndex, //position of the button
    			image: "zimbraicon" //icon
    		};
    
    		//toolbar.createOp api creates the button with some id and  params containing button details.
    		var button = toolbar.createOp("HELLOTEST_ZIMLET_TOOLBAR_BUTTON", buttonArgs);
    		button.addSelectionListener(new AjxListener(this, this._showSelectedMail, controller));
    	}
    };
    
    com_zimbra_hellotoolbarbtns.prototype._showSelectedMail =
    function(controller) {
    	var message = controller.getMsg();
    	appCtxt.getAppController().setStatusMsg("Subject:"+ message.subject);
    };
    Bugzilla - Wiki - Downloads - Before posting... Search!

  3. #3
    sposetti is offline Former Zimbran
    Join Date
    Nov 2009
    Posts
    105
    Rep Power
    5

  4. #4
    earlgrei is offline Intermediate Member
    Join Date
    Sep 2012
    Posts
    16
    Rep Power
    2

    Default

    I am attempting to do a similar thing in Zimbra 8.0.0GA. Has something changed with the Development information? I used the (almost) exact code from the example to make sure it worked in 8. It doesn't seem to. all I changed was helloworld to epicor. Doesnt load. I cannot find errors anywhere. Help is appreciated I will upload whatever I need to.

  5. #5
    ychaouche is offline Senior Member
    Join Date
    Jul 2012
    Location
    Algiers
    Posts
    55
    Rep Power
    3

    Default

    This code works for me in zimbra 7.2

    Code:
    SugarBee.prototype.initializeToolbar = function(app, toolbar, controller, viewID){
    
        if (!SugarBee.addMailButtonCreated && viewID.indexOf(ZmId.VIEW_COMPOSE) >= 0){
    	this._createMailButton(toolbar,controller);
        }
    
        else if (!SugarBee.addContactButtonCreated && viewID == ZmId.VIEW_CONTACT){
    	this._createContactButton(toolbar,controller);
        }
    
        else if (viewID.indexOf(ZmId.VIEW_APPOINTMENT) >= 0){
    	this._createApptButton(toolbar,controller);
        }
    };
    
    SugarBee.prototype._createMailButton = function (toolbar,controller){
    
        var args = {
    	text    : "Envoi+copie sugar",
    	tooltip : "Envoi l'e-mail et cr&eacute;e une copie dans SugarCRM",
    	image   : "plus",
    	index   : 1,
    	enabled : true
        };
        
        var bouton = toolbar.createOp("SugarBeeAddMail",args);
        toolbar.addOp("SugarBeeAddMail",1);
        bouton.addSelectionListener(new AjxListener(this._displayMessage,controller));
        SugarBee.addMailbuttonCreated = true;
    };
    HTH.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 6
    Last Post: 03-05-2010, 01:13 AM
  2. Replies: 1
    Last Post: 10-21-2009, 04:04 PM
  3. Samba and POSIX undeploy problem
    By catnipper in forum Zimlets
    Replies: 0
    Last Post: 09-02-2009, 10:51 AM
  4. Zimbra Address Book Toolbar Button
    By jonnybravo in forum Zimlets
    Replies: 0
    Last Post: 05-28-2008, 09:31 AM
  5. adding button to compose toolbar with a zimlet
    By sdouglass in forum Zimlets
    Replies: 1
    Last Post: 09-18-2006, 06:39 PM

Posting Permissions

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