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