You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Boeckli, Dominique" <do...@eds.com> on 2006/05/09 09:57:12 UTC

Tomahawk 1.1.2 jscookMenu Bugs ?

First case: 

 <t:navigationMenuItem id="Home"  itemLabel="Home"
action="http://t-web/"  target="_self"/> 

always open in a new window or tab in IE and Firefox.

 

Second:

<t:navigationMenuItem id="Contact" itemLabel="Contact"
icon="/graphics/contact.png" action="mailto:test@test.com"/> 

is not recognized as a URL.

 

This is my quick an dirty fix in MyFacesHack.js (in bold): 

//
// Overrides the original JSCookMenu function to work with MyFaces
//
function cmItemMouseUp (obj, index)
{
    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
            target = '_self';
// target fix
            window.open (link, target);
        } else if ( link.match(/^\w*:A\]mailto:/) != null ) {
// mailto fix
            // Link is a mailto URL
// mailto fix
            link = link.replace(/^\w*:A\]/, "");  // Remove JSF ID
// mailto fix
            target = '_self';
// target fix
            window.open (link, target);
// mailto fix
        } 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;
            dummyForm.submit();
        }
    }

 

 

kind regards

 

Dominique