NIHVIVO-646 Add cancelUrl parameter to submit tag in InputElementFormattingTags so that the cancel button can redirect to a different page from the form submission. Change cancel values in submit tags in vitro and vivo forms to "true" where previously they specified a uri, because the uri is misleading (it doesn't control the redirect location). Removed edit submission preprocessing due to problems with cloning.

This commit is contained in:
rjy7 2010-06-17 14:26:59 +00:00
parent cbe3f24250
commit 97a753b66e
17 changed files with 76 additions and 52 deletions

View file

@ -3,6 +3,7 @@
<%@ 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.vitro.webapp.controller.Controllers" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.utils.StringUtils" %>
<%@page import="org.apache.commons.logging.Log"%>
<%@page import="org.apache.commons.logging.LogFactory"%>
<%@page import="com.hp.hpl.jena.rdf.model.ResourceFactory"%>
@ -41,13 +42,24 @@
}
//set up base URL
if( editConfig == null || editConfig.getUrlPatternToReturnTo() == null){
urlPattern = "/individual";
}else{
urlPattern = editConfig.getUrlPatternToReturnTo();
String cancel = request.getParameter("cancel");
String urlPatternToReturnTo = null;
String urlPatternToCancelTo = null;
if (editConfig != null) {
urlPatternToReturnTo = editConfig.getUrlPatternToReturnTo();
urlPatternToCancelTo = request.getParameter("url");
}
// If a different cancel return path has been designated, use it. Otherwise, use the regular return path.
if (cancel != null && cancel.equals("true") && !StringUtils.isEmpty(urlPatternToCancelTo)) {
urlPattern = urlPatternToCancelTo;
}
else if (!StringUtils.isEmpty(urlPatternToReturnTo)) {
urlPattern = urlPatternToReturnTo;
} else {
urlPattern = "/individual";
}
//looks like a redirec to an profile page, try to add anchor for property that was just edited.
//looks like a redirect to a profile page, try to add anchor for property that was just edited.
if( urlPattern.endsWith("individual") || urlPattern.endsWith("entity") ){
if( predicateLocalName != null && predicateLocalName.length() > 0){
predicateAnchor = "#" + predicateLocalName;