コード例 #1
0
    /// <summary>
    /// Saves new wokflow step's data into DB.
    /// </summary>
    /// <returns>Returns ID of created wokflow step</returns>
    protected int SaveNewWorkflowStep()
    {
        WorkflowStepInfo wsi = new WorkflowStepInfo();

        wsi.StepDisplayName = txtWorkflowDisplayName.Text;
        wsi.StepName        = txtWorkflowCodeName.Text;

        // Get published step info for the proper position
        WorkflowStepInfo psi = WorkflowStepInfoProvider.GetPublishedStep(workflowid);

        if (psi != null)
        {
            wsi.StepOrder = psi.StepOrder;
            // Move the published step down
            psi.StepOrder += 1;
            WorkflowStepInfoProvider.SetWorkflowStepInfo(psi);

            // Move the archived step down
            WorkflowStepInfo asi = WorkflowStepInfoProvider.GetArchivedStep(workflowid);
            if (asi != null)
            {
                asi.StepOrder += 1;
                WorkflowStepInfoProvider.SetWorkflowStepInfo(asi);
            }
        }

        wsi.StepWorkflowID = workflowid;
        WorkflowStepInfoProvider.SetWorkflowStepInfo(wsi);
        return(wsi.StepID);
    }
コード例 #2
0
    /// <summary>
    /// Saves new workflow step's data into DB.
    /// </summary>
    /// <returns>Returns ID of created workflow step</returns>
    protected int SaveNewWorkflowStep()
    {
        SetFormValues(CurrentStepInfo);

        // Ensure correct order for basic workflow
        if (CurrentWorkflow.IsBasic)
        {
            // Get published step info for the proper position
            WorkflowStepInfo psi = WorkflowStepInfoProvider.GetPublishedStep(WorkflowID);
            if (psi != null)
            {
                CurrentStepInfo.StepOrder = psi.StepOrder;
                // Move the published step down
                psi.StepOrder += 1;
                WorkflowStepInfoProvider.SetWorkflowStepInfo(psi);

                // Move the archived step down
                WorkflowStepInfo asi = WorkflowStepInfoProvider.GetArchivedStep(WorkflowID);
                if (asi != null)
                {
                    asi.StepOrder += 1;
                    WorkflowStepInfoProvider.SetWorkflowStepInfo(asi);
                }
            }
        }

        CurrentStepInfo.StepWorkflowID = WorkflowID;
        WorkflowStepInfoProvider.SetWorkflowStepInfo(CurrentStepInfo);
        return(CurrentStepInfo.StepID);
    }
コード例 #3
0
    /// <summary>
    /// Reloads the form status.
    /// </summary>
    protected void SetupForm()
    {
        // Check modify permissions
        if ((CMSContext.CurrentUser.IsAuthorizedPerDocument(Node, NodePermissionsEnum.Modify) == AuthorizationResultEnum.Denied) &&
            !CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.Content", "ManageWorkflow"))
        {
            ShowInfo(String.Format(GetString("cmsdesk.notauthorizedtoeditdocument"), Node.NodeAliasPath), true);
        }
        else
        {
            bool autoPublishChanges = false;
            // Check if auto publish changes is allowed
            if (WorkflowInfo != null)
            {
                autoPublishChanges = WorkflowInfo.WorkflowAutoPublishChanges;
            }

            if ((WorkflowInfo != null) || (currentStepId > 0))
            {
                // Setup the form
                WorkflowStepInfo stepInfo = null;
                if (Node.IsPublished && (Node.DocumentCheckedOutVersionHistoryID <= 0))
                {
                    stepInfo = WorkflowStepInfoProvider.GetPublishedStep(WorkflowInfo.WorkflowID);
                }
                else
                {
                    stepInfo = WorkflowStepInfoProvider.GetWorkflowStepInfo(currentStepId) ?? WorkflowStepInfoProvider.GetFirstStep(WorkflowInfo.WorkflowID);
                }

                if (stepInfo != null)
                {
                    currentStepId = stepInfo.StepID;
                    if (plcAdvanced.Visible)
                    {
                        ucDesigner.SelectedStepID = currentStepId;
                    }
                }
            }
        }

        // Check if document isn't checked out
        if (DocumentIsCheckedOut)
        {
            ShowInfo(GetString("WorfklowProperties.DocumentIsCheckedOut"), true);
        }

        // If no workflow scope set for node, hide the data
        if (WorkflowInfo == null)
        {
            lblWorkflow.Text    = GetString("properties.scopenotset");
            lblWorkflow.Visible = true;
            pnlWorkflow.Visible = false;
        }
    }
コード例 #4
0
    /// <summary>
    /// Reloads the form status.
    /// </summary>
    protected void SetupForm()
    {
        // Check modify permissions
        if ((MembershipContext.AuthenticatedUser.IsAuthorizedPerDocument(Node, NodePermissionsEnum.Modify) == AuthorizationResultEnum.Denied) &&
            !MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.Content", "ManageWorkflow"))
        {
            ShowInfo(String.Format(GetString("cmsdesk.notauthorizedtoeditdocument"), HTMLHelper.HTMLEncode(Node.GetDocumentName())), true);
        }
        else
        {
            if ((WorkflowInfo != null) || (currentStepId > 0))
            {
                // Setup the form
                WorkflowStepInfo stepInfo = null;
                if (WorkflowInfo != null)
                {
                    if (Node.IsPublished && (Node.DocumentCheckedOutVersionHistoryID <= 0))
                    {
                        stepInfo = WorkflowStepInfoProvider.GetPublishedStep(WorkflowInfo.WorkflowID);
                    }
                    else
                    {
                        stepInfo = WorkflowStepInfo.Provider.Get(currentStepId) ?? WorkflowStepInfoProvider.GetFirstStep(WorkflowInfo.WorkflowID);
                    }
                }

                if (stepInfo != null)
                {
                    currentStepId = stepInfo.StepID;
                    if (plcAdvanced.Visible)
                    {
                        ucDesigner.SelectedStepID = currentStepId;
                    }
                }
            }
        }

        // If no workflow scope set for node, hide content
        if (WorkflowInfo == null)
        {
            pnlWorkflow.Visible = false;
        }
    }
コード例 #5
0
    /// <summary>
    /// Ensures correct steps order
    /// </summary>
    private void EnsureStepsOrder()
    {
        // Ensure correct order for basic workflow
        if ((CurrentWorkflow != null) && CurrentWorkflow.IsBasic)
        {
            // Get published step info for the proper position
            WorkflowStepInfo psi = WorkflowStepInfoProvider.GetPublishedStep(CurrentWorkflow.WorkflowID);
            if (psi != null)
            {
                CurrentStepInfo.StepOrder = psi.StepOrder;
                // Move the published step down
                psi.StepOrder += 1;
                WorkflowStepInfo.Provider.Set(psi);

                // Move the archived step down
                WorkflowStepInfo asi = WorkflowStepInfoProvider.GetArchivedStep(CurrentWorkflow.WorkflowID);
                if (asi != null)
                {
                    asi.StepOrder += 1;
                    WorkflowStepInfo.Provider.Set(asi);
                }
            }
        }
    }