Removing more portal filtering NIHVIVO-194

This commit is contained in:
bdc34 2010-04-03 00:29:42 +00:00
parent 5da58324b8
commit 6b6cef2e71
4 changed files with 30 additions and 24 deletions

View file

@ -140,7 +140,7 @@ public class VitroRequestPrep implements Filter {
return;
}
vreq.setPortal(portal);
portalFlag = new PortalFlag((HttpServletRequest)request,_appbean, portal);
portalFlag = new PortalFlag((HttpServletRequest)request,_appbean, portal, wdf);
vreq.setPortalFlag(portalFlag);
}
}catch(FlagException ex){

View file

@ -9,6 +9,7 @@ import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
import edu.cornell.mannlib.vitro.webapp.utils.FlagMathUtils;
import edu.cornell.mannlib.vitro.webapp.flags.RequestToPortalFlag;
@ -118,10 +119,11 @@ public class PortalFlag {
* Use this to make a new PortalFlag from the http request and the ServletContext.
*
* @param req
* @param wdf TODO
*/
public PortalFlag(HttpServletRequest req,ApplicationBean appBean, Portal portalBean)
public PortalFlag(HttpServletRequest req,ApplicationBean appBean, Portal portalBean, WebappDaoFactory wdf)
throws FlagException {
RequestToPortalFlag.preparePortalStateForFiltering(this, req,appBean,portalBean);
RequestToPortalFlag.preparePortalStateForFiltering(this, req,appBean,portalBean,wdf);
}
/******************* methods *************************/

View file

@ -2,21 +2,20 @@
package edu.cornell.mannlib.vitro.webapp.flags;
import edu.cornell.mannlib.vedit.beans.LoginFormBean;
import edu.cornell.mannlib.vitro.webapp.flags.PortalFlag;
import edu.cornell.mannlib.vitro.webapp.flags.FlagException;
import edu.cornell.mannlib.vitro.webapp.flags.AuthFlag;
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.utils.FlagMathUtils;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.Arrays;
import java.util.Set;
import java.util.HashSet;
import edu.cornell.mannlib.vedit.beans.LoginFormBean;
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
import edu.cornell.mannlib.vitro.webapp.utils.FlagMathUtils;
/**
* Created by IntelliJ IDEA.
@ -145,7 +144,7 @@ public class RequestToPortalFlag {
*/
public static void preparePortalStateForFiltering(PortalFlag portalFlag, HttpServletRequest req,
ApplicationBean appBean, Portal portalBean) throws FlagException {
ApplicationBean appBean, Portal portalBean, WebappDaoFactory wdf) throws FlagException {
VitroRequest request = new VitroRequest(req);
@ -163,7 +162,8 @@ public class RequestToPortalFlag {
portalFlag.flag3Active=appBean.isFlag3Active() ;
if( !portalBean.isFlag1Filtering()
|| "nofiltering".equals(req.getParameter("flag1")) ) {
|| "nofiltering".equals(req.getParameter("flag1"))
|| wdf.getApplicationDao().isFlag1Active() ) {
portalFlag.flag1Active=false;
portalFlag.flag2Active=false;
portalFlag.flag3Active=false;

View file

@ -6,7 +6,8 @@
<%@ page import="java.util.Iterator" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %><%/* this odd thing points to something in web.xml */ %>
<%@ page errorPage="/error.jsp"%>
<jsp:useBean id="loginHandler" class="edu.cornell.mannlib.vedit.beans.LoginFormBean" scope="session" />
<%@page import="com.hp.hpl.jena.vocabulary.OWL"%><jsp:useBean id="loginHandler" class="edu.cornell.mannlib.vedit.beans.LoginFormBean" scope="session" />
<% /***********************************************
Display Browse Results (the "Index" menu command)
@ -66,12 +67,15 @@ if( request.getAttribute("classgroupsIsEmpty") != null && ((Boolean)request.getA
while (classIter.hasNext()) {
classObj = classIter.next();
if (classObj!=null && classObj instanceof VClass) {
VClass theClass=(VClass)classObj;
String linkStr=response.encodeURL("entitylist");
if (theClass.getURI() == null)
theClass.setURI("null://null");
String queryStr="?vclassId="+URLEncoder.encode(theClass.getURI(),"UTF-8")+additionalParameterStr; %>
<li><a href="<%=linkStr+queryStr%>"><%=theClass.getName()%></a> (<%=theClass.getEntityCount()%>)</li>
VClass theClass=(VClass)classObj;
//filter out owl:Thing
if( theClass.getName() == null || OWL.Thing.getURI().equals(theClass.getURI()))
continue;
String linkStr=response.encodeURL("entitylist");
if (theClass.getURI() == null)
theClass.setURI("null://null");
String queryStr="?vclassId="+URLEncoder.encode(theClass.getURI(),"UTF-8")+additionalParameterStr; %>
<li><a href="<%=linkStr+queryStr%>"><%=theClass.getName()%></a> (<%=theClass.getEntityCount()%>)</li>
<% }
}%>
</ul>