diff --git a/ccm-cms-assets-orgaunittext/application.xml b/ccm-cms-assets-orgaunittext/application.xml new file mode 100644 index 000000000..a30ad9754 --- /dev/null +++ b/ccm-cms-assets-orgaunittext/application.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + An asset for assigning additional texts to an GenericOrganizationalUnit (displayed as + additional tabs) + + \ No newline at end of file diff --git a/ccm-cms-assets-orgaunittext/pdl/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAsset.pdl b/ccm-cms-assets-orgaunittext/pdl/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAsset.pdl new file mode 100644 index 000000000..30584916c --- /dev/null +++ b/ccm-cms-assets-orgaunittext/pdl/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAsset.pdl @@ -0,0 +1,48 @@ +// +// 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.auditing.BasicAuditTrail; +import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit; +import com.arsdigita.kernel.ACSObject; + +object type GenericOrgaUnitTextAsset extends ACSObject { + String[1..1] textAssetName = ca_genericorgaunit_textasset.text_asset_name VARCHAR(100); + String[0..1] content = ca_genericorgaunit_textasset.content CLOB; + + reference key(ca_genericorgaunit_textasset.textasset_id); + + // Basic Auditing info + //unversioned BasicAuditTrail[0..1] auditing = + // qualias { filter(all(com.arsdigita.auditing.BasicAuditTrail), + // id == this.id) }; + //aggressive load(auditing.id, + // auditing.creationDate, + // auditing.creationIP, + // auditing.lastModifiedDate, + // auditing.lastModifiedIP); +} + +association { + composite GenericOrganizationalUnit[1..1] orgaunit = join ca_genericorgaunit_textasset.orgaunit_id + to cms_organizationalunits.organizationalunit_id; + + component GenericOrgaUnitTextAsset[0..n] textassets = join cms_organizationalunits.organizationalunit_id + to ca_genericorgaunit_textasset.orgaunit_id; +} diff --git a/ccm-cms-assets-orgaunittext/sql/ccm-cms-assets-orgaunittext/oracle-se-create.sql b/ccm-cms-assets-orgaunittext/sql/ccm-cms-assets-orgaunittext/oracle-se-create.sql new file mode 100644 index 000000000..8cb4d2774 --- /dev/null +++ b/ccm-cms-assets-orgaunittext/sql/ccm-cms-assets-orgaunittext/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-cms-assets-orgaunittext/sql/ccm-cms-assets-orgaunittext/postgres-create.sql b/ccm-cms-assets-orgaunittext/sql/ccm-cms-assets-orgaunittext/postgres-create.sql new file mode 100644 index 000000000..ffc15342b --- /dev/null +++ b/ccm-cms-assets-orgaunittext/sql/ccm-cms-assets-orgaunittext/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-cms-assets-orgaunittext/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAsset.xml b/ccm-cms-assets-orgaunittext/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAsset.xml new file mode 100644 index 000000000..417744605 --- /dev/null +++ b/ccm-cms-assets-orgaunittext/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAsset.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ccm-cms-assets-orgaunittext/src/ccm-cms-assets-orgaunittext.config b/ccm-cms-assets-orgaunittext/src/ccm-cms-assets-orgaunittext.config new file mode 100644 index 000000000..a2f369f42 --- /dev/null +++ b/ccm-cms-assets-orgaunittext/src/ccm-cms-assets-orgaunittext.config @@ -0,0 +1,5 @@ + + + + diff --git a/ccm-cms-assets-orgaunittext/src/ccm-cms-assets-orgaunittext.load b/ccm-cms-assets-orgaunittext/src/ccm-cms-assets-orgaunittext.load new file mode 100644 index 000000000..db81737b3 --- /dev/null +++ b/ccm-cms-assets-orgaunittext/src/ccm-cms-assets-orgaunittext.load @@ -0,0 +1,16 @@ + + + +
+
+ + + 0 +
+ + + + + + + diff --git a/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAsset.java b/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAsset.java new file mode 100644 index 000000000..5ffe56c18 --- /dev/null +++ b/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAsset.java @@ -0,0 +1,163 @@ +/* + * 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.auditing.AuditingObserver; +import com.arsdigita.auditing.BasicAuditTrail; +import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit; +import com.arsdigita.domain.DomainObject; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.domain.DomainObjectInstantiator; +import com.arsdigita.kernel.ACSObject; +import com.arsdigita.kernel.User; +import com.arsdigita.kernel.permissions.PermissionService; +import com.arsdigita.persistence.DataCollection; +import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.SessionManager; +import com.arsdigita.util.Assert; +import java.util.Date; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class GenericOrgaUnitTextAsset extends ACSObject { + + public static final String BASE_DATA_OBJECT_TYPE + = "com.arsdigita.cms.contentassets.GenericOrgaUnitTextAsset"; + +// static { +// DomainObjectFactory.registerInstantiator( +// BASE_DATA_OBJECT_TYPE, +// new DomainObjectInstantiator() { +// +// @Override +// public DomainObjectInstantiator resolveInstantiator(final DataObject dataObject) { +// return this; +// } +// +// @Override +// protected DomainObject doNewInstance(final DataObject dataObject) { +// return new GenericOrgaUnitTextAsset(dataObject); +// } +// +// }); +// } + + public static final String TEXT_ASSET_NAME = "textAssetName"; + public static final String CONTENT = "content"; + public static final String ORGAUNIT = "orgaunit"; + public static final String TEXT_ASSETS = "textAssets"; +// public static final String AUDIT = "auditing"; +// public static final String CREATION_DATE = AUDIT + "." + BasicAuditTrail.CREATION_DATE; +// private BasicAuditTrail auditTrail; +// private boolean isNew = false; + + private GenericOrgaUnitTextAsset() { + super(BASE_DATA_OBJECT_TYPE); + } + + public GenericOrgaUnitTextAsset(final DataObject dataObject) { + super(dataObject); + } + + public static GenericOrgaUnitTextAsset create(final GenericOrganizationalUnit orgaunit, + final String textAssetName) { + final GenericOrgaUnitTextAsset textAsset = new GenericOrgaUnitTextAsset(); + textAsset.set(ORGAUNIT, orgaunit); + textAsset.set(TEXT_ASSET_NAME, textAssetName); + + return textAsset; + } + +// @Override +// protected void initialize() { +// super.initialize(); + +// final DataObject dataObject = (DataObject) get(AUDIT); +// if (dataObject == null) { +// auditTrail = BasicAuditTrail.retrieveForACSObject(this); +// } else { +// auditTrail = new BasicAuditTrail(dataObject); +// } + +// addObserver(new AuditingObserver(auditTrail)); +// } + + public String getTextAssetName() { + return (String) get(TEXT_ASSET_NAME); + } + + public void setTextAssetName(final String textAssetName) { + set(TEXT_ASSET_NAME, textAssetName); + } + + public String getContent() { + return (String) get(CONTENT); + } + + public void setContent(final String content) { + set(CONTENT, content); + } + + public GenericOrganizationalUnit getOwner() { + final DataObject dataObject = (DataObject) get(ORGAUNIT); + Assert.exists(dataObject, DataObject.class); + + return (GenericOrganizationalUnit) DomainObjectFactory.newInstance(dataObject); + } + +// public User getTextAssetAuthor() { +// return auditTrail.getCreationUser(); +// } +// +// public Date getCreationDate() { +// return auditTrail.getCreationDate(); +// } + + public static DataCollection getTextAssets(final GenericOrganizationalUnit orgaunit) { + Assert.exists(orgaunit, GenericOrganizationalUnit.class); + + final DataCollection textAssets = SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE); + textAssets.addEqualsFilter(ORGAUNIT, orgaunit.getID()); + + return textAssets; + } + +// @Override +// protected void beforeSave() { +// super.beforeSave(); +// +// if (isNew()) { +// isNew = true; +// } +// } +// +// @Override +// protected void afterSave() { +// super.afterSave(); +// +// if (isNew) { +// PermissionService.setContext(this, getOwner()); +// isNew = false; +// } +// } + +} diff --git a/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAssetConfig.java b/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAssetConfig.java new file mode 100644 index 000000000..b0c731b2a --- /dev/null +++ b/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAssetConfig.java @@ -0,0 +1,61 @@ +/* + * 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.runtime.AbstractConfig; +import com.arsdigita.util.parameter.IntegerParameter; +import com.arsdigita.util.parameter.Parameter; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class GenericOrgaUnitTextAssetConfig extends AbstractConfig { + + private static GenericOrgaUnitTextAssetConfig INSTANCE; + + private final Parameter assetStepSortKey = new IntegerParameter( + "com.arsdigita.cms.contentassets.orgaunit_textasset.asset_step_sortkey", + Parameter.REQUIRED, + 5); + + public GenericOrgaUnitTextAssetConfig() { + + super(); + + register(assetStepSortKey); + + loadInfo(); + } + + public static final GenericOrgaUnitTextAssetConfig getInstance() { + if (INSTANCE == null) { + INSTANCE = new GenericOrgaUnitTextAssetConfig(); + INSTANCE.load(); + } + + return INSTANCE; + } + + public Integer getAssetStepSortKey() { + return (Integer) get(assetStepSortKey); + } + +} diff --git a/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAssetConfig_parameter.properties b/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAssetConfig_parameter.properties new file mode 100644 index 000000000..ac7c4f745 --- /dev/null +++ b/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAssetConfig_parameter.properties @@ -0,0 +1,4 @@ +com.arsdigita.cms.contentassets.orgaunit_textasset.asset_step_sortkey.title = Sort key for the generic organizational unit text asset step +com.arsdigita.cms.contentassets.orgaunit_textasset.asset_step_sortkey.purpose = Sort key for the generic organizational unit text asset step +com.arsdigita.cms.contentassets.orgaunit_textasset.asset_step_sortkey.example = 5 +com.arsdigita.cms.contentassets.orgaunit_textasset.asset_step_sortkey.format = [Integer] diff --git a/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAssetGlobalizationUtil.java b/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAssetGlobalizationUtil.java new file mode 100644 index 000000000..d758b250f --- /dev/null +++ b/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAssetGlobalizationUtil.java @@ -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 + * + */ +package com.arsdigita.cms.contentassets; + +import com.arsdigita.globalization.GlobalizedMessage; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class GenericOrgaUnitTextAssetGlobalizationUtil { + + public static final String BUNDLE_NAME + = "com.arsdigita.cms.contentassets.GenericOrgaUnitTextAssetResources"; + + 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-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAssetInitializer.java b/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAssetInitializer.java new file mode 100644 index 000000000..12c9353f2 --- /dev/null +++ b/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAssetInitializer.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.contentassets.ui.GenericOrgaUnitTextAssetStep; +import com.arsdigita.cms.contenttypes.ContentAssetInitializer; +import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit; +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 GenericOrgaUnitTextAssetInitializer extends ContentAssetInitializer { + + public GenericOrgaUnitTextAssetInitializer() { + super("ccm-cms-assets-orgaunittext.pdl.mf"); + } + + @Override + public void init(final DomainInitEvent event) { + super.init(event); + + DomainObjectTraversal.registerAdapter(GenericOrgaUnitTextAsset.BASE_DATA_OBJECT_TYPE, + new SimpleDomainObjectTraversalAdapter(), + SimpleXMLGenerator.ADAPTER_CONTEXT); + + } + + @Override + public String getBaseType() { + return GenericOrganizationalUnit.BASE_DATA_OBJECT_TYPE; + } + + @Override + public String getTraversalXML() { + return TRAVERSAL_ADAPTER_BASE_DIR + "GenericOrgaUnitTextAsset.xml"; + } + + @Override + public String getProperty() { + return GenericOrgaUnitTextAsset.TEXT_ASSETS; + } + + @Override + public Class getAuthoringStep() { + return GenericOrgaUnitTextAssetStep.class; + } + + @Override + public GlobalizedMessage getAuthoringStepLabel() { + return new GlobalizedMessage( + "com.arsdigita.cms.contentassets.orgaunit_textasset_step_label", + "com.arsdigita.cms.contentassets.GenericOrgaUnitTextAssetResources"); + + } + + @Override + public GlobalizedMessage getAuthoringStepDescription() { + return new GlobalizedMessage( + "com.arsdigita.cms.contentassets.orgaunit_textasset_step_description", + "com.arsdigita.cms.contentassets.GenericOrgaUnitTextAssetResources"); + } + + @Override + public int getAuthoringStepSortKey() { + return GenericOrgaUnitTextAssetConfig.getInstance().getAssetStepSortKey(); + } + +} diff --git a/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAssetLoader.java b/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAssetLoader.java new file mode 100644 index 000000000..ee41cc45a --- /dev/null +++ b/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAssetLoader.java @@ -0,0 +1,36 @@ +/* + * 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.runtime.ScriptContext; +import com.arsdigita.loader.PackageLoader; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class GenericOrgaUnitTextAssetLoader extends PackageLoader { + + public void run(final ScriptContext ctx) { + // Nothing + } + +} diff --git a/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAssetResources.properties b/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAssetResources.properties new file mode 100644 index 000000000..59b8f5279 --- /dev/null +++ b/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAssetResources.properties @@ -0,0 +1,14 @@ +# To change this license header, choose License Headers in Project Properties. +# To change this template file, choose Tools | Templates +# and open the template in the editor. + +com.arsdigita.cms.contentassets.orgaunit_textasset_step_label=Further texts +com.arsdigita.cms.contentassets.orgaunit_textasset_step_description=Add more texts here +cms.orgaunit.textassets.empty=No texts +cms.orgaunit.textasset.edit=Edit +cms.orgaunit.textasset.text_asset_name.label=Label +cms.orgaunit.textasset.content.label=Text +cms.orgaunit.textasset.name=Label +cms.orgaunit.textasset.add=Add text +cms.orgaunit.textasset.delete=Remove +cms.orgaunit.textasset.delete.confirm=Are you sure to delete this text? diff --git a/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAssetResources_de.properties b/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAssetResources_de.properties new file mode 100644 index 000000000..9031e7940 --- /dev/null +++ b/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/GenericOrgaUnitTextAssetResources_de.properties @@ -0,0 +1,14 @@ +# To change this license header, choose License Headers in Project Properties. +# To change this template file, choose Tools | Templates +# and open the template in the editor. + +com.arsdigita.cms.contentassets.orgaunit_textasset_step_label=Weitere Texte +com.arsdigita.cms.contentassets.orgaunit_textasset_step_description=Weitere Texte hier hinzuf\u00fcgen +cms.orgaunit.textassets.empty=Keine Texte +cms.orgaunit.textasset.edit=Bearbeiten +cms.orgaunit.textasset.text_asset_name.label=Bezeichnung +cms.orgaunit.textasset.content.label=Text +cms.orgaunit.textasset.name=Bezeichnung +cms.orgaunit.textasset.add=Text hinzuf\u00fcgen +cms.orgaunit.textasset.delete=L\u00f6schen +cms.orgaunit.textasset.delete.confirm=Sind Sie sicher, dass Sie diesen Text l\u00f6schen wollen? diff --git a/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/ui/GenericOrgaUnitTextAssetEdit.java b/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/ui/GenericOrgaUnitTextAssetEdit.java new file mode 100644 index 000000000..777f34d35 --- /dev/null +++ b/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/ui/GenericOrgaUnitTextAssetEdit.java @@ -0,0 +1,154 @@ +/* + * 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.event.FormSubmissionListener; +import com.arsdigita.bebop.event.PrintEvent; +import com.arsdigita.bebop.event.PrintListener; +import com.arsdigita.bebop.form.DHTMLEditor; +import com.arsdigita.bebop.form.Option; +import com.arsdigita.bebop.form.SingleSelect; +import com.arsdigita.bebop.parameters.NotEmptyValidationListener; +import com.arsdigita.bebop.parameters.StringParameter; +import com.arsdigita.cms.ContentSection; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.RelationAttribute; +import com.arsdigita.cms.RelationAttributeCollection; +import com.arsdigita.cms.contentassets.GenericOrgaUnitTextAsset; +import com.arsdigita.cms.contentassets.GenericOrgaUnitTextAssetGlobalizationUtil; +import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit; +import com.arsdigita.cms.ui.authoring.BasicItemForm; +import com.arsdigita.kernel.ui.ACSObjectSelectionModel; +import com.arsdigita.util.UncheckedWrapperException; +import java.util.TooManyListenersException; +import com.arsdigita.globalization.GlobalizationHelper; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class GenericOrgaUnitTextAssetEdit extends BasicItemForm implements FormSubmissionListener { + + private final static String TEXT_ASSET_NAME = "textAssetName"; + private final static String CONTENT = "content"; + private final ItemSelectionModel itemModel; + private final ACSObjectSelectionModel selectionModel; + + public GenericOrgaUnitTextAssetEdit(final ItemSelectionModel itemModel, + final ACSObjectSelectionModel selectionModel) { + super("GenericOrgaUnitTextAssetEditForm", itemModel); + + this.itemModel = itemModel; + this.selectionModel = selectionModel; + addSubmissionListener(this); + } + + @Override + public void addWidgets() { + add(new Label(GenericOrgaUnitTextAssetGlobalizationUtil.globalize( + "cms.orgaunit.textasset.text_asset_name.label"))); + final SingleSelect nameSelect = new SingleSelect(TEXT_ASSET_NAME); + nameSelect.addOption(new Option("", "")); + try { + nameSelect.addPrintListener(new PrintListener() { + + @Override + public void prepare(final PrintEvent event) { + final SingleSelect target = (SingleSelect) event.getTarget(); + + final RelationAttributeCollection names = new RelationAttributeCollection( + "GenericOrgaUnitTextAssetName"); + names.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().getLanguage()); + while (names.next()) { + target.addOption(new Option(names.getKey(), names.getName())); + } + } + + }); + } catch (TooManyListenersException ex) { + throw new UncheckedWrapperException(ex); + } + + nameSelect.addValidationListener(new NotEmptyValidationListener()); + add(nameSelect); + + add(new Label(GenericOrgaUnitTextAssetGlobalizationUtil.globalize( + "cms.orgaunit.textasset.content.label"))); + final DHTMLEditor contentEditor = new DHTMLEditor( + new StringParameter(CONTENT), ContentSection.getConfig().getDHTMLEditorConfig()); + contentEditor.setRows(40); + add(contentEditor); + + } + + @Override + public void init(final FormSectionEvent event) throws FormProcessException { + final PageState state = event.getPageState(); + + if (selectionModel.getSelectedObject(state) != null) { + final GenericOrgaUnitTextAsset textAsset = (GenericOrgaUnitTextAsset) selectionModel. + getSelectedObject(state); + final FormData data = event.getFormData(); + + data.put(TEXT_ASSET_NAME, textAsset.getTextAssetName()); + data.put(CONTENT, textAsset.getContent()); + } + + setVisible(state, true); + } + + @Override + public void process(final FormSectionEvent event) throws FormProcessException { + final FormData data = event.getFormData(); + final PageState state = event.getPageState(); + + final GenericOrgaUnitTextAsset textAsset; + if (selectionModel.getSelectedObject(state) == null) { + final GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) itemModel. + getSelectedObject(state); + + textAsset = GenericOrgaUnitTextAsset.create(orgaunit, data.getString(TEXT_ASSET_NAME)); + } else { + textAsset = (GenericOrgaUnitTextAsset) selectionModel.getSelectedObject(state); + + selectionModel.clearSelection(state); + + textAsset.setTextAssetName(data.getString(TEXT_ASSET_NAME)); + } + + textAsset.setContent(data.getString(CONTENT)); + + textAsset.save(); + } + + @Override + public void submitted(final FormSectionEvent event) throws FormProcessException { + final PageState state = event.getPageState(); + if (getSaveCancelSection().getCancelButton().isSelected(state)) { + selectionModel.clearSelection(state); + } + } + +} diff --git a/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/ui/GenericOrgaUnitTextAssetStep.java b/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/ui/GenericOrgaUnitTextAssetStep.java new file mode 100644 index 000000000..2de5a4f93 --- /dev/null +++ b/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/ui/GenericOrgaUnitTextAssetStep.java @@ -0,0 +1,82 @@ +/* + * 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.contentassets.GenericOrgaUnitTextAssetGlobalizationUtil; +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 GenericOrgaUnitTextAssetStep extends SimpleEditStep { + + private ItemSelectionModel itemModel; + private ACSObjectSelectionModel selectionModel; + private BigDecimalParameter textAssetParam; + + private static final String EDIT = "edit"; + + public GenericOrgaUnitTextAssetStep(final ItemSelectionModel itemModel, + final AuthoringKitWizard parent) { + this(itemModel, parent, null); + } + + public GenericOrgaUnitTextAssetStep(final ItemSelectionModel itemModel, + final AuthoringKitWizard parent, + final String prefix) { + super(itemModel, parent, prefix); + + this.itemModel = itemModel; + + textAssetParam = new BigDecimalParameter("textAsset"); + selectionModel = new ACSObjectSelectionModel(textAssetParam); + + final GenericOrgaUnitTextAssetTable table = new GenericOrgaUnitTextAssetTable( + this, selectionModel, itemModel); + setDisplayComponent(table); + + final GenericOrgaUnitTextAssetEdit edit = new GenericOrgaUnitTextAssetEdit(itemModel, + selectionModel); + add(EDIT, + GenericOrgaUnitTextAssetGlobalizationUtil.globalize("cms.orgaunit.textasset.add"), + new WorkflowLockedComponentAccess(edit, itemModel), + edit.getSaveCancelSection().getCancelButton()); + } + + @Override + public void register(final Page page) { + super.register(page); + + page.addComponentStateParam(this, textAssetParam); + } + + protected void setEditVisible(final PageState state) { + showComponent(state, EDIT); + } + +} diff --git a/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/ui/GenericOrgaUnitTextAssetTable.java b/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/ui/GenericOrgaUnitTextAssetTable.java new file mode 100644 index 000000000..7dc93f8f9 --- /dev/null +++ b/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/ui/GenericOrgaUnitTextAssetTable.java @@ -0,0 +1,282 @@ +/* + * 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.ItemSelectionModel; +import com.arsdigita.cms.RelationAttribute; +import com.arsdigita.cms.RelationAttributeCollection; +import com.arsdigita.cms.contentassets.GenericOrgaUnitTextAsset; +import com.arsdigita.cms.contentassets.GenericOrgaUnitTextAssetGlobalizationUtil; +import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit; +import com.arsdigita.globalization.GlobalizationHelper; +import com.arsdigita.kernel.ui.ACSObjectSelectionModel; +import com.arsdigita.persistence.DataCollection; +import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.OID; +import com.arsdigita.persistence.SessionManager; +import com.arsdigita.util.LockableImpl; +import java.math.BigDecimal; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class GenericOrgaUnitTextAssetTable extends Table { + + private final static String TABLE_COL_EDIT = "table_col_edit"; + private final static String TABLE_COL_DEL = "table_col_del"; + private final GenericOrgaUnitTextAssetStep parent; + private final ItemSelectionModel itemModel; + private final ACSObjectSelectionModel selectionModel; + + public GenericOrgaUnitTextAssetTable(final GenericOrgaUnitTextAssetStep parent, + final ACSObjectSelectionModel selectionModel, + final ItemSelectionModel itemModel) { + + super(); + this.parent = parent; + this.itemModel = itemModel; + this.selectionModel = selectionModel; + + setEmptyView(new Label(GenericOrgaUnitTextAssetGlobalizationUtil.globalize( + "cms.orgaunit.textassets.empty"))); + + final TableColumnModel colModel = getColumnModel(); + colModel.add(new TableColumn( + 0, + new Label(GenericOrgaUnitTextAssetGlobalizationUtil.globalize( + "cms.orgaunit.textasset.name")))); + colModel.add(new TableColumn( + 1, + new Label(GenericOrgaUnitTextAssetGlobalizationUtil.globalize( + "cms.orgaunit.textasset.edit")), + TABLE_COL_EDIT)); + colModel.add(new TableColumn( + 2, + new Label(GenericOrgaUnitTextAssetGlobalizationUtil.globalize( + "cms.orgaunit.textasset.delete")), + TABLE_COL_DEL)); + + setModelBuilder(new ModelBuilder(itemModel)); + + colModel.get(1).setCellRenderer(new EditCellRenderer()); + colModel.get(2).setCellRenderer(new DeleteCellRenderer()); + + addTableActionListener(new ActionListener()); + + } + + private class ModelBuilder extends LockableImpl implements TableModelBuilder { + + private final ItemSelectionModel itemModel; + + public ModelBuilder(final ItemSelectionModel itemModel) { + super(); + this.itemModel = itemModel; + } + + @Override + public TableModel makeModel(final Table table, final PageState state) { + table.getRowSelectionModel().clearSelection(state); + final GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) itemModel. + getSelectedObject(state); + return new AssetsTableModel(table, state, orgaunit); + } + + } + + private class AssetsTableModel implements TableModel { + + private final Table table; + private final DataCollection textAssets; + private GenericOrgaUnitTextAsset textAsset; + + public AssetsTableModel(final Table table, + final PageState state, + final GenericOrganizationalUnit orgaunit) { + this.table = table; + + textAssets = GenericOrgaUnitTextAsset.getTextAssets(orgaunit); + } + + @Override + public int getColumnCount() { + return table.getColumnModel().size(); + } + + @Override + public boolean nextRow() { + boolean ret; + + if ((textAssets != null) && textAssets.next()) { + textAsset = new GenericOrgaUnitTextAsset(textAssets.getDataObject()); + ret = true; + } else { + ret = false; + } + + return ret; + } + + @Override + public Object getElementAt(final int columnIndex) { + switch (columnIndex) { + case 0: + final RelationAttributeCollection names = new RelationAttributeCollection( + "GenericOrgaUnitTextAssetName"); + names.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().getLanguage()); + names.addKeyFilter(textAsset.getTextAssetName()); + final String label; + if (names.next()) { + label = names.getName(); + names.close(); + } else { + label = textAsset.getTextAssetName(); + } + return label; + case 1: + return new Label(GenericOrgaUnitTextAssetGlobalizationUtil.globalize( + "cms.orgaunit.textasset.edit")); + case 2: + return new Label(GenericOrgaUnitTextAssetGlobalizationUtil.globalize( + "cms.orgaunit.textasset.delete")); + default: + return null; + } + } + + @Override + public Object getKeyAt(final int columnIndex) { + return textAsset.getID(); + } + + } + + private class EditCellRenderer extends LockableImpl implements TableCellRenderer { + + public EditCellRenderer() { + super(); + } + + @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 GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) itemModel. + getSelectedObject(state); + + final boolean canEdit = securityManager.canAccess( + state.getRequest(), com.arsdigita.cms.SecurityManager.EDIT_ITEM, orgaunit); + + if (canEdit) { + return new ControlLink((Label) value); + } else { + return (Label) value; + } + } + + } + + private class DeleteCellRenderer extends LockableImpl implements TableCellRenderer { + + public DeleteCellRenderer() { + super(); + } + + @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 GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) itemModel. + getSelectedObject(state); + + final boolean canEdit = securityManager.canAccess( + state.getRequest(), com.arsdigita.cms.SecurityManager.EDIT_ITEM, orgaunit); + + if (canEdit) { + final ControlLink link = new ControlLink((Label) value); + link.setConfirmation(GenericOrgaUnitTextAssetGlobalizationUtil.globalize( + "cms.orgaunit.textasset.delete.confirm")); + return link; + } else { + return (Label) value; + } + } + + } + + private class ActionListener implements TableActionListener { + + public ActionListener() { + //Nothing + } + + @Override + public void cellSelected(final TableActionEvent event) { + final PageState state = event.getPageState(); + + final DataObject dataObject = SessionManager.getSession().retrieve(new OID( + GenericOrgaUnitTextAsset.BASE_DATA_OBJECT_TYPE, + new BigDecimal(event.getRowKey().toString()))); + final GenericOrgaUnitTextAsset textAsset = new GenericOrgaUnitTextAsset(dataObject); + + final GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) itemModel. + getSelectedObject(state); + + final TableColumn col = getColumnModel().get(event.getColumn().intValue()); + + if (TABLE_COL_EDIT.equals(col.getHeaderKey().toString())) { + selectionModel.setSelectedObject(state, textAsset); + parent.setEditVisible(state); + } else if (TABLE_COL_DEL.equals(col.getHeaderKey().toString())) { + textAsset.delete(); + } + } + + @Override + public void headSelected(final TableActionEvent event) { + //Nothing + } + + } +} diff --git a/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/ui/GenericOrgaUnitTextTab.java b/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/ui/GenericOrgaUnitTextTab.java new file mode 100644 index 000000000..8c9c05151 --- /dev/null +++ b/ccm-cms-assets-orgaunittext/src/com/arsdigita/cms/contentassets/ui/GenericOrgaUnitTextTab.java @@ -0,0 +1,79 @@ +/* + * 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.PageState; +import com.arsdigita.cms.contentassets.GenericOrgaUnitTextAsset; +import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit; +import com.arsdigita.cms.contenttypes.ui.GenericOrgaUnitTab; +import com.arsdigita.persistence.DataCollection; +import com.arsdigita.xml.Element; + +/** + * A tab for {@link GenericOrgaunizationalUnit}s which displays additional texts. Can be used more + * than once in the configuration for the tabs, which different keys. The key is used to find the + * correct text to display. + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class GenericOrgaUnitTextTab implements GenericOrgaUnitTab { + + private String key; + + @Override + public String getKey() { + return key; + } + + @Override + public void setKey(final String key) { + this.key = key; + } + + @Override + public boolean hasData(final GenericOrganizationalUnit orgaunit, + final PageState state) { + final DataCollection texts = GenericOrgaUnitTextAsset.getTextAssets(orgaunit); + texts.addEqualsFilter(GenericOrgaUnitTextAsset.TEXT_ASSET_NAME, key); + final boolean empty = texts.isEmpty(); + texts.close(); + return !empty; + } + + @Override + public void generateXml(GenericOrganizationalUnit orgaunit, + Element parent, + PageState state) { + final DataCollection texts = GenericOrgaUnitTextAsset.getTextAssets(orgaunit); + texts.addEqualsFilter(GenericOrgaUnitTextAsset.TEXT_ASSET_NAME, key); + if (texts.isEmpty()) { + parent.newChildElement("noText"); + } else { + texts.next(); + final GenericOrgaUnitTextAsset text = new GenericOrgaUnitTextAsset(texts.getDataObject()); + final Element textElem = parent.newChildElement("text"); + textElem.addAttribute("key", key); + textElem.setText(text.getContent()); + } + + texts.close(); + } + +} diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrgaUnitContactsTab.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrgaUnitContactsTab.java index 2923718b2..5d63a1661 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrgaUnitContactsTab.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrgaUnitContactsTab.java @@ -15,6 +15,18 @@ import com.arsdigita.xml.Element; */ public class GenericOrgaUnitContactsTab implements GenericOrgaUnitTab { + private String key; + + @Override + public String getKey() { + return key; + } + + @Override + public void setKey(final String key) { + this.key = key; + } + @Override public boolean hasData(final GenericOrganizationalUnit orgaunit, final PageState state) { diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrgaUnitExtraXmlGenerator.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrgaUnitExtraXmlGenerator.java index 8f3ba11bd..115866fc9 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrgaUnitExtraXmlGenerator.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrgaUnitExtraXmlGenerator.java @@ -179,6 +179,7 @@ public abstract class GenericOrgaUnitExtraXmlGenerator final String tabName = tokens[0]; final String tabClassName = tokens[1]; final GenericOrgaUnitTab tab = createTabInstance(tabClassName); + tab.setKey(tabName); tabs.put(tabName, tab); } diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrgaUnitMembersTab.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrgaUnitMembersTab.java index 733ff0349..27850361b 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrgaUnitMembersTab.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrgaUnitMembersTab.java @@ -23,7 +23,18 @@ public abstract class GenericOrgaUnitMembersTab implements GenericOrgaUnitTab { private final static Logger logger = Logger.getLogger(GenericOrgaUnitMembersTab.class); - + private String key; + + @Override + public String getKey() { + return key; + } + + @Override + public void setKey(final String key) { + this.key = key; + } + @Override public boolean hasData(final GenericOrganizationalUnit orgaunit, final PageState state) { @@ -39,6 +50,7 @@ public abstract class GenericOrgaUnitMembersTab implements GenericOrgaUnitTab { return !orgaunit.getPersons().isEmpty(); } + @Override public void generateXml(final GenericOrganizationalUnit orgaunit, final Element parent, final PageState state) { diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrgaUnitSubordinateTab.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrgaUnitSubordinateTab.java index 98a5470b2..fcb0b4307 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrgaUnitSubordinateTab.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrgaUnitSubordinateTab.java @@ -16,9 +16,19 @@ import org.apache.log4j.Logger; public abstract class GenericOrgaUnitSubordinateTab implements GenericOrgaUnitTab { - private final static Logger logger = - Logger.getLogger( + private final static Logger logger = Logger.getLogger( GenericOrgaUnitSubordinateTab.class); + private String key; + + @Override + public String getKey() { + return key; + } + + @Override + public void setKey(final String key) { + this.key = key; + } @Override public boolean hasData(final GenericOrganizationalUnit orgaunit, @@ -31,18 +41,16 @@ public abstract class GenericOrgaUnitSubordinateTab final Element parent, final PageState state) { final long start = System.currentTimeMillis(); - final GenericOrganizationalUnitSubordinateCollection subOrgaUnits = - getData(orgaunit, - state); + final GenericOrganizationalUnitSubordinateCollection subOrgaUnits = getData(orgaunit, + state); processFilters(subOrgaUnits, state); - final Element subOrgaUnitsElem = - parent.newChildElement(getXmlElementName()); + final Element subOrgaUnitsElem = parent.newChildElement(getXmlElementName()); if (getPageSize() != 0) { - final GenericOrgaUnitPaginator paginator = - new GenericOrgaUnitPaginator( + final GenericOrgaUnitPaginator paginator + = new GenericOrgaUnitPaginator( subOrgaUnits, state, getPageSize()); paginator.setRange(subOrgaUnits); paginator.generateXml(subOrgaUnitsElem); @@ -78,8 +86,8 @@ public abstract class GenericOrgaUnitSubordinateTab protected GenericOrganizationalUnitSubordinateCollection getData( final GenericOrganizationalUnit orgaunit) { - final GenericOrganizationalUnitSubordinateCollection subOrgaUnits = - orgaunit.getSubordinateOrgaUnits(); + final GenericOrganizationalUnitSubordinateCollection subOrgaUnits = orgaunit. + getSubordinateOrgaUnits(); subOrgaUnits.addFilter( String.format("%s = '%s'", GenericOrganizationalUnitSubordinateCollection.LINK_ASSOCTYPE, diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrgaUnitTab.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrgaUnitTab.java index 5c0c1759e..bfde050e9 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrgaUnitTab.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrgaUnitTab.java @@ -11,7 +11,20 @@ import com.arsdigita.xml.Element; * @version $Id$ */ public interface GenericOrgaUnitTab { - + + /** + * + * @returns The key identifing this tab. + */ + String getKey(); + + /** + * Sets the key which identifies the tab. + * + *@param key + */ + void setKey(String key); + /** * * @param orgaunit diff --git a/ccm-sci-assets-publicationslibrarysignatures/src/com/arsdigita/cms/contentassets/ui/LibrarySignaturesAddForm.java b/ccm-sci-assets-publicationslibrarysignatures/src/com/arsdigita/cms/contentassets/ui/LibrarySignaturesAddForm.java index 24a7a6a1c..756b640d5 100644 --- a/ccm-sci-assets-publicationslibrarysignatures/src/com/arsdigita/cms/contentassets/ui/LibrarySignaturesAddForm.java +++ b/ccm-sci-assets-publicationslibrarysignatures/src/com/arsdigita/cms/contentassets/ui/LibrarySignaturesAddForm.java @@ -46,7 +46,8 @@ public class LibrarySignaturesAddForm extends BasicItemForm { private final ItemSelectionModel itemModel; private final ACSObjectSelectionModel signatureModel; - public LibrarySignaturesAddForm(final ItemSelectionModel itemModel, final ACSObjectSelectionModel signatureModel) { + public LibrarySignaturesAddForm(final ItemSelectionModel itemModel, + final ACSObjectSelectionModel signatureModel) { super("LibrarySignaturesAddForm", itemModel); this.itemModel = itemModel; @@ -55,26 +56,34 @@ public class LibrarySignaturesAddForm extends BasicItemForm { @Override public void addWidgets() { - add(new Label(LibrarySignaturesGlobalizationUtil.globalize("scipublications.librarysignatures.form.library"))); + add(new Label(LibrarySignaturesGlobalizationUtil.globalize( + "scipublications.librarysignatures.form.library"))); final TextField library = new TextField(LIBRARY); - library.addValidationListener(new NotNullValidationListener(LibrarySignaturesGlobalizationUtil.globalize( - "scipublications.librarysignatures.form.library.not_null"))); - library.addValidationListener(new NotEmptyValidationListener(LibrarySignaturesGlobalizationUtil.globalize( - "scipublications.librarysignatures.form.library.not_empty"))); + library.addValidationListener(new NotNullValidationListener( + LibrarySignaturesGlobalizationUtil.globalize( + "scipublications.librarysignatures.form.library.not_null"))); + library.addValidationListener(new NotEmptyValidationListener( + LibrarySignaturesGlobalizationUtil.globalize( + "scipublications.librarysignatures.form.library.not_empty"))); add(library); - add(new Label(LibrarySignaturesGlobalizationUtil.globalize("scipublications.librarysignatures.form.signature"))); + add(new Label(LibrarySignaturesGlobalizationUtil.globalize( + "scipublications.librarysignatures.form.signature"))); final TextField signature = new TextField(SIGNATURE); - signature.addValidationListener(new NotNullValidationListener(LibrarySignaturesGlobalizationUtil.globalize( - "scipublications.librarysignatures.form.signature.not_null"))); - library.addValidationListener(new NotEmptyValidationListener(LibrarySignaturesGlobalizationUtil.globalize( - "scipublications.librarysignatures.form.signature.not_empty"))); + signature.addValidationListener(new NotNullValidationListener( + LibrarySignaturesGlobalizationUtil.globalize( + "scipublications.librarysignatures.form.signature.not_null"))); + library.addValidationListener(new NotEmptyValidationListener( + LibrarySignaturesGlobalizationUtil.globalize( + "scipublications.librarysignatures.form.signature.not_empty"))); add(signature); - add(new Label(LibrarySignaturesGlobalizationUtil.globalize("scipublications.librarysignatures.form.link"))); + add(new Label(LibrarySignaturesGlobalizationUtil.globalize( + "scipublications.librarysignatures.form.link"))); add(new TextField(LINK)); - - add(new Label(LibrarySignaturesGlobalizationUtil.globalize("scipublications.librarysignatures.form.misc"))); + + add(new Label(LibrarySignaturesGlobalizationUtil.globalize( + "scipublications.librarysignatures.form.misc"))); add(new TextField(MISC)); } @@ -83,7 +92,8 @@ public class LibrarySignaturesAddForm extends BasicItemForm { final PageState state = event.getPageState(); if (signatureModel.getSelectedObject(state) != null) { - final LibrarySignature signature = (LibrarySignature) signatureModel.getSelectedObject(state); + final LibrarySignature signature = (LibrarySignature) signatureModel.getSelectedObject( + state); final FormData data = event.getFormData(); data.put(LIBRARY, signature.getLibrary()); diff --git a/ccm-sci-assets-publicationslibrarysignatures/src/com/arsdigita/cms/contentassets/ui/LibrarySignaturesStep.java b/ccm-sci-assets-publicationslibrarysignatures/src/com/arsdigita/cms/contentassets/ui/LibrarySignaturesStep.java index 057234276..03d1b0f4c 100644 --- a/ccm-sci-assets-publicationslibrarysignatures/src/com/arsdigita/cms/contentassets/ui/LibrarySignaturesStep.java +++ b/ccm-sci-assets-publicationslibrarysignatures/src/com/arsdigita/cms/contentassets/ui/LibrarySignaturesStep.java @@ -33,49 +33,50 @@ import com.arsdigita.kernel.ui.ACSObjectSelectionModel; * @version $Id$ */ public class LibrarySignaturesStep extends SimpleEditStep { - - protected static final String EDIT = "edit"; + + protected static final String EDIT = "edit"; protected static final String SIGNATURE_PARAM = "library_signature"; - + private static final String FORM_KEY = "LibrarySignaturesAdd"; - + private final BigDecimalParameter signatureParam; final LibrarySignaturesAddForm addForm; - + public LibrarySignaturesStep(final ItemSelectionModel itemModel, final AuthoringKitWizard parent) { this(itemModel, parent, null); } - - public LibrarySignaturesStep(final ItemSelectionModel itemModel, - final AuthoringKitWizard parent, - final String prefix ) { - - super(itemModel, parent, prefix); - + + public LibrarySignaturesStep(final ItemSelectionModel itemModel, + final AuthoringKitWizard parent, + final String prefix) { + + super(itemModel, parent, prefix); + signatureParam = new BigDecimalParameter(SIGNATURE_PARAM); final ACSObjectSelectionModel signatureModel = new ACSObjectSelectionModel(signatureParam); - + addForm = new LibrarySignaturesAddForm(itemModel, signatureModel); - add(FORM_KEY, + add(FORM_KEY, LibrarySignaturesGlobalizationUtil.globalize("scipublications.librarysignatures.add"), new WorkflowLockedComponentAccess(addForm, itemModel), addForm.getSaveCancelSection().getCancelButton()); - - final LibrarySignaturesTable table = new LibrarySignaturesTable(itemModel, signatureModel, this); - setDisplayComponent(table); + + final LibrarySignaturesTable table = new LibrarySignaturesTable(itemModel, signatureModel, + this); + setDisplayComponent(table); } - + @Override public void register(final Page page) { super.register(page); - + page.addComponentStateParam(this, signatureParam); } - + protected void setAddVisible(final PageState state) { showComponent(state, FORM_KEY); - + //addForm.setVisible(state, true); } - + } diff --git a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/SciDepartmentConfig_parameter.properties b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/SciDepartmentConfig_parameter.properties index 58b9801f2..4520980c7 100644 --- a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/SciDepartmentConfig_parameter.properties +++ b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/SciDepartmentConfig_parameter.properties @@ -55,5 +55,5 @@ com.arsdigita.cms.contenttypes.sciproject.permitted_person_type.format = [String com.arsdigita.cms.contenttypes.sciproject.tabs.title = Tabs for SciDepartment detail view com.arsdigita.cms.contenttypes.sciproject.tabs.purpose = Defines which tabs are shown in the detail view of a SciDepartment -com.arsdigita.cms.contenttypes.sciproject.tabs.example = summary:coma.arsdigita.cms.contenttypes.ui.SciDepartmentSummaryTab;members:SciDepartmentMembersTab +com.arsdigita.cms.contenttypes.sciproject.tabs.example = summary:com.arsdigita.cms.contenttypes.ui.SciDepartmentSummaryTab;members:com.arsdigita.cms.contenttypes.ui.SciDepartmentMembersTab com.arsdigita.cms.contenttypes.sciproject.tabs.format = [String] diff --git a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentDescTab.java b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentDescTab.java index e3c5ed6e2..cec9d063c 100644 --- a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentDescTab.java +++ b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentDescTab.java @@ -14,6 +14,17 @@ import org.apache.log4j.Logger; public class SciDepartmentDescTab implements GenericOrgaUnitTab { public final Logger logger = Logger.getLogger(SciDepartmentDescTab.class); + private String key; + + @Override + public String getKey() { + return key; + } + + @Override + public void setKey(final String key) { + this.key = key; + } @Override public boolean hasData(final GenericOrganizationalUnit orgaunit, diff --git a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMembersTab.java b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMembersTab.java index 2d9854f8f..71833f377 100644 --- a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMembersTab.java +++ b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMembersTab.java @@ -32,10 +32,8 @@ import org.apache.log4j.Logger; */ public class SciDepartmentMembersTab implements GenericOrgaUnitTab { - private final Logger logger = - Logger.getLogger(SciDepartmentMembersTab.class); - private static final SciDepartmentMembersTabConfig config = - new SciDepartmentMembersTabConfig(); + private final Logger logger = Logger.getLogger(SciDepartmentMembersTab.class); + private static final SciDepartmentMembersTabConfig config = new SciDepartmentMembersTabConfig(); private static final String STATUS_PARAM = "memberStatus"; private static final String SURNAME_PARAM = "memberSurname"; private final CompareFilter statusFilter = new CompareFilter( @@ -44,9 +42,9 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab { false, false, false); - private final TextFilter surnameFilter = - new TextFilter(SURNAME_PARAM, - GenericPerson.SURNAME); + private final TextFilter surnameFilter = new TextFilter(SURNAME_PARAM, + GenericPerson.SURNAME); + private String key; static { config.load(); @@ -61,6 +59,16 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab { } } + @Override + public String getKey() { + return key; + } + + @Override + public void setKey(final String key) { + this.key = key; + } + @Override public boolean hasData(final GenericOrganizationalUnit orgaunit, final PageState state) { @@ -135,7 +143,7 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab { paginator.generateXml(depMembersElem); while (persons.next()) { - final GenericPerson person = new GenericPerson(persons.getDataObject()); + final GenericPerson person = new GenericPerson(persons.getDataObject()); generateMemberXml(person, membersRoles.get(person.getContentBundle().getID().toString()), membersStatus.get(person.getContentBundle().getID().toString()), @@ -155,35 +163,37 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab { statusValueElem.addAttribute("key", key); statusValueElem.setText(value); } - + protected class MembersData { + private final DataCollection members; private final Map membersRoles; private final Map membersStatus; - + public MembersData(final DataCollection members, - final Map membersRoles, - final Map membersStatus) { + final Map membersRoles, + final Map membersStatus) { this.members = members; this.membersRoles = membersRoles; this.membersStatus = membersStatus; } - + public DataCollection getMembers() { return members; } - + public Map getMembersRoles() { return Collections.unmodifiableMap(membersRoles); } - + public Map getMembersStatus() { return Collections.unmodifiableMap(membersStatus); } + } protected MembersData getData(final GenericOrganizationalUnit orgaunit, - final PageState state) { + final PageState state) { if (!(orgaunit instanceof SciDepartment)) { throw new IllegalArgumentException(String.format( "This tab can only process instances of " @@ -194,12 +204,11 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab { final DataQuery personBundlesQuery = SessionManager.getSession(). retrieveQuery( - "com.arsdigita.cms.contenttypes.getIdsOfMembersOfOrgaUnits"); + "com.arsdigita.cms.contenttypes.getIdsOfMembersOfOrgaUnits"); final List orgaUnitIds = new ArrayList(); if (config.isMergingMembers()) { - final DataQuery subDepartmentsQuery = - SessionManager.getSession().retrieveQuery( + final DataQuery subDepartmentsQuery = SessionManager.getSession().retrieveQuery( "com.arsdigita.cms.contenttypes.getIdsOfSubordinateOrgaUnitsRecursivlyWithAssocType"); subDepartmentsQuery.setParameter("orgaunitId", orgaunit.getContentBundle().getID().toString()); @@ -218,7 +227,7 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab { final Map membersRoles = new HashMap(); final Map membersStatus = new HashMap(); - + final StringBuilder filterBuilder = new StringBuilder(); while (personBundlesQuery.next()) { if (filterBuilder.length() > 0) { @@ -241,7 +250,7 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab { membersQuery.addOrder(GenericPerson.SURNAME); membersQuery.addOrder(GenericPerson.GIVENNAME); - + //return membersQuery; return new MembersData(membersQuery, membersRoles, membersStatus); } @@ -285,7 +294,6 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab { // System.currentTimeMillis() - start)); // generateMemberXml(member, parent, state); // } - protected void generateMemberXml(final GenericPerson member, final String role, final String status, diff --git a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentProjectsTab.java b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentProjectsTab.java index 462031f91..2b023a0e5 100644 --- a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentProjectsTab.java +++ b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentProjectsTab.java @@ -39,8 +39,8 @@ public class SciDepartmentProjectsTab implements GenericOrgaUnitTab { private final Logger logger = Logger.getLogger( SciDepartmentProjectsTab.class); - private static final SciDepartmentProjectsTabConfig config = - new SciDepartmentProjectsTabConfig(); + private static final SciDepartmentProjectsTabConfig config + = new SciDepartmentProjectsTabConfig(); private static final String STATUS_PARAM = "projectStatus"; private static final String TITLE_PARAM = "projectTitle"; private final CompareFilter statusFilter = new CompareFilter(STATUS_PARAM, @@ -51,6 +51,7 @@ public class SciDepartmentProjectsTab implements GenericOrgaUnitTab { true); private final TextFilter titleFilter = new TextFilter(TITLE_PARAM, ContentPage.TITLE); + private String key; static { config.load(); @@ -73,6 +74,16 @@ public class SciDepartmentProjectsTab implements GenericOrgaUnitTab { false); } + @Override + public String getKey() { + return key; + } + + @Override + public void setKey(final String key) { + this.key = key; + } + @Override public boolean hasData(final GenericOrganizationalUnit orgaunit, final PageState state) { @@ -90,7 +101,7 @@ public class SciDepartmentProjectsTab implements GenericOrgaUnitTab { //Check if we have projects to show final DataCollection data = getData(orgaunit); - final boolean result = (data != null) && !data.isEmpty(); + final boolean result = (data != null) && !data.isEmpty(); logger.debug(String.format("Needed %d ms to determine if department " + "'%s' has projects.", @@ -147,7 +158,7 @@ public class SciDepartmentProjectsTab implements GenericOrgaUnitTab { titleFilter.generateXml(filtersElem); - } else { + } else { applyStatusFilter(projects, request); applyTitleFilter(projects, request); @@ -191,7 +202,7 @@ public class SciDepartmentProjectsTab implements GenericOrgaUnitTab { protected DataCollection getData(final GenericOrganizationalUnit orgaunit) { final long start = System.currentTimeMillis(); - + if (!(orgaunit instanceof SciDepartment)) { throw new IllegalArgumentException(String.format( "This tab can only process instances of " @@ -202,12 +213,11 @@ public class SciDepartmentProjectsTab implements GenericOrgaUnitTab { final DataQuery projectBundlesQuery = SessionManager.getSession(). retrieveQuery( - "com.arsdigita.cms.contenttypes.getIdsOfProjectsOfOrgaUnit"); + "com.arsdigita.cms.contenttypes.getIdsOfProjectsOfOrgaUnit"); final List orgaunitIds = new ArrayList(); if (config.isMergingProjects()) { - final DataQuery subDepartmentsQuery = - SessionManager.getSession().retrieveQuery( + final DataQuery subDepartmentsQuery = SessionManager.getSession().retrieveQuery( "com.arsdigita.cms.contenttypes.getIdsOfSubordinateOrgaUnitsRecursivlyWithAssocType"); subDepartmentsQuery.setParameter("orgaunitId", orgaunit.getContentBundle().getID().toString()); @@ -221,7 +231,7 @@ public class SciDepartmentProjectsTab implements GenericOrgaUnitTab { orgaunitIds.add(orgaunit.getContentBundle().getID().toString()); } projectBundlesQuery.setParameter("orgaunitIds", orgaunitIds); - + final StringBuilder filterBuilder = new StringBuilder(); while (projectBundlesQuery.next()) { if (filterBuilder.length() > 0) { @@ -235,21 +245,27 @@ public class SciDepartmentProjectsTab implements GenericOrgaUnitTab { if (filterBuilder.length() == 0) { //No Projects, return null to indicate return null; - } - + } + projectsQuery.addFilter(String.format("parent.id in (%s)", filterBuilder.toString())); - + if (Kernel.getConfig().languageIndependentItems()) { final FilterFactory filterFactory = projectsQuery.getFilterFactory(); final Filter filter = filterFactory.or(). - addFilter(filterFactory.equals("language", GlobalizationHelper.getNegotiatedLocale().getLanguage())). + addFilter(filterFactory.equals("language", GlobalizationHelper. + getNegotiatedLocale().getLanguage())). addFilter(filterFactory.and(). - addFilter(filterFactory.equals("language", GlobalizationHelper.LANG_INDEPENDENT)). - addFilter(filterFactory.notIn("parent", "com.arsdigita.navigation.getParentIDsOfMatchedItems").set( - "language", GlobalizationHelper.getNegotiatedLocale().getLanguage()))); + addFilter(filterFactory.equals("language", + GlobalizationHelper.LANG_INDEPENDENT)). + addFilter(filterFactory.notIn("parent", + "com.arsdigita.navigation.getParentIDsOfMatchedItems"). + set( + "language", GlobalizationHelper.getNegotiatedLocale(). + getLanguage()))); projectsQuery.addFilter(filter); } else { - projectsQuery.addEqualsFilter("language", GlobalizationHelper.getNegotiatedLocale().getLanguage()); + projectsQuery.addEqualsFilter("language", GlobalizationHelper.getNegotiatedLocale(). + getLanguage()); } logger.debug(String.format( diff --git a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPublicationsTab.java b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPublicationsTab.java index b719e7552..98a2951c8 100644 --- a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPublicationsTab.java +++ b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPublicationsTab.java @@ -37,8 +37,8 @@ public class SciDepartmentPublicationsTab implements GenericOrgaUnitTab { private final Logger logger = Logger.getLogger( SciDepartmentPublicationsTab.class); - private static final SciDepartmentPublicationsTabConfig config = - new SciDepartmentPublicationsTabConfig(); + private static final SciDepartmentPublicationsTabConfig config + = new SciDepartmentPublicationsTabConfig(); private static final String YEAR_PARAM = "yearOfPublication"; private static final String TITLE_PARAM = "title"; private static final String AUTHOR_PARAM = "author"; @@ -52,6 +52,7 @@ public class SciDepartmentPublicationsTab implements GenericOrgaUnitTab { private final TextFilter titleFilter = new TextFilter(TITLE_PARAM, ContentPage.TITLE); private final TextFilter authorFilter; + private String key; static { config.load(); @@ -63,6 +64,17 @@ public class SciDepartmentPublicationsTab implements GenericOrgaUnitTab { authorFilter = new TextFilter(AUTHOR_PARAM, "authorsStr"); } + @Override + public String getKey() { + return key; + } + + @Override + public void setKey(final String key) { + this.key = key; + } + + @Override public boolean hasData(final GenericOrganizationalUnit orgaunit, final PageState state) { final long start = System.currentTimeMillis(); @@ -87,6 +99,7 @@ public class SciDepartmentPublicationsTab implements GenericOrgaUnitTab { return result; } + @Override public void generateXml(final GenericOrganizationalUnit orgaunit, final Element parent, final PageState state) { @@ -202,13 +215,12 @@ public class SciDepartmentPublicationsTab implements GenericOrgaUnitTab { final DataQuery publicationBundlesQuery; - publicationBundlesQuery = - SessionManager.getSession().retrieveQuery("com.arsdigita.cms.contenttypes.getIdsOfPublicationsForOrgaUnit"); + publicationBundlesQuery = SessionManager.getSession().retrieveQuery( + "com.arsdigita.cms.contenttypes.getIdsOfPublicationsForOrgaUnit"); final List orgaunitIds = new ArrayList(); if (config.isMergingPublications()) { - final DataQuery subDepartmentsQuery = - SessionManager.getSession().retrieveQuery( + final DataQuery subDepartmentsQuery = SessionManager.getSession().retrieveQuery( "com.arsdigita.cms.contenttypes.getIdsOfSubordinateOrgaUnitsRecursivlyWithAssocType"); subDepartmentsQuery.setParameter("orgaunitId", orgaunit.getContentBundle().getID().toString()); @@ -243,14 +255,20 @@ public class SciDepartmentPublicationsTab implements GenericOrgaUnitTab { if (Kernel.getConfig().languageIndependentItems()) { final FilterFactory filterFactory = publicationsQuery.getFilterFactory(); final Filter filter = filterFactory.or(). - addFilter(filterFactory.equals("language", GlobalizationHelper.getNegotiatedLocale().getLanguage())). + addFilter(filterFactory.equals("language", GlobalizationHelper. + getNegotiatedLocale().getLanguage())). addFilter(filterFactory.and(). - addFilter(filterFactory.equals("language", GlobalizationHelper.LANG_INDEPENDENT)). - addFilter(filterFactory.notIn("parent", "com.arsdigita.navigation.getParentIDsOfMatchedItems").set( - "language", GlobalizationHelper.getNegotiatedLocale().getLanguage()))); + addFilter(filterFactory.equals("language", + GlobalizationHelper.LANG_INDEPENDENT)). + addFilter(filterFactory.notIn("parent", + "com.arsdigita.navigation.getParentIDsOfMatchedItems"). + set( + "language", GlobalizationHelper.getNegotiatedLocale(). + getLanguage()))); publicationsQuery.addFilter(filter); } else { - publicationsQuery.addEqualsFilter("language", GlobalizationHelper.getNegotiatedLocale().getLanguage()); + publicationsQuery.addEqualsFilter("language", GlobalizationHelper.getNegotiatedLocale(). + getLanguage()); } logger.debug(String.format( @@ -306,8 +324,8 @@ public class SciDepartmentPublicationsTab implements GenericOrgaUnitTab { final Element parent, final PageState state) { final long start = System.currentTimeMillis(); - final ContentPage publication = - (ContentPage) DomainObjectFactory.newInstance(new OID(objectType, publicationId)); + final ContentPage publication = (ContentPage) DomainObjectFactory.newInstance(new OID( + objectType, publicationId)); logger.debug(String.format("Got domain object for publication '%s' " + "in %d ms.", publication.getName(), diff --git a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSummaryTab.java b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSummaryTab.java index 20e43c70b..0adb0cbe5 100644 --- a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSummaryTab.java +++ b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSummaryTab.java @@ -23,21 +23,32 @@ import org.apache.log4j.Logger; */ public class SciDepartmentSummaryTab implements GenericOrgaUnitTab { - private final Logger logger = - Logger.getLogger(SciDepartmentSummaryTab.class); - private final static SciDepartmentSummaryTabConfig config = - new SciDepartmentSummaryTabConfig(); + private final Logger logger = Logger.getLogger(SciDepartmentSummaryTab.class); + private final static SciDepartmentSummaryTabConfig config = new SciDepartmentSummaryTabConfig(); + private String key; static { config.load(); } + @Override + public String getKey() { + return key; + } + + @Override + public void setKey(final String key) { + this.key = key; + } + + @Override public boolean hasData(final GenericOrganizationalUnit orgaunit, final PageState state) { //Some of the the data shown by this tab will ever be there return true; } + @Override public void generateXml(final GenericOrganizationalUnit orgaunit, final Element parent, final PageState state) { @@ -127,7 +138,7 @@ public class SciDepartmentSummaryTab implements GenericOrgaUnitTab { getPersons(); heads.addFilter(roleFilter.toString()); heads.addFilter(statusFilter.toString()); - heads.addOrder("name"); + heads.addOrder("name"); while (heads.next()) { generateHeadXml(heads.getPerson(), headsElem, state); @@ -144,8 +155,7 @@ public class SciDepartmentSummaryTab implements GenericOrgaUnitTab { final PageState state) { final long start = System.currentTimeMillis(); - final GenericOrganizationalUnitSubordinateCollection subDepartments = - department. + final GenericOrganizationalUnitSubordinateCollection subDepartments = department. getSubordinateOrgaUnits(); subDepartments.addFilter( String.format("%s = '%s'", @@ -265,8 +275,7 @@ public class SciDepartmentSummaryTab implements GenericOrgaUnitTab { } private String getContactTypeName(final String contactTypeKey) { - final RelationAttributeCollection relAttrs = - new RelationAttributeCollection(); + final RelationAttributeCollection relAttrs = new RelationAttributeCollection(); relAttrs.addFilter(String.format("attribute = '%s'", "GenericContactTypes")); relAttrs.addFilter(String.format("attr_key = '%s'", contactTypeKey)); @@ -297,5 +306,6 @@ public class SciDepartmentSummaryTab implements GenericOrgaUnitTab { protected ContentItem getContentItem(final PageState state) { return item; } + } } diff --git a/ccm-sci-types-institute/src/com/arsdigita/cms/contenttypes/ui/SciInstituteDescTab.java b/ccm-sci-types-institute/src/com/arsdigita/cms/contenttypes/ui/SciInstituteDescTab.java index d2710120c..346e235c6 100644 --- a/ccm-sci-types-institute/src/com/arsdigita/cms/contenttypes/ui/SciInstituteDescTab.java +++ b/ccm-sci-types-institute/src/com/arsdigita/cms/contenttypes/ui/SciInstituteDescTab.java @@ -15,7 +15,19 @@ import org.apache.log4j.Logger; public class SciInstituteDescTab implements GenericOrgaUnitTab { public final Logger logger = Logger.getLogger(SciInstituteDescTab.class); + private String key; + @Override + public String getKey() { + return key; + } + + @Override + public void setKey(final String key) { + this.key = key; + } + + @Override public boolean hasData(final GenericOrganizationalUnit orgaunit, final PageState state) { final long start = System.currentTimeMillis(); @@ -38,6 +50,7 @@ public class SciInstituteDescTab implements GenericOrgaUnitTab { return result; } + @Override public void generateXml(final GenericOrganizationalUnit orgaunit, final Element parent, final PageState state) { @@ -45,7 +58,7 @@ public class SciInstituteDescTab implements GenericOrgaUnitTab { final Desc desc = getData(orgaunit); final Element descTabElem = parent.newChildElement("instituteDescription"); - + if ((desc.getShortDesc() != null) && !desc.getShortDesc().trim().isEmpty()) { final Element shortDescElem = descTabElem.newChildElement( @@ -98,5 +111,6 @@ public class SciInstituteDescTab implements GenericOrgaUnitTab { public void setDesc(final String desc) { this.desc = desc; } + } } diff --git a/ccm-sci-types-institute/src/com/arsdigita/cms/contenttypes/ui/SciInstituteMembersTab.java b/ccm-sci-types-institute/src/com/arsdigita/cms/contenttypes/ui/SciInstituteMembersTab.java index 92360bfdf..dba22b8f3 100644 --- a/ccm-sci-types-institute/src/com/arsdigita/cms/contenttypes/ui/SciInstituteMembersTab.java +++ b/ccm-sci-types-institute/src/com/arsdigita/cms/contenttypes/ui/SciInstituteMembersTab.java @@ -47,8 +47,7 @@ import org.apache.log4j.Logger; public class SciInstituteMembersTab implements GenericOrgaUnitTab { private final Logger logger = Logger.getLogger(SciInstituteMembersTab.class); - private static final SciInstituteMembersTabConfig config = - new SciInstituteMembersTabConfig(); + private static final SciInstituteMembersTabConfig config = new SciInstituteMembersTabConfig(); private static final String STATUS_PARAM = "memberStatus"; private static final String SURNAME_PARAM = "memberSurname"; private final CompareFilter statusFilter = new CompareFilter( @@ -58,6 +57,7 @@ public class SciInstituteMembersTab implements GenericOrgaUnitTab { false, false); private final TextFilter surnameFilter = new TextFilter(SURNAME_PARAM, GenericPerson.SURNAME); + private String key; static { config.load(); @@ -72,6 +72,17 @@ public class SciInstituteMembersTab implements GenericOrgaUnitTab { } } + @Override + public String getKey() { + return key; + } + + @Override + public void setKey(final String key) { + this.key = key; + } + + @Override public boolean hasData(final GenericOrganizationalUnit orgaunit, final PageState state) { if ((orgaunit.getPersons() != null) && orgaunit.getPersons().size() > 0) { @@ -84,6 +95,7 @@ public class SciInstituteMembersTab implements GenericOrgaUnitTab { } } + @Override public void generateXml(final GenericOrganizationalUnit orgaunit, final Element parent, final PageState state) { @@ -150,12 +162,11 @@ public class SciInstituteMembersTab implements GenericOrgaUnitTab { final DataQuery personBundlesQuery = SessionManager.getSession(). retrieveQuery( - "com.arsdigita.cms.contenttypes.getIdsOfMembersOfOrgaUnits"); + "com.arsdigita.cms.contenttypes.getIdsOfMembersOfOrgaUnits"); final List orgaunitsIds = new ArrayList(); if (config.isMergingMembers()) { - final DataQuery departmentsQuery = - SessionManager.getSession().retrieveQuery( + final DataQuery departmentsQuery = SessionManager.getSession().retrieveQuery( "com.arsdigita.cms.contenttypes.getIdsOfSubordinateOrgaUnitsRecursivlyWithAssocType"); departmentsQuery.setParameter("orgaunitId", orgaunit.getContentBundle().getID().toString()); @@ -179,7 +190,8 @@ public class SciInstituteMembersTab implements GenericOrgaUnitTab { } filterBuilder.append(personBundlesQuery.get("memberId").toString()); } - final DataCollection membersQuery = SessionManager.getSession().retrieve(GenericPerson.BASE_DATA_OBJECT_TYPE); + final DataCollection membersQuery = SessionManager.getSession().retrieve( + GenericPerson.BASE_DATA_OBJECT_TYPE); if (filterBuilder.length() == 0) { //No members, return null to indicate @@ -197,7 +209,7 @@ public class SciInstituteMembersTab implements GenericOrgaUnitTab { orgaunit.getName(), System.currentTimeMillis() - start, config.isMergingMembers())); - + return membersQuery; } diff --git a/ccm-sci-types-institute/src/com/arsdigita/cms/contenttypes/ui/SciInstituteProjectsTab.java b/ccm-sci-types-institute/src/com/arsdigita/cms/contenttypes/ui/SciInstituteProjectsTab.java index f80cd3a90..12ae3c54a 100644 --- a/ccm-sci-types-institute/src/com/arsdigita/cms/contenttypes/ui/SciInstituteProjectsTab.java +++ b/ccm-sci-types-institute/src/com/arsdigita/cms/contenttypes/ui/SciInstituteProjectsTab.java @@ -39,10 +39,8 @@ import org.apache.log4j.Logger; */ public class SciInstituteProjectsTab implements GenericOrgaUnitTab { - private final Logger logger = - Logger.getLogger(SciInstituteProjectsTab.class); - private final static SciInstituteProjectsTabConfig config = - new SciInstituteProjectsTabConfig(); + private final Logger logger = Logger.getLogger(SciInstituteProjectsTab.class); + private final static SciInstituteProjectsTabConfig config = new SciInstituteProjectsTabConfig(); private static final String STATUS_PARAM = "projectStatus"; private static final String TITLE_PARAM = "projectTitle"; private final CompareFilter statusFilter = new CompareFilter(STATUS_PARAM, @@ -53,6 +51,7 @@ public class SciInstituteProjectsTab implements GenericOrgaUnitTab { true); private final TextFilter titleFilter = new TextFilter(TITLE_PARAM, ContentPage.TITLE); + private String key; static { config.load(); @@ -75,6 +74,17 @@ public class SciInstituteProjectsTab implements GenericOrgaUnitTab { false); } + @Override + public String getKey() { + return key; + } + + @Override + public void setKey(final String key) { + this.key = key; + } + + @Override public boolean hasData(final GenericOrganizationalUnit orgaunit, final PageState state) { final long start = System.currentTimeMillis(); @@ -101,6 +111,7 @@ public class SciInstituteProjectsTab implements GenericOrgaUnitTab { return result; } + @Override public void generateXml(final GenericOrganizationalUnit orgaunit, final Element parent, final PageState state) { @@ -206,12 +217,11 @@ public class SciInstituteProjectsTab implements GenericOrgaUnitTab { final DataQuery projectBundlesQuery = SessionManager.getSession(). retrieveQuery( - "com.arsdigita.cms.contenttypes.getIdsOfProjectsOfOrgaUnit"); + "com.arsdigita.cms.contenttypes.getIdsOfProjectsOfOrgaUnit"); final List orgaunitIds = new ArrayList(); if (config.isMergingProjects()) { - final DataQuery subDepartmentsQuery = - SessionManager.getSession().retrieveQuery( + final DataQuery subDepartmentsQuery = SessionManager.getSession().retrieveQuery( "com.arsdigita.cms.contenttypes.getIdsOfSubordinateOrgaUnitsRecursivlyWithAssocType"); subDepartmentsQuery.setParameter("orgaunitId", orgaunit.getContentBundle().getID().toString()); @@ -246,14 +256,20 @@ public class SciInstituteProjectsTab implements GenericOrgaUnitTab { if (Kernel.getConfig().languageIndependentItems()) { final FilterFactory filterFactory = projectsQuery.getFilterFactory(); final Filter filter = filterFactory.or(). - addFilter(filterFactory.equals("language", GlobalizationHelper.getNegotiatedLocale().getLanguage())). + addFilter(filterFactory.equals("language", GlobalizationHelper. + getNegotiatedLocale().getLanguage())). addFilter(filterFactory.and(). - addFilter(filterFactory.equals("language", GlobalizationHelper.LANG_INDEPENDENT)). - addFilter(filterFactory.notIn("parent", "com.arsdigita.navigation.getParentIDsOfMatchedItems").set( - "language", GlobalizationHelper.getNegotiatedLocale().getLanguage()))); + addFilter(filterFactory.equals("language", + GlobalizationHelper.LANG_INDEPENDENT)). + addFilter(filterFactory.notIn("parent", + "com.arsdigita.navigation.getParentIDsOfMatchedItems"). + set( + "language", GlobalizationHelper.getNegotiatedLocale(). + getLanguage()))); projectsQuery.addFilter(filter); } else { - projectsQuery.addEqualsFilter("language", GlobalizationHelper.getNegotiatedLocale().getLanguage()); + projectsQuery.addEqualsFilter("language", GlobalizationHelper.getNegotiatedLocale(). + getLanguage()); } logger.debug(String.format( diff --git a/ccm-sci-types-institute/src/com/arsdigita/cms/contenttypes/ui/SciInstitutePublicationsTab.java b/ccm-sci-types-institute/src/com/arsdigita/cms/contenttypes/ui/SciInstitutePublicationsTab.java index 2c137f1cd..0e6171559 100644 --- a/ccm-sci-types-institute/src/com/arsdigita/cms/contenttypes/ui/SciInstitutePublicationsTab.java +++ b/ccm-sci-types-institute/src/com/arsdigita/cms/contenttypes/ui/SciInstitutePublicationsTab.java @@ -37,8 +37,8 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab { private final Logger logger = Logger.getLogger( SciInstitutePublicationsTab.class); - private static final SciInstitutePublicationsTabConfig config = - new SciInstitutePublicationsTabConfig(); + private static final SciInstitutePublicationsTabConfig config + = new SciInstitutePublicationsTabConfig(); private static final String YEAR_PARAM = "yearOfPublication"; private static final String TITLE_PARAM = "title"; private static final String AUTHOR_PARAM = "author"; @@ -54,6 +54,7 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab { private final TextFilter authorFilter; private boolean excludeWorkingPapers = false; private boolean onlyWorkingPapers = false; + private String key; static { config.load(); @@ -73,6 +74,17 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab { this.onlyWorkingPapers = onlyWorkingPapers; } + @Override + public String getKey() { + return key; + } + + @Override + public void setKey(final String key) { + this.key = key; + } + + @Override public boolean hasData(final GenericOrganizationalUnit orgaunit, final PageState state) { final long start = System.currentTimeMillis(); @@ -97,6 +109,7 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab { return result; } + @Override public void generateXml(final GenericOrganizationalUnit orgaunit, final Element parent, final PageState state) { @@ -226,16 +239,14 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab { orgaunit.getClass().getName())); } - final DataQuery publicationBundlesQuery; - publicationBundlesQuery = - SessionManager.getSession().retrieveQuery("com.arsdigita.cms.contenttypes.getIdsOfPublicationsForOrgaUnit"); + publicationBundlesQuery = SessionManager.getSession().retrieveQuery( + "com.arsdigita.cms.contenttypes.getIdsOfPublicationsForOrgaUnit"); final List orgaunitIds = new ArrayList(); if (config.isMergingPublications()) { - final DataQuery departmentsQuery = - SessionManager.getSession().retrieveQuery( + final DataQuery departmentsQuery = SessionManager.getSession().retrieveQuery( "com.arsdigita.cms.contenttypes.getIdsOfSubordinateOrgaUnitsRecursivlyWithAssocType"); departmentsQuery.setParameter("orgaunitId", orgaunit.getContentBundle().getID().toString()); @@ -270,14 +281,20 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab { if (Kernel.getConfig().languageIndependentItems()) { final FilterFactory filterFactory = publicationsQuery.getFilterFactory(); final Filter filter = filterFactory.or(). - addFilter(filterFactory.equals("language", GlobalizationHelper.getNegotiatedLocale().getLanguage())). + addFilter(filterFactory.equals("language", GlobalizationHelper. + getNegotiatedLocale().getLanguage())). addFilter(filterFactory.and(). - addFilter(filterFactory.equals("language", GlobalizationHelper.LANG_INDEPENDENT)). - addFilter(filterFactory.notIn("parent", "com.arsdigita.navigation.getParentIDsOfMatchedItems").set( - "language", GlobalizationHelper.getNegotiatedLocale().getLanguage()))); + addFilter(filterFactory.equals("language", + GlobalizationHelper.LANG_INDEPENDENT)). + addFilter(filterFactory.notIn("parent", + "com.arsdigita.navigation.getParentIDsOfMatchedItems"). + set( + "language", GlobalizationHelper.getNegotiatedLocale(). + getLanguage()))); publicationsQuery.addFilter(filter); } else { - publicationsQuery.addEqualsFilter("language", GlobalizationHelper.getNegotiatedLocale().getLanguage()); + publicationsQuery.addEqualsFilter("language", GlobalizationHelper.getNegotiatedLocale(). + getLanguage()); } logger.debug(String.format( @@ -333,8 +350,8 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab { final Element parent, final PageState state) { final long start = System.currentTimeMillis(); - final ContentPage publication = - (ContentPage) DomainObjectFactory.newInstance(new OID(objectType, publicationId)); + final ContentPage publication = (ContentPage) DomainObjectFactory.newInstance(new OID( + objectType, publicationId)); logger.debug(String.format("Got domain object for publication '%s' " + "in %d ms.", publication.getName(), diff --git a/ccm-sci-types-institute/src/com/arsdigita/cms/contenttypes/ui/SciInstituteSummaryTab.java b/ccm-sci-types-institute/src/com/arsdigita/cms/contenttypes/ui/SciInstituteSummaryTab.java index 2ac299def..621157e49 100644 --- a/ccm-sci-types-institute/src/com/arsdigita/cms/contenttypes/ui/SciInstituteSummaryTab.java +++ b/ccm-sci-types-institute/src/com/arsdigita/cms/contenttypes/ui/SciInstituteSummaryTab.java @@ -27,21 +27,32 @@ import org.apache.log4j.Logger; */ public class SciInstituteSummaryTab implements GenericOrgaUnitTab { - private final Logger logger = - Logger.getLogger(SciInstituteSummaryTab.class); - private final static SciInstituteSummaryTabConfig config = - new SciInstituteSummaryTabConfig(); + private final Logger logger = Logger.getLogger(SciInstituteSummaryTab.class); + private final static SciInstituteSummaryTabConfig config = new SciInstituteSummaryTabConfig(); + private String key; static { config.load(); } + @Override + public String getKey() { + return key; + } + + @Override + public void setKey(final String key) { + this.key = key; + } + + @Override public boolean hasData(final GenericOrganizationalUnit orgaunit, final PageState state) { //Some of the the data shown by this tab will ever be there return true; } + @Override public void generateXml(final GenericOrganizationalUnit orgaunit, final Element parent, final PageState state) { @@ -185,8 +196,10 @@ public class SciInstituteSummaryTab implements GenericOrgaUnitTab { public int compare(final GenericPerson person1, final GenericPerson person2) { - final String name1 = String.format("%s %s", person1.getSurname(), person1.getGivenName()); - final String name2 = String.format("%s %s", person2.getSurname(), person2.getGivenName()); + final String name1 = String.format("%s %s", person1.getSurname(), person1. + getGivenName()); + final String name2 = String.format("%s %s", person2.getSurname(), person2. + getGivenName()); return name1.compareTo(name2); } @@ -211,8 +224,8 @@ public class SciInstituteSummaryTab implements GenericOrgaUnitTab { final PageState state) { final long start = System.currentTimeMillis(); - final GenericOrganizationalUnitSubordinateCollection departments = - institute.getSubordinateOrgaUnits(); + final GenericOrganizationalUnitSubordinateCollection departments = institute. + getSubordinateOrgaUnits(); departments.addFilter( String.format("%s = '%s'", GenericOrganizationalUnitSubordinateCollection.LINK_ASSOCTYPE, @@ -331,12 +344,12 @@ public class SciInstituteSummaryTab implements GenericOrgaUnitTab { } private String getContactTypeName(final String contactTypeKey) { - final RelationAttributeCollection relAttrs = - new RelationAttributeCollection(); + final RelationAttributeCollection relAttrs = new RelationAttributeCollection(); relAttrs.addFilter(String.format("attribute = '%s'", "GenericContactTypes")); relAttrs.addFilter(String.format("attr_key = '%s'", contactTypeKey)); - relAttrs.addFilter(String.format("lang = '%s'", GlobalizationHelper.getNegotiatedLocale().getLanguage())); + relAttrs.addFilter(String.format("lang = '%s'", GlobalizationHelper.getNegotiatedLocale(). + getLanguage())); if (relAttrs.isEmpty()) { return contactTypeKey; diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescTab.java b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescTab.java index 89e5a1cc8..df8785a0a 100644 --- a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescTab.java +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescTab.java @@ -15,6 +15,17 @@ import org.apache.log4j.Logger; public class SciProjectDescTab implements GenericOrgaUnitTab { public final Logger logger = Logger.getLogger(SciProjectDescTab.class); + private String key; + + @Override + public String getKey() { + return key; + } + + @Override + public void setKey(final String key) { + this.key = key; + } public boolean hasData(final GenericOrganizationalUnit orgaunit, final PageState state) { diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectMembersTab.java b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectMembersTab.java index 4699b733d..9c85eca54 100644 --- a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectMembersTab.java +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectMembersTab.java @@ -9,7 +9,7 @@ import java.util.List; * @version $Id$ */ public class SciProjectMembersTab extends GenericOrgaUnitMembersTab { - + @Override protected String getXmlElementName() { return "members"; diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSummaryTab.java b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSummaryTab.java index 1e517c2d3..9f6cd5276 100644 --- a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSummaryTab.java +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSummaryTab.java @@ -35,17 +35,31 @@ public class SciProjectSummaryTab implements GenericOrgaUnitTab { private final Logger logger = Logger.getLogger(SciProjectSummaryTab.class); private final static SciProjectSummaryTabConfig config = new SciProjectSummaryTabConfig(); + private String key; static { config.load(); } + + + @Override + public String getKey() { + return key; + } + + @Override + public void setKey(final String key) { + this.key = key; + } + @Override public boolean hasData(final GenericOrganizationalUnit orgaunit, final PageState state) { //Some of the data shown by this tab will ever be there return true; } + @Override public void generateXml(final GenericOrganizationalUnit orgaunit, final Element parent, final PageState state) {