protected void Page_Init(object sender, EventArgs e) { node = (TreeNode)Form.EditedObject; TreeNode workflowNode; if (Form.IsInsertMode) { workflowNode = (TreeNode)Form.ParentObject; } else { workflowNode = (TreeNode)Form.EditedObject; } // Setup the workflow information WorkflowManager wm = WorkflowManager.GetInstance(new TreeProvider(CMSContext.CurrentUser)); WorkflowInfo wi = wm.GetNodeWorkflow(workflowNode); if (wi != null) { // Get current step info, do not update document WorkflowStepInfo si = wm.GetStepInfo(workflowNode) ?? WorkflowStepInfoProvider.GetFirstStep(wi.WorkflowID); // Set IsWorkflow. mIsWorkflow = !string.IsNullOrEmpty(si.StepName); } else { mIsWorkflow = false; } }
/// <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; } }
/// <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; } }