cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim Gritsenko <va...@reverycodes.com>
Subject Re: call a function not in global object in <map:call >
Date Thu, 16 Nov 2006 16:56:18 GMT
Jason Johnston wrote:
> Mark Lundquist wrote:
>>
>> On Nov 13, 2006, at 10:14 PM, Rice Yeh wrote:
>>
>>> Thank you. Will this patch go into the trunk eventually?
>>
>> It's up to the committers.  I'm sure they will take a look at it and 
>> decide if they think it's a good way.
> 
> I can't vouch for the patch, but I'll definitely give my +1 on having 
> this feature.  It's something I've wanted for a while, just never got 
> around to submitting a request.

Even though same can be achieved in flow itself, it probably is a good usability 
feature so it worth adding it... WDYT?

Vadim


>> But if you want to try a trunk version, here it is.  I couldn't get 
>> trunk to build, so you might have to fix this if it doesn't compile :-/
>>
>> cheers,
>> —ml—
>>
>> ==================================================================
>> --- 
>> blocks/cocoon-flowscript/cocoon-flowscript-impl/src/main/java/org/apache/cocoon/components/flow/javascript/fom/FOM_JavaScriptInterpreter.java
    
>> (revision 474689)
>> +++ 
>> blocks/cocoon-flowscript/cocoon-flowscript-impl/src/main/java/org/apache/cocoon/components/flow/javascript/fom/FOM_JavaScriptInterpreter.java
    
>> (working copy)
>> @@ -593,11 +593,19 @@
>>                      }
>>                      cocoon.setParameters(parameters);
>>
>> -                    Object fun = 
>> ScriptableObject.getProperty(thrScope, funName);
>> -                    if (fun == Scriptable.NOT_FOUND) {
>> -                        throw new ResourceNotFoundException("Function 
>> \"javascript:" + funName + "()\" not found");
>> +                    // Resolve function name
>> +                    //
>> +                    Object fun;
>> +                    try {
>> +                        fun = context.compileString (funName, null, 
>> 1, null)
>> +                                         .exec (context, thrScope);
>> +                    } catch (EcmaError ee) {
>> +                       throw new ResourceNotFoundException (
>> +                            "Function \"javascript:" + funName + 
>> "()\" not found"
>> +                        );
>>                      }


Mime
View raw message