Results 1 to 2 of 2

Thread: How to get contentObjText on click of a context menu

  1. #1
    Join Date
    Dec 2012
    Posts
    2
    Rep Power
    2

    Default How to get contentObjText on click of a context menu

    Hi,

    I am new to zimlet development. I am trying to develop a content zimlet, the issue I am facing is that I am not able to get hold of content text in the context menu handler code (the menuItemSelected function of javascript).

    Here is my zimlet xml code :-

    Code:
    <zimlet name="com_myservice_zimbra_click2call" version="1.0" description="Click to call any number using myservice - 12">
        <include>com_myservice_zimbra_click2call.js</include>
        <handlerObject>com_myservice_zimbra_click2call_HandlerObject</handlerObject>
        <contentObject type="phone">
    		<matchOn>
    			<regex attrs="g">\+?\b\d([0-9\(\)\.\s\-]){8,20}\d\b</regex>
    		</matchOn>
    		<contextMenu>
    			<menuItem label="Click to call using myservice!" icon="Search" id="SOME_MENU_ITEM_ID1"/>
    		</contextMenu>
    	</contentObject>
    </zimlet>
    And here is my javascript code :-

    Code:
    com_myservice_zimbra_click2call_HandlerObject.prototype.menuItemSelected =
    function(menuItemId, menuData, event) {
    	switch (menuItemId) {
    	case "SOME_MENU_ITEM_ID1":
                    // How to get contentObjText where user right clicked????
    		break;
    	default:
    		// do nothing
    		break;
    	}
    };
    Please note that to me looks like there is a bug in documentation of menuItemSelected function. As per documentation there are five arguments for menuItemSelected function but in reality there are only three i.e menuItemId, menuData and event (have a look at ZmZimletContext.prototype._handleMenuItemSelected( ) of ZmZimletContext.js). Please correct me, If my understanding is incorrect.

    Now my question is how do I get hold of contentObjectText on which the user right clicked? Any help in the right direction is highly appreciated.

    Thanks in advance,
    Amrainder

  2. #2
    Join Date
    Dec 2012
    Posts
    2
    Rep Power
    2

    Default

    OK, so I got solution for the issue being faced by me. The contentOjectText can be obtained by accessing _actionObject.

    Code:
    com_myservice_zimbra_click2call_HandlerObject.prototype.menuItemSelected =
    function(menuItemId, menuData, event) {
    	switch (menuItemId) {
    	case "SOME_MENU_ITEM_ID1":
                    var rightClickedText = this._actionObject.toString();
    		break;
    	default:
    		// do nothing
    		break;
    	}
    };
    Thanks,
    Amrainder

Similar Threads

  1. Add items in an existing context menu.
    By docnum in forum Zimlets
    Replies: 1
    Last Post: 04-09-2014, 02:50 AM
  2. Context Menu - Confusion
    By JeffT in forum Developers
    Replies: 3
    Last Post: 04-09-2014, 02:46 AM
  3. right click context menu
    By mraaronm in forum Administrators
    Replies: 0
    Last Post: 11-19-2008, 11:04 AM
  4. Context menu bug
    By mclain in forum Administrators
    Replies: 5
    Last Post: 02-05-2008, 10:02 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
  •