This commit is contained in:
parent
826679b073
commit
2be346ee67
3 changed files with 33 additions and 13 deletions
|
@ -212,6 +212,11 @@
|
|||
<required>false</required>
|
||||
<rtexprvalue>true</rtexprvalue>
|
||||
</attribute>
|
||||
<attribute>
|
||||
<name>disabled</name>
|
||||
<required>false</required>
|
||||
<rtexprvalue>true</rtexprvalue>
|
||||
</attribute>
|
||||
</tag>
|
||||
|
||||
</taglib>
|
|
@ -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<String> n3Required;
|
||||
List<String> n3Optional;
|
||||
List<String> 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 );
|
||||
|
|
|
@ -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("<dd>"); }
|
||||
out.print("<input "+classStr+" "+sizeStr+" type=\"text\" id=\""+getId()+"\" name=\""+getName()+"\" value=\""+valueStr+"\" />");
|
||||
out.print("<input "+classStr+" "+sizeStr+" " + disabledStr + " type=\"text\" id=\""+getId()+"\" name=\""+getName()+"\" value=\""+valueStr+"\" />");
|
||||
if (definitionTags) { out.print("</dd>"); }
|
||||
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("<dd>"); }
|
||||
if (multiple!=null && !multiple.equals("")) {
|
||||
out.print("<select "+classStr+" id=\""+getId()+"\" name=\""+getName()+"\" multiple=\"multiple\" size=\""+(optionsMap.size() > 10? "10" : optionsMap.size())+"\">");
|
||||
out.print("<select "+ classStr+ " " + disabledStr + " id=\""+getId()+"\" name=\""+getName()+"\" multiple=\"multiple\" size=\""+(optionsMap.size() > 10? "10" : optionsMap.size())+"\">");
|
||||
} else {
|
||||
out.print("<select "+classStr+" id=\""+getId()+"\" name=\""+getName()+"\">");
|
||||
out.print("<select "+classStr+ " " + disabledStr + " id=\""+getId()+"\" name=\""+getName()+"\">");
|
||||
}
|
||||
|
||||
Field thisField = editConfig.getField(getName());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue