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

View File

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

View File

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