mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix AWC-999: Content encoding is displayed and is settable in the UI.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6120 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -5,6 +5,9 @@
|
||||
<show-property name="name" />
|
||||
<show-property name="mimetype" display-label-id="content_type"
|
||||
component-generator="MimeTypeSelectorGenerator" />
|
||||
<show-property name="encoding" display-label-id="encoding"
|
||||
ignore-if-missing="false"
|
||||
component-generator="CharsetSelectorGenerator" />
|
||||
<!-- NOTE: The following 3 properties are defined here to cover -->
|
||||
<!-- the scenario where content is added via CIFS or FTP -->
|
||||
<!-- and so the properties are missing -->
|
||||
@@ -41,6 +44,8 @@
|
||||
<show-property name="name" />
|
||||
<show-property name="mimetype" display-label-id="content_type"
|
||||
component-generator="MimeTypeSelectorGenerator" />
|
||||
<show-property name="encoding" display-label-id="encoding"
|
||||
component-generator="CharsetSelectorGenerator" />
|
||||
<show-property name="title" />
|
||||
<show-property name="description" />
|
||||
<show-property name="size" display-label-id="size"
|
||||
|
@@ -1044,6 +1044,13 @@ public class BrowseBean implements IContextListener
|
||||
}
|
||||
};
|
||||
|
||||
public NodePropertyResolver resolverEncoding = new NodePropertyResolver() {
|
||||
public Object get(Node node) {
|
||||
ContentData content = (ContentData)node.getProperties().get(ContentModel.PROP_CONTENT);
|
||||
return (content != null ? content.getEncoding() : null);
|
||||
}
|
||||
};
|
||||
|
||||
public NodePropertyResolver resolverSize = new NodePropertyResolver() {
|
||||
public Object get(Node node) {
|
||||
ContentData content = (ContentData)node.getProperties().get(ContentModel.PROP_CONTENT);
|
||||
@@ -1397,6 +1404,7 @@ public class BrowseBean implements IContextListener
|
||||
}
|
||||
node.addPropertyResolver("fileType32", this.resolverFileType32);
|
||||
node.addPropertyResolver("mimetype", this.resolverMimetype);
|
||||
node.addPropertyResolver("encoding", this.resolverEncoding);
|
||||
node.addPropertyResolver("size", this.resolverSize);
|
||||
node.addPropertyResolver("lang", this.resolverLang);
|
||||
|
||||
|
@@ -70,6 +70,7 @@ import org.alfresco.web.ui.common.Utils;
|
||||
public class DocumentPropertiesBean
|
||||
{
|
||||
private static final String TEMP_PROP_MIMETYPE = "mimetype";
|
||||
private static final String TEMP_PROP_ENCODING = "encoding";
|
||||
|
||||
protected NodeService nodeService;
|
||||
protected FileFolderService fileFolderService;
|
||||
@@ -105,6 +106,7 @@ public class DocumentPropertiesBean
|
||||
if (content != null)
|
||||
{
|
||||
this.editableNode.getProperties().put(TEMP_PROP_MIMETYPE, content.getMimetype());
|
||||
this.editableNode.getProperties().put(TEMP_PROP_ENCODING, content.getEncoding());
|
||||
}
|
||||
|
||||
this.hasOtherProperties = null;
|
||||
@@ -140,7 +142,7 @@ public class DocumentPropertiesBean
|
||||
// we need to put all the properties from the editable bag back into
|
||||
// the format expected by the repository
|
||||
|
||||
// but first extract and deal with the special mimetype property for ContentData
|
||||
// Deal with the special mimetype property for ContentData
|
||||
String mimetype = (String)props.get(TEMP_PROP_MIMETYPE);
|
||||
if (mimetype != null)
|
||||
{
|
||||
@@ -154,6 +156,20 @@ public class DocumentPropertiesBean
|
||||
}
|
||||
}
|
||||
|
||||
// Deal with the special encoding property for ContentData
|
||||
String encoding = (String) props.get(TEMP_PROP_ENCODING);
|
||||
if (encoding != null)
|
||||
{
|
||||
// remove temporary prop from list so it isn't saved with the others
|
||||
props.remove(TEMP_PROP_ENCODING);
|
||||
ContentData contentData = (ContentData)props.get(ContentModel.PROP_CONTENT);
|
||||
if (contentData != null)
|
||||
{
|
||||
contentData = ContentData.setEncoding(contentData, encoding);
|
||||
props.put(ContentModel.PROP_CONTENT.toString(), contentData);
|
||||
}
|
||||
}
|
||||
|
||||
// extra and deal with the Author prop if the aspect has not been applied yet
|
||||
String author = (String)props.get(ContentModel.PROP_AUTHOR);
|
||||
if (author != null && author.length() != 0)
|
||||
|
@@ -54,6 +54,7 @@ import org.alfresco.web.bean.repository.Repository;
|
||||
public class EditContentPropertiesDialog extends BaseDialogBean
|
||||
{
|
||||
protected static final String TEMP_PROP_MIMETYPE = "mimetype";
|
||||
protected static final String TEMP_PROP_ENCODING = "encoding";
|
||||
|
||||
protected Node editableNode;
|
||||
|
||||
@@ -75,6 +76,7 @@ public class EditContentPropertiesDialog extends BaseDialogBean
|
||||
if (content != null)
|
||||
{
|
||||
this.editableNode.getProperties().put(TEMP_PROP_MIMETYPE, content.getMimetype());
|
||||
this.editableNode.getProperties().put(TEMP_PROP_ENCODING, content.getEncoding());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,8 +106,8 @@ public class EditContentPropertiesDialog extends BaseDialogBean
|
||||
// the format expected by the repository
|
||||
Map<QName, Serializable> repoProps = this.nodeService.getProperties(nodeRef);
|
||||
|
||||
// but first extract and deal with the special mimetype property for ContentData
|
||||
String mimetype = (String)editedProps.get(TEMP_PROP_MIMETYPE);
|
||||
// Extract and deal with the special mimetype property for ContentData
|
||||
String mimetype = (String) editedProps.get(TEMP_PROP_MIMETYPE);
|
||||
if (mimetype != null)
|
||||
{
|
||||
// remove temporary prop from list so it isn't saved with the others
|
||||
@@ -117,6 +119,19 @@ public class EditContentPropertiesDialog extends BaseDialogBean
|
||||
editedProps.put(ContentModel.PROP_CONTENT.toString(), contentData);
|
||||
}
|
||||
}
|
||||
// Extract and deal with the special encoding property for ContentData
|
||||
String encoding = (String) editedProps.get(TEMP_PROP_ENCODING);
|
||||
if (encoding != null)
|
||||
{
|
||||
// remove temporary prop from list so it isn't saved with the others
|
||||
editedProps.remove(TEMP_PROP_ENCODING);
|
||||
ContentData contentData = (ContentData) editedProps.get(ContentModel.PROP_CONTENT);
|
||||
if (contentData != null)
|
||||
{
|
||||
contentData = ContentData.setEncoding(contentData, encoding);
|
||||
editedProps.put(ContentModel.PROP_CONTENT.toString(), contentData);
|
||||
}
|
||||
}
|
||||
|
||||
// add the "author" aspect if required, properties will get set below
|
||||
if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_AUTHOR) == false)
|
||||
|
@@ -42,6 +42,7 @@ import org.alfresco.web.bean.repository.Node;
|
||||
public class ViewContentPropertiesDialog extends BaseDialogBean
|
||||
{
|
||||
protected static final String TEMP_PROP_MIMETYPE = "mimetype";
|
||||
protected static final String TEMP_PROP_ENCODING = "encoding";
|
||||
|
||||
protected Node viewingNode;
|
||||
|
||||
@@ -63,6 +64,7 @@ public class ViewContentPropertiesDialog extends BaseDialogBean
|
||||
if (content != null)
|
||||
{
|
||||
this.viewingNode.getProperties().put(TEMP_PROP_MIMETYPE, content.getMimetype());
|
||||
this.viewingNode.getProperties().put(TEMP_PROP_ENCODING, content.getEncoding());
|
||||
}
|
||||
|
||||
// add the specially handled 'size' property
|
||||
|
@@ -3684,6 +3684,15 @@
|
||||
<managed-bean-scope>request</managed-bean-scope>
|
||||
</managed-bean>
|
||||
|
||||
<managed-bean>
|
||||
<description>
|
||||
Bean that generates a charset selector component
|
||||
</description>
|
||||
<managed-bean-name>CharsetSelectorGenerator</managed-bean-name>
|
||||
<managed-bean-class>org.alfresco.web.bean.generator.CharsetSelectorGenerator</managed-bean-class>
|
||||
<managed-bean-scope>request</managed-bean-scope>
|
||||
</managed-bean>
|
||||
|
||||
<managed-bean>
|
||||
<description>
|
||||
Bean that generates a languages selector component
|
||||
|
@@ -215,6 +215,11 @@
|
||||
<converter-class>org.alfresco.web.ui.repo.converter.MimeTypeConverter</converter-class>
|
||||
</converter>
|
||||
|
||||
<converter>
|
||||
<converter-id>org.alfresco.faces.CharsetConverter</converter-id>
|
||||
<converter-class>org.alfresco.web.ui.repo.converter.CharsetConverter</converter-class>
|
||||
</converter>
|
||||
|
||||
<converter>
|
||||
<converter-id>org.alfresco.faces.LanguageConverter</converter-id>
|
||||
<converter-class>org.alfresco.web.ui.repo.converter.LanguageConverter</converter-class>
|
||||
|
Reference in New Issue
Block a user