function invokeContextMenu(e, contextMenuUrl) {
      contextMenuUrl = contextMenuUrl || "contextMenu";

        function showMenu(items) {
            menu.hide();
            var pos = [e, "tl", "bl"];
            if ($(e).hasClassName("tl-tr"))  pos = [e,"tl","tr"];
            menu.cfg.setProperty("context", pos);
            menu.clearContent();
            menu.addItems(items);
            menu.render("breadcrumb-menu-target");
            menu.show();
        }

        if (xhr)
            xhr.options.onComplete = function () {
            };   // ignore the currently pending call

        if (e.items) {// use what's already loaded
            showMenu(e.items());
        } else {
          // fetch menu on demand
            xhr = new Ajax.Request(combinePath(e.getAttribute("href"), contextMenuUrl), {
                onComplete:function (x) {
                  var items = x.responseText.evalJSON().items;
                    function fillMenuItem(e) {
                        if (e.type === "HEADER") {
                            e.text = makeMenuHtml(e.icon, e.iconXml, "<span class='header'>" + e.displayName + "</span>");
                            e.disabled = true;
                        } else if (e.type === "SEPARATOR") {
                            e.text = "<span class='separator'>--</span>";
                            e.disabled = true;
                        } else {
                          e.text = makeMenuHtml(e.icon, e.iconXml, e.displayName);
                        }
                        if (e.subMenu!=null)
                            e.subMenu = {id:"submenu"+(iota++), itemdata:e.subMenu.items.each(fillMenuItem)};
                        if (e.requiresConfirmation) {
                            e.onclick = {fn: requireConfirmation, obj: {url: e.url, displayName: e.displayName, post: e.post}};
                            delete e.url;
                        } else if (e.post) {
                            e.onclick = {fn: postRequest, obj: e.url};
                            delete e.url;
                        }
                    }
                    items.each(fillMenuItem);
                    e.items = function() { return items };
                    showMenu(items);
                }
            });
        }

        return false;
    }
/**
     * Called when the user clicks a mouse to show a context menu.
     *
     * If the mouse stays there for a while, a context menu gets displayed.
     *
     * @param {HTMLElement} e
     *      anchor tag
     * @param {String} contextMenuUrl
     *      The URL that renders JSON for context menu. Optional.
     */
Called when the user clicks a mouse to show a context menu.
If the mouse stays there for a while, a context menu gets displayed.

@param {HTMLElement} e
anchor tag
@param {String} contextMenuUrl
The URL that renders JSON for context menu. Optional.
Called when the user clicks a mouse to show a context menu . If the mouse stays there for a while a context menu gets displayed . @param { HTMLElement } e anchor tag @param { String } contextMenuUrl The URL that renders JSON for context menu . Optional .
function invokeContextMenu(e, contextMenuUrl) {
      contextMenuUrl = contextMenuUrl || "contextMenu";
        function showMenu(items) {
            menu.hide();
            var pos = [e, "tl", "bl"];
            if ($(e).hasClassName("tl-tr"))  pos = [e,"tl","tr"];
            menu.cfg.setProperty("context", pos);
            menu.clearContent();
            menu.addItems(items);
            menu.render("breadcrumb-menu-target");
            menu.show();
        }
        if (xhr)
            xhr.options.onComplete = function () {
            };   
        if (e.items) {
            showMenu(e.items());
        } else {
            xhr = new Ajax.Request(combinePath(e.getAttribute("href"), contextMenuUrl), {
                onComplete:function (x) {
                  var items = x.responseText.evalJSON().items;
                    function fillMenuItem(e) {
                        if (e.type === "HEADER") {
                            e.text = makeMenuHtml(e.icon, e.iconXml, "<span class='header'>" + e.displayName + "</span>");
                            e.disabled = true;
                        } else if (e.type === "SEPARATOR") {
                            e.text = "<span class='separator'>--</span>";
                            e.disabled = true;
                        } else {
                          e.text = makeMenuHtml(e.icon, e.iconXml, e.displayName);
                        }
                        if (e.subMenu!=null)
                            e.subMenu = {id:"submenu"+(iota++), itemdata:e.subMenu.items.each(fillMenuItem)};
                        if (e.requiresConfirmation) {
                            e.onclick = {fn: requireConfirmation, obj: {url: e.url, displayName: e.displayName, post: e.post}};
                            delete e.url;
                        } else if (e.post) {
                            e.onclick = {fn: postRequest, obj: e.url};
                            delete e.url;
                        }
                    }
                    items.each(fillMenuItem);
                    e.items = function() { return items };
                    showMenu(items);
                }
            });
        }
        return false;
    }
function invokeContextMenu ( e , contextMenuUrl ) { contextMenuUrl = contextMenuUrl || "contextMenu" ; function showMenu ( items ) { menu . hide ( ) ; var pos = [ e , "tl" , "bl" ] ; if ( $ ( e ) . hasClassName ( "tl-tr" ) ) pos = [ e , "tl" , "tr" ] ; menu . cfg . setProperty ( "context" , pos ) ; menu . clearContent ( ) ; menu . addItems ( items ) ; menu . render ( "breadcrumb-menu-target" ) ; menu . show ( ) ; } if ( xhr ) xhr . options . onComplete = function ( ) { } ; if ( e . items ) { showMenu ( e . items ( ) ) ; } else { xhr = new Ajax . Request ( combinePath ( e . getAttribute ( "href" ) , contextMenuUrl ) , { onComplete : function ( x ) { var items = x . responseText . evalJSON ( ) . items ; function fillMenuItem ( e ) { if ( e . type === "HEADER" ) { e . text = makeMenuHtml ( e . icon , e . iconXml , "<span class='header'>" + e . displayName + "</span>" ) ; e . disabled = true ; } else if ( e . type === "SEPARATOR" ) { e . text = "<span class='separator'>--</span>" ; e . disabled = true ; } else { e . text = makeMenuHtml ( e . icon , e . iconXml , e . displayName ) ; } if ( e . subMenu != null ) e . subMenu = { id : "submenu" + ( iota ++ ) , itemdata : e . subMenu . items . each ( fillMenuItem ) } ; if ( e . requiresConfirmation ) { e . onclick = { fn : requireConfirmation , obj : { url : e . url , displayName : e . displayName , post : e . post } } ; delete e . url ; } else if ( e . post ) { e . onclick = { fn : postRequest , obj : e . url } ; delete e . url ; } } items . each ( fillMenuItem ) ; e . items = function ( ) { return items } ; showMenu ( items ) ; } } ) ; } return false ; }
Called when the user clicks a mouse to show a context menu.
Called when the user clicks a mouse to show a context menu .
// ignore the currently pending call // use what's already loaded // fetch menu on demand