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

Wolfgang Illmeyer wolfgang.illmeyer at gmx.net
Sun Sep 2 13:35:13 CEST 2012


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




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


More information about the opencms-dev mailing list