All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.uncompressed-js-resources.oam.custom.navmenu.jscookmenu.MyFacesHack.js Maven / Gradle / Ivy

Go to download

JSF components and utilities that can be used with any JSF implementation. This library is based on the JSF1.1 version of Tomahawk, but with minor source code and build changes to take advantage of JSF2.1 features. A JSF2.1 implementation is required to use this version of the Tomahawk library.

The newest version!
//
// Overrides the original JSCookMenu function to work with MyFaces
// action should be taken for mouse button up at a menu item
//
function cmItemMouseUp (obj, isMain, idSub, menuID, index)
{
	if (_cmItemList[index].isDisabled)
		return;

    var item = _cmItemList[index];

    var link = null, target = '_self';

    if (item.length > 2)
        link = item[2];
    if (item.length > 3 && item[3])
        target = item[3];

    if (link != null)
    {
        // changes by Richard J. Barbalace
        if (link.match(/^\w*:A\]\w*:\/\//) != null ) {
            // Link is a URL
            link = link.replace(/^\w*:A\]/, "");  // Remove JSF ID
            window.open (link, target);
        } else if (link.match(/^\w*:A\]\w*:/) != null ) {
            // Link is a script method
            link = link.replace(/^\w*:A\]\w*:/, "");  // Remove JSF ID
            eval(link);
        } else {
            // Link is a JSF action
            var dummyForm = document.forms[target];
            dummyForm.elements['jscook_action'].value = link;
            if (typeof submitForm == "undefined") {
                //No Trinidad
                dummyForm.submit();
            } else {
                //Trinidad style
                var mysource = dummyForm.name+':jscook_action';
                submitForm(dummyForm.name,1,{source:mysource});    
            }
        }
    }

    var menuInfo = _cmMenuList[menuID];
    var prefix = menuInfo.prefix;
    var thisMenu = cmGetThisMenu (obj, prefix);

    var hasChild = (item.length > 5);
    if (!hasChild)
    {
        if (cmIsDefaultItem (item))
        {
            if (obj.cmIsMain)
                obj.className = prefix + 'MainItem';
            else
                obj.className = prefix + 'MenuItem';
        }
        cmHideMenu (thisMenu, null, menuInfo);
    }
    else
    {
        if (cmIsDefaultItem (item))
        {
            if (obj.cmIsMain)
                obj.className = prefix + 'MainItemHover';
            else
                obj.className = prefix + 'MenuItemHover';
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy