NIHVIVO-707 Add web page and cancel link destinations

This commit is contained in:
ryounes 2011-07-12 14:47:41 +00:00
parent c399323d92
commit 69af70e7be
3 changed files with 22 additions and 6 deletions

View file

@ -130,7 +130,6 @@ core:rank
"formUrl" : "${formUrl}",
"editKey" : "${editKey}",
"urlPatternToReturnTo" : "${returnPathAfterSubmit}",
"urlPatternToCancelTo" : "${returnPathAfterCancel}",
"subject" : ["subject", "${subjectUriJson}" ],
"predicate" : ["predicate", "${predicateUriJson}" ],
@ -228,7 +227,9 @@ core:rank
<c:set var="editMode" value="add" />
<c:set var="title" value="Add a webpage for" />
<c:set var="submitButtonText" value="Add webpage" />
<c:set var="cancelUrl" value="/individual" />
<%-- Cancel to where ever we came from: either directly from the profile page, or from
the Manage Web Pages screen. The latter has added a url param to signal itself. --%>
<c:set var="cancelUrl" value="${ param.cancelTo == 'manage' ? '' : '/individual' }" />
</c:otherwise>
</c:choose>

View file

@ -23,6 +23,10 @@ class, in case we want to re-enable DD without a page reload. */
width: 15em;
}
#addAndCancelLinks {
margin-top: 1.5em;
}
#returnToIndividual {
margin-left: 2em;
}

View file

@ -57,11 +57,12 @@
} // else stay here to manage webpages
VitroRequest vreq = new VitroRequest(request);
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
vreq.setAttribute("defaultNamespace", wdf.getDefaultNamespace());
//WebappDaoFactory wdf = vreq.getWebappDaoFactory();
//vreq.setAttribute("defaultNamespace", wdf.getDefaultNamespace());
String subjectName = ((Individual)request.getAttribute("subject")).getName();
String subjectUri = (String) request.getAttribute("subjectUri");
String predicateUri = (String) request.getAttribute("predicateUri");
List<Map<String, String>> webpages = getWebpages(subjectUri, vreq);
vreq.setAttribute("webpages", webpages);
@ -95,6 +96,11 @@
<c:set var="subjectUri" value="<%= subjectUri %>" />
<c:url var="returnToIndividualUrl" value="/individual?uri=${subjectUri}" />
<c:url var="showAddFormUrl" value="/edit/editRequestDispatch.jsp">
<c:param name="subjectUri" value="<%= subjectUri %>" />
<c:param name="predicateUri" value="<%= predicateUri %>" />
<c:param name="cancelTo" value="manage" />
</c:url>
<jsp:include page="${preForm}"/>
@ -132,8 +138,13 @@
</c:forEach>
</ul>
<a href="${showAddFormUrl}" id="showAddForm" class="button">Add Web Page</a>
<a href="${returnToIndividualUrl}" id="returnToIndividual">Return to Individual</a>
<div id="addAndCancelLinks">
<%-- There is no editConfig at this stage, so we don't need to go through postEditCleanup.jsp on cancel.
These can just be ordinary links, rather than a v:input element, as in
addAuthorsToInformationResource.jsp. --%>
<a href="${showAddFormUrl}" id="showAddForm" class="button green">Add Web Page</a>
<a href="${returnToIndividualUrl}" id="returnToIndividual" class="return">Return to Individual</a>
</div>
<jsp:include page="${postForm}"/>