diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/MiscWebUtils.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/MiscWebUtils.java index 7b577df7d..0c3e8b10d 100755 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/MiscWebUtils.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/MiscWebUtils.java @@ -80,51 +80,55 @@ public class MiscWebUtils { return (String) contentObj; } - // Get custom short view from either the object's class or one of its - // superclasses. - // This is needed because the inference update happens asynchronously, so - // when a new - // property has been added and the page is reloaded, the custom short view - // from a - // superclass may not have been inferred yet. public static String getCustomShortView(HttpServletRequest request) { - VitroRequest vreq = new VitroRequest(request); - VClassDao vcDao = vreq.getWebappDaoFactory().getVClassDao(); - String customShortView = null; Individual object = ((ObjectPropertyStatement) request .getAttribute("opStmt")).getObject(); - List vclasses = object.getVClasses(true); // get directly - // asserted vclasses - Set superClasses = new HashSet(); + return getCustomShortView(object, request); + } - // First try directly asserted classes, there is no useful decision - // mechanism for - // the case where two directly asserted classes have a custom short - // view. - for (VClass vclass : vclasses) { - // Use this class's custom short view, if there is one - customShortView = vclass.getCustomShortView(); - if (customShortView != null) { - return customShortView; - } - // Otherwise, add superclass to list of vclasses to check for custom - // short views - String vclassUri = vclass.getURI(); - superClasses.addAll(vcDao.getAllSuperClassURIs(vclassUri)); - } + // Get custom short view from either the object's class or one of its + // superclasses. This is needed because the inference update happens asynchronously, + // so when a new property has been added and the page is reloaded, the custom short view + // from a superclass may not have been inferred yet. - // Next try super classes. There is no useful decision mechanism for - // the case where two super classes have a custom short view. - for (String superClassUri : superClasses) { - VClass vc = vcDao.getVClassByURI(superClassUri); - customShortView = vc.getCustomShortView(); - if (customShortView != null) { - return customShortView; - } - } + public static String getCustomShortView(Individual individual, HttpServletRequest request) { + VitroRequest vreq = new VitroRequest(request); + VClassDao vcDao = vreq.getWebappDaoFactory().getVClassDao(); + + String customShortView = null; + List vclasses = individual.getVClasses(true); // get directly + // asserted vclasses + Set superClasses = new HashSet(); + + // First try directly asserted classes, there is no useful decision + // mechanism for the case where two directly asserted classes + // have a custom short view. + // RY If we're getting the custom short view with reference to an object property. + // should we use the property's getRangeVClass() method instead? + for (VClass vclass : vclasses) { + // Use this class's custom short view, if there is one + customShortView = vclass.getCustomShortView(); + if (customShortView != null) { + return customShortView; + } + // Otherwise, add superclass to list of vclasses to check for custom + // short views + String vclassUri = vclass.getURI(); + superClasses.addAll(vcDao.getAllSuperClassURIs(vclassUri)); + } + + // Next try super classes. There is no useful decision mechanism for + // the case where two super classes have a custom short view. + for (String superClassUri : superClasses) { + VClass vc = vcDao.getVClassByURI(superClassUri); + customShortView = vc.getCustomShortView(); + if (customShortView != null) { + return customShortView; + } + } - return null; + return null; } /** diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/InputElementFormattingTag.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/InputElementFormattingTag.java index 353bbe44e..e7b8fb6b5 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/InputElementFormattingTag.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/InputElementFormattingTag.java @@ -432,6 +432,12 @@ public class InputElementFormattingTag extends TagSupport { out.print(""); if (definitionTags) { out.print(""); } out.println(); + } else if( getType().equalsIgnoreCase("hidden")) { + String valueStr = doValue(editConfig, editSub); + if (definitionTags) { out.print("
"); } + out.print(""); + if (definitionTags) { out.print("
"); } + out.println(); } else if (getType().equalsIgnoreCase("textarea")) { String valueStr = doValue(editConfig, editSub); String rowStr = doRows(); diff --git a/webapp/web/edit/forms/propDelete.jsp b/webapp/web/edit/forms/propDelete.jsp index 5da9c5fd7..cf35bb4f3 100644 --- a/webapp/web/edit/forms/propDelete.jsp +++ b/webapp/web/edit/forms/propDelete.jsp @@ -21,6 +21,7 @@ <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils" %> <%@ page import="com.hp.hpl.jena.rdf.model.Model" %> +<%@page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%> <%@ page import="java.util.List" %> @@ -104,25 +105,18 @@ public WebappDaoFactory getUnfilteredDaoFactory() { if( object == null ) { //log.warn("Could not find object individual "+objectUri+" via wdf.getIndividualDao().getIndividualByURI(objectUri)"); request.setAttribute("objectName","(name unspecified)"); - } else if (FrontEndEditingUtils.isVitroNsObjProp(predicateUri)) { + } else if (FrontEndEditingUtils.isVitroNsObjProp(predicateUri)) { Model model = (Model)application.getAttribute("jenaOntModel"); request.setAttribute("individual", object); request.setAttribute("objectName", FrontEndEditingUtils.getVitroNsObjDisplayName(predicateUri, object, model)); log.debug("setting object name " + (String)request.getAttribute("objectName") + " for vitro namespace object property " + predicateUri); } else { - for (VClass clas : object.getVClasses()) { - request.setAttribute("rangeClassName", clas.getName()); + customShortView = MiscWebUtils.getCustomShortView(object, request); + if (customShortView != null) { foundClass = true; - customShortView = clas.getCustomShortView(); - - if (customShortView != null && customShortView.trim().length()>0) { - log.debug("setting object name from VClass custom short view"); - request.setAttribute("customShortView",shortViewPrefix + customShortView.trim()); - request.setAttribute("individual",object); - } else { - log.debug("No custom short view for class, so setting object name from object individual name"); - request.setAttribute("objectName",object.getName()); - } + log.debug("setting object name from VClass custom short view"); + request.setAttribute("customShortView",shortViewPrefix + customShortView.trim()); + request.setAttribute("individual",object); } if (!foundClass) { VClass clas = prop.getRangeVClass(); diff --git a/webapp/web/edit/processRdfForm2.jsp b/webapp/web/edit/processRdfForm2.jsp index 59c1bcf26..53ab2cf7b 100644 --- a/webapp/web/edit/processRdfForm2.jsp +++ b/webapp/web/edit/processRdfForm2.jsp @@ -13,7 +13,6 @@ <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Generator" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmissionPreprocessor" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field" %> <%@ page import="java.io.StringReader" %> <%@ page import="java.util.*" %> diff --git a/webapp/web/templates/entity/entityMergedPropsListUngrouped.jsp b/webapp/web/templates/entity/entityMergedPropsListUngrouped.jsp index c711629c6..39185c14d 100644 --- a/webapp/web/templates/entity/entityMergedPropsListUngrouped.jsp +++ b/webapp/web/templates/entity/entityMergedPropsListUngrouped.jsp @@ -26,6 +26,7 @@ <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.VClass" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %> <%@ page import="edu.cornell.mannlib.vedit.beans.LoginFormBean" %> +<%@page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%> <%@ page import="java.util.Collection" %> <%@ page import="java.util.Collections" %> @@ -34,13 +35,14 @@ <%@ page import="java.util.ArrayList" %> <%@ page import="java.util.Iterator" %> <%@ page import="java.util.HashSet" %> +<%@page import="java.util.LinkedList"%> +<%@page import="java.util.Set"%> <%@ page import="org.apache.commons.logging.Log" %> <%@ page import="org.apache.commons.logging.LogFactory" %> -<%@page import="java.util.LinkedList"%> -<%@page import="java.util.Set"%> -<%@page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%> + + <%! public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.templates.entity.entityMergedPropsList.jsp"); %>