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="org.apache.commons.logging.Log"%>
|
||||
<%@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="fn" uri="http://java.sun.com/jstl/functions" %>
|
||||
<%@ taglib uri="http://jakarta.apache.org/taglibs/string-1.1" prefix="str" %>
|
||||
|
@ -12,8 +14,10 @@
|
|||
|
||||
<%
|
||||
/* Clear any cruft from session. */
|
||||
String redirectTo = null;
|
||||
String resourceToRedirectTo = null;
|
||||
String urlPattern = null;
|
||||
String predicateLocalName = null;
|
||||
String predicateAnchor = "";
|
||||
if( session != null ) {
|
||||
EditConfiguration editConfig = EditConfiguration.getConfigFromSession(session,request);
|
||||
//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.clearEditSubmissionInSession(session, editSub);
|
||||
|
||||
if( editConfig != null && editConfig.getEntityToReturnTo() != null ){
|
||||
String predicateUri = editConfig.getPredicateUri();
|
||||
log.debug("Return to property after submitting form: " + predicateUri);
|
||||
%>
|
||||
<c:set var="predicateUri" value="<%=predicateUri%>" />
|
||||
<c:set var="localName" value="${fn:substringAfter(predicateUri, '#')}" />
|
||||
<%
|
||||
|
||||
if( editConfig != null ){
|
||||
String predicateUri = editConfig.getPredicateUri();
|
||||
if( predicateUri != null ){
|
||||
Property prop = ResourceFactory.createProperty(predicateUri);
|
||||
predicateLocalName = prop.getLocalName();
|
||||
}
|
||||
|
||||
if( editConfig.getEntityToReturnTo().startsWith("?") ){
|
||||
redirectTo = (String)request.getAttribute("entityToReturnTo");
|
||||
if( editConfig.getEntityToReturnTo() != null && editConfig.getEntityToReturnTo().startsWith("?") ){
|
||||
resourceToRedirectTo = (String)request.getAttribute("entityToReturnTo");
|
||||
}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 ){
|
||||
request.setAttribute("redirectTo",redirectTo); %>
|
||||
|
||||
<%-- <c:redirect url="/entity">
|
||||
<c:param name="uri" value="${redirectTo}" />
|
||||
<c:param name="property" value="${localName}" />
|
||||
</c:redirect> --%>
|
||||
|
||||
<% if( urlPattern != null && urlPattern.endsWith("entity")){ %>
|
||||
|
||||
/* The parameter extra=true is just for ie6. */
|
||||
if( resourceToRedirectTo != null ){
|
||||
if( urlPattern != null && ( urlPattern.endsWith("entity") || urlPattern.endsWith("individual") )){ %>
|
||||
<%-- Here we're building the redirect URL to include an (unencoded) fragment identifier such as: #propertyName --%>
|
||||
<c:url context="/" var="encodedUrl" value="/entity">
|
||||
<c:param name="uri" value="${redirectTo}" />
|
||||
<c:url context="/" var="encodedUrl" value="<%=urlPattern%>">
|
||||
<c:param name="uri" value="<%=resourceToRedirectTo%>" />
|
||||
<c:param name="extra" value="true"/>
|
||||
</c:url>
|
||||
<c:redirect url="${encodedUrl}${'#'}${localName}" />
|
||||
<% } else {
|
||||
request.setAttribute("urlPattern",urlPattern);%>
|
||||
<c:url context="/" var="encodedUrl" value="${urlPattern}">
|
||||
<c:param name="uri" value="${redirectTo}" />
|
||||
<c:redirect url="${encodedUrl}${predicateAnchor}" />
|
||||
<% } else { %>
|
||||
<c:url context="/" var="encodedUrl" value="<%=urlPattern%>">
|
||||
<c:param name="uri" value="<%=resourceToRedirectTo%>" />
|
||||
<c:param name="extra" value="true"/>
|
||||
</c:url>
|
||||
<c:redirect url="${encodedUrl}${'#'}${localName}" />
|
||||
<c:redirect url="${encodedUrl}${predicateAnchor}" />
|
||||
<%} %>
|
||||
<% } else { %>
|
||||
<c:redirect url="<%= Controllers.LOGIN %>" />
|
||||
<% } %>
|
||||
|
||||
|
||||
<%!
|
||||
Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.edit.postEditCleanUp.jsp");
|
||||
%>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue