<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%> <%@ page import="java.lang.Integer"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.flags.PortalFlagChoices" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.flags.AuthFlag" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.flags.PortalFlag" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Portal" %> <%@ page errorPage="/error.jsp"%> <% /*********************************************** Display A Form for filling out Portal Flags request.attributes: PortalFlag object via attribute "portalState". request.parameters: None yet. Consider sticking < % = MiscWebUtils.getReqInfo(request) % > in the html output for debugging info. This was written by jc55 and split into this file from browseGroups.jsp by bdc34. **********************************************/ PortalFlag portalFilterState = (PortalFlag) request.getAttribute("portalFlag"); if (portalFilterState == null) { String e = "portalFlagChoices.jsp expects that request attribute 'portalFlag' be set to a portal state [PortalFlag] object."; throw new JspException(e); } AuthFlag authFlag = (AuthFlag) request.getAttribute("authFlag"); if (authFlag == null) { String e = "portalFlagChoices.jsp expects that request attribute 'authFlag' be set to a authorization state [AuthFlag] object."; throw new JspException(e); } ApplicationBean appBean = (ApplicationBean) request.getAttribute("appBean"); if (appBean == null) { String e = "portalFlagChoices.jsp expects request attribute 'appBean' be set to an application bean object"; throw new JspException(e); } Portal portal = (Portal) request.getAttribute("portalBean"); if( portal == null ) portal = new Portal(); int portalId = portal.getPortalId(); %> <% String width1Str=request.getParameter("width1"); int width1=14; if (width1Str!=null && !width1Str.equals("")) { try { width1=Integer.parseInt(width1Str); } catch (NumberFormatException ex) { throw new JspException("Error: width1 parameter cannot be decoded as integer in portalFlagChoices.jsp"); } } %>
<% // Draw the appropriate checkboxes if they have been populated // We are dealing with 3 situations for showing portal options in browsing: // #1 For normal browsing (not in one of the application's shared portals [the CALS research portals] the user has 2 radio button choices: // ___ [portal appName] only OR ___ don't filter // // #2 When browsing in one of the application's shared portals [1 of the 4 CALS research portals or the composite "All CALS Research" portal], // the user has the same number of checkbox choices as there are shared portals (e.g, 4 for CALS) // Optionally limit to: // ___ New life sciences ___ Environmental sciences ___ Land grant mission ___ Applied social sciences // // #3 When an editor has logged in and starts browsing, all portals with an id less <= the application's maxPortalId are always shown as options // unless filters are turned completely off by an incoming request parameter boolean haveFlag1Choices=false; if (appBean.isFlag1Active()&& appBean.getFlag1List()!=null && appBean.getFlag1List().size()>1) { if (portalFilterState.getFlag1DisplayStatus()==PortalFlag.SHOW_SHARED_PORTALS || authFlag.getUserSecurityLevel()>=ApplicationBean.FILTER_SECURITY_LEVEL) { haveFlag1Choices=true;%> <% } } String actionStr=request.getParameter("action"); boolean haveFlag2Choices=false; if (appBean.isFlag2Active() && appBean.getFlag2List()!=null && appBean.getFlag2List().size()>1 && (actionStr==null || (actionStr.equals("browse") && authFlag.getUserSecurityLevel()>=ApplicationBean.FILTER_SECURITY_LEVEL))) { haveFlag2Choices=true;%> <% } boolean haveFlag3Choices=false; if (appBean.isFlag3Active() && appBean.getFlag3List()!=null && appBean.getFlag3List().size()>1 && (actionStr==null || (actionStr.equals("browse") && authFlag.getUserSecurityLevel()>=ApplicationBean.FILTER_SECURITY_LEVEL))) { haveFlag3Choices=true;%> <% } //if (actionStr!=null && actionStr.equals("browse")){ if (haveFlag1Choices || haveFlag2Choices || haveFlag3Choices) {%> <% }%>
/> limit to /> omit <%=PortalFlagChoices.getFlag1Choices(portalFilterState,appBean,portalId)%>
/> limit to /> omit <%=PortalFlagChoices.getFlag2Choices(portalFilterState, appBean)%>
/> limit to /> omit <%=PortalFlagChoices.getFlag3Choices(portalFilterState,appBean,portal)%>
filter as indicated above <% if (authFlag.getUserSecurityLevel()>=appBean.FILTER_SECURITY_LEVEL) {%> don't filter at all<% }%>