Results 1 to 4 of 4

Thread: Context Menu - Confusion

  1. #1
    Join Date
    Mar 2006
    Posts
    6
    Rep Power
    9

    Default Context Menu - Confusion

    Hi,

    I am playing with the Context Menu's in Zimlets.
    Does Zimbra offer the functionality to change the context menu's that appear when Zimbra objects are right clicked (Eg: a Calendar or email item), or can they only be configured for the Zimlet itself (ie: zimlet panel object).

    The main purpose would be to allow the user to right click on any zimbra object and have a conext option for a Zimlet rather than relying on the user to drag the object over to the zimlet.

    If this is already possible, are there any publicly available zimlets that use this from which I can obtain an example (As the whitepaper does not make it clear)

    Many thanks in advance

    JeffT

  2. #2
    Join Date
    Nov 2005
    Posts
    518
    Rep Power
    10

    Default

    add the contextMenu to the contentObject in the zimlet definition file

  3. #3
    Join Date
    Jun 2013
    Posts
    23
    Rep Power
    2

    Default

    Hi,
    anyone of you have done that?

    I need it in Zimbra 8, I've tried with this in my XML definition file, but no success:
    Code:
    [...]
            <contentObject type="ZmMailMsg">
                    <contextMenu>
                            <menuItem label="asd" icon="asd" id="asd"/>
                    </contextMenu>
            </contentObject>
    [...]
    Any hint?
    Thanks...
    YetOpen S.r.l. ~ Your open source partner
    Lecco (LC) - ITALY
    http://www.yetopen.it

  4. #4
    Join Date
    Jun 2013
    Posts
    23
    Rep Power
    2

    Default

    I've managed to do it with JS instead if XML definition file.
    The framework calls onActionMenuInitialized method of the Zimlet in context menu initialization, so you have to implement it this way:
    Code:
    ZimletHandlerObject.prototype.onActionMenuInitialized =
    function(controller, menu) {
            var ID = "AN_ID_FOR_THE_OPTION";
            var text = this.getMessage("MYZIMLET_OPTION_MENU_LABEL");
            if (!menu.getMenuItem(ID)) {
                    // some params
                    var op = {
                            id: ID,
                            text: text,
                            image: "search"
                    };
                    var opDesc = ZmOperation.defineOperation(null, op);
                    menu.addOp(ID, 1000);//add the button at the bottom
                    menu.addSelectionListener(
                        ID,
                        new AjxListener(
                            this,
                            //this._myActionWhenTheOptionIsClicked,                                                                   
                            function () { alert ("asd"); }, // inline test, use a function is the right way
                            controller
                        )
                    );
            }
    }
    Hope it helps.

    PS: another example can be found in com_zimbra_srchhighlighter Zimlet.
    Last edited by g41n; 04-09-2014 at 03:29 AM.
    YetOpen S.r.l. ~ Your open source partner
    Lecco (LC) - ITALY
    http://www.yetopen.it

Similar Threads

  1. Replies: 7
    Last Post: 04-10-2008, 05:28 AM
  2. PHP create context header
    By bookatechie in forum Developers
    Replies: 1
    Last Post: 05-01-2007, 08:30 PM
  3. Firefox & New Email context menu problem
    By davidh in forum Installation
    Replies: 2
    Last Post: 03-21-2007, 12:28 PM
  4. How to get rid of Zimlets menu bar
    By daimer77 in forum Zimlets
    Replies: 8
    Last Post: 04-27-2006, 11:36 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
  •