[opencms-dev] 回复: 回复: Why my document doesn't contain released date?
Fantasy
toberich at qq.com
Sat Sep 15 13:31:36 CEST 2012
Hi, Tobias,
Thanks a lot. I've solved this problem by such solution.
Fantasy
------------------ 原始邮件 ------------------
发件人: "Tobias Karrer"<kartobi at googlemail.com>;
发送时间: 2012年9月15日(星期六) 晚上7:28
收件人: "The OpenCms mailing list"<opencms-dev at opencms.org>;
主题: Re: [opencms-dev]回复: Why my document doesn't contain released date?
Simply use
...
<mapping element="Date" mapto="attribute:datereleased"/>
...
Best,
Tobias
Am 03.09.2012 14: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/20120915/3b934c4a/attachment.htm>
More information about the opencms-dev
mailing list