Globalisierung eingerichtet.

git-svn-id: https://svn.libreccm.org/ccm/trunk@454 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2010-06-04 22:32:11 +00:00
parent 0410f15079
commit fe681cfcbc
11 changed files with 216 additions and 69 deletions

View File

@ -1,8 +1,9 @@
package com.arsdigita.cms.contentassets; package com.arsdigita.cms.contentassets;
import com.arsdigita.cms.contentassets.ui.FileDescriptionForm; import com.arsdigita.cms.contentassets.ui.FileDescriptionForm;
import com.arsdigita.bebop.FormSection;
import com.arsdigita.runtime.AbstractConfig; import com.arsdigita.runtime.AbstractConfig;
import com.arsdigita.util.parameter.ClassParameter; import com.arsdigita.util.parameter.SpecificClassParameter;
import com.arsdigita.util.parameter.BooleanParameter; import com.arsdigita.util.parameter.BooleanParameter;
import com.arsdigita.util.parameter.Parameter; import com.arsdigita.util.parameter.Parameter;
@ -15,12 +16,11 @@ public class FileAttachmentConfig extends AbstractConfig {
* Constructor, don't use is directly! * Constructor, don't use is directly!
*/ */
public FileAttachmentConfig() { public FileAttachmentConfig() {
editFormClass = new ClassParameter ("com.arsdigita.cms.contentassets.file_edit_form",
editFormClass = new SpecificClassParameter ("com.arsdigita.cms.contentassets.file_edit_form",
Parameter.REQUIRED, Parameter.REQUIRED,
FileDescriptionForm.class FileDescriptionForm.class,
// TODO move *private* class ContentSectionConfig.SpecificClassParameter to c.a.util.parameter FormSection.class
// so we can use it here.
// , FormSection.class
); );
showAssetID = new BooleanParameter("com.arsdigita.cms.contentassets.file_show_asset_id", showAssetID = new BooleanParameter("com.arsdigita.cms.contentassets.file_show_asset_id",
Parameter.OPTIONAL, Parameter.OPTIONAL,

View File

@ -0,0 +1,77 @@
/*
* Copyright (C) 2010 Peter Boy (pb@zes.uni-remen.de)
*
* The contents of this file are subject to the Open Software License v2.1
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
* http://rhea.redhat.com/licenses/osl2.1.html.
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
*/
package com.arsdigita.cms.contentassets;
import com.arsdigita.globalization.GlobalizedMessage;
/**
* Service routine tp provide localized versions of key strings for the
* FileAttachment UI and messages.
*
* @author pb
* @version $Id: $
*/
public class FileAttachmentGlobalize {
/**
* The label for the authoring step
*/
public static GlobalizedMessage AuthoringStepLabel() {
return new GlobalizedMessage(
"com.arsdigita.cms.contentassets.file_attachment_label",
"com.arsdigita.cms.contentassets.FileAttachmentResources");
}
/**
* The description for the authoring step
*/
public static GlobalizedMessage AuthoringStepDescription() {
return new GlobalizedMessage(
"com.arsdigita.cms.contentassets.file_attachment_description",
"com.arsdigita.cms.contentassets.FileAttachmentResources");
}
/**
* Label for File Type selection box.
*/
public static GlobalizedMessage FileTypeLabel() {
return new GlobalizedMessage(
"com.arsdigita.cms.contentassets.file_type_label",
"com.arsdigita.cms.contentassets.FileAttachmentResources");
}
/**
* Label for File Type selection box.
*/
public static GlobalizedMessage NoFilesAssociatedMsg() {
return new GlobalizedMessage(
"com.arsdigita.cms.contentassets.no_files_associated_msg",
"com.arsdigita.cms.contentassets.FileAttachmentResources");
}
/**
* Label for File Type selection box.
*/
public static GlobalizedMessage UploadNewFileLabel() {
return new GlobalizedMessage(
"com.arsdigita.cms.contentassets.upload_new_file_label",
"com.arsdigita.cms.contentassets.FileAttachmentResources");
}
}

View File

@ -21,7 +21,6 @@ import com.arsdigita.domain.xml.TraversalHandler;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.kernel.URLService; import com.arsdigita.kernel.URLService;
import com.arsdigita.runtime.DomainInitEvent; import com.arsdigita.runtime.DomainInitEvent;
import com.arsdigita.runtime.LegacyInitEvent;
import com.arsdigita.search.MetadataProviderRegistry; import com.arsdigita.search.MetadataProviderRegistry;
import com.arsdigita.xml.XML; import com.arsdigita.xml.XML;
@ -32,47 +31,24 @@ import com.arsdigita.xml.XML;
* @version $Revision: 1.1 $ $Date: 2004/12/15 15:37:51 $ * @version $Revision: 1.1 $ $Date: 2004/12/15 15:37:51 $
* @version $Id: FileAttachmentInitializer.java 1262 2006-07-17 08:15:45Z cgyg9330 $ * @version $Id: FileAttachmentInitializer.java 1262 2006-07-17 08:15:45Z cgyg9330 $
**/ **/
public class FileAttachmentInitializer extends ContentAssetInitializer { public class FileAttachmentInitializer extends ContentAssetInitializer {
/**
* Constructor
*/
public FileAttachmentInitializer() { public FileAttachmentInitializer() {
super("ccm-cms-assets-fileattachment.pdl.mf"); super("ccm-cms-assets-fileattachment.pdl.mf");
} }
public String getTraversalXML() { /**
return "/WEB-INF/traversal-adapters/com/arsdigita/" * Initializes content asset by parsing traversal xml file and registering
+ "cms/contentassets/FileAttachment.xml"; * the specified steps in a transient storage which may be modified during
} * operation and has to be re-initialized each system startup).
* Essential part of initializing the systems domain coupling machinery.
public String getProperty() { * @param evt
return "fileAttachments"; */
} @Override
public String getBaseType() {
return ContentPage.BASE_DATA_OBJECT_TYPE;
}
public Class getAuthoringStep() {
return FileAttachmentsStep.class;
}
public GlobalizedMessage getAuthoringStepLabel() {
return new GlobalizedMessage(
"com.arsdigita.cms.contentassets.file_attachment_label",
"com.arsdigita.cms.contentassets.FileAttachmentResources");
}
public GlobalizedMessage getAuthoringStepDescription() {
return new GlobalizedMessage(
"com.arsdigita.cms.contentassets.file_attachment_description",
"com.arsdigita.cms.contentassets.FileAttachmentResources");
}
public int getAuthoringStepSortKey() {
return 2; // XXX config param please
}
// public void init(LegacyInitEvent evt) {
public void init(DomainInitEvent evt) { public void init(DomainInitEvent evt) {
super.init(evt); super.init(evt);
@ -95,10 +71,74 @@ public class FileAttachmentInitializer extends ContentAssetInitializer {
MetadataProviderRegistry.registerAdapter( MetadataProviderRegistry.registerAdapter(
FileAttachment.BASE_DATA_OBJECT_TYPE, FileAttachment.BASE_DATA_OBJECT_TYPE,
new FileAttachmentMetadataProvider()); new FileAttachmentMetadataProvider());
XML.parseResource( XML.parseResource(
"/WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/" "/WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/"
+ "FileAttachment-search.xml", + "FileAttachment-search.xml",
new TraversalHandler()); new TraversalHandler());
} }
/**
* The base type against which the asset is defined,
* typically com.arsdigita.cms.ContentPage
*/
public String getBaseType() {
return ContentPage.BASE_DATA_OBJECT_TYPE;
}
/**
* Returns the path to the XML file defintions for the
* asset,
* eg /WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/FileAttachments.xml
*/
public String getTraversalXML() {
return "/WEB-INF/traversal-adapters/com/arsdigita/"
+ "cms/contentassets/FileAttachment.xml";
}
/**
* The name of the association between the item
* and the asset, eg 'fileAttachments'.
*/
public String getProperty() {
return "fileAttachments";
}
/**
* The class of the authoring kit step
*/
public Class getAuthoringStep() {
return FileAttachmentsStep.class;
}
/**
* The label for the authoring step
* @deprecated has to be replaced to provide LabelKey, see contgentAssetInitializer
*/
public GlobalizedMessage getAuthoringStepLabel() {
return FileAttachmentGlobalize.AuthoringStepLabel();
// return new GlobalizedMessage(
// "com.arsdigita.cms.contentassets.file_attachment_label",
// "com.arsdigita.cms.contentassets.FileAttachmentResources");
}
/**
* The description for the authoring step
* @deprecated has to be replaced to provide DesciptionKey, see contgentAssetInitializer
*/
public GlobalizedMessage getAuthoringStepDescription() {
return FileAttachmentGlobalize.AuthoringStepDescription();
// return new GlobalizedMessage(
// "com.arsdigita.cms.contentassets.file_attachment_description",
// "com.arsdigita.cms.contentassets.FileAttachmentResources");
}
/**
* The sort key for the authoring step
*/
public int getAuthoringStepSortKey() {
return 2; // XXX config param please
}
} }

View File

@ -1,2 +1,7 @@
com.arsdigita.cms.contentassets.file_attachment_label=Attach files cms.contentassets.file_attachment_label=Attach files
com.arsdigita.cms.contentassets.file_attachment_description=Attach files cms.contentassets.file_attachment_description=Attach files
cms.contentassets.file_type_label=File Type:
cms.contentassets.no_files_associated_msg=This item does not have any associated files.
cms.contentassets.upload_new_file_label=Upload a new file
cms.contentassets.tableheader_file=File
cms.contentassets.tableheader_description=Description

View File

@ -1,2 +1,7 @@
com.arsdigita.cms.contentassets.file_attachment_label=Dateien anf\u00FCgen cms.contentassets.file_attachment_label=Dateien anf\u00FCgen
com.arsdigita.cms.contentassets.file_attachment_description=Dateien anf\u00FCgen cms.contentassets.file_attachment_description=Dateien anf\u00FCgen
cms.contentassets.file_type_label=Datei Typ:
cms.contentassets.no_files_associated_msg=Diesem Dokument sind keine Dateien zum Download zugeordnet.
cms.contentassets.upload_new_file_label=Neue Datei hochladen
cms.contentassets.tableheader_file=Datei
cms.contentassets.tableheader_description=Beschreibung

View File

@ -42,8 +42,7 @@ public class FileAttachmentURLFinder implements URLFinder {
private static final AssetURLFinder s_assetFinder = new AssetURLFinder(); private static final AssetURLFinder s_assetFinder = new AssetURLFinder();
/** /**
* * Find URL for a file attachment by finding its article
* find URL for a file attachment by finding its article
* *
* @param oid the OID of the file attachment * @param oid the OID of the file attachment
* @param content the context of the search (ie draft/live) * @param content the context of the search (ie draft/live)
@ -74,8 +73,7 @@ public class FileAttachmentURLFinder implements URLFinder {
} }
/** /**
* * Find URL for the live context of a file attachment. Delegates to
* find URL for the live context of a file attachment. Delegates to
* AssetURLFinder. * AssetURLFinder.
* *
* @param oid the OID of the file attachment * @param oid the OID of the file attachment

View File

@ -30,7 +30,7 @@ import com.arsdigita.web.URL;
/** /**
* *
* Builds a table model of contacts * Builds a table model of ( copy and paste error:) contacts
* *
* @author Richard Su (richard.su@alum.mit.edu) * @author Richard Su (richard.su@alum.mit.edu)
* @version $Id: FileAttachmentModelBuilder.java 1592 2007-06-21 16:48:55Z lbcfrancois $ * @version $Id: FileAttachmentModelBuilder.java 1592 2007-06-21 16:48:55Z lbcfrancois $
@ -40,6 +40,7 @@ public class FileAttachmentModelBuilder extends AbstractTableModelBuilder {
private Table m_table; private Table m_table;
private ItemSelectionModel m_model; private ItemSelectionModel m_model;
/** /**
* Constructor * Constructor
**/ **/

View File

@ -29,6 +29,7 @@ import com.arsdigita.bebop.parameters.NotNullValidationListener;
import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contentassets.FileAttachment; import com.arsdigita.cms.contentassets.FileAttachment;
import com.arsdigita.cms.contentassets.FileAttachmentGlobalize;
import com.arsdigita.cms.ui.FileUploadSection; import com.arsdigita.cms.ui.FileUploadSection;
import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.mimetypes.ImageMimeType; import com.arsdigita.mimetypes.ImageMimeType;
@ -123,7 +124,8 @@ public class FileAttachmentUpload extends Form
// Add the widgets // Add the widgets
public void addWidgets() { public void addWidgets() {
m_fileUploadSection = m_fileUploadSection =
new FileUploadSection("File Type:", "file", new FileUploadSection(FileAttachmentGlobalize.FileTypeLabel(),
"file",
ImageMimeType.MIME_IMAGE_JPEG); ImageMimeType.MIME_IMAGE_JPEG);
m_fileUploadSection.getFileUploadWidget() m_fileUploadSection.getFileUploadWidget()
.addValidationListener(new NotNullValidationListener()); .addValidationListener(new NotNullValidationListener());

View File

@ -27,6 +27,7 @@ import com.arsdigita.bebop.parameters.BigDecimalParameter;
import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contentassets.FileAttachment; import com.arsdigita.cms.contentassets.FileAttachment;
import com.arsdigita.cms.contentassets.FileAttachmentGlobalize;
import com.arsdigita.cms.ui.CMSContainer; import com.arsdigita.cms.ui.CMSContainer;
import com.arsdigita.cms.ui.SecurityPropertyEditor; import com.arsdigita.cms.ui.SecurityPropertyEditor;
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
@ -70,7 +71,7 @@ public class FileAttachmentsStep extends SecurityPropertyEditor {
m_fileList = new FileAttachmentsTable(m_item, m_fileModel); m_fileList = new FileAttachmentsTable(m_item, m_fileModel);
m_display = new CMSContainer(); m_display = new CMSContainer();
//Main label //Main label
Label mainLabel = new Label("This item does not have any associated files."); Label mainLabel = new Label(FileAttachmentGlobalize.NoFilesAssociatedMsg());
mainLabel.setFontWeight(Label.ITALIC); mainLabel.setFontWeight(Label.ITALIC);
mainLabel.addPrintListener( new PrintListener() { mainLabel.addPrintListener( new PrintListener() {
public void prepare(PrintEvent event) { public void prepare(PrintEvent event) {
@ -81,7 +82,7 @@ public class FileAttachmentsStep extends SecurityPropertyEditor {
Label mainTarget = (Label) event.getTarget(); Label mainTarget = (Label) event.getTarget();
if (files.isEmpty()) { if (files.isEmpty()) {
mainTarget.setLabel( mainTarget.setLabel(
"This item does not have any associated files."); FileAttachmentGlobalize.NoFilesAssociatedMsg());
} else { } else {
mainTarget.setLabel(""); mainTarget.setLabel("");
} }
@ -94,7 +95,11 @@ public class FileAttachmentsStep extends SecurityPropertyEditor {
// The upload form. // The upload form.
m_uploadForm = new FileAttachmentUpload(m_item); m_uploadForm = new FileAttachmentUpload(m_item);
add("upload", "Upload a new file", add("upload",
// XXX todo: use of tostring() is ugly and not supported API. add method
// has to be refactored to accept a GlobalizedMessage as Parameter instead
// of a plain string for the Label (2. parameter) !
FileAttachmentGlobalize.UploadNewFileLabel().toString(),
new WorkflowLockedComponentAccess(m_uploadForm, m_item), new WorkflowLockedComponentAccess(m_uploadForm, m_item),
m_uploadForm.getSaveCancelSection().getCancelButton()); m_uploadForm.getSaveCancelSection().getCancelButton());

View File

@ -1,3 +1,17 @@
/*
* Copyright (C) 2004 Red Hat Inc. All Rights Reserved.
*
* The contents of this file are subject to the Open Software License v2.1
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
* http://rhea.redhat.com/licenses/osl2.1.html.
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
*/
package com.arsdigita.cms.contentassets.ui; package com.arsdigita.cms.contentassets.ui;
import com.arsdigita.bebop.ColumnPanel; import com.arsdigita.bebop.ColumnPanel;