private void LoadSlotInfoMap(ContentTypeManager contentTypeManager, TemplateNameManager templateNameManager) { PSTemplateSlot[] slotData = PSWSUtils.LoadSlots(_assemblyService); _slotMap = new Dictionary <string, SlotInfo>(); foreach (PSTemplateSlot slot in slotData) { SlotInfo info = new SlotInfo(slot.name, new PercussionGuid(slot.id)); foreach (PSTemplateSlotContent idPair in slot.AllowedContent) { PercussionGuid contentTypeID = new PercussionGuid(idPair.contentTypeId); PercussionGuid templateID = new PercussionGuid(idPair.templateId); string contentTypeName = contentTypeManager[contentTypeID]; string templateName = templateNameManager[templateID]; ContentTypeToTemplateInfo pairData = new ContentTypeToTemplateInfo(contentTypeName, contentTypeID, templateName, templateID); info.AllowedContentTemplatePairs.Add(pairData); } if (!_slotMap.ContainsKey(slot.name)) { _slotMap.Add(slot.name, info); } } }
public ContentTypeToTemplateInfo(string contentTypeName, PercussionGuid contentTypeID, string templateName, PercussionGuid templateID) { ContentTypeName = contentTypeName; ContentTypeID = contentTypeID; TemplateName = templateName; TemplateID = templateID; }
private void MakeNavonPublic(string folderPath) { // Get the Navon's content ID. PSSearchResults[] searchResults = PSWSUtils.FindItemByFieldValues(_contentService, NavonContentType, folderPath, true, null); if (searchResults.Length < 1) { throw new CMSOperationalException(string.Format("Navon not found for folder {0}.", folderPath)); } PSWSUtils.TransitionItems(_systemService, new long[] { PercussionGuid.GetID(searchResults[0].id) }, NavonPublicTransitionName); }
/// <summary> /// Performs a reverse look up for a content type name, based on its ID. /// Returns the first content type with that ID. /// Note that searching for an ID from a name is much faster. /// </summary> /// <param name="reverseKey"></param> /// <returns></returns> public string this[PercussionGuid reverseKey] { get { if (!_contentTypeMap.ContainsValue(reverseKey)) { throw new CMSMissingContentTypeException(string.Format("Unknown contentType name: {0}.", reverseKey)); } return(_contentTypeMap.First(kvp => kvp.Value == reverseKey).Key); } }
public override bool Equals(object obj) { if (obj == null) { return(false); } PercussionGuid rhs = obj as PercussionGuid; if ((Object)rhs == null) { return(false); } return(this == rhs); }
public SlotInfo(string name, PercussionGuid id) { Name = name; CmsGuid = id; }