/// <summary> /// Initializes the category provider /// </summary> private void InitCategoryProvider() { // Create and set category provider UniTreeProvider categoryProvider = new UniTreeProvider(); categoryProvider.DisplayNameColumn = "DisplayName"; categoryProvider.IDColumn = "ObjectID"; categoryProvider.LevelColumn = "ObjectLevel"; categoryProvider.OrderColumn = "CategoryOrder"; categoryProvider.ParentIDColumn = "ParentID"; categoryProvider.PathColumn = "ObjectPath"; categoryProvider.ValueColumn = "ObjectID"; categoryProvider.ChildCountColumn = "CompleteChildCount"; categoryProvider.QueryName = "cms.pagetemplatecategory.selectallview"; categoryProvider.ObjectTypeColumn = "ObjectType"; categoryProvider.Columns = "DisplayName, CodeName, ObjectID, ObjectLevel, CategoryOrder, ParentID, ObjectPath, CompleteChildCount, ObjectType, CategoryChildCount, CategoryImagePath, Parameter"; categoryProvider.ImageColumn = "CategoryImagePath"; categoryProvider.ParameterColumn = "Parameter"; if (!SelectPageTemplates) { categoryProvider.WhereCondition = "ObjectType = 'pagetemplatecategory'"; categoryProvider.ChildCountColumn = "CategoryChildCount"; categoryProvider.ObjectTypeColumn = ""; } else { categoryProvider.OrderBy = "ObjectType DESC, DisplayName ASC"; } // Do not show AdHoc category if (!ShowAdHocCategory) { categoryProvider.WhereCondition = SqlHelper.AddWhereCondition(categoryProvider.WhereCondition, "CodeName <> 'AdHoc' AND CodeName <> 'AdHocUI'"); } // Do not show empty categories if (!ShowEmptyCategories) { categoryProvider.WhereCondition = SqlHelper.AddWhereCondition(categoryProvider.WhereCondition, "CategoryTemplateChildCount > 0 OR CategoryChildCount > 0"); TreeProvider tp = new TreeProvider(MembershipContext.AuthenticatedUser); CMS.DocumentEngine.TreeNode node = DocumentHelper.GetDocument(DocumentID, tp); string culture = LocalizationContext.PreferredCultureCode; int level = 0; string path = string.Empty; string className = String.Empty; if (node != null) { level = node.NodeLevel; path = node.NodeAliasPath; if (IsNewPage) { level++; path = path + "/%"; } else { culture = node.DocumentCulture; } className = node.NodeClassName; // Check if class id is in query string - then use it's value instead of document class name int classID = QueryHelper.GetInteger("classid", 0); if (classID != 0) { DataClassInfo dci = DataClassInfoProvider.GetDataClassInfo(classID); if (dci != null) { className = dci.ClassName; } } } // Add where condition for scopes categoryProvider.WhereCondition += " AND (ObjectLevel = 0 OR (SELECT TOP 1 ObjectID FROM View_CMS_PageTemplateCategoryPageTemplate_Joined AS X WHERE X.ObjectType = 'pagetemplate' "; categoryProvider.WhereCondition += " AND (X.PageTemplateType IS NULL OR X.PageTemplateType <> N'" + PageTemplateInfoProvider.GetPageTemplateTypeCode(PageTemplateTypeEnum.Dashboard) + "')"; if (ShowOnlySiteTemplates) { categoryProvider.WhereCondition += " AND X.ObjectID IN (SELECT PageTemplateID FROM CMS_PageTemplateSite WHERE SiteID = " + SiteContext.CurrentSiteID + ") "; } if (node != null) { categoryProvider.WhereCondition += " AND (" + PageTemplateScopeInfoProvider.GetScopeWhereCondition(path, culture, className, level, SiteContext.CurrentSiteName, "X", "ObjectID") + ") "; } categoryProvider.WhereCondition += " AND (X.ObjectPath LIKE View_CMS_PageTemplateCategoryPageTemplate_Joined.ObjectPath + '/%')) IS NOT NULL)"; // Add column count column - minimal number of children categoryProvider.Columns += @", (SELECT TOP 1 Count(*) FROM View_CMS_PageTemplateCategoryPageTemplate_Joined AS Y WHERE (Y.ObjectID = View_CMS_PageTemplateCategoryPageTemplate_Joined.ObjectID AND Y.ObjectLevel = 0) OR ( View_CMS_PageTemplateCategoryPageTemplate_Joined.ObjectType = 'PageTemplateCategory' AND View_CMS_PageTemplateCategoryPageTemplate_Joined.CategoryChildCount > 0 AND Y.ObjectType = 'PageTemplate' AND Y.ObjectLevel > View_CMS_PageTemplateCategoryPageTemplate_Joined.ObjectLevel + 1 "; if (ShowOnlySiteTemplates) { categoryProvider.Columns += "AND Y.ObjectID IN (SELECT PageTemplateID FROM CMS_PageTemplateSite WHERE SiteID = " + SiteContext.CurrentSiteID + ") "; } if (node != null) { categoryProvider.Columns += " AND ( " + PageTemplateScopeInfoProvider.GetScopeWhereCondition(path, culture, className, level, SiteContext.CurrentSiteName, "Y", "ObjectID") + " ) "; } categoryProvider.Columns += " AND Y.ObjectPath LIKE View_CMS_PageTemplateCategoryPageTemplate_Joined.ObjectPath + '/%')) AS MinNumberOfChilds"; categoryProvider.ChildCountColumn = "MinNumberOfChilds"; } // Handle the root path if (!String.IsNullOrEmpty(RootPath)) { categoryProvider.RootLevelOffset = RootPath.Trim('/').Split('/').Length - 1; categoryProvider.WhereCondition = SqlHelper.AddWhereCondition(categoryProvider.WhereCondition, String.Format("((ObjectPath = '{0}' OR ObjectPath LIKE '{0}/%'))", RootPath.Trim('/'))); } treeElem.ProviderObject = categoryProvider; }
/// <summary> /// Initializes the category provider /// </summary> private void InitCategoryProvider() { // Create and set category provider UniTreeProvider categoryProvider = new UniTreeProvider(); categoryProvider.DisplayNameColumn = "DisplayName"; categoryProvider.IDColumn = "ObjectID"; categoryProvider.LevelColumn = "ObjectLevel"; categoryProvider.OrderColumn = "CategoryOrder"; categoryProvider.ParentIDColumn = "ParentID"; categoryProvider.PathColumn = "ObjectPath"; categoryProvider.ValueColumn = "ObjectID"; categoryProvider.ChildCountColumn = "CompleteChildCount"; categoryProvider.QueryName = "cms.pagetemplatecategory.selectallview"; categoryProvider.ObjectTypeColumn = "ObjectType"; categoryProvider.Columns = "DisplayName, CodeName, ObjectID, ObjectLevel, CategoryOrder, ParentID, ObjectPath, CompleteChildCount, ObjectType, CategoryChildCount, CategoryImagePath, Parameter"; categoryProvider.ImageColumn = "CategoryImagePath"; categoryProvider.ParameterColumn = "Parameter"; if (!SelectPageTemplates) { categoryProvider.WhereCondition = "ObjectType = 'pagetemplatecategory'"; categoryProvider.ChildCountColumn = "CategoryChildCount"; categoryProvider.ObjectTypeColumn = ""; treeElem.DefaultImagePath = GetImageUrl("Objects/CMS_PageTemplateCategory/list.png"); } else { categoryProvider.OrderBy = "ObjectType DESC, DisplayName ASC"; treeElem.OnGetImage += new CMSAdminControls_UI_Trees_UniTree.GetImageEventHandler(treeElem_OnGetImage); } // Do not show AdHoc category if (!ShowAdHocCategory) { categoryProvider.WhereCondition = SqlHelperClass.AddWhereCondition(categoryProvider.WhereCondition, "CodeName <> 'AdHoc'"); } // Do not show empty categories if (!ShowEmptyCategories) { categoryProvider.WhereCondition = SqlHelperClass.AddWhereCondition(categoryProvider.WhereCondition, "CategoryTemplateChildCount > 0 OR CategoryChildCount > 0"); TreeProvider tp = new TreeProvider(CMSContext.CurrentUser); CMS.DocumentEngine.TreeNode node = DocumentHelper.GetDocument(DocumentID, tp); string culture = CMSContext.PreferredCultureCode; int level = 0; string path = string.Empty; if (node != null) { level = node.NodeLevel; path = node.NodeAliasPath; if (IsNewPage) { level++; path = path + "/%"; } else { culture = node.DocumentCulture; } } // Add where condition for scopes categoryProvider.WhereCondition += " AND (ObjectLevel = 0 OR (SELECT TOP 1 ObjectID FROM View_CMS_PageTemplateCategoryPageTemplate_Joined AS X WHERE X.ObjectType = 'pagetemplate' "; categoryProvider.WhereCondition += " AND (X.PageTemplateType IS NULL OR X.PageTemplateType <> N'" + PageTemplateInfoProvider.GetPageTemplateTypeCode(PageTemplateTypeEnum.Dashboard) + "')"; if (ShowOnlySiteTemplates) { categoryProvider.WhereCondition += " AND X.ObjectID IN (SELECT PageTemplateID FROM CMS_PageTemplateSite WHERE SiteID = " + CMSContext.CurrentSiteID + ") "; } if (node != null) { categoryProvider.WhereCondition += " AND (" + PageTemplateScopeInfoProvider.GetScopeWhereCondition(path, culture, node.NodeClassName, level, CMSContext.CurrentSiteName, "X", "ObjectID") + ") "; } categoryProvider.WhereCondition += " AND (X.ObjectPath LIKE View_CMS_PageTemplateCategoryPageTemplate_Joined.ObjectPath + '/%')) IS NOT NULL)"; // Add column count column - minimal number of children categoryProvider.Columns += @", (SELECT TOP 1 Count(*) FROM View_CMS_PageTemplateCategoryPageTemplate_Joined AS Y WHERE (Y.ObjectID = View_CMS_PageTemplateCategoryPageTemplate_Joined.ObjectID AND Y.ObjectLevel = 0) OR ( View_CMS_PageTemplateCategoryPageTemplate_Joined.ObjectType = 'PageTemplateCategory' AND View_CMS_PageTemplateCategoryPageTemplate_Joined.CategoryChildCount > 0 AND Y.ObjectType = 'PageTemplate' AND Y.ObjectLevel > View_CMS_PageTemplateCategoryPageTemplate_Joined.ObjectLevel + 1 "; if (ShowOnlySiteTemplates) { categoryProvider.Columns += "AND Y.ObjectID IN (SELECT PageTemplateID FROM CMS_PageTemplateSite WHERE SiteID = " + CMSContext.CurrentSiteID + ") "; } if (node != null) { categoryProvider.Columns += " AND ( " + PageTemplateScopeInfoProvider.GetScopeWhereCondition(path, culture, node.NodeClassName, level, CMSContext.CurrentSiteName, "Y", "ObjectID") + " ) "; } categoryProvider.Columns += " AND Y.ObjectPath LIKE View_CMS_PageTemplateCategoryPageTemplate_Joined.ObjectPath + '/%')) AS MinNumberOfChilds"; categoryProvider.ChildCountColumn = "MinNumberOfChilds"; } // Handle the root path if (!String.IsNullOrEmpty(RootPath) && (RootPath != "/")) { categoryProvider.RootLevelOffset = RootPath.Split('/').Length - 1; categoryProvider.WhereCondition = SqlHelperClass.AddWhereCondition(categoryProvider.WhereCondition, String.Format("((ObjectPath = '{0}' OR ObjectPath LIKE '{0}/%'))", RootPath)); } treeElem.ProviderObject = categoryProvider; }
/// <summary> /// On PreRender. /// </summary> protected override void OnPreRender(EventArgs e) { if (StopProcessing) { return; } string where = flatElem.WhereCondition; // Show only reusable templates if (ShowOnlyReusable) { where = SqlHelperClass.AddWhereCondition(where, "PageTemplateIsReusable = 1"); } if (ShowOnlyProductSectionTemplates) { where = SqlHelperClass.AddWhereCondition(where, "PageTemplateIsAllowedForProductSection = 1"); } // Show only templates of this site if (SiteId > 0) { where = SqlHelperClass.AddWhereCondition(where, "PageTemplateID IN (SELECT PageTemplateID FROM CMS_PageTemplateSite WHERE SiteID = " + SiteId + ")"); } // Node GUID condition if (NodeGUID != Guid.Empty) { where = SqlHelperClass.AddWhereCondition(where, "PageTemplateNodeGUID = '" + NodeGUID + "' AND PageTemplateSiteID = " + SiteId, "OR"); } // Do not display dashboard items where = SqlHelperClass.AddWhereCondition(where, "PageTemplateType IS NULL OR PageTemplateType <> N'" + PageTemplateInfoProvider.GetPageTemplateTypeCode(PageTemplateTypeEnum.Dashboard) + "'"); // Restrict to items in selected category (if not root) if ((SelectedCategory != null) && (SelectedCategory.ParentId > 0)) { where = SqlHelperClass.AddWhereCondition(where, "PageTemplateCategoryID = " + SelectedCategory.CategoryId + " OR PageTemplateCategoryID IN (SELECT CategoryID FROM CMS_PageTemplateCategory WHERE CategoryPath LIKE N'" + SqlHelperClass.GetSafeQueryString(SelectedCategory.CategoryPath, false) + "/%')"); } // Add extra where condition where = SqlHelperClass.AddWhereCondition(where, WhereCondition); TreeProvider tp = new TreeProvider(CMSContext.CurrentUser); TreeNode node = DocumentHelper.GetDocument(DocumentID, tp); string culture = CMSContext.PreferredCultureCode; if (node != null) { int level = node.NodeLevel; string path = node.NodeAliasPath; if (IsNewPage) { level++; path = path + "/%"; } else { culture = node.DocumentCulture; } string className = node.NodeClassName; // Check if class id is in query string - then use it's value instead of document class name int classID = QueryHelper.GetInteger("classid", 0); if (classID != 0) { DataClassInfo dci = DataClassInfoProvider.GetDataClass(classID); if (dci != null) { className = dci.ClassName; } } // Add scopes condition string scopeWhere = PageTemplateScopeInfoProvider.GetScopeWhereCondition(path, culture, className, level, CMSContext.CurrentSiteName, "View_CMS_PageTemplateMetafile_Joined", "PageTemplateID"); where = SqlHelperClass.AddWhereCondition(where, scopeWhere); } flatElem.WhereCondition = where; // Description area litCategory.Text = ShowInDescriptionArea(SelectedItem); base.OnPreRender(e); }
/// <summary> /// Page_Load event. /// </summary> protected void Page_Load(object sender, EventArgs e) { if (this.StopProcessing) { return; } // Create and set category provider UniTreeProvider categoryProvider = new UniTreeProvider(); categoryProvider.DisplayNameColumn = "DisplayName"; categoryProvider.IDColumn = "ObjectID"; categoryProvider.LevelColumn = "ObjectLevel"; categoryProvider.OrderColumn = "CategoryOrder"; categoryProvider.ParentIDColumn = "ParentID"; categoryProvider.PathColumn = "ObjectPath"; categoryProvider.ValueColumn = "ObjectID"; categoryProvider.ChildCountColumn = "CompleteChildCount"; categoryProvider.QueryName = "cms.pagetemplatecategory.selectallview"; categoryProvider.ObjectTypeColumn = "ObjectType"; categoryProvider.Columns = "DisplayName, CodeName, ObjectID, ObjectLevel, CategoryOrder, ParentID, ObjectPath, CompleteChildCount, ObjectType, CategoryChildCount, CategoryImagePath, Parameter"; categoryProvider.ImageColumn = "CategoryImagePath"; categoryProvider.ParameterColumn = "Parameter"; if (!SelectPageTemplates) { categoryProvider.WhereCondition = "ObjectType = 'pagetemplatecategory'"; categoryProvider.ChildCountColumn = "CategoryChildCount"; categoryProvider.ObjectTypeColumn = ""; treeElem.DefaultImagePath = GetImageUrl("Objects/CMS_PageTemplateCategory/list.png"); } else { categoryProvider.OrderBy = "ObjectType DESC, DisplayName ASC"; treeElem.OnGetImage += new CMSAdminControls_UI_Trees_UniTree.GetImageEventHandler(treeElem_OnGetImage); } // Do not show AdHoc category if (!this.ShowAdHocCategory) { categoryProvider.WhereCondition = SqlHelperClass.AddWhereCondition(categoryProvider.WhereCondition, "CodeName <> 'AdHoc'"); } // Do not show empty categories if (!this.ShowEmptyCategories) { categoryProvider.WhereCondition = SqlHelperClass.AddWhereCondition(categoryProvider.WhereCondition, "CategoryTemplateChildCount > 0 OR CategoryChildCount > 0"); TreeProvider tp = new TreeProvider(CMSContext.CurrentUser); TreeNode node = DocumentHelper.GetDocument(DocumentID, tp); string culture = CMSContext.PreferredCultureCode; int level = 0; string path = string.Empty; if (node != null) { level = node.NodeLevel; path = node.NodeAliasPath; if (IsNewPage) { level++; path = path + "/%"; } else { culture = node.DocumentCulture; } } // Add where condition for scopes categoryProvider.WhereCondition += " AND (ObjectLevel = 0 OR (SELECT TOP 1 ObjectID FROM View_CMS_PageTemplateCategoryPageTemplate_Joined AS X WHERE X.ObjectType = 'pagetemplate' "; categoryProvider.WhereCondition += " AND (X.PageTemplateType IS NULL OR X.PageTemplateType <> N'" + PageTemplateInfoProvider.GetPageTemplateTypeCode(PageTemplateTypeEnum.Dashboard) + "')"; if (ShowOnlySiteTemplates) { categoryProvider.WhereCondition += " AND X.ObjectID IN (SELECT PageTemplateID FROM CMS_PageTemplateSite WHERE SiteID = " + CMSContext.CurrentSiteID + ") "; } if (node != null) { categoryProvider.WhereCondition += " AND (" + PageTemplateScopeInfoProvider.GetScopeWhereCondition(path, culture, node.NodeClassName, level, CMSContext.CurrentSiteName, "X", "ObjectID") + ") "; } categoryProvider.WhereCondition += " AND (X.ObjectPath LIKE View_CMS_PageTemplateCategoryPageTemplate_Joined.ObjectPath + '/%')) IS NOT NULL)"; // Add column count column - minimal number of childs categoryProvider.Columns += @", (SELECT TOP 1 Count(*) FROM View_CMS_PageTemplateCategoryPageTemplate_Joined AS Y WHERE (Y.ObjectID = View_CMS_PageTemplateCategoryPageTemplate_Joined.ObjectID AND Y.ObjectLevel = 0) OR ( View_CMS_PageTemplateCategoryPageTemplate_Joined.ObjectType = 'PageTemplateCategory' AND View_CMS_PageTemplateCategoryPageTemplate_Joined.CategoryChildCount > 0 AND Y.ObjectType = 'PageTemplate' AND Y.ObjectLevel > View_CMS_PageTemplateCategoryPageTemplate_Joined.ObjectLevel + 1 "; if (ShowOnlySiteTemplates) { categoryProvider.Columns += "AND Y.ObjectID IN (SELECT PageTemplateID FROM CMS_PageTemplateSite WHERE SiteID = " + CMSContext.CurrentSiteID + ") "; } if (node != null) { categoryProvider.Columns += " AND ( " + PageTemplateScopeInfoProvider.GetScopeWhereCondition(path, culture, node.NodeClassName, level, CMSContext.CurrentSiteName, "Y", "ObjectID") + " ) "; } categoryProvider.Columns += " AND Y.ObjectPath LIKE View_CMS_PageTemplateCategoryPageTemplate_Joined.ObjectPath + '/%')) AS MinNumberOfChilds"; categoryProvider.ChildCountColumn = "MinNumberOfChilds"; } // Set up tree treeElem.ProviderObject = categoryProvider; if (SelectPageTemplates) { treeElem.NodeTemplate = "<span id=\"##OBJECTTYPE##_##NODEID##\" onclick=\"SelectNode(##NODEID##,'##OBJECTTYPE##', ##PARENTNODEID##, '##PARAMETER##');\" name=\"treeNode\" class=\"ContentTreeItem\">##ICON## <span class=\"Name\">##NODENAME##</span></span>"; treeElem.SelectedNodeTemplate = "<span id=\"##OBJECTTYPE##_##NODEID##\" onclick=\"SelectNode(##NODEID##,'##OBJECTTYPE##', ##PARENTNODEID##, '##PARAMETER##');\" name=\"treeNode\" class=\"ContentTreeItem ContentTreeSelectedItem\">##ICON## <span class=\"Name\">##NODENAME##</span></span>"; } else { treeElem.NodeTemplate = "<span onclick=\"SelectNode(##NODEID##, this);\" class=\"ContentTreeItem\">##ICON## <span class=\"Name\">##NODENAME##</span></span>"; treeElem.DefaultItemTemplate = "<span onclick=\"SelectNode('recentlyused', this);\" class=\"ContentTreeItem\">##ICON##<span class=\"Name\">##NODENAME##</span></span><div style=\"clear:both\"></div>"; treeElem.SelectedDefaultItemTemplate = "<span onclick=\"SelectNode('recentlyused', this);\" class=\"ContentTreeItem ContentTreeSelectedItem\">##ICON##<span class=\"Name\">##NODENAME##</span></span><div style=\"clear:both\"></div>"; treeElem.SelectedNodeTemplate = "<span onclick=\"SelectNode(##NODEID##, this);\" class=\"ContentTreeItem ContentTreeSelectedItem\">##ICON## <span class=\"Name\">##NODENAME##</span></span>"; // Register jquery ScriptHelper.RegisterJQuery(this.Page); string js = "function SelectNode(nodeid, sender){ " + "var selectedItem = $j('.ContentTreeSelectedItem'); " + "selectedItem.removeClass('ContentTreeSelectedItem'); " + "selectedItem.addClass('ContentTreeItem');" + "selectedItem = $j(sender);" + "selectedItem.removeClass('ContentTreeItem'); " + "selectedItem.addClass('ContentTreeSelectedItem'); " + "document.getElementById('" + this.treeElem.SelectedItemFieldId + "').value = nodeid;" + treeElem.GetOnSelectedItemBackEventReference() + "}"; ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "SelectTreeNode", ScriptHelper.GetScript(js)); } // Setup event handler treeElem.OnItemSelected += new CMSAdminControls_UI_Trees_UniTree.ItemSelectedEventHandler(treeElem_OnItemSelected); treeElem.OnNodeCreated += new CMSAdminControls_UI_Trees_UniTree.NodeCreatedEventHandler(treeElem_OnNodeCreated); }
/// <summary> /// On PreRender. /// </summary> protected override void OnPreRender(EventArgs e) { if (StopProcessing) { return; } string where = flatElem.WhereCondition; // Show only reusable templates if (ShowOnlyReusable) { where = SqlHelper.AddWhereCondition(where, "PageTemplateIsReusable = 1"); } if (ShowOnlyProductSectionTemplates) { where = SqlHelper.AddWhereCondition(where, "PageTemplateIsAllowedForProductSection = 1"); } // Show only templates of this site if (SiteId > 0) { where = SqlHelper.AddWhereCondition(where, "PageTemplateID IN (SELECT PageTemplateID FROM CMS_PageTemplateSite WHERE SiteID = " + SiteId + ")"); } // Node GUID condition if (NodeGUID != Guid.Empty) { where = SqlHelper.AddWhereCondition(where, "PageTemplateNodeGUID = '" + NodeGUID + "' AND PageTemplateSiteID = " + SiteId, "OR"); } // Do not display dashboard items where = SqlHelper.AddWhereCondition(where, "PageTemplateType IS NULL OR PageTemplateType <> N'" + PageTemplateInfoProvider.GetPageTemplateTypeCode(PageTemplateTypeEnum.Dashboard) + "'"); // Restrict to items in selected category (if not root) - For multiple roots filter items for every root if ((SelectedCategory != null) && ((SelectedCategory.ParentId > 0) || MultipleRoots)) { string cat = SqlHelper.EscapeLikeText(SqlHelper.EscapeQuotes(SelectedCategory.CategoryPath)); if (!cat.EndsWith("/", StringComparison.Ordinal)) { cat += "/"; } cat += "%"; where = SqlHelper.AddWhereCondition(where, "PageTemplateCategoryID = " + SelectedCategory.CategoryId + " OR PageTemplateCategoryID IN (SELECT CategoryID FROM CMS_PageTemplateCategory WHERE CategoryPath LIKE N'" + cat + "')"); } // Add extra where condition where = SqlHelper.AddWhereCondition(where, WhereCondition); TreeProvider tp = new TreeProvider(MembershipContext.AuthenticatedUser); TreeNode node = DocumentHelper.GetDocument(DocumentID, tp); string culture = LocalizationContext.PreferredCultureCode; if (node != null) { int level = node.NodeLevel; string path = node.NodeAliasPath; if (IsNewPage) { level++; path = path + "/%"; } else { culture = node.DocumentCulture; } string className = node.NodeClassName; // Check if class id is in query string - then use it's value instead of document class name int classID = QueryHelper.GetInteger("classid", 0); if (classID != 0) { DataClassInfo dci = DataClassInfoProvider.GetDataClassInfo(classID); if (dci != null) { className = dci.ClassName; } } // Add scopes condition string scopeWhere = PageTemplateScopeInfoProvider.GetScopeWhereCondition(path, culture, className, level, SiteContext.CurrentSiteName, "PageTemplateID"); where = SqlHelper.AddWhereCondition(where, scopeWhere); } flatElem.WhereCondition = where; // Description area ltrDescription.Text = ShowInDescriptionArea(SelectedItem); base.OnPreRender(e); }