From c953c45c3db8e097cb9bc5a96e083f2b47fe35f3 Mon Sep 17 00:00:00 2001 From: Gavin Cornwell Date: Wed, 10 May 2006 08:54:14 +0000 Subject: [PATCH] - New edit properties dialog used when new content is added/created - Minor fixes/enhancements git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2805 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../web-client-config-custom.xml.sample | 13 +- config/alfresco/messages/webclient.properties | 19 +- config/alfresco/web-client-config-dialogs.xml | 10 + .../alfresco/web-client-config-properties.xml | 15 +- config/alfresco/web-client-config.xml | 1 + .../web/app/AlfrescoNavigationHandler.java | 15 +- .../web/bean/content/AddContentDialog.java | 36 ++- .../web/bean/content/BaseContentWizard.java | 64 +++++ .../web/bean/content/CreateContentWizard.java | 23 ++ .../content/EditContentPropertiesDialog.java | 255 ++++++++++++++++++ .../content/SetContentPropertiesDialog.java | 27 ++ .../web/bean/dialog/BaseDialogBean.java | 17 +- .../generator/MimeTypeSelectorGenerator.java | 23 +- .../web/bean/repository/Repository.java | 7 +- .../web/bean/rules/CreateRuleWizard.java | 116 ++++---- .../web/bean/rules/EditRuleWizard.java | 56 ++-- .../web/bean/spaces/CreateSpaceWizard.java | 2 +- .../web/bean/spaces/EditSpaceDialog.java | 5 +- .../ui/repo/component/UIMimeTypeSelector.java | 1 + source/web/WEB-INF/faces-config-beans.xml | 31 ++- .../web/WEB-INF/faces-config-navigation.xml | 16 -- source/web/jsp/content/add-content-dialog.jsp | 69 +++-- .../content/create-content-wizard/details.jsp | 25 +- .../jsp/content/edit-content-properties.jsp | 30 +++ source/web/jsp/dialog/document-details.jsp | 2 +- source/web/jsp/dialog/edit-text-inline.jsp | 4 +- 26 files changed, 711 insertions(+), 171 deletions(-) create mode 100644 source/java/org/alfresco/web/bean/content/EditContentPropertiesDialog.java create mode 100644 source/java/org/alfresco/web/bean/content/SetContentPropertiesDialog.java create mode 100644 source/web/jsp/content/edit-content-properties.jsp diff --git a/config/alfresco/extension/web-client-config-custom.xml.sample b/config/alfresco/extension/web-client-config-custom.xml.sample index c212eddfdb..b8a54707c8 100644 --- a/config/alfresco/extension/web-client-config-custom.xml.sample +++ b/config/alfresco/extension/web-client-config-custom.xml.sample @@ -68,11 +68,14 @@ - - - - - + + + + + diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index da271c7044..9658ee73fd 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -27,7 +27,7 @@ manage_content_users_description=Manage the permissions you have granted to user modify_user_roles_description=Modify the permissions granted to a user for accessing your space. modify_content_user_roles_description=Modify the permissions granted to a user for accessing your content. advancedsearch_description=Perform a more detailed search of the repository. -editdocument_description=Modify the document properties then click OK. +edit_content_description=Modify the content properties then click OK. editcategory_description=Set the category for the document then click OK. editworkflow_description=Modify the simple workflow properties then click OK. editspace_description=Modify the space properties then click OK. @@ -192,6 +192,7 @@ title=Title author=Author date=Date mimetype=Format +content_format=Content Format # Repo permission display labels # Note - these come from the server, the english translation is generally the same @@ -491,6 +492,7 @@ details_of=Details of preview_of=Preview of modify_props_of=Modify Properties of modify_space_properties=Modify Space Properties +modify_content_properties=Modify Content Properties preview=Preview in Template dashboard_view=Dashboard View dashboard=Dashboard @@ -506,6 +508,7 @@ version_history=Version History version=Version document_properties=Document Properties link_properties=Link Properties +general_properties=General Properties other_properties=Other Properties link_destination=Link Destination link_destination_details=Link Destination Details @@ -580,20 +583,22 @@ user_search_info=To find a user search for them using their first name, last nam # Content Wizard messages add_content_dialog_title=Add Content Dialog -add_content_dialog_desc=This dialog helps you to add a document to a space. -upload_document=Upload Document +add_content_dialog_desc=This dialog helps you to add content to a space. +upload_content=Upload Content properties=Properties general=General file_name=File Name content_type=Content Type content_format=Content Format inline_editable=Inline Editable -locate_document=Locate document to upload +locate_content=Locate content to upload content_location=Location -upload_document=Upload Document -uploaded_filename=Uploaded File +uploaded_content=Uploaded Content click_upload=Click upload -file_upload_success=The file ''{0}'' was uploaded successfully. If the file you uploaded does not exist, then an empty file will be created with the name you specified. +file_upload_success=''{0}'' was uploaded successfully. +modify_props_when_page_closes=Modify all properties when this page closes. +modify_props_when_wizard_closes=Modify all properties when this wizard closes. +modify_props_help_text=Rules applied to this content may require you to enter additional information. content_finish_instruction=To add the content to this space click Finish. To review or change your selections click Back. create_content_title=Create Content Wizard create_content_desc=This wizard helps you to create a new document in a space. diff --git a/config/alfresco/web-client-config-dialogs.xml b/config/alfresco/web-client-config-dialogs.xml index 294d194086..8a8dfd1e36 100644 --- a/config/alfresco/web-client-config-dialogs.xml +++ b/config/alfresco/web-client-config-dialogs.xml @@ -15,6 +15,16 @@ icon="/images/icons/create_space_large.gif" title-id="modify_space_properties" description-id="editspace_description" /> + + + + + + diff --git a/config/alfresco/web-client-config-properties.xml b/config/alfresco/web-client-config-properties.xml index 95cc11676a..03da2577eb 100644 --- a/config/alfresco/web-client-config-properties.xml +++ b/config/alfresco/web-client-config-properties.xml @@ -2,11 +2,14 @@ - - - - - + + + + + @@ -111,7 +114,7 @@ - + diff --git a/config/alfresco/web-client-config.xml b/config/alfresco/web-client-config.xml index 9559548672..a1885d0414 100644 --- a/config/alfresco/web-client-config.xml +++ b/config/alfresco/web-client-config.xml @@ -173,6 +173,7 @@ + diff --git a/source/java/org/alfresco/web/app/AlfrescoNavigationHandler.java b/source/java/org/alfresco/web/app/AlfrescoNavigationHandler.java index 3be7b8c876..c87c132971 100644 --- a/source/java/org/alfresco/web/app/AlfrescoNavigationHandler.java +++ b/source/java/org/alfresco/web/app/AlfrescoNavigationHandler.java @@ -528,7 +528,7 @@ public class AlfrescoNavigationHandler extends NavigationHandler } else { - logger.warn("Failed to find configuration for dialog '" + name + "'"); + //logger.warn("Failed to find configuration for dialog '" + name + "'"); // send the dialog name as the outcome to the original handler handleDispatch(context, fromAction, name); @@ -565,7 +565,7 @@ public class AlfrescoNavigationHandler extends NavigationHandler } else { - logger.warn("Failed to find configuration for wizard '" + name + "'"); + //logger.warn("Failed to find configuration for wizard '" + name + "'"); // send the dialog name as the outcome to the original handler handleDispatch(context, fromAction, name); @@ -610,7 +610,16 @@ public class AlfrescoNavigationHandler extends NavigationHandler if (logger.isDebugEnabled()) logger.debug("Closing " + closingItem + " with an overridden outcome of '" + overriddenOutcome + "'"); - navigate(context, fromAction, overriddenOutcome); + // if the override is calling another dialog or wizard come back through + // the navigation handler from the beginning + if (isDialog(overriddenOutcome) || isWizard(overriddenOutcome)) + { + this.handleNavigation(context, fromAction, overriddenOutcome); + } + else + { + navigate(context, fromAction, overriddenOutcome); + } } } else diff --git a/source/java/org/alfresco/web/bean/content/AddContentDialog.java b/source/java/org/alfresco/web/bean/content/AddContentDialog.java index 4684a18a1c..4b0af8bacc 100644 --- a/source/java/org/alfresco/web/bean/content/AddContentDialog.java +++ b/source/java/org/alfresco/web/bean/content/AddContentDialog.java @@ -9,6 +9,7 @@ import javax.faces.event.ActionEvent; import org.alfresco.repo.content.MimetypeMap; import org.alfresco.web.app.Application; import org.alfresco.web.bean.FileUploadBean; +import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Repository; /** @@ -21,7 +22,7 @@ public class AddContentDialog extends BaseContentWizard protected File file; // ------------------------------------------------------------------------------ - // Wizard implementation + // Dialog implementation @Override protected String finishImpl(FacesContext context, String outcome) @@ -29,7 +30,8 @@ public class AddContentDialog extends BaseContentWizard { saveContent(this.file, null); - return "cancel"; + // return default outcome + return outcome; } @Override @@ -39,10 +41,38 @@ public class AddContentDialog extends BaseContentWizard clearUpload(); } + + @Override + protected String doPostCommitProcessing(FacesContext context, String outcome) + { + // as we were successful, go to the set properties dialog if asked + // to otherwise just return + if (this.showOtherProperties) + { + // we are going to immediately edit the properties so we need + // to setup the BrowseBean context appropriately + this.browseBean.setDocument(new Node(this.createdNode)); + + return "dialog:setContentProperties"; + } + else + { + return outcome; + } + } + + @Override + protected String getDefaultFinishOutcome() + { + // as we are using this dialog outside the dialog framework + // just go back to the main page + + return "browse"; + } // ------------------------------------------------------------------------------ // Bean getters and setters - + /** * @return Returns the message to display when a file has been uploaded */ diff --git a/source/java/org/alfresco/web/bean/content/BaseContentWizard.java b/source/java/org/alfresco/web/bean/content/BaseContentWizard.java index ba365a0b9c..f44dc5e165 100644 --- a/source/java/org/alfresco/web/bean/content/BaseContentWizard.java +++ b/source/java/org/alfresco/web/bean/content/BaseContentWizard.java @@ -45,6 +45,8 @@ public abstract class BaseContentWizard extends BaseWizardBean protected String mimeType; protected String objectType; protected boolean inlineEdit; + protected boolean otherPropertiesChoiceVisible = true; + protected boolean showOtherProperties = true; // the NodeRef of the node created during finish protected NodeRef createdNode; @@ -68,6 +70,8 @@ public abstract class BaseContentWizard extends BaseWizardBean this.mimeType = null; this.inlineEdit = false; this.objectType = ContentModel.TYPE_CONTENT.toString(); + + initOtherProperties(); } @Override @@ -200,6 +204,32 @@ public abstract class BaseContentWizard extends BaseWizardBean this.inlineEdit = inlineEdit; } + /** + * @return Determines whether the choice to modify all properties + * is shown + */ + public boolean getOtherPropertiesChoiceVisible() + { + return this.otherPropertiesChoiceVisible; + } + + /** + * @return Determines whether the edit properties dialog should be + * shown when this one ends + */ + public boolean getShowOtherProperties() + { + return this.showOtherProperties; + } + + /** + * @param showOthers Sets whether the edit properties dialog is shown + */ + public void setShowOtherProperties(boolean showOthers) + { + this.showOtherProperties = showOthers; + } + /** * @return Returns a list of object types to allow the user to select from */ @@ -417,4 +447,38 @@ public abstract class BaseContentWizard extends BaseWizardBean return objType; } + + /** + * Initialises the other properties flags from config + */ + protected void initOtherProperties() + { + ConfigService configSvc = Application.getConfigService(FacesContext.getCurrentInstance()); + + if (configSvc != null) + { + Config config = configSvc.getConfig("Content Wizards"); + if (config != null) + { + ConfigElement otherPropsCfg = config.getConfigElement("other-properties"); + if (otherPropsCfg != null) + { + // get the attributes + String userChoiceVisible = otherPropsCfg.getAttribute("user-choice-visible"); + String userChoiceDefault = otherPropsCfg.getAttribute("user-choice-default"); + + // set the defaults + if (userChoiceVisible != null) + { + this.otherPropertiesChoiceVisible = Boolean.parseBoolean(userChoiceVisible); + } + + if (userChoiceDefault != null) + { + this.showOtherProperties = Boolean.parseBoolean(userChoiceDefault); + } + } + } + } + } } diff --git a/source/java/org/alfresco/web/bean/content/CreateContentWizard.java b/source/java/org/alfresco/web/bean/content/CreateContentWizard.java index 5daf28b927..0e874b5787 100644 --- a/source/java/org/alfresco/web/bean/content/CreateContentWizard.java +++ b/source/java/org/alfresco/web/bean/content/CreateContentWizard.java @@ -12,7 +12,9 @@ import org.alfresco.config.Config; import org.alfresco.config.ConfigElement; import org.alfresco.config.ConfigService; import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.web.app.AlfrescoNavigationHandler; import org.alfresco.web.app.Application; +import org.alfresco.web.bean.repository.Node; import org.alfresco.web.data.IDataContainer; import org.alfresco.web.data.QuickSort; import org.apache.commons.logging.Log; @@ -40,6 +42,7 @@ public class CreateContentWizard extends BaseContentWizard { saveContent(null, this.content); + // return the default outcome return outcome; } @@ -74,6 +77,26 @@ public class CreateContentWizard extends BaseContentWizard return disabled; } + @Override + protected String doPostCommitProcessing(FacesContext context, String outcome) + { + // as we were successful, go to the set properties dialog if asked + // to otherwise just return + if (this.showOtherProperties) + { + // we are going to immediately edit the properties so we need + // to setup the BrowseBean context appropriately + this.browseBean.setDocument(new Node(this.createdNode)); + + return getDefaultFinishOutcome() + AlfrescoNavigationHandler.OUTCOME_SEPARATOR + + "dialog:setContentProperties"; + } + else + { + return outcome; + } + } + // ------------------------------------------------------------------------------ // Bean Getters and Setters diff --git a/source/java/org/alfresco/web/bean/content/EditContentPropertiesDialog.java b/source/java/org/alfresco/web/bean/content/EditContentPropertiesDialog.java new file mode 100644 index 0000000000..d4cb19da64 --- /dev/null +++ b/source/java/org/alfresco/web/bean/content/EditContentPropertiesDialog.java @@ -0,0 +1,255 @@ +package org.alfresco.web.bean.content; + +import java.io.Serializable; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import javax.faces.context.FacesContext; + +import org.alfresco.model.ContentModel; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.dictionary.PropertyDefinition; +import org.alfresco.service.cmr.model.FileExistsException; +import org.alfresco.service.cmr.repository.AssociationRef; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.ContentData; +import org.alfresco.service.cmr.repository.InvalidNodeRefException; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.alfresco.web.app.Application; +import org.alfresco.web.bean.dialog.BaseDialogBean; +import org.alfresco.web.bean.repository.Node; +import org.alfresco.web.bean.repository.Repository; + +/** + * Bean implementation of the "Edit Content Properties" dialog. + * + * @author gavinc + */ +public class EditContentPropertiesDialog extends BaseDialogBean +{ + protected static final String TEMP_PROP_MIMETYPE = "mimetype"; + + protected Node editableNode; + + // ------------------------------------------------------------------------------ + // Dialog implementation + + @Override + public void init() + { + super.init(); + + // setup the editable node + this.editableNode = new Node(this.browseBean.getDocument().getNodeRef()); + + // special case for Mimetype - since this is a sub-property of the ContentData object + // we must extract it so it can be edited in the client, then we check for it later + // and create a new ContentData object to wrap it and it's associated URL + ContentData content = (ContentData)this.editableNode.getProperties().get(ContentModel.PROP_CONTENT); + if (content != null) + { + this.editableNode.getProperties().put(TEMP_PROP_MIMETYPE, content.getMimetype()); + } + } + + @Override + protected String finishImpl(FacesContext context, String outcome) + throws Exception + { + NodeRef nodeRef = this.browseBean.getDocument().getNodeRef(); + Map props = this.editableNode.getProperties(); + + // get the name and move the node as necessary + String name = (String) props.get(ContentModel.PROP_NAME); + if (name != null) + { + fileFolderService.rename(nodeRef, name); + } + + Map properties = this.nodeService.getProperties(nodeRef); + // 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 + String mimetype = (String)props.get(TEMP_PROP_MIMETYPE); + if (mimetype != null) + { + // remove temporary prop from list so it isn't saved with the others + props.remove(TEMP_PROP_MIMETYPE); + ContentData contentData = (ContentData)props.get(ContentModel.PROP_CONTENT); + if (contentData != null) + { + contentData = ContentData.setMimetype(contentData, mimetype); + 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) + { + // add aspect if required + if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_AUTHOR) == false) + { + Map authorProps = new HashMap(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 + 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 + Iterator iterProps = props.keySet().iterator(); + while (iterProps.hasNext()) + { + String propName = iterProps.next(); + QName qname = QName.createQName(propName); + + // make sure the property is represented correctly + Serializable propValue = (Serializable)props.get(propName); + + // check for empty strings when using number types, set to null in this case + if ((propValue != null) && (propValue instanceof String) && + (propValue.toString().length() == 0)) + { + PropertyDefinition propDef = this.dictionaryService.getProperty(qname); + if (propDef != null) + { + if (propDef.getDataType().getName().equals(DataTypeDefinition.DOUBLE) || + propDef.getDataType().getName().equals(DataTypeDefinition.FLOAT) || + propDef.getDataType().getName().equals(DataTypeDefinition.INT) || + propDef.getDataType().getName().equals(DataTypeDefinition.LONG)) + { + propValue = null; + } + } + } + + properties.put(qname, propValue); + } + + // send the properties back to the repository + this.nodeService.setProperties(this.browseBean.getDocument().getNodeRef(), properties); + + // we also need to persist any association changes that may have been made + + // add any associations added in the UI + Map> addedAssocs = this.editableNode.getAddedAssociations(); + for (Map typedAssoc : addedAssocs.values()) + { + for (AssociationRef assoc : typedAssoc.values()) + { + this.nodeService.createAssociation(assoc.getSourceRef(), assoc.getTargetRef(), assoc.getTypeQName()); + } + } + + // remove any association removed in the UI + Map> removedAssocs = this.editableNode.getRemovedAssociations(); + for (Map typedAssoc : removedAssocs.values()) + { + for (AssociationRef assoc : typedAssoc.values()) + { + this.nodeService.removeAssociation(assoc.getSourceRef(), assoc.getTargetRef(), assoc.getTypeQName()); + } + } + + // add any child associations added in the UI + Map> addedChildAssocs = this.editableNode.getAddedChildAssociations(); + for (Map typedAssoc : addedChildAssocs.values()) + { + for (ChildAssociationRef assoc : typedAssoc.values()) + { + this.nodeService.addChild(assoc.getParentRef(), assoc.getChildRef(), assoc.getTypeQName(), assoc.getTypeQName()); + } + } + + // remove any child association removed in the UI + Map> removedChildAssocs = this.editableNode.getRemovedChildAssociations(); + for (Map typedAssoc : removedChildAssocs.values()) + { + for (ChildAssociationRef assoc : typedAssoc.values()) + { + this.nodeService.removeChild(assoc.getParentRef(), assoc.getChildRef()); + } + } + + return outcome; + } + + @Override + protected String doPostCommitProcessing(FacesContext context, String outcome) + { + // reset the document held by the browse bean as it's just been updated + this.browseBean.getDocument().reset(); + + return outcome; + } + + /** + * Formats the error message to display if an error occurs during finish processing + * + * @param The exception + * @return The formatted message + */ + @Override + protected String formatErrorMessage(Throwable exception) + { + if (exception instanceof FileExistsException) + { + return MessageFormat.format(Application.getMessage( + FacesContext.getCurrentInstance(), Repository.ERROR_EXISTS), + ((FileExistsException)exception).getExisting().getName()); + } + else if (exception instanceof InvalidNodeRefException) + { + return MessageFormat.format(Application.getMessage( + FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), + new Object[] {this.browseBean.getDocument().getId()}); + } + else + { + return super.formatErrorMessage(exception); + } + } + + @Override + protected String getErrorOutcome(Throwable exception) + { + if (exception instanceof InvalidNodeRefException) + { + // this failure means the node no longer exists - we cannot show + // the content properties screen again so go back to the main page + return "browse"; + } + else + { + return super.getErrorOutcome(exception); + } + } + + // ------------------------------------------------------------------------------ + // Bean getters and setters + + /** + * Returns the node being edited + * + * @return The node being edited + */ + public Node getEditableNode() + { + return this.editableNode; + } +} diff --git a/source/java/org/alfresco/web/bean/content/SetContentPropertiesDialog.java b/source/java/org/alfresco/web/bean/content/SetContentPropertiesDialog.java new file mode 100644 index 0000000000..e784386c87 --- /dev/null +++ b/source/java/org/alfresco/web/bean/content/SetContentPropertiesDialog.java @@ -0,0 +1,27 @@ +package org.alfresco.web.bean.content; + +import org.alfresco.web.app.AlfrescoNavigationHandler; + +/** + * Bean implementation of the "Set Content Properties" dialog. + * + * @author gavinc + */ +public class SetContentPropertiesDialog extends EditContentPropertiesDialog +{ + @Override + protected String getDefaultCancelOutcome() + { + return super.getDefaultCancelOutcome() + + AlfrescoNavigationHandler.OUTCOME_SEPARATOR + + "browse"; + } + + @Override + protected String getDefaultFinishOutcome() + { + return super.getDefaultFinishOutcome() + + AlfrescoNavigationHandler.OUTCOME_SEPARATOR + + "browse"; + } +} diff --git a/source/java/org/alfresco/web/bean/dialog/BaseDialogBean.java b/source/java/org/alfresco/web/bean/dialog/BaseDialogBean.java index c47e81652a..dae1f1aa21 100644 --- a/source/java/org/alfresco/web/bean/dialog/BaseDialogBean.java +++ b/source/java/org/alfresco/web/bean/dialog/BaseDialogBean.java @@ -82,7 +82,7 @@ public abstract class BaseDialogBean implements IDialogBean // rollback the transaction try { if (tx != null) {tx.rollback();} } catch (Exception ex) {} Utils.addErrorMessage(formatErrorMessage(e)); - outcome = null; + outcome = getErrorOutcome(e); } } @@ -209,11 +209,24 @@ public abstract class BaseDialogBean implements IDialogBean } /** + * The default message id to use in error messages + * * @return The error message lookup id */ protected String getErrorMessageId() { - return "error_generic"; + return Repository.ERROR_GENERIC; + } + + /** + * The outcome to return if the given exception occurs + * + * @param exception The exception that got thrown + * @return The error outcome, null by default + */ + protected String getErrorOutcome(Throwable exception) + { + return null; } /** diff --git a/source/java/org/alfresco/web/bean/generator/MimeTypeSelectorGenerator.java b/source/java/org/alfresco/web/bean/generator/MimeTypeSelectorGenerator.java index bda8410b89..fea5476f8b 100644 --- a/source/java/org/alfresco/web/bean/generator/MimeTypeSelectorGenerator.java +++ b/source/java/org/alfresco/web/bean/generator/MimeTypeSelectorGenerator.java @@ -31,17 +31,20 @@ public class MimeTypeSelectorGenerator extends BaseComponentGenerator UIPropertySheet propertySheet, PropertySheetItem property, PropertyDefinition propertyDef, UIComponent component) { - if (property.getConverter() != null) + if (propertySheet.inEditMode() == false) { - // create and add the custom converter - createAndSetConverter(context, property.getConverter(), component); - } - else - { - // if there isn't a custom converter add the mime type - // converter as a default - createAndSetConverter(context, MimeTypeConverter.CONVERTER_ID, - component); + if (property.getConverter() != null) + { + // create and add the custom converter + createAndSetConverter(context, property.getConverter(), component); + } + else + { + // if there isn't a custom converter add the mime type + // converter as a default + createAndSetConverter(context, MimeTypeConverter.CONVERTER_ID, + component); + } } } diff --git a/source/java/org/alfresco/web/bean/repository/Repository.java b/source/java/org/alfresco/web/bean/repository/Repository.java index 54d9ae2996..3f3b4b0ea0 100644 --- a/source/java/org/alfresco/web/bean/repository/Repository.java +++ b/source/java/org/alfresco/web/bean/repository/Repository.java @@ -68,6 +68,7 @@ public final class Repository public static final String ERROR_GENERIC = "error_generic"; public static final String ERROR_NOHOME = "error_homespace"; public static final String ERROR_SEARCH = "error_search"; + public static final String ERROR_EXISTS = "error_exists"; private static final String METADATA_EXTACTER_REGISTRY = "metadataExtracterRegistry"; @@ -76,12 +77,6 @@ public final class Repository /** cache of client StoreRef */ private static StoreRef storeRef = null; - /** reference to Person folder */ - private static NodeRef peopleRef = null; - - /** reference to System folder */ - private static NodeRef systemRef = null; - /** reference to the NamespaceService */ private static NamespaceService namespaceService = null; diff --git a/source/java/org/alfresco/web/bean/rules/CreateRuleWizard.java b/source/java/org/alfresco/web/bean/rules/CreateRuleWizard.java index dcc2753e16..8e57e1a847 100644 --- a/source/java/org/alfresco/web/bean/rules/CreateRuleWizard.java +++ b/source/java/org/alfresco/web/bean/rules/CreateRuleWizard.java @@ -76,8 +76,7 @@ public class CreateRuleWizard extends BaseActionWizard protected static final String CONDITION_PAGES_LOCATION = "/jsp/rules/"; private static final Log logger = LogFactory.getLog(CreateRuleWizard.class); - - + // ------------------------------------------------------------------------------ // Wizard implementation @@ -209,63 +208,7 @@ public class CreateRuleWizard extends BaseActionWizard { return "error_rule"; } - - /** - * Sets up the given rule using the current state of the wizard - * - * @param context FacesContext - * @param rule The rule to setup - * @param outcome The default outcome - * @return The outcome - */ - protected String setupRule(FacesContext context, Rule rule, String outcome) - { - // setup the rule and add it to the space - rule.setTitle(this.title); - rule.setDescription(this.description); - rule.applyToChildren(this.applyToSubSpaces); - rule.setExecuteAsynchronously(this.runInBackground); - - // add all the conditions to the rule - for (Map condParams : this.allConditionsProperties) - { - String conditionName = (String)condParams.get(PROP_CONDITION_NAME); - this.condition = conditionName; - this.currentConditionProperties = condParams; - Map repoCondParams = buildConditionParams(); - - // add the condition to the rule - ActionCondition condition = this.actionService. - createActionCondition(conditionName); - condition.setParameterValues(repoCondParams); - - // specify whether the condition result should be inverted - Boolean not = (Boolean)condParams.get(PROP_CONDITION_NOT); - condition.setInvertCondition(((Boolean)not).booleanValue()); - - rule.addActionCondition(condition); - } - - // add all the actions to the rule - for (Map actionParams : this.allActionsProperties) - { - // use the base class version of buildActionParams(), but for this we need - // to setup the currentActionProperties and action variables - String actionName = (String)actionParams.get(PROP_ACTION_NAME); - this.action = actionName; - this.currentActionProperties = actionParams; - Map repoActionParams = buildActionParams(); - - // add the action to the rule - Action action = this.actionService.createAction(actionName); - action.setParameterValues(repoActionParams); - rule.addAction(action); - } - - return outcome; - } - - + // ------------------------------------------------------------------------------ // Bean Getters and Setters @@ -680,6 +623,61 @@ public class CreateRuleWizard extends BaseActionWizard // ------------------------------------------------------------------------------ // Helper methods + /** + * Sets up the given rule using the current state of the wizard + * + * @param context FacesContext + * @param rule The rule to setup + * @param outcome The default outcome + * @return The outcome + */ + protected String setupRule(FacesContext context, Rule rule, String outcome) + { + // setup the rule and add it to the space + rule.setTitle(this.title); + rule.setDescription(this.description); + rule.applyToChildren(this.applyToSubSpaces); + rule.setExecuteAsynchronously(this.runInBackground); + + // add all the conditions to the rule + for (Map condParams : this.allConditionsProperties) + { + String conditionName = (String)condParams.get(PROP_CONDITION_NAME); + this.condition = conditionName; + this.currentConditionProperties = condParams; + Map repoCondParams = buildConditionParams(); + + // add the condition to the rule + ActionCondition condition = this.actionService. + createActionCondition(conditionName); + condition.setParameterValues(repoCondParams); + + // specify whether the condition result should be inverted + Boolean not = (Boolean)condParams.get(PROP_CONDITION_NOT); + condition.setInvertCondition(((Boolean)not).booleanValue()); + + rule.addActionCondition(condition); + } + + // add all the actions to the rule + for (Map actionParams : this.allActionsProperties) + { + // use the base class version of buildActionParams(), but for this we need + // to setup the currentActionProperties and action variables + String actionName = (String)actionParams.get(PROP_ACTION_NAME); + this.action = actionName; + this.currentActionProperties = actionParams; + Map repoActionParams = buildActionParams(); + + // add the action to the rule + Action action = this.actionService.createAction(actionName); + action.setParameterValues(repoActionParams); + rule.addAction(action); + } + + return outcome; + } + /** * Sets up any default state required by the UI for collecting the * condition settings. The view id to use for the condition UI can also diff --git a/source/java/org/alfresco/web/bean/rules/EditRuleWizard.java b/source/java/org/alfresco/web/bean/rules/EditRuleWizard.java index f84460d0c3..3872772cd3 100644 --- a/source/java/org/alfresco/web/bean/rules/EditRuleWizard.java +++ b/source/java/org/alfresco/web/bean/rules/EditRuleWizard.java @@ -46,31 +46,8 @@ public class EditRuleWizard extends CreateRuleWizard { private static final Log logger = LogFactory.getLog(EditRuleWizard.class); - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - // get hold of the space the rule will apply to and make sure - // it is actionable - Node currentSpace = browseBean.getActionSpace(); - - // get the existing rule - Rule rule = this.rulesBean.getCurrentRule(); - - // remove all the conditions and actions from the current rule - rule.removeAllActionConditions(); - rule.removeAllActions(); - - // re-setup the rule - outcome = setupRule(context, rule, outcome); - - // Save the rule - this.ruleService.saveRule(currentSpace.getNodeRef(), rule); - - if (logger.isDebugEnabled()) - logger.debug("Updated rule '" + this.title + "'"); - - return outcome; - } + // ------------------------------------------------------------------------------ + // Wizard implementation @Override public void init() @@ -133,6 +110,35 @@ public class EditRuleWizard extends CreateRuleWizard this.action = null; } + @Override + protected String finishImpl(FacesContext context, String outcome) throws Exception + { + // get hold of the space the rule will apply to and make sure + // it is actionable + Node currentSpace = browseBean.getActionSpace(); + + // get the existing rule + Rule rule = this.rulesBean.getCurrentRule(); + + // remove all the conditions and actions from the current rule + rule.removeAllActionConditions(); + rule.removeAllActions(); + + // re-setup the rule + outcome = setupRule(context, rule, outcome); + + // Save the rule + this.ruleService.saveRule(currentSpace.getNodeRef(), rule); + + if (logger.isDebugEnabled()) + logger.debug("Updated rule '" + this.title + "'"); + + return outcome; + } + + // ------------------------------------------------------------------------------ + // Helper methods + /** * Populates a Map of properties the wizard is expecting for the given condition * diff --git a/source/java/org/alfresco/web/bean/spaces/CreateSpaceWizard.java b/source/java/org/alfresco/web/bean/spaces/CreateSpaceWizard.java index 9c8d503e4c..da937ea1f1 100644 --- a/source/java/org/alfresco/web/bean/spaces/CreateSpaceWizard.java +++ b/source/java/org/alfresco/web/bean/spaces/CreateSpaceWizard.java @@ -654,7 +654,7 @@ public class CreateSpaceWizard extends BaseWizardBean if (exception instanceof FileExistsException) { return MessageFormat.format(Application.getMessage( - FacesContext.getCurrentInstance(), "error_exists"), + FacesContext.getCurrentInstance(), Repository.ERROR_EXISTS), ((FileExistsException)exception).getExisting().getName()); } else diff --git a/source/java/org/alfresco/web/bean/spaces/EditSpaceDialog.java b/source/java/org/alfresco/web/bean/spaces/EditSpaceDialog.java index 7de1b011d4..8e7ca08cf0 100644 --- a/source/java/org/alfresco/web/bean/spaces/EditSpaceDialog.java +++ b/source/java/org/alfresco/web/bean/spaces/EditSpaceDialog.java @@ -22,6 +22,7 @@ import org.alfresco.service.namespace.QName; import org.alfresco.web.app.Application; import org.alfresco.web.bean.dialog.BaseDialogBean; import org.alfresco.web.bean.repository.Node; +import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.ui.common.component.UIListItem; /** @@ -225,14 +226,14 @@ public class EditSpaceDialog extends BaseDialogBean if (exception instanceof FileExistsException) { return MessageFormat.format(Application.getMessage( - FacesContext.getCurrentInstance(), "error_exists"), + FacesContext.getCurrentInstance(), Repository.ERROR_EXISTS), ((FileExistsException)exception).getExisting().getName()); } else { return MessageFormat.format(Application.getMessage( FacesContext.getCurrentInstance(), "error_space"), - ((FileExistsException)exception).getExisting().getName()); + exception.getMessage()); } } } diff --git a/source/java/org/alfresco/web/ui/repo/component/UIMimeTypeSelector.java b/source/java/org/alfresco/web/ui/repo/component/UIMimeTypeSelector.java index 5eee0c3d2e..1adeda81e0 100644 --- a/source/java/org/alfresco/web/ui/repo/component/UIMimeTypeSelector.java +++ b/source/java/org/alfresco/web/ui/repo/component/UIMimeTypeSelector.java @@ -37,6 +37,7 @@ public class UIMimeTypeSelector extends UISelectOne { UISelectItems items = (UISelectItems)context.getApplication(). createComponent("javax.faces.SelectItems"); + items.setId(this.getId() + "_items"); items.setValue(createList()); // add the child component diff --git a/source/web/WEB-INF/faces-config-beans.xml b/source/web/WEB-INF/faces-config-beans.xml index fd1d2f52a9..05f90c42fc 100644 --- a/source/web/WEB-INF/faces-config-beans.xml +++ b/source/web/WEB-INF/faces-config-beans.xml @@ -447,10 +447,35 @@ - The bean that backs up the Edit Document Properties Dialog + The bean that backs up the Set Content Properties Dialog - EditDocPropsDialog - org.alfresco.web.bean.DocumentPropertiesBean + SetContentPropertiesDialog + org.alfresco.web.bean.content.SetContentPropertiesDialog + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + dictionaryService + #{DictionaryService} + + + browseBean + #{BrowseBean} + + + + + + The bean that backs up the Edit Content Properties Dialog + + EditContentPropertiesDialog + org.alfresco.web.bean.content.EditContentPropertiesDialog session nodeService diff --git a/source/web/WEB-INF/faces-config-navigation.xml b/source/web/WEB-INF/faces-config-navigation.xml index 799faf3a84..88813750a5 100644 --- a/source/web/WEB-INF/faces-config-navigation.xml +++ b/source/web/WEB-INF/faces-config-navigation.xml @@ -287,10 +287,6 @@ /jsp/dialog/document-details.jsp - - editDocProperties - /jsp/dialog/edit-document-properties.jsp - checkoutFile /jsp/dialog/checkout-file.jsp @@ -353,18 +349,6 @@ - - /jsp/dialog/edit-document-properties.jsp - - cancel - /jsp/dialog/document-details.jsp - - - finish - /jsp/dialog/document-details.jsp - - - /jsp/dialog/edit-simple-workflow.jsp diff --git a/source/web/jsp/content/add-content-dialog.jsp b/source/web/jsp/content/add-content-dialog.jsp index e70466a341..4d4987bc79 100644 --- a/source/web/jsp/content/add-content-dialog.jsp +++ b/source/web/jsp/content/add-content-dialog.jsp @@ -136,30 +136,30 @@ if (dialog != null && dialog.getFileName() != null) <% if (fileUploaded == false) { %> - + - - - - @@ -169,11 +169,11 @@ if (dialog != null && dialog.getFileName() != null) <% if (fileUploaded) { %> -
- + +
- + +
- <%=Application.getMessage(FacesContext.getCurrentInstance(), "click_upload")%> + + 2. <%=Application.getMessage(FacesContext.getCurrentInstance(), "click_upload")%>
+ " />
+ @@ -191,23 +191,27 @@ if (dialog != null && dialog.getFileName() != null) - - - + + @@ -218,6 +222,7 @@ if (dialog != null && dialog.getFileName() != null) + @@ -225,7 +230,35 @@ if (dialog != null && dialog.getFileName() != null) - <% } %> + <% if (dialog.getOtherPropertiesChoiceVisible()) { %> + + + + + + + + <% } } %>
- +
-   + +  
- + + + + +  * + onchange="checkButtonState();" />
+   +
+ + + + + + + + + + +
+ +
+ + + +
+
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %> @@ -297,7 +330,7 @@ if (dialog != null && dialog.getFileName() != null) { finishButtonPressed = false; return validateName(document.getElementById("add-content-upload-end:file-name"), - '', true); + '', true); } else { diff --git a/source/web/jsp/content/create-content-wizard/details.jsp b/source/web/jsp/content/create-content-wizard/details.jsp index 6f29b791fc..dc072dce91 100644 --- a/source/web/jsp/content/create-content-wizard/details.jsp +++ b/source/web/jsp/content/create-content-wizard/details.jsp @@ -68,18 +68,26 @@ - - + + + + + + + + + @@ -87,4 +95,15 @@ - \ No newline at end of file + + + + + + + + + diff --git a/source/web/jsp/content/edit-content-properties.jsp b/source/web/jsp/content/edit-content-properties.jsp new file mode 100644 index 0000000000..6451f6ed83 --- /dev/null +++ b/source/web/jsp/content/edit-content-properties.jsp @@ -0,0 +1,30 @@ +<%-- + Copyright (C) 2005 Alfresco, Inc. + + Licensed under the Mozilla Public License version 1.1 + with a permitted attribution clause. You may obtain a + copy of the License at + + http://www.alfresco.org/legal/license.txt + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + either express or implied. See the License for the specific + language governing permissions and limitations under the + License. +--%> +<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> +<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> +<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> +<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> + + + + + + + + \ No newline at end of file diff --git a/source/web/jsp/dialog/document-details.jsp b/source/web/jsp/dialog/document-details.jsp index 57d4c06f5c..2586e7d60c 100644 --- a/source/web/jsp/dialog/document-details.jsp +++ b/source/web/jsp/dialog/document-details.jsp @@ -184,7 +184,7 @@ + action="dialog:editContentProperties" /> diff --git a/source/web/jsp/dialog/edit-text-inline.jsp b/source/web/jsp/dialog/edit-text-inline.jsp index bb9dc42047..137dd3e494 100644 --- a/source/web/jsp/dialog/edit-text-inline.jsp +++ b/source/web/jsp/dialog/edit-text-inline.jsp @@ -137,7 +137,9 @@ <%-- Inline editor --%>
- + <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %> + + <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %>