From 6b6cef2e71f637546598e50dd61798630a2bc895 Mon Sep 17 00:00:00 2001 From: bdc34 Date: Sat, 3 Apr 2010 00:29:42 +0000 Subject: [PATCH] Removing more portal filtering NIHVIVO-194 --- .../webapp/filters/VitroRequestPrep.java | 2 +- .../vitro/webapp/flags/PortalFlag.java | 6 ++-- .../webapp/flags/RequestToPortalFlag.java | 28 +++++++++---------- webapp/web/templates/browse/browseGroup.jsp | 18 +++++++----- 4 files changed, 30 insertions(+), 24 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/filters/VitroRequestPrep.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/filters/VitroRequestPrep.java index 3066dacc6..f5767dcd3 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/filters/VitroRequestPrep.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/filters/VitroRequestPrep.java @@ -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){ diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/flags/PortalFlag.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/flags/PortalFlag.java index 1ec31b186..48f6aae88 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/flags/PortalFlag.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/flags/PortalFlag.java @@ -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 *************************/ diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/flags/RequestToPortalFlag.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/flags/RequestToPortalFlag.java index afce950da..79118c9a9 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/flags/RequestToPortalFlag.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/flags/RequestToPortalFlag.java @@ -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; diff --git a/webapp/web/templates/browse/browseGroup.jsp b/webapp/web/templates/browse/browseGroup.jsp index a248c642b..cd3c24c29 100644 --- a/webapp/web/templates/browse/browseGroup.jsp +++ b/webapp/web/templates/browse/browseGroup.jsp @@ -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"%> - + +<%@page import="com.hp.hpl.jena.vocabulary.OWL"%> <% /*********************************************** 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; %> -
  • <%=theClass.getName()%> (<%=theClass.getEntityCount()%>)
  • + 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; %> +
  • <%=theClass.getName()%> (<%=theClass.getEntityCount()%>)
  • <% } }%>