. Submit Dialog now supports submit with no workflow match - i.e. allows direct submit to staging sandbox if no workflows are appropriate

. Submit Dialog now requires comment+label field to be completed
. DNS name client-side check now allows captial A-Z characters
. Create Shortcut action now available for Website folder type

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4584 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-12-12 18:57:57 +00:00
parent d516ea58c3
commit 0442918790
5 changed files with 81 additions and 43 deletions

View File

@@ -301,6 +301,7 @@
<action idref="take_ownership_space" /> <action idref="take_ownership_space" />
<action idref="edit_website" /> <action idref="edit_website" />
<action idref="invite_website_users" /> <action idref="invite_website_users" />
<action idref="create_shortcut" />
<action idref="run_action" /> <action idref="run_action" />
</action-group> </action-group>

View File

@@ -35,7 +35,6 @@ import org.alfresco.model.WCMAppModel;
import org.alfresco.repo.avm.AVMNodeConverter; import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.repo.avm.actions.AVMRevertStoreAction; import org.alfresco.repo.avm.actions.AVMRevertStoreAction;
import org.alfresco.repo.avm.actions.AVMUndoSandboxListAction; import org.alfresco.repo.avm.actions.AVMUndoSandboxListAction;
import org.alfresco.repo.avm.actions.SimpleAVMSubmitAction;
import org.alfresco.service.cmr.action.Action; import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ActionService; import org.alfresco.service.cmr.action.ActionService;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor; import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
@@ -1110,6 +1109,7 @@ public class AVMBrowseBean implements IContextListener
// nothing to do // nothing to do
} }
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
// Inner classes // Inner classes

View File

@@ -32,6 +32,7 @@ import javax.faces.context.FacesContext;
import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.model.WCMAppModel; import org.alfresco.model.WCMAppModel;
import org.alfresco.repo.avm.AVMDAOs;
import org.alfresco.repo.avm.AVMNodeConverter; import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.repo.workflow.WorkflowModel; import org.alfresco.repo.workflow.WorkflowModel;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor; import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
@@ -167,65 +168,86 @@ public class SubmitDialog extends BaseDialogBean
@Override @Override
protected String finishImpl(FacesContext context, String outcome) throws Exception protected String finishImpl(FacesContext context, String outcome) throws Exception
{ {
// get the defaults from the workflow configuration attached to the selected workflow if (getSubmitItemsSize() == 0)
Map<QName, Serializable> params = null;
String workflowName = this.workflowSelectedValue[0];
for (FormWorkflowWrapper wrapper : this.workflows)
{ {
if (wrapper.Name.equals(workflowName)) return null;
{
params = wrapper.Params;
}
} }
if (params != null) // get the defaults from the workflow configuration attached to the selected workflow
if (this.workflowSelectedValue != null)
{ {
// create container for our avm workflow package Map<QName, Serializable> params = null;
NodeRef workflowPackage = createWorkflowPackage(); String workflowName = this.workflowSelectedValue[0];
params.put(WorkflowModel.ASSOC_PACKAGE, workflowPackage); for (FormWorkflowWrapper wrapper : this.workflows)
// add submission parameters
params.put(WorkflowModel.PROP_WORKFLOW_DESCRIPTION, getComment());
params.put(AVMWorkflowUtil.PROP_LABEL, getLabel());
params.put(AVMWorkflowUtil.PROP_FROM_PATH, AVMConstants.buildAVMStoreRootPath(this.avmBrowseBean.getSandbox()));
// start the workflow to get access to the start task
WorkflowDefinition wfDef = workflowService.getDefinitionByName(workflowName);
WorkflowPath path = this.workflowService.startWorkflow(wfDef.id, params);
if (path != null)
{ {
// extract the start task if (wrapper.Name.equals(workflowName))
List<WorkflowTask> tasks = this.workflowService.getTasksForWorkflowPath(path.id);
if (tasks.size() == 1)
{ {
WorkflowTask startTask = tasks.get(0); params = wrapper.Params;
}
}
if (startTask.state == WorkflowTaskState.IN_PROGRESS) if (params != null)
{
// create container for our avm workflow package
NodeRef workflowPackage = createWorkflowPackage();
params.put(WorkflowModel.ASSOC_PACKAGE, workflowPackage);
// add submission parameters
params.put(WorkflowModel.PROP_WORKFLOW_DESCRIPTION, getComment());
params.put(AVMWorkflowUtil.PROP_LABEL, getLabel());
params.put(AVMWorkflowUtil.PROP_FROM_PATH, AVMConstants.buildAVMStoreRootPath(this.avmBrowseBean.getSandbox()));
// start the workflow to get access to the start task
WorkflowDefinition wfDef = workflowService.getDefinitionByName(workflowName);
WorkflowPath path = this.workflowService.startWorkflow(wfDef.id, params);
if (path != null)
{
// extract the start task
List<WorkflowTask> tasks = this.workflowService.getTasksForWorkflowPath(path.id);
if (tasks.size() == 1)
{ {
// end the start task to trigger the first 'proper' task in the workflow WorkflowTask startTask = tasks.get(0);
this.workflowService.endTask(startTask.id, null);
if (startTask.state == WorkflowTaskState.IN_PROGRESS)
{
// end the start task to trigger the first 'proper' task in the workflow
this.workflowService.endTask(startTask.id, null);
}
} }
} }
} }
else
{
// TODO: jump to dialog and allow user to finish wf properties config!
throw new AlfrescoRuntimeException("Workflow parameters have not been configured, cannot submit items.");
}
} }
else else
{ {
// TODO: jump to dialog and allow user to finish wf properties config! // direct submit to the staging area without workflow
throw new AlfrescoRuntimeException("Workflow has not been configured correctly, cannot submit items."); List<ItemWrapper> items = getSubmitItems();
// construct diffs for selected items for submission
String sandboxPath = AVMConstants.buildAVMStoreRootPath(this.avmBrowseBean.getSandbox());
String stagingPath = AVMConstants.buildAVMStoreRootPath(this.avmBrowseBean.getStagingStore());
List<AVMDifference> diffs = new ArrayList<AVMDifference>(items.size());
for (ItemWrapper wrapper : items)
{
String srcPath = sandboxPath + wrapper.getPath();
String destPath = stagingPath + wrapper.getPath();
AVMDifference diff = new AVMDifference(-1, srcPath, -1, destPath, AVMDifference.NEWER);
diffs.add(diff);
}
// write changes to layer so files are marked as modified
this.avmSyncService.update(diffs, null, true, true, false, false, this.label, this.comment);
AVMDAOs.Instance().fAVMNodeDAO.flush();
avmSyncService.flatten(sandboxPath, stagingPath);
} }
return outcome; return outcome;
} }
/**
* @see org.alfresco.web.bean.dialog.BaseDialogBean#getFinishButtonDisabled()
*/
@Override
public boolean getFinishButtonDisabled()
{
return (getWorkflowSelectedValue() == null || getSubmitItemsSize() == 0);
}
/** /**
* @return Returns the workflow comment. * @return Returns the workflow comment.
*/ */

View File

@@ -61,7 +61,7 @@
if (valid == true) if (valid == true)
{ {
valid = validateRegex(document.getElementById("wizard:wizard-body:dnsname"), valid = validateRegex(document.getElementById("wizard:wizard-body:dnsname"),
"^[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$", true, null, "^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$", true, null,
'</f:verbatim><a:outputText value="#{msg.validation_invalid_dns_name}" /><f:verbatim>', true); '</f:verbatim><a:outputText value="#{msg.validation_invalid_dns_name}" /><f:verbatim>', true);
} }
return valid; return valid;

View File

@@ -30,7 +30,22 @@
function pageLoaded() function pageLoaded()
{ {
document.getElementById("dialog:dialog-body:comment").focus(); document.getElementById("dialog:dialog-body:comment").focus();
checkButtonState();
} }
function checkButtonState()
{
if (document.getElementById("dialog:dialog-body:comment").value.length == 0 ||
document.getElementById("dialog:dialog-body:label").value.length == 0)
{
document.getElementById("dialog:finish-button").disabled = true;
}
else
{
document.getElementById("dialog:finish-button").disabled = false;
}
}
</script> </script>
</f:verbatim> </f:verbatim>