merging r4717 from nihvivo-rel-1.0-maint to trunk
This commit is contained in:
parent
211fef1551
commit
e65e72a065
1 changed files with 43 additions and 35 deletions
|
@ -5,6 +5,8 @@
|
||||||
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %>
|
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %>
|
||||||
<%@page import="org.apache.commons.logging.Log"%>
|
<%@page import="org.apache.commons.logging.Log"%>
|
||||||
<%@page import="org.apache.commons.logging.LogFactory"%>
|
<%@page import="org.apache.commons.logging.LogFactory"%>
|
||||||
|
<%@page import="com.hp.hpl.jena.rdf.model.ResourceFactory"%>
|
||||||
|
<%@page import="com.hp.hpl.jena.rdf.model.Property"%>
|
||||||
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
|
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
|
||||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jstl/functions" %>
|
<%@ taglib prefix="fn" uri="http://java.sun.com/jstl/functions" %>
|
||||||
<%@ taglib uri="http://jakarta.apache.org/taglibs/string-1.1" prefix="str" %>
|
<%@ taglib uri="http://jakarta.apache.org/taglibs/string-1.1" prefix="str" %>
|
||||||
|
@ -12,8 +14,10 @@
|
||||||
|
|
||||||
<%
|
<%
|
||||||
/* Clear any cruft from session. */
|
/* Clear any cruft from session. */
|
||||||
String redirectTo = null;
|
String resourceToRedirectTo = null;
|
||||||
String urlPattern = null;
|
String urlPattern = null;
|
||||||
|
String predicateLocalName = null;
|
||||||
|
String predicateAnchor = "";
|
||||||
if( session != null ) {
|
if( session != null ) {
|
||||||
EditConfiguration editConfig = EditConfiguration.getConfigFromSession(session,request);
|
EditConfiguration editConfig = EditConfiguration.getConfigFromSession(session,request);
|
||||||
//In order to support back button resubmissions, don't remove the editConfig from session.
|
//In order to support back button resubmissions, don't remove the editConfig from session.
|
||||||
|
@ -21,53 +25,57 @@
|
||||||
|
|
||||||
EditSubmission editSub = EditSubmission.getEditSubmissionFromSession(session,editConfig);
|
EditSubmission editSub = EditSubmission.getEditSubmissionFromSession(session,editConfig);
|
||||||
EditSubmission.clearEditSubmissionInSession(session, editSub);
|
EditSubmission.clearEditSubmissionInSession(session, editSub);
|
||||||
|
|
||||||
if( editConfig != null && editConfig.getEntityToReturnTo() != null ){
|
if( editConfig != null ){
|
||||||
String predicateUri = editConfig.getPredicateUri();
|
String predicateUri = editConfig.getPredicateUri();
|
||||||
log.debug("Return to property after submitting form: " + predicateUri);
|
if( predicateUri != null ){
|
||||||
%>
|
Property prop = ResourceFactory.createProperty(predicateUri);
|
||||||
<c:set var="predicateUri" value="<%=predicateUri%>" />
|
predicateLocalName = prop.getLocalName();
|
||||||
<c:set var="localName" value="${fn:substringAfter(predicateUri, '#')}" />
|
}
|
||||||
<%
|
|
||||||
|
|
||||||
if( editConfig.getEntityToReturnTo().startsWith("?") ){
|
if( editConfig.getEntityToReturnTo() != null && editConfig.getEntityToReturnTo().startsWith("?") ){
|
||||||
redirectTo = (String)request.getAttribute("entityToReturnTo");
|
resourceToRedirectTo = (String)request.getAttribute("entityToReturnTo");
|
||||||
}else{
|
}else{
|
||||||
redirectTo = editConfig.getEntityToReturnTo();
|
resourceToRedirectTo = editConfig.getEntityToReturnTo();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if( editConfig != null && editConfig.getUrlPatternToReturnTo() != null){
|
|
||||||
urlPattern = editConfig.getUrlPatternToReturnTo();
|
//set up base URL
|
||||||
|
if( editConfig == null || editConfig.getUrlPatternToReturnTo() == null){
|
||||||
|
urlPattern = "/individual";
|
||||||
|
}else{
|
||||||
|
urlPattern = editConfig.getUrlPatternToReturnTo();
|
||||||
|
}
|
||||||
|
|
||||||
|
//looks like a redirec to an 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;
|
||||||
|
request.setAttribute("predicateAnchor", predicateAnchor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( redirectTo != null ){
|
/* The parameter extra=true is just for ie6. */
|
||||||
request.setAttribute("redirectTo",redirectTo); %>
|
if( resourceToRedirectTo != null ){
|
||||||
|
if( urlPattern != null && ( urlPattern.endsWith("entity") || urlPattern.endsWith("individual") )){ %>
|
||||||
<%-- <c:redirect url="/entity">
|
|
||||||
<c:param name="uri" value="${redirectTo}" />
|
|
||||||
<c:param name="property" value="${localName}" />
|
|
||||||
</c:redirect> --%>
|
|
||||||
|
|
||||||
<% if( urlPattern != null && urlPattern.endsWith("entity")){ %>
|
|
||||||
<%-- Here we're building the redirect URL to include an (unencoded) fragment identifier such as: #propertyName --%>
|
<%-- Here we're building the redirect URL to include an (unencoded) fragment identifier such as: #propertyName --%>
|
||||||
<c:url context="/" var="encodedUrl" value="/entity">
|
<c:url context="/" var="encodedUrl" value="<%=urlPattern%>">
|
||||||
<c:param name="uri" value="${redirectTo}" />
|
<c:param name="uri" value="<%=resourceToRedirectTo%>" />
|
||||||
|
<c:param name="extra" value="true"/>
|
||||||
</c:url>
|
</c:url>
|
||||||
<c:redirect url="${encodedUrl}${'#'}${localName}" />
|
<c:redirect url="${encodedUrl}${predicateAnchor}" />
|
||||||
<% } else {
|
<% } else { %>
|
||||||
request.setAttribute("urlPattern",urlPattern);%>
|
<c:url context="/" var="encodedUrl" value="<%=urlPattern%>">
|
||||||
<c:url context="/" var="encodedUrl" value="${urlPattern}">
|
<c:param name="uri" value="<%=resourceToRedirectTo%>" />
|
||||||
<c:param name="uri" value="${redirectTo}" />
|
<c:param name="extra" value="true"/>
|
||||||
</c:url>
|
</c:url>
|
||||||
<c:redirect url="${encodedUrl}${'#'}${localName}" />
|
<c:redirect url="${encodedUrl}${predicateAnchor}" />
|
||||||
<%} %>
|
<%} %>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<c:redirect url="<%= Controllers.LOGIN %>" />
|
<c:redirect url="<%= Controllers.LOGIN %>" />
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
|
|
||||||
<%!
|
<%!
|
||||||
Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.edit.postEditCleanUp.jsp");
|
Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.edit.postEditCleanUp.jsp");
|
||||||
%>
|
%>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue