Author: adrianc
Date: Wed May 2 13:13:10 2012
New Revision: 1333030
URL:
http://svn.apache.org/viewvc?rev=1333030&view=revLog:
Improved Mini-language <script> element - now supports inline scripts in the element body.
Modified:
ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallScript.java
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallScript.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallScript.java?rev=1333030&r1=1333029&r2=1333030&view=diff==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallScript.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallScript.java Wed May 2 13:13:10 2012
@@ -21,6 +21,7 @@ package org.ofbiz.minilang.method.callop
import org.ofbiz.base.util.ScriptUtil;
import org.ofbiz.base.util.Scriptlet;
import org.ofbiz.base.util.StringUtil;
+import org.ofbiz.base.util.UtilXml;
import org.ofbiz.base.util.string.FlexibleStringExpander;
import org.ofbiz.minilang.MiniLangException;
import org.ofbiz.minilang.MiniLangRuntimeException;
@@ -69,9 +70,12 @@ public final class CallScript extends Me
if (elementModified && MiniLangUtil.autoCorrectOn()) {
MiniLangUtil.flagDocumentAsCorrected(element);
}
- String scriptAttribute = element.getAttribute("script");
- if (MiniLangUtil.containsScript(scriptAttribute)) {
- this.scriptlet = new Scriptlet(StringUtil.convertOperatorSubstitutions(scriptAttribute));
+ String inlineScript = element.getAttribute("script");
+ if (inlineScript.length() == 0) {
+ inlineScript = UtilXml.elementValue(element);
+ }
+ if (MiniLangUtil.containsScript(inlineScript)) {
+ this.scriptlet = new Scriptlet(StringUtil.convertOperatorSubstitutions(inlineScript));
this.location = null;
this.method = null;
} else {