[opencms-dev] 回复: Why my document doesn't contain released date?

Polina Beutling p.beutling at alkacon.com
Mon Sep 10 12:02:17 CEST 2012


Hello,

"daterealeased" is not a property, but an attribute. So please try 
following:

<mapping element="Date" mapto="attribute:datereleased"/>

-- 
Kind Regards,
Polina.
  
-------------------

Visit OpenCms Days 2012 Conference and Expo September 24 to 25, 2012 in Cologne, Germany http://www.opencms-days.org

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




Am 03.09.2012 15:04, schrieb Fantasy:
> Hi, Wolfgang,
>
> Thanks for your explanation.
>
> What i need is when clicking Save button, the Date's value would be 
> filled to datereleased. The Date has a default value as 
> ${currenttime}, and I did fill the date's value when editing, but 
> nothing happened after saved. What's going on?
>
> Fantasy
>
>
> ------------------ 原始邮 件 ------------------
> *发件人:* "Wolfgang Illmeyer"<wolfgang.illmeyer at gmx.net>;
> *发送时间:* 2012年9月2日(星期天) 晚上7:35
> *收件人:* "The OpenCms mailing list"<opencms-dev at opencms.org>;
> *主题:* Re: [opencms-dev] Why my document doesn't contain released date?
>
> Hi,
>
> What you specified is supposed to take the contents of the "Date" 
> field of the structured content and write it to a "datereleased" 
> property on certain occasions (e.g. when you press "save" in the 
> structured content editor). If you don't put anything in the "Date" 
> field, nothing will happen at all.
>
> If you want a "release date" (whatever that could be), I'd recommend 
> to use OpenCms API to to extract it from the CmsResource somehow 
> (instead of explicitly storing it, if possible), or maybe there is 
> some <cms:...> tag that can do that, too.
>
> If you think of "release date" as the date of the last publish of the 
> file, you can CmsObject.readAllAvailableVersions(), execute 
> getPublishTag() on the first I_CmsHistoryResource and use the result 
> to CmsObject.readHistoryProject(), which has a getPublishingDate().
>
> If you think of "release date" as the date of the first publish of the 
> file... Maybe you should fill it automatically by listening to 
> I_CmsListener.EVENT_BEFORE_PUBLISH_PROJECT. You'll need to implement 
> and register an I_CmsModuleAction class for you module to achieve that.
>
> Regards,
>
> Wolfgang
>
> Am Sonntag, 2. September 2012, 11:38:30 schrieb Fantasy:
>
> Hi, all,
>
> I defined a document schema file, and add the following mapping, but 
> when i check in the file list, non of the documents contain the 
> realeased date. Why?
>
> the definitions:
> <xsd:complexType name="OpenCmsVideoDocument">
>     <xsd:sequence>
>         <!--  some other attributes -->
> <xsd:element name="Date" type="OpenCmsDateTime" minOccurs="1" 
> maxOccurs="1"/>
>         <xsd:element name="URL" type="OpenCmsString" minOccurs="1" 
> maxOccurs="1"/>
>         <!--  some other attributes -->
>     </xsd:sequence>
>     <xsd:attribute name="language" type="OpenCmsLocale" use="required"/>
> </xsd:complexType>
>
> the mappings:
> <mappings>
>     <!-- some other mapping -->
>     <mapping element="Keywords" mapto="property:Keywords"/>
> <mapping element="Date" mapto="property:datereleased"/>
> </mappings>
>
>
> Thanks.
>
> Fantasy
>
>
>
>
>
> _______________________________________________
> 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/cgi-bin/mailman/listinfo/opencms-dev
>
>
>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20120910/9712b1bb/attachment.htm>


More information about the opencms-dev mailing list