[opencms-dev] How to map a property with a xml content element ?

Michael Moossen m.moossen at alkacon.com
Mon Aug 17 08:47:30 CEST 2009


Hi Alain!

for this you will need to extend the property dialog.
and set your dialog class in your opencms-workplace.xml configuration 
file, under the dialoghandler node.

if you decide to extend the default property dialog 
(org.opencms.workplace.commons.CmsPropertyAdvanced) you have just to 
overwrite the performDialogOperation(HttpServletRequest) method.

there in the main loop, check for the properties you want to map and 
write them to xml content. should not be more than 20 loc.

HTH
-------------------
Michael Moossen

Alkacon Software GmbH  - The OpenCms Experts
http://www.alkacon.com - http://www.opencms.org


Alain TOMASIAN schrieb:
> Hi Christian,
> 
> Thanks for your answer.
> 
> In fact, I'd like to change the xml content value (that which is mapped with
> the Title property) when I change the Title property from the OpenCMS
> properties widget in the explorer.
> 
> But it seems that is not possible without writing specific code ?
> 
> Alain.
> __________________________________________
>  Alain TOMASIAN - NAOS Technologies
>  33, avenue Philippe Auguste - 75011 PARIS
>  +33 1 402 402 86 - http://www.naos.com
> __________________________________________
> Découvrez notre solution de communication
>      par email : http://www.enews.fr
> __________________________________________
> 
> 
>> Alain TOMASIAN wrote:
>>> Hi,
>>>
>>> I'd like to know how can I map property (a Title for example) to a xml
>>> content
>>> element. And if is it possible to put the Title value property in this
>>> element
>>> when I edit it ?
>>>
>>> I know that it's possible to map the xml content element to a Title property
>>> like this :
>>>
>>> <mapping element="Legend" mapto="property:Title" />
>>>
>>> but I need to have the opposite :-)
>>>
>> What should the opposite be?
>> The mapping works both ways. It should take the old value from the
>> property if it is there, otherwise from the XML content field. When
>> saving your xml file, the value will be saved both into your xml field
>> and into your property. In general, the mapping just works at edit time,
>> it will change the way how existing files are interpreted when they are
>> only being read.
>>
>> If you want to somehow re-organize content and merge some properties
>> into your XML content so that the data can then be read differently,
>> then you might need to write a custom piece of code that does this kind
>> of merging, since - as stated before - the mapping will only be
>> evaluated, whenever the file is saved in the editor^.
>>
>> hth
>> Christian
>>> Thanks for your answers
>>>
>>> Alain.
>>> __________________________________________
>>>  Alain TOMASIAN - NAOS Technologies
>>>  33, avenue Philippe Auguste - 75011 PARIS
>>>  +33 1 402 402 86 - http://www.naos.com
>>> __________________________________________
>>> Découvrez notre solution de communication
>>>      par email : http://www.enews.fr
>>> __________________________________________
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> This mail is sent to you from the opencms-dev mailing list
>>> To change your list options, or to unsubscribe from the list, please visit
>>> http://lists.opencms.org/mailman/listinfo/opencms-dev
>>>
>>>
> 
> 
> 
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev



More information about the opencms-dev mailing list