From a451740c85f3efea06df67c7f8a60608e95eb0dc Mon Sep 17 00:00:00 2001 From: rjy7 Date: Tue, 30 Mar 2010 01:03:56 +0000 Subject: [PATCH] NIHVIVO-193 Added Javascript functionality to custom form for person has position --- webapp/config/tlds/vitroForm.tld | 7 ++++++- .../web/jsptags/InputElementFormattingTag.java | 18 +++++++++++++++++- webapp/web/edit/formPrefix.jsp | 1 + webapp/web/js/extensions/String.js | 5 +++++ 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 webapp/web/js/extensions/String.js diff --git a/webapp/config/tlds/vitroForm.tld b/webapp/config/tlds/vitroForm.tld index 7c9de7131..ff855ca2f 100644 --- a/webapp/config/tlds/vitroForm.tld +++ b/webapp/config/tlds/vitroForm.tld @@ -152,7 +152,12 @@ cssClass false true - + + + labelClass + false + true + value false 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 8c3236114..bdd517f3e 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 @@ -56,6 +56,7 @@ public class InputElementFormattingTag extends TagSupport { private String type; private String label; private String cssClass; + private String labelClass; private String value; private String error; private int size = 0; @@ -94,6 +95,13 @@ 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 getValue() { return value; @@ -157,6 +165,14 @@ public class InputElementFormattingTag extends TagSupport { public void setCancel(String s){ cancel = s; } + + private String doLabelClass() { + String labelClass = getLabelClass(); + if (labelClass != null && !labelClass.equals("")) { + return " class=\""+labelClass+"\""; + } + return ""; + } private String doClass() { /* only insert the class attribute if it has been populated */ @@ -350,7 +366,7 @@ public class InputElementFormattingTag extends TagSupport { if( getLabel()!=null && !getLabel().equals("")) { if (definitionTags) { out.println("
"); } - out.println(""); + out.println(""+getLabel()+""); if (definitionTags) { out.println("
"); } } diff --git a/webapp/web/edit/formPrefix.jsp b/webapp/web/edit/formPrefix.jsp index 2b660ee04..7f2396d70 100644 --- a/webapp/web/edit/formPrefix.jsp +++ b/webapp/web/edit/formPrefix.jsp @@ -60,6 +60,7 @@ <% } %> + diff --git a/webapp/web/js/extensions/String.js b/webapp/web/js/extensions/String.js new file mode 100644 index 000000000..a14d6fa2a --- /dev/null +++ b/webapp/web/js/extensions/String.js @@ -0,0 +1,5 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +String.prototype.capitalize = function() { + return this.substring(0,1).toUpperCase() + this.substring(1); +}; \ No newline at end of file