CT NewsItem

* Kleine Korrekturen

git-svn-id: https://svn.libreccm.org/ccm/trunk@440 8810af33-2d31-482b-a856-94f89814c4df
master
quasi 2010-05-26 06:58:52 +00:00
parent 8fde211eba
commit 90acf45f3c
3 changed files with 48 additions and 51 deletions

View File

@ -1,36 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<ctd:content-types xmlns:ctd="http://xmlns.redhat.com/cms/content-types"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.redhat.com/cms/content-types content-types.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.redhat.com/cms/content-types content-types.xsd">
<ctd:content-type
label="NewsItem"
description="A news item type"
objectType="com.arsdigita.cms.contenttypes.NewsItem"
classname="com.arsdigita.cms.contenttypes.NewsItem">
<ctd:content-type
label="NewsItem"
description="A news item type"
objectType="com.arsdigita.cms.contenttypes.NewsItem"
classname="com.arsdigita.cms.contenttypes.NewsItem">
<ctd:authoring-kit
createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
<ctd:authoring-kit
createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
<ctd:authoring-step
labelKey="cms.contenttypes.shared.basic_properties.title"
labelBundle="com.arsdigita.cms.ui.CMSResources"
descriptionKey="newsitem.authoring.body_text.description"
descriptionBundle="com.arsdigita.cms.contenttypes.NewsItemResources"
<ctd:authoring-step
labelKey="cms.contenttypes.shared.basic_properties.title"
labelBundle="com.arsdigita.cms.ui.CMSResources"
descriptionKey="newsitem.authoring.body_text.description"
descriptionBundle="com.arsdigita.cms.contenttypes.NewsItemResources"
component="com.arsdigita.cms.contenttypes.ui.NewsItemPropertiesStep"/>
<ctd:include href="/WEB-INF/content-types/edit-body-text-step.xml"/>
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
<ctd:include href="/WEB-INF/content-types/edit-body-text-step.xml"/>
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
<ctd:authoring-step
labelKey="newsitem.authoring.image.title"
labelBundle="com.arsdigita.cms.contenttypes.NewsItemResources"
descriptionKey="newsitem.authoring.image.description"
descriptionBundle="com.arsdigita.cms.contenttypes.NewsItemResources"
<ctd:authoring-step
labelKey="newsitem.authoring.image.title"
labelBundle="com.arsdigita.cms.contenttypes.NewsItemResources"
descriptionKey="newsitem.authoring.image.description"
descriptionBundle="com.arsdigita.cms.contenttypes.NewsItemResources"
component="com.arsdigita.cms.ui.authoring.ArticleImage"/>
</ctd:authoring-kit>
</ctd:authoring-kit>
</ctd:content-type>
</ctd:content-type>
</ctd:content-types>

View File

@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<xrd:adapters xmlns:xrd="http://xmlns.redhat.com/schemas/waf/xml-renderer-rules"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://rhea.redhat.com/schemas/waf/xml-renderer-rules xml-renderer-rules.xsd">
<!-- No need to list all the content types here. Only
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://rhea.redhat.com/schemas/waf/xml-renderer-rules xml-renderer-rules.xsd">
<!-- No need to list all the content types here. Only
need to list a type if is adds associations that
were not in the parent type, or to remove attributes
-->
<!-- First off the adapters for ContentItemPanel -->
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator">
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.NewsItem"
extends="com.arsdigita.cms.basetypes.Article"
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator">
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.NewsItem"
extends="com.arsdigita.cms.basetypes.Article"
traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter">
<xrd:formatter property="/object/newsDate"
class="com.arsdigita.xml.formatters.DateFormatter"/>
</xrd:adapter>
</xrd:context>
<xrd:formatter property="/object/newsDate"
class="com.arsdigita.xml.formatters.DateFormatter"/>
</xrd:adapter>
</xrd:context>
</xrd:adapters>

View File

@ -18,8 +18,6 @@
*/
package com.arsdigita.cms.contenttypes;
import com.arsdigita.cms.basetypes.Article;
import com.arsdigita.cms.ContentType;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.persistence.DataObject;
@ -57,26 +55,23 @@ import java.util.Date;
* @author Shashin Shinde <a href="mailto:sshinde@redhat.com">sshinde@redhat.com</a>
* @version $Revision: #7 $ $Date: 2004/08/17 $
**/
public class NewsItem extends Article {
public class NewsItem extends com.arsdigita.cms.basetypes.Article {
/** PDL property name for lead */
public static final String LEAD = "lead";
/** PDL property name for news date */
public static final String NEWS_DATE = "newsDate";
public static final String IS_HOMEPAGE = "isHomepage";
public static final String RECENT_NEWS =
"com.arsdigita.cms.contenttypes.RecentNews";
public static final String RECENT_NEWS =
"com.arsdigita.cms.contenttypes.RecentNews";
/** Data object type for this domain object */
public static final String BASE_DATA_OBJECT_TYPE
= "com.arsdigita.cms.contenttypes.NewsItem";
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.NewsItem";
private static final NewsItemConfig s_config = new NewsItemConfig();
static {
s_config.load();
}
public static final NewsItemConfig getConfig() {
return s_config;
}
@ -101,17 +96,19 @@ public class NewsItem extends Article {
super(type);
}
@Override
public void initialize() {
super.initialize();
if (isNew()) {
setIsHomepage(Boolean.FALSE);
}
}
@Override
public void beforeSave() {
super.beforeSave();
Assert.exists(getContentType(), ContentType.class);
}
@ -139,19 +136,19 @@ public class NewsItem extends Article {
public String getDisplayNewsDate() {
Date d = getNewsDate();
return (d != null) ? DateFormat.getDateInstance(DateFormat.LONG)
.format(d) : null;
return (d != null) ? DateFormat.getDateInstance(DateFormat.LONG).format(d) : null;
}
public void setNewsDate(Date newsDate) {
set(NEWS_DATE, newsDate);
}
public static final int SUMMARY_LENGTH = 200;
@Override
public String getSearchSummary() {
return com.arsdigita.util.StringUtils.truncateString(getLead(),
SUMMARY_LENGTH,
true);
SUMMARY_LENGTH,
true);
}
/*