<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Simply use <br>
...<br>
<span style=" font-weight:600;"><mapping element="</span><span
style=" font-weight:600; color:#0000ff;">Date</span><span
style=" font-weight:600;">" mapto="attribute:datereleased"/></span><br>
...<br>
<br>
Best,<br>
Tobias<br>
<br>
Am 03.09.2012 14:04, schrieb Fantasy:<br>
</div>
<blockquote cite="mid:tencent_34DF576270E96E6C0F1E1828@qq.com"
type="cite">Hi, Wolfgang,<br>
<br>
<div>Thanks for your explanation.<br>
<br>
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?<br>
<br>
Fantasy<br>
</div>
<div><includetail>
<div><br>
</div>
<div><br>
</div>
<div style="font-size: 12px;font-family: Arial
Narrow;padding:2px 0 2px 0;">------------------ 原始邮
件 ------------------</div>
<div style="font-size: 12px;background:#efefef;padding:8px;">
<div><b>发件人:</b> "Wolfgang
Illmeyer"<a class="moz-txt-link-rfc2396E" href="mailto:wolfgang.illmeyer@gmx.net"><wolfgang.illmeyer@gmx.net></a>;</div>
<div><b>发送时间:</b> 2012年9月2日(星期天) 晚上7:35</div>
<div><b>收件人:</b> "The OpenCms mailing
list"<a class="moz-txt-link-rfc2396E" href="mailto:opencms-dev@opencms.org"><opencms-dev@opencms.org></a>; <wbr></div>
<div><b>主题:</b> Re: [opencms-dev] Why my document doesn't
contain released date?</div>
</div>
<div><br>
</div>
<style type="text/css">
</style>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;
-qt-user-state:0;">Hi,</p>
<p style="-qt-paragraph-type:empty; margin-top:0px;
margin-bottom:0px; margin-left:0px; margin-right:0px;
-qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;
-qt-user-state:0;">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.</p>
<p style="-qt-paragraph-type:empty; margin-top:0px;
margin-bottom:0px; margin-left:0px; margin-right:0px;
-qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;
-qt-user-state:0;">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.</p>
<p style="-qt-paragraph-type:empty; margin-top:0px;
margin-bottom:0px; margin-left:0px; margin-right:0px;
-qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;
-qt-user-state:0;">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().</p>
<p style="-qt-paragraph-type:empty; margin-top:0px;
margin-bottom:0px; margin-left:0px; margin-right:0px;
-qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;
-qt-user-state:0;">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.</p>
<p style="-qt-paragraph-type:empty; margin-top:0px;
margin-bottom:0px; margin-left:0px; margin-right:0px;
-qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;
-qt-user-state:0;">Regards,</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;
-qt-user-state:0;">Wolfgang</p>
<p style="-qt-paragraph-type:empty; margin-top:0px;
margin-bottom:0px; margin-left:0px; margin-right:0px;
-qt-block-indent:0; text-indent:0px; "> </p>
<p style="-qt-paragraph-type:empty; margin-top:0px;
margin-bottom:0px; margin-left:0px; margin-right:0px;
-qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;
-qt-user-state:0;">Am Sonntag, 2. September 2012, 11:38:30
schrieb Fantasy:<br>
</p>
<p style=" margin-top:12px; margin-bottom:0px;
margin-left:40px; margin-right:40px; -qt-block-indent:0;
text-indent:0px; -qt-user-state:0;">Hi, all,<br>
<br>
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?<br>
<br>
<span style=" font-weight:600;">the definitions:</span><br>
<span style=" background-color:#ffffff;"><xsd:complexType
name="OpenCmsVideoDocument"><br>
<xsd:sequence><br>
<!-- some other attributes --><br>
</span><span style=" font-weight:600;
background-color:#ffffff;"><xsd:element name="</span><span
style=" font-weight:600; color:#0000ff;
background-color:#ffffff;">Date</span><span style="
font-weight:600; background-color:#ffffff;">"
type="OpenCmsDateTime" minOccurs="1" maxOccurs="1"/></span><span
style=" background-color:#ffffff;"><br>
<xsd:element name="URL" type="OpenCmsString"
minOccurs="1" maxOccurs="1"/><br>
<!-- some other attributes --><br>
</xsd:sequence><br>
<xsd:attribute name="language" type="OpenCmsLocale"
use="required"/><br>
</xsd:complexType></span><br>
<br>
<span style=" font-weight:600;">the mappings:</span><br>
<mappings><br>
<!-- some other mapping --><br>
<mapping element="Keywords"
mapto="property:Keywords"/><br>
<span style=" font-weight:600;"><mapping element="</span><span
style=" font-weight:600; color:#0000ff;">Date</span><span
style=" font-weight:600;">"
mapto="property:datereleased"/></span><br>
</mappings><br>
<br>
<br>
Thanks.<br>
<br>
Fantasy<br>
<br>
</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;
-qt-user-state:0;"><br>
<br>
</p>
</includetail></div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
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
<a class="moz-txt-link-freetext" href="http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev">http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev</a>
</pre>
</blockquote>
<br>
</body>
</html>