introduced currentUser as handler for the current user object,
regardless of request path etc. accessing a property that is null in the skin parameter object will produce "" instead of "null"
This commit is contained in:
		
							parent
							
								
									e35dc60958
								
							
						
					
					
						commit
						673032e685
					
				
					 1 changed files with 6 additions and 3 deletions
				
			
		|  | @ -197,8 +197,11 @@ public class Skin { | ||||||
| 	        arguments[0] = par; | 	        arguments[0] = par; | ||||||
| 
 | 
 | ||||||
| 	        if (handler != null) { | 	        if (handler != null) { | ||||||
| 	            // not a global macro - need to find handler object | 	            if ("currentuser".equalsIgnoreCase (handler)) { | ||||||
| 	            if (thisNode != null) { | 	                // as a special convention, we use "currentuser" to access macros in the current user object | ||||||
|  | 	                handlerObject = reval.getNodeWrapper (reval.user.getNode ()); | ||||||
|  | 	            } else if (thisNode != null) { | ||||||
|  | 	                // not a global macro - need to find handler object | ||||||
| 	                // was called with this object - check it or its parents for matching prototype | 	                // was called with this object - check it or its parents for matching prototype | ||||||
| 	                if (!handler.equalsIgnoreCase ("this") && !handler.equalsIgnoreCase (thisNode.getPrototypeName ())) { | 	                if (!handler.equalsIgnoreCase ("this") && !handler.equalsIgnoreCase (thisNode.getPrototypeName ())) { | ||||||
| 	                    // the handler object is not what we want | 	                    // the handler object is not what we want | ||||||
|  | @ -273,7 +276,7 @@ public class Skin { | ||||||
| 	    else { | 	    else { | ||||||
| 	        try { | 	        try { | ||||||
| 	            ESValue value = paramObject.getProperty (name, name.hashCode()); | 	            ESValue value = paramObject.getProperty (name, name.hashCode()); | ||||||
| 	            if (value != null && value != ESUndefined.theUndefined) | 	            if (value != null && value != ESUndefined.theUndefined && value != ESNull.theNull) | ||||||
| 	                reval.res.write (value); | 	                reval.res.write (value); | ||||||
| 	        } catch (EcmaScriptException ignore) {} | 	        } catch (EcmaScriptException ignore) {} | ||||||
| 	    } | 	    } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue