protected void Page_Load(object sender, EventArgs e) { if (!StopProcessing && !URLHelper.IsPostback()) { int shift = -1; string where = String.Empty; if (ModuleID != 0) { where = "ElementResourceID = " + ModuleID; } if (!String.IsNullOrEmpty(WhereCondition)) { where = SqlHelper.AddWhereCondition(where, WhereCondition); } // Get the data DataSet ds = UIElementInfoProvider.GetUIElements(where, "ElementOrder", 0, "ElementID, ElementParentID, ElementDisplayName, ElementOrder, ElementLevel"); if (!DataHelper.DataSourceIsEmpty(ds)) { gds = new GroupedDataSource(ds, "ElementParentID"); FillDropDownList(shift, 0); } } }
/// <summary> /// DataBinds the control. /// </summary> public void ReloadData() { DisabledItems = string.Empty; this.drpCategories.Items.Clear(); int shift = -1; string where = string.Empty; if (DisplayOnlyCategories) { // Only categories that are not marked as groups will be displayed where += "ISNULL([CategoryIsGroup], 0) = 0"; } if (!string.IsNullOrEmpty(WhereCondition)) { // Append additional WHERE condition where += " AND " + WhereCondition; } // Add root category item if needed if (this.IncludeRootCategory) { SettingsCategoryInfo rootCat = SettingsCategoryInfoProvider.GetSettingsCategoryInfo(this.RootCategoryId); if (rootCat != null) { ListItem item = new ListItem(); item.Text = GetPrefix(shift) + ResHelper.LocalizeString(rootCat.CategoryDisplayName); item.Value = this.RootCategoryId.ToString(); this.drpCategories.Items.Add(item); DisableItemInKeyEdit(item, rootCat.CategoryIsGroup); // Increase indent shift++; } } DataSet ds = SettingsCategoryInfoProvider.GetSettingsCategories(where, "CategoryOrder", 0, "CategoryID, CategoryParentID, CategoryName, CategoryDisplayName, CategoryOrder, CategoryIsGroup"); if (!DataHelper.DataSourceIsEmpty(ds)) { this.groupedDS = new GroupedDataSource(ds, "CategoryParentID"); FillDropDownList(shift, this.RootCategoryId); } }
/// <summary> /// Setup application list. /// </summary> private void SetupAppList() { DataSet ds = ApplicationUIHelper.LoadApplications(); DataSet filteredDataSet = ApplicationUIHelper.FilterApplications(ds, CurrentUser, true); if ((filteredDataSet != null) && !DataHelper.DataSourceIsEmpty(filteredDataSet)) { // Create grouped data source GroupedDataSource gds = new GroupedDataSource(filteredDataSet, "ElementParentID", "ElementLevel"); appListUniview.DataSource = gds; appListUniview.ReloadData(true); } SiteInfo si = SiteContext.CurrentSite; if ((si != null) && (!si.SiteIsOffline)) { SetupLiveSiteLink(); } }
/// <summary> /// Reloads data. /// </summary> public void ReloadData(bool force) { if (!dataLoaded || force) { DisabledItems = string.Empty; disabledCats = new Hashtable(); int shift = 0; drpCategories.Items.Clear(); string where = GetWhereCondition(); if (AddNoneRecord) { ListItem item = new ListItem(GetString("general.root"), "0"); drpCategories.Items.Add(item); } // Get the data DataSet ds = CategoryInfoProvider.GetCategories(where, "CategoryUserID, CategorySiteID, CategoryOrder", 0, "CategoryID, CategoryParentID, CategoryDisplayName, CategoryOrder, CategoryLevel, CategorySiteID, CategoryEnabled", SiteID); if (!DataHelper.DataSourceIsEmpty(ds)) { gds = new GroupedDataSource(ds, "CategoryParentID"); FillDropDownList(shift, 0); } // Ensure selected category if (CategoryID != mCategoryId) { CategoryID = mCategoryId; } dataLoaded = true; } }
public override void ReloadData() { // Hide control for one culture version if ((DataSource == null) || DataHelper.DataSourceIsEmpty(SiteCultures) || (SiteCultures.Tables[0].Rows.Count <= 1)) { Visible = false; } else { // Check the data source if (!(DataSource is GroupedDataSource)) { throw new Exception("[DocumentFlags]: Only GroupedDataSource is supported as a data source."); } // Register tooltip script ScriptHelper.RegisterTooltip(Page); // Get appropriate table from the data source GroupedDataSource gDS = (GroupedDataSource)DataSource; DataTable table = gDS.GetGroupDataTable(NodeID); // Get document in the default site culture DateTime defaultLastModification = DateTimeHelper.ZERO_TIME; DateTime defaultLastPublished = DateTimeHelper.ZERO_TIME; bool defaultCultureExists = false; DataRow[] rows = null; if (table != null) { rows = table.Select("DocumentCulture='" + DefaultSiteCulture + "'"); defaultCultureExists = (rows.Length > 0); } if (defaultCultureExists) { defaultLastModification = ValidationHelper.GetDateTime(rows[0]["DocumentModifiedWhen"], DateTimeHelper.ZERO_TIME); defaultLastPublished = ValidationHelper.GetDateTime(rows[0]["DocumentLastPublished"], DateTimeHelper.ZERO_TIME); } // Build the content StringBuilder sb = new StringBuilder(); sb.Append("<table cellpadding=\"1\" cellspacing=\"0\" class=\"DocumentFlags\">\n<tr>\n"); int colsInRow = 0; int cols = 0; int colsCount = SiteCultures.Tables[0].Rows.Count; if (colsCount < RepeatColumns) { RepeatColumns = colsCount; } foreach (DataRow dr in SiteCultures.Tables[0].Rows) { ++cols; ++colsInRow; DateTime lastModification = DateTimeHelper.ZERO_TIME; string versionNumber = null; TranslationStatusEnum status = TranslationStatusEnum.NotAvailable; string cultureName = ValidationHelper.GetString(DataHelper.GetDataRowValue(dr, "CultureName"), "-"); string cultureCode = ValidationHelper.GetString(DataHelper.GetDataRowValue(dr, "CultureCode"), "-"); // Get document for given culture if (table != null) { rows = table.Select("DocumentCulture='" + cultureCode + "'"); // Document doesn't exist if (rows.Length != 0) { versionNumber = ValidationHelper.GetString(DataHelper.GetDataRowValue(rows[0], "VersionNumber"), null); // Check if document is outdated if (versionNumber != null) { lastModification = ValidationHelper.GetDateTime(rows[0]["DocumentLastPublished"], DateTimeHelper.ZERO_TIME); status = (lastModification < defaultLastPublished) ? TranslationStatusEnum.Outdated : TranslationStatusEnum.Translated; } else { lastModification = ValidationHelper.GetDateTime(rows[0]["DocumentModifiedWhen"], DateTimeHelper.ZERO_TIME); status = (lastModification < defaultLastModification) ? TranslationStatusEnum.Outdated : TranslationStatusEnum.Translated; } } } sb.Append("<td class=\"", GetStatusCSSClass(status), "\">"); sb.Append("<img onmouseout=\"UnTip()\" style=\"cursor:pointer;\" onclick=\"", SelectJSFunction, "('", NodeID, "','", cultureCode, "'," + Convert.ToInt32((status != TranslationStatusEnum.NotAvailable)) + "," + ScriptHelper.GetString(ItemUrl + "?" + URLHelper.LanguageParameterName + "=" + cultureCode) + ")\" onmouseover=\"DF_Tip('", GetFlagIconUrl(cultureCode, "48x48"), "', '", cultureName, "', '", GetStatusString(status), "', '"); sb.Append(versionNumber ?? string.Empty); sb.Append("', '"); TimeZoneInfo ti = null; sb.Append((lastModification != DateTimeHelper.ZERO_TIME) ? TimeZoneHelper.GetCurrentTimeZoneDateTimeString(lastModification, CMSContext.CurrentUser, CMSContext.CurrentSite, out ti) : string.Empty); sb.Append("')\" src=\""); sb.Append(GetFlagIconUrl(cultureCode, "16x16")); sb.Append("\" alt=\""); sb.Append(cultureName); sb.Append("\" /></td>\n"); // Ensure repeat columns if (((colsInRow % RepeatColumns) == 0) && (cols != colsCount)) { sb.Append("</tr><tr>\n"); colsInRow = 0; } } // Ensure rest of the table cells if ((colsInRow != RepeatColumns) && (colsInRow != 0)) { while (colsInRow < RepeatColumns) { sb.Append("<td> </td>\n"); ++colsInRow; } } sb.Append("</tr>\n</table>\n"); ltlFlags.Text = sb.ToString(); } }
/// <summary> /// Setup application list. /// </summary> private void SetupAppList() { DataSet ds = ApplicationHelper.LoadApplications(); DataSet filteredDataSet = ApplicationHelper.FilterApplications(ds, CurrentUser, true); if ((filteredDataSet != null) && !DataHelper.DataSourceIsEmpty(filteredDataSet)) { // Create grouped data source GroupedDataSource gds = new GroupedDataSource(filteredDataSet, "ElementParentID", "ElementLevel"); appListUniview.DataSource = gds; appListUniview.ReloadData(true); } SiteInfo si = SiteContext.CurrentSite; if ((si != null) && (!si.SiteIsOffline)) { SetupLiveSiteLink(); } }
protected void Page_Load(object sender, EventArgs e) { if (!StopProcessing && !URLHelper.IsPostback()) { int shift = -1; string where = String.Empty; if (ModuleID != 0) { where = "ElementResourceID = " + ModuleID; } if (!String.IsNullOrEmpty(WhereCondition)) { where = SqlHelper.AddWhereCondition(where, WhereCondition); } // Get the data DataSet ds = UIElementInfoProvider.GetUIElements(where, "ElementOrder", 0, "ElementID, ElementParentID, ElementDisplayName, ElementOrder, ElementLevel"); if (!DataHelper.DataSourceIsEmpty(ds)) { gds = new GroupedDataSource(ds, "ElementParentID"); FillDropDownList(shift, 0); } } }
/// <summary> /// OnPreRender. /// </summary> protected override void OnPreRender(EventArgs e) { gridDocuments.StopProcessing = StopProcessing; if (StopProcessing) { return; } if (!dataLoaded) { gridDocuments.ReloadData(); } // Hide column with languages if only one culture is assigned to the site if (DataHelper.DataSourceIsEmpty(SiteCultures) || (SiteCultures.Tables[0].Rows.Count <= 1)) { // Hide column with flags if (gridDocuments.NamedColumns.ContainsKey("documentculture")) { gridDocuments.NamedColumns["documentculture"].Visible = false; } // Hide language filter if (gridDocuments.FilterFields.ContainsKey("NodeID")) { gridDocuments.FilterFields["NodeID"].FilterRow.Visible = false; } } else { if (FlagsControls.Count != 0) { // Get all document node IDs string nodeIds = null; foreach (DocumentFlagsControl ucDocFlags in FlagsControls) { nodeIds += ucDocFlags.NodeID + ","; } if (nodeIds != null) { nodeIds = nodeIds.TrimEnd(','); } // Get all documents Tree.SelectQueryName = "SelectVersions"; string columns = "NodeID, VersionNumber, DocumentCulture, DocumentModifiedWhen, DocumentLastPublished"; if (checkPermissions) { columns = SqlHelperClass.MergeColumns(columns, TreeProvider.SECURITYCHECK_REQUIRED_COLUMNS); } DataSet dsDocs = null; if (!checkPermissions || (CMSContext.CurrentUser.IsAuthorizedPerDocument(Node, NodePermissionsEnum.Read) == AuthorizationResultEnum.Allowed)) { dsDocs = Tree.SelectNodes(currentSiteName, "/%", TreeProvider.ALL_CULTURES, false, null, "NodeID IN (" + nodeIds + ")", null, -1, false, 0, columns); } // Check permissions if (checkPermissions) { dsDocs = TreeSecurityProvider.FilterDataSetByPermissions(dsDocs, NodePermissionsEnum.Read, currentUserInfo); } if (!DataHelper.DataSourceIsEmpty(dsDocs)) { GroupedDataSource gDSDocs = new GroupedDataSource(dsDocs, "NodeID"); // Initialize the document flags controls foreach (DocumentFlagsControl ucDocFlags in FlagsControls) { ucDocFlags.DataSource = gDSDocs; ucDocFlags.ReloadData(); } } } } base.OnPreRender(e); }
/// <summary> /// Reloads data. /// </summary> public void ReloadData(bool force) { if (!dataLoaded || force) { DisabledItems = string.Empty; disabledCats = new Hashtable(); int shift = 0; this.drpCategories.Items.Clear(); string where = GetWhereCondition(); if (AddNoneRecord) { ListItem item = new ListItem(GetString("general.root"), "0"); this.drpCategories.Items.Add(item); } // Get the data DataSet ds = CategoryInfoProvider.GetCategories(where, "CategoryUserID, CategorySiteID, CategoryOrder", 0, "CategoryID, CategoryParentID, CategoryDisplayName, CategoryOrder, CategoryLevel, CategorySiteID, CategoryEnabled", SiteID); if (!DataHelper.DataSourceIsEmpty(ds)) { gds = new GroupedDataSource(ds, "CategoryParentID"); FillDropDownList(shift, 0); } // Ensure selected category if (CategoryID != mCategoryId) { CategoryID = mCategoryId; } dataLoaded = true; } }
/// <summary> /// OnPreRender. /// </summary> protected override void OnPreRender(EventArgs e) { gridDocuments.StopProcessing = StopProcessing; if (StopProcessing) { return; } if (!dataLoaded) { gridDocuments.ReloadData(); } string order = null; CurrentWhereCondition = GetCompleteWhereCondition(gridDocuments.WhereClause, ref order).ToString(true); // Hide column with languages if only one culture is assigned to the site if (DataHelper.DataSourceIsEmpty(SiteCultures) || (SiteCultures.Tables[0].Rows.Count <= 1)) { // Hide column with flags if (gridDocuments.NamedColumns.ContainsKey("documentculture")) { gridDocuments.NamedColumns["documentculture"].Visible = false; } // Hide language filter gridDocuments.FilterForm.FieldsToHide.Add("DocumentCulture"); } else { if (FlagsControls.Count != 0) { // Get all document node IDs HashSet <int> nodeIds = new HashSet <int>(); foreach (DocumentFlagsControl ucDocFlags in FlagsControls) { nodeIds.Add(ucDocFlags.NodeID); } var condition = new WhereCondition(); condition.WhereIn("NodeID", nodeIds); // Get all culture documents DataSet docs = Tree.SelectNodes(currentSiteName, "/%", TreeProvider.ALL_CULTURES, false, null, condition.ToString(true), null, -1, false, 0, "NodeID, DocumentLastVersionNumber, DocumentCulture, DocumentModifiedWhen, DocumentLastPublished"); if (!DataHelper.DataSourceIsEmpty(docs)) { var groupedDocs = new GroupedDataSource(docs, "NodeID"); // Initialize the document flags controls foreach (var docFlagCtrl in FlagsControls) { docFlagCtrl.DataSource = groupedDocs; docFlagCtrl.ReloadData(); } } } } base.OnPreRender(e); }
/// <summary> /// OnPreRender. /// </summary> protected override void OnPreRender(EventArgs e) { gridDocuments.StopProcessing = StopProcessing; if (StopProcessing) { return; } // Get actual filter where condition string filterWhere = gridDocuments.FilterForm.GetWhereCondition(); // Filter selected document type only if ((ClassID > 0) && !RequestHelper.IsCallback()) { CurrentWhereCondition = SqlHelper.AddWhereCondition(filterWhere, "NodeClassID = " + ClassID); } else { CurrentWhereCondition = filterWhere; } if (!dataLoaded) { if ((gridDocuments.FilterForm.FieldControls != null) && (gridDocuments.FilterForm.FieldControls.Count > 0)) { // Set actual where condition from basic filter if exists gridDocuments.WhereClause = filterWhere; } gridDocuments.ReloadData(); } // Hide column with languages if only one culture is assigned to the site if (DataHelper.DataSourceIsEmpty(SiteCultures) || (SiteCultures.Tables[0].Rows.Count <= 1)) { // Hide column with flags if (gridDocuments.NamedColumns.ContainsKey("documentculture")) { gridDocuments.NamedColumns["documentculture"].Visible = false; } // Hide language filter gridDocuments.FilterForm.FieldsToHide.Add("DocumentCulture"); } else { if (FlagsControls.Count != 0) { // Get all document node IDs string nodeIds = null; foreach (DocumentFlagsControl ucDocFlags in FlagsControls) { nodeIds += ucDocFlags.NodeID + ","; } if (nodeIds != null) { nodeIds = nodeIds.TrimEnd(','); } // Get all culture documents Tree.SelectQueryName = "SelectVersions"; DataSet dsDocs = Tree.SelectNodes(currentSiteName, "/%", TreeProvider.ALL_CULTURES, false, null, "NodeID IN (" + nodeIds + ")", null, -1, false, 0, "NodeID, VersionNumber, DocumentCulture, DocumentModifiedWhen, DocumentLastPublished"); if (!DataHelper.DataSourceIsEmpty(dsDocs)) { GroupedDataSource gDSDocs = new GroupedDataSource(dsDocs, "NodeID"); // Initialize the document flags controls foreach (DocumentFlagsControl ucDocFlags in FlagsControls) { ucDocFlags.DataSource = gDSDocs; ucDocFlags.ReloadData(); } } } } base.OnPreRender(e); }
/// <summary> /// OnPreRender. /// </summary> protected override void OnPreRender(EventArgs e) { if (!dataLoaded) { gridDocuments.ReloadData(); } // Hide column with languages if only one culture is assigned to the site if (DataHelper.DataSourceIsEmpty(SiteCultures) || (SiteCultures.Tables[0].Rows.Count <= 1)) { DataControlField languagesColumn = gridDocuments.GridView.Columns[7]; languagesColumn.Visible = false; plcLang.Visible = false; } else { if (FlagsControls.Count != 0) { // Get all document node IDs string nodeIds = null; foreach (DocumentFlagsControl ucDocFlags in FlagsControls) { nodeIds += ucDocFlags.NodeID + ","; } if (nodeIds != null) { nodeIds = nodeIds.TrimEnd(','); } // Get all documents tree.SelectQueryName = "SelectVersions"; string columns = "NodeID, VersionNumber, DocumentCulture, DocumentModifiedWhen, DocumentLastPublished"; if (checkPermissions) { columns = SqlHelperClass.MergeColumns(columns, TreeProvider.SECURITYCHECK_REQUIRED_COLUMNS); } DataSet dsDocs = null; if (!checkPermissions || (CMSContext.CurrentUser.IsAuthorizedPerDocument(node, NodePermissionsEnum.Read) == AuthorizationResultEnum.Allowed)) { dsDocs = tree.SelectNodes(currentSiteName, "/%", TreeProvider.ALL_CULTURES, false, null, "NodeID IN (" + nodeIds + ")", null, -1, false, 0, columns); } // Check permissions if (checkPermissions) { dsDocs = TreeSecurityProvider.FilterDataSetByPermissions(dsDocs, NodePermissionsEnum.Read, currentUserInfo); } if (!DataHelper.DataSourceIsEmpty(dsDocs)) { GroupedDataSource gDSDocs = new GroupedDataSource(dsDocs, "NodeID"); // Initialize the document flags controls foreach (DocumentFlagsControl ucDocFlags in FlagsControls) { ucDocFlags.DataSource = gDSDocs; ucDocFlags.ReloadData(); } } } } base.OnPreRender(e); }
public override void ReloadData() { // Hide control for one culture version if ((DataSource == null) || DataHelper.DataSourceIsEmpty(SiteCultures) || (SiteCultures.Tables[0].Rows.Count <= 1)) { Visible = false; } else { // Check the data source if (!(DataSource is GroupedDataSource)) { throw new Exception("[DocumentFlags]: Only GroupedDataSource is supported as a data source."); } // Register tooltip script ScriptHelper.RegisterTooltip(Page); // Get appropriate table from the data source GroupedDataSource gDS = (GroupedDataSource)DataSource; DataTable table = gDS.GetGroupDataTable(NodeID); // Get document in the default site culture DateTime defaultLastModification = DateTimeHelper.ZERO_TIME; DateTime defaultLastPublished = DateTimeHelper.ZERO_TIME; bool defaultCultureExists = false; DataRow[] rows = null; if (table != null) { rows = table.Select("DocumentCulture='" + DefaultSiteCulture + "'"); defaultCultureExists = (rows.Length > 0); } if (defaultCultureExists) { defaultLastModification = ValidationHelper.GetDateTime(rows[0]["DocumentModifiedWhen"], DateTimeHelper.ZERO_TIME); defaultLastPublished = ValidationHelper.GetDateTime(rows[0]["DocumentLastPublished"], DateTimeHelper.ZERO_TIME); } // Build the content StringBuilder sb = new StringBuilder(); sb.Append("<div class=\"document-flags\">"); int colsInRow = 0; int cols = 0; int colsCount = SiteCultures.Tables[0].Rows.Count; if (colsCount < RepeatColumns) { RepeatColumns = colsCount; } foreach (DataRow dr in SiteCultures.Tables[0].Rows) { ++cols; ++colsInRow; DateTime lastModification = DateTimeHelper.ZERO_TIME; string versionNumber = null; string className = null; TranslationStatusEnum status = TranslationStatusEnum.NotAvailable; string cultureName = DataHelper.GetStringValue(dr, "CultureName", "-"); string cultureCode = DataHelper.GetStringValue(dr, "CultureCode", "-"); // Get document for given culture if (table != null) { rows = table.Select("DocumentCulture='" + cultureCode + "'"); // Document doesn't exist if (rows.Length != 0) { className = DataHelper.GetStringValue(rows[0], "ClassName", null); versionNumber = DataHelper.GetStringValue(rows[0], "DocumentLastVersionNumber", null); // Check if document is outdated if (versionNumber != null) { lastModification = ValidationHelper.GetDateTime(rows[0]["DocumentLastPublished"], DateTimeHelper.ZERO_TIME); status = (lastModification < defaultLastPublished) ? TranslationStatusEnum.Outdated : TranslationStatusEnum.Translated; } else { lastModification = ValidationHelper.GetDateTime(rows[0]["DocumentModifiedWhen"], DateTimeHelper.ZERO_TIME); status = (lastModification < defaultLastModification) ? TranslationStatusEnum.Outdated : TranslationStatusEnum.Translated; } } } sb.Append("<span class=\"", GetStatusCSSClass(status), "\">"); var itemUrl = (className != null && DataClassInfoProvider.GetDataClassInfo(className).ClassHasURL) ? UrlResolver.ResolveUrl(DocumentUIHelper.GetPageHandlerLivePath(NodeID, cultureCode)) : "#"; sb.Append("<img onmouseout=\"UnTip()\" style=\"cursor:pointer;\" onclick=\"", SelectJSFunction, "('", NodeID, "','", cultureCode, "'," + Convert.ToInt32((status != TranslationStatusEnum.NotAvailable)) + "," + ScriptHelper.GetString(itemUrl) + ")\" onmouseover=\"DF_Tip('", GetFlagIconUrl(cultureCode, "48x48"), "', '", cultureName, "', '", GetStatusString(status), "', '"); sb.Append(versionNumber ?? string.Empty); sb.Append("', '"); sb.Append((lastModification != DateTimeHelper.ZERO_TIME) ? TimeZoneHelper.ConvertToUserTimeZone(lastModification, true, MembershipContext.AuthenticatedUser, SiteContext.CurrentSite) : string.Empty); sb.Append("')\" src=\""); sb.Append(GetFlagIconUrl(cultureCode, "16x16")); sb.Append("\" alt=\""); sb.Append(cultureName); sb.Append("\" /></span>"); // Ensure repeat columns if (((colsInRow % RepeatColumns) == 0) && (cols != colsCount)) { sb.Append("<br />\n"); colsInRow = 0; } } sb.Append("</div>\n"); ltlFlags.Text = sb.ToString(); } }
/// <summary> /// OnPreRender. /// </summary> protected override void OnPreRender(EventArgs e) { gridDocuments.StopProcessing = StopProcessing; if (StopProcessing) { return; } // Get actual filter where condition string filterWhere = gridDocuments.FilterForm.GetWhereCondition(); // Filter selected document type only if ((ClassID > 0) && !RequestHelper.IsCallback()) { CurrentWhereCondition = SqlHelper.AddWhereCondition(filterWhere, "NodeClassID = " + ClassID); } else { CurrentWhereCondition = filterWhere; } if (!dataLoaded) { if ((gridDocuments.FilterForm.FieldControls != null) && (gridDocuments.FilterForm.FieldControls.Count > 0)) { // Set actual where condition from basic filter if exists gridDocuments.WhereClause = filterWhere; } gridDocuments.ReloadData(); } // Hide column with languages if only one culture is assigned to the site if (DataHelper.DataSourceIsEmpty(SiteCultures) || (SiteCultures.Tables[0].Rows.Count <= 1)) { // Hide column with flags if (gridDocuments.NamedColumns.ContainsKey("documentculture")) { gridDocuments.NamedColumns["documentculture"].Visible = false; } // Hide language filter gridDocuments.FilterForm.FieldsToHide.Add("DocumentCulture"); } else { if (FlagsControls.Count != 0) { // Get all document node IDs string nodeIds = null; foreach (DocumentFlagsControl ucDocFlags in FlagsControls) { nodeIds += ucDocFlags.NodeID + ","; } if (nodeIds != null) { nodeIds = nodeIds.TrimEnd(','); } // Get all culture documents Tree.SelectQueryName = "SelectVersions"; DataSet dsDocs = Tree.SelectNodes(currentSiteName, "/%", TreeProvider.ALL_CULTURES, false, null, "NodeID IN (" + nodeIds + ")", null, -1, false, 0, "NodeID, VersionNumber, DocumentCulture, DocumentModifiedWhen, DocumentLastPublished"); if (!DataHelper.DataSourceIsEmpty(dsDocs)) { GroupedDataSource gDSDocs = new GroupedDataSource(dsDocs, "NodeID"); // Initialize the document flags controls foreach (DocumentFlagsControl ucDocFlags in FlagsControls) { ucDocFlags.DataSource = gDSDocs; ucDocFlags.ReloadData(); } } } } base.OnPreRender(e); }
/// <summary> /// DataBinds the control. /// </summary> public void ReloadData() { DisabledItems = string.Empty; drpCategories.Items.Clear(); int shift = -1; string where = string.Empty; if (DisplayOnlyCategories) { // Only categories that are not marked as groups will be displayed where += "ISNULL([CategoryIsGroup], 0) = 0"; } if (!string.IsNullOrEmpty(WhereCondition)) { // Append additional WHERE condition where += " AND " + WhereCondition; } // Add root category item if needed if (IncludeRootCategory) { SettingsCategoryInfo rootCat = SettingsCategoryInfoProvider.GetSettingsCategoryInfo(RootCategoryId); if (rootCat != null) { ListItem item = new ListItem(); item.Text = GetPrefix(shift) + ResHelper.LocalizeString(rootCat.CategoryDisplayName); item.Value = RootCategoryId.ToString(); drpCategories.Items.Add(item); DisableItemInKeyEdit(item, rootCat.CategoryIsGroup); // Increase indent shift++; } } DataSet ds = SettingsCategoryInfoProvider.GetSettingsCategories(where, "CategoryOrder", 0, "CategoryID, CategoryParentID, CategoryName, CategoryDisplayName, CategoryOrder, CategoryIsGroup"); if (!DataHelper.DataSourceIsEmpty(ds)) { groupedDS = new GroupedDataSource(ds, "CategoryParentID"); FillDropDownList(shift, RootCategoryId); } }