private void LoadDisplayTabDropDown() { ddlDisplayTabId.Items.Clear(); var modules = new[] { Utility.DnnFriendlyModuleName }; //we're going to get all pages no matter if they have a Publish module on them or not. We'll only highlight Overrideable ones later //if (chkForceDisplayTab.Checked) //{ // //if the ForceDisplayTab is checked we need to make sure we get ALL publish modules, not just overrideable ones // dt = Utility.GetDisplayTabIdsAll(modules); //} //else //{ // dt = Utility.GetDisplayTabIds(modules); // if (dt.Rows.Count < 1) // { // //if there are no items in the list, meaning there are no modules set to be overrideable, then get the list of all Publish pages. // dt = Utility.GetDisplayTabIdsAll(modules); // } //} DataTable dt = Utility.GetDisplayTabIds(modules); //this.ddlDisplayTabId.Items.Insert(0, new ListItem(Localization.GetString("ChooseOne", LocalResourceFile), "-1")); ddlDisplayTabId.DataSource = TabController.GetPortalTabs(PortalId, 0, false, true); ddlDisplayTabId.DataBind(); foreach (DataRow dr in dt.Rows) { if (ddlDisplayTabId.Items.FindByValue(dr["TabID"].ToString()) != null) { ddlDisplayTabId.Items.FindByValue(dr["TabID"].ToString()).Text += Localization.GetString("PublishOverrideable", LocalSharedResourceFile); } // ListItem li = new ListItem(dr["TabName"] + " (" + dr["TabID"] + ")", dr["TabID"].ToString()); // this.ddlDisplayTabId.Items.Add(li); } //check if the DisplayTabId should be set. var av = (Article)VersionInfoObject; if (!VersionInfoObject.IsNew) { ListItem li = ddlDisplayTabId.Items.FindByValue(av.DisplayTabId.ToString(CultureInfo.InvariantCulture)); if (li != null) { ddlDisplayTabId.ClearSelection(); li.Selected = true; } else { //if we made it here we've hit an article who is pointing to a page that is no longer overrideable, set the default page. if (DefaultDisplayTabId > 0) { li = ddlDisplayTabId.Items.FindByValue(DefaultDisplayTabId.ToString(CultureInfo.InvariantCulture)); if (li != null) { ddlDisplayTabId.ClearSelection(); li.Selected = true; } } } } else { Category parent = null; if (ParentId != -1) { parent = Category.GetCategory(ParentId, PortalId); } //look for display tab id if (parent != null && parent.ChildDisplayTabId > 0) { if (ddlDisplayTabId.Items.FindByValue(parent.ChildDisplayTabId.ToString(CultureInfo.InvariantCulture)) != null) { ddlDisplayTabId.SelectedIndex = -1; ddlDisplayTabId.Items.FindByValue(parent.ChildDisplayTabId.ToString(CultureInfo.InvariantCulture)).Selected = true; } } else { //load the default display tab ListItem li = ddlDisplayTabId.Items.FindByValue(DefaultDisplayTabId.ToString(CultureInfo.InvariantCulture)); if (li != null) { ddlDisplayTabId.ClearSelection(); li.Selected = true; } } } }
private void LoadCategoryDisplayTabDropDown() { ddlDisplayTabId.Items.Clear(); var modules = new[] { Utility.DnnFriendlyModuleName }; //ListItem l = new ListItem(Localization.GetString("ChooseOne", LocalResourceFile), "-1"); //this.ddlDisplayTabId.Items.Insert(0, l); //foreach (DataRow dr in dt.Rows) //{ // ListItem li = new ListItem(dr["TabName"] + " (" + dr["TabID"] + ")", dr["TabID"].ToString()); // this.ddlDisplayTabId.Items.Add(li); //} DataTable dt = Utility.GetDisplayTabIds(modules); //this.ddlDisplayTabId.Items.Insert(0, new ListItem(Localization.GetString("ChooseOne", LocalResourceFile), "-1")); //ddlDisplayTabId.DataSource = Globals.GetPortalTabs(PortalSettings.DesktopTabs, false, true); ddlDisplayTabId.DataSource = TabController.GetPortalTabs(PortalId, 0, false, true); ddlDisplayTabId.DataBind(); foreach (DataRow dr in dt.Rows) { if (ddlDisplayTabId.Items.FindByValue(dr["TabID"].ToString()) != null) { ddlDisplayTabId.Items.FindByValue(dr["TabID"].ToString()).Text += Localization.GetString("PublishOverrideable", LocalSharedResourceFile); } // ListItem li = new ListItem(dr["TabName"] + " (" + dr["TabID"] + ")", dr["TabID"].ToString()); // this.ddlDisplayTabId.Items.Add(li); } if (!VersionInfoObject.IsNew) { ListItem li = ddlDisplayTabId.Items.FindByValue(VersionInfoObject.DisplayTabId.ToString(CultureInfo.InvariantCulture)); if (li != null) { ddlDisplayTabId.ClearSelection(); li.Selected = true; } } else { Category parent = null; if (ParentId != -1) { parent = Category.GetCategory(ParentId, PortalId); parentCategoryRelationships.AddToSelectedItems(parent); } //look for display tab id if (parent != null && parent.ChildDisplayTabId > 0) { if (ddlDisplayTabId.Items.FindByValue(parent.ChildDisplayTabId.ToString(CultureInfo.InvariantCulture)) != null) { ddlDisplayTabId.SelectedIndex = -1; ddlDisplayTabId.Items.FindByValue(parent.ChildDisplayTabId.ToString(CultureInfo.InvariantCulture)).Selected = true; } } else { //load the default display tab ListItem li = ddlDisplayTabId.Items.FindByValue(DefaultDisplayTabId.ToString(CultureInfo.InvariantCulture)); if (li != null) { ddlDisplayTabId.ClearSelection(); li.Selected = true; } } } }