updates for cancel link to accept parameter vivo-393

This commit is contained in:
hudajkhan 2013-10-22 14:11:11 -04:00
parent 9f9e833253
commit 271c1e9063
3 changed files with 32 additions and 19 deletions

View file

@ -55,6 +55,15 @@ public class PostEditCleanupController extends FreemarkerHttpServlet{
return new RedirectResponseValues( UrlBuilder.getHomeUrl() ); return new RedirectResponseValues( UrlBuilder.getHomeUrl() );
} }
//In some cases, a generator/form may have a regular URL to return to but the same generator
//may be used from different pages, so a parameter allowing the form to return to a specific page
//would be useful
String returnURLParameter = vreq.getParameter("returnURL");
if(returnURLParameter != null) {
return new DirectRedirectResponseValues( returnURLParameter );
}
// If there is a urlToReturnTo that takes precedence // If there is a urlToReturnTo that takes precedence
if( editConfig.getUrlToReturnTo() != null && ! editConfig.getUrlToReturnTo().trim().isEmpty()){ if( editConfig.getUrlToReturnTo() != null && ! editConfig.getUrlToReturnTo().trim().isEmpty()){
//this does not get value substitution or the predicate anchor //this does not get value substitution or the predicate anchor

View file

@ -666,7 +666,13 @@ public class EditConfigurationTemplateModel extends BaseTemplateModel {
//this url is for canceling //this url is for canceling
public String getCancelUrl() { public String getCancelUrl() {
String editKey = editConfig.getEditKey(); String editKey = editConfig.getEditKey();
return EditConfigurationUtils.getCancelUrlBase(vreq) + "?editKey=" + editKey + "&cancel=true"; String cancelURL = EditConfigurationUtils.getCancelUrlBase(vreq) + "?editKey=" + editKey + "&cancel=true";
//Check for special return url parameter
String returnURLParameter = vreq.getParameter("returnURL");
if(returnURLParameter != null && !returnURLParameter.isEmpty() ) {
cancelURL += "&returnURL=" + returnURLParameter;
}
return cancelURL;
} }
//Get confirm deletion url //Get confirm deletion url

View file

@ -5,8 +5,7 @@
<#include "individual-setup.ftl"> <#include "individual-setup.ftl">
<#assign hasElement = propertyGroups.pullProperty("${namespaces.display}hasElement")!> <#assign hasElement = propertyGroups.pullProperty("${namespaces.display}hasElement")!>
<#assign returnURL = "/vivo/individual?uri=http%3A%2F%2Fvitro.mannlib.cornell.edu%2Fontologies%2Fdisplay%2F1.1%23DefaultMenu&switchToDisplayModel=true" />
<#assign addNewMenuItemUrl = "${urls.base}/menuManagementController?cmd=add" >
<#if hasElement?has_content> <#if hasElement?has_content>
<script type="text/javascript"> <script type="text/javascript">
@ -24,22 +23,21 @@
<#-- Link to add a new menu item --> <#-- Link to add a new menu item -->
<#if editable> <#if editable>
<#if addNewMenuItemUrl?has_content> <form id="pageListForm" action="${urls.base}/editRequestDispatch" method="get">
<form id="pageListForm" action="${urls.base}/editRequestDispatch" method="get"> <input type="hidden" name="typeOfNew" value="http://vitro.mannlib.cornell.edu/ontologies/display/1.1#Page">
<input type="hidden" name="typeOfNew" value="http://vitro.mannlib.cornell.edu/ontologies/display/1.1#Page"> <input type="hidden" name="switchToDisplayModel" value="1">
<input type="hidden" name="switchToDisplayModel" value="1"> <input type="hidden" name="editForm" value="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.ManagePageGenerator" role="input">
<input type="hidden" name="editForm" value="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.ManagePageGenerator" role="input"> <input type="hidden" name="addMenuItem" value="true" />
<input type="hidden" name="addMenuItem" value="true" /> <input id="submit" value="Add new menu page" role="button" type="submit" >
<input id="submit" value="Add new menu page" role="button" type="submit" > <input type="hidden" name="returnURL" value="${returnURL?url}" />
<#if verbosePropertySwitch.url?contains("pageManagement")> <#if verbosePropertySwitch.url?contains("pageManagement")>
<span class="or"> ${i18n().or} </span> <span class="or"> ${i18n().or} </span>
<a style="margin-left:7px" href="${urls.base}/pageList" title="Return to Profile Page">Return to Page Management</a> <a style="margin-left:7px" href="${urls.base}/pageList" title="Return to Profile Page">Return to Page Management</a>
</#if> </#if>
</form> </form>
<br /> <br />
<p class="note">${i18n().refresh_page_after_reordering}</p> <p class="note">${i18n().refresh_page_after_reordering}</p>
</#if>
</#if> </#if>
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/css/individual/individual.css" />', ${stylesheets.add('<link rel="stylesheet" href="${urls.base}/css/individual/individual.css" />',