Fix link to individual list page

This commit is contained in:
rjy7 2010-05-18 17:38:47 +00:00
parent 269b89825f
commit 6741f7d586
5 changed files with 101 additions and 9 deletions

View file

@ -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";

View file

@ -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);
}
}
}

View file

@ -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";