diff --git a/webapp/config/web.xml b/webapp/config/web.xml
index b32d28c2f..a56b95a50 100644
--- a/webapp/config/web.xml
+++ b/webapp/config/web.xml
@@ -837,14 +837,18 @@
- CommentsController
- edu.cornell.mannlib.vitro.webapp.controller.CommentsController
+ CommentFormController
+ edu.cornell.mannlib.vitro.webapp.controller.freemarker.CommentFormController
- CommentsController
+ CommentFormController
/comments
-
+
+ CommentFormController
+ /contact
+
+
JSON Service
edu.cornell.mannlib.vitro.webapp.controller.JSONServlet
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/Controllers.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/Controllers.java
index add66cba0..f71537512 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/Controllers.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/Controllers.java
@@ -24,8 +24,6 @@ public class Controllers {
public static final String TERMS_OF_USE_URL = "/termsOfUse";
public static final String SEARCH_URL = "/search";
-
-
public static final String ENTITY = "/entity";
public static final String ENTITY_PROP_LIST = "/entityPropList";
public static final String ENTITY_LIST = "/EntityList";
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/CommentFormController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/CommentFormController.java
new file mode 100644
index 000000000..7846dda90
--- /dev/null
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/CommentFormController.java
@@ -0,0 +1,89 @@
+/* $This file is distributed under the terms of the license in /doc/license.txt$ */
+
+package edu.cornell.mannlib.vitro.webapp.controller.freemarker;
+
+import java.io.IOException;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
+import edu.cornell.mannlib.vitro.webapp.beans.Portal;
+import edu.cornell.mannlib.vitro.webapp.controller.ContactMailServlet;
+import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
+import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
+
+/**
+ * Controller for comments ("contact us") page
+ * * @author bjl23
+ */
+public class CommentFormController extends FreeMarkerHttpServlet {
+
+ public void doPost(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ doGet(request, response);
+ }
+
+ public void doGet( HttpServletRequest request, HttpServletResponse response )
+ throws IOException, ServletException {
+ super.doGet(request,response);
+ VitroRequest vreq = new VitroRequest(request);
+ try {
+ //this try block passes any errors to error.jsp
+ if (!ContactMailServlet.isSmtpHostConfigured()) {
+ request.setAttribute("title", "Comments and Feedback Form");
+ request.setAttribute("bodyJsp", "/contact_err.jsp");// <<< this is where the body gets set
+ request.setAttribute("ERR","This application has not yet been configured to send mail -- " +
+ "smtp host has not been specified in the configuration properties file.");
+ RequestDispatcher errd = request.getRequestDispatcher(Controllers.BASIC_JSP);
+ errd.forward(request, response);
+ }
+ ApplicationBean appBean=vreq.getAppBean();
+ Portal portalBean=vreq.getPortal();
+
+ if ( (appBean.getMaxSharedPortalId()-appBean.getMinSharedPortalId()) > 1
+ && ( (portalBean.getPortalId() >= appBean.getMinSharedPortalId()
+ && portalBean.getPortalId() <= appBean.getMaxSharedPortalId() )
+ || portalBean.getPortalId() == appBean.getSharedPortalFlagNumeric() )
+ ) {
+ request.setAttribute("portalType","CALSResearch");
+ } else
+ if (portalBean.getAppName().equalsIgnoreCase("CALS Impact")){
+ request.setAttribute("portalType", "CALSImpact");
+ } else if (portalBean.getAppName().equalsIgnoreCase("VIVO")) {
+ request.setAttribute("portalType", "VIVO");
+ } else {
+ request.setAttribute("portalType", "clone");
+ }
+
+ request.setAttribute("siteName",portalBean.getAppName());
+ request.setAttribute("scripts","/js/commentsForm.js");
+
+ if (request.getHeader("Referer") == null)
+ request.getSession().setAttribute("commentsFormReferer","none");
+ else
+ request.getSession().setAttribute("commentsFormReferer",request.getHeader("Referer"));
+
+
+ request.setAttribute("portalId",Integer.valueOf(portalBean.getPortalId()));
+
+ request.setAttribute("title", portalBean.getAppName()+" Comments and Feedback Form");
+ request.setAttribute("bodyJsp", "/commentsForm.jsp");// <<< this is where the body gets set
+ request.setAttribute("portalBean",portalBean);
+
+ RequestDispatcher rd =
+ request.getRequestDispatcher(Controllers.BASIC_JSP);
+ rd.forward(request, response);
+
+ } catch (Throwable e) {
+ // This is how we use an error.jsp
+ //it expects javax.servlet.jsp.jspException to be set to the
+ //exception so that it can display the info out of that.
+ request.setAttribute("javax.servlet.jsp.jspException", e);
+ RequestDispatcher rd = request.getRequestDispatcher("/error.jsp");
+ rd.include(request, response);
+ }
+ }
+}
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/Router.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/Router.java
index 03e5f4e1b..15bb2a31b 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/Router.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/Router.java
@@ -7,14 +7,14 @@ package edu.cornell.mannlib.vitro.webapp.controller.freemarker;
public class Router {
public static final String ABOUT = "/about";
- public static final String CONTACT = "/comments";
public static final String BROWSE = "/browse";
+ public static final String COMMENT_FORM = "/comments";
public static final String INDIVIDUAL = "/individual";
- public static final String INDIVIDUAL_LIST = "/individuallist";
+ public static final String INDIVIDUAL_LIST = "/entitylist"; // change
public static final String SEARCH = "/search";
public static final String TERMS_OF_USE = "/termsOfUse";
- // Put these under /siteAdmin/...
+ // Put these under /admin/...
// Currently login, logout, and site admin are all the same page, but they don't have to be.
public static final String LOGIN = "/siteAdmin";
public static final String LOGOUT = "/siteAdmin";
diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/controller/FreeMarkerHttpServletTest.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/controller/FreeMarkerHttpServletTest.java
index fee521f4e..63ff06989 100644
--- a/webapp/test/edu/cornell/mannlib/vitro/webapp/controller/FreeMarkerHttpServletTest.java
+++ b/webapp/test/edu/cornell/mannlib/vitro/webapp/controller/FreeMarkerHttpServletTest.java
@@ -10,6 +10,7 @@ import junit.framework.Assert;
import org.junit.Test;
import edu.cornell.mannlib.vitro.testing.AbstractTestClass;
+import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreeMarkerHttpServlet;
import freemarker.template.Configuration;
public class FreeMarkerHttpServletTest extends AbstractTestClass {