maurizio pillitu wrote:
Hi everybody,
I would like to be able to set tags to assets; the list of assets is stored in 
a Hippo CMS backend template.

At the moment I managed to pickup a tag from a selection-list with the 
following code:

- extensions/types/types.xml

<types>
 ...
 <resource name="asset" label="types:cms.types.label.asset" type="abstract" 
i18n:attr="label">
    <properties>cocoon://extensions/types/asset-properties</properties>
 </resource>
 ...
</types>


- extensions/types/sitemap.xmap

<?xml version="1.0" encoding="UTF-8"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0";>
  <map:pipelines>
<map:pipeline type="noncaching" >

      <map:match pattern="asset-properties">
        <map:generate src="asset/properties.xml"/>
        <map:transform type="include"/>
        <map:transform src="resources/tags2props.xsl"/>
        <map:serialize type="xml"/>
      </map:match>

      <map:match pattern="getCategories">
        <map:generate 
src="webdav://{repository:host}:{repository:port}{repository:rootPath}{repository:filesPath}/content/meta/categories.xml"/>
        <map:serialize type="xml"/>
      </map:match>

    </map:pipeline>
  </map:pipelines>
</map:sitemap>


- extesions/asset/properties.xml

<?xml version="1.0"?>
<Properties xmlns:i18n="http://apache.org/cocoon/i18n/2.1";
        xmlns:ci="http://apache.org/cocoon/include/1.0";>
        <Property>
                <Name>tag</Name>
                <DisplayName>Tag</DisplayName>
                <Namespace>http://hippo.nl/cms/1.0</Namespace>
                <NamespacePrefix>cms</NamespacePrefix>
                <Datatype>string</Datatype>
                <ci:include src="cocoon:/getCategories"/>
        </Property>
</Properties>


What I would like to have is instead a multivalue field; I tried to patch the 
cForm /editor/src/site/explorer/transformers/propform cform, but I get a 
binding error

An error occured during loading: Cannot set value of field 'cms-tag' with an 
object of type java.lang.String

Probably the multivalue field should rely on a Object[] model; however I 
couldn't find the way to fix it. Any ideas?

TIA!


Met vriendelijke groet,


Are you dynamically patching the propform model definition ? You can just define the list in the CForms model definition like this:

<fd:multivaluefield id="drinks" required="true">
<fd:label>Indicate which 2 of the following drinks you'd like to receive:</fd:label>
         <fd:datatype base="string"/>
         <fd:validation>
           <fd:value-count exact="2"/>
         </fd:validation>
         <fd:selection-list>
           <fd:item value="Maes"/>
           <fd:item value="Jupiler"/>
           <fd:item value="Leffe"/>
           <fd:item value="Hoegaarden"/>
           <fd:item value="Coca Cola"/>
         </fd:selection-list>
       </fd:multivaluefield>


This is a sample from the Cocoon forms block btw.. Might be worth having a look at.

The overall approach of your solution is ok. Do you think you can make a generic solution and provide a patch for Hippo CMS to support multi value lists?

Dennis

--
Hippo
[EMAIL PROTECTED]

Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466 San Francisco - Hippo USA Inc. 101 H Street, suite Q Petaluma CA 94952-3329 +1 (707) 773-4646

www.onehippo.com [EMAIL PROTECTED]

********************************************
Hippocms-dev: Hippo CMS development public mailinglist

Reply via email to