This patch contains original user's paths.
I've cleaned them and I attach for updating in sourceforge.
Thank you
LucĂa
SourceForge.net wrote:
Patches item #1689150, was opened at 2007-03-27 15:16
Message generated for change (Settings changed) made by bollini
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=319984&aid=1689150&group_id=19984
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Closed
Resolution: Accepted
Priority: 5
Private: No
Submitted By: Andrea Bollini (bollini)
Assigned to: Andrea Bollini (bollini)
Summary: improvement of ControlledVocabulary
Initial Comment:
This patch fix the bug #1689143 (ControlledVocabulary don't works with onebox)
and add some improvement.
1) the controlled vocabulary now works also with textarea
2) for any field with vocabulary you can specify in input-forms.xml if the vocabulary is close or open (i.e. if it is possible insert free value for this field). The default is "open" (the current dspace behaviour) for "close" you need to add a "closed" attribute to vocabulary tag with value true|yes. For example
<field>
<dc-schema>dc</dc-schema>
<dc-element>subject</dc-element>
<dc-qualifier></dc-qualifier>
<!-- An input-type of twobox MUST be marked as repeatable -->
<repeatable>true</repeatable>
<label>Subject Keywords</label>
<input-type>onebox</input-type>
<hint> Enter appropriate subject keywords or phrases below. </hint>
<required></required>
<vocabulary closed="true">srsc</vocabulary>
</field>
The closure is add only to the webui and not at the business logic. It uses the
(x)html readonly property for input/textarea tag.
----------------------------------------------------------------------
Comment By: Andrea Bollini (bollini)
Date: 2007-04-06 10:58
Message:
Logged In: YES
user_id=1293299
Originator: YES
File Added: improvementControlledVocabulary_doc
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=319984&aid=1689150&group_id=19984
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Dspace-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dspace-devel
Index: docs/configure.html
===================================================================
--- docs/configure.html (revision 1762)
+++ docs/configure.html (working copy)
@@ -1041,12 +1041,17 @@
<input-type>twobox</input-type><br/>
<hint> Enter appropriate subject
keywords or phrases below. </hint><br/>
<required></required><br/>
- <b> <vocabulary>nsi</vocabulary></b><br/>
+ <b> <vocabulary
[closed="false"]>nsi</vocabulary></b><br/>
</field><br/>
</code>
</p>
-
<p>
+The vocabulary element has an optional boolean attribute <b>closed</b> that
can be used to force input only with
+the javascript of controlled-vocabulary add-on.
+The default behaviour (i.e. without this attribute) is as set
<b>closed="false"</b>.
+This allow the user also to enter the value in free way.
+</p>
+<p>
The following vocabularies are currently available by default:
</p>
<ul>
Index: src/org/dspace/app/webui/util/DCInput.java
===================================================================
--- src/org/dspace/app/webui/util/DCInput.java (revision 1748)
+++ src/org/dspace/app/webui/util/DCInput.java (working copy)
@@ -92,6 +92,9 @@
/** the name of the controlled vocabulary to use */
private String vocabulary = null;
+ /** is the entry closed to vocabulary terms? */
+ private boolean closedVocabulary = false;
+
/**
* Class constructor for creating a DCInput object based on the contents of
* a HashMap
@@ -127,6 +130,9 @@
required = (warning != null && warning.length() > 0);
visibility = (String) fieldMap.get("visibility");
vocabulary = (String) fieldMap.get("vocabulary");
+ String closedVocabularyStr = (String) fieldMap.get("closedVocabulary");
+ closedVocabulary = "true".equalsIgnoreCase(closedVocabularyStr)
+ || "yes".equalsIgnoreCase(closedVocabularyStr);
}
/**
@@ -349,4 +355,21 @@
return null;
}
+ /**
+ * The closed attribute of the vocabulary tag for this field as set in
+ * input-forms.xml
+ *
+ * <code>
+ * <field>
+ * .....
+ * <vocabulary closed="true">nsrc</vocabulary>
+ * </field>
+ * </code>
+ * @return the closedVocabulary flags: true if the entry should be
restricted
+ * only to vocabulary terms, false otherwise
+ */
+ public boolean isClosedVocabulary() {
+ return closedVocabulary;
+ }
+
}
Index: src/org/dspace/app/webui/util/DCInputsReader.java
===================================================================
--- src/org/dspace/app/webui/util/DCInputsReader.java (revision 1748)
+++ src/org/dspace/app/webui/util/DCInputsReader.java (working copy)
@@ -421,6 +421,11 @@
}
}
}
+ else if (tagName.equals("vocabulary"))
+ {
+ String closedVocabularyString =
getAttribute(nd, "closed");
+ field.put("closedVocabulary",
closedVocabularyString);
+ }
}
}
String missing = null;
Index: jsp/submit/edit-metadata.jsp
===================================================================
--- jsp/submit/edit-metadata.jsp (revision 1748)
+++ jsp/submit/edit-metadata.jsp (working copy)
@@ -413,7 +413,7 @@
void doTextArea(javax.servlet.jsp.JspWriter out, Item item,
String fieldName, String schema, String element, String qualifier,
boolean repeatable,
- int fieldCountIncr, String label, PageContext pageContext)
+ int fieldCountIncr, String label, PageContext pageContext, String
vocabulary, boolean closedVocabulary)
throws java.io.IOException
{
@@ -443,9 +443,13 @@
.append(fieldName);
if (repeatable)
sb.append("_").append(i);
- sb.append("\" rows=\"4\" cols=\"45\" >")
+ sb.append("\" rows=\"4\" cols=\"45\"")
+ .append(hasVocabulary(vocabulary)&&closedVocabulary?"
readonly=\"readonly\" ":"")
+ .append(" >")
.append(val)
- .append("</textarea></td>\n");
+ .append("</textarea>")
+ .append(doControlledVocabulary(fieldName + (repeatable?"_" + i:""),
pageContext, vocabulary))
+ .append("</td>\n");
if (repeatable && i < defaults.length)
{
@@ -481,7 +485,7 @@
void doOneBox(javax.servlet.jsp.JspWriter out, Item item,
String fieldName, String schema, String element, String qualifier,
boolean repeatable,
- int fieldCountIncr, String label, PageContext pageContext, String
vocabulary)
+ int fieldCountIncr, String label, PageContext pageContext, String
vocabulary, boolean closedVocabulary)
throws java.io.IOException
{
@@ -513,9 +517,10 @@
sb.append("_").append(i);
sb.append("\" size=\"50\" value=\"")
- .append(val)
- .append("\"/>")
- .append(doControlledVocabulary(fieldName, pageContext, vocabulary))
+ .append(val +"\"")
+ .append(hasVocabulary(vocabulary)&&closedVocabulary?"
readonly=\"readonly\" ":"")
+ .append("/>")
+ .append(doControlledVocabulary(fieldName + (repeatable?"_" + i:""),
pageContext, vocabulary))
.append("</td>\n");
@@ -553,7 +558,7 @@
void doTwoBox(javax.servlet.jsp.JspWriter out, Item item,
String fieldName, String schema, String element, String qualifier,
boolean repeatable,
- int fieldCountIncr, String label, PageContext pageContext, String
vocabulary)
+ int fieldCountIncr, String label, PageContext pageContext, String
vocabulary, boolean closedVocabulary)
throws java.io.IOException
{
DCValue[] defaults = item.getMetadata(schema, element, qualifier,
Item.ANY);
@@ -596,19 +601,25 @@
.append("_").append(i)
.append("\" size=\"15\" value=\"")
.append(defaults[i].value.replaceAll("\"", """))
- .append("\"/> <input type=\"submit\" name=\"submit_")
+ .append("\"")
+ .append(hasVocabulary(vocabulary)&&closedVocabulary?"
readonly=\"readonly\" ":"")
+ .append("/> <input type=\"submit\" name=\"submit_")
.append(fieldName)
.append("_remove_")
.append(i)
// .append("\" value=\"Remove\"/></td>\n");
.append("\" value=\"")
.append(LocaleSupport.getLocalizedMessage(pageContext,
"jsp.submit.edit-metadata.button.remove2"))
- .append("\"/></td>\n");
+ .append("\"/>")
+ .append(doControlledVocabulary(fieldName + "_" + i, pageContext,
vocabulary))
+ .append("</td>\n");
else
{
sb.append("<td align=\"left\"><input type=\"text\" name=\"")
.append(fieldName).append("_").append(i)
- .append("\" size=\"15\"/>")
+ .append("\" size=\"15\"")
+ .append(hasVocabulary(vocabulary)&&closedVocabulary?"
readonly=\"readonly\" ":"")
+ .append("/>")
.append(doControlledVocabulary(fieldName + "_" + i, pageContext,
vocabulary))
.append("</td>\n");
}
@@ -619,21 +630,27 @@
.append("_").append(i)
.append("\" size=\"15\" value=\"")
.append(defaults[i].value.replaceAll("\"", """))
- .append("\"/> <input type=\"submit\" name=\"submit_")
+ .append("\"")
+ .append(hasVocabulary(vocabulary)&&closedVocabulary?"
readonly=\"readonly\" ":"")
+ .append("/> <input type=\"submit\" name=\"submit_")
.append(fieldName)
.append("_remove_")
.append(i)
// .append("\" value=\"Remove\"/></td></tr>\n");
.append("\" value=\"")
.append(LocaleSupport.getLocalizedMessage(pageContext,
"jsp.submit.edit-metadata.button.remove2"))
- .append("\"/></td></tr>\n");
+ .append("\"/>")
+ .append(doControlledVocabulary(fieldName + "_" + i, pageContext,
vocabulary))
+ .append("</td></tr>\n");
else
{
sb.append("<td align=\"left\"><input type=\"text\" name=\"")
.append(fieldName)
.append("_").append(i)
//.append("\" size=\"15\"/></td>");
- .append("\" size=\"15\"/>")
+ .append("\" size=\"15\"")
+ .append(hasVocabulary(vocabulary)&&closedVocabulary?"
readonly=\"readonly\" ":"")
+ .append("/>")
.append(doControlledVocabulary(fieldName + "_" + i, pageContext,
vocabulary))
.append("</td>\n");
@@ -932,6 +949,8 @@
String inputType = inputs[z].getInputType();
String label = inputs[z].getLabel();
+ boolean closedVocabulary = inputs[z].isClosedVocabulary();
+
if (inputType.equals("name"))
{
doPersonalName(out, item, fieldName, dcSchema, dcElement,
dcQualifier,
@@ -955,7 +974,8 @@
else if (inputType.equals("textarea"))
{
doTextArea(out, item, fieldName, dcSchema, dcElement,
dcQualifier,
- repeatable, fieldCountIncr, label,
pageContext);
+ repeatable, fieldCountIncr, label,
pageContext, vocabulary,
+ closedVocabulary);
}
else if (inputType.equals("dropdown"))
{
@@ -965,12 +985,14 @@
else if (inputType.equals("twobox"))
{
doTwoBox(out, item, fieldName, dcSchema, dcElement,
dcQualifier,
- repeatable, fieldCountIncr, label,
pageContext, vocabulary);
+ repeatable, fieldCountIncr, label,
pageContext, vocabulary,
+ closedVocabulary);
}
else
{
doOneBox(out, item, fieldName, dcSchema, dcElement,
dcQualifier,
- repeatable, fieldCountIncr, label,
pageContext, vocabulary);
+ repeatable, fieldCountIncr, label,
pageContext, vocabulary,
+ closedVocabulary);
}
if (hasVocabulary(vocabulary))
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
DSpace-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech