From 0702b6ac531d0f53070dde0395f23ea161c124ec Mon Sep 17 00:00:00 2001 From: jensp Date: Wed, 19 Mar 2014 15:43:38 +0000 Subject: [PATCH] New content type for historic dates. git-svn-id: https://svn.libreccm.org/ccm/trunk@2573 8810af33-2d31-482b-a856-94f89814c4df --- ccm-cms-types-historicdate/application.xml | 24 + .../ccm-cms-types-historicdate.pdl | 39 ++ .../oracle-se-create.sql | 21 + .../postgres-create.sql | 22 + .../cms/contenttypes/HistoricDate.xml | 29 + .../cms/contenttypes/HistoricDate.xml | 18 + .../src/ccm-cms-types-historicdate.load | 16 + .../cms/contenttypes/HistoricDate.java | 106 ++++ .../HistoricDateGlobalizationUtil.java | 40 ++ .../cms/contenttypes/HistoricDateLoader.java | 36 ++ .../HistoricDateResources.properties | 9 + .../HistoricDateResources_de.properties | 9 + .../ui/HistoricDatePropertiesStep.java | 79 +++ .../ui/HistoricDatePropertyForm.java | 157 ++++++ .../bebop/parameters/DateParameter.java | 92 ++-- .../web/themes/mandalay/includes/types.xsl | 1 + .../mandalay/includes/types/HistoricDate.xsl | 518 ++++++++++++++++++ .../themes/mandalay/lang/de/HistoricDate.xml | 32 ++ .../mandalay/lang/de/SciPublications.xml | 3 +- .../themes/mandalay/lang/de/footerMenu.xml | 1 + .../themes/mandalay/lang/en/HistoricDate.xml | 32 ++ .../mandalay/lang/en/SciPublications.xml | 1 + .../web/themes/mandalay/layout/navigation.xml | 54 +- .../web/themes/mandalay/layout/portal.xml | 146 +++-- .../mandalay/settings/GenericOrganization.xml | 1 - .../themes/mandalay/settings/HistoricDate.xml | 50 ++ 26 files changed, 1386 insertions(+), 150 deletions(-) create mode 100644 ccm-cms-types-historicdate/application.xml create mode 100644 ccm-cms-types-historicdate/pdl/com/arsdigita/content-types/ccm-cms-types-historicdate.pdl create mode 100644 ccm-cms-types-historicdate/sql/ccm-cms-types-historicdate/oracle-se-create.sql create mode 100644 ccm-cms-types-historicdate/sql/ccm-cms-types-historicdate/postgres-create.sql create mode 100644 ccm-cms-types-historicdate/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/HistoricDate.xml create mode 100644 ccm-cms-types-historicdate/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/HistoricDate.xml create mode 100644 ccm-cms-types-historicdate/src/ccm-cms-types-historicdate.load create mode 100644 ccm-cms-types-historicdate/src/com/arsdigita/cms/contenttypes/HistoricDate.java create mode 100644 ccm-cms-types-historicdate/src/com/arsdigita/cms/contenttypes/HistoricDateGlobalizationUtil.java create mode 100644 ccm-cms-types-historicdate/src/com/arsdigita/cms/contenttypes/HistoricDateLoader.java create mode 100644 ccm-cms-types-historicdate/src/com/arsdigita/cms/contenttypes/HistoricDateResources.properties create mode 100644 ccm-cms-types-historicdate/src/com/arsdigita/cms/contenttypes/HistoricDateResources_de.properties create mode 100644 ccm-cms-types-historicdate/src/com/arsdigita/cms/contenttypes/ui/HistoricDatePropertiesStep.java create mode 100644 ccm-cms-types-historicdate/src/com/arsdigita/cms/contenttypes/ui/HistoricDatePropertyForm.java create mode 100644 ccm-sci-bundle/web/themes/mandalay/includes/types/HistoricDate.xsl create mode 100644 ccm-sci-bundle/web/themes/mandalay/lang/de/HistoricDate.xml create mode 100644 ccm-sci-bundle/web/themes/mandalay/lang/en/HistoricDate.xml create mode 100644 ccm-sci-bundle/web/themes/mandalay/settings/HistoricDate.xml diff --git a/ccm-cms-types-historicdate/application.xml b/ccm-cms-types-historicdate/application.xml new file mode 100644 index 000000000..563e39516 --- /dev/null +++ b/ccm-cms-types-historicdate/application.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + A content type for describing historic dates + + diff --git a/ccm-cms-types-historicdate/pdl/com/arsdigita/content-types/ccm-cms-types-historicdate.pdl b/ccm-cms-types-historicdate/pdl/com/arsdigita/content-types/ccm-cms-types-historicdate.pdl new file mode 100644 index 000000000..881c5ae1d --- /dev/null +++ b/ccm-cms-types-historicdate/pdl/com/arsdigita/content-types/ccm-cms-types-historicdate.pdl @@ -0,0 +1,39 @@ +// +// Copyright (C) 2014 Jens Pelzetter All Rights Reserved. +// +// 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 +// +// $Id$ + +model com.arsdigita.cms.contenttypes; + +//Object type for historic dates + +object type HistoricDate extends GenericArticle { + + String[0..1] lead = ct_historicdate.lead VARCHAR(4096); + + //The historic date. We are not using the Java/SQL types here because they are not working + //with B.C. dates, for example the 15. March 44 B.C. + Integer[0..1] year = ct_historicdate.year INTEGER; + Integer[0..1] month = ct_historicdate.month INTEGER; + Integer[0..1] dayOfMonth = ct_historicdate.dayofmonth INTEGER; + + //Boolean to indicate if the date is approximately + Boolean[0..1] dateIsApprox = ct_historicdate.dateapprox BIT; + + reference key (ct_historicdate.historic_date_id); + +} \ No newline at end of file diff --git a/ccm-cms-types-historicdate/sql/ccm-cms-types-historicdate/oracle-se-create.sql b/ccm-cms-types-historicdate/sql/ccm-cms-types-historicdate/oracle-se-create.sql new file mode 100644 index 000000000..d047ed87f --- /dev/null +++ b/ccm-cms-types-historicdate/sql/ccm-cms-types-historicdate/oracle-se-create.sql @@ -0,0 +1,21 @@ +-- +-- Copyright (C) 2014 Jens Pelzetter All Rights Reserved. +-- +-- 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 +-- +-- $Id$ +@@ ddl/oracle-se/create.sql + +@@ ddl/oracle-se/deferred.sql diff --git a/ccm-cms-types-historicdate/sql/ccm-cms-types-historicdate/postgres-create.sql b/ccm-cms-types-historicdate/sql/ccm-cms-types-historicdate/postgres-create.sql new file mode 100644 index 000000000..60719ef16 --- /dev/null +++ b/ccm-cms-types-historicdate/sql/ccm-cms-types-historicdate/postgres-create.sql @@ -0,0 +1,22 @@ +-- +-- Copyright (C) 2014 Jens Pelzetter All Rights Reserved. +-- +-- 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 +-- +-- $Id: postgres-create.sql 1594 2007-07-10 10:56:11Z p_boy $ +-- $DateTime: 2004/08/17 23:15:09 $ +\i ddl/postgres/create.sql + +\i ddl/postgres/deferred.sql diff --git a/ccm-cms-types-historicdate/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/HistoricDate.xml b/ccm-cms-types-historicdate/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/HistoricDate.xml new file mode 100644 index 000000000..0b0948263 --- /dev/null +++ b/ccm-cms-types-historicdate/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/HistoricDate.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + diff --git a/ccm-cms-types-historicdate/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/HistoricDate.xml b/ccm-cms-types-historicdate/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/HistoricDate.xml new file mode 100644 index 000000000..b136a515c --- /dev/null +++ b/ccm-cms-types-historicdate/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/HistoricDate.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + diff --git a/ccm-cms-types-historicdate/src/ccm-cms-types-historicdate.load b/ccm-cms-types-historicdate/src/ccm-cms-types-historicdate.load new file mode 100644 index 000000000..a2a7699cf --- /dev/null +++ b/ccm-cms-types-historicdate/src/ccm-cms-types-historicdate.load @@ -0,0 +1,16 @@ + + + +
+
+ + + +
+ + + + + + + diff --git a/ccm-cms-types-historicdate/src/com/arsdigita/cms/contenttypes/HistoricDate.java b/ccm-cms-types-historicdate/src/com/arsdigita/cms/contenttypes/HistoricDate.java new file mode 100644 index 000000000..bdd3981a6 --- /dev/null +++ b/ccm-cms-types-historicdate/src/com/arsdigita/cms/contenttypes/HistoricDate.java @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2014 Jens Pelzetter All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package com.arsdigita.cms.contenttypes; + +import com.arsdigita.domain.DataObjectNotFoundException; +import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.OID; +import java.math.BigDecimal; + +/** + * + * @author Jens Pelzetter + */ +public class HistoricDate extends GenericArticle { + + public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.HistoricDate"; + public static final String YEAR = "year"; + public static final String MONTH = "month"; + public static final String DAY_OF_MONTH = "dayOfMonth"; + public static final String DATE_IS_APPROX = "dateIsApprox"; + public static final String LEAD = "lead"; + + public HistoricDate() { + this(BASE_DATA_OBJECT_TYPE); + } + + public HistoricDate(final BigDecimal id) throws DataObjectNotFoundException { + this(new OID(BASE_DATA_OBJECT_TYPE, id)); + } + + public HistoricDate(final OID oid) throws DataObjectNotFoundException { + super(oid); + } + + public HistoricDate(final DataObject dataObject) { + super(dataObject); + } + + public HistoricDate(final String type) { + super(type); + } + + public Integer getYear() { + return (Integer) get(YEAR); + } + + public void setYear(final Integer year) { + set(YEAR, year); + } + + public Integer getMonth() { + return (Integer) get(MONTH); + } + + public void setMonth(final Integer month) { + set(MONTH, month); + } + + public Integer getDayOfMonth() { + return (Integer) get(DAY_OF_MONTH); + } + + public void setDayOfMonth(final Integer dayOfMonth) { + set(DAY_OF_MONTH, dayOfMonth); + } + + public Boolean getDateIsApprox() { + return (Boolean) get(DATE_IS_APPROX); + } + + public void setDateIsApprox(final Boolean dateIsApprox) { + set(DATE_IS_APPROX, dateIsApprox); + } + + public String getLead() { + return (String) get(LEAD); + } + + public void setLead(final String lead) { + set(LEAD, lead); + } + + @Override + public String getSearchSummary() { + return com.arsdigita.util.StringUtils.truncateString(getLead(), + 200, + true); + } + +} diff --git a/ccm-cms-types-historicdate/src/com/arsdigita/cms/contenttypes/HistoricDateGlobalizationUtil.java b/ccm-cms-types-historicdate/src/com/arsdigita/cms/contenttypes/HistoricDateGlobalizationUtil.java new file mode 100644 index 000000000..c3b0b15d0 --- /dev/null +++ b/ccm-cms-types-historicdate/src/com/arsdigita/cms/contenttypes/HistoricDateGlobalizationUtil.java @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2014 Jens Pelzetter All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +package com.arsdigita.cms.contenttypes; + +import com.arsdigita.globalization.GlobalizedMessage; + +/** + * + * @author Jens Pelzetter + */ +public class HistoricDateGlobalizationUtil { + + public final static String BUNDLE_NAME = "com.arsdigita.cms.contenttypes.HistoricDateResources"; + + + public static GlobalizedMessage globalize(final String key) { + return new GlobalizedMessage(key, BUNDLE_NAME); + } + + public static GlobalizedMessage globalize(final String key, final Object[] args) { + return new GlobalizedMessage(key, BUNDLE_NAME, args); + } +} diff --git a/ccm-cms-types-historicdate/src/com/arsdigita/cms/contenttypes/HistoricDateLoader.java b/ccm-cms-types-historicdate/src/com/arsdigita/cms/contenttypes/HistoricDateLoader.java new file mode 100644 index 000000000..81c056267 --- /dev/null +++ b/ccm-cms-types-historicdate/src/com/arsdigita/cms/contenttypes/HistoricDateLoader.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2014 Jens Pelzetter All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package com.arsdigita.cms.contenttypes; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class HistoricDateLoader extends AbstractContentTypeLoader { + + private static final String[] TYPES = { + "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/HistoricDate.xml"}; + + @Override + public String[] getTypes() { + return TYPES; + } + +} diff --git a/ccm-cms-types-historicdate/src/com/arsdigita/cms/contenttypes/HistoricDateResources.properties b/ccm-cms-types-historicdate/src/com/arsdigita/cms/contenttypes/HistoricDateResources.properties new file mode 100644 index 000000000..9e74e5b9c --- /dev/null +++ b/ccm-cms-types-historicdate/src/com/arsdigita/cms/contenttypes/HistoricDateResources.properties @@ -0,0 +1,9 @@ +# 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. + +historicdate.ui.year=Year +historicdate.ui.month=Month +historicdate.ui.day_of_month=Day of Month +historicdate.ui.date_is_approx=Date is approximately +historicdate.ui.lead=Lead text diff --git a/ccm-cms-types-historicdate/src/com/arsdigita/cms/contenttypes/HistoricDateResources_de.properties b/ccm-cms-types-historicdate/src/com/arsdigita/cms/contenttypes/HistoricDateResources_de.properties new file mode 100644 index 000000000..88e3a34fe --- /dev/null +++ b/ccm-cms-types-historicdate/src/com/arsdigita/cms/contenttypes/HistoricDateResources_de.properties @@ -0,0 +1,9 @@ +# 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. + +historicdate.ui.year=Jahr +historicdate.ui.month=Monat +historicdate.ui.day_of_month=Tag +historicdate.ui.date_is_approx=Ungef\u00e4hres Datum +historicdate.ui.lead=Zusammenfassung diff --git a/ccm-cms-types-historicdate/src/com/arsdigita/cms/contenttypes/ui/HistoricDatePropertiesStep.java b/ccm-cms-types-historicdate/src/com/arsdigita/cms/contenttypes/ui/HistoricDatePropertiesStep.java new file mode 100644 index 000000000..f08aa8d3f --- /dev/null +++ b/ccm-cms-types-historicdate/src/com/arsdigita/cms/contenttypes/ui/HistoricDatePropertiesStep.java @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2002-2004 Red Hat Inc. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +package com.arsdigita.cms.contenttypes.ui; + +import com.arsdigita.bebop.Component; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.HistoricDate; +import com.arsdigita.cms.contenttypes.HistoricDateGlobalizationUtil; +import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; +import com.arsdigita.cms.ui.authoring.BasicPageForm; +import com.arsdigita.cms.ui.authoring.SimpleEditStep; +import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess; +import com.arsdigita.cms.util.GlobalizationUtil; +import com.arsdigita.toolbox.ui.DomainObjectPropertySheet; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class HistoricDatePropertiesStep extends SimpleEditStep { + + public static String EDIT_SHEET_NAME = "edit"; + + public HistoricDatePropertiesStep(final ItemSelectionModel itemModel, + AuthoringKitWizard parent) { + super(itemModel, parent); + + setDefaultEditKey(EDIT_SHEET_NAME); + final BasicPageForm editSheet = new HistoricDatePropertyForm(itemModel, this); + add(EDIT_SHEET_NAME, + GlobalizationUtil.globalize("cms.ui.edit"), + new WorkflowLockedComponentAccess(editSheet, itemModel), + editSheet.getSaveCancelSection().getCancelButton()); + + setDisplayComponent(getHistoricDatePropertySheet(itemModel)); + } + + public static Component getHistoricDatePropertySheet(final ItemSelectionModel itemModel) { + + final DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel); + + sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.title"), HistoricDate.TITLE); + sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.name"), HistoricDate.NAME); + + sheet.add(HistoricDateGlobalizationUtil.globalize("historicdate.ui.year"), + HistoricDate.YEAR); + sheet.add(HistoricDateGlobalizationUtil.globalize("historicdate.ui.month"), + HistoricDate.MONTH); + sheet.add(HistoricDateGlobalizationUtil.globalize("historicdate.ui.day_of_month"), + HistoricDate.DAY_OF_MONTH); + + sheet.add(HistoricDateGlobalizationUtil.globalize("historicdate.ui.date_is_approx"), + HistoricDate.DATE_IS_APPROX); + + sheet.add(HistoricDateGlobalizationUtil.globalize("historicdate.ui.lead"), + HistoricDate.LEAD); + + return sheet; + + } +} diff --git a/ccm-cms-types-historicdate/src/com/arsdigita/cms/contenttypes/ui/HistoricDatePropertyForm.java b/ccm-cms-types-historicdate/src/com/arsdigita/cms/contenttypes/ui/HistoricDatePropertyForm.java new file mode 100644 index 000000000..f2e57417f --- /dev/null +++ b/ccm-cms-types-historicdate/src/com/arsdigita/cms/contenttypes/ui/HistoricDatePropertyForm.java @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2014 Jens Pelzetter All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package com.arsdigita.cms.contenttypes.ui; + +import com.arsdigita.bebop.FormData; +import com.arsdigita.bebop.FormProcessException; +import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.event.FormInitListener; +import com.arsdigita.bebop.event.FormProcessListener; +import com.arsdigita.bebop.event.FormSectionEvent; +import com.arsdigita.bebop.event.FormSubmissionListener; +import com.arsdigita.bebop.form.CheckboxGroup; +import com.arsdigita.bebop.form.Option; +import com.arsdigita.bebop.form.TextArea; +import com.arsdigita.bebop.form.TextField; +import com.arsdigita.bebop.parameters.IntegerParameter; +import com.arsdigita.bebop.parameters.ParameterModel; +import com.arsdigita.bebop.parameters.StringParameter; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.HistoricDate; +import com.arsdigita.cms.contenttypes.HistoricDateGlobalizationUtil; +import com.arsdigita.cms.ui.authoring.BasicPageForm; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class HistoricDatePropertyForm extends BasicPageForm implements FormProcessListener, + FormSubmissionListener, + FormInitListener { + + public static final String FORM_ID = "historic_date_edit"; + private HistoricDatePropertiesStep step; + private static final String APPROX = "approx"; + private CheckboxGroup dateIsApprox; + + public HistoricDatePropertyForm(final ItemSelectionModel itemModel) { + this(itemModel, null); + } + + public HistoricDatePropertyForm(final ItemSelectionModel itemModel, + final HistoricDatePropertiesStep step) { + super(FORM_ID, itemModel); + this.step = step; + addSubmissionListener(this); + } + + @Override + public void addWidgets() { + super.addWidgets(); + + add(new Label(HistoricDateGlobalizationUtil.globalize("historicdate.ui.year"))); + final IntegerParameter yearParam = new IntegerParameter(HistoricDate.YEAR); + final TextField year = new TextField(yearParam); + year.setLabel(HistoricDateGlobalizationUtil.globalize("historicdate.ui.year")); + add(year); + + add(new Label(HistoricDateGlobalizationUtil.globalize("historicdate.ui.month"))); + final IntegerParameter monthParam = new IntegerParameter(HistoricDate.MONTH); + final TextField month = new TextField(monthParam); + month.setLabel(HistoricDateGlobalizationUtil.globalize("historicdate.ui.month")); + add(month); + + add(new Label(HistoricDateGlobalizationUtil.globalize("historicdate.ui.day_of_month"))); + final IntegerParameter dayOfMonthParam = new IntegerParameter(HistoricDate.DAY_OF_MONTH); + final TextField dayOfMonth = new TextField(dayOfMonthParam); + dayOfMonth.setLabel(HistoricDateGlobalizationUtil.globalize("historicdate.ui.day_of_month")); + add(dayOfMonth); + + add(new Label(HistoricDateGlobalizationUtil.globalize("historicdate.ui.date_is_approx"))); + dateIsApprox = new CheckboxGroup(HistoricDate.DATE_IS_APPROX + "Group"); + dateIsApprox.setLabel(HistoricDateGlobalizationUtil.globalize( + "historicdate.ui.date_is_approx")); + dateIsApprox.addOption(new Option(HistoricDate.DATE_IS_APPROX, "")); + add(dateIsApprox); + + add(new Label(HistoricDateGlobalizationUtil.globalize("historicdate.ui.lead"))); + final ParameterModel leadParam = new StringParameter(HistoricDate.LEAD); + final TextArea lead = new TextArea(leadParam); + lead.setCols(80); + lead.setRows(24); + lead.setLabel(HistoricDateGlobalizationUtil.globalize("historicdate.ui.lead")); + add(lead); + } + + @Override + public void init(final FormSectionEvent event) throws FormProcessException { + final FormData data = event.getFormData(); + final HistoricDate historicDate = (HistoricDate) super.initBasicWidgets(event); + + data.put(HistoricDate.YEAR, historicDate.getYear()); + data.put(HistoricDate.MONTH, historicDate.getMonth()); + data.put(HistoricDate.DAY_OF_MONTH, historicDate.getDayOfMonth()); + + if ((historicDate.getDateIsApprox() == null) || !historicDate.getDateIsApprox()) { + dateIsApprox.setValue(event.getPageState(), ""); + } else { + dateIsApprox.setValue(event.getPageState(), new String[]{APPROX}); + } + + data.put(HistoricDate.LEAD, historicDate.getLead()); + } + + @Override + public void process(final FormSectionEvent event) throws FormProcessException { + final FormData data = event.getFormData(); + final HistoricDate historicDate = (HistoricDate) super.processBasicWidgets(event); + + if ((historicDate != null) + && getSaveCancelSection().getSaveButton().isSelected(event.getPageState())) { + historicDate.setYear((Integer) data.get(HistoricDate.YEAR)); + historicDate.setMonth((Integer) data.get(HistoricDate.MONTH)); + historicDate.setDayOfMonth((Integer) data.get(HistoricDate.DAY_OF_MONTH)); + + if (dateIsApprox.getValue(event.getPageState()) == null) { + historicDate.setDateIsApprox(false); + } else { + historicDate.setDateIsApprox(true); + } + + historicDate.setLead((String) data.get(HistoricDate.LEAD)); + + historicDate.save(); + } + + if (step != null) { + step.maybeForwardToNextStep(event.getPageState()); + } + + } + + @Override + public void submitted(final FormSectionEvent event) throws FormProcessException { + if ((step != null) + && getSaveCancelSection().getCancelButton().isSelected(event.getPageState())) { + step.cancelStreamlinedCreation(event.getPageState()); + } + } + +} diff --git a/ccm-core/src/com/arsdigita/bebop/parameters/DateParameter.java b/ccm-core/src/com/arsdigita/bebop/parameters/DateParameter.java index b548e0699..b1863ac4b 100755 --- a/ccm-core/src/com/arsdigita/bebop/parameters/DateParameter.java +++ b/ccm-core/src/com/arsdigita/bebop/parameters/DateParameter.java @@ -25,11 +25,11 @@ import java.util.GregorianCalendar; import javax.servlet.http.HttpServletRequest; /** - * A class that represents the model for date form parameters. + * A class that represents the model for date form parameters. * - * @author Karl Goldstein - * @author Uday Mathur - * @version $Id: DateParameter.java 287 2005-02-22 00:29:02Z sskracic $ + * @author Karl Goldstein + * @author Uday Mathur + * @version $Id: DateParameter.java 287 2005-02-22 00:29:02Z sskracic $ */ public class DateParameter extends ParameterModel { @@ -38,65 +38,63 @@ public class DateParameter extends ParameterModel { } /** - * This method returns a new Calendar object that is manipulated - * within transformValue to create a Date Object. This method should - * be overridden if you wish to use a Calendar other than the + * This method returns a new Calendar object that is manipulated within transformValue to create + * a Date Object. This method should be overridden if you wish to use a Calendar other than the * lenient GregorianCalendar. * - * @param request the servlet request from which Locale can be - * extracted if needed + * @param request the servlet request from which Locale can be extracted if needed * * @return a new Calendar object - * */ + * + */ protected Calendar getCalendar(HttpServletRequest request) { return new GregorianCalendar(); } /** - * Computes a date object from multiple parameters in the - * request. This method searches for parameters named - * getName() + ".year", getName() + + * Computes a date object from multiple parameters in the request. This method searches for + * parameters named getName() + ".year", getName() + * ".month" and getName() + ".day". It sets the - * fields HOUR, MINUTE and - * SECOND to 0, since they are by default the current - * time. - * */ + * fields HOUR, MINUTE and SECOND to 0, since they are by + * default the current time. + * + */ @Override public Object transformValue(HttpServletRequest request) throws IllegalArgumentException { Calendar c = null; - Object outVal = null; - try { + Object outVal = null; + try { - c = getCalendar(request); - c.clear(); - //don't accept lenient dates like June 44 - c.setLenient(false); + c = getCalendar(request); + c.clear(); + //don't accept lenient dates like June 44 + c.setLenient(false); - String year = Globalization.decodeParameter(request, getName()+".year"); - String month = Globalization.decodeParameter(request, getName()+".month"); - String day = Globalization.decodeParameter(request, getName()+".day"); + String year = Globalization.decodeParameter(request, getName() + ".year"); + String month = Globalization.decodeParameter(request, getName() + ".month"); + String day = Globalization.decodeParameter(request, getName() + ".day"); - if ( year == null && month == null && day == null ) { - return transformSingleValue(request); - } - if (day == null || day.length() == 0) { - return null; - } - if ( year != null ) { - c.set(Calendar.YEAR, Integer.parseInt(year)); - } - if ( month != null ) { - c.set(Calendar.MONTH, Integer.parseInt(month)); - } - if ( day != null ) { - c.set(Calendar.DATE, Integer.parseInt(day)); - } - outVal = c.getTime(); - } catch ( IllegalArgumentException e) { - throw new IllegalArgumentException("Invalid Day of Month"); - } - return outVal; + if (year == null && month == null && day == null) { + return transformSingleValue(request); + } + if (day == null || day.length() == 0) { + return null; + } + if (year != null) { + c.set(Calendar.YEAR, Integer.parseInt(year)); + } + if (month != null) { + c.set(Calendar.MONTH, Integer.parseInt(month)); + } + if (day != null) { + c.set(Calendar.DATE, Integer.parseInt(day)); + } + outVal = c.getTime(); + } catch (IllegalArgumentException e) { + throw new IllegalArgumentException("Invalid Day of Month"); + } + return outVal; } public Object unmarshal(String encoded) { @@ -104,7 +102,7 @@ public class DateParameter extends ParameterModel { return new Date(Long.parseLong(encoded)); } catch (NumberFormatException e) { throw new IllegalArgumentException("Cannot unmarshal date '" - + encoded +"': " + e.getMessage()); + + encoded + "': " + e.getMessage()); } } diff --git a/ccm-sci-bundle/web/themes/mandalay/includes/types.xsl b/ccm-sci-bundle/web/themes/mandalay/includes/types.xsl index 6114934cf..5d848184b 100755 --- a/ccm-sci-bundle/web/themes/mandalay/includes/types.xsl +++ b/ccm-sci-bundle/web/themes/mandalay/includes/types.xsl @@ -53,6 +53,7 @@ + diff --git a/ccm-sci-bundle/web/themes/mandalay/includes/types/HistoricDate.xsl b/ccm-sci-bundle/web/themes/mandalay/includes/types/HistoricDate.xsl new file mode 100644 index 000000000..2b8504612 --- /dev/null +++ b/ccm-sci-bundle/web/themes/mandalay/includes/types/HistoricDate.xsl @@ -0,0 +1,518 @@ + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + +
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + dynamic + + + +
+ + /ccm/cms-service/stream/image/?image_id=&maxWidth=150&maxHeight=100 + + + + + + + + + +
+
+
+ + + + + + + + + + + + + dynamic + + + + + + + dynamic + + + + + + + + + + + +
+ + /ccm/cms-service/stream/image/?image_id=&maxWidth=150&maxHeight=100 + + + + + + + + + +
+
+ +
+ + + + + + + + + ... + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /redirect/?oid= + + + + + + + + dynamic + + + + + + + + + + + + + + + + + + + + + + + + + + + + /redirect/?oid= + + + + + + + + dynamic + + + + + + + dynamic + + + + + + + + + dynamic + + + + +
+ + + + + + + + ... + + + + + + + + + + + + + + + +
+
+
+ + \ No newline at end of file diff --git a/ccm-sci-bundle/web/themes/mandalay/lang/de/HistoricDate.xml b/ccm-sci-bundle/web/themes/mandalay/lang/de/HistoricDate.xml new file mode 100644 index 000000000..9a2ae3022 --- /dev/null +++ b/ccm-sci-bundle/web/themes/mandalay/lang/de/HistoricDate.xml @@ -0,0 +1,32 @@ + + + + + + Deutsch + 0.8 + + mehr » + weiter lesen + + ca. + v. Chr. + + diff --git a/ccm-sci-bundle/web/themes/mandalay/lang/de/SciPublications.xml b/ccm-sci-bundle/web/themes/mandalay/lang/de/SciPublications.xml index a9ee4e6fc..13911f247 100644 --- a/ccm-sci-bundle/web/themes/mandalay/lang/de/SciPublications.xml +++ b/ccm-sci-bundle/web/themes/mandalay/lang/de/SciPublications.xml @@ -94,11 +94,12 @@ Publikationsdatum Referierter Artikel Weitere Informationen - Ausgabe + Ausgabe Jahrgang Jahr Beiträge Referierter Artikel + Erste Veröffentlichung Zusammenfassung Artikel diff --git a/ccm-sci-bundle/web/themes/mandalay/lang/de/footerMenu.xml b/ccm-sci-bundle/web/themes/mandalay/lang/de/footerMenu.xml index 348353a22..607da3402 100755 --- a/ccm-sci-bundle/web/themes/mandalay/lang/de/footerMenu.xml +++ b/ccm-sci-bundle/web/themes/mandalay/lang/de/footerMenu.xml @@ -31,4 +31,5 @@ Webmaster Impressum Bildnachweis + ScientificCMS diff --git a/ccm-sci-bundle/web/themes/mandalay/lang/en/HistoricDate.xml b/ccm-sci-bundle/web/themes/mandalay/lang/en/HistoricDate.xml new file mode 100644 index 000000000..591f367b3 --- /dev/null +++ b/ccm-sci-bundle/web/themes/mandalay/lang/en/HistoricDate.xml @@ -0,0 +1,32 @@ + + + + + + English + 0.8 + + more » + read more + + approx. + BC + + diff --git a/ccm-sci-bundle/web/themes/mandalay/lang/en/SciPublications.xml b/ccm-sci-bundle/web/themes/mandalay/lang/en/SciPublications.xml index 4711172c7..eb1ede074 100644 --- a/ccm-sci-bundle/web/themes/mandalay/lang/en/SciPublications.xml +++ b/ccm-sci-bundle/web/themes/mandalay/lang/en/SciPublications.xml @@ -96,6 +96,7 @@ Year Articles Reviewed article + First published Abstract Articles diff --git a/ccm-sci-bundle/web/themes/mandalay/layout/navigation.xml b/ccm-sci-bundle/web/themes/mandalay/layout/navigation.xml index a273bae62..49b470064 100755 --- a/ccm-sci-bundle/web/themes/mandalay/layout/navigation.xml +++ b/ccm-sci-bundle/web/themes/mandalay/layout/navigation.xml @@ -143,35 +143,35 @@
- + -
- -