Object | +--Skin
| SUMMARY: Constructor | Properties | Methods | DETAIL: Constructor | Properties | Methods |
| 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. |
Skin
|
getSubskin(<String> name)
Returns a subskin by that name. |
Array
|
getSubskinNames()
Returns an array of names of all the subskins defined in this skin. |
Boolean
|
hasMainskin()
Checks if this skin has a main skin, as opposed to consisting just of subskins. |
Boolean
|
hasSubskin(<String> name)
Check if this skin contains a subskin with the given name. |
| 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()
Skin getSubskin(<String> name)
name - as String, the subskin name
Array getSubskinNames()
Boolean hasMainskin()
Boolean hasSubskin(<String> name)
name - as String, a subskin name
| SUMMARY: Constructor | Properties | Methods | DETAIL: Constructor | Properties | Methods |