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; return;
} }
vreq.setPortal(portal); vreq.setPortal(portal);
portalFlag = new PortalFlag((HttpServletRequest)request,_appbean, portal); portalFlag = new PortalFlag((HttpServletRequest)request,_appbean, portal, wdf);
vreq.setPortalFlag(portalFlag); vreq.setPortalFlag(portalFlag);
} }
}catch(FlagException ex){ }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.ApplicationBean;
import edu.cornell.mannlib.vitro.webapp.beans.Portal; 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.utils.FlagMathUtils;
import edu.cornell.mannlib.vitro.webapp.flags.RequestToPortalFlag; 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. * Use this to make a new PortalFlag from the http request and the ServletContext.
* *
* @param req * @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 { throws FlagException {
RequestToPortalFlag.preparePortalStateForFiltering(this, req,appBean,portalBean); RequestToPortalFlag.preparePortalStateForFiltering(this, req,appBean,portalBean,wdf);
} }
/******************* methods *************************/ /******************* methods *************************/

View file

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

View file

@ -6,7 +6,8 @@
<%@ page import="java.util.Iterator" %> <%@ page import="java.util.Iterator" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %><%/* this odd thing points to something in web.xml */ %> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %><%/* this odd thing points to something in web.xml */ %>
<%@ page errorPage="/error.jsp"%> <%@ 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) Display Browse Results (the "Index" menu command)
@ -67,11 +68,14 @@ if( request.getAttribute("classgroupsIsEmpty") != null && ((Boolean)request.getA
classObj = classIter.next(); classObj = classIter.next();
if (classObj!=null && classObj instanceof VClass) { if (classObj!=null && classObj instanceof VClass) {
VClass theClass=(VClass)classObj; VClass theClass=(VClass)classObj;
String linkStr=response.encodeURL("entitylist"); //filter out owl:Thing
if (theClass.getURI() == null) if( theClass.getName() == null || OWL.Thing.getURI().equals(theClass.getURI()))
theClass.setURI("null://null"); continue;
String queryStr="?vclassId="+URLEncoder.encode(theClass.getURI(),"UTF-8")+additionalParameterStr; %> String linkStr=response.encodeURL("entitylist");
<li><a href="<%=linkStr+queryStr%>"><%=theClass.getName()%></a> (<%=theClass.getEntityCount()%>)</li> 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> </ul>