Tim Olsen avatar Tim Olsen committed 29607e3

Copy from CVS: Fix for lack of TurbineUtils in Context when loaded from Rest code. Had to override the doBuild method, to insert TurbineUtils like SecureScreen does.
BUGZID:1264

Comments (0)

Files changed (2)

org/nrg/xdat/turbine/modules/screens/Login.java

 package org.nrg.xdat.turbine.modules.screens;
 
 import org.apache.turbine.modules.screens.VelocitySecureScreen;
+import org.apache.turbine.services.velocity.TurbineVelocity;
 import org.apache.turbine.util.RunData;
 import org.apache.velocity.context.Context;
+import org.nrg.xdat.turbine.utils.TurbineUtils;
 
 public class Login extends VelocitySecureScreen {
+
+	@Override
+	protected void doBuildTemplate(RunData data) throws Exception {
+		Context c = TurbineVelocity.getContext(data);
+        String systemName = TurbineUtils.GetSystemName();
+        c.put("turbineUtils",TurbineUtils.GetInstance());
+        c.put("systemName",systemName);
+        doBuildTemplate(data, c);
+	}
+
 	@Override
 	protected void doBuildTemplate(RunData data, Context context) throws Exception {
 		for(final Object param : data.getParameters().keySet()){
 		}
 	}
 
+
+
+
 	@Override
 	protected boolean isAuthorized(RunData arg0) throws Exception {
 		return false;

org/nrg/xdat/turbine/modules/screens/Register.java

 package org.nrg.xdat.turbine.modules.screens;
 
 import org.apache.turbine.modules.screens.VelocitySecureScreen;
+import org.apache.turbine.services.velocity.TurbineVelocity;
 import org.apache.turbine.util.RunData;
 import org.apache.velocity.context.Context;
+import org.nrg.xdat.turbine.utils.TurbineUtils;
 
 public class Register extends VelocitySecureScreen {
 
+
+	@Override
+	protected void doBuildTemplate(RunData data) throws Exception {
+		Context c = TurbineVelocity.getContext(data);
+        String systemName = TurbineUtils.GetSystemName();
+        c.put("turbineUtils",TurbineUtils.GetInstance());
+        c.put("systemName",systemName);
+        doBuildTemplate(data, c);
+	}
+
 	@Override
 	protected void doBuildTemplate(RunData data, Context context) throws Exception {
 		for(final Object param : data.getParameters().keySet()){
 			final String paramS= (String)param;
-			if ((!paramS.equalsIgnoreCase("template")) 
+			if ((!paramS.equalsIgnoreCase("template"))
 					&& (!paramS.equalsIgnoreCase("action"))
 					&& (!paramS.equalsIgnoreCase("username"))
 					&& (!paramS.equalsIgnoreCase("password"))){
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.