16 using System.Collections.Generic;
19 using erminas.SmartAPI.Utils;
20 using erminas.SmartAPI.Utils.CachedCollections;
22 namespace erminas.SmartAPI.CMS.Project.ContentClasses
29 internal class PageDefinitions : RDList<IPageDefinition>, IPageDefinitions
31 private readonly IContentClass _contentClass;
33 internal PageDefinitions(IContentClass contentClass,
Caching caching) : base(caching)
35 _contentClass = contentClass;
36 RetrieveFunc = GetPageDefinitions;
39 public IContentClass ContentClass
41 get {
return _contentClass; }
44 public IProject Project
46 get {
return _contentClass.Project; }
49 public ISession Session
51 get {
return _contentClass.Session; }
54 private List<IPageDefinition> GetPageDefinitions()
56 const string LOAD_PREASSIGNMENT =
@"<TEMPLATELIST action=""load"" withpagedefinitions=""1""/>";
58 var xmlDoc = Project.ExecuteRQL(LOAD_PREASSIGNMENT);
59 const string PAGE_DEFINITIONS_XPATH =
"//TEMPLATE[@guid='{0}']/PAGEDEFINITIONS/PAGEDEFINITION";
60 var pageDefs = xmlDoc.SelectNodes(PAGE_DEFINITIONS_XPATH.RQLFormat(_contentClass));
63 (from XmlElement curPageDef in pageDefs select
new PageDefinition(_contentClass, curPageDef))
64 .Cast<IPageDefinition>().ToList();