protected void Page_Load(object sender, EventArgs e) { workflowStepId = QueryHelper.GetInteger("workflowstepid", 0); string currentWorkflowStep = null; int workflowId = 0; if (workflowStepId > 0) { wsi = WorkflowStepInfoProvider.GetWorkflowStepInfo(workflowStepId); // Set edited object EditedObject = wsi; if (wsi != null) { workflowId = wsi.StepWorkflowID; currentWorkflowStep = WorkflowStepInfoProvider.GetWorkflowStepInfo(workflowStepId).StepDisplayName; } } string workflowStepsUrl = "~/CMSModules/Workflows/Workflow_Steps.aspx?workflowid=" + workflowId + "&showtab=steps"; string workflowSteps = GetString("Publish.WorkflowSteps"); if (!RequestHelper.IsPostBack()) { InitalizeMenu(); } // Initialize PageTitle InitializeMasterPage(workflowSteps, workflowStepsUrl, currentWorkflowStep); }
/// <summary> /// Creates process. Called when the "Create process" button is pressed. /// </summary> private bool CreateProcess() { // Create new process object and set its properties WorkflowInfo newProcess = new WorkflowInfo() { WorkflowDisplayName = "My new process", WorkflowName = "MyNewProcess", WorkflowType = WorkflowTypeEnum.Automation, WorkflowRecurrenceType = ProcessRecurrenceTypeEnum.Recurring }; // Save the process WorkflowInfoProvider.SetWorkflowInfo(newProcess); // Create default steps WorkflowStepInfoProvider.CreateDefaultWorkflowSteps(newProcess); // Get the step with codename 'Finished' and allow Move to previous WorkflowStepInfo finishedStep = WorkflowStepInfoProvider.GetWorkflowStepInfo("Finished", newProcess.WorkflowID); finishedStep.StepAllowReject = true; // Save the 'Finished' step WorkflowStepInfoProvider.SetWorkflowStepInfo(finishedStep); return(true); }
/// <summary> /// Handles the UniGrid's OnAction event. /// </summary> /// <param name="actionName">Name of item (button) that threw event</param> /// <param name="actionArgument">ID (value of Primary key) of corresponding data row</param> protected void OnAction(string actionName, object actionArgument) { int workflowstepid = Convert.ToInt32(actionArgument); if (actionName == "delete") { // Check if documents use the workflow WorkflowStepInfo si = WorkflowStepInfoProvider.GetWorkflowStepInfo(workflowstepid); if (si != null) { List <string> documentNames = new List <string>(); if (WorkflowStepInfoProvider.CheckDependencies(workflowstepid, ref documentNames)) { // Encode and localize names StringBuilder sb = new StringBuilder(); documentNames.ForEach(item => sb.Append("<br />", HTMLHelper.HTMLEncode(ResHelper.LocalizeString(item)))); Control.ShowError(Control.GetString("Workflow.CannotDeleteStepUsed"), Control.GetString("workflow.documentlist") + sb); } else { // Delete the workflow step WorkflowStepInfoProvider.DeleteWorkflowStepInfo(workflowstepid); } } } else if (actionName == "moveup") { WorkflowStepInfoProvider.MoveStepUp(WorkflowStepInfoProvider.GetWorkflowStepInfo(workflowstepid)); } else if (actionName == "movedown") { WorkflowStepInfoProvider.MoveStepDown(WorkflowStepInfoProvider.GetWorkflowStepInfo(workflowstepid)); } }
/// <summary> /// Creates process transitions. Called when the "Create transitions" button is pressed. /// Expects the CreateProcess and CreateProcessStep method to be run first. /// </summary> private bool CreateProcessTransitions() { // Get the process WorkflowInfo process = WorkflowInfoProvider.GetWorkflowInfo("MyNewProcess", WorkflowTypeEnum.Automation); if (process != null) { // Get the previously created process step WorkflowStepInfo step = WorkflowStepInfoProvider.GetWorkflowStepInfo("MyNewProcessStep", process.WorkflowID); // Get the step with codename 'Finished' WorkflowStepInfo finishedStep = WorkflowStepInfoProvider.GetWorkflowStepInfo("Finished", process.WorkflowID); if ((step != null) && (finishedStep != null)) { // Get existed transition from 'Start' step to 'Finished' step InfoDataSet <WorkflowTransitionInfo> transitions = WorkflowTransitionInfoProvider.GetWorkflowTransitions(process.WorkflowID, null, null, 1, null); WorkflowTransitionInfo existedTransition = transitions.First <WorkflowTransitionInfo>(); // Change existed transition to leads from 'Start' step to 'My new step' step existedTransition.TransitionEndStepID = step.StepID; // Save existed transition WorkflowTransitionInfoProvider.SetWorkflowTransitionInfo(existedTransition); // Connect 'My new step' step to 'Finished' step step.ConnectTo(step.StepDefinition.SourcePoints[0].Guid, finishedStep); return(true); } } return(false); }
/// <summary> /// Creates workflow transitions. Called when the "Create transition" button is pressed. /// Expects the CreateWorklow and CreateStep method to be run first. /// </summary> private bool CreateTransition() { // Get the workflow WorkflowInfo worklow = WorkflowInfoProvider.GetWorkflowInfo("MyNewWorkflow", WorkflowTypeEnum.Approval); if (worklow != null) { // Get steps with codename 'MyNewStep' and 'Published' WorkflowStepInfo myNewStep = WorkflowStepInfoProvider.GetWorkflowStepInfo("MyNewStep", worklow.WorkflowID); WorkflowStepInfo publishedStep = WorkflowStepInfoProvider.GetWorkflowStepInfo("Published", worklow.WorkflowID); if ((myNewStep != null) && (publishedStep != null)) { // Get existing transition leading to 'Published step' string where = "TransitionEndStepID = " + publishedStep.StepID; InfoDataSet <WorkflowTransitionInfo> transitions = WorkflowTransitionInfoProvider.GetWorkflowTransitions(worklow.WorkflowID, where, null, 1, null); WorkflowTransitionInfo existingTransition = transitions.First <WorkflowTransitionInfo>(); // Change existing transition to leads from 'Start step' to 'My new step' existingTransition.TransitionEndStepID = myNewStep.StepID; // Save existing transition WorkflowTransitionInfoProvider.SetWorkflowTransitionInfo(existingTransition); // Connect 'My new step' step to 'Published' step myNewStep.ConnectTo(myNewStep.StepDefinition.SourcePoints[0].Guid, publishedStep); return(true); } } return(false); }
/// <summary> /// Getting WorkFlowStatus by noadAliaspath /// </summary> /// <param name="data">noadAliaspath</param> public static string WorkFlowStatusBynodeAliasPath(string nodeAliasPath) { // Create an instance of the Tree provider first //TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser); TreeProvider tree = new TreeProvider(); // Get the document TreeNode node = tree.SelectSingleNode(SiteContext.CurrentSiteName, nodeAliasPath, "en-us", false, null, false, false, false); var workFlow = string.Empty; if (node != null) { //Get the document per NodeID and culture TreeNode tn = tree.SelectSingleNode(node.NodeID, "en-us"); //Return its workflow step ID int iStepID = tn.DocumentWorkflowStepID; if (iStepID > 0) { // Get workflow step display name WorkflowStepInfo wsi = WorkflowStepInfoProvider.GetWorkflowStepInfo(iStepID); if (wsi != null) { workFlow = ResHelper.LocalizeString(wsi.StepDisplayName); } } } return(workFlow); }
/// <summary> /// Deletes workflow transition. Called when the "Delete transition" button is pressed. /// Expects the CreateWorklow and CreateTransitions method to be run first. /// </summary> private bool DeleteTransition() { // Get the process WorkflowInfo worklow = WorkflowInfoProvider.GetWorkflowInfo("MyNewWorkflow", WorkflowTypeEnum.Approval); if (worklow != null) { // Get step WorkflowStepInfo startStep = WorkflowStepInfoProvider.GetWorkflowStepInfo("MyNewStep", worklow.WorkflowID); if (startStep != null) { // Get existing transition leading from 'My new step' string where = "TransitionStartStepID = " + startStep.StepID; InfoDataSet <WorkflowTransitionInfo> transitions = WorkflowTransitionInfoProvider.GetWorkflowTransitions(worklow.WorkflowID, where, null, 1, null); WorkflowTransitionInfo existingTransition = transitions.First <WorkflowTransitionInfo>(); if (existingTransition != null) { // Delete transition WorkflowTransitionInfoProvider.DeleteWorkflowTransitionInfo(existingTransition); return(true); } } } return(false); }
/// <summary> /// UniGrid external data bound. /// </summary> private object gridDocs_OnExternalDataBound(object sender, string sourceName, object parameter) { sourceName = sourceName.ToLowerCSafe(); switch (sourceName) { // Column 'DocumentWorkflowStepID' case "documentworkflowstepid": int stepId = ValidationHelper.GetInteger(parameter, 0); if (stepId > 0) { // Get workflow step display name WorkflowStepInfo wsi = WorkflowStepInfoProvider.GetWorkflowStepInfo(stepId); if (wsi != null) { return(ResHelper.LocalizeString(wsi.StepDisplayName)); } } break; // Column 'Published' case "published": bool published = ValidationHelper.GetBoolean(parameter, true); return(published ? GetString("General.Yes") : GetString("General.No")); case "documentmodifiedwhen": case "documentmodifiedwhentooltip": TimeZoneInfo tzi = null; // Get current time for user contribution list on live site string result = TimeZoneMethods.GetDateTimeForControl(this, ValidationHelper.GetDateTime(parameter, DateTimeHelper.ZERO_TIME), out tzi).ToString(); // Display time zone shift if needed if ((tzi != null) && TimeZoneHelper.TimeZonesEnabled) { if (sourceName.EndsWithCSafe("tooltip")) { result = TimeZoneHelper.GetUTCLongStringOffset(tzi); } else { result += TimeZoneHelper.GetUTCStringOffset(tzi); } } return(result); // Action 'edit' case "edit": ((Control)sender).Visible = AllowEdit && CheckGroupPermission("editpages"); break; // Action 'delete' case "delete": ((Control)sender).Visible = AllowDelete && CheckGroupPermission("deletepages"); break; } return(parameter); }
/// <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; } }
protected void Page_Load(object sender, EventArgs e) { int stepId = QueryHelper.GetInteger("workflowStepId", 0); if (stepId > 0) { // Set edited object EditedObject = WorkflowStepInfoProvider.GetWorkflowStepInfo(stepId); ucEmails.WorkflowStepID = stepId; } }
/// <summary> /// Returns credential provider based on workflowstep ID parameter. /// </summary> private ICredentialProvider GetCredentialProvider() { if (WorkflowStepId > 0) { var step = WorkflowStepInfoProvider.GetWorkflowStepInfo(WorkflowStepId); if (step != null) { return(new StepCredentialProvider(step)); } return(null); } return(new UserCredentialProvider(MembershipContext.AuthenticatedUser)); }
/// <summary> /// Reloads the data in the selector. /// </summary> public void ReloadData() { if (ddlSourcePoints.Items.Count == 0) { WorkflowStepInfo step = WorkflowStepInfoProvider.GetWorkflowStepInfo(WorkflowStepID); if (step != null) { Step definition = step.StepDefinition; if ((definition == null) || (definition.SourcePoints == null)) { Visible = false; } else { List <SourcePoint> sourcePoints = definition.SourcePoints; Guid?defaultCase = null; List <WorkflowTransitionInfo> connections = WorkflowTransitionInfoProvider.GetStepTransitions(step, null); foreach (SourcePoint sp in sourcePoints) { AddItem(sp, connections); if (sp.Type == SourcePointTypeEnum.SwitchDefault) { defaultCase = sp.Guid; } } // Ensure default source point for timeout if (step.StepAllowDefaultTimeoutTarget && !sourcePoints.Exists(s => (s is TimeoutSourcePoint))) { AddItem(new TimeoutSourcePoint(), connections); } if (definition.TimeoutTarget != Guid.Empty) { ddlSourcePoints.SelectedValue = definition.TimeoutTarget.ToString(); } else if (defaultCase.HasValue) { ddlSourcePoints.SelectedValue = defaultCase.Value.ToString(); } } } } // Set visibility Visible = IsVisible(); }
/// <summary> /// Removes the assignment of the CMS Editors role from a workflow step. Called when the "Remove role from step" button is pressed. /// Expects the CreateWorkflow, CreateWorkflowStep and AddRoleToStep methods to be run first. /// </summary> private bool RemoveRoleFromStep() { // Get the workflow WorkflowInfo workflow = WorkflowInfoProvider.GetWorkflowInfo("MyNewWorkflow", WorkflowTypeEnum.Approval); if (workflow != null) { // Get the custom step WorkflowStepInfo step = WorkflowStepInfoProvider.GetWorkflowStepInfo("MyNewWorkflowStep", workflow.WorkflowID); if (step != null) { // Get the role to be assigned to the step RoleInfo role = RoleInfoProvider.GetRoleInfo("CMSEditor", SiteContext.CurrentSiteID); if (role != null) { // Get the step - role relationship WorkflowStepRoleInfo stepRoleInfo = WorkflowStepRoleInfoProvider.GetWorkflowStepRoleInfo(step.StepID, role.RoleID); if (stepRoleInfo != null) { // Remove the assignment WorkflowStepRoleInfoProvider.RemoveRoleFromWorkflowStep(step.StepID, role.RoleID); return(true); } else { // The role is not assigned to the step apiRemoveRoleFromStep.ErrorMessage = "The 'CMS Editors' role is not assigned to the step."; } } else { // The role was not found apiRemoveRoleFromStep.ErrorMessage = "The role 'CMS Editors' was not found."; } } else { // The step was not found apiRemoveRoleFromStep.ErrorMessage = "The step 'My new workflow step' was not found."; } } return(false); }
//After getting dataset of all document filtering data as per required conditions public static DataSet UpdateDocumentsDataset(DataSet ds) { // Display and initialize grid if datasource is not empty for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++) { if (!string.IsNullOrEmpty(ds.Tables[0].Rows[i]["DocumentWorkflowStepID"].ToString())) { int stepId = Convert.ToInt32(ds.Tables[0].Rows[i]["DocumentWorkflowStepID"]); var workFlow = string.Empty; if (stepId > 0) { // Get workflow step display name WorkflowStepInfo wsi = WorkflowStepInfoProvider.GetWorkflowStepInfo(stepId); if (wsi != null) { workFlow = ResHelper.LocalizeString(wsi.StepDisplayName); } //if its in draft state then display documents created by current user only if (workFlow == SMEConstant.WORKFLOW_DRAFT) { int userID = MembershipContext.AuthenticatedUser.UserID; int DocumentCreatedByUserID = Convert.ToInt32(ds.Tables[0].Rows[i]["DocumentCreatedByUserID"]); int DocumentModifiedByUserID = Convert.ToInt32(ds.Tables[0].Rows[i]["DocumentModifiedByUserID"]); string NodeAliasPath = ds.Tables[0].Rows[i]["NodeAliasPath"].ToString(); int DocumentID = Convert.ToInt32(ds.Tables[0].Rows[i]["DocumentID"]); int DocumentCheckedOutVersionHistoryID = Convert.ToInt32(ds.Tables[0].Rows[i]["DocumentCheckedOutVersionHistoryID"]); //checking that current document is already rejected or not DataSet dsRejected = WorkflowHistoryInfoProvider.GetWorkflowHistories("WasRejected = 1 AND VersionHistoryID = " + DocumentCheckedOutVersionHistoryID + " ", null, 100, null); //checking wether that document is already is published or not. if its already published then anyone can see and edit it //if that document is rejected then it will display to all and it will not go inside if condition bool isPublished = isPublishedStatusBynodeAliasPath(NodeAliasPath); if (!isPublished && DataHelper.DataSourceIsEmpty(dsRejected)) { //if a document is modified by me then it should display to me although its not created by me //if that document is not created or not modified then no need to display on my list if (DocumentCreatedByUserID != userID && DocumentModifiedByUserID != userID) { ds.Tables[0].Rows[i].Delete(); } } } } } } ds.Tables[0].AcceptChanges(); return(ds); }
/// <summary> /// Validates the data, returns true if succeeded. /// </summary> public bool ValidateData() { // Finds whether required fields are not empty string result = new Validator().NotEmpty(txtWorkflowStepDisplayName.Text, GetString("Development-Workflow_New.RequiresDisplayName")).NotEmpty(txtWorkflowStepCodeName.Text, GetString("Development-Workflow_New.RequiresCodeName")) .IsCodeName(txtWorkflowStepCodeName.Text, GetString("general.invalidcodename")) .Result; if (!String.IsNullOrEmpty(result)) { ShowError(result); return(false); } // Validate code name uniqueness WorkflowStepInfo wsi = WorkflowStepInfoProvider.GetWorkflowStepInfo(txtWorkflowStepCodeName.Text, ((WorkflowID > 0) ? WorkflowID : CurrentStepInfo.StepWorkflowID)); if ((wsi != null) && (wsi.StepID != CurrentStepInfo.StepID)) { ShowError(GetString("Development-Workflow_Step_New.WorkflowStepExists")); return(false); } // Validate source point control if (!ucSourcePointEdit.ValidateData()) { return(false); } // Validate action properties control if (CurrentStepInfo.StepIsAction && !ucActionParameters.ValidateData()) { return(false); } if ((WorkflowStepID > 0) && (CurrentStepInfo == null)) { ShowError(GetString("Development-Workflow_Step_New.WorkflowExists")); return(false); } if (ucTimeout.Visible && String.IsNullOrEmpty(ucTimeout.ScheduleInterval) && ucTimeout.TimeoutEnabled) { return(false); } return(true); }
protected void gridElem_OnAction(string actionName, object actionArgument) { Guid sourcePointGuid = ValidationHelper.GetGuid(actionArgument, Guid.Empty); if (sourcePointGuid != Guid.Empty) { string graphName = QueryHelper.GetString("graph", String.Empty); switch (actionName.ToLowerCSafe()) { case "edit": string url = URLHelper.AddParameterToUrl(UIContextHelper.GetElementUrl("CMS", "Workflows.EditCase", false), "workflowStepId", WorkflowStepID.ToString()); url = URLHelper.AddParameterToUrl(url, "isindialog", QueryHelper.GetBoolean("isindialog", false).ToString()); url = URLHelper.AddParameterToUrl(url, "hash", QueryHelper.GetHash(url)); url = URLHelper.AddParameterToUrl(url, "sourcepointGuid", sourcePointGuid.ToString()); url = URLHelper.AddParameterToUrl(url, "graph", graphName); URLHelper.Redirect(url); break; case "delete": WorkflowStepInfo step = WorkflowStepInfoProvider.GetWorkflowStepInfo(WorkflowStepID); if (step == null) { ShowError(GetString("graphservice.missingnode")); } string result = step.RemoveSourcePoint(sourcePointGuid); if (!String.IsNullOrEmpty(result)) { ShowError(result); } else { WorkflowHelper.RefreshDesignerFromDialog(Page, CurrentStepInfo.StepID, graphName); } break; case "moveup": CurrentStepInfo.MoveSourcePointUp(sourcePointGuid); WorkflowHelper.RefreshDesignerFromDialog(Page, CurrentStepInfo.StepID, graphName);; break; case "movedown": CurrentStepInfo.MoveSourcePointDown(sourcePointGuid); WorkflowHelper.RefreshDesignerFromDialog(Page, CurrentStepInfo.StepID, graphName); break; } } }
/// <summary> /// Deletes the workflow scope, workflow step and the document used for this example. Called when the "Delete example objects" button is pressed. /// Expects the "CreateExampleObjects" method to be run first. /// </summary> private bool DeleteExampleObjects() { TreeProvider tree = new TreeProvider(CMSContext.CurrentUser); // Get the example document TreeNode node = tree.SelectSingleNode(CMSContext.CurrentSiteName, "/API-Example", "en-us"); if (node != null) { // Delete the document DocumentHelper.DeleteDocument(node, tree, true, true, true); } string where = "ScopeStartingPath LIKE '/API-Example%'"; // Get example workflow scopes DataSet scopes = WorkflowScopeInfoProvider.GetWorkflowScopes(where, null, 0, null); if (!DataHelper.DataSourceIsEmpty(scopes)) { // Loop through all the scopes in case more identical scopes were accidentally created foreach (DataRow scopeRow in scopes.Tables[0].Rows) { // Create scope info object WorkflowScopeInfo scope = new WorkflowScopeInfo(scopeRow); // Delete the scope WorkflowScopeInfoProvider.DeleteWorkflowScopeInfo(scope); } } // Get the default workflow WorkflowInfo workflow = WorkflowInfoProvider.GetWorkflowInfo("default"); if (workflow != null) { // Get the example step WorkflowStepInfo step = WorkflowStepInfoProvider.GetWorkflowStepInfo("MyNewWorkflowStep", workflow.WorkflowID); if (step != null) { // Delete the step WorkflowStepInfoProvider.DeleteWorkflowStepInfo(step); } } return(true); }
private void AddItem(SourcePoint sp, List <WorkflowTransitionInfo> connections) { string label = String.Format(GetString("wf.sourcepoint.label"), sp.Label); WorkflowTransitionInfo conn = connections.FirstOrDefault(i => i.TransitionSourcePointGUID == sp.Guid); if (conn != null) { WorkflowStepInfo target = WorkflowStepInfoProvider.GetWorkflowStepInfo(conn.TransitionEndStepID); if (target != null) { label = String.Format("{0} {1}", label, string.Format(GetString("wf.sourcepoint.step"), target.StepDisplayName)); } } ddlSourcePoints.Items.Add(new ListItem(ResHelper.LocalizeString(label), sp.Guid.ToString())); }
/// <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"), Node.NodeAliasPath), 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 = WorkflowStepInfoProvider.GetWorkflowStepInfo(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> /// Deletes the workflow step. Called when the "Delete workflow step" button is pressed. /// Expects the CreateWorkflow and CreateWorkflowStep methods to be run first. /// </summary> private bool DeleteWorkflowStep() { // Get the workflow WorkflowInfo workflow = WorkflowInfoProvider.GetWorkflowInfo("MyNewWorkflow", WorkflowTypeEnum.Approval); if (workflow != null) { // Get the custom step WorkflowStepInfo deleteStep = WorkflowStepInfoProvider.GetWorkflowStepInfo("MyNewWorkflowStep", workflow.WorkflowID); if (deleteStep != null) { // Remove the step WorkflowStepInfoProvider.DeleteWorkflowStepInfo(deleteStep); return(true); } } return(false); }
//On_ExternalDatabound Displaying Workflow Status and disabling edit and delete button based on condition public static string WorkFlowStatusDisplay(int stepId, string currOrgID, object sender) { var workFlow = string.Empty; if (stepId > 0) { // Get workflow step display name WorkflowStepInfo wsi = WorkflowStepInfoProvider.GetWorkflowStepInfo(stepId); if (wsi != null) { workFlow = ResHelper.LocalizeString(wsi.StepDisplayName); } // if workflow is Archive then we have to disable delete button if (workFlow == SMEConstant.WORKFLOW_ARCHIVED) { System.Web.UI.WebControls.TableCell orgActions = ((System.Web.UI.WebControls.TableCell)sender); System.Web.UI.WebControls.TableRow Actions = ((System.Web.UI.WebControls.TableRow)orgActions.Parent); ((CMSButton)(Actions.Cells[0].FindControl("adelete"))).Enabled = false; //((CMSButton)(Actions.Cells[0].FindControl("aedit"))).Enabled = true; } // if workflow is "Approval await" then we have to disable edit and delete button for author else if (workFlow == SMEConstant.WORKFLOW_APPROVAL) { if (IsUserInAdminRole()) { System.Web.UI.WebControls.TableCell orgActions = ((System.Web.UI.WebControls.TableCell)sender); System.Web.UI.WebControls.TableRow Actions = ((System.Web.UI.WebControls.TableRow)orgActions.Parent); ((CMSButton)(Actions.Cells[0].FindControl("adelete"))).Enabled = false; ((CMSButton)(Actions.Cells[0].FindControl("aedit"))).Enabled = false; } else { System.Web.UI.WebControls.TableCell orgActions = ((System.Web.UI.WebControls.TableCell)sender); System.Web.UI.WebControls.TableRow Actions = ((System.Web.UI.WebControls.TableRow)orgActions.Parent); ((CMSButton)(Actions.Cells[0].FindControl("adelete"))).Enabled = true; ((CMSButton)(Actions.Cells[0].FindControl("aedit"))).Enabled = true; } } } return(workFlow); }
protected void Page_Load(object sender, EventArgs e) { int workflowStepId = QueryHelper.GetInteger("workflowstepid", 0); Guid sourcePointGuid = QueryHelper.GetGuid("sourcepointguid", Guid.Empty); WorkflowStepInfo step = WorkflowStepInfoProvider.GetWorkflowStepInfo(workflowStepId); if ((step != null) && (step.StepDefinition != null)) { SourcePoint sourcePoint = step.StepDefinition.SourcePoints.FirstOrDefault(i => i.Guid == sourcePointGuid); if (sourcePoint != null) { if (!RequestHelper.IsPostBack()) { InitalizeMenu(sourcePoint, workflowStepId); } InitializeMasterPage(workflowStepId, sourcePoint.Label); } } }
protected void gridElem_OnAction(string actionName, object actionArgument) { Guid sourcePointGuid = ValidationHelper.GetGuid(actionArgument, Guid.Empty); if (sourcePointGuid != Guid.Empty) { switch (actionName.ToLowerCSafe()) { case "edit": if (!String.IsNullOrEmpty(ItemEditUrl)) { string url = URLHelper.AddParameterToUrl(ItemEditUrl, "workflowStepId", WorkflowStepID.ToString()); url = URLHelper.AddParameterToUrl(url, "sourcePointGuid", sourcePointGuid.ToString()); URLHelper.Redirect(url); } break; case "delete": WorkflowStepInfo step = WorkflowStepInfoProvider.GetWorkflowStepInfo(WorkflowStepID); if (step == null) { ShowError(GetString("graphservice.missingnode")); } string result = step.RemoveSourcePoint(sourcePointGuid); if (!String.IsNullOrEmpty(result)) { ShowError(result); } break; case "moveup": CurrentStepInfo.MoveSourcePointUp(sourcePointGuid); break; case "movedown": CurrentStepInfo.MoveSourcePointDown(sourcePointGuid); break; } } }
/// <summary> /// Saves new workflow step's data and redirects to Workflow_Edit.aspx. /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Event arguments</param> protected void btnOk_Click(object sender, EventArgs e) { // Finds whether required fields are not empty string result = new Validator().NotEmpty(txtWorkflowDisplayName.Text, GetString("Development-Workflow_Step_New.RequiresDisplayName")).NotEmpty(txtWorkflowCodeName.Text, GetString("Development-Workflow_Step_New.RequiresCodeName")) .IsCodeName(txtWorkflowCodeName.Text, GetString("general.invalidcodename")) .Result; if (result == "") { WorkflowStepInfo wsi = WorkflowStepInfoProvider.GetWorkflowStepInfo(txtWorkflowCodeName.Text, workflowid); if (wsi == null) { try { int workflowStepId = SaveNewWorkflowStep(); if (workflowStepId > 0) { URLHelper.Redirect("Workflow_Step_Edit.aspx?workflowStepid=" + workflowStepId); } } catch (Exception ex) { lblError.Visible = true; lblError.Text = ex.Message; } } else { lblError.Visible = true; lblError.Text = GetString("Development-Workflow_Step_New.WorkflowStepExists"); } } else { lblError.Visible = true; lblError.Text = result; } }
/// <summary> /// Initializes the master page elements. /// </summary> /// <param name="workflowStepId">Workflow step ID</param> private void InitializeMasterPage(int workflowStepId) { WorkflowStepInfo step = WorkflowStepInfoProvider.GetWorkflowStepInfo(workflowStepId); // Set edited object EditedObject = step; if (step != null) { if (step.StepAllowBranch) { // Condition step type can't have additional switch cases if (step.StepType != WorkflowStepTypeEnum.Condition) { // Set actions HeaderAction action = new HeaderAction() { ControlType = HeaderActionTypeEnum.Hyperlink, Text = GetString("Development-Workflow_Step_SourcePoints.New"), RedirectUrl = "~/CMSModules/Workflows/Pages/WorkflowStep/SourcePoint/General.aspx?workflowStepId=" + step.StepID, ImageUrl = GetImageUrl("Objects/CMS_WorkflowStep/SourcePoint/add.png"), }; if (!CanAddSourcePoint(step)) { action.Enabled = false; action.Tooltip = GetString("workflowstep.toomanysourcepoints"); } CurrentMaster.HeaderActions.AddAction(action); } } else { ShowInformation(GetString("workflowstep.cannothavecustomsourcepoints")); listElem.StopProcessing = true; } } }
/// <summary> /// Gets and updates process step. Called when the "Get and update step" button is pressed. /// Expects the CreateProcessStep method to be run first. /// </summary> private bool GetAndUpdateProcessStep() { // Get the process WorkflowInfo process = WorkflowInfoProvider.GetWorkflowInfo("MyNewProcess", WorkflowTypeEnum.Automation); if (process != null) { // Get the process step WorkflowStepInfo modifyStep = WorkflowStepInfoProvider.GetWorkflowStepInfo("MyNewProcessStep", process.WorkflowID); if (modifyStep != null) { // Update the properties modifyStep.StepDisplayName = modifyStep.StepDisplayName.ToLower(); // Save the changes WorkflowStepInfoProvider.SetWorkflowStepInfo(modifyStep); return(true); } } return(false); }
//move that document to previous version workflow state //it will move to the state or previous version that we edited protected static bool MoveToWorkflowStep(int VersionWorkFlowStepID, TreeProvider tree, TreeNode node) { bool versionChangedStatus = false; WorkflowManager workflowManager = WorkflowManager.GetInstance(tree); WorkflowInfo workflow = workflowManager.GetNodeWorkflow(node); // Check if the document uses workflow if (workflow != null) { // Check if the workflow doesn't use automatic publishing, otherwise, documents can't change workflow steps. if (!workflow.WorkflowAutoPublishChanges) { // Check if the current user can move the document to the next step if (workflowManager.CheckStepPermissions(node, WorkflowActionEnum.Reject)) { // Get workflowStepInfo object based on workflow step ID WorkflowStepInfo workflowStep = WorkflowStepInfoProvider.GetWorkflowStepInfo(VersionWorkFlowStepID); if (workflowStep.StepDisplayName.ToLower() == SMEConstant.WORKFLOW_PUBLISHED.ToLower()) { // Move the document to the specified step workflowManager.MoveToSpecificStep(node, workflowStep); versionChangedStatus = true; } else if (workflowStep.StepDisplayName.ToLower() == SMEConstant.WORKFLOW_ARCHIVED.ToLower()) { // Archive the document workflowManager.ArchiveDocument(node, null); // Move the document to the specified step //workflowManager.MoveToSpecificStep(node, workflowStep); versionChangedStatus = true; } } } } return(versionChangedStatus); }
/// <summary> /// Assings the CMS Editors role to a workflow step. Called when the "Add role to step" button is pressed. /// Expects the CreateWorkflow and CreateWorkflowStep methods to be run first. /// </summary> private bool AddRoleToStep() { // Get the workflow WorkflowInfo workflow = WorkflowInfoProvider.GetWorkflowInfo("MyNewWorkflow"); if (workflow != null) { // Get the custom step WorkflowStepInfo step = WorkflowStepInfoProvider.GetWorkflowStepInfo("MyNewWorkflowStep", workflow.WorkflowID); if (step != null) { // Get the role to be assigned to the step RoleInfo role = RoleInfoProvider.GetRoleInfo("CMSEditor", SiteContext.CurrentSiteID); if (role != null) { // Make the assignment WorkflowStepRoleInfoProvider.AddRoleToWorkflowStep(step.StepID, role.RoleID); return(true); } else { // Role was not found apiAddRoleToStep.ErrorMessage = "Role 'CMS Editors' was not found."; } } else { // Step was not found apiAddRoleToStep.ErrorMessage = "Step 'My new workflow step' was not found."; } } return(false); }
private void ReloadMenu() { if (StopProcessing) { return; } // Handle several reloads ClearProperties(); if (!HideStandardButtons) { // If content should be refreshed if (AutomationManager.RefreshActionContent) { // Display action message WorkflowActionInfo action = WorkflowActionInfoProvider.GetWorkflowActionInfo(Step.StepActionID); string name = (action != null) ? action.ActionDisplayName : Step.StepDisplayName; string str = (action != null) ? "workflow.actioninprogress" : "workflow.stepinprogress"; string text = string.Format(ResHelper.GetString(str, ResourceCulture), HTMLHelper.HTMLEncode(ResHelper.LocalizeString(name))); text = ScriptHelper.GetLoaderInlineHtml(Page, text); InformationText = text; EnsureRefreshScript(); } // Object update if (AutomationManager.Mode == FormModeEnum.Update) { if (InfoObject != null) { // Get current process WorkflowInfo process = AutomationManager.Process; string objectName = HTMLHelper.HTMLEncode(InfoObject.TypeInfo.GetNiceObjectTypeName().ToLowerCSafe()); // Next step action if (AutomationManager.IsActionAllowed(ComponentEvents.AUTOMATION_MOVE_NEXT)) { next = new NextStepAction(Page) { Tooltip = string.Format(ResHelper.GetString("EditMenu.NextStep", ResourceCulture), objectName), OnClientClick = RaiseGetClientValidationScript(ComponentEvents.AUTOMATION_MOVE_NEXT, null), }; } // Move to specific step action if (AutomationManager.IsActionAllowed(ComponentEvents.AUTOMATION_MOVE_SPEC)) { var steps = WorkflowStepInfoProvider.GetWorkflowSteps() .Where("StepWorkflowID = " + process.WorkflowID + " AND StepType <> " + (int)WorkflowStepTypeEnum.Start) .OrderBy("StepDisplayName"); specific = new NextStepAction(Page) { Text = GetString("AutoMenu.SpecificStepIcon"), Tooltip = string.Format(ResHelper.GetString("AutoMenu.SpecificStepMultiple", ResourceCulture), objectName), CommandName = ComponentEvents.AUTOMATION_MOVE_SPEC, EventName = ComponentEvents.AUTOMATION_MOVE_SPEC, CssClass = "scrollable-menu", // Make action inactive OnClientClick = null, Inactive = true }; foreach (var s in steps) { string stepName = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(s.StepDisplayName)); NextStepAction spc = new NextStepAction(Page) { Text = string.Format(ResHelper.GetString("AutoMenu.SpecificStepTo", ResourceCulture), stepName), Tooltip = string.Format(ResHelper.GetString("AutoMenu.SpecificStep", ResourceCulture), objectName), CommandName = ComponentEvents.AUTOMATION_MOVE_SPEC, EventName = ComponentEvents.AUTOMATION_MOVE_SPEC, CommandArgument = s.StepID.ToString(), OnClientClick = RaiseGetClientValidationScript(ComponentEvents.AUTOMATION_MOVE_SPEC, "if(!confirm(" + ScriptHelper.GetString(string.Format(ResHelper.GetString("autoMenu.MoveSpecificConfirmation"), objectName, ResHelper.LocalizeString(s.StepDisplayName))) + ")) { return false; }"), }; // Process action appearance ProcessAction(spc, Step, s); // Add step specific.AlternativeActions.Add(spc); } // Add comment AddCommentAction(ComponentEvents.AUTOMATION_MOVE_SPEC, specific, objectName); } // Previous step action if (AutomationManager.IsActionAllowed(ComponentEvents.AUTOMATION_MOVE_PREVIOUS)) { var prevSteps = Manager.GetPreviousSteps(InfoObject, StateObject); int prevStepsCount = prevSteps.Count; if (prevStepsCount > 0) { previous = new PreviousStepAction(Page) { Tooltip = string.Format(ResHelper.GetString("EditMenu.PreviousStep", ResourceCulture), objectName), OnClientClick = RaiseGetClientValidationScript(ComponentEvents.AUTOMATION_MOVE_PREVIOUS, null) }; // For managers allow move to specified step if (WorkflowStepInfoProvider.CanUserManageAutomationProcesses(MembershipContext.AuthenticatedUser, InfoObject.Generalized.ObjectSiteName)) { if (prevStepsCount > 1) { foreach (var s in prevSteps) { previous.AlternativeActions.Add(new PreviousStepAction(Page) { Text = string.Format(ResHelper.GetString("EditMenu.PreviousStepTo", ResourceCulture), HTMLHelper.HTMLEncode(ResHelper.LocalizeString(s.StepDisplayName))), Tooltip = string.Format(ResHelper.GetString("EditMenu.PreviousStep", ResourceCulture), objectName), OnClientClick = RaiseGetClientValidationScript(ComponentEvents.AUTOMATION_MOVE_PREVIOUS, null), CommandArgument = s.RelatedHistoryID.ToString() }); } } } // Add comment AddCommentAction(ComponentEvents.AUTOMATION_MOVE_PREVIOUS, previous, objectName); } } if (AutomationManager.IsActionAllowed(ComponentEvents.AUTOMATION_REMOVE)) { delete = new HeaderAction { CommandName = ComponentEvents.AUTOMATION_REMOVE, EventName = ComponentEvents.AUTOMATION_REMOVE, Text = ResHelper.GetString("autoMenu.RemoveState", ResourceCulture), Tooltip = string.Format(ResHelper.GetString("autoMenu.RemoveStateDesc", ResourceCulture), objectName), OnClientClick = RaiseGetClientValidationScript(ComponentEvents.AUTOMATION_REMOVE, "if(!confirm(" + ScriptHelper.GetString(string.Format(ResHelper.GetString("autoMenu.RemoveStateConfirmation"), objectName)) + ")) { return false; }"), ButtonStyle = ButtonStyle.Default }; } // Handle multiple next steps if (next != null) { // Get next step info List <WorkflowStepInfo> steps = AutomationManager.NextSteps; int stepsCount = steps.Count; if (stepsCount > 0) { var nextS = steps[0]; // Only one next step if (stepsCount == 1) { if (nextS.StepIsFinished) { next.Text = ResHelper.GetString("EditMenu.IconFinish", ResourceCulture); next.Tooltip = string.Format(ResHelper.GetString("EditMenu.Finish", ResourceCulture), objectName); } // Process action appearance ProcessAction(next, Step, nextS); } // Multiple next steps else { // Check if not all steps finish steps if (steps.Exists(s => !s.StepIsFinished)) { next.Tooltip = string.Format(ResHelper.GetString("EditMenu.NextStepMultiple", ResourceCulture), objectName); } else { next.Text = ResHelper.GetString("EditMenu.IconFinish", ResourceCulture); next.Tooltip = string.Format(ResHelper.GetString("EditMenu.NextStepMultiple", ResourceCulture), objectName); } // Make action inactive next.OnClientClick = null; next.Inactive = true; // Process action appearance ProcessAction(next, Step, null); string itemText = "EditMenu.NextStepTo"; string itemDesc = "EditMenu.NextStep"; foreach (var s in steps) { NextStepAction nxt = new NextStepAction(Page) { Text = string.Format(ResHelper.GetString(itemText, ResourceCulture), HTMLHelper.HTMLEncode(ResHelper.LocalizeString(s.StepDisplayName))), Tooltip = string.Format(ResHelper.GetString(itemDesc, ResourceCulture), objectName), OnClientClick = RaiseGetClientValidationScript(ComponentEvents.AUTOMATION_MOVE_NEXT, null), CommandArgument = s.StepID.ToString() }; if (s.StepIsFinished) { nxt.Text = string.Format(ResHelper.GetString("EditMenu.FinishTo", ResourceCulture), HTMLHelper.HTMLEncode(ResHelper.LocalizeString(s.StepDisplayName))); nxt.Tooltip = string.Format(ResHelper.GetString("EditMenu.Finish", ResourceCulture), objectName); } // Process action appearance ProcessAction(nxt, Step, s); // Add step next.AlternativeActions.Add(nxt); } } // Add comment AddCommentAction(ComponentEvents.AUTOMATION_MOVE_NEXT, next, objectName); } else { bool displayAction = false; if (!Step.StepAllowBranch) { // Transition exists, but condition doesn't match var transitions = Manager.GetStepTransitions(Step); if (transitions.Count > 0) { WorkflowStepInfo s = WorkflowStepInfoProvider.GetWorkflowStepInfo(transitions[0].TransitionEndStepID); // Finish text if (s.StepIsFinished) { next.Text = ResHelper.GetString("EditMenu.IconFinish", ResourceCulture); next.Tooltip = string.Format(ResHelper.GetString("EditMenu.Finish", ResourceCulture), objectName); } // Inform user displayAction = true; next.Enabled = false; // Process action appearance ProcessAction(next, Step, null); } } if (!displayAction) { // There is not next step next = null; } } } // Handle start button if (AutomationManager.IsActionAllowed(ComponentEvents.AUTOMATION_START) && (process.WorkflowRecurrenceType != ProcessRecurrenceTypeEnum.NonRecurring)) { start = new HeaderAction { CommandName = ComponentEvents.AUTOMATION_START, EventName = ComponentEvents.AUTOMATION_START, Text = ResHelper.GetString("autoMenu.StartState", ResourceCulture), Tooltip = process.WorkflowEnabled ? ResHelper.GetString("autoMenu.StartStateDesc", ResourceCulture) : ResHelper.GetString("autoMenu.DisabledStateDesc", ResourceCulture), CommandArgument = process.WorkflowID.ToString(), Enabled = process.WorkflowEnabled, OnClientClick = RaiseGetClientValidationScript(ComponentEvents.AUTOMATION_START, "if(!confirm(" + ScriptHelper.GetString(string.Format(ResHelper.GetString("autoMenu.startSameProcessConfirmation", ResourceCulture), objectName)) + ")) { return false; }"), ButtonStyle = ButtonStyle.Default }; } } } } // Add actions in correct order menu.ActionsList.Clear(); AddAction(previous); AddAction(next); AddAction(specific); AddAction(delete); AddAction(start); // Set the information text if (!String.IsNullOrEmpty(InformationText)) { lblInfo.Text = InformationText; lblInfo.CssClass = "LeftAlign EditMenuInfo"; lblInfo.Visible = true; } ScriptHelper.RegisterJQuery(Page); ScriptHelper.RegisterModule(Page, "CMS/ScrollPane", new { selector = ".scrollable-menu ul" }); CssRegistration.RegisterCssLink(Page, "~/CMSScripts/jquery/jquery-jscrollpane.css"); }
/// <summary> /// External data binding handler. /// </summary> protected object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter) { // Prepare variables int nodeId = 0; string culture = string.Empty; DataRowView data = null; sourceName = sourceName.ToLowerCSafe(); SiteInfo site = null; switch (sourceName) { // Edit button case EXTERNALSOURCE_EDIT: if (sender is ImageButton) { ImageButton editButton = (ImageButton)sender; data = UniGridFunctions.GetDataRowView(editButton.Parent as DataControlFieldCell); site = GetSiteFromRow(data); nodeId = ValidationHelper.GetInteger(data[SOURCE_NODEID], 0); culture = ValidationHelper.GetString(data[SOURCE_DOCUMENTCULTURE], string.Empty); string type = ValidationHelper.GetString(DataHelper.GetDataRowViewValue(data, SOURCE_TYPE), string.Empty); // Check permissions if ((site.Status != SiteStatusEnum.Running) || (!CMSMyDeskPage.IsUserAuthorizedPerContent(site.SiteName) || ((ListingType == ListingTypeEnum.All) && (type == LISTINGTYPE_RECYCLEBIN)))) { editButton.ImageUrl = GetImageUrl("Design/Controls/UniGrid/Actions/Editdisabled.png"); editButton.OnClientClick = "return false"; editButton.Style.Add(HtmlTextWriterStyle.Cursor, "default"); } else { editButton.OnClientClick = "return SelectItem(" + nodeId + ", '" + culture + "','" + ResolveSiteUrl(site) + "');"; } return(editButton); } return(sender); // Preview button case EXTERNALSOURCE_PREVIEW: if (sender is ImageButton) { ImageButton previewButton = (ImageButton)sender; data = UniGridFunctions.GetDataRowView(previewButton.Parent as DataControlFieldCell); site = GetSiteFromRow(data); string type = ValidationHelper.GetString(DataHelper.GetDataRowViewValue(data, SOURCE_TYPE), string.Empty); if ((site.Status != SiteStatusEnum.Running) || ((ListingType == ListingTypeEnum.All) && (type == LISTINGTYPE_RECYCLEBIN))) { previewButton.ImageUrl = GetImageUrl("Design/Controls/UniGrid/Actions/Viewdisabled.png"); previewButton.OnClientClick = "return false"; previewButton.Style.Add(HtmlTextWriterStyle.Cursor, "default"); } else { nodeId = ValidationHelper.GetInteger(data[SOURCE_NODEID], 0); culture = ValidationHelper.GetString(data[SOURCE_DOCUMENTCULTURE], string.Empty); string nodeAliasPath = ValidationHelper.GetString(data[SOURCE_NODEALIASPATH], string.Empty); // Generate preview URL string url = CMSContext.GetUrl(nodeAliasPath, null, site.SiteName); url = URLHelper.AddParameterToUrl(url, "viewmode", "2"); url = URLHelper.AddParameterToUrl(url, URLHelper.LanguageParameterName, culture); previewButton.OnClientClick = "window.open('" + URLHelper.ResolveUrl(url) + "','LiveSite');return false;"; } return(previewButton); } return(sender); // Document name column case EXTERNALSOURCE_DOCUMENTNAME: data = (DataRowView)parameter; string name = ValidationHelper.GetString(data[SOURCE_DOCUMENTNAME], string.Empty); nodeId = ValidationHelper.GetInteger(data[SOURCE_NODEID], 0); culture = ValidationHelper.GetString(data[SOURCE_DOCUMENTCULTURE], string.Empty); string className = ValidationHelper.GetString(data[SOURCE_CLASSNAME], string.Empty); site = GetSiteFromRow(data); if (name == string.Empty) { name = GetString("general.notspecified"); } // Add document type icon string result = string.Empty; switch (ListingType) { case ListingTypeEnum.DocTypeDocuments: break; default: result = "<img src=\"" + UIHelper.GetDocumentTypeIconUrl(Parent.Page, className, String.Empty, true) + "\" class=\"UnigridActionButton\" />"; break; } result += "<span style=\"vertical-align: bottom;\">" + HTMLHelper.HTMLEncode(TextHelper.LimitLength(name, 50)) + "</span>"; if (ListingType != ListingTypeEnum.All) { bool isLink = (data.Row.Table.Columns.Contains(SOURCE_NODELINKEDNODEID) && (data[SOURCE_NODELINKEDNODEID] != DBNull.Value)); if (isLink) { // Add link icon result += UIHelper.GetDocumentMarkImage(Parent.Page, DocumentMarkEnum.Link); } } return(result); // Class name column case EXTERNALSOURCE_CLASSDISPLAYNAME: string displayName = ValidationHelper.GetString(parameter, string.Empty); if (sourceName.ToLowerCSafe() == EXTERNALSOURCE_CLASSDISPLAYNAMETOOLTIP) { displayName = TextHelper.LimitLength(displayName, 50); } if (displayName == string.Empty) { displayName = "-"; } return(HTMLHelper.HTMLEncode(ResHelper.LocalizeString(displayName))); case EXTERNALSOURCE_DOCUMENTNAMETOOLTIP: data = (DataRowView)parameter; return(UniGridFunctions.DocumentNameTooltip(data)); case EXTERNALSOURCE_STEPDISPLAYNAME: // Step display name string stepName = ValidationHelper.GetString(parameter, string.Empty); if (stepName == string.Empty) { stepName = "-"; } return(HTMLHelper.HTMLEncode(ResHelper.LocalizeString(stepName))); case EXTERNALSOURCE_STEPNAME: // Step display name from ID int stepId = ValidationHelper.GetInteger(parameter, 0); if (stepId > 0) { WorkflowStepInfo wsi = WorkflowStepInfoProvider.GetWorkflowStepInfo(stepId); if (wsi != null) { return(HTMLHelper.HTMLEncode(ResHelper.LocalizeString(wsi.StepDisplayName))); } } return("-"); case EXTERNALSOURCE_CULTURE: data = (DataRowView)parameter; culture = ValidationHelper.GetString(data[SOURCE_DOCUMENTCULTURE], string.Empty); // Add icon if (culture != String.Empty) { return(UniGridFunctions.DocumentCultureFlag(data, Page)); } return("-"); // Version column case EXTERNALSOURCE_VERSION: if (parameter == DBNull.Value) { parameter = "-"; } parameter = HTMLHelper.HTMLEncode(parameter.ToString()); return(parameter); // Site name column case EXTERNALSOURCE_SITENAME: string siteName = ValidationHelper.GetString(parameter, string.Empty); siteInfo = SiteInfoProvider.GetSiteInfo(siteName); return(HTMLHelper.HTMLEncode(siteInfo.DisplayName)); case EXTERNALSOURCE_SITEID: int siteId = ValidationHelper.GetInteger(parameter, 0); siteInfo = SiteInfoProvider.GetSiteInfo(siteId); return(HTMLHelper.HTMLEncode(siteInfo.DisplayName)); // Document timestamp column case EXTERNALSOURCE_MODIFIEDWHEN: case EXTERNALSOURCE_MODIFIEDWHENTOOLTIP: if (string.IsNullOrEmpty(parameter.ToString())) { return(string.Empty); } else { if (currentSiteInfo == null) { currentSiteInfo = CMSContext.CurrentSite; } bool displayGMT = (sourceName == EXTERNALSOURCE_MODIFIEDWHENTOOLTIP); DateTime time = ValidationHelper.GetDateTime(parameter, DateTimeHelper.ZERO_TIME); return(TimeZoneHelper.ConvertToUserTimeZone(time, displayGMT, currentUserInfo, currentSiteInfo)); } } return(parameter); }