ContentItem for Talks (as subtype of publication)

git-svn-id: https://svn.libreccm.org/ccm/trunk@4755 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2017-06-01 19:38:44 +00:00
parent 929be68c01
commit f552d85ae7
19 changed files with 607 additions and 1 deletions

View File

@ -39,7 +39,7 @@ public class RelatedLinkCaptionEditForm extends RelatedLinkCaptionForm {
RelatedLink link;
if (m_linkModel.isSelected(state)) {
link = (RelatedLink) m_linkModel.getSelectedLink(state);
if ("caption".equals(link.getTargetURI())) {
if (link != null && "caption".equals(link.getTargetURI())) {
//make this form visible because we are editing and it is a caption not a link
setVisible(state, true);
}

View File

@ -0,0 +1,31 @@
<?xml version="1.0"?>
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
name="ccm-sci-publications-talk"
prettyName="SciPublications Talk"
version="6.6.3"
release="1"
webapp="ROOT">
<ccm:dependencies>
<ccm:requires name="ccm-core" version="6.6.4" relation="ge" />
<ccm:requires name="ccm-cms" version="6.6.7" relation="ge" />
<ccm:requires name="ccm-sci-publications" version="6.6.3" relation="ge" />
</ccm:dependencies>
<ccm:directories>
<ccm:directory name="pdl" />
<ccm:directory name="sql" />
<ccm:directory name="src" />
</ccm:directories>
<ccm:contacts>
<ccm:contact uri="http://www.redhat.com/software/rhea" type="website"/>
<ccm:contact uri="mailto:rhea@redhat.com" type="support"/>
</ccm:contacts>
<ccm:description>
Additional content type Talk for the ccm-sci-publications module
(requested by the ITB).
</ccm:description>
</ccm:application>

View File

@ -0,0 +1,19 @@
model com.arsdigita.cms.contenttypes;
import com.arsdigita.cms.ContentPage;
object type Talk extends Publication {
reference key (ct_talks.talk_id);
String[0..1] event = ct_talks.event;
Date[0..1] dateOfTalk = ct_talks.date;
String[0..1] place = ct_talks.place;
}
object type TalkBundle extends PublicationBundle {
reference key (ct_talk_bundles.bundle_id);
}

View File

@ -0,0 +1,4 @@
@ ddl/oracle-se/create.sql
@ ddl/oracle-se/deferred.sql

View File

@ -0,0 +1,5 @@
begin;
\i ddl/postgres/create.sql
\i ddl/postgres/deferred.sql
end;

View File

@ -0,0 +1,31 @@
<?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">
<ctd:content-type
label="SciPublications/Talk"
description="Base type for Talks"
objectType="com.arsdigita.cms.contenttypes.Talk"
classname="com.arsdigita.cms.contenttypes.Talk">
<ctd:authoring-kit createComponent="com.arsdigita.cms.contenttypes.ui.TalkCreate">
<ctd:authoring-step
labelKey="publications.ui.talk.basic_properties.title"
labelBundle="com.arsdigita.cms.contenttypes.ui.TalkResources"
descriptionKey="publications.ui.talk.basic_properties.description"
descriptionBundle="com.arsdigita.cms.contenttypes.ui.TalkResources"
component="com.arsdigita.cms.contenttypes.ui.TalkPropertiesStep"
ordering="1"/>
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
</ctd:authoring-kit>
</ctd:content-type>
</ctd:content-types>

View File

@ -0,0 +1,18 @@
<?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">
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator" >
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.Talk"
extends="com.arsdigita.cms.contenttypes.Publication">
</xrd:adapter>
</xrd:context>
</xrd:adapters>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<registry>
<!-- Nothing yet -->
</registry>

View File

@ -0,0 +1,18 @@
<load>
<requires>
<table name="inits"/>
<table name="acs_objects"/>
<table name="cms_items"/>
<table name="ct_publications"/>
<initializer class="com.arsdigita.cms.Initializer"/>
<initializer class="com.arsdigita.cms.contenttypes.UnPublishedInitializer"/>
</requires>
<provides>
<table name="ct_talks"/>
<initializer class="com.arsdigita.cms.contenttypes.TalkInitializer"/>
</provides>
<scripts>
<schema directory="ccm-sci-publications-talk"/>
<data class="com.arsdigita.cms.contenttypes.TalkLoader"/>
</scripts>
</load>

View File

@ -0,0 +1,88 @@
/*
* Copyright (c) 2017 Jens Pelzetter,
* ScientificCMS Team, http://www.scientificcms.org
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.cms.contenttypes;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.OID;
import java.math.BigDecimal;
import java.util.Date;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class Talk extends Publication {
public static final String BASE_DATA_OBJECT_TYPE
= "com.arsdigita.cms.contenttypes.Talk";
public static final String EVENT = "event";
public static final String DATE_OF_TALK = "dateOfTalk";
public static final String PLACE = "place";
public Talk() {
this(BASE_DATA_OBJECT_TYPE);
}
public Talk(final BigDecimal id) {
this(new OID(BASE_DATA_OBJECT_TYPE, id));
}
public Talk(final OID oid) {
super(oid);
}
public Talk(final DataObject dataObject) {
super(dataObject);
}
public Talk(final String type) {
super(type);
}
public TalkBundle getTalkBundle() {
return (TalkBundle) getContentBundle();
}
public String getEvent() {
return (String) get(EVENT);
}
public void setEvent(final String event) {
set(EVENT, event);
}
public Date getDateOfTalk() {
return (Date) get(DATE_OF_TALK);
}
public void setDateOfTalk(final Date date) {
set(DATE_OF_TALK, date);
}
public String getPlace() {
return (String) get(PLACE);
}
public void setPlace(final String place) {
set(PLACE, place);
}
}

View File

@ -0,0 +1,73 @@
/*
* Copyright (c) 2014 Jens Pelzetter
*
* This library is free software; you can redistribte it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.cms.contenttypes;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.CustomCopy;
import com.arsdigita.cms.ItemCopier;
import com.arsdigita.cms.XMLDeliveryCache;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.domain.DomainCollection;
import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.persistence.DataCollection;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.OID;
import com.arsdigita.persistence.metadata.Property;
import com.arsdigita.util.Assert;
import java.math.BigDecimal;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class TalkBundle extends PublicationBundle {
public static final String BASE_DATA_OBJECT_TYPE
= "com.arsdigita.cms.contenttypes.TalkBundle";
public TalkBundle(final ContentItem primary) {
super(BASE_DATA_OBJECT_TYPE);
Assert.exists(primary, ContentItem.class);
setDefaultLanguage(primary.getLanguage());
setContentType(primary.getContentType());
addInstance(primary);
setName(primary.getName());
}
public TalkBundle(final OID oid) throws DataObjectNotFoundException {
super(oid);
}
public TalkBundle(final BigDecimal id) throws DataObjectNotFoundException {
this(new OID(BASE_DATA_OBJECT_TYPE, id));
}
public TalkBundle(final DataObject dataObject) {
super(dataObject);
}
public TalkBundle(final String type) {
super(type);
}
}

View File

@ -0,0 +1,18 @@
package com.arsdigita.cms.contenttypes;
import com.arsdigita.globalization.GlobalizedMessage;
public class TalkGlobalizationUtil {
public static final String BUNDLE_NAME
= "com.arsdigita.cms.contenttypes.TalkResources";
public static GlobalizedMessage globalize(String key) {
return new GlobalizedMessage(key, BUNDLE_NAME);
}
public static GlobalizedMessage globalize(String key, Object[] args) {
return new GlobalizedMessage(key, BUNDLE_NAME, args);
}
}

View File

@ -0,0 +1,43 @@
/*
* Copyright (c) 2012 Jens Pelzetter,
* ScientificCMS Team, http://www.scientificcms.org
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.cms.contenttypes;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class TalkInitializer extends ContentTypeInitializer {
public TalkInitializer() {
super("ccm-sci-publications-task.pdf.mf",
Talk.BASE_DATA_OBJECT_TYPE);
}
@Override
public String[] getStylesheets() {
return new String[]{INTERNAL_THEME_TYPES_DIR + "sci/Talk.xsl"};
}
@Override
public String getTraversalXML() {
return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Talk.xml";
}
}

View File

@ -0,0 +1,39 @@
/*
* Copyright (c) 2012 Jens Pelzetter,
* ScientificCMS Team, http://www.scientificcms.org
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.cms.contenttypes;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class TalkLoader extends AbstractContentTypeLoader {
private static final String[] TYPES = {"/WEB-INF/content-types/com/arsdigita/cms/contenttypes/Talk.xml"};
public TalkLoader() {
super();
}
@Override
public String[] getTypes() {
return TYPES;
}
}

View File

@ -0,0 +1,4 @@
publications.ui.talk.place=Place
publications.ui.talk.date=Date
publications.ui.talk.event=Event

View File

@ -0,0 +1,4 @@
publications.ui.talk.place=Ort
publications.ui.talk.date=Datum
publications.ui.talk.event=Veranstaltung

View File

@ -0,0 +1,89 @@
/*
* Copyright (c) 2012 Jens Pelzetter,
* ScientificCMS Team, http://www.scientificcms.org
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.Label;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.Talk;
import com.arsdigita.cms.contenttypes.TalkGlobalizationUtil;
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
import com.arsdigita.cms.ui.authoring.BasicPageForm;
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class TalkPropertiesStep extends PublicationPropertiesStep {
public TalkPropertiesStep(final ItemSelectionModel itemModel,
final AuthoringKitWizard parent) {
super(itemModel, parent);
}
public static Component getTalkPropertiesSheet(
final ItemSelectionModel itemModel) {
final DomainObjectPropertySheet sheet
= (DomainObjectPropertySheet) getPublicationPropertySheet(
itemModel);
sheet.add(TalkGlobalizationUtil.globalize("publications.ui.talk.place"),
Talk.PLACE);
sheet.add(TalkGlobalizationUtil.globalize("publications.ui.talk.date"),
Talk.DATE_OF_TALK);
sheet.add(TalkGlobalizationUtil.globalize("publications.ui.talk.event"),
Talk.EVENT);
return sheet;
}
@Override
protected void addBasicProperties(final ItemSelectionModel itemModel,
final AuthoringKitWizard parent) {
final SimpleEditStep basicProperties = new SimpleEditStep(
itemModel, parent, EDIT_SHEET_NAME);
final BasicPageForm editBasicSheet = new TalkPropertyForm(itemModel,
this);
basicProperties.add(EDIT_SHEET_NAME,
TalkGlobalizationUtil.globalize(
"publications.ui.talk.edit_basic_sheet"),
new WorkflowLockedComponentAccess(editBasicSheet,
itemModel),
editBasicSheet.getSaveCancelSection()
.getCancelButton());
basicProperties.setDisplayComponent(getTalkPropertiesSheet(itemModel));
getSegmentedPanel()
.addSegment(
new Label(TalkGlobalizationUtil
.globalize("publications.ui.talk.basic_properties")),
basicProperties);
}
}

View File

@ -0,0 +1,98 @@
package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.event.FormInitListener;
import com.arsdigita.bebop.event.FormProcessListener;
import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.event.FormSubmissionListener;
import com.arsdigita.bebop.form.Date;
import com.arsdigita.bebop.form.TextField;
import com.arsdigita.bebop.parameters.DateParameter;
import com.arsdigita.bebop.parameters.ParameterModel;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.Talk;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class TalkPropertyForm
extends PublicationPropertyForm
implements FormInitListener,
FormProcessListener,
FormSubmissionListener {
private TalkPropertiesStep step;
private static final String ID = "TaskEdit";
public TalkPropertyForm(final ItemSelectionModel itemModel) {
this(itemModel, null);
}
public TalkPropertyForm(final ItemSelectionModel itemModel,
TalkPropertiesStep step) {
super(itemModel, step);
this.step = step;
addSubmissionListener(this);
}
@Override
public void addWidgets() {
super.addWidgets();
final ParameterModel placeParameter
= new StringParameter(Talk.PLACE);
final TextField placeField = new TextField(placeParameter);
add(placeField);
final ParameterModel dateParameter
= new DateParameter(Talk.DATE_OF_TALK);
final Date dateField = new Date(dateParameter);
add(dateField);
final ParameterModel eventParameter
= new StringParameter(Talk.EVENT);
final TextField eventField = new TextField(eventParameter);
add(eventField);
}
@Override
public void init(final FormSectionEvent event) throws FormProcessException {
super.init(event);
final FormData data = event.getFormData();
final Talk talk = (Talk) initBasicWidgets(event);
data.put(Talk.EVENT, talk.getEvent());
data.put(Talk.DATE_OF_TALK, talk.getDateOfTalk());
data.put(Talk.PLACE, talk.getPlace());
}
@Override
public void process(final FormSectionEvent event)
throws FormProcessException {
super.process(event);
final FormData data = event.getFormData();
final Talk talk = (Talk) processBasicWidgets(event);
if (talk != null
&& getSaveCancelSection()
.getSaveButton()
.isSelected(event.getPageState())) {
talk.setDateOfTalk((java.util.Date) data.get(Talk.DATE_OF_TALK));
talk.setEvent((String) data.get(Talk.EVENT));
talk.setPlace((String) data.get(Talk.PLACE));
talk.save();
}
}
}

View File

@ -0,0 +1,20 @@
<!DOCTYPE stylesheet [
<!ENTITY nbsp "&#160;" ><!-- no-break space = non-breaking space, U+00A0 ISOnum -->
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:cms="http://www.arsdigita.com/cms/1.0"
version="1.0">
<xsl:template match="cms:item[objectType='com.arsdigita.cms.contenttypes.Talk']" mode="cms:CT_graphics"
name="cms:CT_graphics_com_arsdigita_cms_contenttypes_Talk">
<p><xsl:value-of select="./name"/></p>
</xsl:template>
<xsl:template match="cms:item[objectType='com.arsdigita.cms.contenttypes.Talk']" mode="cms:CT_text"
name="cms:CT_text_com_arsdigita_cms_contenttypes_Talk">
<p><xsl:value-of select="./name"/></p>
</xsl:template>
</xsl:stylesheet>