diff --git a/ccm-sci-publications-publicationtype/application.xml b/ccm-sci-publications-publicationtype/application.xml
new file mode 100644
index 000000000..893809d3c
--- /dev/null
+++ b/ccm-sci-publications-publicationtype/application.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ An asset for for describing different types of publication of a publication, e.g. ebook"
+
+
+
\ No newline at end of file
diff --git a/ccm-sci-publications-publicationtype/pdl/com/arsdigita/cms/contentassets/PublicationTypeAsset.pdl b/ccm-sci-publications-publicationtype/pdl/com/arsdigita/cms/contentassets/PublicationTypeAsset.pdl
new file mode 100644
index 000000000..16e8ca98b
--- /dev/null
+++ b/ccm-sci-publications-publicationtype/pdl/com/arsdigita/cms/contentassets/PublicationTypeAsset.pdl
@@ -0,0 +1,43 @@
+//
+// Copyright (C) 2013 Jens Pelzetter
+//
+// 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
+//
+//
+
+model com.arsdigita.cms.contentassets;
+
+import com.arsdigita.cms.contenttypes.Publication;
+import com.arsdigita.kernel.ACSObject;
+
+object type PublicationTypeAsset extends ACSObject {
+
+ String[1..1] publicationType = ca_publications_publicationtype.publicationtype VARCHAR(512);
+ String[0..1] isbn = ca_publications_publicationtype.isbn VARCHAR(17);
+ String[0..1] misc = ca_publications_publicationtype.misc VARCHAR(4096);
+
+ reference key(ca_publications_publicationtype.type_id);
+}
+
+association {
+
+ composite Publication[1..1] publication = join ca_publications_publicationtype.publication_id
+ to ct_publications.publication_id;
+
+ component PublicationTypeAsset[0..n] publicationtypes = join ct_publications.publication_id
+ to ca_publications_publicationtype.publication_id;
+}
+
+
diff --git a/ccm-sci-publications-publicationtype/sql/ccm-sci-publications-publicationtype/oracle-se-create.sql b/ccm-sci-publications-publicationtype/sql/ccm-sci-publications-publicationtype/oracle-se-create.sql
new file mode 100644
index 000000000..8cb4d2774
--- /dev/null
+++ b/ccm-sci-publications-publicationtype/sql/ccm-sci-publications-publicationtype/oracle-se-create.sql
@@ -0,0 +1,2 @@
+@@ ddl/oracle-se/create.sql
+@@ ddl/oracle-se/deferred.sql
\ No newline at end of file
diff --git a/ccm-sci-publications-publicationtype/sql/ccm-sci-publications-publicationtype/postgres-create.sql b/ccm-sci-publications-publicationtype/sql/ccm-sci-publications-publicationtype/postgres-create.sql
new file mode 100644
index 000000000..ffc15342b
--- /dev/null
+++ b/ccm-sci-publications-publicationtype/sql/ccm-sci-publications-publicationtype/postgres-create.sql
@@ -0,0 +1,4 @@
+begin;
+\i ddl/postgres/create.sql
+\i ddl/postgres/deferred.sql
+commit;
\ No newline at end of file
diff --git a/ccm-sci-publications-publicationtype/src/WEB-INF/resources/publication_types.xml b/ccm-sci-publications-publicationtype/src/WEB-INF/resources/publication_types.xml
new file mode 100644
index 000000000..cab6a253a
--- /dev/null
+++ b/ccm-sci-publications-publicationtype/src/WEB-INF/resources/publication_types.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+ Book
+
+
+ Buch
+
+
+ Hardcover
+
+
+ Hardcover
+
+
+ Softcover
+
+
+ Softcover
+
+
+ Paperback
+
+
+ Taschenbuch
+
+
+ E-Book
+
+
+ E-Book
+
+
+
+
\ No newline at end of file
diff --git a/ccm-sci-publications-publicationtype/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/PublicationTypeAsset.xml b/ccm-sci-publications-publicationtype/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/PublicationTypeAsset.xml
new file mode 100644
index 000000000..10e5c1452
--- /dev/null
+++ b/ccm-sci-publications-publicationtype/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/PublicationTypeAsset.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ccm-sci-publications-publicationtype/src/ccm-sci-publications-publicationtype.config b/ccm-sci-publications-publicationtype/src/ccm-sci-publications-publicationtype.config
new file mode 100644
index 000000000..ec3d9045d
--- /dev/null
+++ b/ccm-sci-publications-publicationtype/src/ccm-sci-publications-publicationtype.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/ccm-sci-publications-publicationtype/src/ccm-sci-publications-publicationtype.load b/ccm-sci-publications-publicationtype/src/ccm-sci-publications-publicationtype.load
new file mode 100644
index 000000000..d7b7af36f
--- /dev/null
+++ b/ccm-sci-publications-publicationtype/src/ccm-sci-publications-publicationtype.load
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ccm-sci-publications-publicationtype/src/com/arsdigita/cms/contentassets/PublicationTypeAsset.java b/ccm-sci-publications-publicationtype/src/com/arsdigita/cms/contentassets/PublicationTypeAsset.java
new file mode 100644
index 000000000..70f51d620
--- /dev/null
+++ b/ccm-sci-publications-publicationtype/src/com/arsdigita/cms/contentassets/PublicationTypeAsset.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2013 Jens Pelzetter
+ *
+ * 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.contentassets;
+
+import com.arsdigita.cms.contenttypes.Publication;
+import com.arsdigita.domain.DomainObjectFactory;
+import com.arsdigita.kernel.ACSObject;
+import com.arsdigita.persistence.DataCollection;
+import com.arsdigita.persistence.DataObject;
+import com.arsdigita.persistence.OID;
+import com.arsdigita.persistence.SessionManager;
+import com.arsdigita.util.Assert;
+import java.math.BigDecimal;
+
+/**
+ *
+ * @author Jens Pelzetter
+ * @version $Id$
+ */
+public class PublicationTypeAsset extends ACSObject {
+
+ public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contentassets.PublicationTypeAsset";
+
+ public static final String PUBLICATION_TYPE = "publicationType";
+ public static final String ISBN = "isbn";
+ public static final String MISC = "misc";
+ public static final String PUBLICATION = "publication";
+
+ public PublicationTypeAsset() {
+ super(BASE_DATA_OBJECT_TYPE);
+ }
+
+ public PublicationTypeAsset(final BigDecimal publicationTypeId) {
+ super(new OID(BASE_DATA_OBJECT_TYPE, publicationTypeId));
+ }
+
+ public PublicationTypeAsset(final String type) {
+ super(type);
+ }
+
+ public PublicationTypeAsset(final DataObject dataObject) {
+ super(dataObject);
+ }
+
+ public static PublicationTypeAsset create(final Publication publication) {
+ final PublicationTypeAsset type = new PublicationTypeAsset();
+ type.set(PUBLICATION, publication);
+
+ return type;
+ }
+
+ public static DataCollection getPublicationTypeAssets(final Publication publication) {
+ Assert.exists(publication, Publication.class);
+
+ final DataCollection types = SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE);
+
+ types.addEqualsFilter(PUBLICATION, publication.getID());
+ types.addOrder(PUBLICATION_TYPE);
+ types.addOrder(ISBN);
+
+ return types;
+ }
+
+ public String getPublicationType() {
+ return (String) get(PUBLICATION_TYPE);
+ }
+
+ public void setPublicationType(final String type) {
+ set(PUBLICATION_TYPE, type);
+ }
+
+ public String getIsbn() {
+ return (String) get(ISBN);
+ }
+
+ public void setIsbn(final String isbn) {
+ set(ISBN, isbn);
+ }
+
+ public String getMisc() {
+ return (String) get(MISC);
+ }
+
+ public void setMisc(final String misc) {
+ set(MISC, misc);
+ }
+
+ public Publication getPublication() {
+ final DataObject dataObject = (DataObject) get(PUBLICATION);
+
+ return (Publication) DomainObjectFactory.newInstance(dataObject);
+ }
+
+}
diff --git a/ccm-sci-publications-publicationtype/src/com/arsdigita/cms/contentassets/PublicationTypeAssetInitializer.java b/ccm-sci-publications-publicationtype/src/com/arsdigita/cms/contentassets/PublicationTypeAssetInitializer.java
new file mode 100644
index 000000000..3fb58c60b
--- /dev/null
+++ b/ccm-sci-publications-publicationtype/src/com/arsdigita/cms/contentassets/PublicationTypeAssetInitializer.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2013 Jens Pelzetter
+ *
+ * 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.contentassets;
+
+import com.arsdigita.cms.RelationAttributeImportTool;
+import com.arsdigita.cms.contentassets.ui.PublicationTypeAssetStep;
+import com.arsdigita.cms.contenttypes.ContentAssetInitializer;
+import com.arsdigita.cms.contenttypes.Publication;
+import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
+import com.arsdigita.domain.DomainObjectTraversal;
+import com.arsdigita.domain.SimpleDomainObjectTraversalAdapter;
+import com.arsdigita.globalization.GlobalizedMessage;
+import com.arsdigita.runtime.DomainInitEvent;
+
+/**
+ *
+ * @author Jens Pelzetter
+ * @version $Id$
+ */
+public class PublicationTypeAssetInitializer extends ContentAssetInitializer {
+
+ public PublicationTypeAssetInitializer() {
+ super("ccm-sci-publications-publicationtype.pdl.mf");
+ }
+
+ @Override
+ public void init(final DomainInitEvent event) {
+ super.init(event);
+
+ DomainObjectTraversal.registerAdapter(PublicationTypeAsset.BASE_DATA_OBJECT_TYPE,
+ new SimpleDomainObjectTraversalAdapter(),
+ SimpleXMLGenerator.ADAPTER_CONTEXT);
+
+ final RelationAttributeImportTool importTool = new RelationAttributeImportTool();
+ importTool.loadData("WEB-INF/resources/publication_types.xml");
+ }
+
+ @Override
+ public String getBaseType() {
+ return Publication.BASE_DATA_OBJECT_TYPE;
+ }
+
+ @Override
+ public String getTraversalXML() {
+ return TRAVERSAL_ADAPTER_BASE_DIR + "PublicationTypeAsset.xml";
+ }
+
+ @Override
+ public String getProperty() {
+ return "publicationtypes";
+ }
+
+ @Override
+ public Class getAuthoringStep() {
+ return PublicationTypeAssetStep.class;
+ }
+
+ @Override
+ public GlobalizedMessage getAuthoringStepLabel() {
+ return new GlobalizedMessage("com.arsdigita.cms.contentassets.publicationtypes.label",
+ "com.arsdigita.cms.contentassets.PublicationTypeAssetResources");
+ }
+
+ @Override
+ public GlobalizedMessage getAuthoringStepDescription() {
+ return new GlobalizedMessage("com.arsdigita.cms.contentassets.publicationtypes.description",
+ "com.arsdigita.cms.contentassets.PublicationTypeAssetResources");
+ }
+
+ @Override
+ public int getAuthoringStepSortKey() {
+ return 10;
+ }
+
+}
diff --git a/ccm-sci-publications-publicationtype/src/com/arsdigita/cms/contentassets/PublicationTypeAssetLoader.java b/ccm-sci-publications-publicationtype/src/com/arsdigita/cms/contentassets/PublicationTypeAssetLoader.java
new file mode 100644
index 000000000..ffc95e5d6
--- /dev/null
+++ b/ccm-sci-publications-publicationtype/src/com/arsdigita/cms/contentassets/PublicationTypeAssetLoader.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2013 Jens Pelzetter
+ *
+ * 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.contentassets;
+
+import com.arsdigita.loader.PackageLoader;
+import com.arsdigita.runtime.ScriptContext;
+
+/**
+ *
+ * @author Jens Pelzetter
+ * @version $Id$
+ */
+public class PublicationTypeAssetLoader extends PackageLoader {
+
+ public void run(final ScriptContext ctx) {
+ //Nothing
+ }
+
+}
diff --git a/ccm-sci-publications-publicationtype/src/com/arsdigita/cms/contentassets/PublicationTypeValuesCollection.java b/ccm-sci-publications-publicationtype/src/com/arsdigita/cms/contentassets/PublicationTypeValuesCollection.java
new file mode 100644
index 000000000..4efa901de
--- /dev/null
+++ b/ccm-sci-publications-publicationtype/src/com/arsdigita/cms/contentassets/PublicationTypeValuesCollection.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2013 Jens Pelzetter
+ *
+ * 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.contentassets;
+
+import com.arsdigita.cms.RelationAttributeCollection;
+import com.arsdigita.persistence.DataCollection;
+
+/**
+ *
+ * @author Jens Pelzetter
+ * @version $Id$
+ */
+public class PublicationTypeValuesCollection extends RelationAttributeCollection {
+
+ public static final String ATTRIBUTE_NAME = "PublicationTypeAssetTypeValues";
+
+ public PublicationTypeValuesCollection() {
+ super(ATTRIBUTE_NAME);
+ }
+
+ public PublicationTypeValuesCollection(final String key) {
+ super(ATTRIBUTE_NAME, key);
+ }
+
+ public PublicationTypeValuesCollection(final DataCollection dataCollection) {
+ super(dataCollection);
+ }
+
+}
diff --git a/ccm-sci-publications-publicationtype/src/com/arsdigita/cms/contentassets/ui/PublicationTypeAssetAddForm.java b/ccm-sci-publications-publicationtype/src/com/arsdigita/cms/contentassets/ui/PublicationTypeAssetAddForm.java
new file mode 100644
index 000000000..f077b9c60
--- /dev/null
+++ b/ccm-sci-publications-publicationtype/src/com/arsdigita/cms/contentassets/ui/PublicationTypeAssetAddForm.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2013 Jens Pelzetter
+ *
+ * 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.contentassets.ui;
+
+import com.arsdigita.bebop.FormData;
+import com.arsdigita.bebop.FormProcessException;
+import com.arsdigita.bebop.Label;
+import com.arsdigita.bebop.PageState;
+import com.arsdigita.bebop.event.FormSectionEvent;
+import com.arsdigita.bebop.form.Option;
+import com.arsdigita.bebop.form.SingleSelect;
+import com.arsdigita.bebop.form.TextArea;
+import com.arsdigita.bebop.form.TextField;
+import com.arsdigita.bebop.parameters.NotEmptyValidationListener;
+import com.arsdigita.bebop.parameters.NotNullValidationListener;
+import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.RelationAttribute;
+import com.arsdigita.cms.contentassets.PublicationTypeAsset;
+import com.arsdigita.cms.contentassets.PublicationTypeValuesCollection;
+import com.arsdigita.cms.contenttypes.Publication;
+import com.arsdigita.cms.ui.authoring.BasicItemForm;
+import com.arsdigita.globalization.GlobalizationHelper;
+import com.arsdigita.kernel.ui.ACSObjectSelectionModel;
+
+/**
+ *
+ * @author Jens Pelzetter
+ * @version $Id$
+ */
+public class PublicationTypeAssetAddForm extends BasicItemForm {
+
+ private final static String PUB_TYPE = "publicationType";
+ private final static String ISBN = "isbn";
+ private final static String MISC = "misc";
+ private final ItemSelectionModel itemModel;
+ private final ACSObjectSelectionModel typeModel;
+
+ public PublicationTypeAssetAddForm(final ItemSelectionModel itemModel, final ACSObjectSelectionModel typeModel) {
+ super("PublicationTypeAssetAddForm", itemModel);
+
+ this.itemModel = itemModel;
+ this.typeModel = typeModel;
+ }
+
+ @Override
+ public void addWidgets() {
+ add(new Label(PublicationTypeAssetGlobalizationUtil.
+ globalize("scipublications.publication_type_asset.form.type")));
+ final SingleSelect type = new SingleSelect(PUB_TYPE);
+ type.addValidationListener(new NotNullValidationListener());
+ type.addValidationListener(new NotEmptyValidationListener());
+ type.addOption(new Option("", new Label(PublicationTypeAssetGlobalizationUtil.globalize(
+ "scipublications.publication_type_asset.form.type.select_one"))));
+ final PublicationTypeValuesCollection values = new PublicationTypeValuesCollection();
+ values.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().getLanguage());
+
+ while (values.next()) {
+ final RelationAttribute value = values.getRelationAttribute();
+ type.addOption(new Option(value.getKey(), value.getName()));
+ }
+ add(type);
+
+ add(new Label(PublicationTypeAssetGlobalizationUtil.
+ globalize("scipublications.publication_type_asset.form.isbn")));
+ add(new TextField(ISBN));
+
+ add(new Label(PublicationTypeAssetGlobalizationUtil.
+ globalize("scipublications.publication_type_asset.form.misc")));
+ final TextArea misc = new TextArea(MISC);
+ misc.setRows(12);
+ misc.setCols(60);
+ add(misc);
+ }
+
+ @Override
+ public void init(final FormSectionEvent event) throws FormProcessException {
+ final PageState state = event.getPageState();
+
+ if (typeModel.getSelectedObject(state) != null) {
+ final PublicationTypeAsset typeAsset = (PublicationTypeAsset) typeModel.getSelectedObject(state);
+ final FormData data = event.getFormData();
+
+ data.put(PUB_TYPE, typeAsset.getPublicationType());
+ data.put(ISBN, typeAsset.getIsbn());
+ data.put(MISC, typeAsset.getMisc());
+ }
+
+ setVisible(state, true);
+ }
+
+ @Override
+ public void process(final FormSectionEvent event) throws FormProcessException {
+ final FormData data = event.getFormData();
+ final PageState state = event.getPageState();
+
+ final PublicationTypeAsset typeAsset;
+ if (typeModel.getSelectedObject(state) == null) {
+ final Publication publication = (Publication) itemModel.getSelectedItem(state);
+
+ typeAsset = PublicationTypeAsset.create(publication);
+ } else {
+ typeAsset = (PublicationTypeAsset) typeModel.getSelectedObject(state);
+
+ typeModel.setSelectedObject(state, null);
+ }
+
+ typeAsset.setPublicationType(data.getString(PUB_TYPE));
+ typeAsset.setIsbn(data.getString(ISBN));
+ typeAsset.setMisc(data.getString(MISC));
+
+ typeAsset.save();
+ }
+
+}
diff --git a/ccm-sci-publications-publicationtype/src/com/arsdigita/cms/contentassets/ui/PublicationTypeAssetGlobalizationUtil.java b/ccm-sci-publications-publicationtype/src/com/arsdigita/cms/contentassets/ui/PublicationTypeAssetGlobalizationUtil.java
new file mode 100644
index 000000000..5d9665544
--- /dev/null
+++ b/ccm-sci-publications-publicationtype/src/com/arsdigita/cms/contentassets/ui/PublicationTypeAssetGlobalizationUtil.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2013 Jens Pelzetter
+ *
+ * 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.contentassets.ui;
+
+import com.arsdigita.globalization.GlobalizedMessage;
+
+/**
+ *
+ * @author Jens Pelzetter
+ * @version $Id$
+ */
+public class PublicationTypeAssetGlobalizationUtil {
+
+ private PublicationTypeAssetGlobalizationUtil() {
+ //Nothing
+ }
+
+ public static final String BUNDLE_NAME = "com.arsdigita.cms.contentassets.PublicationTypeAssetResources";
+
+ public static GlobalizedMessage globalize(final String key) {
+ return new GlobalizedMessage(key, BUNDLE_NAME);
+ }
+
+ public static GlobalizedMessage globalize(final String key, final Object[] args) {
+ return new GlobalizedMessage(key, BUNDLE_NAME, args);
+ }
+
+}
diff --git a/ccm-sci-publications-publicationtype/src/com/arsdigita/cms/contentassets/ui/PublicationTypeAssetStep.java b/ccm-sci-publications-publicationtype/src/com/arsdigita/cms/contentassets/ui/PublicationTypeAssetStep.java
new file mode 100644
index 000000000..419e058ed
--- /dev/null
+++ b/ccm-sci-publications-publicationtype/src/com/arsdigita/cms/contentassets/ui/PublicationTypeAssetStep.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2013 Jens Pelzetter
+ *
+ * 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.contentassets.ui;
+
+import com.arsdigita.bebop.Page;
+import com.arsdigita.bebop.PageState;
+import com.arsdigita.bebop.parameters.BigDecimalParameter;
+import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
+import com.arsdigita.cms.ui.authoring.SimpleEditStep;
+import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
+import com.arsdigita.kernel.ui.ACSObjectSelectionModel;
+
+/**
+ *
+ * @author Jens Pelzetter
+ * @version $Id$
+ */
+public class PublicationTypeAssetStep extends SimpleEditStep {
+
+ protected static final String EDIT = "edit";
+ protected static final String PUB_TYPE_PARAM = "publication_type";
+
+ private final static String FORM_KEY = "PublicationTypesAdd";
+
+ private final BigDecimalParameter typeParameter;
+ final PublicationTypeAssetAddForm addForm;
+
+ public PublicationTypeAssetStep(final ItemSelectionModel itemModel,
+ final AuthoringKitWizard parent,
+ final String prefix) {
+ super(itemModel, parent, prefix);
+
+ typeParameter = new BigDecimalParameter(PUB_TYPE_PARAM);
+ final ACSObjectSelectionModel typeModel = new ACSObjectSelectionModel(typeParameter);
+
+ addForm = new PublicationTypeAssetAddForm(itemModel, typeModel);
+ add(FORM_KEY,
+ PublicationTypeAssetGlobalizationUtil.globalize("scipublications.publicationtypeasset.add"),
+ new WorkflowLockedComponentAccess(addForm, itemModel),
+ addForm.getSaveCancelSection().getCancelButton());
+
+ final PublicationTypeAssetTable table = new PublicationTypeAssetTable(itemModel, typeModel, this);
+ setDisplayComponent(table);
+ }
+
+ @Override
+ public void register(final Page page) {
+ super.register(page);
+
+ page.addComponentStateParam(this, typeParameter);
+ }
+
+ protected void setAddVisible(final PageState state) {
+ showComponent(state, FORM_KEY);
+ }
+
+}
diff --git a/ccm-sci-publications-publicationtype/src/com/arsdigita/cms/contentassets/ui/PublicationTypeAssetTable.java b/ccm-sci-publications-publicationtype/src/com/arsdigita/cms/contentassets/ui/PublicationTypeAssetTable.java
new file mode 100644
index 000000000..bfef73986
--- /dev/null
+++ b/ccm-sci-publications-publicationtype/src/com/arsdigita/cms/contentassets/ui/PublicationTypeAssetTable.java
@@ -0,0 +1,290 @@
+/*
+ * Copyright (c) 2013 Jens Pelzetter
+ *
+ * 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.contentassets.ui;
+
+import com.arsdigita.bebop.Component;
+import com.arsdigita.bebop.ControlLink;
+import com.arsdigita.bebop.Label;
+import com.arsdigita.bebop.PageState;
+import com.arsdigita.bebop.Table;
+import com.arsdigita.bebop.event.TableActionEvent;
+import com.arsdigita.bebop.event.TableActionListener;
+import com.arsdigita.bebop.table.TableCellRenderer;
+import com.arsdigita.bebop.table.TableColumn;
+import com.arsdigita.bebop.table.TableColumnModel;
+import com.arsdigita.bebop.table.TableModel;
+import com.arsdigita.bebop.table.TableModelBuilder;
+import com.arsdigita.cms.CMS;
+import com.arsdigita.cms.ContentItem;
+import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.contentassets.PublicationTypeAsset;
+import com.arsdigita.cms.contenttypes.Publication;
+import com.arsdigita.globalization.GlobalizedMessage;
+import com.arsdigita.kernel.ui.ACSObjectSelectionModel;
+import com.arsdigita.persistence.DataCollection;
+import com.arsdigita.util.LockableImpl;
+import com.sun.org.apache.xml.internal.resolver.helpers.PublicId;
+import java.math.BigDecimal;
+
+/**
+ *
+ * @author Jens Pelzetter
+ * @version $Id$
+ */
+public class PublicationTypeAssetTable extends Table {
+
+ private final static String TABLE_COL_TYPE = "table_col_type";
+ private final static String TABLE_COL_ISBN = "table_col_isbn";
+ private final static String TABLE_COL_MISC = "table_col_misc";
+ private final static String TABLE_COL_EDIT = "table_col_edit";
+ private final static String TABLE_COL_DEL = "table_col_del";
+ private final PublicationTypeAssetStep parent;
+ private final ItemSelectionModel itemModel;
+ private final ACSObjectSelectionModel typeModel;
+
+ public PublicationTypeAssetTable(final ItemSelectionModel itemModel,
+ final ACSObjectSelectionModel typeModel,
+ final PublicationTypeAssetStep parent) {
+ super();
+
+ this.parent = parent;
+ this.itemModel = itemModel;
+ this.typeModel = typeModel;
+
+ setEmptyView(new Label(PublicationTypeAssetGlobalizationUtil.globalize(
+ "scipublications.publication_type_asset.none")));
+
+ final TableColumnModel columnModel = getColumnModel();
+
+ columnModel.add(new TableColumn(
+ 0,
+ PublicationTypeAssetGlobalizationUtil.globalize("scipublications.publication_type_asset.type"),
+ TABLE_COL_TYPE));
+ columnModel.add(new TableColumn(
+ 1,
+ PublicationTypeAssetGlobalizationUtil.globalize("scipublications.publication_type_asset.isbn"),
+ TABLE_COL_ISBN));
+ columnModel.add(new TableColumn(
+ 2,
+ PublicationTypeAssetGlobalizationUtil.globalize("scipublications.publication_type_asset.misc"),
+ TABLE_COL_MISC));
+ columnModel.add(new TableColumn(
+ 3,
+ PublicationTypeAssetGlobalizationUtil.globalize("scipublications.publication_type_asset.edit"),
+ TABLE_COL_EDIT));
+ columnModel.add(new TableColumn(
+ 4,
+ PublicationTypeAssetGlobalizationUtil.globalize("scipublications.publication_type_asset.delete"),
+ TABLE_COL_DEL));
+
+ setModelBuilder(new ModelBuilder(itemModel));
+
+ columnModel.get(3).setCellRenderer(new EditCellRenderer());
+ columnModel.get(4).setCellRenderer(new DeleteCellRenderer());
+
+ addTableActionListener(new ActionListener());
+ }
+
+ private class ModelBuilder extends LockableImpl implements TableModelBuilder {
+
+ private final ItemSelectionModel itemModel;
+
+ public ModelBuilder(final ItemSelectionModel itemModel) {
+ this.itemModel = itemModel;
+ }
+
+ @Override
+ public TableModel makeModel(final Table table, final PageState state) {
+ table.getRowSelectionModel().clearSelection(state);
+
+ final Publication publication = (Publication) itemModel.getSelectedItem(state);
+
+ return new Model(table, state, publication);
+ }
+
+ }
+
+ private class Model implements TableModel {
+
+ private final Table table;
+ private final DataCollection typeAssets;
+
+ public Model(final Table table, final PageState state, final Publication publication) {
+ this.table = table;
+
+ typeAssets = PublicationTypeAsset.getPublicationTypeAssets(publication);
+ }
+
+ @Override
+ public int getColumnCount() {
+ return table.getColumnModel().size();
+ }
+
+ @Override
+ public boolean nextRow() {
+ return (typeAssets != null) && typeAssets.next();
+ }
+
+ @Override
+ public Object getElementAt(final int columnIndex) {
+ switch (columnIndex) {
+ case 0:
+ return typeAssets.get(PublicationTypeAsset.PUBLICATION_TYPE);
+ case 1:
+ return typeAssets.get(PublicationTypeAsset.ISBN);
+ case 2:
+ return typeAssets.get(PublicationTypeAsset.MISC);
+ case 3:
+ return PublicationTypeAssetGlobalizationUtil.globalize(
+ "scipublications.publication_type_asset.edit");
+ case 4:
+ return PublicationTypeAssetGlobalizationUtil.globalize(
+ "scipublications.publication_type_asset.delete");
+ default:
+ return null;
+ }
+ }
+
+ @Override
+ public Object getKeyAt(final int columnIndex) {
+ return typeAssets.get(ContentItem.ID);
+ }
+
+ }
+
+ private class EditCellRenderer extends LockableImpl implements TableCellRenderer {
+
+ public EditCellRenderer() {
+ //Nothing
+ }
+
+ @Override
+ public Component getComponent(final Table table,
+ final PageState state,
+ final Object value,
+ final boolean isSelected,
+ final Object key,
+ final int row,
+ final int column) {
+ final com.arsdigita.cms.SecurityManager securityManager = CMS.getSecurityManager(state);
+ final Publication publication = (Publication) itemModel.getSelectedItem(state);
+
+ final boolean canEdit = securityManager.canAccess(state.getRequest(),
+ com.arsdigita.cms.SecurityManager.EDIT_ITEM,
+ publication);
+
+ if (canEdit) {
+ final ControlLink link;
+ if (value instanceof GlobalizedMessage) {
+ link = new ControlLink(new Label((GlobalizedMessage) value));
+ } else if (value == null) {
+ return new Label("???");
+ } else {
+ link = new ControlLink(value.toString());
+ }
+ return link;
+ } else {
+ final Label label;
+ if (value instanceof GlobalizedMessage) {
+ label = new Label((GlobalizedMessage) value);
+ } else if (value == null) {
+ return new Label("???");
+ } else {
+ label = new Label(value.toString());
+ }
+ return label;
+ }
+ }
+
+ }
+
+ private class DeleteCellRenderer extends LockableImpl implements TableCellRenderer {
+
+ public DeleteCellRenderer() {
+ //Nothing
+ }
+
+ @Override
+ public Component getComponent(final Table table,
+ final PageState state,
+ final Object value,
+ final boolean isSelected,
+ final Object key,
+ final int row,
+ final int column) {
+ final com.arsdigita.cms.SecurityManager securityManager = CMS.getSecurityManager(state);
+ final Publication publication = (Publication) itemModel.getSelectedItem(state);
+
+ final boolean canEdit = securityManager.canAccess(state.getRequest(),
+ com.arsdigita.cms.SecurityManager.EDIT_ITEM,
+ publication);
+
+ if (canEdit) {
+ final ControlLink link;
+ if (value instanceof GlobalizedMessage) {
+ link = new ControlLink(new Label((GlobalizedMessage) value));
+ } else {
+ link = new ControlLink(value.toString());
+ }
+ link.setConfirmation(PublicationTypeAssetGlobalizationUtil.globalize(
+ "scipublications.publication_type_asset.delete.confirm"));
+ return link;
+ } else {
+ final Label label;
+ if (value instanceof GlobalizedMessage) {
+ label = new Label((GlobalizedMessage) value);
+ } else {
+ label = new Label(value.toString());
+ }
+ return label;
+ }
+
+ }
+
+ }
+
+ private class ActionListener implements TableActionListener {
+
+ public ActionListener() {
+ //Nothing for now
+ }
+
+ @Override
+ public void cellSelected(final TableActionEvent event) {
+ final PageState state = event.getPageState();
+
+ final PublicationTypeAsset asset = new PublicationTypeAsset(new BigDecimal(event.getRowKey().toString()));
+
+ final TableColumn column = getColumnModel().get(event.getColumn().intValue());
+
+ if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
+ typeModel.setSelectedObject(state, asset);
+ parent.setAddVisible(state);
+ } else if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
+ asset.delete();
+ }
+ }
+
+ @Override
+ public void headSelected(final TableActionEvent event) {
+ //Nothing
+ }
+
+ }
+}