myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adrian Mitev (JIRA)" <...@myfaces.apache.org>
Subject [jira] Created: (TOMAHAWK-965) Add ability to JSCookMenu to invoke javascript and actiom method at the same
Date Thu, 19 Apr 2007 13:10:15 GMT
Add ability to JSCookMenu to invoke javascript and actiom method at the same
----------------------------------------------------------------------------

                 Key: TOMAHAWK-965
                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-965
             Project: MyFaces Tomahawk
          Issue Type: Improvement
          Components: JS Cook Menu
    Affects Versions: 1.1.6-SNAPSHOT
            Reporter: Adrian Mitev


In MyFacesHack.js:


 if (link != null)
    {
       //-------------- Add this code
        //searches for javascript$action notation
        if (link.match(/\w*:A\].*\$/) != null) {
        	expr = link.replace(/^\w*:A\]/, "");
        	jsExpr = expr.replace(/\$.*/,"");
        	eval(jsExpr);
        	link = link.replace(jsExpr,"").replace("\$","");
        }
       //-----------------------
        // 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;
            dummyForm.submit();
        }
    }

This addition searches for action that contains javascript code and expression separated by
$. Splits them and invokes the javascript code. Example:

<t:navigationMenuItem itemLabel="Something" action="alert('myBean.actionMethod will be
invoked')$#{myBean.actionMethod}" />

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message