mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
- fixed issues with editing spaces
- made topic pages consistent with 1.2 - added ability to force properties to render even if they are not present in the node - changed warnings about missing properties to debug but added a log label to turn it on easily git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2922 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -5,21 +5,28 @@
|
|||||||
<show-property name="name" />
|
<show-property name="name" />
|
||||||
<show-property name="mimetype" display-label-id="content_type"
|
<show-property name="mimetype" display-label-id="content_type"
|
||||||
component-generator="MimeTypeSelectorGenerator" />
|
component-generator="MimeTypeSelectorGenerator" />
|
||||||
<show-property name="title" />
|
<show-property name="title" display-label-id="title"
|
||||||
<show-property name="description" />
|
ignore-if-missing="false" />
|
||||||
|
<show-property name="description" display-label-id="description"
|
||||||
|
ignore-if-missing="false" />
|
||||||
<show-property name="size" display-label-id="size"
|
<show-property name="size" display-label-id="size"
|
||||||
converter="org.alfresco.faces.ByteSizeConverter"
|
converter="org.alfresco.faces.ByteSizeConverter"
|
||||||
show-in-edit-mode="false" />
|
show-in-edit-mode="false" />
|
||||||
|
<show-property name="author" display-label-id="author"
|
||||||
|
ignore-if-missing="false" />
|
||||||
</property-sheet>
|
</property-sheet>
|
||||||
</config>
|
</config>
|
||||||
|
|
||||||
<config evaluator="node-type" condition="folder">
|
<config evaluator="node-type" condition="folder">
|
||||||
<property-sheet>
|
<property-sheet>
|
||||||
<show-property name="name"/>
|
<show-property name="name"/>
|
||||||
<show-property name="title"/>
|
<show-property name="title" display-label-id="title"
|
||||||
<show-property name="description"/>
|
ignore-if-missing="false" />
|
||||||
<show-property name="icon" show-in-view-mode="false" display-label-id="icon"
|
<show-property name="description" display-label-id="description"
|
||||||
component-generator="SpaceIconPickerGenerator" />
|
ignore-if-missing="false" />
|
||||||
|
<show-property name="app:icon" show-in-view-mode="false" display-label-id="icon"
|
||||||
|
component-generator="SpaceIconPickerGenerator"
|
||||||
|
ignore-if-missing="false" />
|
||||||
</property-sheet>
|
</property-sheet>
|
||||||
</config>
|
</config>
|
||||||
|
|
||||||
@@ -27,7 +34,7 @@
|
|||||||
<property-sheet>
|
<property-sheet>
|
||||||
<show-property name="name"/>
|
<show-property name="name"/>
|
||||||
<show-property name="description"/>
|
<show-property name="description"/>
|
||||||
<show-property name="icon" show-in-view-mode="false" display-label-id="icon"
|
<show-property name="app:icon" show-in-view-mode="false" display-label-id="icon"
|
||||||
component-generator="SpaceIconPickerGenerator" />
|
component-generator="SpaceIconPickerGenerator" />
|
||||||
</property-sheet>
|
</property-sheet>
|
||||||
</config>
|
</config>
|
||||||
@@ -36,16 +43,15 @@
|
|||||||
<property-sheet>
|
<property-sheet>
|
||||||
<show-property name="name"/>
|
<show-property name="name"/>
|
||||||
<show-property name="description"/>
|
<show-property name="description"/>
|
||||||
<show-property name="icon" show-in-view-mode="false" display-label-id="icon"
|
<show-property name="app:icon" show-in-view-mode="false" display-label-id="icon"
|
||||||
component-generator="SpaceIconPickerGenerator" />
|
component-generator="SpaceIconPickerGenerator" />
|
||||||
</property-sheet>
|
</property-sheet>
|
||||||
</config>
|
</config>
|
||||||
|
|
||||||
<config evaluator="node-type" condition="fm:topic">
|
<config evaluator="node-type" condition="fm:topic">
|
||||||
<property-sheet>
|
<property-sheet>
|
||||||
<show-property name="name"/>
|
<show-property name="name" display-label-id="subject" />
|
||||||
<show-property name="description"/>
|
<show-property name="app:icon" show-in-view-mode="false" display-label-id="icon"
|
||||||
<show-property name="icon" show-in-view-mode="false" display-label-id="icon"
|
|
||||||
component-generator="SpaceIconPickerGenerator" />
|
component-generator="SpaceIconPickerGenerator" />
|
||||||
</property-sheet>
|
</property-sheet>
|
||||||
</config>
|
</config>
|
||||||
|
@@ -175,7 +175,6 @@
|
|||||||
<config evaluator="string-compare" condition="Content Wizards">
|
<config evaluator="string-compare" condition="Content Wizards">
|
||||||
<!-- The list of custom content types to show in the content wizards -->
|
<!-- The list of custom content types to show in the content wizards -->
|
||||||
<content-types>
|
<content-types>
|
||||||
<type name="cm:dictionaryModel"/>
|
|
||||||
</content-types>
|
</content-types>
|
||||||
|
|
||||||
<!-- The list of mime types that can be created inline -->
|
<!-- The list of mime types that can be created inline -->
|
||||||
@@ -196,7 +195,6 @@
|
|||||||
</subtypes>
|
</subtypes>
|
||||||
<!-- The list of content types shown in the specialise-type action -->
|
<!-- The list of content types shown in the specialise-type action -->
|
||||||
<specialise-types>
|
<specialise-types>
|
||||||
<type name="cm:dictionaryModel"/>
|
|
||||||
</specialise-types>
|
</specialise-types>
|
||||||
<!-- The list of aspects to show in the add/remove features action -->
|
<!-- The list of aspects to show in the add/remove features action -->
|
||||||
<!-- and the has-aspect condition -->
|
<!-- and the has-aspect condition -->
|
||||||
|
@@ -2,7 +2,6 @@ package org.alfresco.web.bean.content;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -60,66 +59,54 @@ public class EditContentPropertiesDialog extends BaseDialogBean
|
|||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
NodeRef nodeRef = this.browseBean.getDocument().getNodeRef();
|
NodeRef nodeRef = this.browseBean.getDocument().getNodeRef();
|
||||||
Map<String, Object> props = this.editableNode.getProperties();
|
Map<String, Object> editedProps = this.editableNode.getProperties();
|
||||||
|
|
||||||
// get the name and move the node as necessary
|
// get the name and move the node as necessary
|
||||||
String name = (String) props.get(ContentModel.PROP_NAME);
|
String name = (String) editedProps.get(ContentModel.PROP_NAME);
|
||||||
if (name != null)
|
if (name != null)
|
||||||
{
|
{
|
||||||
fileFolderService.rename(nodeRef, name);
|
fileFolderService.rename(nodeRef, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<QName, Serializable> properties = this.nodeService.getProperties(nodeRef);
|
Map<QName, Serializable> repoProps = this.nodeService.getProperties(nodeRef);
|
||||||
// we need to put all the properties from the editable bag back into
|
// we need to put all the properties from the editable bag back into
|
||||||
// the format expected by the repository
|
// the format expected by the repository
|
||||||
|
|
||||||
// but first extract and deal with the special mimetype property for ContentData
|
// but first extract and deal with the special mimetype property for ContentData
|
||||||
String mimetype = (String)props.get(TEMP_PROP_MIMETYPE);
|
String mimetype = (String)editedProps.get(TEMP_PROP_MIMETYPE);
|
||||||
if (mimetype != null)
|
if (mimetype != null)
|
||||||
{
|
{
|
||||||
// remove temporary prop from list so it isn't saved with the others
|
// remove temporary prop from list so it isn't saved with the others
|
||||||
props.remove(TEMP_PROP_MIMETYPE);
|
editedProps.remove(TEMP_PROP_MIMETYPE);
|
||||||
ContentData contentData = (ContentData)props.get(ContentModel.PROP_CONTENT);
|
ContentData contentData = (ContentData)editedProps.get(ContentModel.PROP_CONTENT);
|
||||||
if (contentData != null)
|
if (contentData != null)
|
||||||
{
|
{
|
||||||
contentData = ContentData.setMimetype(contentData, mimetype);
|
contentData = ContentData.setMimetype(contentData, mimetype);
|
||||||
props.put(ContentModel.PROP_CONTENT.toString(), contentData);
|
editedProps.put(ContentModel.PROP_CONTENT.toString(), contentData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// extra and deal with the Author prop if the aspect has not been applied yet
|
// add the "author" aspect if required, properties will get set below
|
||||||
String author = (String)props.get(ContentModel.PROP_AUTHOR);
|
if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_AUTHOR) == false)
|
||||||
if (author != null && author.length() != 0)
|
|
||||||
{
|
{
|
||||||
// add aspect if required
|
this.nodeService.addAspect(nodeRef, ContentModel.ASPECT_AUTHOR, null);
|
||||||
if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_AUTHOR) == false)
|
|
||||||
{
|
|
||||||
Map<QName, Serializable> authorProps = new HashMap<QName, Serializable>(1, 1.0f);
|
|
||||||
authorProps.put(ContentModel.PROP_AUTHOR, author);
|
|
||||||
this.nodeService.addAspect(nodeRef, ContentModel.ASPECT_AUTHOR, authorProps);
|
|
||||||
}
|
|
||||||
// else it will get updated in the later setProperties() call
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// deal with adding the "titled" aspect if required
|
// add the "titled" aspect if required, properties will get set below
|
||||||
String title = (String)props.get(ContentModel.PROP_TITLE);
|
if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_TITLED) == false)
|
||||||
String description = (String)props.get(ContentModel.PROP_DESCRIPTION);
|
|
||||||
if (title != null || description != null)
|
|
||||||
{
|
{
|
||||||
// add the aspect to be sure it's present
|
|
||||||
nodeService.addAspect(nodeRef, ContentModel.ASPECT_TITLED, null);
|
nodeService.addAspect(nodeRef, ContentModel.ASPECT_TITLED, null);
|
||||||
// props will get added later in setProperties()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// add the remaining properties
|
// add the remaining properties
|
||||||
Iterator<String> iterProps = props.keySet().iterator();
|
Iterator<String> iterProps = editedProps.keySet().iterator();
|
||||||
while (iterProps.hasNext())
|
while (iterProps.hasNext())
|
||||||
{
|
{
|
||||||
String propName = iterProps.next();
|
String propName = iterProps.next();
|
||||||
QName qname = QName.createQName(propName);
|
QName qname = QName.createQName(propName);
|
||||||
|
|
||||||
// make sure the property is represented correctly
|
// make sure the property is represented correctly
|
||||||
Serializable propValue = (Serializable)props.get(propName);
|
Serializable propValue = (Serializable)editedProps.get(propName);
|
||||||
|
|
||||||
// check for empty strings when using number types, set to null in this case
|
// check for empty strings when using number types, set to null in this case
|
||||||
if ((propValue != null) && (propValue instanceof String) &&
|
if ((propValue != null) && (propValue instanceof String) &&
|
||||||
@@ -138,11 +125,11 @@ public class EditContentPropertiesDialog extends BaseDialogBean
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
properties.put(qname, propValue);
|
repoProps.put(qname, propValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
// send the properties back to the repository
|
// send the properties back to the repository
|
||||||
this.nodeService.setProperties(this.browseBean.getDocument().getNodeRef(), properties);
|
this.nodeService.setProperties(nodeRef, repoProps);
|
||||||
|
|
||||||
// we also need to persist any association changes that may have been made
|
// we also need to persist any association changes that may have been made
|
||||||
|
|
||||||
|
@@ -28,8 +28,7 @@ public class LabelGenerator extends BaseComponentGenerator
|
|||||||
// add the component to the property sheet item
|
// add the component to the property sheet item
|
||||||
item.getChildren().add(component);
|
item.getChildren().add(component);
|
||||||
|
|
||||||
// TODO: Turn the label red if the field is required
|
// TODO: setup the 'for' attribute to associate with it the control
|
||||||
// setup the 'for' attribute to associate with it the control
|
|
||||||
|
|
||||||
return component;
|
return component;
|
||||||
}
|
}
|
||||||
|
@@ -31,7 +31,7 @@ public class EditSpaceDialog extends CreateSpaceDialog
|
|||||||
super.init(parameters);
|
super.init(parameters);
|
||||||
|
|
||||||
// setup the space being edited
|
// setup the space being edited
|
||||||
this.editableNode = this.browseBean.getActionSpace();
|
this.editableNode = new Node(this.browseBean.getActionSpace().getNodeRef());
|
||||||
this.spaceType = this.editableNode.getType().toString();
|
this.spaceType = this.editableNode.getType().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ public class EditSpaceDialog extends CreateSpaceDialog
|
|||||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||||
{
|
{
|
||||||
// update the existing node in the repository
|
// update the existing node in the repository
|
||||||
NodeRef nodeRef = this.editableNode.getNodeRef();
|
NodeRef nodeRef = this.browseBean.getActionSpace().getNodeRef();
|
||||||
Map<String, Object> editedProps = this.editableNode.getProperties();
|
Map<String, Object> editedProps = this.editableNode.getProperties();
|
||||||
|
|
||||||
// handle the name property separately, perform a rename in case it changed
|
// handle the name property separately, perform a rename in case it changed
|
||||||
@@ -68,6 +68,12 @@ public class EditSpaceDialog extends CreateSpaceDialog
|
|||||||
// get the current set of properties from the repository
|
// get the current set of properties from the repository
|
||||||
Map<QName, Serializable> repoProps = this.nodeService.getProperties(nodeRef);
|
Map<QName, Serializable> repoProps = this.nodeService.getProperties(nodeRef);
|
||||||
|
|
||||||
|
// add the "uifacets" aspect if required, properties will get set below
|
||||||
|
if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_UIFACETS) == false)
|
||||||
|
{
|
||||||
|
this.nodeService.addAspect(nodeRef, ContentModel.ASPECT_UIFACETS, null);
|
||||||
|
}
|
||||||
|
|
||||||
// overwrite the current properties with the edited ones
|
// overwrite the current properties with the edited ones
|
||||||
Iterator<String> iterProps = editedProps.keySet().iterator();
|
Iterator<String> iterProps = editedProps.keySet().iterator();
|
||||||
while (iterProps.hasNext())
|
while (iterProps.hasNext())
|
||||||
@@ -149,7 +155,7 @@ public class EditSpaceDialog extends CreateSpaceDialog
|
|||||||
@Override
|
@Override
|
||||||
protected String doPostCommitProcessing(FacesContext context, String outcome)
|
protected String doPostCommitProcessing(FacesContext context, String outcome)
|
||||||
{
|
{
|
||||||
this.editableNode.reset();
|
this.browseBean.getActionSpace().reset();
|
||||||
|
|
||||||
return outcome;
|
return outcome;
|
||||||
}
|
}
|
||||||
|
@@ -139,13 +139,16 @@ public class PropertySheetConfigElement extends ConfigElementAdapter
|
|||||||
* sheet is in view mode
|
* sheet is in view mode
|
||||||
* @param inEdit Sets whether the property should be shown when the property
|
* @param inEdit Sets whether the property should be shown when the property
|
||||||
* sheet is in edit mode
|
* sheet is in edit mode
|
||||||
* @parm compGenerator The name of a bean that can be used as a component generator
|
* @param compGenerator The name of a bean that can be used as a component generator
|
||||||
|
* @param ignoreIfMissing Sets whether the property should be rendered if it is not
|
||||||
|
* found in the data dictionary or the node itself
|
||||||
*/
|
*/
|
||||||
/*package*/ void addProperty(String name, String displayLabel, String displayLabelId, String readOnly,
|
/*package*/ void addProperty(String name, String displayLabel, String displayLabelId, String readOnly,
|
||||||
String converter, String inView, String inEdit, String compGenerator)
|
String converter, String inView, String inEdit, String compGenerator,
|
||||||
|
String ignoreIfMissing)
|
||||||
{
|
{
|
||||||
addItem(new PropertyConfig(name, displayLabel, displayLabelId, Boolean.parseBoolean(readOnly),
|
addItem(new PropertyConfig(name, displayLabel, displayLabelId, Boolean.parseBoolean(readOnly),
|
||||||
converter, inView, inEdit, compGenerator));
|
converter, inView, inEdit, compGenerator, ignoreIfMissing));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -160,7 +163,7 @@ public class PropertySheetConfigElement extends ConfigElementAdapter
|
|||||||
* sheet is in view mode
|
* sheet is in view mode
|
||||||
* @param inEdit Sets whether the property should be shown when the property
|
* @param inEdit Sets whether the property should be shown when the property
|
||||||
* sheet is in edit mode
|
* sheet is in edit mode
|
||||||
* @parm compGenerator The name of a bean that can be used as a component generator
|
* @param compGenerator The name of a bean that can be used as a component generator
|
||||||
*/
|
*/
|
||||||
/*package*/ void addAssociation(String name, String displayLabel, String displayLabelId, String readOnly,
|
/*package*/ void addAssociation(String name, String displayLabel, String displayLabelId, String readOnly,
|
||||||
String converter, String inView, String inEdit, String compGenerator)
|
String converter, String inView, String inEdit, String compGenerator)
|
||||||
@@ -181,7 +184,7 @@ public class PropertySheetConfigElement extends ConfigElementAdapter
|
|||||||
* sheet is in view mode
|
* sheet is in view mode
|
||||||
* @param inEdit Sets whether the property should be shown when the property
|
* @param inEdit Sets whether the property should be shown when the property
|
||||||
* sheet is in edit mode
|
* sheet is in edit mode
|
||||||
* @parm compGenerator The name of a bean that can be used as a component generator
|
* @param compGenerator The name of a bean that can be used as a component generator
|
||||||
*/
|
*/
|
||||||
/*package*/ void addChildAssociation(String name, String displayLabel, String displayLabelId, String readOnly,
|
/*package*/ void addChildAssociation(String name, String displayLabel, String displayLabelId, String readOnly,
|
||||||
String converter, String inView, String inEdit, String compGenerator)
|
String converter, String inView, String inEdit, String compGenerator)
|
||||||
@@ -257,10 +260,11 @@ public class PropertySheetConfigElement extends ConfigElementAdapter
|
|||||||
private boolean readOnly;
|
private boolean readOnly;
|
||||||
private boolean showInViewMode = true;
|
private boolean showInViewMode = true;
|
||||||
private boolean showInEditMode = true;
|
private boolean showInEditMode = true;
|
||||||
|
private boolean ignoreIfMissing = true;
|
||||||
|
|
||||||
public ItemConfig(String name, String displayLabel, String displayLabelId,
|
public ItemConfig(String name, String displayLabel, String displayLabelId,
|
||||||
boolean readOnly, String converter, String inView, String inEdit,
|
boolean readOnly, String converter, String inView, String inEdit,
|
||||||
String compGenerator)
|
String compGenerator, String ignoreIfMissing)
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.displayLabel = displayLabel;
|
this.displayLabel = displayLabel;
|
||||||
@@ -277,6 +281,10 @@ public class PropertySheetConfigElement extends ConfigElementAdapter
|
|||||||
{
|
{
|
||||||
this.showInEditMode = Boolean.parseBoolean(inEdit);
|
this.showInEditMode = Boolean.parseBoolean(inEdit);
|
||||||
}
|
}
|
||||||
|
if (ignoreIfMissing != null)
|
||||||
|
{
|
||||||
|
this.ignoreIfMissing = Boolean.parseBoolean(ignoreIfMissing);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -343,6 +351,15 @@ public class PropertySheetConfigElement extends ConfigElementAdapter
|
|||||||
return this.componentGenerator;
|
return this.componentGenerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Whether the property should be rendered if it is not found in the
|
||||||
|
* data dictionary or the node itself.
|
||||||
|
*/
|
||||||
|
public boolean getIgnoreIfMissing()
|
||||||
|
{
|
||||||
|
return this.ignoreIfMissing;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see java.lang.Object#toString()
|
* @see java.lang.Object#toString()
|
||||||
*/
|
*/
|
||||||
@@ -356,6 +373,7 @@ public class PropertySheetConfigElement extends ConfigElementAdapter
|
|||||||
buffer.append(" read-only=").append(this.readOnly);
|
buffer.append(" read-only=").append(this.readOnly);
|
||||||
buffer.append(" show-in-view-mode=").append(this.showInViewMode);
|
buffer.append(" show-in-view-mode=").append(this.showInViewMode);
|
||||||
buffer.append(" show-in-edit-mode=").append(this.showInEditMode);
|
buffer.append(" show-in-edit-mode=").append(this.showInEditMode);
|
||||||
|
buffer.append(" ignore-if-missing=").append(this.ignoreIfMissing);
|
||||||
buffer.append(" component-generator=").append(this.componentGenerator).append(")");
|
buffer.append(" component-generator=").append(this.componentGenerator).append(")");
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
@@ -368,10 +386,10 @@ public class PropertySheetConfigElement extends ConfigElementAdapter
|
|||||||
{
|
{
|
||||||
public PropertyConfig(String name, String displayLabel, String displayLabelId,
|
public PropertyConfig(String name, String displayLabel, String displayLabelId,
|
||||||
boolean readOnly, String converter, String inView, String inEdit,
|
boolean readOnly, String converter, String inView, String inEdit,
|
||||||
String compGenerator)
|
String compGenerator, String ignoreIfMissing)
|
||||||
{
|
{
|
||||||
super(name, displayLabel, displayLabelId, readOnly, converter,
|
super(name, displayLabel, displayLabelId, readOnly, converter,
|
||||||
inView, inEdit, compGenerator);
|
inView, inEdit, compGenerator, ignoreIfMissing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -385,7 +403,7 @@ public class PropertySheetConfigElement extends ConfigElementAdapter
|
|||||||
String compGenerator)
|
String compGenerator)
|
||||||
{
|
{
|
||||||
super(name, displayLabel, displayLabelId, readOnly, converter,
|
super(name, displayLabel, displayLabelId, readOnly, converter,
|
||||||
inView, inEdit, compGenerator);
|
inView, inEdit, compGenerator, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -399,7 +417,7 @@ public class PropertySheetConfigElement extends ConfigElementAdapter
|
|||||||
String compGenerator)
|
String compGenerator)
|
||||||
{
|
{
|
||||||
super(name, displayLabel, displayLabelId, readOnly, converter,
|
super(name, displayLabel, displayLabelId, readOnly, converter,
|
||||||
inView, inEdit, compGenerator);
|
inView, inEdit, compGenerator, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -42,10 +42,12 @@ public class PropertySheetElementReader implements ConfigElementReader
|
|||||||
public static final String ATTR_SHOW_IN_EDIT_MODE = "show-in-edit-mode";
|
public static final String ATTR_SHOW_IN_EDIT_MODE = "show-in-edit-mode";
|
||||||
public static final String ATTR_SHOW_IN_VIEW_MODE = "show-in-view-mode";
|
public static final String ATTR_SHOW_IN_VIEW_MODE = "show-in-view-mode";
|
||||||
public static final String ATTR_COMPONENT_GENERATOR = "component-generator";
|
public static final String ATTR_COMPONENT_GENERATOR = "component-generator";
|
||||||
|
public static final String ATTR_IGNORE_IF_MISSING = "ignore-if-missing";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.config.xml.elementreader.ConfigElementReader#parse(org.dom4j.Element)
|
* @see org.alfresco.config.xml.elementreader.ConfigElementReader#parse(org.dom4j.Element)
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public ConfigElement parse(Element element)
|
public ConfigElement parse(Element element)
|
||||||
{
|
{
|
||||||
PropertySheetConfigElement configElement = null;
|
PropertySheetConfigElement configElement = null;
|
||||||
@@ -78,9 +80,11 @@ public class PropertySheetElementReader implements ConfigElementReader
|
|||||||
|
|
||||||
if (ELEMENT_SHOW_PROPERTY.equals(item.getName()))
|
if (ELEMENT_SHOW_PROPERTY.equals(item.getName()))
|
||||||
{
|
{
|
||||||
|
String ignoreIfMissing = item.attributeValue(ATTR_IGNORE_IF_MISSING);
|
||||||
|
|
||||||
// add the property to show to the custom config element
|
// add the property to show to the custom config element
|
||||||
configElement.addProperty(propName, label, labelId, readOnly, converter,
|
configElement.addProperty(propName, label, labelId, readOnly, converter,
|
||||||
inView, inEdit, compGenerator);
|
inView, inEdit, compGenerator, ignoreIfMissing);
|
||||||
}
|
}
|
||||||
else if (ELEMENT_SHOW_ASSOC.equals(item.getName()))
|
else if (ELEMENT_SHOW_ASSOC.equals(item.getName()))
|
||||||
{
|
{
|
||||||
|
@@ -18,7 +18,6 @@ package org.alfresco.web.config;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -99,12 +98,14 @@ public class WebClientConfigTest extends BaseTest
|
|||||||
assertNotNull("createddate property config should not be null", createdDataProp);
|
assertNotNull("createddate property config should not be null", createdDataProp);
|
||||||
assertEquals("display label for createddate should be null", null, createdDataProp.getDisplayLabel());
|
assertEquals("display label for createddate should be null", null, createdDataProp.getDisplayLabel());
|
||||||
assertTrue("read only for createddate should be 'true'", createdDataProp.isReadOnly());
|
assertTrue("read only for createddate should be 'true'", createdDataProp.isReadOnly());
|
||||||
|
assertTrue("ignoreIfMissing for createddate should be 'true'", createdDataProp.getIgnoreIfMissing());
|
||||||
|
|
||||||
ItemConfig iconProp = props.get("icon");
|
ItemConfig iconProp = props.get("icon");
|
||||||
assertNotNull("icon property config should not be null", iconProp);
|
assertNotNull("icon property config should not be null", iconProp);
|
||||||
assertEquals("display label for icon should be null", null, iconProp.getDisplayLabel());
|
assertEquals("display label for icon should be null", null, iconProp.getDisplayLabel());
|
||||||
assertEquals("component-generator", "SpaceIconPickerGenerator", iconProp.getComponentGenerator());
|
assertEquals("component-generator", "SpaceIconPickerGenerator", iconProp.getComponentGenerator());
|
||||||
assertFalse("read only for icon should be 'false'", iconProp.isReadOnly());
|
assertFalse("read only for icon should be 'false'", iconProp.isReadOnly());
|
||||||
|
assertFalse("ignoreIfMissing for icon should be 'false'", iconProp.getIgnoreIfMissing());
|
||||||
|
|
||||||
// test that a call to the generic getChildren call throws an error
|
// test that a call to the generic getChildren call throws an error
|
||||||
try
|
try
|
||||||
@@ -277,6 +278,7 @@ public class WebClientConfigTest extends BaseTest
|
|||||||
assertFalse("icon should not be read-only", iconCfg.isReadOnly());
|
assertFalse("icon should not be read-only", iconCfg.isReadOnly());
|
||||||
assertTrue("icon should be shown in view mode", iconCfg.isShownInViewMode());
|
assertTrue("icon should be shown in view mode", iconCfg.isShownInViewMode());
|
||||||
assertTrue("icon should be shown in edit mode", iconCfg.isShownInEditMode());
|
assertTrue("icon should be shown in edit mode", iconCfg.isShownInEditMode());
|
||||||
|
assertFalse("ignoreIfMissing for icon should be 'false'", iconCfg.getIgnoreIfMissing());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -42,6 +42,7 @@ public abstract class PropertySheetItem extends UIPanel implements NamingContain
|
|||||||
protected String displayLabel;
|
protected String displayLabel;
|
||||||
protected String converter;
|
protected String converter;
|
||||||
protected Boolean readOnly;
|
protected Boolean readOnly;
|
||||||
|
protected Boolean ignoreIfMissing;
|
||||||
protected String componentGenerator;
|
protected String componentGenerator;
|
||||||
|
|
||||||
protected String resolvedDisplayLabel;
|
protected String resolvedDisplayLabel;
|
||||||
@@ -198,6 +199,38 @@ public abstract class PropertySheetItem extends UIPanel implements NamingContain
|
|||||||
this.readOnly = readOnly;
|
this.readOnly = readOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Determines whether the item should be ignored (not rendered)
|
||||||
|
* if the item can not be found
|
||||||
|
*/
|
||||||
|
public boolean getIgnoreIfMissing()
|
||||||
|
{
|
||||||
|
if (this.ignoreIfMissing == null)
|
||||||
|
{
|
||||||
|
ValueBinding vb = getValueBinding("ignoreIfMissing");
|
||||||
|
if (vb != null)
|
||||||
|
{
|
||||||
|
this.ignoreIfMissing = (Boolean)vb.getValue(getFacesContext());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.ignoreIfMissing == null)
|
||||||
|
{
|
||||||
|
this.ignoreIfMissing = Boolean.TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.ignoreIfMissing;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ignoreIfMissing Sets the whether the item will be ignored
|
||||||
|
* if it can not be found
|
||||||
|
*/
|
||||||
|
public void setIgnoreIfMissing(boolean ignoreIfMissing)
|
||||||
|
{
|
||||||
|
this.ignoreIfMissing = ignoreIfMissing;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see javax.faces.component.StateHolder#restoreState(javax.faces.context.FacesContext, java.lang.Object)
|
* @see javax.faces.component.StateHolder#restoreState(javax.faces.context.FacesContext, java.lang.Object)
|
||||||
*/
|
*/
|
||||||
@@ -212,6 +245,7 @@ public abstract class PropertySheetItem extends UIPanel implements NamingContain
|
|||||||
this.converter = (String)values[4];
|
this.converter = (String)values[4];
|
||||||
this.componentGenerator = (String)values[5];
|
this.componentGenerator = (String)values[5];
|
||||||
this.resolvedDisplayLabel = (String)values[6];
|
this.resolvedDisplayLabel = (String)values[6];
|
||||||
|
this.ignoreIfMissing = (Boolean)values[7];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -219,7 +253,7 @@ public abstract class PropertySheetItem extends UIPanel implements NamingContain
|
|||||||
*/
|
*/
|
||||||
public Object saveState(FacesContext context)
|
public Object saveState(FacesContext context)
|
||||||
{
|
{
|
||||||
Object values[] = new Object[7];
|
Object values[] = new Object[8];
|
||||||
// standard component attributes are saved by the super class
|
// standard component attributes are saved by the super class
|
||||||
values[0] = super.saveState(context);
|
values[0] = super.saveState(context);
|
||||||
values[1] = this.name;
|
values[1] = this.name;
|
||||||
@@ -228,6 +262,7 @@ public abstract class PropertySheetItem extends UIPanel implements NamingContain
|
|||||||
values[4] = this.converter;
|
values[4] = this.converter;
|
||||||
values[5] = this.componentGenerator;
|
values[5] = this.componentGenerator;
|
||||||
values[6] = this.resolvedDisplayLabel;
|
values[6] = this.resolvedDisplayLabel;
|
||||||
|
values[7] = this.ignoreIfMissing;
|
||||||
return (values);
|
return (values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -41,6 +41,7 @@ import org.springframework.web.jsf.FacesContextUtils;
|
|||||||
public class UIProperty extends PropertySheetItem
|
public class UIProperty extends PropertySheetItem
|
||||||
{
|
{
|
||||||
private static Log logger = LogFactory.getLog(UIProperty.class);
|
private static Log logger = LogFactory.getLog(UIProperty.class);
|
||||||
|
private static Log missingPropsLogger = LogFactory.getLog("alfresco.missingProperties");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor
|
* Default constructor
|
||||||
@@ -76,8 +77,9 @@ public class UIProperty extends PropertySheetItem
|
|||||||
if (propDef == null)
|
if (propDef == null)
|
||||||
{
|
{
|
||||||
// there is no definition for the node, so it may have been added to
|
// there is no definition for the node, so it may have been added to
|
||||||
// the node as an additional property, so look for it in the node itself
|
// the node as an additional property, so look for it in the node itself.
|
||||||
if (node.hasProperty(propertyName))
|
// Or, if the ignoreIfMissing flag is set to false, show the property
|
||||||
|
if (node.hasProperty(propertyName) || getIgnoreIfMissing() == false)
|
||||||
{
|
{
|
||||||
String displayLabel = (String)getDisplayLabel();
|
String displayLabel = (String)getDisplayLabel();
|
||||||
if (displayLabel == null)
|
if (displayLabel == null)
|
||||||
@@ -91,8 +93,9 @@ public class UIProperty extends PropertySheetItem
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// warn the user that the property was not found anywhere!
|
// warn the user that the property was not found anywhere
|
||||||
logger.warn("Failed to find property definition for property '" + propertyName + "' for node: " + node.getNodeRef().toString());
|
if (missingPropsLogger.isDebugEnabled())
|
||||||
|
missingPropsLogger.debug("Failed to find property '" + propertyName + "' for node: " + node.getNodeRef().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -743,6 +743,7 @@ public class UIPropertySheet extends UIPanel implements NamingContainer
|
|||||||
propSheetItem.setName(item.getName());
|
propSheetItem.setName(item.getName());
|
||||||
propSheetItem.setConverter(item.getConverter());
|
propSheetItem.setConverter(item.getConverter());
|
||||||
propSheetItem.setComponentGenerator(item.getComponentGenerator());
|
propSheetItem.setComponentGenerator(item.getComponentGenerator());
|
||||||
|
propSheetItem.setIgnoreIfMissing(item.getIgnoreIfMissing());
|
||||||
|
|
||||||
String displayLabel = item.getDisplayLabel();
|
String displayLabel = item.getDisplayLabel();
|
||||||
if (item.getDisplayLabelId() != null)
|
if (item.getDisplayLabelId() != null)
|
||||||
|
@@ -86,7 +86,7 @@
|
|||||||
<config evaluator="string-compare" condition="Property Viewing">
|
<config evaluator="string-compare" condition="Property Viewing">
|
||||||
<property-sheet>
|
<property-sheet>
|
||||||
<show-property name="description" show-in-view-mode="false" show-in-edit-mode="false" />
|
<show-property name="description" show-in-view-mode="false" show-in-edit-mode="false" />
|
||||||
<show-property name="icon" />
|
<show-property name="icon" ignore-if-missing="false" />
|
||||||
<show-property name="uuid" show-in-view-mode="true" />
|
<show-property name="uuid" show-in-view-mode="true" />
|
||||||
</property-sheet>
|
</property-sheet>
|
||||||
</config>
|
</config>
|
||||||
|
@@ -161,7 +161,8 @@
|
|||||||
<show-property name="createddate" read-only="true" />
|
<show-property name="createddate" read-only="true" />
|
||||||
<show-property name="modifieddate" read-only="true" />
|
<show-property name="modifieddate" read-only="true" />
|
||||||
<show-property name="description" display-label="Description" read-only="false" />
|
<show-property name="description" display-label="Description" read-only="false" />
|
||||||
<show-property name="icon" component-generator="SpaceIconPickerGenerator" />
|
<show-property name="icon" component-generator="SpaceIconPickerGenerator"
|
||||||
|
ignore-if-missing="false" />
|
||||||
<show-property name="size" read-only="true" show-in-edit-mode="false" />
|
<show-property name="size" read-only="true" show-in-edit-mode="false" />
|
||||||
</property-sheet>
|
</property-sheet>
|
||||||
</config>
|
</config>
|
||||||
|
@@ -81,7 +81,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
</f:verbatim>
|
</f:verbatim>
|
||||||
<h:outputText value="#{msg.name}:" />
|
<h:outputText value="#{msg.subject}:" />
|
||||||
<f:verbatim>
|
<f:verbatim>
|
||||||
</td>
|
</td>
|
||||||
<td width="85%">
|
<td width="85%">
|
||||||
@@ -91,19 +91,6 @@
|
|||||||
<f:verbatim>
|
<f:verbatim>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td></td>
|
|
||||||
<td>
|
|
||||||
</f:verbatim>
|
|
||||||
<h:outputText value="#{msg.description}:" />
|
|
||||||
<f:verbatim>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
</f:verbatim>
|
|
||||||
<h:inputText id="description" value="#{DialogManager.bean.description}" size="35" maxlength="1024" />
|
|
||||||
<f:verbatim>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>
|
<td>
|
||||||
|
Reference in New Issue
Block a user