
Detailed reference of prototypes, properties and methods available in the
Javascript environment of your Helma web applications.
Object | +--skin
See:
| SUMMARY: Constructor | Properties | Methods | DETAIL: Constructor | Properties | Methods |
| Constructor Summary | |
skin(Object)
A Skin object that can be passed to the global functions renderSkin, resp. |
|
| Methods Summary | |
void
|
allowMacro(<String> macroname)
Limits the range of allowed macros to be rendered in a skin to an explicit set. |
Boolean
|
containsMacro(<String> macroname)
Checks whether a skin does contain a specific macro. |
String
|
getSource()
Returns the source of the unrendered skin. |
| Constructor Detail |
skin(Object)
| Method Detail |
void allowMacro(<String> macroname)
// Two macro functions defined in a JavaScript file:
function isAllowed_macro() {
return("Hello");
}
function isForbidden_macro() {
return("World");
}
// The action that enables one of the macros:
function test_action() {
var str = "<% root.isAllowed %>, <% root.isForbidden %>!";
var skin = createSkin(str);
// as soon as we call allowMacro() on a skin, only those
// macros explicitely set are allowed to be evaluated.
// all others will result in an error msg.
skin.allowMacro("root.isAllowed");
renderSkin(skin);
}
Hello, [Macro root.isForbidden not allowed in sandbox]!
macroname - as String
Boolean containsMacro(<String> macroname)
Example:
var skin1 = createSkin("myMacro");
var skin2 = createSkin("<% myMacro %>");
var skin3 = createSkin("<% this.myMacro %>");
res.writeln(skin1.containsMacro("myMacro"));
false
res.writeln(skin2.containsMacro("myMacro"));
true
res.writeln(skin3.containsMacro("myMacro"));
false
res.writeln(skin3.containsMacro("this.myMacro"));
true
macroname - as String
String getSource()
| SUMMARY: Constructor | Properties | Methods | DETAIL: Constructor | Properties | Methods |