diff --git a/ccm-cms/pdl/com/arsdigita/content-types/GenericContact.pdl b/ccm-cms/pdl/com/arsdigita/content-types/GenericContact.pdl
index 22417aa2b..94c47eec5 100644
--- a/ccm-cms/pdl/com/arsdigita/content-types/GenericContact.pdl
+++ b/ccm-cms/pdl/com/arsdigita/content-types/GenericContact.pdl
@@ -66,8 +66,8 @@ association {
to cms_contacts.contact_id;
// Link Attribute
- BigDecimal[1..1] contact_order = cms_person_contact_map.contact_order INTEGER;
+ BigDecimal[0..1] contact_order = cms_person_contact_map.contact_order INTEGER;
// Can't use a join statement here because contacttype_id is not unique
- String[1..1] contact_type = cms_person_contact_map.key VARCHAR(100);
+ String[0..1] contact_type = cms_person_contact_map.key VARCHAR(100);
}
diff --git a/ccm-cms/pdl/com/arsdigita/content-types/GenericOrganizationalUnit.pdl b/ccm-cms/pdl/com/arsdigita/content-types/GenericOrganizationalUnit.pdl
index fa90e37bc..7b3abb720 100644
--- a/ccm-cms/pdl/com/arsdigita/content-types/GenericOrganizationalUnit.pdl
+++ b/ccm-cms/pdl/com/arsdigita/content-types/GenericOrganizationalUnit.pdl
@@ -34,7 +34,7 @@ object type GenericOrganizationalUnit extends ContentPage {
// Parent <-> child relation organizationalunits to build department structures etc.
association {
- GenericOrganizationalUnit[0..1] orgaunit_parent = join cms_organizationalunits.organizationalunit_id
+ GenericOrganizationalUnit[0..n] orgaunit_parent = join cms_organizationalunits.organizationalunit_id
to cms_organizationalunits_organizationalunit_map.orgaunit_children_id,
join cms_organizationalunits_organizationalunit_map.orgaunit_parent_id
to cms_organizationalunits.organizationalunit_id;
@@ -62,15 +62,15 @@ association {
to cms_contacts.contact_id;
// Some link attributes.
- String contact_type = cms_organizationalunits_contact_map.contact_type VARCHAR(100);
- Integer contact_order = cms_organizationalunits_contact_map.map_order INTEGER;
+ String[0..1] contact_type = cms_organizationalunits_contact_map.contact_type VARCHAR(100);
+ Integer[0..1] contact_order = cms_organizationalunits_contact_map.map_order INTEGER;
}
// Links a organization with persons.
association {
- GenericOrganizationalUnit[0..1] organizationalunit = join cms_persons.person_id
+ GenericOrganizationalUnit[0..n] organizationalunit = join cms_persons.person_id
to cms_organizationalunits_person_map.person_id,
join cms_organizationalunits_person_map.organizationalunit_id
to cms_organizationalunits.organizationalunit_id;
diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericOrganizationalUnitChildrenCollection.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericOrganizationalUnitChildrenCollection.java
index 36d428655..f27b4e24f 100644
--- a/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericOrganizationalUnitChildrenCollection.java
+++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericOrganizationalUnitChildrenCollection.java
@@ -74,7 +74,7 @@ public class GenericOrganizationalUnitChildrenCollection
public void swapWithNext(GenericOrganizationalUnit child) {
int currentPos = 0;
int currentIndex = 0;
- int nextIndex = 0;
+ int nextIndex = 0;
s_log.debug("Searching child...");
this.rewind();
@@ -181,6 +181,7 @@ public class GenericOrganizationalUnitChildrenCollection
* @return The GenericOrganizationalUnit at the cursors current position.
*/
public GenericOrganizationalUnit getOrgaUnitChild() {
- return new GenericOrganizationalUnit(m_dataCollection.getDataObject());
+ return new GenericOrganizationalUnit(
+ m_dataCollection.getDataObject());
}
}
diff --git a/ccm-core/src/com/arsdigita/persistence/OID.java b/ccm-core/src/com/arsdigita/persistence/OID.java
index 58eae2b20..c65ee5dc1 100755
--- a/ccm-core/src/com/arsdigita/persistence/OID.java
+++ b/ccm-core/src/com/arsdigita/persistence/OID.java
@@ -429,7 +429,31 @@ public class OID {
for(Iterator it = props.keySet().iterator(); it.hasNext(); ) {
Object key = it.next();
Object value = props.get(key);
- sb.append(key.toString() + OID_SEPARATOR_CHAR + value.toString());
+ /*if ((key == null) || (value == null)) {
+ m_log.warn("key or value in OID.toString() are null");
+ m_log.warn(String.format("key = %s", key));
+ m_log.warn(String.format("value = %s", value));
+ }*/
+ /*
+ * Changed by Jens Pelzetter 2010-09-14. For unknown reasons
+ * the value is null for some properties, which causes
+ * a NPE in the line below the if.
+ */
+ if (null == value) {
+ m_log.info(String.format("The value for prop \"%s\" " +
+ "is null. Ignoring.", key));
+ continue;
+ }
+ /*
+ * Changed by Jens Pelzetter 2010-09-14.
+ *
+ * The old method (see below) is very slow, because of this
+ * has been changed.
+ */
+ sb.append(key.toString());
+ sb.append(OID_SEPARATOR_CHAR);
+ sb.append(value.toString());
+ //sb.append(key.toString() + OID_SEPARATOR_CHAR + value.toString());
if (it.hasNext()) {
sb.append(OID_SEPARATOR_CHAR);
}
diff --git a/ccm-sci-publications/pdl/com/arsdigita/content-types/Publication.pdl b/ccm-sci-publications/pdl/com/arsdigita/content-types/Publication.pdl
index 8a8a32ba3..9e304446e 100644
--- a/ccm-sci-publications/pdl/com/arsdigita/content-types/Publication.pdl
+++ b/ccm-sci-publications/pdl/com/arsdigita/content-types/Publication.pdl
@@ -35,7 +35,7 @@ object type Publication extends ContentPage {
//Assoication for the authors
association {
- Publication[0..1] publication = join cms_persons.person_id
+ Publication[0..n] publication = join cms_persons.person_id
to ct_publications_authorship.person_id,
join ct_publications_authorship.publication_id
to ct_publications.publication_id;
diff --git a/ccm-sci-publications/pdl/com/arsdigita/content-types/PublicationList.pdl b/ccm-sci-publications/pdl/com/arsdigita/content-types/PublicationList.pdl
new file mode 100644
index 000000000..66f6d5b5c
--- /dev/null
+++ b/ccm-sci-publications/pdl/com/arsdigita/content-types/PublicationList.pdl
@@ -0,0 +1,45 @@
+//
+// Copyright (C) 2010 Jens Pelzetter, for the Center of Social Politics (ZeS) of
+// the University of Bremen
+//
+// 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.contenttypes;
+
+import com.arsdigita.cms.ContentPage;
+
+//PDL definition for the basic attributes of publication.
+object type PublicationList extends ContentPage {
+
+ String[0..1] description = ct_publicationlists.description VARCHAR(2048);
+
+ reference key (ct_publicationlists.publicationlist_id);
+}
+
+//Association which links the publication list(s) and the publications
+association {
+
+ PublicationList[0..n] publicationLists = join ct_publications.publication_id
+ to ct_publicationlists_map.publication_id,
+ join ct_publicationlists_map.publicationlist_id
+ to ct_publicationlists.publicationlist_id;
+
+ Publication[0..n] publications = join ct_publicationlists.publicationlist_id
+ to ct_publicationlists_map.publicationlist_id,
+ join ct_publicationlists_map.publication_id
+ to ct_publications.publication_id;
+}
\ No newline at end of file
diff --git a/ccm-sci-publications/pdl/com/arsdigita/content-types/Series.pdl b/ccm-sci-publications/pdl/com/arsdigita/content-types/Series.pdl
index 8aba3807c..cb9ce8a21 100644
--- a/ccm-sci-publications/pdl/com/arsdigita/content-types/Series.pdl
+++ b/ccm-sci-publications/pdl/com/arsdigita/content-types/Series.pdl
@@ -32,7 +32,7 @@ object type Series extends ContentPage {
//Assoication for the editship of a series
association {
- Series[0..1] series = join cms_persons.person_id
+ Series[0..n] series = join cms_persons.person_id
to ct_series_editship.person_id,
join ct_series_editship.series_id
to ct_series.series_id;
@@ -54,7 +54,7 @@ association {
//Assoication for the volumes in the series
association {
- Series[0..1] series = join ct_publications.publication_id
+ Series[0..n] series = join ct_publications.publication_id
to ct_publications_volume_in_series.publication_id,
join ct_publications_volume_in_series.series_id
to ct_series.series_id;
diff --git a/ccm-sci-publications/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/PublicationList.xml b/ccm-sci-publications/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/PublicationList.xml
new file mode 100644
index 000000000..4e774c51a
--- /dev/null
+++ b/ccm-sci-publications/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/PublicationList.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/ArticleInCollectedVolume.xml b/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/ArticleInCollectedVolume.xml
new file mode 100644
index 000000000..30ff0e6ae
--- /dev/null
+++ b/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/ArticleInCollectedVolume.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/PublicationList.xml b/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/PublicationList.xml
new file mode 100644
index 000000000..69fe0529d
--- /dev/null
+++ b/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/PublicationList.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ccm-sci-publications/src/ccm-sci-publications.load b/ccm-sci-publications/src/ccm-sci-publications.load
index 341681c65..c665ff50d 100644
--- a/ccm-sci-publications/src/ccm-sci-publications.load
+++ b/ccm-sci-publications/src/ccm-sci-publications.load
@@ -6,7 +6,7 @@
-
+
@@ -21,6 +21,7 @@
+
@@ -36,6 +37,7 @@
+
@@ -54,5 +56,6 @@
+
diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/Publication.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/Publication.java
index 1d89e51bf..048a1d260 100644
--- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/Publication.java
+++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/Publication.java
@@ -1,5 +1,6 @@
/*
- * Copyright (c) 2010 Jens Pelzetter, for the Center of Social Politics of the University of Bremen
+ * Copyright (c) 2010 Jens Pelzetter,
+ * for the Center of Social Politics of the University of Bremen
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/PublicationList.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/PublicationList.java
new file mode 100644
index 000000000..919898687
--- /dev/null
+++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/PublicationList.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2010 Jens Pelzetter,
+ * for the Center of Social Politics of the University of Bremen
+ *
+ * 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 java.math.BigDecimal;
+
+import com.arsdigita.cms.ContentPage;
+import com.arsdigita.domain.DataObjectNotFoundException;
+import com.arsdigita.persistence.DataCollection;
+import com.arsdigita.persistence.DataObject;
+import com.arsdigita.persistence.OID;
+import com.arsdigita.util.Assert;
+
+/**
+ * This content type is used to create a simple list of {@link Publication}
+ * items. This is only a temporally solution. This content type be replaced by
+ * a more flexible portlet or application soon.
+ *
+ * @author Jens Pelzetter
+ */
+public class PublicationList extends ContentPage {
+
+ public static final String DESCRIPTION = "description";
+ public static final String PUBLICATIONS = "publications";
+ public static final String BASE_DATA_OBJECT_TYPE =
+ "com.arsdigita.cms.contenttypes.PublicationList";
+
+ public PublicationList() {
+ this(BASE_DATA_OBJECT_TYPE);
+ }
+
+ public PublicationList(BigDecimal id)
+ throws DataObjectNotFoundException {
+ this(new OID(BASE_DATA_OBJECT_TYPE, id));
+ }
+
+ public PublicationList(OID oid) throws DataObjectNotFoundException {
+ super(oid);
+ }
+
+ public PublicationList(DataObject obj) {
+ super(obj);
+ }
+
+ public PublicationList(String type) {
+ super(type);
+ }
+
+ public String getDescription() {
+ return (String) get(DESCRIPTION);
+ }
+
+ public void setDescription(String desc) {
+ set(DESCRIPTION, desc);
+ }
+
+ public PublicationCollection getPublications() {
+ return new PublicationCollection((DataCollection) get(PUBLICATIONS));
+ }
+
+ public void addPublication(Publication publication) {
+ Assert.exists (publication, Publication.class);
+
+ add(PUBLICATIONS, publication);
+ }
+
+ public void removePublication(Publication publication) {
+ Assert.exists (publication, Publication.class);
+
+ remove(PUBLICATIONS, publication);
+ }
+
+ public boolean hasPublications() {
+ return !getPublications().isEmpty();
+ }
+}
diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/PublicationListCollection.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/PublicationListCollection.java
new file mode 100644
index 000000000..734bfacfc
--- /dev/null
+++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/PublicationListCollection.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2010 Jens Pelzetter,
+ * for the Center of Social Politics of the University of Bremen
+ *
+ * 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.domain.DomainCollection;
+import com.arsdigita.persistence.DataCollection;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+public class PublicationListCollection extends DomainCollection {
+
+ public PublicationListCollection(DataCollection dataCollection) {
+ super(dataCollection);
+ }
+
+ public PublicationList getPublicationList() {
+ return new PublicationList(m_dataCollection.getDataObject());
+ }
+
+}
diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/PublicationListInitializer.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/PublicationListInitializer.java
new file mode 100644
index 000000000..41303e9e7
--- /dev/null
+++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/PublicationListInitializer.java
@@ -0,0 +1,23 @@
+package com.arsdigita.cms.contenttypes;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+public class PublicationListInitializer extends ContentTypeInitializer {
+
+ public PublicationListInitializer() {
+ super("empty.pdl.mf", PublicationList.BASE_DATA_OBJECT_TYPE);
+ }
+
+ @Override
+ public String[] getStylesheets() {
+ return new String[]{"/static/content-types/com/arsdigita/cms/contenttypes/PublicationList.xsl"};
+ }
+
+ @Override
+ public String getTraversalXML() {
+ return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/PublicationList.xml";
+ }
+
+}
diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/PublicationListLoader.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/PublicationListLoader.java
new file mode 100644
index 000000000..fd4ff884c
--- /dev/null
+++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/PublicationListLoader.java
@@ -0,0 +1,19 @@
+package com.arsdigita.cms.contenttypes;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+public class PublicationListLoader extends AbstractContentTypeLoader {
+
+ private static final String[] TYPES = {"/WEB-INF/content-types/com/arsdigita/cms/contenttypes/PublicationList.xml"};
+
+ public PublicationListLoader() {
+ super();
+ }
+
+ public String[] getTypes() {
+ return TYPES;
+ }
+
+}
diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationAuthorsPropertyStep.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationAuthorsPropertyStep.java
index 24bab5b42..bac81ed54 100644
--- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationAuthorsPropertyStep.java
+++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationAuthorsPropertyStep.java
@@ -14,9 +14,8 @@ public class PublicationAuthorsPropertyStep extends SimpleEditStep {
private static final String ADD_AUTHOR_SHEET_NAME = "addAuthor";
- public PublicationAuthorsPropertyStep(
- ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
+ public PublicationAuthorsPropertyStep(ItemSelectionModel itemModel,
+ AuthoringKitWizard parent) {
this(itemModel, parent, null);
}
diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationAuthorsTable.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationAuthorsTable.java
index d2beec5dd..6c349c23a 100644
--- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationAuthorsTable.java
+++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationAuthorsTable.java
@@ -41,7 +41,7 @@ public class PublicationAuthorsTable
public PublicationAuthorsTable(ItemSelectionModel itemModel) {
super();
m_itemModel = itemModel;
-
+
setEmptyView(
new Label(PublicationGlobalizationUtil.globalize(
"publications.ui.authors.none")));
@@ -75,7 +75,7 @@ public class PublicationAuthorsTable
setModelBuilder(
new PublicationAuthorsTableModelBuilder(itemModel));
- colModel.get(0).setCellRenderer(new EditCellRenderer());
+ colModel.get(0).setCellRenderer(new EditCellRenderer());
colModel.get(2).setCellRenderer(new DeleteCellRenderer());
colModel.get(3).setCellRenderer(new UpCellRenderer());
colModel.get(4).setCellRenderer(new DownCellRenderer());
@@ -110,10 +110,9 @@ public class PublicationAuthorsTable
private AuthorshipCollection m_authorshipCollection;
private GenericPerson m_author;
- private PublicationAuthorsTableModel(
- Table table,
- PageState state,
- Publication publication) {
+ public PublicationAuthorsTableModel(Table table,
+ PageState state,
+ Publication publication) {
m_table = table;
m_authorshipCollection = publication.getAuthors();
}
@@ -205,14 +204,13 @@ public class PublicationAuthorsTable
implements TableCellRenderer {
@Override
- public Component getComponent(
- Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
+ public Component getComponent(Table table,
+ PageState state,
+ Object value,
+ boolean isSelected,
+ Object key,
+ int row,
+ int col) {
SecurityManager securityManager =
Utilities.getSecurityManager(state);
diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationListPropertiesStep.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationListPropertiesStep.java
new file mode 100644
index 000000000..dbc868a0b
--- /dev/null
+++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationListPropertiesStep.java
@@ -0,0 +1,122 @@
+package com.arsdigita.cms.contenttypes.ui;
+
+import java.text.DateFormat;
+
+import com.arsdigita.bebop.Component;
+import com.arsdigita.bebop.Label;
+import com.arsdigita.bebop.PageState;
+import com.arsdigita.bebop.SegmentedPanel;
+import com.arsdigita.cms.ContentPage;
+import com.arsdigita.cms.ContentSection;
+import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.contenttypes.PublicationList;
+import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
+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.domain.DomainObject;
+import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+public class PublicationListPropertiesStep extends SimpleEditStep {
+
+ public static final String EDIT_SHEET_NAME = "edit";
+ private SegmentedPanel segmentedPanel;
+
+ public PublicationListPropertiesStep(ItemSelectionModel itemModel,
+ AuthoringKitWizard parent) {
+ super(itemModel, parent);
+
+ segmentedPanel = new SegmentedPanel();
+ setDefaultEditKey(EDIT_SHEET_NAME);
+
+ addBasicProperties(itemModel, parent);
+ addSteps(itemModel, parent);
+
+ setDisplayComponent(segmentedPanel);
+ }
+
+ public static Component getPublicationListPropertySheet(
+ ItemSelectionModel itemModel) {
+ DomainObjectPropertySheet sheet =
+ new DomainObjectPropertySheet(itemModel);
+
+ sheet.add(PublicationGlobalizationUtil.globalize(
+ "publications.ui.publicationlist.name"),
+ PublicationList.NAME);
+ sheet.add(PublicationGlobalizationUtil.globalize(
+ "publications.ui.publicationlist.title"),
+ PublicationList.TITLE);
+
+ if (!ContentSection.getConfig().getHideLaunchDate()) {
+ sheet.add(ContenttypesGlobalizationUtil.globalize(
+ "cms.ui.authoring.page_launch_date"),
+ ContentPage.LAUNCH_DATE,
+ new DomainObjectPropertySheet.AttributeFormatter() {
+
+ public String format(DomainObject item,
+ String attribute,
+ PageState state) {
+ ContentPage page = (ContentPage) item;
+ if (page.getLaunchDate() != null) {
+ return DateFormat.getDateInstance(DateFormat.LONG).
+ format(page.getLaunchDate());
+ } else {
+ return (String) ContenttypesGlobalizationUtil.globalize(
+ "cms.ui.unknown").localize();
+ }
+ }
+ });
+ }
+
+ return sheet;
+ }
+
+ protected SegmentedPanel getSegmentedPanel() {
+ return segmentedPanel;
+ }
+
+ protected void addBasicProperties(ItemSelectionModel itemModel,
+ AuthoringKitWizard parent) {
+ SimpleEditStep basicProperties = new SimpleEditStep(itemModel,
+ parent,
+ EDIT_SHEET_NAME);
+
+ BasicPageForm editBasicSheet =
+ new PublicationListPropertyForm(itemModel,
+ this);
+ basicProperties.add(EDIT_SHEET_NAME,
+ (String) PublicationGlobalizationUtil.globalize(
+ "publcations.ui.publicationlist_edit_basic_sheet").
+ localize(), new WorkflowLockedComponentAccess(editBasicSheet,
+ itemModel),
+ editBasicSheet.getSaveCancelSection().
+ getCancelButton());
+
+ basicProperties.setDisplayComponent(
+ getPublicationListPropertySheet(itemModel));
+
+ segmentedPanel.addSegment(
+ new Label((String) PublicationGlobalizationUtil.globalize(
+ "publications.ui.publicationlist.basic_properties").
+ localize()), basicProperties);
+ }
+
+ protected void addSteps(ItemSelectionModel itemModel,
+ AuthoringKitWizard parent) {
+ addStep(new PublicationListPublicationsStep(itemModel, parent),
+ "publications.ui.publicationlist.publications");
+ }
+
+ protected void addStep(SimpleEditStep step, String labelKey) {
+ segmentedPanel.addSegment(
+ new Label((String) PublicationGlobalizationUtil.globalize(
+ labelKey).localize()),
+ step);
+
+ }
+}
diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationListPropertyForm.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationListPropertyForm.java
new file mode 100644
index 000000000..9d989412f
--- /dev/null
+++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationListPropertyForm.java
@@ -0,0 +1,93 @@
+package com.arsdigita.cms.contenttypes.ui;
+
+import com.arsdigita.bebop.FormData;
+import com.arsdigita.bebop.FormProcessException;
+import com.arsdigita.bebop.Label;
+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.TextArea;
+import com.arsdigita.bebop.form.TextField;
+import com.arsdigita.bebop.parameters.ParameterModel;
+import com.arsdigita.bebop.parameters.StringParameter;
+import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.contenttypes.PublicationList;
+import com.arsdigita.cms.ui.authoring.BasicPageForm;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+public class PublicationListPropertyForm
+ extends BasicPageForm
+ implements FormProcessListener,
+ FormInitListener,
+ FormSubmissionListener {
+
+ private PublicationListPropertiesStep m_step;
+ public static final String ID = "PublicationList_edit";
+
+ public PublicationListPropertyForm(ItemSelectionModel itemModel) {
+ this(itemModel, null);
+ }
+
+ public PublicationListPropertyForm(ItemSelectionModel itemModel,
+ PublicationListPropertiesStep step) {
+ super(ID, itemModel);
+ m_step = step;
+ addSubmissionListener(this);
+ }
+
+ @Override
+ protected void addWidgets() {
+ super.addWidgets();
+
+ add(new Label((String) PublicationGlobalizationUtil.globalize(
+ "publications.ui.publicationlist.title").localize()));
+ ParameterModel titleParam = new StringParameter(PublicationList.TITLE);
+ TextField title = new TextField(titleParam);
+ add(title);
+
+ add(new Label((String) PublicationGlobalizationUtil.globalize(
+ "publications.ui.publicationlist.description").localize()));
+ ParameterModel descParam =
+ new StringParameter(PublicationList.DESCRIPTION);
+ TextArea desc = new TextArea(descParam);
+ desc.setCols(60);
+ desc.setRows(16);
+ add(desc);
+ }
+
+ @Override
+ public void init(FormSectionEvent fse) throws FormProcessException {
+ FormData data = fse.getFormData();
+ PublicationList list = (PublicationList) super.initBasicWidgets(fse);
+
+ data.put(PublicationList.TITLE, list.getTitle());
+ data.put(PublicationList.DESCRIPTION, list.getDescription());
+ }
+
+ @Override
+ public void process(FormSectionEvent fse) throws FormProcessException {
+ FormData data = fse.getFormData();
+ PublicationList list = (PublicationList) super.processBasicWidgets(fse);
+
+ if ((list != null) && getSaveCancelSection().getSaveButton().
+ isSelected(fse.getPageState())) {
+ list.setTitle((String) data.get(PublicationList.TITLE));
+ list.setDescription((String) data.get(PublicationList.DESCRIPTION));
+
+ list.save();
+ }
+ }
+
+ @Override
+ public void submitted(FormSectionEvent fse) throws FormProcessException {
+ if ((m_step != null) && getSaveCancelSection().getCancelButton().
+ isSelected(fse.getPageState())) {
+ m_step.cancelStreamlinedCreation(fse.getPageState());
+ }
+
+ }
+}
diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationListPublicationAddForm.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationListPublicationAddForm.java
new file mode 100644
index 000000000..a49e17b1b
--- /dev/null
+++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationListPublicationAddForm.java
@@ -0,0 +1,69 @@
+package com.arsdigita.cms.contenttypes.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.FormInitListener;
+import com.arsdigita.bebop.event.FormProcessListener;
+import com.arsdigita.bebop.event.FormSectionEvent;
+import com.arsdigita.cms.ContentType;
+import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.contenttypes.Publication;
+import com.arsdigita.cms.contenttypes.PublicationList;
+import com.arsdigita.cms.ui.ItemSearchWidget;
+import com.arsdigita.cms.ui.authoring.BasicItemForm;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+public class PublicationListPublicationAddForm
+ extends BasicItemForm
+ implements FormProcessListener,
+ FormInitListener {
+
+ private PublicationListPropertiesStep m_step;
+ private ItemSearchWidget m_itemSearch;
+ private final String ITEM_SEARCH = "publications";
+ private ItemSelectionModel m_itemModel;
+
+ public PublicationListPublicationAddForm(ItemSelectionModel itemModel) {
+ super("PublicationsEntryForm", itemModel);
+ m_itemModel = itemModel;
+ }
+
+ @Override
+ protected void addWidgets() {
+ add(new Label((String) PublicationGlobalizationUtil.globalize(
+ "publications.ui.publicationlist.selectPublication").
+ localize()));
+ m_itemSearch = new ItemSearchWidget(
+ ITEM_SEARCH,
+ ContentType.findByAssociatedObjectType(
+ Publication.class.getName()));
+ add(m_itemSearch);
+ }
+
+ @Override
+ public void init(FormSectionEvent fse) throws FormProcessException {
+ PageState state = fse.getPageState();
+ setVisible(state, true);
+ }
+
+ @Override
+ public void process(FormSectionEvent fse) throws FormProcessException {
+ FormData data = fse.getFormData();
+ PageState state = fse.getPageState();
+ PublicationList list = (PublicationList) getItemSelectionModel().
+ getSelectedObject(state);
+
+ if (!(this.getSaveCancelSection().getCancelButton().
+ isSelected(state))) {
+ list.addPublication(
+ (Publication) data.get(ITEM_SEARCH));
+ }
+
+ init(fse);
+ }
+}
diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationListPublicationsStep.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationListPublicationsStep.java
new file mode 100644
index 000000000..4bbef225b
--- /dev/null
+++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationListPublicationsStep.java
@@ -0,0 +1,40 @@
+package com.arsdigita.cms.contenttypes.ui;
+
+import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
+import com.arsdigita.cms.ui.authoring.BasicItemForm;
+import com.arsdigita.cms.ui.authoring.SimpleEditStep;
+import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+public class PublicationListPublicationsStep extends SimpleEditStep {
+
+ private static final String ADD_PUBLICATION_SHEET_NAME = "addPublication";
+
+ public PublicationListPublicationsStep(ItemSelectionModel itemModel,
+ AuthoringKitWizard parent) {
+ this(itemModel, parent, null);
+ }
+
+ public PublicationListPublicationsStep(ItemSelectionModel itemModel,
+ AuthoringKitWizard parent,
+ String prefix) {
+ super(itemModel, parent, prefix);
+
+ BasicItemForm addPublicationSheet =
+ new PublicationListPublicationAddForm(itemModel);
+ add(ADD_PUBLICATION_SHEET_NAME,
+ (String) PublicationGlobalizationUtil.globalize(
+ "publications.ui.publicationlist.add_publication").localize(),
+ new WorkflowLockedComponentAccess(addPublicationSheet,
+ itemModel),
+ addPublicationSheet.getSaveCancelSection().getCancelButton());
+
+ PublicationListPublicationsTable publicationsTable =
+ new PublicationListPublicationsTable(itemModel);
+ setDisplayComponent(publicationsTable);
+ }
+}
diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationListPublicationsTable.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationListPublicationsTable.java
new file mode 100644
index 000000000..0034fbf39
--- /dev/null
+++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationListPublicationsTable.java
@@ -0,0 +1,234 @@
+package com.arsdigita.cms.contenttypes.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.ItemSelectionModel;
+import com.arsdigita.cms.SecurityManager;
+import com.arsdigita.cms.contenttypes.Publication;
+import com.arsdigita.cms.contenttypes.PublicationCollection;
+import com.arsdigita.cms.contenttypes.PublicationList;
+import com.arsdigita.cms.dispatcher.Utilities;
+import com.arsdigita.util.LockableImpl;
+import java.math.BigDecimal;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+public class PublicationListPublicationsTable
+ extends Table
+ implements TableActionListener {
+
+ private static final String TABLE_COL_EDIT = "table_col_edit";
+ private final String TABLE_COL_DEL = "table_col_del";
+ private ItemSelectionModel m_itemModel;
+
+ public PublicationListPublicationsTable(ItemSelectionModel itemModel) {
+ super();
+ m_itemModel = itemModel;
+
+ setEmptyView(
+ new Label(PublicationGlobalizationUtil.globalize(
+ "publications.ui.publicationlist.no_publications")));
+
+ TableColumnModel colModel = getColumnModel();
+ colModel.add(new TableColumn(
+ 0,
+ PublicationGlobalizationUtil.globalize(
+ "publications.ui.publicationlist.publication.title").
+ localize(),
+ TABLE_COL_EDIT));
+ colModel.add(new TableColumn(
+ 1,
+ PublicationGlobalizationUtil.globalize(
+ "publications.ui.publicationlist.publication.remove").
+ localize(),
+ TABLE_COL_DEL));
+
+ setModelBuilder(
+ new PublicationListPublicationsTableModelBuilder(itemModel));
+
+ colModel.get(0).setCellRenderer(new EditCellRenderer());
+ colModel.get(1).setCellRenderer(new DeleteCellRenderer());
+
+ addTableActionListener(this);
+ }
+
+ private class PublicationListPublicationsTableModelBuilder
+ extends LockableImpl
+ implements TableModelBuilder {
+
+ private ItemSelectionModel m_itemModel;
+
+ public PublicationListPublicationsTableModelBuilder(
+ ItemSelectionModel itemModel) {
+ m_itemModel = itemModel;
+ }
+
+ public TableModel makeModel(Table table, PageState state) {
+ table.getRowSelectionModel().clearSelection(state);
+ PublicationList list = (PublicationList) m_itemModel.
+ getSelectedObject(state);
+ return new PublicationListPublicationsTableModel(table,
+ state,
+ list);
+ }
+ }
+
+ private class PublicationListPublicationsTableModel implements TableModel {
+
+ private Table m_table;
+ private PublicationCollection m_publicationCollection;
+ private Publication m_publication;
+
+ public PublicationListPublicationsTableModel(Table table,
+ PageState state,
+ PublicationList list) {
+ m_table = table;
+ m_publicationCollection = list.getPublications();
+ }
+
+ @Override
+ public int getColumnCount() {
+ return m_table.getColumnModel().size();
+ }
+
+ @Override
+ public boolean nextRow() {
+ boolean ret;
+
+ if ((m_publicationCollection != null)
+ && m_publicationCollection.next()) {
+ m_publication = m_publicationCollection.getPublication();
+ ret = true;
+ } else {
+ ret = false;
+ }
+
+ return ret;
+ }
+
+ @Override
+ public Object getElementAt(int columnIndex) {
+ switch (columnIndex) {
+ case 0:
+ return m_publication.getTitle();
+ case 1:
+ return PublicationGlobalizationUtil.globalize(
+ "publications.ui.publicationlist.publication.remove").
+ localize();
+ default:
+ return null;
+ }
+ }
+
+ public Object getKeyAt(int columnIndex) {
+ return m_publication.getID();
+ }
+ }
+
+ private class EditCellRenderer
+ extends LockableImpl
+ implements TableCellRenderer {
+
+ @Override
+ public Component getComponent(
+ Table table,
+ PageState state,
+ Object value,
+ boolean isSelected,
+ Object key,
+ int row,
+ int col) {
+ SecurityManager securityManager =
+ Utilities.getSecurityManager(state);
+ PublicationList list = (PublicationList) m_itemModel.
+ getSelectedObject(state);
+
+ boolean canEdit = securityManager.canAccess(
+ state.getRequest(),
+ SecurityManager.EDIT_ITEM,
+ list);
+
+ if (canEdit) {
+ ControlLink link = new ControlLink(value.toString());
+ return link;
+ } else {
+ Label label = new Label(value.toString());
+ return label;
+ }
+ }
+ }
+
+ private class DeleteCellRenderer
+ extends LockableImpl
+ implements TableCellRenderer {
+
+ @Override
+ public Component getComponent(Table table,
+ PageState state,
+ Object value,
+ boolean isSelected,
+ Object key,
+ int row,
+ int col) {
+
+ SecurityManager securityManager =
+ Utilities.getSecurityManager(state);
+ PublicationList list = (PublicationList) m_itemModel.
+ getSelectedObject(state);
+
+ boolean canDelete = securityManager.canAccess(
+ state.getRequest(),
+ SecurityManager.DELETE_ITEM,
+ list);
+
+ if (canDelete) {
+ ControlLink link = new ControlLink(value.toString());
+ link.setConfirmation((String) PublicationGlobalizationUtil.
+ globalize(
+ "publications.ui.publicationlist.publication.confirm_remove").
+ localize());
+ return link;
+ } else {
+ Label label = new Label(value.toString());
+ return label;
+ }
+ }
+ }
+
+ @Override
+ public void cellSelected(TableActionEvent event) {
+ PageState state = event.getPageState();
+
+ Publication publication = new Publication(
+ new BigDecimal(event.getRowKey().toString()));
+
+ PublicationList list = (PublicationList) m_itemModel.getSelectedObject(
+ state);
+
+ PublicationCollection publications = list.getPublications();
+
+ TableColumn column = getColumnModel().get(event.getColumn().intValue());
+
+ if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
+ } else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
+ list.removePublication(publication);
+ }
+ }
+
+ @Override
+ public void headSelected(TableActionEvent event) {
+ //Nothing to do
+ }
+}
diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationPropertiesStep.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationPropertiesStep.java
index f3c7c2919..b7732d1a3 100644
--- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationPropertiesStep.java
+++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationPropertiesStep.java
@@ -44,9 +44,12 @@ public class PublicationPropertiesStep extends SimpleEditStep {
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(
itemModel);
+ sheet.add(PublicationGlobalizationUtil.globalize(
+ "publications.ui.publication.name"),
+ Publication.NAME);
sheet.add(PublicationGlobalizationUtil.globalize(
"publications.ui.publication.title"),
- Publication.NAME);
+ Publication.TITLE);
sheet.add(PublicationGlobalizationUtil.globalize(
"publications.ui.publication.year_of_publication"),
Publication.YEAR_OF_PUBLICATION);
diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationPropertyForm.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationPropertyForm.java
index d273b038d..ff0101e94 100644
--- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationPropertyForm.java
+++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationPropertyForm.java
@@ -49,7 +49,7 @@ public class PublicationPropertyForm
add(new Label((String) PublicationGlobalizationUtil.globalize(
"publications.ui.publication.title").localize()));
- ParameterModel titleParam = new StringParameter(Publication.NAME);
+ ParameterModel titleParam = new StringParameter(Publication.TITLE);
TextField title = new TextField(titleParam);
add(title);
@@ -83,7 +83,7 @@ public class PublicationPropertyForm
FormData data = fse.getFormData();
Publication publication = (Publication) super.initBasicWidgets(fse);
- data.put(Publication.NAME, publication.getTitle());
+ data.put(Publication.TITLE, publication.getTitle());
data.put(Publication.YEAR_OF_PUBLICATION, publication.
getYearOfPublication());
data.put(Publication.ABSTRACT, publication.getAbstract());
@@ -97,7 +97,7 @@ public class PublicationPropertyForm
if ((publication != null) && getSaveCancelSection().getSaveButton().
isSelected(fse.getPageState())) {
- publication.setTitle((String) data.get(Publication.NAME));
+ publication.setTitle((String) data.get(Publication.TITLE));
publication.setYearOfPublication((Integer) data.get(
Publication.YEAR_OF_PUBLICATION));
publication.setAbstract((String) data.get(Publication.ABSTRACT));
diff --git a/ccm-sci-publications/web/static/content-types/com/arsdigita/cms/contenttypes/PublicationList.xsl b/ccm-sci-publications/web/static/content-types/com/arsdigita/cms/contenttypes/PublicationList.xsl
new file mode 100644
index 000000000..17623605c
--- /dev/null
+++ b/ccm-sci-publications/web/static/content-types/com/arsdigita/cms/contenttypes/PublicationList.xsl
@@ -0,0 +1,19 @@
+
+]>
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file