You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by ch...@apache.org on 2006/09/25 09:30:56 UTC
svn commit: r449591 - in /lenya/trunk/src:
modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Create.java
webapp/lenya/usecases/usecases.js
Author: chestnut
Date: Mon Sep 25 00:30:55 2006
New Revision: 449591
URL: http://svn.apache.org/viewvc?view=rev&rev=449591
Log:
allow for multivalue metadata when creating a document (Array param values returned as comma separated string)
Modified:
lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Create.java
lenya/trunk/src/webapp/lenya/usecases/usecases.js
Modified: lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Create.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Create.java?view=diff&rev=449591&r1=449590&r2=449591
==============================================================================
--- lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Create.java (original)
+++ lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Create.java Mon Sep 25 00:30:55 2006
@@ -188,6 +188,19 @@
}
protected String getDublinCoreParameter(String name) {
+ Object param = getParameter(DUBLIN_CORE_PREFIX + name);
+ if (param != null && getParameter(DUBLIN_CORE_PREFIX + name).getClass().isArray()) {
+ String[] values = (String[]) getParameter(DUBLIN_CORE_PREFIX + name);
+ String paramValue = new String("");
+ for (int i = 0; i < values.length; i++ ) {
+ String value = values[i];
+ if (i > 0)
+ paramValue = paramValue + ',' + value;
+ else
+ paramValue = value;
+ }
+ return paramValue;
+ }
return getParameterAsString(DUBLIN_CORE_PREFIX + name, null);
}
Modified: lenya/trunk/src/webapp/lenya/usecases/usecases.js
URL: http://svn.apache.org/viewvc/lenya/trunk/src/webapp/lenya/usecases/usecases.js?view=diff&rev=449591&r1=449590&r2=449591
==============================================================================
--- lenya/trunk/src/webapp/lenya/usecases/usecases.js (original)
+++ lenya/trunk/src/webapp/lenya/usecases/usecases.js Mon Sep 25 00:30:55 2006
@@ -33,9 +33,13 @@
var string = new Packages.java.lang.String();
var vector = new Packages.java.util.Vector();
if (string.getClass().isInstance(value) || vector.getClass().isInstance(value)) {
- // use getParameter() to avoid character encoding problems
- value = flowHelper.getRequest(cocoon).getParameter(name);
- usecase.setParameter(name, value);
+ // use getParameters() to avoid character encoding problems
+ var values = flowHelper.getRequest(cocoon).getParameterValues(name);
+ if (values.length < 2) {
+ usecase.setParameter(name, values[0]);
+ } else {
+ usecase.setParameter(name, values);
+ }
}
else {
usecase.setPart(name, value);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org
Re: svn commit: r449591 - in /lenya/trunk/src: modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Create.java
webapp/lenya/usecases/usecases.js
Posted by Doug Chestnut <dh...@virginia.edu>.
Jörn Nettingsmeier wrote:
> Doug Chestnut wrote:
>
>>
>>
>> Jörn Nettingsmeier wrote:
>>
>>> chestnut@apache.org wrote:
>>>
>>>> Author: chestnut
>>>> Date: Mon Sep 25 00:30:55 2006
>>>> New Revision: 449591
>>>>
>>>> URL: http://svn.apache.org/viewvc?view=rev&rev=449591
>>>> Log:
>>>> allow for multivalue metadata when creating a document (Array param
>>>> values returned as comma separated string)
>>>
>>>
>>>
>>> i like multivalue metadata. but does that mean that metadata entries
>>> cannot contain commas any longer? if so, that is certainly going to
>>> bite someone badly at some point.
>>
>> Sure they can, it is just a way to handle multiple values (which was
>> not supported before, the first value was stored only).
>>
>> <select name="dublincore.subject" multiple="multiple">
>> <option value="Reading,Writing,Arithmetic">General Subjects</option>
>> <option>Art</option>
>> <option>History</option>
>> </select>
>
>
>
> + protected String getDublinCoreParameter(String name) {
> + Object param = getParameter(DUBLIN_CORE_PREFIX + name);
> + if (param != null && getParameter(DUBLIN_CORE_PREFIX +
> name).getClass().isArray()) {
> + String[] values = (String[])
> getParameter(DUBLIN_CORE_PREFIX + name);
>
> say values[] = { "simplestring", "another, more complicated string" };
>
> + String paramValue = new String("");
> + for (int i = 0; i < values.length; i++ ) {
> + String value = values[i];
> + if (i > 0)
> + paramValue = paramValue + ',' + value;
> + else
> + paramValue = value;
> + }
> + return paramValue;
>
> now paramValue will be "simplestring,another, more complicated string".
> which looks like three tokens. in your example, this does not hurt,
> since you are using the concatenated string as-is, without looking
> inside. but what if i need to get at the single tokens?
Short term: Use whatever solution you had when multivalue selects were
ignored :)
I guess that these metadata values need to be stored in separate
elements, and accessed as arrays. This digs deeper into the code base
than I have time for today, but I will look into this asap unless
someone else beats me to it ;).
--Doug
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: svn commit: r449591 - in /lenya/trunk/src: modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Create.java
webapp/lenya/usecases/usecases.js
Posted by Jörn Nettingsmeier <po...@uni-duisburg-essen.de>.
Doug Chestnut wrote:
>
>
> Jörn Nettingsmeier wrote:
>> chestnut@apache.org wrote:
>>
>>> Author: chestnut
>>> Date: Mon Sep 25 00:30:55 2006
>>> New Revision: 449591
>>>
>>> URL: http://svn.apache.org/viewvc?view=rev&rev=449591
>>> Log:
>>> allow for multivalue metadata when creating a document (Array param
>>> values returned as comma separated string)
>>
>>
>> i like multivalue metadata. but does that mean that metadata entries
>> cannot contain commas any longer? if so, that is certainly going to
>> bite someone badly at some point.
> Sure they can, it is just a way to handle multiple values (which was not
> supported before, the first value was stored only).
>
> <select name="dublincore.subject" multiple="multiple">
> <option value="Reading,Writing,Arithmetic">General Subjects</option>
> <option>Art</option>
> <option>History</option>
> </select>
+ protected String getDublinCoreParameter(String name) {
+ Object param = getParameter(DUBLIN_CORE_PREFIX + name);
+ if (param != null && getParameter(DUBLIN_CORE_PREFIX +
name).getClass().isArray()) {
+ String[] values = (String[])
getParameter(DUBLIN_CORE_PREFIX + name);
say values[] = { "simplestring", "another, more complicated string" };
+ String paramValue = new String("");
+ for (int i = 0; i < values.length; i++ ) {
+ String value = values[i];
+ if (i > 0)
+ paramValue = paramValue + ',' + value;
+ else
+ paramValue = value;
+ }
+ return paramValue;
now paramValue will be "simplestring,another, more complicated string".
which looks like three tokens. in your example, this does not hurt,
since you are using the concatenated string as-is, without looking
inside. but what if i need to get at the single tokens?
--
"Open source takes the bullshit out of software."
- Charles Ferguson on TechnologyReview.com
--
Jörn Nettingsmeier, EDV-Administrator
Institut für Politikwissenschaft
Universität Duisburg-Essen, Standort Duisburg
Mail: pol-admin@uni-due.de, Telefon: 0203/379-2736
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: svn commit: r449591 - in /lenya/trunk/src: modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Create.java
webapp/lenya/usecases/usecases.js
Posted by Doug Chestnut <dh...@virginia.edu>.
Jörn Nettingsmeier wrote:
> chestnut@apache.org wrote:
>
>> Author: chestnut
>> Date: Mon Sep 25 00:30:55 2006
>> New Revision: 449591
>>
>> URL: http://svn.apache.org/viewvc?view=rev&rev=449591
>> Log:
>> allow for multivalue metadata when creating a document (Array param
>> values returned as comma separated string)
>
>
> i like multivalue metadata. but does that mean that metadata entries
> cannot contain commas any longer? if so, that is certainly going to bite
> someone badly at some point.
Sure they can, it is just a way to handle multiple values (which was not
supported before, the first value was stored only).
<select name="dublincore.subject" multiple="multiple">
<option value="Reading,Writing,Arithmetic">General Subjects</option>
<option>Art</option>
<option>History</option>
</select>
--Doug
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: svn commit: r449591 - in /lenya/trunk/src: modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Create.java
webapp/lenya/usecases/usecases.js
Posted by Jörn Nettingsmeier <po...@uni-duisburg-essen.de>.
chestnut@apache.org wrote:
> Author: chestnut
> Date: Mon Sep 25 00:30:55 2006
> New Revision: 449591
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=449591
> Log:
> allow for multivalue metadata when creating a document (Array param values returned as comma separated string)
i like multivalue metadata. but does that mean that metadata entries
cannot contain commas any longer? if so, that is certainly going to bite
someone badly at some point.
--
"Open source takes the bullshit out of software."
- Charles Ferguson on TechnologyReview.com
--
Jörn Nettingsmeier, EDV-Administrator
Institut für Politikwissenschaft
Universität Duisburg-Essen, Standort Duisburg
Mail: pol-admin@uni-due.de, Telefon: 0203/379-2736
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org