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-94f89814c4dfccm-docs
parent
87ede0d337
commit
8b308f4fa4
|
|
@ -34,6 +34,9 @@ import java.io.File;
|
||||||
import javax.activation.MimeType;
|
import javax.activation.MimeType;
|
||||||
import javax.activation.MimeTypeParseException;
|
import javax.activation.MimeTypeParseException;
|
||||||
import javax.activation.MimetypesFileTypeMap;
|
import javax.activation.MimetypesFileTypeMap;
|
||||||
|
import javax.servlet.ServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletRequestWrapper;
|
||||||
import org.librecms.CmsConstants;
|
import org.librecms.CmsConstants;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -372,15 +375,25 @@ public class FileUploadSection extends FormSection {
|
||||||
final String fileName = getFileName(event);
|
final String fileName = getFileName(event);
|
||||||
|
|
||||||
if (fileName != null && fileName.length() > 0) {
|
if (fileName != null && fileName.length() > 0) {
|
||||||
return ((MultipartHttpServletRequest) event
|
return ((MultipartHttpServletRequest) unwrapRequest(event
|
||||||
.getPageState()
|
.getPageState()
|
||||||
.getRequest())
|
.getRequest()))
|
||||||
.getFile(getFileUploadWidgetName());
|
.getFile(getFileUploadWidgetName());
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
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
|
* Obtain a filename from the file upload widget. The containing form should
|
||||||
* call this method in its process listener.
|
* 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
|
* Add mime-type options to the option group by loading all mime types which
|
||||||
* match a certain prefix from the database
|
* 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
|
* @param mimePrefix Populate the mime type widget with all mime types that
|
||||||
* match the prefix. Some of the possible prefixes are "text", "image",
|
* match the prefix. Some of the possible prefixes are "text", "image",
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,7 @@ public abstract class BinaryAssetForm extends AssetForm {
|
||||||
CmsConstants.CMS_BUNDLE),
|
CmsConstants.CMS_BUNDLE),
|
||||||
"",
|
"",
|
||||||
"");
|
"");
|
||||||
|
panel.add(fileUpload);
|
||||||
|
|
||||||
add(panel);
|
add(panel);
|
||||||
}
|
}
|
||||||
|
|
@ -117,10 +118,18 @@ public abstract class BinaryAssetForm extends AssetForm {
|
||||||
.getDescription()
|
.getDescription()
|
||||||
.getValue(getSelectedLocale(state)));
|
.getValue(getSelectedLocale(state)));
|
||||||
|
|
||||||
|
if (binaryAsset.getData() == null
|
||||||
|
|| binaryAsset.getData().length == 0) {
|
||||||
|
fileName.setText("-");
|
||||||
|
mimeType.setText("-");
|
||||||
|
size.setText("-");
|
||||||
|
} else {
|
||||||
|
|
||||||
fileName.setText(binaryAsset.getFileName());
|
fileName.setText(binaryAsset.getFileName());
|
||||||
mimeType.setText(binaryAsset.getMimeType().toString());
|
mimeType.setText(binaryAsset.getMimeType().toString());
|
||||||
size.setText(Long.toString(binaryAsset.getSize()));
|
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=Search for
|
||||||
cms.ui.assets.search_page.query.submit=Find
|
cms.ui.assets.search_page.query.submit=Find
|
||||||
cms.ui.assets.external_video_asset.legal_metadata.label=Legal metadata
|
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=Suche nach
|
||||||
cms.ui.assets.search_page.query.submit=Finden
|
cms.ui.assets.search_page.query.submit=Finden
|
||||||
cms.ui.assets.external_video_asset.legal_metadata.label=Rechtliche Informationen
|
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=Search for
|
||||||
cms.ui.assets.search_page.query.submit=Find
|
cms.ui.assets.search_page.query.submit=Find
|
||||||
cms.ui.assets.external_video_asset.legal_metadata.label=Legal metadata
|
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;
|
package com.arsdigita.xml;
|
||||||
|
|
||||||
|
import javax.enterprise.context.ContextNotActiveException;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
|
@ -77,7 +78,7 @@ public class CCMTransformerFactory extends TransformerFactory {
|
||||||
private XmlConfig retrieveXmlConfig() {
|
private XmlConfig retrieveXmlConfig() {
|
||||||
try {
|
try {
|
||||||
return XmlConfig.getConfig();
|
return XmlConfig.getConfig();
|
||||||
} catch (IllegalStateException ex) {
|
} catch (IllegalStateException | ContextNotActiveException ex) {
|
||||||
LOGGER.warn(
|
LOGGER.warn(
|
||||||
"Failed to access registry (CDI container not available?).",
|
"Failed to access registry (CDI container not available?).",
|
||||||
ex);
|
ex);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue