From d4f138bc480da468c37967091db244b243fc5318 Mon Sep 17 00:00:00 2001 From: pb Date: Sun, 9 Jun 2013 17:50:47 +0000 Subject: [PATCH] =?UTF-8?q?Anpassung=20und=20Vervollst=C3=A4ndigung=20Reso?= =?UTF-8?q?urceBundles=20sowie=20Sprachumschaltung=20abgeschlossen.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.libreccm.org/ccm/trunk@2196 8810af33-2d31-482b-a856-94f89814c4df --- .../InlineSiteResources.properties | 1 + .../InlineSiteResources_de.properties | 1 + .../InlineSiteResources_fr.properties | 1 + .../ui/InlineSitePropertiesStep.java | 44 +++++++++++++-- .../util/InlineSiteGlobalizationUtil.java | 56 +++++++++++++++++++ .../util/LegalNoticeGlobalizationUtil.java | 56 +++++++++++++++++++ 6 files changed, 155 insertions(+), 4 deletions(-) create mode 100755 ccm-cms-types-inlinesite/src/com/arsdigita/cms/contenttypes/InlineSiteResources.properties create mode 100644 ccm-cms-types-inlinesite/src/com/arsdigita/cms/contenttypes/InlineSiteResources_de.properties create mode 100755 ccm-cms-types-inlinesite/src/com/arsdigita/cms/contenttypes/InlineSiteResources_fr.properties create mode 100755 ccm-cms-types-inlinesite/src/com/arsdigita/cms/contenttypes/util/InlineSiteGlobalizationUtil.java create mode 100644 ccm-cms-types-legalnotice/src/com/arsdigita/cms/contenttypes/util/LegalNoticeGlobalizationUtil.java diff --git a/ccm-cms-types-inlinesite/src/com/arsdigita/cms/contenttypes/InlineSiteResources.properties b/ccm-cms-types-inlinesite/src/com/arsdigita/cms/contenttypes/InlineSiteResources.properties new file mode 100755 index 000000000..359ec7c9d --- /dev/null +++ b/ccm-cms-types-inlinesite/src/com/arsdigita/cms/contenttypes/InlineSiteResources.properties @@ -0,0 +1 @@ +cms.contenttypes.ui.inlinesite.url=Site Url: diff --git a/ccm-cms-types-inlinesite/src/com/arsdigita/cms/contenttypes/InlineSiteResources_de.properties b/ccm-cms-types-inlinesite/src/com/arsdigita/cms/contenttypes/InlineSiteResources_de.properties new file mode 100644 index 000000000..00193424d --- /dev/null +++ b/ccm-cms-types-inlinesite/src/com/arsdigita/cms/contenttypes/InlineSiteResources_de.properties @@ -0,0 +1 @@ +cms.contenttypes.ui.inlinesite.url=Url der Seite: diff --git a/ccm-cms-types-inlinesite/src/com/arsdigita/cms/contenttypes/InlineSiteResources_fr.properties b/ccm-cms-types-inlinesite/src/com/arsdigita/cms/contenttypes/InlineSiteResources_fr.properties new file mode 100755 index 000000000..aa9fa9bde --- /dev/null +++ b/ccm-cms-types-inlinesite/src/com/arsdigita/cms/contenttypes/InlineSiteResources_fr.properties @@ -0,0 +1 @@ +cms.contenttypes.ui.inlinesite.url=Site URL: diff --git a/ccm-cms-types-inlinesite/src/com/arsdigita/cms/contenttypes/ui/InlineSitePropertiesStep.java b/ccm-cms-types-inlinesite/src/com/arsdigita/cms/contenttypes/ui/InlineSitePropertiesStep.java index 8ce3087df..c274270fa 100755 --- a/ccm-cms-types-inlinesite/src/com/arsdigita/cms/contenttypes/ui/InlineSitePropertiesStep.java +++ b/ccm-cms-types-inlinesite/src/com/arsdigita/cms/contenttypes/ui/InlineSitePropertiesStep.java @@ -21,12 +21,19 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.cms.contenttypes.InlineSite; import com.arsdigita.bebop.Component; +import com.arsdigita.bebop.PageState; +import com.arsdigita.cms.ContentPage; +import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.ui.authoring.BasicPageForm; import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.util.InlineSiteGlobalizationUtil; import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; import com.arsdigita.cms.ui.authoring.SimpleEditStep; import com.arsdigita.toolbox.ui.DomainObjectPropertySheet; import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess; +import com.arsdigita.cms.util.GlobalizationUtil; +import com.arsdigita.domain.DomainObject; +import java.text.DateFormat; /** @@ -65,10 +72,39 @@ public class InlineSitePropertiesStep itemModel ) { DomainObjectPropertySheet sheet = new DomainObjectPropertySheet( itemModel ); - sheet.add( "Name:", InlineSite.NAME ); - sheet.add( "Title:", InlineSite.TITLE ); - sheet.add( "Description:", InlineSite.DESCRIPTION); - sheet.add( "URL:", InlineSite.URL ); + sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.title"), + InlineSite.TITLE); + sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.name"), + InlineSite.NAME ); + + if (!ContentSection.getConfig().getHideLaunchDate()) { + sheet.add(GlobalizationUtil + .globalize("cms.contenttypes.ui.launch_date"), + ContentPage.LAUNCH_DATE, + new DomainObjectPropertySheet.AttributeFormatter() { + + @Override + public String format(DomainObject item, + String attribute, + PageState state) { + ContentPage page = (ContentPage) item; + if (page.getLaunchDate() != null) { + return DateFormat + .getDateInstance(DateFormat.LONG) + .format(page.getLaunchDate()); + } else { + return (String) GlobalizationUtil + .globalize("cms.ui.unknown") + .localize(); + } + } + }); + } + sheet.add( GlobalizationUtil.globalize("cms.contenttypes.ui.summary"), + InlineSite.DESCRIPTION); + sheet.add( InlineSiteGlobalizationUtil + .globalize("cms.contenttypes.ui.inlinesite.url"), + InlineSite.URL ); return sheet; } diff --git a/ccm-cms-types-inlinesite/src/com/arsdigita/cms/contenttypes/util/InlineSiteGlobalizationUtil.java b/ccm-cms-types-inlinesite/src/com/arsdigita/cms/contenttypes/util/InlineSiteGlobalizationUtil.java new file mode 100755 index 000000000..fd5a6cb4b --- /dev/null +++ b/ccm-cms-types-inlinesite/src/com/arsdigita/cms/contenttypes/util/InlineSiteGlobalizationUtil.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 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.util; + +import com.arsdigita.globalization.Globalized; +import com.arsdigita.globalization.GlobalizedMessage; + +/** + * Compilation of methods to simplify the handling of globalizing keys. + * Basically it adds the name of package's resource bundle files to the + * globalize methods and forwards to GlobalizedMessage, shortening the + * method invocation in the various application classes. + * + * @author randyg@arsdigita.com + * @version $Revision: #4 $ $Date: 2004/08/17 $ + */ + +public class InlineSiteGlobalizationUtil implements Globalized { + + /** Name of Java resource files to handle FAQ's globalisation. */ + final public static String BUNDLE_NAME = + "com.arsdigita.cms.contenttypes.InlineSiteResources"; + + /** + * This returns a globalized message using the package specific bundle, + * provided by BUNDLE_NAME. + */ + public static GlobalizedMessage globalize(String key) { + return new GlobalizedMessage(key, BUNDLE_NAME); + } + + /** + * Returns a globalized message object, using the package specific bundle, + * as specified by BUNDLE_NAME. Also takes in an Object[] of arguments to + * interpolate into the retrieved message using the MessageFormat class. + */ + public static GlobalizedMessage globalize(String key, Object[] args) { + return new GlobalizedMessage(key, BUNDLE_NAME, args); + } +} diff --git a/ccm-cms-types-legalnotice/src/com/arsdigita/cms/contenttypes/util/LegalNoticeGlobalizationUtil.java b/ccm-cms-types-legalnotice/src/com/arsdigita/cms/contenttypes/util/LegalNoticeGlobalizationUtil.java new file mode 100644 index 000000000..c5bb643f4 --- /dev/null +++ b/ccm-cms-types-legalnotice/src/com/arsdigita/cms/contenttypes/util/LegalNoticeGlobalizationUtil.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 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.util; + +import com.arsdigita.globalization.Globalized; +import com.arsdigita.globalization.GlobalizedMessage; + +/** + * Compilation of methods to simplify the handling of globalizing keys. + * Basically it adds the name of package's resource bundle files to the + * globalize methods and forwards to GlobalizedMessage, shortening the + * method invocation in the various application classes. + * + * @author randyg@arsdigita.com + * @version $Revision: #4 $ $Date: 2004/08/17 $ + */ + +public class LegalNoticeGlobalizationUtil implements Globalized { + + /** Name of Java resource files to handle FAQ's globalisation. */ + final public static String BUNDLE_NAME = + "com.arsdigita.cms.contenttypes.LegalNoticeResources"; + + /** + * This returns a globalized message using the package specific bundle, + * provided by BUNDLE_NAME. + */ + public static GlobalizedMessage globalize(String key) { + return new GlobalizedMessage(key, BUNDLE_NAME); + } + + /** + * Returns a globalized message object, using the package specific bundle, + * as specified by BUNDLE_NAME. Also takes in an Object[] of arguments to + * interpolate into the retrieved message using the MessageFormat class. + */ + public static GlobalizedMessage globalize(String key, Object[] args) { + return new GlobalizedMessage(key, BUNDLE_NAME, args); + } +}