Added positional parameters to some macros
This commit is contained in:
parent
b5275719bb
commit
e15b2bb521
2 changed files with 29 additions and 23 deletions
|
@ -8,10 +8,10 @@
|
|||
*
|
||||
* Copyright 1998-2005 Helma Software. All Rights Reserved.
|
||||
*
|
||||
* $RCSfile: Date.js,v $
|
||||
* $Author: czv $
|
||||
* $Revision: 1.2 $
|
||||
* $Date: 2006/04/24 07:02:17 $
|
||||
* $RCSfile: Global.js,v $
|
||||
* $Author: tobi $
|
||||
* $Revision: 1.1 $
|
||||
* $Date: 2006/08/06 11:27:56 $
|
||||
*/
|
||||
|
||||
|
||||
|
@ -22,8 +22,8 @@ app.addRepository("modules/core/String.js");
|
|||
* write out a property contained in app.properties
|
||||
* @param Object containing the name of the property
|
||||
*/
|
||||
function property_macro(param) {
|
||||
res.write(app.properties[param.name] || String.NULL);
|
||||
function property_macro(param, name) {
|
||||
res.write(getProperty(name || param.name) || String.NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -33,8 +33,8 @@ function property_macro(param) {
|
|||
* just to be able to use different encodings
|
||||
* @param Object containing the string as text property
|
||||
*/
|
||||
function write_macro(param) {
|
||||
res.write(param.text || String.NULL);
|
||||
function write_macro(param, text) {
|
||||
res.write(param.text || text || String.NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -59,9 +59,11 @@ function now_macro(param) {
|
|||
/**
|
||||
* renders a global skin
|
||||
*/
|
||||
function skin_macro(param) {
|
||||
if (param.name) {
|
||||
renderSkin(param.name);
|
||||
var skin_macro = function(param, name) {
|
||||
var skinName = name || param.name;
|
||||
if (skinName) {
|
||||
renderSkin(skinName);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
* Copyright 1998-2005 Helma Software. All Rights Reserved.
|
||||
*
|
||||
* $RCSfile: HopObject.js,v $
|
||||
* $Author: tobi $
|
||||
* $Revision: 1.4 $
|
||||
* $Date: 2007/04/23 15:03:47 $
|
||||
* $Author: hannes $
|
||||
* $Revision: 1.5 $
|
||||
* $Date: 2007/05/10 13:45:34 $
|
||||
*/
|
||||
|
||||
|
||||
|
@ -40,7 +40,7 @@ HopObject.prototype.forEach = function(callback) {
|
|||
/**
|
||||
* macro returns the id of a HopObject
|
||||
*/
|
||||
HopObject.prototype.id_macro = function(param) {
|
||||
HopObject.prototype.id_macro = function() {
|
||||
res.write(this._id);
|
||||
return;
|
||||
};
|
||||
|
@ -49,8 +49,8 @@ HopObject.prototype.id_macro = function(param) {
|
|||
/**
|
||||
* macro returns the url for any hopobject
|
||||
*/
|
||||
HopObject.prototype.href_macro = function(param) {
|
||||
res.write(this.href(param.action || String.NULLSTR));
|
||||
HopObject.prototype.href_macro = function(param, action) {
|
||||
res.write(this.href(action || param.action || String.NULLSTR));
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -59,15 +59,16 @@ HopObject.prototype.href_macro = function(param) {
|
|||
* macro rendering a skin or displaying
|
||||
* its source (param.as == "source")
|
||||
*/
|
||||
HopObject.prototype.skin_macro = function(param) {
|
||||
if (param.name) {
|
||||
HopObject.prototype.skin_macro = function(param, name) {
|
||||
var skinName = name || param.name;
|
||||
if (skinName) {
|
||||
if (param.as == "source") {
|
||||
var str = app.skinfiles[this._prototype][param.name];
|
||||
var str = app.skinfiles[this._prototype][skinName];
|
||||
if (str && param.unwrap == "true") {
|
||||
str = str.unwrap();
|
||||
}
|
||||
} else {
|
||||
var str = this.renderSkinAsString(param.name, param);
|
||||
var str = this.renderSkinAsString(skinName, param);
|
||||
}
|
||||
res.write(str);
|
||||
}
|
||||
|
@ -100,11 +101,14 @@ HopObject.prototype.switch_macro = function(param) {
|
|||
* itemPrefix: text to prepend to each items skin render
|
||||
* itemSuffix: text to append to each items skin render
|
||||
*/
|
||||
HopObject.prototype.loop_macro = function(param) {
|
||||
HopObject.prototype.loop_macro = function(param, collection) {
|
||||
if (!param.skin) {
|
||||
return;
|
||||
}
|
||||
var items = param.collection ? this[param.collection] : this;
|
||||
if (!collection) {
|
||||
collection = param.collection;
|
||||
}
|
||||
var items = collection ? this[collection] : this;
|
||||
if (!items || !items.size || items.size() < 1) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue