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() );
}
//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( editConfig.getUrlToReturnTo() != null && ! editConfig.getUrlToReturnTo().trim().isEmpty()){
//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
public String getCancelUrl() {
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