private void BindGroups() { ArrayList arrGroups = RoleController.GetRoleGroups(PortalId); if (arrGroups.Count > 0) { cboRoleGroups.Items.Clear(); //cboRoleGroups.Items.Add(new ListItem(Localization.GetString("AllRoles"), "-2")); cboRoleGroups.AddItem(Localization.GetString("AllRoles"), "-2"); var item = new DnnComboBoxItem(Localization.GetString("GlobalRoles"), "-1"); if (_roleGroupId == -1) { item.Selected = true; } cboRoleGroups.Items.Add(item); foreach (RoleGroupInfo roleGroup in arrGroups) { item = new DnnComboBoxItem(roleGroup.RoleGroupName, roleGroup.RoleGroupID.ToString(CultureInfo.InvariantCulture)); if (_roleGroupId == roleGroup.RoleGroupID) { item.Selected = true; } cboRoleGroups.Items.Add(item); } divGroups.Visible = true; } else { _roleGroupId = -2; divGroups.Visible = false; } BindData(); }
private void BuildDropDownModulesList(IEnumerable <ModuleInfo> modulesList, bool isFiltred) { TabController tc = new TabController(); ModuleController mc = new ModuleController(); cbModulesList.Items.Clear(); int totnbc = 0; int cnt = 0; var modulesListfull = mc.GetModules(PortalId).Cast <ModuleInfo>(); foreach (ModuleInfo moduleInfo in modulesList) { int nbc = GetNbOfClone(modulesListfull, moduleInfo.ModuleID); totnbc += nbc; //ListItem li = new ListItem(); DnnComboBoxItem li = new DnnComboBoxItem(); li.Text = string.Format("({0}) - ModuleID : {1} - Title : {2} - Page : {3} ({4}) - Pane : {5} - IsDelete : {6} - All Tabs : {7}", nbc, moduleInfo.ModuleID, moduleInfo.ModuleTitle, tc.GetTab(moduleInfo.TabID, moduleInfo.PortalID, true).LocalizedTabName, moduleInfo.TabID, moduleInfo.PaneName, moduleInfo.IsDeleted, moduleInfo.AllTabs); //li.Text = "(" + nbc + ") - TabModuleID :" + moduleInfo.TabModuleID + " - ModuleID : " + moduleInfo.ModuleID + " - ModuleDefID : " + moduleInfo.ModuleDefID + " - FriendlyName : " + moduleInfo.DesktopModule.FriendlyName + " - Title : " + moduleInfo.ModuleTitle + " - Page : " + tc.GetTab(moduleInfo.TabID, moduleInfo.PortalID, true).LocalizedTabName + "(" + moduleInfo.TabID + ") - Pane : " + moduleInfo.PaneName + " - IsDelete : " + moduleInfo.IsDeleted + " - All Tabs : " + moduleInfo.AllTabs; li.Value = string.Format("{0}|{1}", moduleInfo.ModuleID, moduleInfo.TabID); cbModulesList.Items.Add(li); cnt++; } int c = modulesList.Count(); if (isFiltred) { lblNbTotal.Text = totnbc.ToString(); } else { lblNbTotal.Text = c.ToString(); } //DropDownList1.Items.Cast<DropDownList>().Reverse(); //061113 var portalController = new PortalController(); var portalInfo = portalController.GetPortal(PortalId); BindTree(portalInfo); //061113 }
private void AddFiles(string root, string filter) { string[] files = Directory.GetFiles(Request.MapPath(Globals.ApplicationPath + "/" + root), filter); foreach (string strFile in files) { string file = root.Replace('\\', '/') + "/" + Path.GetFileName(strFile); var item = new DnnComboBoxItem(file, file.ToLower()); if (ModuleControl != null && item.Value.Equals(ModuleControl.ControlSrc.ToLower())) { item.Selected = true; } cboSource.Items.Add(item); } }
private void BindLanguagesList() { if (ShowSwitchLanguagesPanel()) { foreach (var lang in LoadLanguagesList()) { var item = new DnnComboBoxItem(lang[0], lang[1]); if (lang[2] == "true") { item.Selected = true; } controlBar_SwitchLanguage.Items.Add(item); } } }
private void BindLanguagesList() { if (this.ShowSwitchLanguagesPanel()) { const string FlagImageUrlFormatString = "~/images/Flags/{0}.gif"; foreach (var lang in this.LoadLanguagesList()) { var item = new DnnComboBoxItem(lang[0], lang[1]); item.ImageUrl = string.Format(FlagImageUrlFormatString, item.Value); if (lang[2] == "true") { item.Selected = true; } this.controlBar_SwitchLanguage.Items.Add(item); } } }
private void LoadModuleFolders(string selectedValue) { cboModule.Items.Clear(); var arrFolders = Directory.GetDirectories(Globals.ApplicationMapPath + "\\DesktopModules\\" + cboOwner.SelectedValue); foreach (var strFolder in arrFolders) { var path = strFolder.Replace(Path.GetDirectoryName(strFolder) + "\\", ""); var item = new DnnComboBoxItem(path, path); if (item.Value == selectedValue) { item.Selected = true; } cboModule.Items.Add(item); } //cboModule.Items.Insert(0, new ListItem("<" + Localization.GetString("Not_Specified", Localization.SharedResourceFile) + ">", "")); cboModule.InsertItem(0, "<" + Localization.GetString("Not_Specified", Localization.SharedResourceFile) + ">", ""); }
private void LoadModuleFolders(string selectedValue) { cboModule.Items.Clear(); var moduleFolders = GetModulesFolders(); foreach (var moduleFolder in moduleFolders) { var path = GetPathForComboBox(moduleFolder); var item = new DnnComboBoxItem(path, path); if (item.Value == selectedValue) { item.Selected = true; } cboModule.Items.Add(item); } //cboModule.Items.Insert(0, new ListItem("<" + Localization.GetString("Not_Specified", Localization.SharedResourceFile) + ">", "")); cboModule.InsertItem(0, "<" + Localization.GetString("Not_Specified", Localization.SharedResourceFile) + ">", ""); }
private void LoadTemplateList() { TemplateLst.ClearSelection(); TemplateLst.Items.Clear(); //Get Templates Folder ArrayList templateFiles = Globals.GetFileList(PortalSettings.PortalId, "page.template", false, "Templates/"); foreach (FileItem dnnFile in templateFiles) { var item = new DnnComboBoxItem(dnnFile.Text.Replace(".page.template", ""), dnnFile.Value); TemplateLst.Items.Add(item); if (item.Text == "Default") { item.Selected = true; } } TemplateLst.InsertItem(0, GetString("NoTemplate"), ""); }
private DnnComboBoxItem AddSearchItem(string name) { var propertyName = Null.NullString; if (Request.QueryString["filterProperty"] != null) { propertyName = Request.QueryString["filterProperty"]; } var text = Localization.GetString(name, LocalResourceFile); if (String.IsNullOrEmpty(text)) { text = name; } var item = new DnnComboBoxItem(text, name); if (name == propertyName) { item.Selected = true; } return(item); }
public void BindTerm(Term term, IEnumerable <Term> terms, bool isHeirarchical, bool loadFromControl, bool editEnabled) { //nameValidator.Text = Services.Localization.Localization.GetString("TermName.Required", SharedResourceFile); if (loadFromControl) { term.Name = nameTextBox.Text; term.Description = descriptionTextBox.Text; if (isHeirarchical && !string.IsNullOrEmpty(parentTermCombo.SelectedValue)) { term.ParentTermId = Int32.Parse(parentTermCombo.SelectedValue); } } else { nameTextBox.Text = term.Name; nameTextBox.Attributes.Add("data-termid", term.TermId.ToString()); nameTextBox.Attributes.Add("data-vocabularyid", term.VocabularyId.ToString()); descriptionTextBox.Text = term.Description; //Remove this term (and its descendants) from the collection, so we don't get wierd heirarchies var termsList = (from t in terms where !(t.Left >= term.Left && t.Right <= term.Right) select t).ToList(); parentTermCombo.Items.Clear(); foreach (var t in termsList) { var item = new DnnComboBoxItem(t.Name, t.TermId.ToString()); if (term.ParentTermId.HasValue && term.ParentTermId == t.TermId) { item.Selected = true; } parentTermCombo.Items.Add(item); } divParentTerm.Visible = isHeirarchical && termsList.Count > 0; nameTextBox.Enabled = editEnabled; descriptionTextBox.Enabled = editEnabled; parentTermCombo.Enabled = editEnabled; } }
private void LoadOwnerFolders(string selectedValue) { cboOwner.Items.Clear(); var arrFolders = Directory.GetDirectories(Globals.ApplicationMapPath + "\\DesktopModules\\"); foreach (var strFolder in arrFolders) { var files = Directory.GetFiles(strFolder, "*.ascx"); //exclude module folders if (files.Length == 0 || strFolder.ToLower() == "admin") { var path = strFolder.Replace(Path.GetDirectoryName(strFolder) + "\\", ""); var item = new DnnComboBoxItem(path, path); if (item.Value == selectedValue) { item.Selected = true; } cboOwner.Items.Add(item); } } //cboOwner.Items.Insert(0, new ListItem("<" + Localization.GetString("Not_Specified", Localization.SharedResourceFile) + ">", "")); cboOwner.InsertItem(0, "<" + Localization.GetString("Not_Specified", Localization.SharedResourceFile) + ">", ""); }
private void LoadOwnerFolders(string selectedValue) { cboOwner.Items.Clear(); var arrFolders = GetRootModuleDefinitionFolders(); foreach (var folder in arrFolders) { var files = Directory.GetFiles(folder.Path, "*.ascx"); //exclude module folders if (files.Length == 0 || folder.Path.ToLower() == "admin") { var path = GetPathForComboBox(folder); var item = new DnnComboBoxItem(path, path); if (item.Value == selectedValue) { item.Selected = true; } cboOwner.Items.Add(item); } } //cboOwner.Items.Insert(0, new ListItem("<" + Localization.GetString("Not_Specified", Localization.SharedResourceFile) + ">", "")); cboOwner.InsertItem(0, "<" + Localization.GetString("Not_Specified", Localization.SharedResourceFile) + ">", ""); }
private void BindSourceFolders() { IList <string> controlfolders = GetSubdirectories(Request.MapPath(Globals.ApplicationPath + "/DesktopModules")); controlfolders.Insert(0, Request.MapPath(Globals.ApplicationPath + "/Admin/Skins")); var currentControlFolder = ModuleControl != null?Path.GetDirectoryName(ModuleControl.ControlSrc.ToLower()).Replace('\\', '/') : string.Empty; foreach (var folder in controlfolders) { var moduleControls = Directory.EnumerateFiles(folder, "*.*", SearchOption.TopDirectoryOnly).Count(s => s.EndsWith(".ascx") || s.EndsWith(".cshtml") || s.EndsWith(".vbhtml") || s.EndsWith(".html") || s.EndsWith(".htm")); if (moduleControls > 0) { var shortFolder = folder.Substring(Request.MapPath(Globals.ApplicationPath).Length + 1).Replace('\\', '/'); var item = new DnnComboBoxItem(shortFolder, shortFolder.ToLower()); if (item.Value.Equals(currentControlFolder)) { item.Selected = true; } cboSourceFolder.Items.Add(item); } } }
/// ----------------------------------------------------------------------------- /// <summary> /// Page_Load runs when the control is loaded /// </summary> /// ----------------------------------------------------------------------------- private void Page_Load(object sender, System.EventArgs e) { try { if (ViewState[VIEWSTATE_FILTER] != null) { string filter = ViewState[VIEWSTATE_FILTER].ToString(); } if (Settings[MyModule.Settings.SETTING_SHOW_HELP] != null) { bool showHelp = Convert.ToBoolean(Settings[MyModule.Settings.SETTING_SHOW_HELP]); PlaceHolder1.Visible = showHelp; PlaceHolder2.Visible = showHelp; } if (!IsPostBack) { ViewState[VIEWSTATE_FILTER] = string.Format("{0}|{1}", FILTER_PRE, FILTER_ALL_MODULES); try { //custom code ModuleController mc = new ModuleController(); var modulesList = mc.GetModules(PortalId).Cast <ModuleInfo>(); var modulesListFull = mc.GetModules(PortalId).Cast <ModuleInfo>(); BuildDropDownModulesList(modulesList, false); //build the list of Panes var panesList = mc.GetModules(PortalId).Cast <ModuleInfo>().GroupBy(i => new { i.PaneName }).Select(g => g.First()); //ListItem sp = new ListItem(); DnnComboBoxItem sp = new DnnComboBoxItem(); sp.Text = "Select a Pane"; sp.Value = SELECT_PANE_VALUE; cbPanesList.Items.Add(sp); foreach (ModuleInfo moduleInfo in panesList) { //ListItem p = new ListItem(); DnnComboBoxItem p = new DnnComboBoxItem(); p.Text = moduleInfo.PaneName; p.Value = moduleInfo.PaneName; cbPanesList.Items.Add(p); } //build the list of Titles var titlesList = mc.GetModules(PortalId).Cast <ModuleInfo>().GroupBy(i => new { i.ModuleTitle }).Select(g => g.First()); //ListItem st = new ListItem(); DnnComboBoxItem st = new DnnComboBoxItem(); st.Text = "Select a Title"; st.Value = SELECT_TITLE_VALUE; cbTitlesList.Items.Add(st); foreach (ModuleInfo moduleInfo in titlesList) { //ListItem t = new ListItem(); DnnComboBoxItem t = new DnnComboBoxItem(); t.Text = moduleInfo.ModuleTitle; t.Value = moduleInfo.ModuleTitle; cbTitlesList.Items.Add(t); } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
public override void LoadSettings() { try { if ((Page.IsPostBack == false)) { if (!String.IsNullOrEmpty(Convert.ToString(Settings["LinkTarget"]))) { comboBoxLinkTarget.SelectedValue = Convert.ToString(Settings["LinkTarget"]); } if (!string.IsNullOrEmpty(Convert.ToString(Settings["ScopeForPortals"]))) { var list = Convert.ToString(Settings["ScopeForPortals"]).Split('|').ToList(); var portalList = LoadPortalsList().ToList(); if (portalList.Any()) { foreach (var portal in portalList) { var item = new DnnComboBoxItem(portal[0], portal[1]) { Checked = list.Contains(portal[1]) }; comboBoxPortals.Items.Add(item); } } else { divPortalGroup.Visible = false; } } else { var portalList = LoadPortalsList().ToList(); if (portalList.Any()) { foreach (var portal in portalList) { var item = new DnnComboBoxItem(portal[0], portal[1]) { Checked = PortalId.ToString() == portal[1] }; comboBoxPortals.Items.Add(item); } } else { divPortalGroup.Visible = false; } } if (!string.IsNullOrEmpty(Convert.ToString(Settings["ScopeForFilters"]))) { var list = Convert.ToString(Settings["ScopeForFilters"]).Split('|').ToList(); var filterList = LoadSeachContentSourcesList(); foreach (var filter in filterList) { var item = new DnnComboBoxItem(filter, filter) { Checked = list.Contains(filter) }; comboBoxFilters.Items.Add(item); } } else { var filterList = LoadSeachContentSourcesList(); foreach (var filter in filterList) { var item = new DnnComboBoxItem(filter, filter) { Checked = true }; comboBoxFilters.Items.Add(item); } } if (!string.IsNullOrEmpty(Convert.ToString(Settings["EnableWildSearch"]))) { var enableWildSearch = Convert.ToBoolean(Settings["EnableWildSearch"]); chkEnableWildSearch.Checked = enableWildSearch; } else { chkEnableWildSearch.Checked = true; } } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
private void BindDetailData() { var pc = new PortalController(); cboLogTypePortalID.DataTextField = "PortalName"; cboLogTypePortalID.DataValueField = "PortalID"; cboLogTypePortalID.DataSource = pc.GetPortals(); cboLogTypePortalID.DataBind(); // ReSharper disable LocalizableElement var i = new DnnComboBoxItem { Text = Localization.GetString("All"), Value = "*" }; // ReSharper restore LocalizableElement cboLogTypePortalID.Items.Insert(0, i); pnlEditLogTypeConfigInfo.Visible = true; pnlLogTypeConfigInfo.Visible = false; var logController = new LogController(); var arrLogTypeInfo = logController.GetLogTypeInfoDictionary().Values.OrderBy(t => t.LogTypeFriendlyName); cboLogTypeKey.DataTextField = "LogTypeFriendlyName"; cboLogTypeKey.DataValueField = "LogTypeKey"; cboLogTypeKey.DataSource = arrLogTypeInfo; cboLogTypeKey.DataBind(); int[] items = { 1, 2, 3, 4, 5, 10, 25, 100, 250, 500 }; cboKeepMostRecent.Items.Clear(); cboKeepMostRecent.Items.Add(new DnnComboBoxItem(Localization.GetString("All"), "*")); foreach (int item in items) { cboKeepMostRecent.Items.Add(item == 1 ? new DnnComboBoxItem(item + Localization.GetString("LogEntry", LocalResourceFile), item.ToString(CultureInfo.InvariantCulture)) : new DnnComboBoxItem(item + Localization.GetString("LogEntries", LocalResourceFile), item.ToString(CultureInfo.InvariantCulture))); } int[] items2 = { 1, 2, 3, 4, 5, 10, 25, 100, 250, 500, 1000 }; cboThreshold.Items.Clear(); foreach (int item in items2) { cboThreshold.Items.Add(item == 1 ? new DnnComboBoxItem(item + Localization.GetString("Occurence", LocalResourceFile), item.ToString(CultureInfo.InvariantCulture)) : new DnnComboBoxItem(item + Localization.GetString("Occurences", LocalResourceFile), item.ToString(CultureInfo.InvariantCulture))); } cboThresholdNotificationTime.Items.Clear(); foreach (int item in new [] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 60, 90, 120 }) { cboThresholdNotificationTime.Items.Add(new DnnComboBoxItem(item.ToString(CultureInfo.InvariantCulture), item.ToString(CultureInfo.InvariantCulture))); } cboThresholdNotificationTimeType.Items.Clear(); foreach (int item in new[] { 1, 2, 3, 4 }) { cboThresholdNotificationTimeType.Items.Add(new DnnComboBoxItem(Localization.GetString(string.Format("TimeType_{0}", item), LocalResourceFile), item.ToString(CultureInfo.InvariantCulture))); } // ReSharper disable LocalizableElement var j = new DnnComboBoxItem { Text = Localization.GetString("All"), Value = "*" }; // ReSharper restore LocalizableElement cboLogTypeKey.Items.Insert(0, j); }