/// <summary> /// Get the workflow name out of the current item /// </summary> /// <param name="args"></param> /// <returns></returns> private string GetItemWorkflowName(DynamicFieldsArgs args) { //Grab item and master database var item = args.InnerItem; var masterDb = Factory.GetDatabase("master"); //Initalize the workflow name return value var workflowName = "N/A"; //If the item exist and the item has a workflow ID set then set the workflow name return value if (item == null) return workflowName; //Get the workflow item ID var workflowItemId = item.Fields[FieldIDs.Workflow].Value; if (string.IsNullOrEmpty(workflowItemId)) return workflowName; //Get the workflow item var workflowItem = masterDb.GetItem(workflowItemId); //Set the workflow name to the return value if (workflowItem != null) workflowName = workflowItem.Name; return workflowName; }
/// <summary> /// Adds the workflow name to the dynamic placeholders for views /// </summary> /// <param name="args"></param> public override void Process(DynamicFieldsArgs args) { //Add the workflow name to the dynamic placeholders args.QuickActions.Add("Workflow", GetItemWorkflowName(args)); }
/// <summary> /// Add the item language to the dynamic placeholders for views /// </summary> /// <param name="args"></param> public override void Process(DynamicFieldsArgs args) { //Add the item language as a dynamic placeholder args.QuickActions.Add("Language", args.InnerItem.Language.Name); }
/// <summary> /// Add the workflow state name to the dynamic placeholders for views /// </summary> /// <param name="args"></param> public override void Process(DynamicFieldsArgs args) { //Add the workflow name of the current item to the Dynamic Placeholder list args.QuickActions.Add("WorkflowState", GetItemWorkflowStateName(args)); }
/// <summary> /// Add the workflow history to the dynamic placeholders for views /// </summary> /// <param name="args"></param> public override void Process(DynamicFieldsArgs args) { //Set the Workflow History Actions dynamic field to a history link with a hidden table of history information args.QuickActions.Add("WorkflowHistoryActions", GetWorkflowHistory(args)); }
/// <summary> /// Generates a button that can be clicked to show the history table /// </summary> /// <param name="args"></param> /// <returns></returns> private string GetWorkflowHistory(DynamicFieldsArgs args) { //Get the item var item = args.InnerItem; //Create the history button var stringBuilder = new StringBuilder("<span class='history-button' style=\"font-weight:bold;"); stringBuilder.Append("background: url(\'/temp/IconCache/Applications/16x16/history.png') no-repeat 6px 3px;"); stringBuilder.Append("padding-left:25px;\">"); stringBuilder.Append("<a href='' onclick=\"return false;\">History</a>"); //Create the history table stringBuilder.Append(BuildHistoryView(item)); //Close the loop stringBuilder.Append("</span>"); //Return the information return stringBuilder.ToString(); }