. Changed UIProperty to not output error to screen when a configured property is missing from a node

- instead a DEBUG log level message is output
. Title is no longer mandatory on edit-document-properties screen
. Titled aspect added to content doc if required the first time you save props in the document properties screen

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2043 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2005-12-16 12:52:44 +00:00
parent 337ca951f4
commit 991e650b00
3 changed files with 18 additions and 11 deletions

View File

@@ -149,7 +149,7 @@ public class DocumentPropertiesBean
// extra and deal with the Author prop if the aspect has not been applied yet // extra and deal with the Author prop if the aspect has not been applied yet
String author = (String)props.get(ContentModel.PROP_AUTHOR); String author = (String)props.get(ContentModel.PROP_AUTHOR);
if (author != null) if (author != null && author.length() != 0)
{ {
// add aspect if required // add aspect if required
if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_AUTHOR) == false) if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_AUTHOR) == false)
@@ -161,6 +161,16 @@ public class DocumentPropertiesBean
// else it will get updated in the later setProperties() call // else it will get updated in the later setProperties() call
} }
// deal with adding the "titled" aspect if required
String title = (String)props.get(ContentModel.PROP_TITLE);
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);
// props will get added later in setProperties()
}
// add the remaining properties // add the remaining properties
Iterator<String> iterProps = props.keySet().iterator(); Iterator<String> iterProps = props.keySet().iterator();
while (iterProps.hasNext()) while (iterProps.hasNext())

View File

@@ -110,15 +110,14 @@ public class UIProperty extends PropertySheetItem
else else
{ {
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("Failed to find property definition for property '" + propertyName + "'"); logger.debug("Failed to find property definition for property '" + propertyName + "' for node: " + node.getNodeRef().toString());
// NOTE: removed the error as it simply serves to confuse users and clutter the screen,
// the debugging log level should be used instead when developing property screens.
// add an error message as the property is not defined in the data dictionary and // add an error message as the property is not defined in the data dictionary and
// not in the node's set of properties // not in the node's set of properties
String msg = MessageFormat.format(Application.getMessage(context, MSG_ERROR_PROPERTY), new Object[] {propertyName}); //String msg = MessageFormat.format(Application.getMessage(context, MSG_ERROR_PROPERTY), new Object[] {propertyName});
Utils.addErrorMessage(msg); //Utils.addErrorMessage(msg);
if (logger.isDebugEnabled())
logger.debug("Added global error message: " + msg);
} }
} }
else else

View File

@@ -29,8 +29,7 @@
<script language="JavaScript1.2"> <script language="JavaScript1.2">
function checkButtonState() function checkButtonState()
{ {
if (document.getElementById("edit-doc-properties:file-name").value.length == 0 || if (document.getElementById("edit-doc-properties:file-name").value.length == 0)
document.getElementById("edit-doc-properties:title").value.length == 0)
{ {
document.getElementById("edit-doc-properties:ok-button").disabled = true; document.getElementById("edit-doc-properties:ok-button").disabled = true;
} }
@@ -133,8 +132,7 @@
<tr> <tr>
<td><nobr><h:outputText value="#{msg.title}" />:</nobr></td> <td><nobr><h:outputText value="#{msg.title}" />:</nobr></td>
<td> <td>
<h:inputText id="title" value="#{EditDocPropsDialog.properties.title}" size="35" maxlength="1024" <h:inputText id="title" value="#{EditDocPropsDialog.properties.title}" size="35" maxlength="1024" />
onkeyup="javascript:checkButtonState();" />&nbsp;*
</td> </td>
</tr> </tr>
<tr> <tr>