From 2be346ee6766fe49af5c3ce580f3b971259dc5f3 Mon Sep 17 00:00:00 2001 From: rjy7 Date: Sat, 24 Jul 2010 20:25:37 +0000 Subject: [PATCH] Merge r5466 from http://svn.mannlib.cornell.edu/svn/vitro/branches/nihvivo-rel-1.1-maint --- webapp/config/tlds/vitroForm.tld | 5 ++++ .../edit/n3editing/EditConfiguration.java | 15 ++++++----- .../jsptags/InputElementFormattingTag.java | 26 ++++++++++++++----- 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/webapp/config/tlds/vitroForm.tld b/webapp/config/tlds/vitroForm.tld index cbde329b5..7838e0b09 100644 --- a/webapp/config/tlds/vitroForm.tld +++ b/webapp/config/tlds/vitroForm.tld @@ -212,6 +212,11 @@ false true + + disabled + false + true + \ No newline at end of file diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditConfiguration.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditConfiguration.java index d0a118928..bc8a9da20 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditConfiguration.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditConfiguration.java @@ -45,6 +45,7 @@ import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch; * in preparation for N3. They may also be appended with a datatype or lang. */ public class EditConfiguration { + List n3Required; List n3Optional; List urisOnform; @@ -254,15 +255,15 @@ public class EditConfiguration { UserToIndIdentifierFactory.getIndividualsForUser(ids); if( userUris == null || userUris.size() == 0 ){ - System.out.println("Cound not find user ur for edit request"); + log.debug("Cound not find user ur for edit request"); log.error("Could not find a userUri for edit request, make " + "sure that there is an IdentifierBundleFactory that " + "produces userUri identifiers in the context."); } else if( userUris.size() > 1 ){ log.error("Found multiple userUris, using the first in list."); - System.out.println("Found multiple user uris"); + log.debug("Found multiple user uris"); }else { - System.out.println("EditConfiguration.java - checking system value for User URI " + userUris.get(0)); + log.debug("EditConfiguration.java - checking system value for User URI " + userUris.get(0)); getUrisInScope().put("editingUser",userUris.get(0)); } } @@ -304,24 +305,24 @@ public class EditConfiguration { public void prepareForObjPropUpdate( Model model ){ if( model == null ) { //Added parens and output - System.out.println("Model is null and will be throwing an error"); + log.debug("Model is null and will be throwing an error"); throw new Error("EditConfiguration.prepareForObjPropUpdate() needs a Model");} if( !isObjectResource ) { //Added parens and output - System.out.println("This is not an object resource? lacks dataprop "); + log.debug("This is not an object resource? lacks dataprop "); throw new Error("This request does not appear to be for an update since it lacks a dataprop object or a dataProp hash key "); } //find the variable for object, this anchors the paths to the existing values if( object == null || object.trim().length() == 0) { //Added parens and output - System.out.println("Object is null or object length is null"); + log.debug("Object is null or object length is null"); throw new Error("This request does not appear to be for an update since it lacks an object"); } getUrisInScope().put( varNameForObject, object); - System.out.println("Putting uris in scope - var name for ojbect " + varNameForObject + " and object is " + object); + log.debug("Putting uris in scope - var name for object " + varNameForObject + " and object is " + object); // run SPARQL, sub in values SparqlEvaluate sparqlEval = new SparqlEvaluate( model ); runSparqlForAdditional( sparqlEval ); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/InputElementFormattingTag.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/InputElementFormattingTag.java index 504970694..569ca056a 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/InputElementFormattingTag.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/InputElementFormattingTag.java @@ -65,6 +65,7 @@ public class InputElementFormattingTag extends TagSupport { private String cancelUrl; private String cssClass; private String labelClass; + private String disabled; private String value; private String error; private int size = 0; @@ -122,14 +123,18 @@ public class InputElementFormattingTag extends TagSupport { public void setCssClass(String classStr) { this.cssClass = classStr; } - public String getLabelClass() { return labelClass; } public void setLabelClass(String labelClassStr) { this.labelClass = labelClassStr; } - + public String getDisabled() { + return disabled; + } + public void setDisabled(String disabled) { + this.disabled = disabled; + } public String getValue() { return value; } @@ -208,6 +213,15 @@ public class InputElementFormattingTag extends TagSupport { } return ""; } + + private String doDisabled() { + /* only insert the disabled attribute if it has been populated */ + String disabled = getDisabled(); + if (!StringUtils.isEmpty(disabled)) { + return "disabled=\"disabled\""; + } + return ""; + } private String doSize() { if (getSize()>0) { @@ -283,7 +297,6 @@ public class InputElementFormattingTag extends TagSupport { return ""; } - private String literalToString(Literal lit){ if( lit == null || lit.getValue() == null) return ""; String value = lit.getValue().toString(); @@ -394,6 +407,7 @@ public class InputElementFormattingTag extends TagSupport { /* populate the pieces */ String classStr = doClass(); + String disabledStr = doDisabled(); String errorStr = getValidationErrors(editSub); JspWriter out = pageContext.getOut(); @@ -445,7 +459,7 @@ public class InputElementFormattingTag extends TagSupport { String valueStr = doValue(editConfig, editSub); String sizeStr = doSize(); if (definitionTags) { out.print("
"); } - out.print(""); + out.print(""); if (definitionTags) { out.print("
"); } out.println(); // Handle hidden inputs where Javascript writes a value that needs to be returned with an invalid submission. @@ -473,9 +487,9 @@ public class InputElementFormattingTag extends TagSupport { if (optionsMap.size()>0) { // e.g., an Educational Background where may be no choices left after remove existing if (definitionTags) { out.print("
"); } if (multiple!=null && !multiple.equals("")) { - out.print(" 10? "10" : optionsMap.size())+"\">"); } else { - out.print(""); } Field thisField = editConfig.getField(getName());