Skip to content

Instantly share code, notes, and snippets.

@blacktambourine
Created December 11, 2015 02:41
Show Gist options
  • Save blacktambourine/1667ff7abf5ec3b8649b to your computer and use it in GitHub Desktop.
Save blacktambourine/1667ff7abf5ec3b8649b to your computer and use it in GitHub Desktop.
Sitecore Configuration File Parser
using System;
using System.Collections.Generic;
namespace BlackTambourine.Web.Helpers
{
public class WorkboxPlusConfig
{
public Dictionary<Guid, string> ItemTemplateNames { get; private set; }
public Dictionary<Guid, string> FilterableWorkflowStates { get; private set; }
public bool EnablePageLevelApproval { get; set; }
public WorkboxPlusConfig(string enablePageLevelApproval)
{
this.ItemTemplateNames = new Dictionary<Guid, string>();
this.FilterableWorkflowStates = new Dictionary<Guid, string>();
EnablePageLevelApproval = true; //default to true;
EnablePageLevelApproval = bool.Parse(enablePageLevelApproval);
}
#region Child Item Templates
public void AddWorkboxPlusItemTemplateName(string key, System.Xml.XmlNode node)
{
AddWorkboxPlusItemTemplateName(node);
}
public void AddWorkboxPlusItemTemplateName(System.Xml.XmlNode node)
{
var guid = Sitecore.Xml.XmlUtil.GetValue(node);
var name = Sitecore.Xml.XmlUtil.GetAttribute("name", node);
this.ItemTemplateNames.Add(new Guid(guid), name);
}
#endregion
#region Filterable Workflow States
public void AddWorkboxPlusFilterableState(string key, System.Xml.XmlNode node)
{
AddWorkboxPlusFilterableState(node);
}
public void AddWorkboxPlusFilterableState(System.Xml.XmlNode node)
{
var guid = Sitecore.Xml.XmlUtil.GetValue(node);
var name = Sitecore.Xml.XmlUtil.GetAttribute("name", node);
this.FilterableWorkflowStates.Add(new Guid(guid), name);
}
#endregion
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment