- 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
This commit is contained in:
Gavin Cornwell
2006-05-10 08:54:14 +00:00
parent 7f6fabb0b6
commit c953c45c3d
26 changed files with 711 additions and 171 deletions

View File

@@ -68,11 +68,14 @@
<config evaluator="node-type" condition="my:sop">
<property-sheet>
<show-property name="name" show-in-edit-mode="false" />
<show-property name="mimetype" display-label-id="mimetype" converter="org.alfresco.faces.MimeTypeConverter" show-in-edit-mode="false" />
<show-property name="title" show-in-edit-mode="false" />
<show-property name="description" show-in-edit-mode="false" />
<show-property name="size" display-label-id="size" converter="org.alfresco.faces.ByteSizeConverter" show-in-edit-mode="false" />
<show-property name="name" />
<show-property name="mimetype" display-label-id="content_type"
component-generator="MimeTypeSelectorGenerator" />
<show-property name="title" />
<show-property name="description" />
<show-property name="size" display-label-id="size"
converter="org.alfresco.faces.ByteSizeConverter"
show-in-edit-mode="false" />
<show-property name="my:publishedDate" />
<show-association name="my:signOff" />
<show-property name="my:authorisedBy" />

View File

@@ -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.

View File

@@ -15,6 +15,16 @@
icon="/images/icons/create_space_large.gif" title-id="modify_space_properties"
description-id="editspace_description" />
<!-- Definition of the set content properties dialog -->
<dialog name="setContentProperties" page="/jsp/content/edit-content-properties.jsp"
managed-bean="SetContentPropertiesDialog" icon="/images/icons/details_large.gif"
title-id="modify_content_properties" description-id="edit_content_description" />
<!-- Definition of the edit content properties dialog -->
<dialog name="editContentProperties" page="/jsp/content/edit-content-properties.jsp"
managed-bean="EditContentPropertiesDialog" icon="/images/icons/details_large.gif"
title-id="modify_content_properties" description-id="edit_content_description" />
</dialogs>
</config>

View File

@@ -2,11 +2,14 @@
<config evaluator="node-type" condition="content">
<property-sheet>
<show-property name="name" show-in-edit-mode="false" />
<show-property name="mimetype" display-label-id="mimetype" converter="org.alfresco.faces.MimeTypeConverter" show-in-edit-mode="false" />
<show-property name="title" show-in-edit-mode="false" />
<show-property name="description" show-in-edit-mode="false" />
<show-property name="size" display-label-id="size" converter="org.alfresco.faces.ByteSizeConverter" show-in-edit-mode="false" />
<show-property name="name" />
<show-property name="mimetype" display-label-id="content_type"
component-generator="MimeTypeSelectorGenerator" />
<show-property name="title" />
<show-property name="description" />
<show-property name="size" display-label-id="size"
converter="org.alfresco.faces.ByteSizeConverter"
show-in-edit-mode="false" />
</property-sheet>
</config>
@@ -111,7 +114,7 @@
<config evaluator="aspect-name" condition="author">
<property-sheet>
<show-property name="author" show-in-edit-mode="false" />
<show-property name="author" />
</property-sheet>
</config>

View File

@@ -173,6 +173,7 @@
</config>
<config evaluator="string-compare" condition="Content Wizards">
<other-properties user-choice-visible="true" user-choice-default="true" />
<create-mime-types>
<mime-type name="text/html" />
<mime-type name="text/plain" />

View File

@@ -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,9 +610,18 @@ public class AlfrescoNavigationHandler extends NavigationHandler
if (logger.isDebugEnabled())
logger.debug("Closing " + closingItem + " with an overridden outcome of '" + 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
{
// we are trying to close a dialog when one hasn't been opened!

View File

@@ -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
@@ -40,6 +42,34 @@ 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

View File

@@ -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);
}
}
}
}
}
}

View File

@@ -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

View File

@@ -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<String, Object> 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<QName, Serializable> 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<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
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<String> 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<String, Map<String, AssociationRef>> addedAssocs = this.editableNode.getAddedAssociations();
for (Map<String, AssociationRef> 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<String, Map<String, AssociationRef>> removedAssocs = this.editableNode.getRemovedAssociations();
for (Map<String, AssociationRef> 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<String, Map<String, ChildAssociationRef>> addedChildAssocs = this.editableNode.getAddedChildAssociations();
for (Map<String, ChildAssociationRef> 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<String, Map<String, ChildAssociationRef>> removedChildAssocs = this.editableNode.getRemovedChildAssociations();
for (Map<String, ChildAssociationRef> 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;
}
}

View File

@@ -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";
}
}

View File

@@ -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;
}
/**

View File

@@ -30,6 +30,8 @@ public class MimeTypeSelectorGenerator extends BaseComponentGenerator
protected void setupConverter(FacesContext context,
UIPropertySheet propertySheet, PropertySheetItem property,
PropertyDefinition propertyDef, UIComponent component)
{
if (propertySheet.inEditMode() == false)
{
if (property.getConverter() != null)
{
@@ -44,6 +46,7 @@ public class MimeTypeSelectorGenerator extends BaseComponentGenerator
component);
}
}
}
@Override
protected void setupMandatoryValidation(FacesContext context,

View File

@@ -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;

View File

@@ -77,7 +77,6 @@ public class CreateRuleWizard extends BaseActionWizard
private static final Log logger = LogFactory.getLog(CreateRuleWizard.class);
// ------------------------------------------------------------------------------
// Wizard implementation
@@ -210,62 +209,6 @@ 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<String, Serializable> condParams : this.allConditionsProperties)
{
String conditionName = (String)condParams.get(PROP_CONDITION_NAME);
this.condition = conditionName;
this.currentConditionProperties = condParams;
Map<String, Serializable> 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<String, Serializable> 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<String, Serializable> 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<String, Serializable> condParams : this.allConditionsProperties)
{
String conditionName = (String)condParams.get(PROP_CONDITION_NAME);
this.condition = conditionName;
this.currentConditionProperties = condParams;
Map<String, Serializable> 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<String, Serializable> 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<String, Serializable> 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

View File

@@ -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
*

View File

@@ -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

View File

@@ -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());
}
}
}

View File

@@ -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

View File

@@ -447,10 +447,35 @@
<managed-bean>
<description>
The bean that backs up the Edit Document Properties Dialog
The bean that backs up the Set Content Properties Dialog
</description>
<managed-bean-name>EditDocPropsDialog</managed-bean-name>
<managed-bean-class>org.alfresco.web.bean.DocumentPropertiesBean</managed-bean-class>
<managed-bean-name>SetContentPropertiesDialog</managed-bean-name>
<managed-bean-class>org.alfresco.web.bean.content.SetContentPropertiesDialog</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>nodeService</property-name>
<value>#{NodeService}</value>
</managed-property>
<managed-property>
<property-name>fileFolderService</property-name>
<value>#{FileFolderService}</value>
</managed-property>
<managed-property>
<property-name>dictionaryService</property-name>
<value>#{DictionaryService}</value>
</managed-property>
<managed-property>
<property-name>browseBean</property-name>
<value>#{BrowseBean}</value>
</managed-property>
</managed-bean>
<managed-bean>
<description>
The bean that backs up the Edit Content Properties Dialog
</description>
<managed-bean-name>EditContentPropertiesDialog</managed-bean-name>
<managed-bean-class>org.alfresco.web.bean.content.EditContentPropertiesDialog</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>nodeService</property-name>

View File

@@ -287,10 +287,6 @@
<navigation-rule>
<from-view-id>/jsp/dialog/document-details.jsp</from-view-id>
<navigation-case>
<from-outcome>editDocProperties</from-outcome>
<to-view-id>/jsp/dialog/edit-document-properties.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>checkoutFile</from-outcome>
<to-view-id>/jsp/dialog/checkout-file.jsp</to-view-id>
@@ -353,18 +349,6 @@
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/jsp/dialog/edit-document-properties.jsp</from-view-id>
<navigation-case>
<from-outcome>cancel</from-outcome>
<to-view-id>/jsp/dialog/document-details.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>finish</from-outcome>
<to-view-id>/jsp/dialog/document-details.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/jsp/dialog/edit-simple-workflow.jsp</from-view-id>
<navigation-case>

View File

@@ -136,30 +136,30 @@ if (dialog != null && dialog.getFileName() != null)
<table cellpadding="2" cellspacing="2" border="0" width="100%">
<% if (fileUploaded == false) { %>
<tr>
<td colspan="2" class="wizardSectionHeading"><h:outputText value="#{msg.upload_document}"/></td>
<td colspan="3" class="wizardSectionHeading"><h:outputText value="#{msg.upload_content}"/></td>
</tr>
<tr><td class="paddingRow"></td></tr>
<tr>
<td class="mainSubText" colspan="2">
<h:outputText id="text1" value="1. #{msg.locate_document}"/>
<td class="mainSubText" colspan="3">
<h:outputText id="text1" value="1. #{msg.locate_content}"/>
</td>
</tr>
<tr><td class="paddingRow"></td></tr>
<r:uploadForm>
<tr>
<td colspan="2">
<input style="margin-left:12px;" type="file" size="50" name="alfFileInput"/>
<td colspan="3">
<input style="margin-left:12px;" type="file" size="75" name="alfFileInput"/>
</td>
</tr>
<tr><td class="paddingRow"></td></tr>
<tr>
<td class="mainSubText" colspan="2">
<%=Application.getMessage(FacesContext.getCurrentInstance(), "click_upload")%>
<td class="mainSubText" colspan="3">
2. <%=Application.getMessage(FacesContext.getCurrentInstance(), "click_upload")%>
</td>
</tr>
<tr>
<td colspan="2">
<td colspan="3">
<input style="margin-left:12px;" type="submit" value="<%=Application.getMessage(FacesContext.getCurrentInstance(), "upload")%>" />
</td>
</tr>
@@ -169,11 +169,11 @@ if (dialog != null && dialog.getFileName() != null)
<h:form acceptCharset="UTF-8" id="add-content-upload-end" onsubmit="return validate();">
<% if (fileUploaded) { %>
<tr>
<td colspan="2">
<td colspan="3">
<table border="0" cellspacing="2" cellpadding="2" class="selectedItems">
<tr>
<td colspan="2" class="selectedItemsHeader">
<h:outputText id="text2" value="#{msg.uploaded_filename}" />
<h:outputText id="text2" value="#{msg.uploaded_content}" />
</th>
</tr>
<tr>
@@ -191,23 +191,27 @@ if (dialog != null && dialog.getFileName() != null)
</tr>
<tr><td class="paddingRow"></td></tr>
<tr>
<td colspan="2" class="wizardSectionHeading">
&nbsp;<h:outputText id="text4" value="#{msg.properties}" />
<td colspan="3" class="wizardSectionHeading">
&nbsp;<h:outputText id="text4" value="#{msg.general_properties}" />
</td>
</tr>
<tr><td class="paddingRow"></td></tr>
<tr>
<td>
<h:outputText id="text5" value="#{msg.file_name}:" />
<td align="middle">
<h:graphicImage value="/images/icons/required_field.gif" alt="Required Field" />
</td>
<td width="90%">
<td>
<h:outputText id="text5" value="#{msg.name}:" />
</td>
<td width="85%">
<h:inputText id="file-name" value="#{AddContentDialog.fileName}"
maxlength="1024" size="35"
onkeyup="checkButtonState();"
onchange="checkButtonState();" />&nbsp;*
onchange="checkButtonState();" />
</td>
</tr>
<tr>
<td></td>
<td>
<h:outputText id="text6" value="#{msg.type}:" />
</td>
@@ -218,6 +222,7 @@ if (dialog != null && dialog.getFileName() != null)
</td>
</tr>
<tr>
<td></td>
<td>
<h:outputText id="text7" value="#{msg.content_type}:" />
</td>
@@ -225,7 +230,35 @@ if (dialog != null && dialog.getFileName() != null)
<r:mimeTypeSelector id="mime-type" value="#{AddContentDialog.mimeType}" />
</td>
</tr>
<% } %>
<% if (dialog.getOtherPropertiesChoiceVisible()) { %>
<tr><td class="paddingRow"></td></tr>
<tr>
<td colspan="3" class="wizardSectionHeading">
&nbsp;<h:outputText id="text8" value="#{msg.other_properties}" />
</td>
</tr>
<tr>
<td colspan="3">
<table style="padding-top: 2px;">
<tr>
<td colspan="3">
<h:outputText id="text9" value="#{msg.modify_props_help_text}" />
</td>
</tr>
<tr><td class="paddingRow"></td></tr>
<tr>
<td>
<h:selectBooleanCheckbox value="#{AddContentDialog.showOtherProperties}" />
</td>
<td width="100%">
<h:outputText id="text10" value="#{msg.modify_props_when_page_closes}" />
</td>
</tr>
</table>
</td>
</tr>
<% } } %>
</table>
<% 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"),
'<a:outputText id="text8" value="#{msg.validation_invalid_character}" />', true);
'<a:outputText id="text11" value="#{msg.validation_invalid_character}" />', true);
}
else
{

View File

@@ -68,18 +68,26 @@
<a:errors message="#{msg.error_wizard}" styleClass="errorMessage" />
<h:panelGrid columns="2" cellpadding="2" cellspacing="2" border="0">
<h:outputText value="#{msg.file_name}:"/>
<h:panelGrid columns="1" cellpadding="2" style="padding-top: 4px; padding-bottom: 4px;"
width="100%" rowClasses="wizardSectionHeading">
<h:outputText value="&nbsp;#{msg.general_properties}" escape="false" />
</h:panelGrid>
<h:panelGrid columns="3" cellpadding="3" cellspacing="3" border="0">
<h:graphicImage value="/images/icons/required_field.gif" alt="Required Field" />
<h:outputText value="#{msg.name}:"/>
<h:inputText id="file-name" value="#{WizardManager.bean.fileName}"
maxlength="1024" size="35"
onkeyup="checkButtonState();"
onchange="checkButtonState();" />
<h:outputText value=""/>
<h:outputText value="#{msg.type}:"/>
<h:selectOneMenu value="#{WizardManager.bean.objectType}">
<f:selectItems value="#{WizardManager.bean.objectTypes}" />
</h:selectOneMenu>
<h:outputText value=""/>
<h:outputText value="#{msg.content_type}:"/>
<h:selectOneMenu value="#{WizardManager.bean.mimeType}"
valueChangeListener="#{WizardManager.bean.createContentChanged}">
@@ -87,4 +95,15 @@
</h:selectOneMenu>
</h:panelGrid>
<h:panelGrid columns="1" cellpadding="3" cellspacing="3" border="0" style="padding-top: 4px;"
width="100%" rowClasses="wizardSectionHeading, paddingRow"
rendered="#{WizardManager.bean.otherPropertiesChoiceVisible}">
<h:outputText value="&nbsp;#{msg.other_properties}" escape="false" />
<h:outputText value="#{msg.modify_props_help_text}" />
</h:panelGrid>
<h:panelGrid style="padding-top: 2px;" columns="2"
rendered="#{WizardManager.bean.otherPropertiesChoiceVisible}">
<h:selectBooleanCheckbox value="#{WizardManager.bean.showOtherProperties}" />
<h:outputText value="#{msg.modify_props_when_wizard_closes}" />
</h:panelGrid>

View File

@@ -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" %>
<a:errors message="#{msg.error_dialog}" styleClass="errorMessage" />
<h:panelGrid columns="1" cellpadding="2" style="padding-top: 4px; padding-bottom: 4px;"
width="100%" rowClasses="wizardSectionHeading">
<h:outputText value="&nbsp;#{msg.properties}" escape="false" />
</h:panelGrid>
<r:propertySheetGrid id="content-props" value="#{DialogManager.bean.editableNode}"
var="editContentProps" columns="1" externalConfig="true" />

View File

@@ -184,7 +184,7 @@
<f:facet name="title">
<r:permissionEvaluator value="#{DocumentDetailsBean.document}" allow="Write">
<a:actionLink id="titleLink1" value="#{msg.modify}" showLink="false" image="/images/icons/Change_details.gif"
action="editDocProperties" actionListener="#{EditDocPropsDialog.setupDocumentForAction}" />
action="dialog:editContentProperties" />
</r:permissionEvaluator>
</f:facet>
</h:panelGroup>

View File

@@ -137,7 +137,9 @@
<%-- Inline editor --%>
<tr>
<td width="100%" valign="top" height="100%">
<h:inputTextarea id="textArea" rows="24" cols="112" value="#{CheckinCheckoutBean.editorOutput}" />
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %>
<h:inputTextarea id="textArea" rows="24" cols="120" value="#{CheckinCheckoutBean.editorOutput}" />
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %>
</td>
</tr>
</table>