Skip to content

Instantly share code, notes, and snippets.

@Refactored
Created June 27, 2013 17:25
Show Gist options
  • Save Refactored/5878448 to your computer and use it in GitHub Desktop.
Save Refactored/5878448 to your computer and use it in GitHub Desktop.
private void CreateItem(IWorkflow workflow, Item item, System.Web.UI.Control control)
{
Assert.ArgumentNotNull(workflow, "workflow");
Assert.ArgumentNotNull(item, "item");
Assert.ArgumentNotNull(control, "control");
XmlControl webControl = Resource.GetWebControl("WorkboxItem") as XmlControl;
Assert.IsNotNull(webControl, "workboxItem is null");
control.Controls.Add(webControl);
StringBuilder builder = new StringBuilder(" - (");
Language language = item.Language;
builder.Append(language.CultureInfo.DisplayName);
builder.Append(", ");
builder.Append(Translate.Text("version"));
builder.Append(' ');
builder.Append(item.Version.ToString());
builder.Append(")");
Assert.IsNotNull(webControl, "workboxItem");
webControl["Header"] = item.DisplayName;
webControl["Details"] = builder.ToString();
webControl["Path"] = item.Paths.ContentPath.ToLower();
webControl["Icon"] = item.Appearance.Icon;
webControl["ShortDescription"] = item.Help.ToolTip;
webControl["History"] = this.GetHistory(workflow, item);
webControl["HistoryMoreID"] = Control.GetUniqueID("ctl");
webControl["HistoryClick"] = string.Concat(new object[] { "workflow:showhistory(id=", item.ID, ",la=", item.Language.Name, ",vs=", item.Version, ",wf=", workflow.WorkflowID, ")" });
webControl["PreviewClick"] = string.Concat(new object[] { "Preview(\"", item.ID, "\", \"", item.Language, "\", \"", item.Version, "\")" });
webControl["Click"] = string.Concat(new object[] { "Open(\"", item.ID, "\", \"", item.Language, "\", \"", item.Version, "\")" });
webControl["DiffClick"] = string.Concat(new object[] { "Diff(\"", item.ID, "\", \"", item.Language, "\", \"", item.Version, "\")" });
webControl["Display"] = "none";
string uniqueID = Control.GetUniqueID(string.Empty);
webControl["CheckID"] = "check_" + uniqueID;
webControl["HiddenID"] = "hidden_" + uniqueID;
webControl["CheckValue"] = string.Concat(new object[] { item.ID, ",", item.Language, ",", item.Version });
foreach (WorkflowCommand command in WorkflowFilterer.FilterVisibleCommands(workflow.GetCommands(item)))
{
this.CreateCommand(workflow, command, item, webControl);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment