Updates for n3 editing and freemarker conversion. Also fixing propDelete.jsp's reference to freemarker configuration loading to include correct method call.
This commit is contained in:
parent
23b55d2ae6
commit
591af24749
15 changed files with 356 additions and 112 deletions
|
@ -6,7 +6,7 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.net.URLEncoder;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@ -37,6 +37,7 @@ import com.hp.hpl.jena.rdf.model.StmtIterator;
|
||||||
import com.hp.hpl.jena.vocabulary.RDF;
|
import com.hp.hpl.jena.vocabulary.RDF;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Utils;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||||
|
@ -75,9 +76,7 @@ public class DeletePropertyController extends FreemarkerHttpServlet {
|
||||||
} else {
|
} else {
|
||||||
processDataProperty(vreq);
|
processDataProperty(vreq);
|
||||||
}
|
}
|
||||||
//Get subject, predicate uri ,
|
|
||||||
//Redirect
|
|
||||||
//return new TemplateResponseValues(editConfig.getTemplate(), map);
|
|
||||||
String redirectUrl = getRedirectUrl(vreq);
|
String redirectUrl = getRedirectUrl(vreq);
|
||||||
return new RedirectResponseValues(redirectUrl, HttpServletResponse.SC_SEE_OTHER);
|
return new RedirectResponseValues(redirectUrl, HttpServletResponse.SC_SEE_OTHER);
|
||||||
}
|
}
|
||||||
|
@ -89,8 +88,8 @@ public class DeletePropertyController extends FreemarkerHttpServlet {
|
||||||
String predicateUri = EditConfigurationUtils.getPredicateUri(vreq);
|
String predicateUri = EditConfigurationUtils.getPredicateUri(vreq);
|
||||||
int hashIndex = predicateUri.lastIndexOf("#");
|
int hashIndex = predicateUri.lastIndexOf("#");
|
||||||
String localName = predicateUri.substring(hashIndex + 1);
|
String localName = predicateUri.substring(hashIndex + 1);
|
||||||
String redirectUrl = "/entity?uri=" + subjectUri;
|
String redirectUrl = "/entity?uri=" + URLEncoder.encode(subjectUri);
|
||||||
return null;
|
return redirectUrl + "#" + URLEncoder.encode(localName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,7 +112,8 @@ public class DeletePropertyController extends FreemarkerHttpServlet {
|
||||||
return "In delete property controller, could not find object property " + predicateUri;
|
return "In delete property controller, could not find object property " + predicateUri;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DataProperty prop = EditConfigurationUtils.getDataProperty(vreq);
|
DataProperty prop = getDataProperty(vreq);
|
||||||
|
|
||||||
if(prop == null) {
|
if(prop == null) {
|
||||||
return "In delete property controller, could not find data property " + predicateUri;
|
return "In delete property controller, could not find data property " + predicateUri;
|
||||||
}
|
}
|
||||||
|
@ -123,6 +123,18 @@ public class DeletePropertyController extends FreemarkerHttpServlet {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private DataProperty getDataProperty(VitroRequest vreq) {
|
||||||
|
//This is the standard mechanism but note that datapropStmtDelete uses wdf with user aware
|
||||||
|
|
||||||
|
//DataProperty prop = EditConfigurationUtils.getDataProperty(vreq);
|
||||||
|
String editorUri = EditN3Utils.getEditorUri(vreq);
|
||||||
|
WebappDaoFactory wdf = vreq.getWebappDaoFactory().getUserAwareDaoFactory(editorUri);
|
||||||
|
DataProperty prop = wdf.getDataPropertyDao().getDataPropertyByURI(
|
||||||
|
EditConfigurationUtils.getPredicateUri(vreq));
|
||||||
|
return prop;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private TemplateResponseValues doErrorMessage(String errorMessage) {
|
private TemplateResponseValues doErrorMessage(String errorMessage) {
|
||||||
HashMap<String,Object> map = new HashMap<String,Object>();
|
HashMap<String,Object> map = new HashMap<String,Object>();
|
||||||
map.put("errorMessage", errorMessage);
|
map.put("errorMessage", errorMessage);
|
||||||
|
@ -137,33 +149,51 @@ public class DeletePropertyController extends FreemarkerHttpServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteDataPropertyStatement(VitroRequest vreq) {
|
private void deleteDataPropertyStatement(VitroRequest vreq) {
|
||||||
Individual subject = EditConfigurationUtils.getSubjectIndividual(vreq);
|
String subjectUri = EditConfigurationUtils.getSubjectUri(vreq);
|
||||||
//TODO: if null, need to throw or show error
|
|
||||||
int dataHash = getDataHash(vreq);
|
|
||||||
String predicateUri = EditConfigurationUtils.getPredicateUri(vreq);
|
String predicateUri = EditConfigurationUtils.getPredicateUri(vreq);
|
||||||
|
|
||||||
|
int dataHash = EditConfigurationUtils.getDataHash(vreq);
|
||||||
DataPropertyStatement dps = EditConfigurationUtils.getDataPropertyStatement(vreq, vreq.getSession(), dataHash, predicateUri);
|
DataPropertyStatement dps = EditConfigurationUtils.getDataPropertyStatement(vreq, vreq.getSession(), dataHash, predicateUri);
|
||||||
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
|
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(dps != null) {
|
if(dps != null) {
|
||||||
|
logDataPropertyDeletionMessages(dps);
|
||||||
|
processDataPropertyStatement(dps, subjectUri, predicateUri);
|
||||||
wdf.getDataPropertyStatementDao().deleteDataPropertyStatement(dps);
|
wdf.getDataPropertyStatementDao().deleteDataPropertyStatement(dps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private int getDataHash(VitroRequest vreq) {
|
private void processDataPropertyStatement(
|
||||||
int dataHash = 0;
|
DataPropertyStatement dps, String subjectUri, String predicateUri) {
|
||||||
String datapropKey = EditConfigurationUtils.getDataPropKey(vreq);
|
//if no individual Uri set to subject uri
|
||||||
if (datapropKey!=null && datapropKey.trim().length()>0) {
|
if( dps.getIndividualURI() == null || dps.getIndividualURI().trim().length() == 0){
|
||||||
try {
|
log.debug("adding missing subjectURI to DataPropertyStatement" );
|
||||||
dataHash = Integer.parseInt(datapropKey);
|
dps.setIndividualURI( subjectUri );
|
||||||
} catch (NumberFormatException ex) {
|
}
|
||||||
log.error("Cannot decode incoming dataprop key str " + datapropKey + "as integer hash");
|
//if no predicate, set predicate uri
|
||||||
//throw new JspException("Cannot decode incoming datapropKey String value "+datapropKeyStr+" as an integer hash in datapropStmtDelete.jsp");
|
if( dps.getDatapropURI() == null || dps.getDatapropURI().trim().length() == 0){
|
||||||
}
|
log.debug("adding missing datapropUri to DataPropertyStatement");
|
||||||
|
dps.setDatapropURI( predicateUri );
|
||||||
}
|
}
|
||||||
return dataHash;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void logDataPropertyDeletionMessages(DataPropertyStatement dps) {
|
||||||
|
log.debug("attempting to delete dataPropertyStatement: subjectURI <" + dps.getIndividualURI() +">");
|
||||||
|
log.debug( "predicateURI <" + dps.getDatapropURI() + ">");
|
||||||
|
log.debug( "literal \"" + dps.getData() + "\"" );
|
||||||
|
log.debug( "lang @" + (dps.getLanguage() == null ? "null" : dps.getLanguage()));
|
||||||
|
log.debug( "datatype ^^" + (dps.getDatatypeURI() == null ? "null" : dps.getDatatypeURI() ));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//process object property
|
//process object property
|
||||||
private void processObjectProperty(VitroRequest vreq) {
|
private void processObjectProperty(VitroRequest vreq) {
|
||||||
ObjectProperty prop = EditConfigurationUtils.getObjectProperty(vreq);
|
ObjectProperty prop = EditConfigurationUtils.getObjectProperty(vreq);
|
||||||
|
|
|
@ -8,12 +8,16 @@ import java.util.Map;
|
||||||
|
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
import com.hp.hpl.jena.rdf.model.Model;
|
import com.hp.hpl.jena.rdf.model.Model;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
|
||||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash;
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.edit.EditConfigurationTemplateModel;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||||
|
@ -21,6 +25,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||||
|
|
||||||
public class EditConfigurationUtils {
|
public class EditConfigurationUtils {
|
||||||
|
private static Log log = LogFactory.getLog(EditConfigurationUtils.class);
|
||||||
|
|
||||||
protected static final String MULTI_VALUED_EDIT_SUBMISSION = "MultiValueEditSubmission";
|
protected static final String MULTI_VALUED_EDIT_SUBMISSION = "MultiValueEditSubmission";
|
||||||
|
|
||||||
|
@ -159,4 +164,19 @@ public class EditConfigurationUtils {
|
||||||
return dps;
|
return dps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO: Include get object property statement
|
||||||
|
public static int getDataHash(VitroRequest vreq) {
|
||||||
|
int dataHash = 0;
|
||||||
|
String datapropKey = EditConfigurationUtils.getDataPropKey(vreq);
|
||||||
|
if (datapropKey!=null && datapropKey.trim().length()>0) {
|
||||||
|
try {
|
||||||
|
dataHash = Integer.parseInt(datapropKey);
|
||||||
|
} catch (NumberFormatException ex) {
|
||||||
|
log.error("Cannot decode incoming dataprop key str " + datapropKey + "as integer hash");
|
||||||
|
//throw new JspException("Cannot decode incoming datapropKey String value "+datapropKeyStr+" as an integer hash in datapropStmtDelete.jsp");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dataHash;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@ public class EditConfigurationVTwo {
|
||||||
|
|
||||||
EditN3GeneratorVTwo n3generator;
|
EditN3GeneratorVTwo n3generator;
|
||||||
|
|
||||||
private List<ModelChangePreprocessor> modelChangePreprocessors = Collections.emptyList();
|
private List<ModelChangePreprocessor> modelChangePreprocessors;
|
||||||
|
|
||||||
private List<EditSubmissionVTwoPreprocessor> editSubmissionPreprocessors = Collections.emptyList();
|
private List<EditSubmissionVTwoPreprocessor> editSubmissionPreprocessors = Collections.emptyList();
|
||||||
|
|
||||||
|
@ -157,6 +157,7 @@ public class EditConfigurationVTwo {
|
||||||
queryModelSelector = StandardModelSelector.selector;
|
queryModelSelector = StandardModelSelector.selector;
|
||||||
resourceModelSelector = StandardModelSelector.selector;
|
resourceModelSelector = StandardModelSelector.selector;
|
||||||
wdfSelectorForOptons = StandardWDFSelector.selector;
|
wdfSelectorForOptons = StandardWDFSelector.selector;
|
||||||
|
modelChangePreprocessors = new LinkedList<ModelChangePreprocessor>();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Make copy of edit configuration object
|
//Make copy of edit configuration object
|
||||||
|
|
|
@ -237,7 +237,7 @@ public class DefaultAddMissingIndividualFormGenerator implements EditConfigurati
|
||||||
//asserted types string buffer is empty in the original jsp
|
//asserted types string buffer is empty in the original jsp
|
||||||
//TODO: Review original comments in jsp to see what could go here
|
//TODO: Review original comments in jsp to see what could go here
|
||||||
//n3Optional.add(getN3AssertedTypes(vreq));
|
//n3Optional.add(getN3AssertedTypes(vreq));
|
||||||
n3Optional.add(getFlagURI(vreq));
|
n3Optional.add("?" + objectVarName + " rdf:type " + getFlagURI(vreq));
|
||||||
return n3Optional;
|
return n3Optional;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -386,8 +386,10 @@ public class DefaultAddMissingIndividualFormGenerator implements EditConfigurati
|
||||||
//if object property
|
//if object property
|
||||||
if(EditConfigurationUtils.isObjectProperty(EditConfigurationUtils.getPredicateUri(vreq), vreq)){
|
if(EditConfigurationUtils.isObjectProperty(EditConfigurationUtils.getPredicateUri(vreq), vreq)){
|
||||||
Individual objectIndividual = EditConfigurationUtils.getObjectIndividual(vreq);
|
Individual objectIndividual = EditConfigurationUtils.getObjectIndividual(vreq);
|
||||||
if(isForwardToCreateButEdit(vreq) ||
|
if(!isReplaceWithNew(vreq) &&
|
||||||
objectIndividual != null) {
|
(isForwardToCreateButEdit(vreq) ||
|
||||||
|
objectIndividual != null)
|
||||||
|
) {
|
||||||
editConfiguration.prepareForObjPropUpdate(model);
|
editConfiguration.prepareForObjPropUpdate(model);
|
||||||
} else {
|
} else {
|
||||||
//new object to be created
|
//new object to be created
|
||||||
|
|
|
@ -49,8 +49,7 @@ public class EditRequestDispatchController extends FreemarkerHttpServlet {
|
||||||
final String DEFAULT_DATA_FORM = "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.DefaultDataPropertyFormGenerator";
|
final String DEFAULT_DATA_FORM = "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.DefaultDataPropertyFormGenerator";
|
||||||
//TODO: Create this generator
|
//TODO: Create this generator
|
||||||
final String RDFS_LABEL_FORM = "";
|
final String RDFS_LABEL_FORM = "";
|
||||||
final String DEFAULT_ERROR_FORM = "error.jsp";
|
final String DEFAULT_DELETE_FORM = "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.DefaultDeleteGenerator";
|
||||||
final String DEFAULT_ADD_INDIVIDUAL = "defaultAddMissingIndividualForm.jsp";
|
|
||||||
@Override
|
@Override
|
||||||
protected ResponseValues processRequest(VitroRequest vreq) {
|
protected ResponseValues processRequest(VitroRequest vreq) {
|
||||||
|
|
||||||
|
@ -61,9 +60,11 @@ public class EditRequestDispatchController extends FreemarkerHttpServlet {
|
||||||
if(isErrorCondition(vreq)){
|
if(isErrorCondition(vreq)){
|
||||||
return doHelp(vreq, getErrorMessage(vreq));
|
return doHelp(vreq, getErrorMessage(vreq));
|
||||||
}
|
}
|
||||||
//TODO: Check if skip edit form needs to go here or elsewhere
|
|
||||||
//in case form needs to be redirected b/c of special individuals
|
//if edit form needs to be skipped to object instead
|
||||||
// processSkipEditForm(vreq);
|
if(isSkipEditForm(vreq)) {
|
||||||
|
return processSkipEditForm(vreq);
|
||||||
|
}
|
||||||
|
|
||||||
//Get the edit generator name
|
//Get the edit generator name
|
||||||
String editConfGeneratorName = processEditConfGeneratorName(vreq);
|
String editConfGeneratorName = processEditConfGeneratorName(vreq);
|
||||||
|
@ -132,8 +133,12 @@ public class EditRequestDispatchController extends FreemarkerHttpServlet {
|
||||||
String editConfGeneratorName = DEFAULT_OBJ_FORM;
|
String editConfGeneratorName = DEFAULT_OBJ_FORM;
|
||||||
String predicateUri = getPredicateUri(vreq);
|
String predicateUri = getPredicateUri(vreq);
|
||||||
String formParam = getFormParam(vreq);
|
String formParam = getFormParam(vreq);
|
||||||
|
//Handle deletion before any of the other cases
|
||||||
|
if(isDeleteForm(vreq)) {
|
||||||
|
editConfGeneratorName = DEFAULT_DELETE_FORM;
|
||||||
|
}
|
||||||
// *** handle the case where the form is specified as a request parameter ***
|
// *** handle the case where the form is specified as a request parameter ***
|
||||||
if( predicateUri == null && ( formParam != null && !formParam.isEmpty()) ){
|
else if( predicateUri == null && ( formParam != null && !formParam.isEmpty()) ){
|
||||||
//form parameter must be a fully qualified java class name of a EditConfigurationVTwoGenerator implementation.
|
//form parameter must be a fully qualified java class name of a EditConfigurationVTwoGenerator implementation.
|
||||||
editConfGeneratorName = formParam;
|
editConfGeneratorName = formParam;
|
||||||
} else if(isVitroLabel(predicateUri)) { //in case of data property
|
} else if(isVitroLabel(predicateUri)) { //in case of data property
|
||||||
|
@ -170,10 +175,9 @@ public class EditRequestDispatchController extends FreemarkerHttpServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//if skip edit form
|
||||||
//TODO: Implement below correctly or integrate
|
private boolean isSkipEditForm(VitroRequest vreq) {
|
||||||
private ResponseValues processSkipEditForm(VitroRequest vreq) {
|
//Certain predicates may be annotated to change the behavior of the edit
|
||||||
//Certain predicates may be annotated to change the behavior of the edit
|
|
||||||
//link. Check for this annotation and, if present, simply redirect
|
//link. Check for this annotation and, if present, simply redirect
|
||||||
//to the normal individual display for the object URI instead of bringing
|
//to the normal individual display for the object URI instead of bringing
|
||||||
//up an editing form.
|
//up an editing form.
|
||||||
|
@ -183,16 +187,19 @@ public class EditRequestDispatchController extends FreemarkerHttpServlet {
|
||||||
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
|
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
|
||||||
String predicateUri = vreq.getParameter("predicateUri");
|
String predicateUri = vreq.getParameter("predicateUri");
|
||||||
boolean isEditOfExistingStmt = isEditOfExistingStmt(vreq);
|
boolean isEditOfExistingStmt = isEditOfExistingStmt(vreq);
|
||||||
|
return (isEditOfExistingStmt && (wdf.getObjectPropertyDao().skipEditForm(predicateUri)));
|
||||||
|
}
|
||||||
|
|
||||||
if ( isEditOfExistingStmt && (wdf.getObjectPropertyDao().skipEditForm(predicateUri)) ) {
|
//TODO: Implement below correctly or integrate
|
||||||
log.debug("redirecting to object for predicate " + predicateUri);
|
private ResponseValues processSkipEditForm(VitroRequest vreq) {
|
||||||
String redirectPage = vreq.getContextPath() + "/individual";
|
String redirectPage = vreq.getContextPath() + "/individual";
|
||||||
redirectPage += "uri=" + URLEncoder.encode(vreq.getParameter("objectUri")) +
|
String objectUri = EditConfigurationUtils.getObjectUri(vreq);
|
||||||
"&relatedSubjectUri=" + URLEncoder.encode(vreq.getParameter("subjectUri")) +
|
String subjectUri = EditConfigurationUtils.getSubjectUri(vreq);
|
||||||
"&relatingPredicateUri=" + URLEncoder.encode(vreq.getParameter("predicateUri"));
|
String predicateUri = EditConfigurationUtils.getPredicateUri(vreq);
|
||||||
return new RedirectResponseValues(redirectPage, HttpServletResponse.SC_SEE_OTHER);
|
redirectPage += "uri=" + URLEncoder.encode(objectUri) +
|
||||||
}
|
"&relatedSubjectUri=" + URLEncoder.encode(subjectUri) +
|
||||||
return null;
|
"&relatingPredicateUri=" + URLEncoder.encode(predicateUri);
|
||||||
|
return new RedirectResponseValues(redirectPage, HttpServletResponse.SC_SEE_OTHER);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,120 @@
|
||||||
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
|
||||||
|
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.controller;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||||
|
|
||||||
|
import com.hp.hpl.jena.ontology.OntModel;
|
||||||
|
import com.hp.hpl.jena.rdf.model.Model;
|
||||||
|
import com.hp.hpl.jena.rdf.model.Property;
|
||||||
|
|
||||||
|
import com.hp.hpl.jena.rdf.model.Resource;
|
||||||
|
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
||||||
|
import com.hp.hpl.jena.rdf.model.Literal;
|
||||||
|
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.ParamMap;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Route;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.RedirectResponseValues;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.InsertException;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.AdditionsAndRetractions;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditSubmissionUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.MultiValueEditSubmission;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.ProcessRdfForm;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.controller.ProcessRdfFormController.Utilities;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Utils;
|
||||||
|
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.EditLiteral;
|
||||||
|
/**
|
||||||
|
* This servlet will process EditConfigurations with query parameters
|
||||||
|
* to perform an edit.
|
||||||
|
*
|
||||||
|
* TODO: rename this class ProcessN3Edit
|
||||||
|
*/
|
||||||
|
public class PostEditCleanupController extends FreemarkerHttpServlet{
|
||||||
|
|
||||||
|
private Log log = LogFactory.getLog(PostEditCleanupController.class);
|
||||||
|
|
||||||
|
|
||||||
|
//bdc34: this is likely to become a servlet instead of a jsp.
|
||||||
|
// You can get a reference to the servlet from the context.
|
||||||
|
// this will need to be converted from a jsp to something else
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ResponseValues processRequest(VitroRequest vreq) {
|
||||||
|
EditConfigurationVTwo configuration = EditConfigurationVTwo.getConfigFromSession(vreq.getSession(), vreq);
|
||||||
|
if(configuration == null)
|
||||||
|
throw new Error("No edit configuration found.");
|
||||||
|
|
||||||
|
//get the EditSubmission
|
||||||
|
MultiValueEditSubmission submission = new MultiValueEditSubmission(vreq.getParameterMap(), configuration);
|
||||||
|
String entityToReturnTo = ProcessRdfForm.processEntityToReturnTo(configuration, submission, vreq);
|
||||||
|
return doPostEdit(vreq, entityToReturnTo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static RedirectResponseValues doPostEdit(VitroRequest vreq, String resourceToRedirectTo ) {
|
||||||
|
String urlPattern = null;
|
||||||
|
String predicateAnchor = "";
|
||||||
|
HttpSession session = vreq.getSession(false);
|
||||||
|
if( session != null ) {
|
||||||
|
EditConfigurationVTwo editConfig = EditConfigurationVTwo.getConfigFromSession(session,vreq);
|
||||||
|
//In order to support back button resubmissions, don't remove the editConfig from session.
|
||||||
|
//EditConfiguration.clearEditConfigurationInSession(session, editConfig);
|
||||||
|
|
||||||
|
MultiValueEditSubmission editSub = EditSubmissionUtils.getEditSubmissionFromSession(session,editConfig);
|
||||||
|
EditSubmissionUtils.clearEditSubmissionInSession(session, editSub);
|
||||||
|
|
||||||
|
//Get prop local name if it exists
|
||||||
|
String predicateLocalName = Utilities.getPredicateLocalName(editConfig);
|
||||||
|
|
||||||
|
//Get url pattern
|
||||||
|
urlPattern = Utilities.getPostEditUrlPattern(vreq, editConfig);
|
||||||
|
predicateAnchor = Utilities.getPredicateAnchorPostEdit(urlPattern, predicateLocalName);
|
||||||
|
if(predicateAnchor != null && !predicateAnchor.isEmpty()) {
|
||||||
|
vreq.setAttribute("predicateAnchor", predicateAnchor);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//Redirect appropriately
|
||||||
|
if( resourceToRedirectTo != null ){
|
||||||
|
ParamMap paramMap = new ParamMap();
|
||||||
|
paramMap.put("uri", resourceToRedirectTo);
|
||||||
|
paramMap.put("extra","true"); //for ie6
|
||||||
|
return new RedirectResponseValues( UrlBuilder.getPath(urlPattern,paramMap) + predicateAnchor );
|
||||||
|
} else if ( !urlPattern.endsWith("individual") && !urlPattern.endsWith("entity") ){
|
||||||
|
return new RedirectResponseValues( urlPattern );
|
||||||
|
}
|
||||||
|
return new RedirectResponseValues( UrlBuilder.getUrl(Route.LOGIN) );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -65,7 +65,6 @@ public class ProcessRdfFormController extends FreemarkerHttpServlet{
|
||||||
//bdc34: this is likely to become a servlet instead of a jsp.
|
//bdc34: this is likely to become a servlet instead of a jsp.
|
||||||
// You can get a reference to the servlet from the context.
|
// You can get a reference to the servlet from the context.
|
||||||
// this will need to be converted from a jsp to something else
|
// this will need to be converted from a jsp to something else
|
||||||
public static final String POST_EDIT_CLEANUP_JSP = "postEditCleanUp.jsp";
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ResponseValues processRequest(VitroRequest vreq) {
|
protected ResponseValues processRequest(VitroRequest vreq) {
|
||||||
|
@ -111,7 +110,7 @@ public class ProcessRdfFormController extends FreemarkerHttpServlet{
|
||||||
String entityToReturnTo = ProcessRdfForm.processEntityToReturnTo(configuration, submission, vreq);
|
String entityToReturnTo = ProcessRdfForm.processEntityToReturnTo(configuration, submission, vreq);
|
||||||
//For data property processing, need to update edit configuration for back button
|
//For data property processing, need to update edit configuration for back button
|
||||||
ProcessRdfForm.updateEditConfigurationForBackButton(configuration, submission, vreq, writeModel);
|
ProcessRdfForm.updateEditConfigurationForBackButton(configuration, submission, vreq, writeModel);
|
||||||
return doPostEdit(vreq, entityToReturnTo);
|
return PostEditCleanupController.doPostEdit(vreq, entityToReturnTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
//In case of back button confusion
|
//In case of back button confusion
|
||||||
|
@ -209,48 +208,6 @@ public class ProcessRdfFormController extends FreemarkerHttpServlet{
|
||||||
return null; //no errors
|
return null; //no errors
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Is this the equivalent of post Edit Cleanup
|
|
||||||
//Also do we wish to continue setting attributes on the request?
|
|
||||||
|
|
||||||
private RedirectResponseValues doPostEdit(VitroRequest vreq, String resourceToRedirectTo ) {
|
|
||||||
String urlPattern = null;
|
|
||||||
String predicateAnchor = "";
|
|
||||||
HttpSession session = vreq.getSession(false);
|
|
||||||
if( session != null ) {
|
|
||||||
EditConfigurationVTwo editConfig = EditConfigurationVTwo.getConfigFromSession(session,vreq);
|
|
||||||
//In order to support back button resubmissions, don't remove the editConfig from session.
|
|
||||||
//EditConfiguration.clearEditConfigurationInSession(session, editConfig);
|
|
||||||
|
|
||||||
MultiValueEditSubmission editSub = EditSubmissionUtils.getEditSubmissionFromSession(session,editConfig);
|
|
||||||
EditSubmissionUtils.clearEditSubmissionInSession(session, editSub);
|
|
||||||
|
|
||||||
//Get prop local name if it exists
|
|
||||||
String predicateLocalName = Utilities.getPredicateLocalName(editConfig);
|
|
||||||
|
|
||||||
//Get url pattern
|
|
||||||
urlPattern = Utilities.getPostEditUrlPattern(vreq, editConfig);
|
|
||||||
predicateAnchor = Utilities.getPredicateAnchorPostEdit(urlPattern, predicateLocalName);
|
|
||||||
if(predicateAnchor != null && !predicateAnchor.isEmpty()) {
|
|
||||||
vreq.setAttribute("predicateAnchor", predicateAnchor);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//Redirect appropriately
|
|
||||||
if( resourceToRedirectTo != null ){
|
|
||||||
ParamMap paramMap = new ParamMap();
|
|
||||||
paramMap.put("uri", resourceToRedirectTo);
|
|
||||||
paramMap.put("extra","true"); //for ie6
|
|
||||||
return new RedirectResponseValues( UrlBuilder.getPath(urlPattern,paramMap) + predicateAnchor );
|
|
||||||
} else if ( !urlPattern.endsWith("individual") && !urlPattern.endsWith("entity") ){
|
|
||||||
return new RedirectResponseValues( urlPattern );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return new RedirectResponseValues( UrlBuilder.getUrl(Route.LOGIN) );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//Move to EditN3Utils but keep make new uris here
|
//Move to EditN3Utils but keep make new uris here
|
||||||
public static class Utilities {
|
public static class Utilities {
|
||||||
|
|
|
@ -346,6 +346,37 @@ public class EditConfigurationTemplateModel extends BaseTemplateModel {
|
||||||
return getObjectPredicateProperty().getOfferCreateNewOption();
|
return getObjectPredicateProperty().getOfferCreateNewOption();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPropertyName() {
|
||||||
|
if(isObjectProperty()) {
|
||||||
|
return getPropertyPublicDomainTitle().toLowerCase();
|
||||||
|
}
|
||||||
|
if(isDataProperty()) {
|
||||||
|
return getPropertyPublicName();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: Implement statement display
|
||||||
|
public Map<String, String> getStatementDisplay() {
|
||||||
|
Map<String, String> statementDisplay = new HashMap<String, String>();
|
||||||
|
if(isDataProperty()) {
|
||||||
|
statementDisplay.put("dataValue", getDataLiteralValuesAsString());
|
||||||
|
} else {
|
||||||
|
//Expecting statement parameters to be passed in
|
||||||
|
Map params = vreq.getParameterMap();
|
||||||
|
for (Object key : params.keySet()) {
|
||||||
|
String keyString = (String) key; //key.toString()
|
||||||
|
if (keyString.startsWith("statement_")) {
|
||||||
|
keyString = keyString.replaceFirst("statement_", "");
|
||||||
|
String value = ( (String[]) params.get(key))[0];
|
||||||
|
statementDisplay.put(keyString, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return statementDisplay;
|
||||||
|
}
|
||||||
|
|
||||||
//TODO:Check where this logic should actually go, copied from input element formatting tag
|
//TODO:Check where this logic should actually go, copied from input element formatting tag
|
||||||
public Map<String, String> getOfferTypesCreateNew() {
|
public Map<String, String> getOfferTypesCreateNew() {
|
||||||
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
|
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
|
||||||
|
@ -444,8 +475,19 @@ public class EditConfigurationTemplateModel extends BaseTemplateModel {
|
||||||
return getMainEditUrl() + "?" + vreq.getQueryString();
|
return getMainEditUrl() + "?" + vreq.getQueryString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//this url is for canceling
|
||||||
|
public String getCancelUrl() {
|
||||||
|
String editKey = editConfig.getEditKey();
|
||||||
|
return vreq.getContextPath() + "/postEditCleanupController?editKey=" + editKey + "&cancel=true";
|
||||||
|
}
|
||||||
|
|
||||||
public String getMainEditUrl() {
|
public String getMainEditUrl() {
|
||||||
return "/edit/editRequestDispatch";
|
return vreq.getContextPath() + "/editRequestDispatch";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Get confirm deletion url
|
||||||
|
public String getDeleteProcessingUrl() {
|
||||||
|
return vreq.getContextPath() + "/deletePropertyController";
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Check if this logic is correct and delete prohibited does not expect a specific value
|
//TODO: Check if this logic is correct and delete prohibited does not expect a specific value
|
||||||
|
@ -471,4 +513,12 @@ public class EditConfigurationTemplateModel extends BaseTemplateModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getVitroNsProperty() {
|
||||||
|
String vitroNsProp = vreq.getParameter("vitroNsProp");
|
||||||
|
if(vitroNsProp == null) {
|
||||||
|
vitroNsProp = "";
|
||||||
|
}
|
||||||
|
return vitroNsProp;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,9 +130,7 @@ public WebappDaoFactory getUnfilteredDaoFactory() {
|
||||||
//map.putAll(FreemarkerHttpServlet.getDirectives());
|
//map.putAll(FreemarkerHttpServlet.getDirectives());
|
||||||
//map.putAll(FreemarkerHttpServlet.getMethods());
|
//map.putAll(FreemarkerHttpServlet.getMethods());
|
||||||
ServletContext context = getServletContext();
|
ServletContext context = getServletContext();
|
||||||
FreemarkerConfigurationLoader loader =
|
FreemarkerConfiguration fmConfig = FreemarkerConfigurationLoader.getConfig(vreq, context);
|
||||||
FreemarkerConfigurationLoader.getFreemarkerConfigurationLoader(context);
|
|
||||||
FreemarkerConfiguration fmConfig = loader.getConfig(vreq);
|
|
||||||
fmConfig.resetRequestSpecificSharedVariables();
|
fmConfig.resetRequestSpecificSharedVariables();
|
||||||
TemplateProcessingHelper helper = new TemplateProcessingHelper(fmConfig, vreq, context);
|
TemplateProcessingHelper helper = new TemplateProcessingHelper(fmConfig, vreq, context);
|
||||||
statementDisplay = helper.processTemplateToString(templateName, map);
|
statementDisplay = helper.processTemplateToString(templateName, map);
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
<#assign toBeDeletedClass = "dataProp" />
|
||||||
|
<#if editConfiguration.objectProperty = true>
|
||||||
|
<#assign toBeDeletedClass = "objProp" />
|
||||||
|
</#if>
|
||||||
|
<#assign statement = editConfiguration.statementDisplay />
|
||||||
|
<form action="${editConfiguration.deleteProcessingUrl}" method="get">
|
||||||
|
<label for="submit">
|
||||||
|
<h2>Are you sure you want to delete the following entry from
|
||||||
|
<em>${editConfiguration.propertyName}</em>?
|
||||||
|
</h2>
|
||||||
|
</label>
|
||||||
|
<div class="toBeDeleted ${toBeDeletedClass}">
|
||||||
|
<#if editConfiguration.objectProperty = true>
|
||||||
|
<#if statement.object?has_content>
|
||||||
|
<#include "propStatement-default.ftl" />
|
||||||
|
</#if>
|
||||||
|
<#else>
|
||||||
|
${statement.dataValue}
|
||||||
|
</#if>
|
||||||
|
</div>
|
||||||
|
<input type="hidden" name="subjectUri" value="${editConfiguration.subjectUri}"/>
|
||||||
|
<input type="hidden" name="predicateUri" value="${editConfiguration.predicateUri}"/>
|
||||||
|
|
||||||
|
<#if editConfiguration.dataProperty = true>
|
||||||
|
<input type="hidden" name="datapropKey" value="${editConfiguration.datapropKey}" />
|
||||||
|
<input type="hidden" name="vitroNsProp" value="${editConfiguration.vitroNsProperty}" />
|
||||||
|
<#else>
|
||||||
|
<input type="hidden" name="objectUri" value="${editConfiguration.objectUri}"/>
|
||||||
|
</#if>
|
||||||
|
|
||||||
|
|
||||||
|
<p class="submit">
|
||||||
|
<input type="submit" id="delete" value="Delete"/>
|
||||||
|
<span class="or"> or </span>
|
||||||
|
<a title="Cancel" href="${editConfiguration.cancelUrl}">Cancel</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</form>
|
|
@ -1,7 +1,7 @@
|
||||||
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||||
|
|
||||||
<#assign formTitle>
|
<#assign formTitle>
|
||||||
${editConfiguration.propertyPublicDomainTitle} entry for ${editConfiguration.subjectName}
|
"${editConfiguration.propertyPublicDomainTitle}" entry for ${editConfiguration.subjectName}
|
||||||
</#assign>
|
</#assign>
|
||||||
<#if editConfiguration.objectUri?has_content>
|
<#if editConfiguration.objectUri?has_content>
|
||||||
<#assign formTitle>Edit ${formTitle} </#assign>
|
<#assign formTitle>Edit ${formTitle} </#assign>
|
||||||
|
@ -13,11 +13,15 @@
|
||||||
|
|
||||||
<form class="editForm" action = "${submitUrl}">
|
<form class="editForm" action = "${submitUrl}">
|
||||||
<input type="hidden" name="editKey" id="editKey" value="${editKey}" />
|
<input type="hidden" name="editKey" id="editKey" value="${editKey}" />
|
||||||
<input type="text" name="name" id="name" label="name (required" size="30"/>
|
<input type="text" name="name" id="name" label="name (required)" size="30"/>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<div style="margin-top: 0.2em">
|
<div style="margin-top: 0.2em">
|
||||||
<input type="submit" id="submit" value="${editConfiguration.submitLabel}" cancel="true"/>
|
<input type="submit" id="submit" value="${editConfiguration.submitLabel}"
|
||||||
|
<span class="or"> or </span>
|
||||||
|
<a title="Cancel" href="${editConfiguration.cancelUrl}">Cancel</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,13 @@
|
||||||
id="${editConfiguration.dataLiteral}" name="${editConfiguration.dataLiteral}"
|
id="${editConfiguration.dataLiteral}" name="${editConfiguration.dataLiteral}"
|
||||||
value="${literalValues}"/>
|
value="${literalValues}"/>
|
||||||
|
|
||||||
|
|
||||||
<div style="margin-top: 0.2em">
|
<div style="margin-top: 0.2em">
|
||||||
<input type="submit" id="submit" value="${editConfiguration.submitLabel}" cancel="true"/>
|
<input type="submit" id="submit" value="${editConfiguration.submitLabel}"/>
|
||||||
|
<span class="or"> or </span>
|
||||||
|
<a title="Cancel" href="${editConfiguration.cancelUrl}">Cancel</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,29 +3,35 @@
|
||||||
<input type="hidden" name="subjectUri" value="${editConfiguration.subjectUri}"/>
|
<input type="hidden" name="subjectUri" value="${editConfiguration.subjectUri}"/>
|
||||||
<input type="hidden" name="predicateUri" value="${editConfiguration.predicateUri}"/>
|
<input type="hidden" name="predicateUri" value="${editConfiguration.predicateUri}"/>
|
||||||
<input type="hidden" name="cmd" value="delete"/>
|
<input type="hidden" name="cmd" value="delete"/>
|
||||||
|
<input type="hidden" name="editKey" value="${editConfiguration.editKey}"/>
|
||||||
<#if editConfiguration.dataProperty = true>
|
<#if editConfiguration.dataProperty = true>
|
||||||
<input type="hidden" name="datapropKey" value="${editConfiguration.datapropKey}" />
|
<input type="hidden" name="datapropKey" value="${editConfiguration.datapropKey}" />
|
||||||
<input type="submit" id="delete" value="Delete">
|
<div style="margin-top: 0.2em">
|
||||||
<a class="cancel">Cancel</a>
|
<input type="submit" id="delete" value="Delete">
|
||||||
|
</div>
|
||||||
|
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
<#--The original jsp included vinput tag with cancel=empty string for case where both select from existing
|
<#--The original jsp included vinput tag with cancel=empty string for case where both select from existing
|
||||||
and offer create new option are true below
|
and offer create new option are true below
|
||||||
so leaving as Cancel for now but unclear as to what the result would have been-->
|
so leaving as Cancel for first option but not second below-->
|
||||||
<#if editConfiguration.objectProperty = true>
|
<#if editConfiguration.objectProperty = true>
|
||||||
<input type="hidden" name="objectUri" value="${editConfiguration.objectUri}"/>
|
<input type="hidden" name="objectUri" value="${editConfiguration.objectUri}"/>
|
||||||
|
|
||||||
<#if editConfiguration.propertySelectFromExisting = false
|
<#if editConfiguration.propertySelectFromExisting = false
|
||||||
&& editConfiguration.propertyOfferCreateNewOption = false>
|
&& editConfiguration.propertyOfferCreateNewOption = false>
|
||||||
<input type="submit" id="delete" value="Delete">
|
<div style="margin-top: 0.2em">
|
||||||
<a class="cancel">Cancel</a>
|
<input type="submit" id="delete" value="Delete">
|
||||||
|
<span class="or"> or </span>
|
||||||
|
<a title="Cancel" href="${editConfiguration.cancelUrl}">Cancel</a>
|
||||||
|
</div>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
<#if editConfiguration.propertySelectFromExisting = true
|
<#if editConfiguration.propertySelectFromExisting = true
|
||||||
&& editConfiguration.propertyOfferCreateNewOption = true>
|
&& editConfiguration.propertyOfferCreateNewOption = true>
|
||||||
<input type="submit" id="delete" value="Delete">
|
<div style="margin-top: 0.2em">
|
||||||
<a class="cancel">Cancel</a>
|
<input type="submit" id="delete" value="Delete">
|
||||||
|
</div>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
</#if>
|
</#if>
|
||||||
|
|
|
@ -4,11 +4,18 @@
|
||||||
<p style="margin-top: 5em">Please create a new entry.</p>
|
<p style="margin-top: 5em">Please create a new entry.</p>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
|
|
||||||
|
<#if editConfiguration.objectUri?has_content>
|
||||||
|
<#assign objectUri = editConfiguration.objectUri>
|
||||||
|
<#else>
|
||||||
|
<#assign objectUri = ""/>
|
||||||
|
</#if>
|
||||||
|
|
||||||
<#assign typesList = editConfiguration.offerTypesCreateNew />
|
<#assign typesList = editConfiguration.offerTypesCreateNew />
|
||||||
<form class="editForm" action="{editConfiguration.mainEditUrl}">
|
<form class="editForm" action="${editConfiguration.mainEditUrl}">
|
||||||
<input type="hidden" value="${editConfiguration.subjectUri}" name="subjectUri"/>
|
<input type="hidden" value="${editConfiguration.subjectUri}" name="subjectUri"/>
|
||||||
<input type="hidden" value="${editConfiguration.predicateUri}" name="predicateUri"/>
|
<input type="hidden" value="${editConfiguration.predicateUri}" name="predicateUri"/>
|
||||||
<input type="hidden" value="${editConfiguration.objectUri}" name="objectUri"/>
|
<input type="hidden" value="${objectUri}" name="objectUri"/>
|
||||||
<input type="hidden" value="create" name="cmd"/>
|
<input type="hidden" value="create" name="cmd"/>
|
||||||
<select id="typeOfNew" name="typeOfNew">
|
<select id="typeOfNew" name="typeOfNew">
|
||||||
<#assign typeKeys = typesList?keys />
|
<#assign typeKeys = typesList?keys />
|
||||||
|
@ -16,7 +23,5 @@
|
||||||
<option value="${typeKey}"> ${typesList[typeKey]} </option>
|
<option value="${typeKey}"> ${typesList[typeKey]} </option>
|
||||||
</#list>
|
</#list>
|
||||||
</select>
|
</select>
|
||||||
|
<input type="submit" id="submit" value="Add a new item of this type"/>
|
||||||
<input type="submit" name="submit" id="submit" value="Add a new item of this type" />
|
|
||||||
<a class="cancel">Cancel</a>
|
|
||||||
</form>
|
</form>
|
|
@ -20,7 +20,9 @@
|
||||||
</#list>
|
</#list>
|
||||||
</select>
|
</select>
|
||||||
<div style="margin-top: 0.2em">
|
<div style="margin-top: 0.2em">
|
||||||
<input type="submit" id="submit" value="${editConfiguration.submitLabel}" cancel="true"/>
|
<input type="submit" id="submit" value="${editConfiguration.submitLabel}"/>
|
||||||
|
<span class="or"> or </span>
|
||||||
|
<a title="Cancel" href="${editConfiguration.cancelUrl}">Cancel</a>
|
||||||
</div>
|
</div>
|
||||||
</#if>
|
</#if>
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue