From 5e04d833f102e087f7d19675b358ac5eb9ca6a57 Mon Sep 17 00:00:00 2001 From: hns Date: Thu, 26 Jul 2001 14:44:17 +0000 Subject: [PATCH] switched to new href() syntax, fixed bug in user.register where the db field name was used instead of the corresponding property name --- src/helma/framework/core/Application.java | 31 +++++++++++++++-------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/helma/framework/core/Application.java b/src/helma/framework/core/Application.java index 429071a3..bba55d1d 100644 --- a/src/helma/framework/core/Application.java +++ b/src/helma/framework/core/Application.java @@ -406,9 +406,16 @@ public class Application extends UnicastRemoteObject implements IRemoteApp, Runn unode = new Node (uname); String usernameField = userMapping.getNameField (); - if (usernameField == null) - usernameField = "name"; - unode.setString (usernameField, uname); + String usernameProp = null; + if (usernameField != null) { + Relation namerel= userMapping.columnNameToProperty (usernameField); + if (namerel != null) + usernameProp = namerel.propname; + } + if (usernameProp == null) + usernameProp = "name"; + unode.setName (uname); + unode.setString (usernameProp, uname); unode.setString ("password", password); unode.setPrototype ("user"); unode.setDbMapping (userMapping); @@ -474,21 +481,23 @@ public class Application extends UnicastRemoteObject implements IRemoteApp, Runn public String getNodePath (INode n, String tmpname) { INode root = getDataRoot (); INode users = getUserRoot (); - String href = n.getUrl (root, users, tmpname); + String siteroot = props.getProperty ("rootPrototype"); + String href = n.getUrl (root, users, tmpname, siteroot); return href; } public String getNodeHref (INode n, String tmpname) { INode root = getDataRoot (); INode users = getUserRoot (); - // check base uri from app.properties + + // check base uri and optional root prototype from app.properties String base = props.getProperty ("baseURI"); - if (base != null) - setBaseURI (base); - String href = n.getHref (root, users, tmpname, baseURI == null ? "/" : baseURI); - // add cache teaser - // href = href + "&tease="+((int) (Math.random ()*999)); - return href; + String siteroot = props.getProperty ("rootPrototype"); + + setBaseURI (base); + String href = n.getUrl (root, users, tmpname, siteroot); + + return baseURI + href; } public void setBaseURI (String uri) {