From 48b65ada10550a2d6b248f469f3fe93b3c96596a Mon Sep 17 00:00:00 2001 From: jensp Date: Fri, 13 Jun 2014 18:09:26 +0000 Subject: [PATCH] - New ImageStepDisplay now needs less width - Some formatting etc. in SciDepartmentMembersTab git-svn-id: https://svn.libreccm.org/ccm/trunk@2699 8810af33-2d31-482b-a856-94f89814c4df --- .../ImageStepResources.properties | 9 + .../ImageStepResources_de.properties | 9 + .../ImageStepResources_en.properties | 9 + .../ui/ImageStepDisplayTable.java | 147 ++++++++++----- .../cms/contenttypes/SciDepartmentConfig.java | 171 ++++++++---------- .../ui/SciDepartmentMembersTab.java | 49 +++-- .../ui/SciDepartmentMembersTabConfig.java | 61 ++++--- ...tmentMembersTabConfig_parameter.properties | 12 +- 8 files changed, 283 insertions(+), 184 deletions(-) diff --git a/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ImageStepResources.properties b/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ImageStepResources.properties index 9fe55d875..eb179c05b 100755 --- a/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ImageStepResources.properties +++ b/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ImageStepResources.properties @@ -9,3 +9,12 @@ cms.contentassets.ui.image_step.edit_attached_image=Edit caption cms.contentassets.ui.image_step.caption=Caption cms.contentassets.ui.image_step.image_table.thumbnail=Thumbnail cms.contentassets.ui.image_step.remove_attached_image.confirm=Are you sure to remove this attached image? +cms.contentassets.ui.image_step.image_table.properties=Image properties +cms.contentassets.ui.image_step.table.edit_attached_image=\u270D +cms.contentassets.ui.image_step.table.move_attached_image_up=\u2B06 +cms.contentassets.ui.image_step.table.move_attached_image_down=\u2B07 +cms.contentassets.ui.image_step.table.remove_attached_image=\u2716 +cms.contentassets.ui.image_step.table.edit_attached_image.header= +cms.contentassets.ui.image_step.table.move_attached_image_up.header= +cms.contentassets.ui.image_step.table.move_attached_image_down.header= +cms.contentassets.ui.image_step.table.remove_attached_image.header= diff --git a/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ImageStepResources_de.properties b/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ImageStepResources_de.properties index bfc342564..dc84345f6 100644 --- a/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ImageStepResources_de.properties +++ b/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ImageStepResources_de.properties @@ -9,3 +9,12 @@ cms.contentassets.ui.image_step.edit_attached_image=Bildunterschrift editieren cms.contentassets.ui.image_step.caption=Bildunterschrift cms.contentassets.ui.image_step.image_table.thumbnail=Vorschau cms.contentassets.ui.image_step.remove_attached_image.confirm=Sind Sie sicher das Sie die Zuordnung dieses Bildes entfernen m\u00f6chten? +cms.contentassets.ui.image_step.image_table.properties=Bildeigenschaften +cms.contentassets.ui.image_step.table.edit_attached_image=\u270D +cms.contentassets.ui.image_step.table.move_attached_image_up=\u2B06 +cms.contentassets.ui.image_step.table.move_attached_image_down=\u2B07 +cms.contentassets.ui.image_step.table.remove_attached_image=\u2716 +cms.contentassets.ui.image_step.table.edit_attached_image.header= +cms.contentassets.ui.image_step.table.move_attached_image_up.header= +cms.contentassets.ui.image_step.table.move_attached_image_down.header= +cms.contentassets.ui.image_step.table.remove_attached_image.header= diff --git a/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ImageStepResources_en.properties b/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ImageStepResources_en.properties index f5d57b0c2..b80ddd4ad 100755 --- a/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ImageStepResources_en.properties +++ b/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ImageStepResources_en.properties @@ -9,3 +9,12 @@ cms.contentassets.ui.image_step.edit_attached_image=Edit caption cms.contentassets.ui.image_step.caption=Caption cms.contentassets.ui.image_step.image_table.thumbnail=Thumbnail cms.contentassets.ui.image_step.remove_attached_image.confirm=cms.contentassets.ui.image_step.remove_attached_image.confirm +cms.contentassets.ui.image_step.image_table.properties=Image properties +cms.contentassets.ui.image_step.table.edit_attached_image=\u270D +cms.contentassets.ui.image_step.table.move_attached_image_up=\u2B06 +cms.contentassets.ui.image_step.table.move_attached_image_down=\u2B07 +cms.contentassets.ui.image_step.table.remove_attached_image=\u2716 +cms.contentassets.ui.image_step.table.edit_attached_image.header= +cms.contentassets.ui.image_step.table.move_attached_image_up.header= +cms.contentassets.ui.image_step.table.move_attached_image_down.header= +cms.contentassets.ui.image_step.table.remove_attached_image.header= diff --git a/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepDisplayTable.java b/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepDisplayTable.java index 97f6e3df2..49c5348b4 100644 --- a/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepDisplayTable.java +++ b/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepDisplayTable.java @@ -18,8 +18,10 @@ */ package com.arsdigita.cms.contentassets.ui; +import com.arsdigita.bebop.BoxPanel; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.ControlLink; +import com.arsdigita.bebop.Image; import com.arsdigita.bebop.Label; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.Table; @@ -33,6 +35,7 @@ import com.arsdigita.bebop.table.TableModelBuilder; import com.arsdigita.cms.CMS; import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ImageAsset; +import com.arsdigita.cms.ReusableImageAsset; import com.arsdigita.cms.Service; import com.arsdigita.cms.contentassets.ItemImageAttachment; import com.arsdigita.cms.contentassets.util.ImageStepGlobalizationUtil; @@ -59,16 +62,23 @@ public class ImageStepDisplayTable extends Table { private final static String TABLE_COL_UP = "table_col_up"; private final static String TABLE_COL_DOWN = "table_col_down"; private final static int TABLE_COL_INDEX_THUMBNAIL = 0; - private final static int TABLE_COL_INDEX_NAME = 1; - private final static int TABLE_COL_INDEX_DIMENSIONS = 2; - private final static int TABLE_COL_INDEX_TYPE = 3; - private final static int TABLE_COL_INDEX_CAPTION = 4; - private final static int TABLE_COL_INDEX_EDIT = 5; - private final static int TABLE_COL_INDEX_UP = 6; - private final static int TABLE_COL_INDEX_DOWN = 7; - private final static int TABLE_COL_INDEX_DEL = 8; + private final static int TABLE_COL_INDEX_PROPS = 1; + //private final static int TABLE_COL_INDEX_NAME = 1; + //private final static int TABLE_COL_INDEX_DIMENSIONS = 2; + //private final static int TABLE_COL_INDEX_TYPE = 3; +// private final static int TABLE_COL_INDEX_CAPTION = 4; +// private final static int TABLE_COL_INDEX_EDIT = 5; +// private final static int TABLE_COL_INDEX_UP = 6; +// private final static int TABLE_COL_INDEX_DOWN = 7; +// private final static int TABLE_COL_INDEX_DEL = 8; + private final static int TABLE_COL_INDEX_CAPTION = 2; + private final static int TABLE_COL_INDEX_EDIT = 3; + private final static int TABLE_COL_INDEX_UP = 4; + private final static int TABLE_COL_INDEX_DOWN = 5; + private final static int TABLE_COL_INDEX_DEL = 6; private final static int UP = -1; private final static int DOWN = 1; + private static final String CONTROL_LINK_FONT_SIZE = "font-size: 200%;"; private final ImageStep imageStep; @@ -85,19 +95,23 @@ public class ImageStepDisplayTable extends Table { "cms.contentassets.ui.image_step.image_table.thumbnail"))); columnModel.add(new TableColumn( - TABLE_COL_INDEX_NAME, - GlobalizationUtil.globalize( - "cms.contentasset.image.ui.display.name"))); - - columnModel.add(new TableColumn( - TABLE_COL_INDEX_DIMENSIONS, - GlobalizationUtil.globalize("cms.contentasset.image.ui.display.dimensions"))); - - columnModel.add(new TableColumn( - TABLE_COL_INDEX_TYPE, - GlobalizationUtil.globalize( - "cms.contentasset.image.ui.display.type"))); + TABLE_COL_INDEX_PROPS, + ImageStepGlobalizationUtil + .globalize("cms.contentassets.ui.image_step.image_table.properties"))); +// columnModel.add(new TableColumn( +// TABLE_COL_INDEX_NAME, +// GlobalizationUtil.globalize( +// "cms.contentasset.image.ui.display.name"))); +// +// columnModel.add(new TableColumn( +// TABLE_COL_INDEX_DIMENSIONS, +// GlobalizationUtil.globalize("cms.contentasset.image.ui.display.dimensions"))); +// +// columnModel.add(new TableColumn( +// TABLE_COL_INDEX_TYPE, +// GlobalizationUtil.globalize( +// "cms.contentasset.image.ui.display.type"))); columnModel.add(new TableColumn( TABLE_COL_INDEX_CAPTION, GlobalizationUtil.globalize("cms.contentasset.image.ui.caption"))); @@ -105,38 +119,39 @@ public class ImageStepDisplayTable extends Table { columnModel.add(new TableColumn( TABLE_COL_INDEX_EDIT, ImageStepGlobalizationUtil.globalize( - "cms.contentassets.ui.image_step.edit_attached_image"), + "cms.contentassets.ui.image_step.table.edit_attached_image.header"), TABLE_COL_EDIT)); columnModel.add(new TableColumn( TABLE_COL_INDEX_UP, ImageStepGlobalizationUtil.globalize( - "cms.contentassets.ui.image_step.move_attached_image_up"), + "cms.contentassets.ui.image_step.table.move_attached_image_up.header"), TABLE_COL_UP)); columnModel.add(new TableColumn( TABLE_COL_INDEX_DOWN, ImageStepGlobalizationUtil.globalize( - "cms.contentassets.ui.image_step.move_attached_image_down"), + "cms.contentassets.ui.image_step.table.move_attached_image_down.header"), TABLE_COL_DOWN)); columnModel.add(new TableColumn( TABLE_COL_INDEX_DEL, ImageStepGlobalizationUtil.globalize( - "cms.contentassets.ui.image_step.remove_attached_image"), + "cms.contentassets.ui.image_step.table.remove_attached_image.header"), TABLE_COL_DEL)); setModelBuilder(new ImageTableModelBuilder(imageStep)); - columnModel.get(0).setCellRenderer(new ThumbnailCellRenderer()); - columnModel.get(1).setCellRenderer(new NameCellRenderer()); - columnModel.get(2).setCellRenderer(new DimensionsCellRenderer()); - columnModel.get(3).setCellRenderer(new TypeCellRenderer()); - columnModel.get(4).setCellRenderer(new CaptionCellRenderer()); - columnModel.get(5).setCellRenderer(new EditCellRenderer()); - columnModel.get(6).setCellRenderer(new UpCellRenderer()); - columnModel.get(7).setCellRenderer(new DownCellRenderer()); - columnModel.get(8).setCellRenderer(new DeleteCellRenderer()); + columnModel.get(TABLE_COL_INDEX_THUMBNAIL).setCellRenderer(new ThumbnailCellRenderer()); + columnModel.get(TABLE_COL_INDEX_PROPS).setCellRenderer(new PropertiesCellRenderer()); +// columnModel.get(TABLE_COL_INDEX_NAME).setCellRenderer(new NameCellRenderer()); +// columnModel.get(TABLE_COL_INDEX_DIMENSIONS).setCellRenderer(new DimensionsCellRenderer()); +// columnModel.get(TABLE_COL_INDEX_TYPE).setCellRenderer(new TypeCellRenderer()); + columnModel.get(TABLE_COL_INDEX_CAPTION).setCellRenderer(new CaptionCellRenderer()); + columnModel.get(TABLE_COL_INDEX_EDIT).setCellRenderer(new EditCellRenderer()); + columnModel.get(TABLE_COL_INDEX_UP).setCellRenderer(new UpCellRenderer()); + columnModel.get(TABLE_COL_INDEX_DOWN).setCellRenderer(new DownCellRenderer()); + columnModel.get(TABLE_COL_INDEX_DEL).setCellRenderer(new DeleteCellRenderer()); addTableActionListener(new ImageStepTableActionListener()); @@ -195,27 +210,29 @@ public class ImageStepDisplayTable extends Table { switch (columnIndex) { case TABLE_COL_INDEX_THUMBNAIL: return image; - case TABLE_COL_INDEX_NAME: - return image.getImage().getName(); - case TABLE_COL_INDEX_DIMENSIONS: - return String.format("%sx%s px", image.getImage().getWidth().toString(), - image.getImage().getHeight().toString()); - case TABLE_COL_INDEX_TYPE: - return image.getImage().getMimeType().getLabel(); + case TABLE_COL_INDEX_PROPS: + return image; +// case TABLE_COL_INDEX_NAME: +// return image.getImage().getName(); +// case TABLE_COL_INDEX_DIMENSIONS: +// return String.format("%sx%s px", image.getImage().getWidth().toString(), +// image.getImage().getHeight().toString()); +// case TABLE_COL_INDEX_TYPE: +// return image.getImage().getMimeType().getLabel(); case TABLE_COL_INDEX_CAPTION: return image.getCaption(); case TABLE_COL_INDEX_EDIT: return ImageStepGlobalizationUtil.globalize( - "cms.contentassets.ui.image_step.edit_attached_image"); + "cms.contentassets.ui.image_step.table.edit_attached_image"); case TABLE_COL_INDEX_UP: return ImageStepGlobalizationUtil.globalize( - "cms.contentassets.ui.image_step.move_attached_image_up"); + "cms.contentassets.ui.image_step.table.move_attached_image_up"); case TABLE_COL_INDEX_DOWN: return ImageStepGlobalizationUtil.globalize( - "cms.contentassets.ui.image_step.move_attached_image_down"); + "cms.contentassets.ui.image_step.table.move_attached_image_down"); case TABLE_COL_INDEX_DEL: return ImageStepGlobalizationUtil.globalize( - "cms.contentassets.ui.image_step.remove_attached_image"); + "cms.contentassets.ui.image_step.table.remove_attached_image"); default: return null; @@ -279,6 +296,31 @@ public class ImageStepDisplayTable extends Table { } } + + private class PropertiesCellRenderer extends LockableImpl implements TableCellRenderer { + + @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 ItemImageAttachment attachment = (ItemImageAttachment) value; + final ReusableImageAsset image = attachment.getImage(); + + final BoxPanel panel = new BoxPanel(BoxPanel.VERTICAL); + + panel.add(new Label(image.getName())); + panel.add(new Label(String.format("%sx%s px", image.getWidth().toString(), + image.getHeight().toString()))); + panel.add(new Label(image.getMimeType().getLabel())); + + return panel; + } + + } private class NameCellRenderer extends LockableImpl implements TableCellRenderer { @@ -359,12 +401,13 @@ public class ImageStepDisplayTable extends Table { item); if (canEdit) { - return new ControlLink(new Label((GlobalizedMessage) value)); + final ControlLink link = new ControlLink(new Label((GlobalizedMessage) value)); + link.setStyleAttr(CONTROL_LINK_FONT_SIZE); + return link; } else { return new Label(""); } - } - + } } private class UpCellRenderer extends LockableImpl implements TableCellRenderer { @@ -381,7 +424,9 @@ public class ImageStepDisplayTable extends Table { //First row, don't show up link return new Label(""); } else { - return new ControlLink(new Label((GlobalizedMessage) value)); + final ControlLink link = new ControlLink(new Label((GlobalizedMessage) value)); + link.setStyleAttr(CONTROL_LINK_FONT_SIZE); + return link; } } @@ -404,7 +449,9 @@ public class ImageStepDisplayTable extends Table { //Last row in table, don't show down link return new Label(""); } else { - return new ControlLink(new Label((GlobalizedMessage) value)); + final ControlLink link = new ControlLink(new Label((GlobalizedMessage) value)); + link.setStyleAttr(CONTROL_LINK_FONT_SIZE); + return link; } } @@ -432,7 +479,7 @@ public class ImageStepDisplayTable extends Table { final ControlLink link = new ControlLink(new Label((GlobalizedMessage) value)); link.setConfirmation(ImageStepGlobalizationUtil.globalize( "cms.contentassets.ui.image_step.remove_attached_image.confirm")); - + link.setStyleAttr(CONTROL_LINK_FONT_SIZE); return link; } else { return new Label(""); diff --git a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/SciDepartmentConfig.java b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/SciDepartmentConfig.java index 9f4bf42cd..ea586922e 100644 --- a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/SciDepartmentConfig.java +++ b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/SciDepartmentConfig.java @@ -25,9 +25,9 @@ import com.arsdigita.util.parameter.Parameter; import com.arsdigita.util.parameter.StringParameter; /** - * Configuration for SciDepartment. - * - * @author Jens Pelzetter + * Configuration for SciDepartment. + * + * @author Jens Pelzetter * @version $Id$ */ public class SciDepartmentConfig extends AbstractConfig { @@ -52,120 +52,110 @@ public class SciDepartmentConfig extends AbstractConfig { private final Parameter showViceHeadInList; private final Parameter showSecretriatInList; private final Parameter listShowRoleContacts; - + public SciDepartmentConfig() { - enableSubDepartmentsStep = - new BooleanParameter( - "com.arsdigita.cms.contenttypes.scidepartment.enable.subdepartments_step", - Parameter.REQUIRED, - Boolean.TRUE); + enableSubDepartmentsStep = new BooleanParameter( + "com.arsdigita.cms.contenttypes.scidepartment.enable.subdepartments_step", + Parameter.REQUIRED, + Boolean.TRUE); - subDepartmentsStepSortKey = - new IntegerParameter( - "com.arsdigita.cms.contenttypes.scidepartment.subdepartments_step_sortkey", - Parameter.REQUIRED, - 10); + subDepartmentsStepSortKey = new IntegerParameter( + "com.arsdigita.cms.contenttypes.scidepartment.subdepartments_step_sortkey", + Parameter.REQUIRED, + 10); - enableSuperDepartmentsStep = - new BooleanParameter( - "com.arsdigita.cms.contenttypes.scidepartment.enable.super_departments_step", - Parameter.REQUIRED, - Boolean.TRUE); + enableSuperDepartmentsStep = new BooleanParameter( + "com.arsdigita.cms.contenttypes.scidepartment.enable.super_departments_step", + Parameter.REQUIRED, + Boolean.TRUE); - superDepartmentsStepSortKey = - new IntegerParameter( - "com.arsdigita.cms.contenttypes.scidepartment.superdepartments_step_sortkey", - Parameter.REQUIRED, - 20); + superDepartmentsStepSortKey = new IntegerParameter( + "com.arsdigita.cms.contenttypes.scidepartment.superdepartments_step_sortkey", + Parameter.REQUIRED, + 20); - enableProjectsStep = - new BooleanParameter( - "com.arsdigita.cms.contenttypes.scidepartment.enable.projects_step", - Parameter.REQUIRED, - Boolean.TRUE); + enableProjectsStep = new BooleanParameter( + "com.arsdigita.cms.contenttypes.scidepartment.enable.projects_step", + Parameter.REQUIRED, + Boolean.TRUE); - projectsStepSortKey = - new IntegerParameter( - "com.arsdigita.cms.contenttypes.scidepartment.projects_step_sortkey", - Parameter.REQUIRED, - 30); + projectsStepSortKey = new IntegerParameter( + "com.arsdigita.cms.contenttypes.scidepartment.projects_step_sortkey", + Parameter.REQUIRED, + 30); - enableProjectDepartmentsStep = - new BooleanParameter( - "com.arsdigita.cms.contenttypes.scidepartment.enable.project_departments_step", - Parameter.REQUIRED, - Boolean.TRUE); + enableProjectDepartmentsStep = new BooleanParameter( + "com.arsdigita.cms.contenttypes.scidepartment.enable.project_departments_step", + Parameter.REQUIRED, + Boolean.TRUE); - projectDepartmentsStepSortKey = - new IntegerParameter( - "com.arsdigita.cms.contenttypes.scidepartment.project_departments_step_sortkey", - Parameter.REQUIRED, - 40); + projectDepartmentsStepSortKey = new IntegerParameter( + "com.arsdigita.cms.contenttypes.scidepartment.project_departments_step_sortkey", + Parameter.REQUIRED, + 40); - shortDescMaxLength = - new IntegerParameter( - "com.arsdigita.cms.contenttypes.scidepartment.short_desc.max_length", - Parameter.REQUIRED, - 500); + shortDescMaxLength = new IntegerParameter( + "com.arsdigita.cms.contenttypes.scidepartment.short_desc.max_length", + Parameter.REQUIRED, + 500); - enableDescriptionDhtml = - new BooleanParameter( - "com.arsdigita.cms.contenttypes.scidepartment.description.dhtml_enable", - Parameter.REQUIRED, - Boolean.TRUE); + enableDescriptionDhtml = new BooleanParameter( + "com.arsdigita.cms.contenttypes.scidepartment.description.dhtml_enable", + Parameter.REQUIRED, + Boolean.TRUE); - permittedPersonType = - new StringParameter( - "com.arsdigita.cms.contenttypes.sciproject.permitted_person_type", - Parameter.REQUIRED, - "com.arsdigita.cms.contenttypes.GenericPerson"); + permittedPersonType = new StringParameter( + "com.arsdigita.cms.contenttypes.sciproject.permitted_person_type", + Parameter.REQUIRED, + "com.arsdigita.cms.contenttypes.GenericPerson"); - tabs = - new StringParameter( - "com.arsdigita.cms.contenttypes.sciproject.tabs", - Parameter.REQUIRED, - "summary:com.arsdigita.cms.contenttypes.ui.SciDepartmentSummaryTab;desc:com.arsdigita.cms.contenttypes.ui.SciDepartmentDescTab;members:com.arsdigita.cms.contenttypes.ui.SciDepartmentMembersTab;projects:com.arsdigita.cms.contenttypes.ui.SciDepartmentProjectsTab;publications:com.arsdigita.cms.contenttypes.ui.SciDepartmentPublicationsTab"); + tabs = new StringParameter( + "com.arsdigita.cms.contenttypes.sciproject.tabs", + Parameter.REQUIRED, + "summary:com.arsdigita.cms.contenttypes.ui.SciDepartmentSummaryTab;desc:com.arsdigita.cms.contenttypes.ui.SciDepartmentDescTab;members:com.arsdigita.cms.contenttypes.ui.SciDepartmentMembersTab;projects:com.arsdigita.cms.contenttypes.ui.SciDepartmentProjectsTab;publications:com.arsdigita.cms.contenttypes.ui.SciDepartmentPublicationsTab"); activeStatus = new StringParameter( - "com.arsdigita.cms.contenttypes.scidepartment.summarytab.status.active", - Parameter.REQUIRED, - "active"); + "com.arsdigita.cms.contenttypes.scidepartment.summarytab.status.active", + Parameter.REQUIRED, + "active"); headRole = new StringParameter( - "com.arsdigita.cms.contenttypes.scidepartment.heads.role", - Parameter.REQUIRED, - "head"); + "com.arsdigita.cms.contenttypes.scidepartment.heads.role", + Parameter.REQUIRED, + "head"); viceHeadRole = new StringParameter( - "com.arsdigita.cms.contenttypes.scidepartment.viceheads.role", - Parameter.REQUIRED, - "vicehead"); + "com.arsdigita.cms.contenttypes.scidepartment.viceheads.role", + Parameter.REQUIRED, + "vicehead"); secretariatRole = new StringParameter( - "com.arsdigita.cms.contenttypes.scidepartment.secretariat.role", - Parameter.REQUIRED, - "secretariat"); + "com.arsdigita.cms.contenttypes.scidepartment.secretariat.role", + Parameter.REQUIRED, + "secretariat"); showHeadInList = new BooleanParameter( - "com.arsdigita.cms.contenttypes.sciproject.listview.show_head", - Parameter.REQUIRED, - Boolean.TRUE); + "com.arsdigita.cms.contenttypes.sciproject.listview.show_head", + Parameter.REQUIRED, + Boolean.TRUE); showViceHeadInList = new BooleanParameter( - "com.arsdigita.cms.contenttypes.sciproject.listview.show_vicehead", - Parameter.REQUIRED, - Boolean.TRUE); + "com.arsdigita.cms.contenttypes.sciproject.listview.show_vicehead", + Parameter.REQUIRED, + Boolean.TRUE); showSecretriatInList = new BooleanParameter( - "com.arsdigita.cms.contenttypes.sciproject.listview.show_secretriat", - Parameter.REQUIRED, - Boolean.TRUE); + "com.arsdigita.cms.contenttypes.sciproject.listview.show_secretriat", + Parameter.REQUIRED, + Boolean.TRUE); listShowRoleContacts = new BooleanParameter( - "com.arsdigita.cms.contenttypes.sciproject.listview.show_role_contacts", - Parameter.REQUIRED, - Boolean.TRUE); + "com.arsdigita.cms.contenttypes.sciproject.listview.show_role_contacts", + Parameter.REQUIRED, + Boolean.TRUE); + + register(enableSubDepartmentsStep); register(subDepartmentsStepSortKey); @@ -187,7 +177,6 @@ public class SciDepartmentConfig extends AbstractConfig { register(showViceHeadInList); register(showSecretriatInList); register(listShowRoleContacts); - loadInfo(); } @@ -238,7 +227,7 @@ public class SciDepartmentConfig extends AbstractConfig { public final String getTabs() { return (String) get(tabs); } - + public final String getActiveStatus() { return (String) get(activeStatus); } @@ -270,5 +259,5 @@ public class SciDepartmentConfig extends AbstractConfig { public Boolean getListShowRoleContacts() { return (Boolean) get(listShowRoleContacts); } - + } 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 01e0992a0..a0460d240 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 @@ -44,8 +44,8 @@ import org.apache.log4j.Logger; /** * This tab displays all person items associated with a SciDepartment. - * - * @author Jens Pelzetter + * + * @author Jens Pelzetter * @version $Id$ */ public class SciDepartmentMembersTab implements GenericOrgaUnitTab { @@ -89,7 +89,7 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab { public boolean hasData(final GenericOrganizationalUnit orgaunit, final PageState state) { if ((orgaunit.getPersons() != null) - && orgaunit.getPersons().size() > 0) { + && orgaunit.getPersons().size() > 0) { return true; } else if (config.isMergingMembers()) { final DataQuery persons = getData(orgaunit, state).getMembers(); @@ -110,19 +110,24 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab { final Map membersStatus = membersData.getMembersStatus(); final HttpServletRequest request = state.getRequest(); - applySurnameFilter(persons, request); + if (config.getMembersTabSurnameFilter()) { + applySurnameFilter(persons, request); + } final Element depMembersElem = parent.newChildElement( - "departmentMembers"); + "departmentMembers"); final Element filtersElem = depMembersElem.newChildElement("filters"); - statusFilter.generateXml(filtersElem); + if (config.getMembersTabStatusFilter()) { + statusFilter.generateXml(filtersElem); + } if ((persons == null) || persons.isEmpty()) { - if ((surnameFilter != null) - && (surnameFilter.getFilter() != null) - && !(surnameFilter.getFilter().trim().isEmpty())) { + if (((surnameFilter != null) + && (surnameFilter.getFilter() != null) + && !(surnameFilter.getFilter().trim().isEmpty())) + && (config.getMembersTabSurnameFilter())) { surnameFilter.generateXml(filtersElem); } depMembersElem.newChildElement("noMembers"); @@ -130,7 +135,7 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab { } final RelationAttributeCollection roles = new RelationAttributeCollection( - SciDepartment.ROLE_ENUM_NAME); + SciDepartment.ROLE_ENUM_NAME); roles.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().getLanguage()); final Element rolesElem = depMembersElem.newChildElement("roles"); while (roles.next()) { @@ -138,7 +143,7 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab { } final RelationAttributeCollection statusValues = new RelationAttributeCollection( - "GenericOrganizationalUnitMemberStatus"); + "GenericOrganizationalUnitMemberStatus"); statusValues.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().getLanguage()); final Element statusValuesElem = depMembersElem.newChildElement("statusValues"); while (statusValues.next()) { @@ -149,9 +154,10 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab { (int) persons.size(), config.getPageSize()); - if ((paginator.getPageCount() > config.getEnableSearchLimit()) - || ((surnameFilter.getFilter() != null) - && !(surnameFilter.getFilter().trim().isEmpty()))) { + if (((paginator.getPageCount() > config.getEnableSearchLimit()) + || ((surnameFilter.getFilter() != null) + && !(surnameFilter.getFilter().trim().isEmpty()))) + && config.getMembersTabSurnameFilter()) { surnameFilter.generateXml(filtersElem); } @@ -212,20 +218,20 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab { final PageState state) { if (!(orgaunit instanceof SciDepartment)) { throw new IllegalArgumentException(String.format( - "This tab can only process instances of " + "This tab can only process instances of " + "'com.arsdigita.cms.contenttypes.SciDepartment'. Provided " + "object is of type '%s'", - orgaunit.getClass().getName())); + orgaunit.getClass().getName())); } final DataQuery personBundlesQuery = SessionManager.getSession(). - retrieveQuery( + retrieveQuery( "com.arsdigita.cms.contenttypes.getIdsOfMembersOfOrgaUnits"); final List orgaUnitIds = new ArrayList(); if (config.isMergingMembers()) { final DataQuery subDepartmentsQuery = SessionManager.getSession().retrieveQuery( - "com.arsdigita.cms.contenttypes.getIdsOfSubordinateOrgaUnitsRecursivlyWithAssocType"); + "com.arsdigita.cms.contenttypes.getIdsOfSubordinateOrgaUnitsRecursivlyWithAssocType"); subDepartmentsQuery.setParameter("orgaunitId", orgaunit.getContentBundle().getID().toString()); subDepartmentsQuery.setParameter("assocType", @@ -239,7 +245,9 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab { } personBundlesQuery.setParameter("orgaunitIds", orgaUnitIds); - applyStatusFilter(personBundlesQuery, state.getRequest()); + if (config.getMembersTabStatusFilter()) { + applyStatusFilter(personBundlesQuery, state.getRequest()); + } final Map membersRoles = new HashMap(); final Map membersStatus = new HashMap(); @@ -255,7 +263,7 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab { membersStatus.put(memberId, (String) personBundlesQuery.get("status")); } final DataCollection membersQuery = SessionManager.getSession().retrieve( - GenericPerson.BASE_DATA_OBJECT_TYPE); + GenericPerson.BASE_DATA_OBJECT_TYPE); if (filterBuilder.length() == 0) { //No member return null to indicate @@ -339,4 +347,5 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab { } } + } diff --git a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMembersTabConfig.java b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMembersTabConfig.java index 79bf137c8..553e1985c 100644 --- a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMembersTabConfig.java +++ b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMembersTabConfig.java @@ -26,8 +26,8 @@ import com.arsdigita.util.parameter.StringArrayParameter; /** * Configuration for the members tab. - * - * @author Jens Pelzetter + * + * @author Jens Pelzetter * @version $Id$ */ public class SciDepartmentMembersTabConfig extends AbstractConfig { @@ -36,36 +36,45 @@ public class SciDepartmentMembersTabConfig extends AbstractConfig { private Parameter pageSize; private Parameter enableSearchLimit; private Parameter mergeMembers; + private Parameter membersTabStatusFilter; + private Parameter membersTabSurnameFilter; public SciDepartmentMembersTabConfig() { - statusValues = - new StringArrayParameter( - "com.arsdigita.cms.contenttypes.scidepartment.tabs.members.status_values", - Parameter.REQUIRED, - new String[]{"active", "associated", "former"}); + statusValues = new StringArrayParameter( + "com.arsdigita.cms.contenttypes.scidepartment.tabs.members.status_values", + Parameter.REQUIRED, + new String[]{"active", "associated", "former"}); - pageSize = - new IntegerParameter( - "com.arsdigita.cms.contenttypes.scidepartment.tabs.members.page_size", - Parameter.REQUIRED, - 30); + pageSize = new IntegerParameter( + "com.arsdigita.cms.contenttypes.scidepartment.tabs.members.page_size", + Parameter.REQUIRED, + 30); - enableSearchLimit = - new IntegerParameter( - "com.arsdigita.cms.contenttypes.scidepartment.tabs.members.enable_search_limit", - Parameter.REQUIRED, - 0); + enableSearchLimit = new IntegerParameter( + "com.arsdigita.cms.contenttypes.scidepartment.tabs.members.enable_search_limit", + Parameter.REQUIRED, + 0); - mergeMembers = - new BooleanParameter( - "com.arsdigita.cms.contenttypes.scidepartments.tabs.members.merge", - Parameter.REQUIRED, - Boolean.FALSE); + mergeMembers = new BooleanParameter( + "com.arsdigita.cms.contenttypes.scidepartments.tabs.members.merge", + Parameter.REQUIRED, + Boolean.FALSE); + + membersTabStatusFilter = new BooleanParameter( + "com.arsdigita.cms.contenttypes.scidepartment.tabs.members.status_filter", + Parameter.REQUIRED, + Boolean.TRUE); + membersTabSurnameFilter = new BooleanParameter( + "com.arsdigita.cms.contenttypes.scidepartment.tabs.members.surname_filter", + Parameter.REQUIRED, + Boolean.TRUE); register(statusValues); register(pageSize); register(enableSearchLimit); register(mergeMembers); + register(membersTabStatusFilter); + register(membersTabSurnameFilter); loadInfo(); } @@ -86,4 +95,12 @@ public class SciDepartmentMembersTabConfig extends AbstractConfig { return (Boolean) get(mergeMembers); } + public Boolean getMembersTabStatusFilter() { + return (Boolean) get(membersTabStatusFilter); + } + + public Boolean getMembersTabSurnameFilter() { + return (Boolean) get(membersTabSurnameFilter); + } + } diff --git a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMembersTabConfig_parameter.properties b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMembersTabConfig_parameter.properties index 32c373e8a..b8e51fb59 100644 --- a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMembersTabConfig_parameter.properties +++ b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMembersTabConfig_parameter.properties @@ -16,4 +16,14 @@ com.arsdigita.cms.contenttypes.scidepartment.tabs.members.enable_search_limit.fo com.arsdigita.cms.contenttypes.scidepartments.tabs.members.merge.title = Merge members com.arsdigita.cms.contenttypes.scidepartments.tabs.members.merge.purpose = Merge the members of the department and its sub departments into one list? com.arsdigita.cms.contenttypes.scidepartments.tabs.members.merge.example = true -com.arsdigita.cms.contenttypes.scidepartments.tabs.members.merge.format = [Boolean] \ No newline at end of file +com.arsdigita.cms.contenttypes.scidepartments.tabs.members.merge.format = [Boolean] + +com.arsdigita.cms.contenttypes.scidepartment.tabs.members.status_filter.title = Show status filter in Members Tab? +com.arsdigita.cms.contenttypes.scidepartment.tabs.members.status_filter.purpose = Show status filter in Members Tab? +com.arsdigita.cms.contenttypes.scidepartment.tabs.members.status_filter.example = true +com.arsdigita.cms.contenttypes.scidepartment.tabs.members.status_filter.format = [Boolean] + +com.arsdigita.cms.contenttypes.scidepartment.tabs.members.surname_filter.title = Show surname filter in Members tab? +com.arsdigita.cms.contenttypes.scidepartment.tabs.members.surname_filter.purpose = Show surname filter in Members tab? +com.arsdigita.cms.contenttypes.scidepartment.tabs.members.surname_filter.example = true +com.arsdigita.cms.contenttypes.scidepartment.tabs.members.surname_filter.format = [Boolean] \ No newline at end of file