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 09-03-2010, 02:59 AM
Moderator
 
Posts: 7,929
Default [SOLVED] Help with Zimlet to compose email and set subject

Hi,

I am trying to follow some of the code for adding a zimlet button to generate a new email and set the subject field. So far I have
Code:
com_uxbod_sendfax = function() {
};
com_uxbod_sendfax.prototype = new ZmZimletBase;
com_uxbod_sendfax.prototype.constructor = com_uxbod_sendfax;

com_uxbod_sendfax.prototype.initializeToolbar =
function(app, toolbar, controller, viewId) {

    if (viewId.indexOf("COMPOSE") >= 0) {

        var buttonIndex = -1;
        for (var i = 0; i < toolbar.opList.length; i++) {
            if (toolbar.opList[i] == ZmOperation.VIEW_MENU) {
                buttonIndex = i + 1;
                break;
            }
        }

        var buttonArgs = {
            text    : "Send Fax",
            tooltip : "Uxbod Send Fax Facility",
            index   : buttonIndex,
            image   : "zimbraicon"
        };

        var button = toolbar.createOp("UXBOD_ZIMLET_SENDFAX_BUTTON", buttonArgs);
        button.addSelectionListener(new AjxListener(this, this._showSelectedMail, controller));
    }
};

com_uxbod_sendfax.prototype._showSelectedMail =
function(controller) {
    var message = controller.getMsg();
    appCtxt.getAppController().setStatusMsg("Subject:"+ message.subject);
};
I refresh ZWC but I do not see the button appear, and if I click on new message then nothing happens. Thoughts on what I have done wrong please ?
__________________
Reply With Quote
  #2 (permalink)  
Old 09-03-2010, 06:06 AM
Moderator
 
Posts: 7,929
Default

Getting a little further by studying rrao's template zimlet. What I am struggling with now is how to position the button. I would like it to always come after the Option button in the mail compose window. Though how would one find the correct identifier ? I tried VIEW_OPTIONS but then the button did not show at all. If I set the variable index to say 4 it positions in the middle
__________________
Reply With Quote
  #3 (permalink)  
Old 09-05-2010, 06:00 AM
Project Contributor
 
Posts: 92
Default

Hi uxbod,

How about this?
I have tried something like this in my zimlet.

Quote:
var buttonIndex = 0;
for (var i = 0; i < toolbar.opList.length; i++) {
if (toolbar.opList[i] == "COMPOSE_OPTIONS") {
buttonIndex = i + 1;
break;
}
}
Reply With Quote
  #4 (permalink)  
Old 09-05-2010, 07:08 AM
Moderator
 
Posts: 7,929
Default

Thanks Slight mod and it is now working
Code:
var buttonIndex = 0;
                for (var i = 0; i < toolbar.opList.length; i++) {
                                if (toolbar.opList[i] == ZmOperation.COMPOSE_OPTIONS) {
                                        buttonIndex = i + 2;
                                        break;
                                }
                }
I wish the variable options were exposed in a wiki document somewhere.
__________________
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

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.