diff --git a/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/ui/RelatedLinkCaptionEditForm.java b/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/ui/RelatedLinkCaptionEditForm.java index da7f86a54..609aea35a 100644 --- a/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/ui/RelatedLinkCaptionEditForm.java +++ b/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/ui/RelatedLinkCaptionEditForm.java @@ -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); } diff --git a/ccm-sci-publications-talk/application.xml b/ccm-sci-publications-talk/application.xml new file mode 100644 index 000000000..b16b64357 --- /dev/null +++ b/ccm-sci-publications-talk/application.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + Additional content type Talk for the ccm-sci-publications module + (requested by the ITB). + + + diff --git a/ccm-sci-publications-talk/pdl/com/arsdigita/content-types/Talk.pdl b/ccm-sci-publications-talk/pdl/com/arsdigita/content-types/Talk.pdl new file mode 100644 index 000000000..9f0b6cf0d --- /dev/null +++ b/ccm-sci-publications-talk/pdl/com/arsdigita/content-types/Talk.pdl @@ -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); +} + + diff --git a/ccm-sci-publications-talk/sql/ccm-sci-publications-talk/oracle-se-create.sql b/ccm-sci-publications-talk/sql/ccm-sci-publications-talk/oracle-se-create.sql new file mode 100644 index 000000000..6ba1e966a --- /dev/null +++ b/ccm-sci-publications-talk/sql/ccm-sci-publications-talk/oracle-se-create.sql @@ -0,0 +1,4 @@ +@ ddl/oracle-se/create.sql + +@ ddl/oracle-se/deferred.sql + diff --git a/ccm-sci-publications-talk/sql/ccm-sci-publications-talk/postgres-create.sql b/ccm-sci-publications-talk/sql/ccm-sci-publications-talk/postgres-create.sql new file mode 100644 index 000000000..8dc8d0275 --- /dev/null +++ b/ccm-sci-publications-talk/sql/ccm-sci-publications-talk/postgres-create.sql @@ -0,0 +1,5 @@ +begin; +\i ddl/postgres/create.sql +\i ddl/postgres/deferred.sql +end; + diff --git a/ccm-sci-publications-talk/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/Talk.xml b/ccm-sci-publications-talk/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/Talk.xml new file mode 100644 index 000000000..3a1b874ac --- /dev/null +++ b/ccm-sci-publications-talk/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/Talk.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + diff --git a/ccm-sci-publications-talk/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Talk.xml b/ccm-sci-publications-talk/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Talk.xml new file mode 100644 index 000000000..d069784a7 --- /dev/null +++ b/ccm-sci-publications-talk/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Talk.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + diff --git a/ccm-sci-publications-talk/src/ccm-sci-publications-talk.config b/ccm-sci-publications-talk/src/ccm-sci-publications-talk.config new file mode 100644 index 000000000..7a49dd24c --- /dev/null +++ b/ccm-sci-publications-talk/src/ccm-sci-publications-talk.config @@ -0,0 +1,4 @@ + + + + diff --git a/ccm-sci-publications-talk/src/ccm-sci-publications-talk.load b/ccm-sci-publications-talk/src/ccm-sci-publications-talk.load new file mode 100644 index 000000000..5d2550f24 --- /dev/null +++ b/ccm-sci-publications-talk/src/ccm-sci-publications-talk.load @@ -0,0 +1,18 @@ + + + +
+
+
+ + + + +
+ + + + + + + diff --git a/ccm-sci-publications-talk/src/com/arsdigita/cms/contenttypes/Talk.java b/ccm-sci-publications-talk/src/com/arsdigita/cms/contenttypes/Talk.java new file mode 100644 index 000000000..d588720ac --- /dev/null +++ b/ccm-sci-publications-talk/src/com/arsdigita/cms/contenttypes/Talk.java @@ -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 Jens Pelzetter + */ +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); + } + +} diff --git a/ccm-sci-publications-talk/src/com/arsdigita/cms/contenttypes/TalkBundle.java b/ccm-sci-publications-talk/src/com/arsdigita/cms/contenttypes/TalkBundle.java new file mode 100644 index 000000000..49e94f7d3 --- /dev/null +++ b/ccm-sci-publications-talk/src/com/arsdigita/cms/contenttypes/TalkBundle.java @@ -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 Jens Pelzetter + */ +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); + } + +} diff --git a/ccm-sci-publications-talk/src/com/arsdigita/cms/contenttypes/TalkGlobalizationUtil.java b/ccm-sci-publications-talk/src/com/arsdigita/cms/contenttypes/TalkGlobalizationUtil.java new file mode 100644 index 000000000..3953579a9 --- /dev/null +++ b/ccm-sci-publications-talk/src/com/arsdigita/cms/contenttypes/TalkGlobalizationUtil.java @@ -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); + } + +} diff --git a/ccm-sci-publications-talk/src/com/arsdigita/cms/contenttypes/TalkInitializer.java b/ccm-sci-publications-talk/src/com/arsdigita/cms/contenttypes/TalkInitializer.java new file mode 100644 index 000000000..eaff86a4c --- /dev/null +++ b/ccm-sci-publications-talk/src/com/arsdigita/cms/contenttypes/TalkInitializer.java @@ -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 Jens Pelzetter + */ +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"; + } + +} diff --git a/ccm-sci-publications-talk/src/com/arsdigita/cms/contenttypes/TalkLoader.java b/ccm-sci-publications-talk/src/com/arsdigita/cms/contenttypes/TalkLoader.java new file mode 100644 index 000000000..da9b57e59 --- /dev/null +++ b/ccm-sci-publications-talk/src/com/arsdigita/cms/contenttypes/TalkLoader.java @@ -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 Jens Pelzetter + */ +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; + } + +} diff --git a/ccm-sci-publications-talk/src/com/arsdigita/cms/contenttypes/TalkResources.properties b/ccm-sci-publications-talk/src/com/arsdigita/cms/contenttypes/TalkResources.properties new file mode 100644 index 000000000..7f666caca --- /dev/null +++ b/ccm-sci-publications-talk/src/com/arsdigita/cms/contenttypes/TalkResources.properties @@ -0,0 +1,4 @@ +publications.ui.talk.place=Place + +publications.ui.talk.date=Date +publications.ui.talk.event=Event diff --git a/ccm-sci-publications-talk/src/com/arsdigita/cms/contenttypes/TalkResources_de.properties b/ccm-sci-publications-talk/src/com/arsdigita/cms/contenttypes/TalkResources_de.properties new file mode 100644 index 000000000..d25118c08 --- /dev/null +++ b/ccm-sci-publications-talk/src/com/arsdigita/cms/contenttypes/TalkResources_de.properties @@ -0,0 +1,4 @@ +publications.ui.talk.place=Ort + +publications.ui.talk.date=Datum +publications.ui.talk.event=Veranstaltung diff --git a/ccm-sci-publications-talk/src/com/arsdigita/cms/contenttypes/ui/TalkPropertiesStep.java b/ccm-sci-publications-talk/src/com/arsdigita/cms/contenttypes/ui/TalkPropertiesStep.java new file mode 100644 index 000000000..acfe8982c --- /dev/null +++ b/ccm-sci-publications-talk/src/com/arsdigita/cms/contenttypes/ui/TalkPropertiesStep.java @@ -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 Jens Pelzetter + */ +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); + + } + +} diff --git a/ccm-sci-publications-talk/src/com/arsdigita/cms/contenttypes/ui/TalkPropertyForm.java b/ccm-sci-publications-talk/src/com/arsdigita/cms/contenttypes/ui/TalkPropertyForm.java new file mode 100644 index 000000000..a82c12ac2 --- /dev/null +++ b/ccm-sci-publications-talk/src/com/arsdigita/cms/contenttypes/ui/TalkPropertyForm.java @@ -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 Jens Pelzetter + */ +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(); + } + + } + +} diff --git a/ccm-sci-publications-talk/web/heirloom/contenttypes/sci/Talk.xsl b/ccm-sci-publications-talk/web/heirloom/contenttypes/sci/Talk.xsl new file mode 100644 index 000000000..89ccb2f3f --- /dev/null +++ b/ccm-sci-publications-talk/web/heirloom/contenttypes/sci/Talk.xsl @@ -0,0 +1,20 @@ + +]> + + + + +

+
+ + +

+
+ +
+