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 LoadSiteList() { // Is there more than one site in this group? var multipleSites = GetCurrentPortalsGroup().Count() > 1; var list = new List <ListItem>(); list.Add(new ListItem { Text = GetString("SelectSite.Text"), Value = "" }); if (multipleSites) { var portals = GetCurrentPortalsGroup(); foreach (var portal in portals) { var item = new ListItem() { Text = portal.PortalName, Value = portal.PortalID.ToString() }; list.Add(item); } } else { var item = new ListItem() { Text = PortalSettings.PortalName, Value = PortalSettings.PortalId.ToString() }; list.Add(item); } foreach (var item in list) { var comboItem = new DotNetNuke.Web.UI.WebControls.DnnComboBoxItem(); comboItem.Text = item.Text; comboItem.Value = item.Value; SiteList.Items.Add(comboItem); } }
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.Equals(propertyName, StringComparison.InvariantCultureIgnoreCase)) { item.Selected = true; } return item; }
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.Text); //TemplateLst.Items.Add(item); TemplateLst.Items.Add(item); if (item.Text == "Default") { item.Selected = true; } } //TemplateLst.Items.Insert(0, new ListItem(GetString("NoTemplate"), "")); TemplateLst.InsertItem(0, GetString("NoTemplate"), ""); }
private void BindDetailData() { cboLogTypePortalID.DataTextField = "PortalName"; cboLogTypePortalID.DataValueField = "PortalID"; cboLogTypePortalID.DataSource = PortalController.Instance.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 arrLogTypeInfo = LogController.Instance.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); }
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")); 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); } } }
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 BindDesktopModules() { var dicModules = DesktopModuleController.GetDesktopModules(Null.NullInteger); var dicPortalDesktopModules = DesktopModuleController.GetPortalDesktopModulesByPortalID(_portalId); ctlDesktopModules.Items.Clear(); foreach (var objDicModule in dicModules.Values) { DnnComboBoxItem comboBoxItem = new DnnComboBoxItem(objDicModule.ModuleName, objDicModule.DesktopModuleID.ToString()); foreach (var objPortalDesktopModule in dicPortalDesktopModules.Values) { if (objPortalDesktopModule.DesktopModuleID == objDicModule.DesktopModuleID) { comboBoxItem.Checked = true; break; } } ctlDesktopModules.Items.Add(comboBoxItem); } //foreach (var objPortalDesktopModule in dicPortalDesktopModules.Values) //{ // dicModules.Remove(objPortalDesktopModule.DesktopModuleID); //} //ctlDesktopModules.AvailableDataSource = dicModules.Values; //ctlDesktopModules.SelectedDataSource = dicPortalDesktopModules.Values; }
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 BindLanguagesList() { if (ShowSwitchLanguagesPanel()) { const string FlagImageUrlFormatString = "~/images/Flags/{0}.gif"; foreach (var lang in LoadLanguagesList()) { var item = new DnnComboBoxItem(lang[0], lang[1]); item.ImageUrl = string.Format(FlagImageUrlFormatString, item.Value); if (lang[2] == "true") { item.Selected = true; } controlBar_SwitchLanguage.Items.Add(item); } } }
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 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 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 LoadSiteList() { // Is there more than one site in this group? var multipleSites = GetCurrentPortalsGroup().Count() > 1; var list = new List<ListItem>(); list.Add(new ListItem { Text = GetString("SelectSite.Text"), Value = "" }); if(multipleSites) { var portals = GetCurrentPortalsGroup(); foreach (var portal in portals) { var item = new ListItem() { Text = portal.PortalName, Value = portal.PortalID.ToString() }; list.Add(item); } } else { var item = new ListItem() {Text = PortalSettings.PortalName, Value = PortalSettings.PortalId.ToString()}; list.Add(item); } foreach(var item in list) { var comboItem = new DotNetNuke.Web.UI.WebControls.DnnComboBoxItem(); comboItem.Text = item.Text; comboItem.Value = item.Value; SiteList.Items.Add(comboItem); } }
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 BindDesktopModules() { var dicModules = DesktopModuleController.GetDesktopModules(Null.NullInteger); var dicPortalDesktopModules = DesktopModuleController.GetPortalDesktopModulesByPortalID(_portalId); ctlDesktopModules.Items.Clear(); foreach (var objDicModule in dicModules.Values) { DnnComboBoxItem comboBoxItem = new DnnComboBoxItem(objDicModule.FriendlyName, objDicModule.DesktopModuleID.ToString()); foreach (var objPortalDesktopModule in dicPortalDesktopModules.Values) { if (objPortalDesktopModule.DesktopModuleID == objDicModule.DesktopModuleID) { comboBoxItem.Checked = true; break; } } ctlDesktopModules.Items.Add(comboBoxItem); } }