@@ -510,7 +495,7 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.
-<% if( mode == 4 ){ %>
+<% if( mode == EditMode.ERROR ){ %>
This form is unable to handle the editing of this role because it is associated with
multiple ${param.roleActivityTypeLabel} individuals.
<% }else{ %>
diff --git a/productMods/edit/forms/personHasPositionHistory.jsp b/productMods/edit/forms/personHasPositionHistory.jsp
index b39b9f82..921f5f47 100644
--- a/productMods/edit/forms/personHasPositionHistory.jsp
+++ b/productMods/edit/forms/personHasPositionHistory.jsp
@@ -19,6 +19,9 @@
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Css" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.elements.DateTimeWithPrecision"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field"%>
+<%@page import="edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement"%>
+<%@page import="edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils"%>
+<%@page import="edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode"%>
<%@ page import="org.apache.commons.logging.Log" %>
<%@ page import="org.apache.commons.logging.LogFactory" %>
@@ -37,6 +40,29 @@
request.setAttribute("stringDatatypeUriJson", MiscWebUtils.escape(XSD.xstring.toString()));
request.setAttribute("gYearDatatypeUriJson", MiscWebUtils.escape(XSD.gYear.toString()));
+
+/*
+ There are 4 modes that this form can be in:
+ 1. Add, there is a subject and a predicate but no position and nothing else.
+
+ 2. normal edit where everything should already be filled out. There is a subject, a object and an individual on
+ the other end of the object's core:personInOrganization stmt.
+
+ 3. Repair a bad role node. There is a subject, prediate and object but there is no individual on the
+ other end of the object's core:personInOrganization stmt. This should be similar to an add but the form should be expanded.
+
+ 4. Really bad node. multiple core:personInOrganization statements.
+*/
+
+ EditMode mode = FrontEndEditingUtils.getEditMode(request, "http://vivoweb.org/ontology/core#positionInOrganization");
+
+ if( mode == EditMode.ADD ) {
+ %> <%
+ } else if(mode == EditMode.EDIT){
+ %> <%
+ } else if(mode == EditMode.REPAIR){
+ %> <%
+ }
%>
@@ -210,24 +236,19 @@
-<%-- Configure add vs. edit --%>
-<%
-
- String objectUri = (String) request.getAttribute("objectUri");
- if (objectUri != null) { // editing existing entry
-%>
-
-
-
-
-<%
- } else { // adding new entry
-%>
-
+<%-- Configure add vs. edit --%>
+
+
-<% } %>
+
+
+
+
+ ${editMode == "repair" ? "" : "" }
+
+
{
@@ -356,7 +377,7 @@
<%
- log.debug(request.getAttribute("editjson"));
+ //log.debug(request.getAttribute("editjson"));
EditConfiguration editConfig = EditConfiguration.getConfigFromSession(session,request);
if (editConfig == null) {
@@ -375,6 +396,7 @@
Model model = (Model) application.getAttribute("jenaOntModel");
+ String objectUri = (String) request.getAttribute("objectUri");
if (objectUri != null) { // editing existing
editConfig.prepareForObjPropUpdate(model);
} else { // adding new
@@ -398,6 +420,11 @@
+<% if( mode == EditMode.ERROR ){ %>
+ This form is unable to handle the editing of this position because it is associated with
+ multiple Position individuals.
+<% }else{ %>
+
${titleVerb} position entry for <%= subjectName %>
" >
@@ -441,8 +468,10 @@
var customFormData = {
acUrl: '${acUrl}',
editMode: '${editMode}',
- submitButtonTextType: 'compound'
+ submitButtonTextType: 'compound',
+ defaultTypeName: 'organization' // used in repair mode, to generate button text and org name field label
};
+<% } %>