use of com.servoy.j2db.scripting.ScriptVariableScope in project servoy-client by Servoy.
the class ServoyFunctionPropertyType method nativeFunctionToJSON.
private void nativeFunctionToJSON(NativeFunction function, Map<String, Object> map) throws Exception {
String functionName = function.getFunctionName();
Scriptable parentScope = function.getParentScope();
while (parentScope != null && !(parentScope instanceof ScriptVariableScope)) {
parentScope = parentScope.getParentScope();
}
if (parentScope instanceof FormScope && ((FormScope) parentScope).getFormController() != null) {
String formName = ((FormScope) parentScope).getFormController().getName();
map.put("script", SecuritySupport.encrypt(Settings.getInstance(), "forms." + formName + "." + functionName + "()"));
map.put("formname", formName);
} else if (parentScope instanceof GlobalScope) {
map.put("script", SecuritySupport.encrypt(Settings.getInstance(), "scopes." + ((GlobalScope) parentScope).getScopeName() + "." + functionName + "()"));
}
}
Aggregations