NIHVIVO-646 Add cancelUrl parameter to submit tag in InputElementFormattingTags so that the cancel button can redirect to a different page from the form submission. Change cancel values in submit tags in vitro and vivo forms to "true" where previously they specified a uri, because the uri is misleading (it doesn't control the redirect location). Removed edit submission preprocessing due to problems with cloning.

This commit is contained in:
rjy7 2010-06-17 14:26:59 +00:00
parent cbe3f24250
commit 97a753b66e
17 changed files with 76 additions and 52 deletions

View file

@ -29,7 +29,7 @@ import com.hp.hpl.jena.vocabulary.XSD;
import edu.cornell.mannlib.vitro.webapp.edit.EditLiteral;
public class EditSubmission implements Cloneable {
public class EditSubmission {
private String editKey;
private Map<String,Literal> literalsFromForm ;
@ -413,16 +413,6 @@ public class EditSubmission implements Cloneable {
}
return out;
}
public EditSubmission clone() {
try {
return (EditSubmission) super.clone();
} catch (CloneNotSupportedException e) {
// TODO Auto-generated catch block
log.error("Error cloning EditSubmission object: CloneNotSupported exception");
return null;
}
}
private Log log = LogFactory.getLog(EditSubmission.class);
}

View file

@ -43,6 +43,7 @@ import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.SelectListGenerator;
import edu.cornell.mannlib.vitro.webapp.utils.StringUtils;
/**
* This tag will build an option list for individuals of a VClass.
@ -56,6 +57,7 @@ public class InputElementFormattingTag extends TagSupport {
private String type;
private String label;
private String cancelLabel;
private String cancelUrl;
private String cssClass;
private String labelClass;
private String value;
@ -96,6 +98,12 @@ public class InputElementFormattingTag extends TagSupport {
public void setCancelLabel(String cancelLabel) {
this.cancelLabel = cancelLabel;
}
public String getCancelUrl() {
return cancelUrl;
}
public void setCancelUrl(String cancelUrl) {
this.cancelUrl = cancelUrl;
}
public String getCssClass() {
return cssClass;
}
@ -295,12 +303,19 @@ public class InputElementFormattingTag extends TagSupport {
}else if( "dashboard".equals( getCancel() )){ //this case is Datastar-specific.
return " or <a class=\"cancel\" href=\"" + vreq.getContextPath()
+ "/dashboard\" title=\"Cancel\">"+labelStr+"</a>";
}else if (getCancel()!=null && !getCancel().equals("")) {
}else if (getCancel()!=null && !getCancel().equals("") && !getCancel().equals("false")) {
if( editConfig != null && editConfig.getEditKey() != null ){
try{
return "<span class=\"or\"> or </span><a class=\"cancel\" href=\"" + vreq.getContextPath()
+ "/edit/postEditCleanUp.jsp?editKey="+ URLEncoder.encode(editConfig.getEditKey(),"UTF-8")
+"\" title=\"Cancel\">"+labelStr+"</a>";
String url = vreq.getContextPath() +
"/edit/postEditCleanUp.jsp?editKey="+
URLEncoder.encode(editConfig.getEditKey(),"UTF-8") +
"&cancel=true";
String cancelUrl = getCancelUrl();
if (!StringUtils.isEmpty(cancelUrl)) {
url += "&url=" + cancelUrl;
}
return "<span class=\"or\"> or </span><a class=\"cancel\" href=\"" +
url + "\" title=\"Cancel\">"+labelStr+"</a>";
}catch(UnsupportedEncodingException ex){
log.error( "doCancel(): " , ex);
}