Improve output: distinguish between failed assertions (failures) and unexpected exceptions (errors), and print a filtered stack trace for any exception.

This commit is contained in:
jeb228 2010-01-29 22:13:57 +00:00
commit 4f2e303079
1839 changed files with 235630 additions and 0 deletions

View file

@ -0,0 +1,54 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.flags.PortalFlagChoices" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ page errorPage="/error.jsp"%>
<% /***********************************************
Displays the little group of things at the bottom of the page
for administrators and editors.
request.attributes:
an Entity object with the name "entity"
request.parameters:
None, should only work with requestScope attributes for security reasons.
Consider sticking < % = MiscWebUtils.getReqInfo(request) % > in the html output
for debugging info.
bdc34 2006-01-22 created
**********************************************/
Individual entity=(Individual)request.getAttribute("entity");
if (entity == null){
String e="entityAdmin.jsp expects that request attribute 'entity' be set to the Entity object to display.";
throw new JspException(e);
}
%>
<c:if test="${sessionScope.loginHandler != null &&
sessionScope.loginHandler.loginStatus == 'authenticated' &&
sessionScope.loginHandler.loginRole >= sessionScope.loginHandler.editor }">
<c:set var='entity' value='${requestScope.entity}'/><%/* just moving this into page scope for easy use */ %>
<c:set var='portal' value='${requestScope.portal}'/>
<div class='admin top'>
<h3 class="toggle">Admin Panel</h3>
<div class="panelContents">
<c:url var="editHref" value="/entityEdit">
<c:param name="home" value="${currentPortalId}"/>
<c:param name="uri" value="${entity.URI}"/>
</c:url>
<a href='<c:out value="${editHref}"/>'> edit this individual</a> |
<c:url var="cloneHref" value="/cloneEntity">
<c:param name="home" value="${currentPortalId}"/>
<c:param name="uri" value="${entity.URI}"/>
</c:url>
<a href='<c:out value="${cloneHref}"/>'> clone this individual </a>
<p>Resource URI: <c:out value="${entity.URI}"/></p>
</div>
</div>
</c:if>

View file

@ -0,0 +1,172 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.VClass" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission" %>
<%@ page import="edu.cornell.mannlib.vedit.beans.LoginFormBean" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %>
<%@ page import="org.apache.commons.logging.Log" %>
<%@ page import="org.apache.commons.logging.LogFactory" %>
<%@ page import="java.util.List" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://vitro.mannlib.cornell.edu/vitro/tags/StringProcessorTag" prefix="p" %>
<%@ page errorPage="/error.jsp"%>
<%!
public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.templates.entity.entityBasic.jsp");
%>
<%
log.debug("Starting entityBasic.jsp");
Individual entity = (Individual)request.getAttribute("entity");
%>
<c:if test="${!empty entityURI}">
<c:set var="myEntityURI" scope="request" value="${entityURI}"/>
<%
try {
VitroRequest vreq = new VitroRequest(request);
entity = vreq.getWebappDaoFactory().getIndividualDao().getIndividualByURI((String)request.getAttribute("myEntityURI"));
System.out.println("entityBasic rendering "+entity.getURI());
} catch (Exception e) {
e.printStackTrace();
}
%>
</c:if>
<%
if (entity == null){
String e="entityBasic.jsp expects that request attribute 'entity' be set to the Entity object to display.";
throw new JspException(e);
}
if (VitroRequestPrep.isSelfEditing(request) || LoginFormBean.loggedIn(request, LoginFormBean.NON_EDITOR) /* minimum level*/) {
request.setAttribute("showSelfEdits",Boolean.TRUE);
}%>
<c:if test="${sessionScope.loginHandler != null &&
sessionScope.loginHandler.loginStatus == 'authenticated' &&
sessionScope.loginHandler.loginRole >= LoginFormBean.NON_EDITOR}">
<c:set var="showCuratorEdits" value="${true}"/>
</c:if>
<c:set var='imageDir' value='images' />
<c:set var="themeDir"><c:out value="${portalBean.themeDir}" /></c:set>
<%
//here we build up the url for the larger image.
String imageUrl = null;
if (entity.getImageFile() != null &&
entity.getImageFile().indexOf("http:")==0) {
imageUrl = entity.getImageFile();
} else {
imageUrl = response.encodeURL( "/images/" + entity.getImageFile() );
}
//anytime we are at an entity page we shouldn't have an editing config or submission
session.removeAttribute("editjson");
EditConfiguration.clearAllConfigsInSession(session);
EditSubmission.clearAllEditSubmissionsInSession(session);
%>
<c:set var='entity' value='${requestScope.entity}'/><%/* just moving this into page scope for easy use */ %>
<c:set var='entityMergedPropsListJsp' value='/entityMergedPropList'/>
<c:set var='portal' value='${currentPortalId}'/>
<c:set var='portalBean' value='${currentPortal}'/>
<c:set var='themeDir'><c:out value='${portalBean.themeDir}' /></c:set>
<div id="content">
<jsp:include page="entityAdmin.jsp"/>
<div class='contents entity'>
<div id="label">
<c:choose>
<c:when test="${!empty relatedSubject}">
<h2><p:process>${relatingPredicate.domainPublic} for ${relatedSubject.name}</p:process></h2>
<c:url var="backToSubjectLink" value="/entity">
<c:param name="home" value="${portalBean.portalId}"/>
<c:param name="uri" value="${relatedSubject.URI}"/>
</c:url>
<p><a href="${backToSubjectLink}">&larr; return to ${relatedSubject.name}</a></p>
</c:when>
<c:otherwise>
<h2><p:process>${entity.name}</p:process></h2>
<c:if test="${!empty entity.moniker}">
<p:process><em class="moniker">${entity.moniker}</em></p:process>
</c:if>
</c:otherwise>
</c:choose>
</div><!-- entity label -->
<c:if test="${ (!empty entity.anchor) || (!empty entity.linksList) }">
<ul class="externalLinks">
<c:if test="${!empty entity.anchor}">
<c:choose>
<c:when test="${!empty entity.url}">
<c:url var="entityUrl" value="${entity.url}" />
<li class="primary"><a class="externalLink" href="<c:out value="${entityUrl}"/>"><p:process>${entity.anchor}</p:process></a></li>
</c:when>
<c:otherwise>
<li class="primary"><span class="externalLink"><p:process>${entity.anchor}</p:process></span></li>
</c:otherwise>
</c:choose>
</c:if>
<c:if test="${!empty entity.linksList }">
<c:forEach items="${entity.linksList}" var='link' varStatus="count">
<c:url var="linkUrl" value="${link.url}" />
<c:choose>
<c:when test="${empty entity.url && count.first==true}"><li class="first"></c:when>
<c:otherwise><li></c:otherwise>
</c:choose>
<a class="externalLink" href="<c:out value="${linkUrl}"/>"><p:process>${link.anchor}</p:process></a></li>
</c:forEach>
</c:if>
</ul>
</c:if>
<c:if test="${!empty entity.imageThumb}">
<div class="thumbnail">
<c:if test="${!empty entity.imageFile}">
<c:url var="imageUrl" value="/${imageDir}/${entity.imageFile}" />
<a class="image" href="${imageUrl}">
</c:if>
<c:url var="imageSrc" value='/${imageDir}/${entity.imageThumb}'/>
<img src="<c:out value="${imageSrc}"/>" title="click to view larger image in new window" alt="" width="150"/>
<c:if test="${!empty entity.imageFile}"></a></c:if>
</div>
<c:if test="${!empty entity.citation}">
<div class="citation">${entity.citation}</div>
</c:if>
</c:if>
<p:process>
<div class='description'>${entity.blurb}</div>
<div class='description'>${entity.description}</div>
</p:process>
<c:choose>
<c:when test="${showCuratorEdits || showSelfEdits}">
<c:import url="${entityMergedPropsListJsp}">
<c:param name="mode" value="edit"/>
<c:param name="grouped" value="false"/>
<%-- unless a value is provided, properties not assigned to a group will not have a tab or appear on the page --%>
<c:param name="unassignedPropsGroupName" value=""/>
</c:import>
</c:when>
<c:otherwise>
<c:import url="${entityMergedPropsListJsp}">
<c:param name="grouped" value="false"/>
<%-- unless a value is provided, properties not assigned to a group will not have a tab or appear on the page --%>
<c:param name="unassignedPropsGroupName" value=""/>
</c:import>
</c:otherwise>
</c:choose>
<p/>
<p:process>
<c:if test="${(!empty entity.citation) && (empty entity.imageThumb)}">
<div class="citation">${entity.citation}</div>
</c:if>
<c:if test="${!empty entity.keywordString}">
<p id="keywords">Keywords: ${entity.keywordString}</p>
</c:if>
</p:process>
${requestScope.servletButtons}
</div>
</div> <!-- content -->

View file

@ -0,0 +1,64 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://vitro.mannlib.cornell.edu/vitro/tags/PropertyEditLink" prefix="edLnk" %>
<%@ page import="edu.cornell.mannlib.vedit.beans.LoginFormBean" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.KeywordProperty" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.KeywordDao" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Keyword" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.KeywordIndividualRelation" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.KeywordIndividualRelationDao" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %>
<%@ page import="org.apache.commons.logging.Log" %>
<%@ page import="org.apache.commons.logging.LogFactory" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.List" %>
<%@ taglib uri="http://vitro.mannlib.cornell.edu/vitro/tags/StringProcessorTag" prefix="p" %>
<%!
public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.templates.entity.entityKeywordsList.jsp");
%>
<%
if (!LoginFormBean.loggedIn(request, LoginFormBean.CURATOR)) {%>
<c:redirect url="<%= Controllers.LOGIN %>" />
<%
}
Individual ent = (Individual)request.getAttribute("entity");
if (ent==null) {
log.error("No incoming entity in entityKeywordsList.jsp");
}
VitroRequest vreq = new VitroRequest(request);
KeywordProperty kProp = new KeywordProperty("has keyword","keywords",0,null);
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
KeywordIndividualRelationDao kirDao = wdf.getKeys2EntsDao();
KeywordDao kDao = wdf.getKeywordDao();
List<KeywordIndividualRelation> kirs = kirDao.getKeywordIndividualRelationsByIndividualURI(ent.getURI());
if (kirs != null) {
int keyCount=0;
Iterator kirIt = kirs.iterator();
while (kirIt.hasNext()) {
KeywordIndividualRelation kir = (KeywordIndividualRelation) kirIt.next();
if (kir.getKeyId() > 0) {
Keyword k = kDao.getKeywordById(kir.getKeyId());
if (k != null) {
++keyCount;
if (keyCount==1) {%>
<h3 class="propertyName">Keywords</h3>
<div class="datatypePropertyValue">
<% } else { %>
<c:out value=", "/>
<% }%>
<c:out value="<%=k.getTerm()%>"/>
<% }
}
}%>
</div><%
}
%>

View file

@ -0,0 +1,103 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%><%/* this odd thing points to something in web.xml */ %>
<%@ page errorPage="/error.jsp"%>
<% /***********************************************
Display a List of Entities in the most basic fashion.
request.attributes:
a List of Entity objects with the name "entities"
portal id as "portal"
request.parameters:
None yet.
Consider sticking < % = MiscWebUtils.getReqInfo(request) % > in the html output for debugging info.
bdc34 2006-01-27 created
**********************************************/
if (request.getAttribute("entities") == null){
String e="entityList.jsp expects that request attribute 'entities' be set to a List of Entity objects.";
throw new JspException(e);
}
%>
<c:set var='entities' value='${requestScope.entities}' /><%/* just moving this into page scope for easy use */ %>
<c:set var='portal' value='${requestScope.portal}' />
<c:set var='title' value='${requestScope.title}' />
<c:set var='subTitle' value='${requestScope.subTitle}' />
<div id="content">
<div class="contents">
<div class="entityList">
<h2>${title}</h2>
<c:if test="${!empty subTitle}"><h4>${subTitle}"</h4></c:if>
<% /* <p>${pageTime} milliseconds</p> */ %>
<ul>
<c:forEach items='${entities}' var='ent'>
<li>
<c:forEach items="${ent.VClasses}" var="type">
<c:if test="${!empty type.customSearchView}">
<c:set var="altRenderJsp" value="${type.customSearchView}"/>
</c:if>
</c:forEach>
<c:url var="entHref" value="/entity">
<c:param name="home" value="${portal.portalId}"/>
<c:param name="uri" value="${ent.URI}"/>
</c:url>
<a href='<c:out value="${entHref}"/>'><p:process><c:out value="${ent.name}"/></p:process></a>
<c:choose>
<c:when test="${!empty ent.moniker}">
| <p:process><c:out value="${ent.moniker}"/></p:process>
</c:when>
<c:otherwise>
<c:out value="${ent.VClass.name}"/>
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${!empty altRenderJsp}">
<c:set scope="request" var="individual" value="${ent}"/>
<c:if test="${!empty ent.url}">
<%-- decide here whether to render a link on the included page by setting individualUrl in the request scope --%>
<c:set scope="request" var="individualURL" value="${ent.url}"/>
</c:if>
<c:catch var="e">
<jsp:include page="/templates/search/${altRenderJsp}" flush="true"/>
<c:remove var="altRenderJsp"/>
</c:catch>
<c:if test="${e != null}">
<!-- unable to include ${altRenderJsp} -->
</c:if>
</c:when>
<c:otherwise>
<c:if test="${!empty ent.anchor}"> |
<c:choose>
<c:when test="${!empty ent.url}">
<c:url var="entUrl" value="${ent.url}" />
<a class="externalLink" href='<c:out value="${entUrl}"/>'><c:out value="${ent.anchor}"/></a>
</c:when>
<c:otherwise>
<i><c:out value="${ent.anchor}"/></i>
</c:otherwise>
</c:choose>
</c:if>
<c:forEach items='${ent.linksList}' var="entLink">
| <c:url var="entLinkUrl" value="${entLink.url}" />
<a class="externalLink" href="<c:out value='${entLinkUrl}'/>"><c:out value="${entLink.anchor}"/></a>
</c:forEach>
</c:otherwise>
</c:choose>
</li>
</c:forEach>
</ul>
</div> <!--end entityList-->
<% /* add supplementary text provided by controllers such as "CoAuthorServlet" */ %>
<c:if test="${!empty requestScope.suppText}">
${requestScope.suppText}
</c:if>
</div> <!--end contents-->
</div><!-- end content -->

View file

@ -0,0 +1,63 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ page import="java.util.*,edu.cornell.mannlib.vitro.webapp.beans.Individual"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%><%/* this odd thing points to something in web.xml */ %>
<%@ page errorPage="/error.jsp"%>
<% /***********************************************
Display a List of Entities in the most basic fashion.
request.attributes:
a List of Entity objects with the name "entities"
portal id as "portal"
request.parameters:
"rows" is number of rows in gallery table
"columns" is number of columns in gallery table
Consider sticking < % = MiscWebUtils.getReqInfo(request) % > in the html output for debugging info.
bdc34 2006-01-27 created
**********************************************/
if (request.getAttribute("entities") == null){
String e="entityListForTabs.jsp expects that request attribute 'entities' be set to a List of Entity objects.";
throw new JspException(e);
}
%>
<c:set var='entities' value='${requestScope.entities}' /><%/* just moving this into page scope for easy use */ %>
<c:set var='portal' value='${requestScope.portal}' />
<c:set var='count' value='0'/>
<c:set var='rows'>
<c:out value="${requestScope.rows}" default="3"/>
</c:set>
<c:set var='columns'>
<c:out value="${requestScope.columns}" default="8"/>
</c:set>
<c:set var='IMG_DIR' value='images/' />
<c:set var='IMG_WIDTH' value='100'/>
<table class='tabEntities entityListForGalleryTab'>
<c:forEach var='row' begin="1" end="${rows}" step="1">
<tr>
<c:forEach var='col' begin="1" end="${columns}" step="1">
<c:set var='ent' value='${entities[count]}'/>
<c:set var='count' value='${count + 1}'/>
<c:if test="${ not empty ent and not empty ent.imageThumb}">
<td>
<c:url var="entityHref" value="/entity">
<c:param name="home" value="${portal.portalId}"/>
<c:param name="uri" value="${ent.URI}"/>
</c:url>
<a class="image" href="<c:out value="${entityHref}"/>" >
<c:url var="imageSrc" value="${IMG_DIR}${ent.imageThumb}"/>
<img width="${IMG_WIDTH}" src="<c:out value="${imageSrc}"/>" title="${ent.name}" alt="${ent.name}" />
</a>
</td>
</c:if>
</c:forEach>
</tr>
</c:forEach>
</table>

View file

@ -0,0 +1,96 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ 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/jsp/jstl/fmt" prefix="fmt" %>
<%@ page errorPage="/error.jsp"%>
<% /***********************************************
Display a list of entities for a tab.
request.attributes:
a List of Entity objects with the name "entities"
portal id as "portal"
request.parameters:
None yet.
Consider sticking < % = MiscWebUtils.getReqInfo(request) % > in the html output for debugging info.
bdc34 2006-01-27 created
**********************************************/
if (request.getAttribute("entities") == null){
String e="entityListForTabs.jsp expects that request attribute 'entities' be set to a List of Entity objects.";
throw new JspException(e);
}
%>
<c:set var="searchViewPrefix" value="/templates/search/"/>
<c:set var='entities' value='${requestScope.entities}' /><%/* just moving this into page scope for easy use */ %>
<c:set var='portal' value='${requestScope.portal}' />
<c:set var='IMG_DIR' value='images/' />
<c:set var='IMG_WIDTH' value='75'/>
<jsp:include page="/templates/alpha/alphaIndex.jsp"/>
<ul class='tabEntities entityListForTab'>
<c:forEach items='${entities}' var='ent'>
<c:url var="entHref" value="/entity">
<c:param name="home" value="${sessionScope.currentPortalId}"/>
<c:param name="uri" value="${ent.URI}"/>
</c:url>
<li>
<a href='<c:out value="${entHref}"/>'>${ent.name}</a>
<c:if test="${!empty ent.moniker}">
<span class="tab-moniker">
| <c:out value="${ent.moniker}"/>
</span>
</c:if>
<c:if test="${!empty ent.VClasses}">
<c:forEach items="${ent.VClasses}" var="type">
<c:if test="${!empty type.customSearchView}">
<c:set var="customSearchView" value="${type.customSearchView}"/>
</c:if>
</c:forEach>
</c:if>
<c:set var="anchorText" value="${ent.anchor}"/>
<c:if test="${(!empty customSearchView) && (!empty anchorText)}">
<c:set scope="request" var="individual" value="${ent}"/>
<c:if test="${!empty ent.url}">
<c:set scope="request" var="individualURL" value="${ent.url}"/>
</c:if>
<jsp:include page="${searchViewPrefix}${customSearchView}" flush="true"/>
<c:remove var="individual"/>
<c:remove var="individualURL"/>
<c:remove var="anchorText"/>
</c:if>
<c:if test="${!empty anchorText}">
<span class="tab-extLink"> |
<c:choose>
<c:when test="${!empty ent.url}">
<c:url var="entUrl" value="${ent.url}"/>
<a class="externalLink" href="<c:out value="${entUrl}"/>">${anchorText}</a>
</c:when>
<c:otherwise>
<span style="font-style: italic; text-size: 0.75em;">${anchorText}</span>
</c:otherwise>
</c:choose>
</span>
</c:if>
<c:forEach items='${ent.linksList}' var="entLink"><span class="tab-extLink"> | <c:url var="entLinkUrl" value="${entLink.url}"/><a class="externalLink" href="<c:out value="${entLinkUrl}"/>">${entLink.anchor}</a></span></c:forEach>
<c:choose>
<c:when test='${not empty ent.imageThumb }'>
<c:url var="imageHref" value="entity">
<c:param name="home" value="${sessionScope.currentPortalId}"/>
<c:param name="uri" value="${ent.URI}"/>
</c:url>
<c:url var="imageSrc" value="${IMG_DIR}${ent.imageThumb}"/>
<div class="tab-image"><a class="image" href="<c:out value="${imageHref}"/>"><img width="${IMG_WIDTH}" src="<c:out value="${imageSrc}"/>" title="${ent.name}" alt="" /></a></div>
<c:if test="${not empty ent.blurb}"><div class='blurb'>${ent.blurb}</div></c:if>
</c:when>
<c:otherwise>
<c:if test="${not empty ent.blurb}"><div class='blurb'>${ent.blurb}</div></c:if>
</c:otherwise>
</c:choose>
</li>
</c:forEach>
</ul>

View file

@ -0,0 +1,298 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://vitro.mannlib.cornell.edu/vitro/tags/PropertyEditLink" prefix="edLnk" %>
<%@ taglib uri="http://vitro.mannlib.cornell.edu/vitro/tags/StringProcessorTag" prefix="p" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Portal" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.PropertyInstanceDao" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.PropertyInstance" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Property" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.KeywordProperty" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.PropertyGroup" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.PropertyGroupDao" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataProperty" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.RdfLiteralHash" %>
<%@ page import="java.util.Collection" %>
<%@ page import="java.util.Collections" %>
<%@ page import="java.util.Comparator" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.HashSet" %>
<%@ page import="org.apache.commons.logging.Log" %>
<%@ page import="org.apache.commons.logging.LogFactory" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %>
<%@ page import="edu.cornell.mannlib.vedit.beans.LoginFormBean" %>
<jsp:useBean id="loginHandler" class="edu.cornell.mannlib.vedit.beans.LoginFormBean" scope="session" />
<%!
public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.templates.entity.entityMergedPropsList.jsp");
%>
<% if( VitroRequestPrep.isSelfEditing(request) ) {
log.debug("setting showSelfEdits true");%>
<c:set var="showSelfEdits" value="${true}"/>
<% }
if (loginHandler!=null && loginHandler.getLoginStatus()=="authenticated" && Integer.parseInt(loginHandler.getLoginRole())>=loginHandler.getNonEditor()) {
log.debug("setting showCuratorEdits true");%>
<c:set var="showCuratorEdits" value="${true}"/>
<c:set var='themeDir'><c:out value='${portalBean.themeDir}' /></c:set>
<% }
String unassignedPropGroupName=null;
String unassignedName = (String) request.getAttribute("unassignedPropsGroupName");
if (unassignedName != null && unassignedName.length()>0) {
unassignedPropGroupName=unassignedName;
log.debug("found temp group attribute \""+unassignedName+"\" for unassigned properties");
}%>
<c:set var='entity' value='${requestScope.entity}'/><%-- just moving this into page scope for easy use --%>
<c:set var='portal' value='${requestScope.portalBean}'/><%-- likewise --%>
<c:set var="hiddenDivCount" value="0"/>
<% Individual subject = (Individual) request.getAttribute("entity");
if (subject==null) {
throw new Error("Subject individual must be in request scope for entityMergedPropsList.jsp");
}
// Nick wants not to use explicit parameters to trigger visibility of a div, but for now we don't just want to always show the 1st one
String openingGroupLocalName = (String) request.getParameter("curgroup");
VitroRequest vreq = new VitroRequest(request);
// added to permit distinguishing links outside the current portal
int currentPortalId = -1;
Portal currentPortal = vreq.getPortal();
if (currentPortal!=null) {
currentPortalId = currentPortal.getPortalId();
}
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
PropertyGroupDao pgDao = wdf.getPropertyGroupDao();
ArrayList<PropertyGroup> groupsList = (ArrayList) request.getAttribute("groupsList");
if (groupsList!=null && groupsList.size()>0) { // first do the list of headers
if (groupsList.size()==1) {
for (PropertyGroup pg : groupsList) {
if (unassignedPropGroupName != null && !unassignedPropGroupName.equalsIgnoreCase(pg.getName())) {
log.debug("only one group ["+pg.getName() +"] so rendering without group headers");
}
request.setAttribute("mergedList",pg.getPropertyList());
}
%><jsp:include page="entityMergedPropsListUngrouped.jsp" flush="true"/><%
return;
}%>
<%--
<ul id="profileCats">
<% for (PropertyGroup pg : groupsList ) {
if (openingGroupLocalName == null || openingGroupLocalName.equals("")) {
openingGroupLocalName = pg.getLocalName();
}
String styleStr = "display: inline;";
if (openingGroupLocalName.equals(pg.getLocalName())) {%>
<li class="currentCat"><a id="currentCat" href="#<%=pg.getLocalName()%>" title="<%=pg.getName()%>"><%=pg.getName()%></a></li>
<% } else { %>
<li><a href="#<%=pg.getLocalName()%>" title="<%=pg.getName()%>"><%=pg.getName()%></a></li>
<% }
} %>
</ul>
--%>
<% // now display the properties themselves, by group
for (PropertyGroup g : groupsList) {%>
<c:set var="group" value="<%=g%>"/>
<c:set var="groupStyle" value="display: block;"/>
<c:if test="${group.statementCount==0}"><c:set var="groupStyle" value="display: block"/></c:if>
<%-- Getting the count of properties in each group --%>
<c:set var="counter" value="0"/>
<c:set var="propTotal" value="0"/>
<% int propTotal = g.getPropertyList().size(); %>
<c:set var="propTotal" value="<%=propTotal%>" />
<div class="propsCategory" id="<%=g.getLocalName()%>">
<h3><strong><%=g.getName()%></strong></h3>
<div class="propsWrap">
<% for (Property p : g.getPropertyList()) {%>
<% if (p instanceof ObjectProperty) {
ObjectProperty op = (ObjectProperty)p;%>
<c:set var="objProp" value="<%=op%>"/>
<c:set var="editableInSomeWay" value="${false}"/>
<c:if test="${showSelfEdits || showCuratorEdits}">
<edLnk:editLinks item="${objProp}" var="links" />
<c:if test="${!empty links}">
<c:set var="editableInSomeWay" value="${true}"/>
</c:if>
</c:if>
<c:set var="objStyle" value="display: block;"/>
<c:set var="objRows" value="${fn:length(objProp.objectPropertyStatements)}"/>
<c:if test="${objRows==0}"><c:set var="objStyle" value="display: block;"/></c:if>
<c:if test="${editableInSomeWay || objRows>0}">
<c:set var="first" value=""/><c:if test="${counter == 0}"><c:set var="first" value=" first"/></c:if>
<c:set var="last" value=""/><c:if test="${(counter+1) == propTotal}"><c:set var="last" value=" last"/></c:if>
<div class="propsItem${first}${last}" id="${objProp.localName}">
<h4>${objProp.editLabel}</h4>
<c:if test="${showSelfEdits || showCuratorEdits}"><edLnk:editLinks item="${objProp}" icons="false" /></c:if>
<c:set var="displayLimit" value="${objProp.domainDisplayLimit}"/>
<c:if test="${displayLimit<0}">
<c:set var="displayLimit" value="32"/> <% /* arbitrary limit if value is unset, i.e. -1 */ %>
</c:if>
<c:if test="${objRows>0}">
<ul class='properties'>
</c:if>
<c:forEach items="${objProp.objectPropertyStatements}" var="objPropertyStmt">
<li><span class="statementWrap">
<c:set var="opStmt" value="${objPropertyStmt}" scope="request"/>
<c:url var="propertyLink" value="/entity">
<c:param name="home" value="${portal.portalId}"/>
<c:param name="uri" value="${objPropertyStmt.object.URI}"/>
<%--
<% ObjectPropertyStatement oStmt = (ObjectPropertyStatement)request.getAttribute("opStmt");
if (oStmt!=null) {
Individual obj= (Individual)oStmt.getObject();
if (obj != null) {
if (!obj.doesFlag1Match(currentPortalId)) {%>
<c:param name="jump" value="true"/>
<% }
}
}%>
--%>
</c:url>
<c:remove var="opStmt" scope="request"/>
<c:forEach items="${objPropertyStmt.object.VClasses}" var="type">
<c:if test="${!empty type.customShortView}">
<c:set var="altRenderJsp" value="${type.customShortView}"/>
</c:if>
</c:forEach>
<c:choose>
<c:when test="${!empty altRenderJsp}">
<c:set scope="request" var="individual" value="${objPropertyStmt.object}"/>
<c:set scope="request" var="predicateUri" value="${objProp.URI}"/>
<jsp:include page="${altRenderJsp}" flush="true"/>
<c:remove var="altRenderJsp"/>
</c:when>
<c:otherwise>
<a class="propertyLink" href='<c:out value="${propertyLink}"/>'><p:process><c:out value="${objPropertyStmt.object.name}"/></p:process></a>
<c:if test="${!empty objPropertyStmt.object.moniker}">
<p:process><c:out value="| ${objPropertyStmt.object.moniker}"/></p:process>
</c:if>
</c:otherwise>
</c:choose>
<c:if test="${showSelfEdits || showCuratorEdits}">
<c:set var="editLinks"><edLnk:editLinks item="${objPropertyStmt}" icons="false"/></c:set>
<c:if test="${!empty editLinks}"><span class="editLinks">${editLinks}</span></c:if>
<c:if test="${empty editLinks}"><em class="nonEditable">(non-editable)</em></c:if>
</c:if>
</span></li>
</c:forEach>
<c:if test="${objRows > 0}"></ul></c:if>
</div><!-- ${objProp.localName} -->
</c:if>
<% } else if (p instanceof DataProperty) {
DataProperty dp = (DataProperty)p;%>
<c:set var="dataProp" value="<%=dp%>"/>
<c:set var="dataRows" value="${fn:length(dataProp.dataPropertyStatements)}"/>
<c:set var="dataStyle" value="display: block;"/>
<c:set var="displayLimit" value="${dataProp.displayLimit}"/>
<c:if test="${dataRows==0}"><c:set var="dataStyle" value="display: block;"/></c:if>
<c:set var="first" value=""/><c:if test="${counter == 0}"><c:set var="first" value=" first"/></c:if>
<c:set var="last" value=""/><c:if test="${(counter+1) == propTotal}"><c:set var="last" value=" last"/></c:if>
<c:set var="multiItem" value=""/><c:if test="${dataRows > 1 && displayLimit == 1}"><c:set var="multiItem" value=" multiItem"/></c:if>
<c:set var="addable" value=""/><c:if test="${dataRows >= 1 && displayLimit > 1}"><c:set var="addable" value=" addable"/></c:if>
<div id="${dataProp.localName}" class="propsItem dataItem${first}${last}${multiItem}${addable}" style="${dataStyle}">
<h4>${dataProp.editLabel}</h4>
<c:if test="${showSelfEdits || showCuratorEdits}">
<c:choose>
<c:when test="${dataRows == 1 && displayLimit==1 }">
<%-- just put in a single "edit" link, not an "add" link that expands to reveal edit/delete links --%>
<c:set var="editLinks"><edLnk:editLinks item="${dataProp.dataPropertyStatements[0]}" icons="false"/></c:set>
<c:if test="${!empty editLinks}"><span class="editLinks">${editLinks}</span></c:if>
<c:if test="${empty editLinks}"><em class="nonEditable">(non-editable)</em></c:if>
</c:when>
<c:otherwise><%-- creates an add link, even if displayLimit is unset, i.e. -1 --%>
<edLnk:editLinks item="${dataProp}" icons="false"/>
</c:otherwise>
</c:choose>
</c:if>
<c:if test="${displayLimit<0}">
<%-- set to an arbitrary but high positive limit if unset on property, i.e. -1 --%>
<c:set var="displayLimit" value="32"/>
</c:if>
<c:if test="${fn:length(dataProp.dataPropertyStatements)-displayLimit==1}">
<%-- don't leave just one statement to expand --%>
<c:set var="displayLimit" value="${displayLimit+1}"/>
</c:if>
<%-- c:if test="${displayLimit < 0}"><c:set var="displayLimit" value="20"/></c:if --%>
<c:if test="${dataRows > 0}">
<div class="datatypeProperties">
<c:if test="${dataRows > 1}"><ul class="datatypePropertyValue"></c:if>
<c:if test="${dataRows == 1}"><div class="datatypePropertyValue"></c:if>
<c:forEach items="${dataProp.dataPropertyStatements}" var="dataPropertyStmt">
<p:process>
<c:choose>
<c:when test='${dataRows==1}'>
<span class="statementWrap">
${dataPropertyStmt.data}
<c:if test='${displayLimit>1 && (showSelfEdits || showCuratorEdits)}'>
<c:set var="editLinks"><edLnk:editLinks item="${dataPropertyStmt}" icons="false"/></c:set>
<c:if test="${!empty editLinks}"><span class="editLinks">${editLinks}</span></c:if>
<c:if test="${empty editLinks}"><em class="nonEditable">(non-editable)</em></c:if>
</c:if>
</span>
</c:when>
<c:otherwise>
<li><span class="statementWrap">
${dataPropertyStmt.data}
<c:if test="${dataRows > 1 || displayLimit != 1 }">
<c:if test="${showSelfEdits || showCuratorEdits}">
<c:set var="editLinks"><edLnk:editLinks item="${dataPropertyStmt}" icons="false"/></c:set>
<c:if test="${!empty editLinks}"><span class="editLinks">${editLinks}</span></c:if>
<c:if test="${empty editLinks}"><em class="nonEditable">(non-editable)</em></c:if>
</c:if>
</c:if>
</span></li>
</c:otherwise>
</c:choose>
</p:process>
</c:forEach>
<c:choose>
<c:when test="${dataRows==1}"></div></c:when>
<c:otherwise></ul></c:otherwise>
</c:choose>
</div><!-- datatypeProperties -->
</c:if>
</div><!-- ${dataProp.localName} -->
<% } else { // keyword property -- ignore
if (p instanceof KeywordProperty) {%>
<p>Not expecting keyword properties here.</p>
<% } else {
log.warn("unexpected unknown property type found");%>
<p>Unknown property type found</p>
<% }
}
%><c:set var="counter" value="${counter+1}"/><%
} // end for (Property p : g.getPropertyList()
%>
</div><!-- propsWrap -->
</div><!-- class="propsCategory" -->
<c:if test="${showSelfEdits || showCuratorEdits}">
<a class="backToTop" href="#wrap" title="jump to top of the page">back to top</a>
</c:if>
<% } // end for (PropertyGroup g : groupsList)
} else {
log.debug("incoming groups list with merged properties not found as request attribute for subject "+subject.getName()+"\n");
}
%>

View file

@ -0,0 +1,325 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://vitro.mannlib.cornell.edu/vitro/tags/StringProcessorTag" prefix="p" %>
<%@ taglib uri="http://vitro.mannlib.cornell.edu/vitro/tags/PropertyEditLink" prefix="edLnk" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Portal" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.PropertyInstanceDao" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.PropertyInstance" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Property" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.KeywordProperty" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.PropertyGroup" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.PropertyGroupDao" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataProperty" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.RdfLiteralHash" %>
<%@ page import="java.util.Collection" %>
<%@ page import="java.util.Collections" %>
<%@ page import="java.util.Comparator" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.HashSet" %>
<%@ page import="org.apache.commons.logging.Log" %>
<%@ page import="org.apache.commons.logging.LogFactory" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %>
<%@ page import="edu.cornell.mannlib.vedit.beans.LoginFormBean" %>
<jsp:useBean id="loginHandler" class="edu.cornell.mannlib.vedit.beans.LoginFormBean" scope="session" />
<%!
public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.templates.entity.entityMergedPropsList.jsp");
%>
<c:set var='themeDir'><c:out value='${portalBean.themeDir}' /></c:set>
<% if( VitroRequestPrep.isSelfEditing(request) ) {
log.debug("setting showSelfEdits true");%>
<c:set var="showSelfEdits" value="${true}"/>
<% }
if (loginHandler!=null && loginHandler.getLoginStatus()=="authenticated" && Integer.parseInt(loginHandler.getLoginRole())>=loginHandler.getNonEditor()) {
log.debug("setting showCuratorEdits true");%>
<c:set var="showCuratorEdits" value="${true}"/>
<% }%>
<c:set var='entity' value='${requestScope.entity}'/><%-- just moving this into page scope for easy use --%>
<c:set var='portal' value='${requestScope.portalBean}'/><%-- likewise --%>
<c:set var="hiddenDivCount" value="0"/>
<% Individual subject = (Individual) request.getAttribute("entity");
if (subject==null) {
throw new Error("Subject individual must be in request scope for dashboardPropsList.jsp");
}
// Nick wants not to use explicit parameters to trigger visibility of a div, but for now we don't just want to always show the 1st one
String openingGroupLocalName = (String) request.getParameter("curgroup");
VitroRequest vreq = new VitroRequest(request);
// added to permit distinguishing links outside the current portal
int currentPortalId = -1;
Portal currentPortal = vreq.getPortal();
if (currentPortal!=null) {
currentPortalId = currentPortal.getPortalId();
}
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
PropertyGroupDao pgDao = wdf.getPropertyGroupDao();
ArrayList<Property> propsList = (ArrayList) request.getAttribute("mergedList");
for (Property p : propsList) {%>
<c:set var="stmtCounter" value="0"/>
<% if (p instanceof ObjectProperty) {
ObjectProperty op = (ObjectProperty)p;%>
<c:set var="objProp" value="<%=op%>"/>
<c:set var="editableInSomeWay" value="${false}"/>
<c:if test="${showSelfEdits || showCuratorEdits}">
<edLnk:editLinks item="${objProp}" var="links" />
<c:if test="${!empty links}">
<c:set var="editableInSomeWay" value="${true}"/>
</c:if>
</c:if>
<c:set var="objStyle" value="display: block;"/>
<c:set var="objRows" value="${fn:length(objProp.objectPropertyStatements)}"/>
<c:if test="${objRows==0}"><c:set var="objStyle" value="display: block;"/></c:if>
<c:if test="${editableInSomeWay || objRows>0}">
<c:set var="classForEditControls" value=""/>
<c:if test="${showSelfEdits || showCuratorEdits}"><c:set var="classForEditControls" value=" editing"/></c:if>
<c:set var="uniqueOpropDivName" value="${fn:replace(objProp.localNameWithPrefix,':','-')}"/>
<div class="propsItem ${classForEditControls}" id="${'oprop-'}${uniqueOpropDivName}">
<h3 class="propertyName">${objProp.editLabel}</h3>
<c:if test="${showSelfEdits || showCuratorEdits}"><edLnk:editLinks item="${objProp}" icons="false" /></c:if>
<%-- Verbose property display additions for object properties, using context variable verbosePropertyListing --%>
<c:if test="${showCuratorEdits && verbosePropertyListing}">
<c:url var="propertyEditLink" value="/propertyEdit">
<c:param name="home" value="${portal.portalId}"/>
<c:param name="uri" value="${objProp.URI}"/>
</c:url>
<c:choose>
<c:when test="${!empty objProp.hiddenFromDisplayBelowRoleLevel.label}"><c:set var="displayCue" value="${objProp.hiddenFromDisplayBelowRoleLevel.label}"/></c:when>
<c:otherwise><c:set var="displayCue" value="unspecified"/></c:otherwise>
</c:choose>
<c:choose>
<c:when test="${!empty objProp.prohibitedFromUpdateBelowRoleLevel.label}"><c:set var="updateCue" value="${objProp.prohibitedFromUpdateBelowRoleLevel.label}"/></c:when>
<c:otherwise><c:set var="updateCue" value="unspecified"/></c:otherwise>
</c:choose>
<c:choose>
<c:when test="${!empty objProp.localNameWithPrefix}"><c:set var="localName" value="${objProp.localNameWithPrefix}"/></c:when>
<c:otherwise><c:set var="localName" value="no local name"/></c:otherwise>
</c:choose>
<c:choose>
<c:when test="${!empty objProp.domainDisplayTier}"><c:set var="displayTier" value="${objProp.domainDisplayTier}"/></c:when>
<c:otherwise><c:set var="displayTier" value="blank"/></c:otherwise>
</c:choose>
<c:choose>
<c:when test="${!empty objProp.groupURI}">
<% PropertyGroup pg = pgDao.getGroupByURI(op.getGroupURI());
if (pg!=null && pg.getName()!=null) {
request.setAttribute("groupName",pg.getName());%>
<span style="color: grey; font-size: 0.75em;"><a class="propertyLink" href="${propertyEditLink}"/>${localName}</a> (object property); display tier ${displayTier} within group ${groupName}; display level: ${displayCue}; update level: ${updateCue}</span>
<% } else {%>
<span style="color: grey; font-size: 0.75em;"><a class="propertyLink" href="${propertyEditLink}"/>${localName}</a> (object property); display tier ${displayTier}; display level: ${displayCue}; update level: ${updateCue}</span>
<% } %>
</c:when>
<c:otherwise>
<span style="color: grey; font-size: 0.75em;"><a class="propertyLink" href="${propertyEditLink}"/>${localName}</a> (object property); display tier ${displayTier}; display level: ${displayCue}; update level: ${updateCue}</span>
</c:otherwise>
</c:choose>
</c:if>
<%-- end Verbose property display additions for object properties --%>
<c:set var="displayLimit" value="${objProp.domainDisplayLimit}"/>
<c:if test="${displayLimit<0}">
<c:set var="displayLimit" value="32"/> <% /* arbitrary limit if value is unset, i.e. -1 */ %>
</c:if>
<c:if test="${fn:length(objProp.objectPropertyStatements)-displayLimit==1}"><c:set var="displayLimit" value="${displayLimit+1}"/></c:if>
<c:if test="${objRows>0}">
<ul class='properties'>
</c:if>
<c:forEach items="${objProp.objectPropertyStatements}" var="objPropertyStmt">
<c:if test="${stmtCounter == displayLimit}"><!-- set up toggle div and expandable continuation div -->
</ul>
<c:set var="hiddenDivCount" value="${hiddenDivCount+1}"/>
<c:url var="themePath" value="/${themeDir}site_icons" />
<div class="navlinkblock ">
<span class="entityMoreSpan">
<c:out value='${objRows - stmtCounter}' />
<c:choose>
<c:when test='${displayLimit==0}'> entries</c:when>
<c:otherwise> more</c:otherwise>
</c:choose>
</span>
<div class="extraEntities">
<ul class="properties">
</c:if>
<li><span class="statementWrap">
<c:set var="opStmt" value="${objPropertyStmt}" scope="request"/>
<c:url var="propertyLink" value="/entity">
<c:param name="home" value="${portal.portalId}"/>
<c:param name="uri" value="${objPropertyStmt.object.URI}"/>
<%--
<% ObjectPropertyStatement oStmt = (ObjectPropertyStatement)request.getAttribute("opStmt");
if (oStmt!=null) {
Individual obj= (Individual)oStmt.getObject();
if (obj != null) {
if (!obj.doesFlag1Match(currentPortalId)) {%>
<c:param name="jump" value="true"/>
<% }
}
}%>
--%>
</c:url>
<c:remove var="opStmt" scope="request"/>
<c:forEach items="${objPropertyStmt.object.VClasses}" var="type">
<c:if test="${!empty type.customShortView}">
<c:set var="altRenderJsp" value="${type.customShortView}"/>
</c:if>
</c:forEach>
<c:choose>
<c:when test="${!empty altRenderJsp}">
<c:set scope="request" var="individual" value="${objPropertyStmt.object}"/>
<c:set scope="request" var="predicateUri" value="${objProp.URI}"/>
<jsp:include page="${altRenderJsp}" flush="true"/>
<c:remove var="altRenderJsp"/>
</c:when>
<c:otherwise>
<a class="propertyLink" href='<c:out value="${propertyLink}"/>'><p:process><c:out value="${objPropertyStmt.object.name}"/></p:process></a>
<c:if test="${!empty objPropertyStmt.object.moniker}">
<p:process><c:out value="| ${objPropertyStmt.object.moniker}"/></p:process>
</c:if>
</c:otherwise>
</c:choose>
<c:if test="${showSelfEdits || showCuratorEdits}">
<c:set var="editLinks"><edLnk:editLinks item="${objPropertyStmt}" icons="false"/></c:set>
<c:if test="${!empty editLinks}"><span class="editLinks">${editLinks}&nbsp;</span></c:if>
<c:if test="${empty editLinks}"><em class="nonEditable">(non-editable) </em></c:if>
</c:if>
</span></li>
<c:set var="stmtCounter" value="${stmtCounter+1}"/>
</c:forEach>
<c:if test="${objRows > 0}"></ul></c:if>
<c:if test="${stmtCounter > displayLimit}">
</div><%-- navlinkblock --%>
</div><%-- extraEntities --%></c:if>
</div><!-- ${objProp.localNameWithPrefix} -->
</c:if>
<% } else if (p instanceof DataProperty) {
DataProperty dp = (DataProperty)p;%>
<c:set var="dataProp" value="<%=dp%>"/>
<c:set var="dataRows" value="${fn:length(dataProp.dataPropertyStatements)}"/>
<c:set var="dataStyle" value="display: block;"/>
<c:if test="${dataRows==0}"><c:set var="dataStyle" value="display: block;"/></c:if>
<c:set var="classForEditControls" value=""/>
<c:if test="${showSelfEdits || showCuratorEdits}"><c:set var="classForEditControls" value=" editing"/></c:if>
<c:set var="uniqueDpropDivName" value="${fn:replace(dataProp.localNameWithPrefix,':','-')}"/>
<div id="${'dprop-'}${uniqueDpropDivName}" class="propsItem ${classForEditControls}" style="${dataStyle}">
<h3 class="propertyName">${dataProp.editLabel}</h3>
<c:if test="${showSelfEdits || showCuratorEdits}"><edLnk:editLinks item="${dataProp}" icons="false"/></c:if>
<%-- Verbose property display additions for data properties, using context variable verbosePropertyListing --%>
<c:if test="${showCuratorEdits && verbosePropertyListing}">
<c:url var="propertyEditLink" value="/datapropEdit">
<c:param name="home" value="${portal.portalId}"/>
<c:param name="uri" value="${dataProp.URI}"/>
</c:url>
<c:choose>
<c:when test="${!empty dataProp.hiddenFromDisplayBelowRoleLevel.label}"><c:set var="displayCue" value="${dataProp.hiddenFromDisplayBelowRoleLevel.label}"/></c:when>
<c:otherwise><c:set var="displayCue" value="unspecified"/></c:otherwise>
</c:choose>
<c:choose>
<c:when test="${!empty dataProp.prohibitedFromUpdateBelowRoleLevel.label}"><c:set var="updateCue" value="${dataProp.prohibitedFromUpdateBelowRoleLevel.label}"/></c:when>
<c:otherwise><c:set var="updateCue" value="unspecified"/></c:otherwise>
</c:choose>
<c:choose>
<c:when test="${!empty dataProp.localNameWithPrefix}"><c:set var="localName" value="${dataProp.localNameWithPrefix}"/></c:when>
<c:otherwise><c:set var="localName" value="no local name"/></c:otherwise>
</c:choose>
<c:choose>
<c:when test="${!empty dataProp.displayTier}"><c:set var="displayTier" value="${dataProp.displayTier}"/></c:when>
<c:otherwise><c:set var="displayTier" value="blank"/></c:otherwise>
</c:choose>
<c:choose>
<c:when test="${!empty dataProp.groupURI}">
<% PropertyGroup pg = pgDao.getGroupByURI(dp.getGroupURI());
if (pg!=null && pg.getName()!=null) {
request.setAttribute("groupName",pg.getName());%>
<span style="color: grey; font-size: 0.75em;"><a class="propertyLink" href="${propertyEditLink}"/>${localName}</a> (data property); display tier ${displayTier} within group ${groupName}; display level: ${displayCue}; update level: ${updateCue}</span>
<% } else {%>
<span style="color: grey; font-size: 0.75em;"><a class="propertyLink" href="${propertyEditLink}"/>${localName}</a> (data property); display tier ${displayTier}; display level: ${displayCue}; update level: ${updateCue}</span>
<% } %>
</c:when>
<c:otherwise>
<span style="color: grey; font-size: 0.75em;"><a class="propertyLink" href="${propertyEditLink}"/>${localName}</a> (data property); display tier ${displayTier}; display level: ${displayCue}; update level: ${updateCue}</span>
</c:otherwise>
</c:choose>
</c:if>
<%-- end Verbose property display additions for data properties --%>
<c:set var="displayLimit" value="${dataProp.displayLimit}"/>
<c:if test="${displayLimit<0}">
<c:set var="displayLimit" value="32"/> <% /* arbitrary limit if value is unset, i.e. -1 */ %>
</c:if>
<c:if test="${fn:length(dataProp.dataPropertyStatements)-displayLimit==1}"><c:set var="displayLimit" value="${displayLimit+1}"/></c:if>
<c:if test="${displayLimit < 0}"><c:set var="displayLimit" value="20"/></c:if>
<c:if test="${!empty dataProp.dataPropertyStatements}"><div class="datatypeProperties"></c:if>
<c:if test="${dataRows > 1}">
<ul class="datatypePropertyValue">
</c:if>
<c:if test="${dataRows == 1}">
<div class="datatypePropertyValue"><span class="statementWrap">
</c:if>
<c:forEach items="${dataProp.dataPropertyStatements}" var="dataPropertyStmt">
<c:if test="${stmtCounter == displayLimit}">
<c:if test="${dataRows > 1 && displayLimit < 0}"></ul></c:if>
<div class="navlinkblock ">
<span class="entityMoreSpan">
<c:out value='${dataRows - stmtCounter}' />
<c:choose>
<c:when test='${displayLimit==0}'> entries</c:when>
<c:otherwise> more</c:otherwise>
</c:choose>
</span>
<div class="extraEntities">
</c:if>
<c:set var="stmtCounter" value="${stmtCounter+1}"/>
<c:choose>
<c:when test='${dataRows==1}'>
<p:process>${dataPropertyStmt.data}</p:process>
<c:if test="${showSelfEdits || showCuratorEdits}">
<c:set var="editLinks"><edLnk:editLinks item="${dataPropertyStmt}" icons="false"/></c:set>
<c:if test="${!empty editLinks}"><span class="editLinks">${editLinks}&nbsp;</span></c:if>
<c:if test="${empty editLinks}"><em class="nonEditable">(non-editable) </em></c:if>
</c:if>
</c:when>
<c:otherwise>
<li><span class="statementWrap">
<p:process>${dataPropertyStmt.data}</p:process>
<c:if test="${showSelfEdits || showCuratorEdits}">
<c:set var="editLinks"><edLnk:editLinks item="${dataPropertyStmt}" icons="false"/></c:set>
<c:if test="${!empty editLinks}"><span class="editLinks">${editLinks}&nbsp;</span></c:if>
<c:if test="${empty editLinks}"><em class="nonEditable">(non-editable) </em></c:if>
</c:if>
</span></li>
</c:otherwise>
</c:choose>
<c:if test="${dataRows==1}"></span></div></c:if>
</c:forEach>
<c:if test="${stmtCounter > displayLimit}"></div></div></c:if>
<c:if test="${!empty dataProp.dataPropertyStatements}"></div><!-- datatypeProperties --></c:if>
</div><!-- ${dataProp.localNameWithPrefix} -->
<% } else { // keyword property -- ignore
if (p instanceof KeywordProperty) {%>
<p>Not expecting keyword properties here.</p>
<% } else {
log.warn("unexpected unknown property type found");%>
<p>Unknown property type found</p>
<% }
}
} // end for (Property p : g.getPropertyList()
%>

View file

@ -0,0 +1,36 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<% /***********************************************
This file is used to inject <link> and <script> elements
into the head element of the generated source of a VITRO
page that is being displayed by the entity controller.
In other words, anything like domain.com/entity?...
will have the lines specified here added in the <head>
of the page.
This is a great way to specify JavaScript or CSS files
at the entity display level as opposed to globally.
Example:
<link rel="stylesheet" type="text/css" href="/css/entity.css"/>" media="screen"/>
<script type="text/javascript" src="/js/jquery.js"></script>
****************************************************/ %>
<c:url var="jquery" value="/js/jquery.js"/>
<c:url var="getURLParam" value="/js/jquery_plugins/getURLParam.js"/>
<c:url var="colorAnimations" value="/js/jquery_plugins/colorAnimations.js"/>
<c:url var="propertyGroupSwitcher" value="/js/propertyGroupSwitcher.js"/>
<c:url var="vitroControls" value="/js/controls.js"/>
<c:url var="jqueryForm" value="/js/jquery_plugins/jquery.form.js"/>
<c:url var="tinyMCE" value="/js/tiny_mce/tiny_mce.js"/>
<script type="text/javascript" src="${jquery}"></script>
<script type="text/javascript" src="${getURLParam}"></script>
<script type="text/javascript" src="${colorAnimations}"></script>
<script type="text/javascript" src="${propertyGroupSwitcher}"></script>
<script type="text/javascript" src="${jqueryForm}"></script>
<script type="text/javascript" src="${tinyMCE}"></script>
<script type="text/javascript" src="${vitroControls}"></script>

View file

@ -0,0 +1,54 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Link" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %>
<%@ page import="org.apache.commons.logging.Log" %>
<%@ page import="org.apache.commons.logging.LogFactory" %>
<%!
public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.templates.entity.linkShortView.jsp");
%>
<%-- this comes in as an attribute called "individual" but the object has to be created as a Link using the Link dao getLinkByURI() method in order to render correctly
when the link uri may sometimes be of XSD type anyURI and sometimes of XSD type string --%>
<%
Individual ind = (Individual)request.getAttribute("individual");
WebappDaoFactory wdf = (WebappDaoFactory)getServletContext().getAttribute("webappDaoFactory");
if (wdf!=null) {
Link link = wdf.getLinksDao().getLinkByURI(ind.getURI());
if (link!=null) {
request.setAttribute("linkIndividual", link);
} else {
log.error("Cannot create linkIndividual from individual "+ind.getUrl());
}
} else {
log.error("Cannot create WebappDaoFactory in linkShortView.jsp");
}%>
<c:choose>
<c:when test="${!empty linkIndividual}">
<c:choose>
<c:when test="${!empty linkIndividual.anchor}">
<c:choose>
<c:when test="${!empty linkIndividual.url}">
<c:url var="link" value="${linkIndividual.url}" />
<a class="externalLink" href="<c:out value="${link}"/>">${linkIndividual.anchor}</a>
</c:when>
<c:otherwise>
<c:out value="${linkIndividual.anchor}"/>
</c:otherwise>
</c:choose>
</c:when>
<c:otherwise>
<c:out value="link anchor is not populated"/>
</c:otherwise>
</c:choose>
</c:when>
<c:otherwise>
<c:out value="link individual not found ..."/>
</c:otherwise>
</c:choose>