CCM NG/ccm-cms: Some bugfixes and translations for the BinaryAssetForm
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4681 8810af33-2d31-482b-a856-94f89814c4df
Former-commit-id: 90c73c0e34
pull/2/head
parent
554e201452
commit
c62d231f0c
|
|
@ -34,6 +34,9 @@ import java.io.File;
|
|||
import javax.activation.MimeType;
|
||||
import javax.activation.MimeTypeParseException;
|
||||
import javax.activation.MimetypesFileTypeMap;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletRequestWrapper;
|
||||
import org.librecms.CmsConstants;
|
||||
|
||||
/**
|
||||
|
|
@ -372,15 +375,25 @@ public class FileUploadSection extends FormSection {
|
|||
final String fileName = getFileName(event);
|
||||
|
||||
if (fileName != null && fileName.length() > 0) {
|
||||
return ((MultipartHttpServletRequest) event
|
||||
return ((MultipartHttpServletRequest) unwrapRequest(event
|
||||
.getPageState()
|
||||
.getRequest())
|
||||
.getRequest()))
|
||||
.getFile(getFileUploadWidgetName());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private ServletRequest unwrapRequest(final HttpServletRequest request) {
|
||||
|
||||
ServletRequest current = request;
|
||||
while (current instanceof HttpServletRequestWrapper) {
|
||||
current = ((HttpServletRequestWrapper) current).getRequest();
|
||||
}
|
||||
|
||||
return current;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain a filename from the file upload widget. The containing form should
|
||||
* call this method in its process listener.
|
||||
|
|
@ -449,7 +462,8 @@ public class FileUploadSection extends FormSection {
|
|||
* Add mime-type options to the option group by loading all mime types which
|
||||
* match a certain prefix from the database
|
||||
*
|
||||
* @param mimeTypeOptions The mime type widget to which options should be added
|
||||
* @param mimeTypeOptions The mime type widget to which options should be
|
||||
* added
|
||||
*
|
||||
* @param mimePrefix Populate the mime type widget with all mime types that
|
||||
* match the prefix. Some of the possible prefixes are "text", "image",
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ public abstract class BinaryAssetForm extends AssetForm {
|
|||
CmsConstants.CMS_BUNDLE),
|
||||
"",
|
||||
"");
|
||||
panel.add(fileUpload);
|
||||
|
||||
add(panel);
|
||||
}
|
||||
|
|
@ -117,9 +118,17 @@ public abstract class BinaryAssetForm extends AssetForm {
|
|||
.getDescription()
|
||||
.getValue(getSelectedLocale(state)));
|
||||
|
||||
fileName.setText(binaryAsset.getFileName());
|
||||
mimeType.setText(binaryAsset.getMimeType().toString());
|
||||
size.setText(Long.toString(binaryAsset.getSize()));
|
||||
if (binaryAsset.getData() == null
|
||||
|| binaryAsset.getData().length == 0) {
|
||||
fileName.setText("-");
|
||||
mimeType.setText("-");
|
||||
size.setText("-");
|
||||
} else {
|
||||
|
||||
fileName.setText(binaryAsset.getFileName());
|
||||
mimeType.setText(binaryAsset.getMimeType().toString());
|
||||
size.setText(Long.toString(binaryAsset.getSize()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -266,3 +266,7 @@ cms.ui.assets.search_page.title=Select an asset
|
|||
cms.ui.assets.search_page.query=Search for
|
||||
cms.ui.assets.search_page.query.submit=Find
|
||||
cms.ui.assets.external_video_asset.legal_metadata.label=Legal metadata
|
||||
cms.ui.assets.binaryasset.description=Description
|
||||
cms.ui.assets.binaryasset.filename=File name
|
||||
cms.ui.assets.binaryasset.mimetype=Type
|
||||
cms.ui.assets.binaryasset.size=Size (bytes)
|
||||
|
|
|
|||
|
|
@ -265,3 +265,7 @@ cms.ui.assets.search_page.title=W\u00e4hlen Sie ein Asset
|
|||
cms.ui.assets.search_page.query=Suche nach
|
||||
cms.ui.assets.search_page.query.submit=Finden
|
||||
cms.ui.assets.external_video_asset.legal_metadata.label=Rechtliche Informationen
|
||||
cms.ui.assets.binaryasset.description=Beschreibung
|
||||
cms.ui.assets.binaryasset.filename=Dateiname
|
||||
cms.ui.assets.binaryasset.mimetype=Typ
|
||||
cms.ui.assets.binaryasset.size=Gr\u00f6\u00dfe (Bytes)
|
||||
|
|
|
|||
|
|
@ -224,3 +224,7 @@ cms.ui.assets.search_page.title=Select an asset
|
|||
cms.ui.assets.search_page.query=Search for
|
||||
cms.ui.assets.search_page.query.submit=Find
|
||||
cms.ui.assets.external_video_asset.legal_metadata.label=Legal metadata
|
||||
cms.ui.assets.binaryasset.description=Description
|
||||
cms.ui.assets.binaryasset.filename=File name
|
||||
cms.ui.assets.binaryasset.mimetype=Type
|
||||
cms.ui.assets.binaryasset.size=Size (bytes)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package com.arsdigita.xml;
|
||||
|
||||
import javax.enterprise.context.ContextNotActiveException;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
|
|
@ -77,7 +78,7 @@ public class CCMTransformerFactory extends TransformerFactory {
|
|||
private XmlConfig retrieveXmlConfig() {
|
||||
try {
|
||||
return XmlConfig.getConfig();
|
||||
} catch (IllegalStateException ex) {
|
||||
} catch (IllegalStateException | ContextNotActiveException ex) {
|
||||
LOGGER.warn(
|
||||
"Failed to access registry (CDI container not available?).",
|
||||
ex);
|
||||
|
|
|
|||
Loading…
Reference in New Issue