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

Carl Alex Friis Nielsen cfn at kb.dk
Mon Aug 17 09:50:55 CEST 2009


That would only allow changing content when editing a field - if you want to truly reflect changes in the properties, then modifying the property dialog is the way to go.
You wouldn't need to change the behavior of the dialog for other resource types, so seen from a user perspective everything will then appear "normal" for resource types except the one you8 want to handle differently.

Are you aware that you can specify in the schema for an xml resource type, that an element shall be initialized to the value of a property at creation time ?

Cheers,

Carl

-----Oprindelig meddelelse-----
Fra: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] På vegne af Alain TOMASIAN
Sendt: 17. august 2009 09:42
Til: Michael Moossen
Cc: The OpenCms mailing list
Emne: Re: [opencms-dev] How to map a property with a xml content element ?

Hi Michael,

Thanks for your help :-)

This solution isn't good for me because it's affect a global OpenCMS application.

I prefer extend OpenCms with developing a custom widget for a structured content.

Regards,

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
__________________________________________


> 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
>



_______________________________________________
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