public void setAlarmType() { ListController listController = new ListController(); IEnumerable<ListEntryInfo> listEntryInfoCol = null; //AlarmType //listEntryInfoCol = listController.GetListEntryInfoItems("AlarmRuleSet.AlarmType"); listEntryInfoCol = ListsTextLocalizedByListName("AlarmRuleSet.AlarmType"); string strAlarmType = ""; int i = 0; int icount = listEntryInfoCol.Count(); foreach (ListEntryInfo item in listEntryInfoCol) { i += 1; strAlarmType += item.EntryID.ToString() + ":"; //strAlarmType += item.SortOrder.ToString() + " " + item.Text; if (i == icount) { strAlarmType += item.SortOrder.ToString() + " " + item.Text; //strAlarmType += ":" + item.EntryID.ToString(); } else { strAlarmType += item.SortOrder.ToString() + " " + item.Text + ";"; //strAlarmType += ":" + item.EntryID.ToString() + ";"; } } hidAlarmType.Value = strAlarmType; }
public HttpResponseMessage Search(string q) { var portalId = PortalController.GetEffectivePortalId(PortalSettings.PortalId); var controller = new ListController(); ListEntryInfo imageType = controller.GetListEntryInfo("DataType", "Image"); IList<SearchResult> results = new List<SearchResult>(); foreach (var definition in ProfileController.GetPropertyDefinitionsByPortal(portalId) .Cast<ProfilePropertyDefinition>() .Where(definition => definition.DataType != imageType.EntryID)) { AddProperty(results, definition.PropertyName, q); } AddProperty(results, "Email", q); AddProperty(results, "DisplayName", q); AddProperty(results, "Username", q); AddProperty(results, "Password", q); AddProperty(results, "PasswordConfirm", q); AddProperty(results, "PasswordQuestion", q); AddProperty(results, "PasswordAnswer", q); return Request.CreateResponse(HttpStatusCode.OK, results.OrderBy(sr => sr.id)); }
/// <Summary>CreateEditor creates the control collection.</Summary> protected override void CreateEditor() { CategoryDataField = "PropertyCategory"; EditorDataField = "DataType"; NameDataField = "PropertyName"; RequiredDataField = "Required"; ValidationExpressionDataField = "ValidationExpression"; ValueDataField = "PropertyValue"; VisibleDataField = "Visible"; VisibilityDataField = "Visibility"; LengthDataField = "Length"; base.CreateEditor(); //We need to wire up the RegionControl to the CountryControl foreach( FieldEditorControl editor in Fields ) { if( editor.Editor is DNNRegionEditControl ) { ListEntryInfo country = null; foreach( FieldEditorControl checkEditor in Fields ) { if( checkEditor.Editor is DNNCountryEditControl ) { DNNCountryEditControl countryEdit = (DNNCountryEditControl)checkEditor.Editor; ListController objListController = new ListController(); ListEntryInfoCollection countries = objListController.GetListEntryInfoCollection( "Country" ); foreach( ListEntryInfo checkCountry in countries ) { if( checkCountry.Text == countryEdit.Value.ToString() ) { country = checkCountry; break; } } } } //Create a ListAttribute for the Region string countryKey; if( country != null ) { countryKey = "Country." + country.Value; } else { countryKey = "Country.Unknown"; } object[] attributes; attributes = new object[1]; attributes[0] = new ListAttribute( "Region", countryKey, ListBoundField.Text, ListBoundField.Text ); editor.Editor.CustomAttributes = attributes; } } }
private IEnumerable<ListEntryInfo> ListsTextLocalizedByListName(string listname) { ListController listcontroller = new ListController(); IEnumerable<ListEntryInfo> listEntryInfoCol = null; listEntryInfoCol = listcontroller.GetListEntryInfoItems(listname); foreach (ListEntryInfo li in listEntryInfoCol) { li.Text = Localization.GetString(li.Text, "~/App_GlobalResources/List_" + listname + "." + (Page as DotNetNuke.Framework.PageBase).PageCulture.Name + ".resx"); } return listEntryInfoCol; }
private static string DisplayDataType(ProfilePropertyDefinition definition) { string cacheKey = string.Format("DisplayDataType:{0}", definition.DataType); string strDataType = Convert.ToString(DataCache.GetCache(cacheKey)) + ""; if (strDataType == string.Empty) { var objListController = new ListController(); strDataType = objListController.GetListEntryInfo(definition.DataType).Value; DataCache.SetCache(cacheKey, strDataType); } return strDataType; }
public void WhenIFillInTheProfilePropertyForm(TechTalk.SpecFlow.Table table) { ProfilePropertiesPage.PropertyNameField.Value = table.Rows[0]["Value"]; ListEntryInfo dataType = new ListController().GetListEntryInfo("DataType", table.Rows[1]["Value"]); ProfilePropertiesPage.DataTypeSelectList.SelectByValue(dataType.EntryID.ToString(CultureInfo.InvariantCulture)); ProfilePropertiesPage.PropertyCategoryField.Value = table.Rows[2]["Value"]; ProfilePropertiesPage.LengthTextField.Value = table.Rows[3]["Value"]; ProfilePropertiesPage.RequiredCheckBox.Checked = Boolean.Parse(table.Rows[4]["Value"]); ProfilePropertiesPage.VisibleCheckBox.Checked = Boolean.Parse(table.Rows[5]["Value"]); ProfilePropertiesPage.ReadOnlyCheckBox.Checked = Boolean.Parse(table.Rows[6]["Value"]); }
public string DisplayDataType(AttributeDefinition definition) { string retValue = Null.NullString; ListController objListController = new ListController(); ListEntryInfo definitionEntry = objListController.GetListEntryInfo(definition.DataType); if ((definitionEntry != null)) { retValue = definitionEntry.Value; } return retValue; }
private void BindTree() { var ctlLists = new ListController(); var colLists = ctlLists.GetListInfoCollection(string.Empty, string.Empty, PortalSettings.ActiveTab.PortalID); var indexLookup = new Hashtable(); listTree.Nodes.Clear(); foreach (ListInfo list in colLists) { String filteredNode; if (list.DisplayName.Contains(":")) { var finalPeriod = list.DisplayName.LastIndexOf(".", StringComparison.InvariantCulture); filteredNode = list.DisplayName.Substring(finalPeriod + 1); } else { filteredNode = list.DisplayName; } var node = new DnnTreeNode { Text = filteredNode }; { node.Value = list.Key; node.ToolTip = String.Format(LocalizeString("NoEntries"), list.EntryCount); node.ImageUrl = IconController.IconURL("Folder"); } if (list.Level == 0) { listTree.Nodes.Add(node); } else { if (indexLookup[list.ParentList] != null) { var parentNode = (DnnTreeNode) indexLookup[list.ParentList]; parentNode.Nodes.Add(node); } } //Add index key here to find it later, should suggest with Joe to add it to DNNTree if (indexLookup[list.Key] == null) { indexLookup.Add(list.Key, node); } } }
/// ----------------------------------------------------------------------------- /// <summary> /// The GetDependency method instantiates (and returns) the relevant Dependency /// </summary> /// <param name="dependencyNav">The manifest (XPathNavigator) for the dependency</param> /// ----------------------------------------------------------------------------- public static IDependency GetDependency(XPathNavigator dependencyNav) { IDependency dependency = null; string dependencyType = Util.ReadAttribute(dependencyNav, "type"); switch (dependencyType.ToLowerInvariant()) { case "coreversion": dependency = new CoreVersionDependency(); break; case "package": dependency = new PackageDependency(); break; case "managedpackage": dependency = new ManagedPackageDependency(); break; case "permission": dependency = new PermissionsDependency(); break; case "type": dependency = new TypeDependency(); break; default: //Dependency type is defined in the List var listController = new ListController(); ListEntryInfo entry = listController.GetListEntryInfo("Dependency", dependencyType); if (entry != null && !string.IsNullOrEmpty(entry.Text)) { //The class for the Installer is specified in the Text property dependency = (DependencyBase)Reflection.CreateObject(entry.Text, "Dependency_" + entry.Value); } break; } if (dependency == null) { //Could not create dependency, show generic error message dependency = new InvalidDependency(Util.INSTALL_Dependencies); } //Read Manifest dependency.ReadManifest(dependencyNav); return dependency; }
public bool FoundBannedPassword(string inputString) { const string listName = "BannedPasswords"; var listController = new ListController(); PortalSettings settings = PortalController.GetCurrentPortalSettings(); IEnumerable<ListEntryInfo> listEntryHostInfos = listController.GetListEntryInfoItems(listName, "", Null.NullInteger); IEnumerable<ListEntryInfo> listEntryPortalInfos = listController.GetListEntryInfoItems(listName + "-" + settings.PortalId, "", settings.PortalId); IEnumerable<ListEntryInfo> query2 = listEntryHostInfos.Where(test => test.Text == inputString); IEnumerable<ListEntryInfo> query3 = listEntryPortalInfos.Where(test => test.Text == inputString); if (query2.Any() || query3.Any()) { return true; } return false; }
private void BindTree() { var ctlLists = new ListController(); var colLists = ctlLists.GetListInfoCollection(string.Empty, string.Empty, PortalSettings.ActiveTab.PortalID); var indexLookup = new Hashtable(); listTree.Nodes.Clear(); foreach (ListInfo list in colLists) { var node = new DnnTreeNode { Text = list.DisplayName.Replace(list.ParentList + ".", "") }; { node.Value = list.Key; node.ToolTip = String.Format(LocalizeString("NoEntries"), list.EntryCount); node.ImageUrl = IconController.IconURL("Folder"); } if (list.Level == 0) { listTree.Nodes.Add(node); } else { if (indexLookup[list.ParentList] != null) { var parentNode = (DnnTreeNode)indexLookup[list.ParentList]; parentNode.Nodes.Add(node); } } //Add index key here to find it later, should suggest with Joe to add it to DNNTree if (indexLookup[list.Key] == null) { indexLookup.Add(list.Key, node); } } }
public ActionResult Search(string q) { try { var portalId = PortalController.GetEffectivePortalId(PortalSettings.PortalId); var controller = new ListController(); var textType = controller.GetListEntryInfo("DataType", "Text"); var regionType = controller.GetListEntryInfo("DataType", "Region"); var countryType = controller.GetListEntryInfo("DataType", "Country"); IList<SearchResult> results = new List<SearchResult>(); foreach (var definition in ProfileController.GetPropertyDefinitionsByPortal(portalId) .Cast<ProfilePropertyDefinition>() .Where(definition => definition.DataType == textType.EntryID || definition.DataType == regionType.EntryID || definition.DataType == countryType.EntryID)) { AddProperty(results, definition.PropertyName, q); } AddProperty(results, "Email", q); AddProperty(results, "DisplayName", q); AddProperty(results, "Username", q); AddProperty(results, "Password", q); AddProperty(results, "PasswordConfirm", q); AddProperty(results, "PasswordQuestion", q); AddProperty(results, "PasswordAnswer", q); return Json(results.OrderBy(sr => sr.id), JsonRequestBehavior.AllowGet); } catch (Exception exc) { DnnLog.Error(exc); return Json(null, JsonRequestBehavior.AllowGet); } }
// Another method, get Lists on demand public object Item(string key, bool Cache) { int index; object obj = null; bool itemExists = false; try //Do validation first { if (mKeyIndexLookup[key.ToLowerInvariant()] != null) { itemExists = true; } } catch (Exception exc) { Logger.Error(exc); } //key will be in format Country.US:Region if (!itemExists) { var ctlLists = new ListController(); string listName = key.Substring(key.IndexOf(":") + 1); string parentKey = key.Replace(listName, "").TrimEnd(':'); ListInfo listInfo = ctlLists.GetListInfo(listName, parentKey); //the collection has been cache, so add this entry list into it if specified if (Cache) { Add(listInfo.Key, listInfo); return(listInfo); } } else { index = Convert.ToInt32(mKeyIndexLookup[key.ToLowerInvariant()]); obj = base.List[index]; } return(obj); }
void OnItemChanged(object sender, PropertyEditorEventArgs e) { var regionContainer = ControlUtilities.FindControl<Control>(Parent, "Region", true); if (regionContainer != null) { var regionControl = ControlUtilities.FindFirstDescendent<DNNRegionEditControl>(regionContainer); if (regionControl != null) { var listController = new ListController(); var countries = listController.GetListEntryInfoItems("Country"); foreach (var checkCountry in countries) { if (checkCountry.Text == e.StringValue) { var attributes = new object[1]; attributes[0] = new ListAttribute("Region", "Country." + checkCountry.Value, ListBoundField.Text, ListBoundField.Text); regionControl.CustomAttributes = attributes; break; } } } } }
/// ----------------------------------------------------------------------------- /// <summary> /// Loads top level entry list into DNNTree /// </summary> /// <remarks> /// </remarks> /// <history> /// [tamttt] 20/10/2004 Created /// </history> /// ----------------------------------------------------------------------------- private void BindTree() { var ctlLists = new ListController(); var colLists = ctlLists.GetListInfoCollection(string.Empty, string.Empty, PortalSettings.ActiveTab.PortalID); var indexLookup = new Hashtable(); DNNtree.TreeNodes.Clear(); foreach (ListInfo list in colLists) { var node = new TreeNode(list.DisplayName); { node.Key = list.Key; node.ToolTip = list.EntryCount + " entries"; node.ImageIndex = (int)eImageType.Folder; } if (list.Level == 0) { DNNtree.TreeNodes.Add(node); } else { if (indexLookup[list.ParentList] != null) { var parentNode = (TreeNode)indexLookup[list.ParentList]; parentNode.TreeNodes.Add(node); } } //Add index key here to find it later, should suggest with Joe to add it to DNNTree if (indexLookup[list.Key] == null) { indexLookup.Add(list.Key, node); } } }
/// <summary> /// Loads top level entry list into DNNTree /// </summary> /// <history> /// [tamttt] 20/10/2004 Created /// </history> private void BindTree() { ListController ctlLists = new ListController(); ListInfoCollection colLists = ctlLists.GetListInfoCollection(); Hashtable indexLookup = new Hashtable(); DNNtree.TreeNodes.Clear(); foreach (ListInfo Lists in colLists) { TreeNode node = new TreeNode(Lists.DisplayName); node.Key = Lists.Key; node.ToolTip = Lists.EntryCount + " entries"; node.ImageIndex = (int)eImageType.Folder; //.Target = Lists.DefinitionID.ToString & ":" & Lists.EnableSortOrder.ToString ' borrow this property to store this value if (Lists.Level == 0) { DNNtree.TreeNodes.Add(node); } else { if (indexLookup[Lists.ParentList] != null) { TreeNode parentNode = (TreeNode)(indexLookup[Lists.ParentList]); parentNode.TreeNodes.Add(node); } } // Add index key here to find it later, should suggest with Joe to add it to DNNTree if (indexLookup[Lists.Key] == null) { indexLookup.Add(Lists.Key, node); } } }
private void BindTree() { var ctlLists = new ListController(); var colLists = ctlLists.GetListInfoCollection(string.Empty, string.Empty, PortalSettings.ActiveTab.PortalID); var indexLookup = new Hashtable(); listTree.Nodes.Clear(); foreach (ListInfo list in colLists) { var node = new DnnTreeNode { Text = list.DisplayName.Replace(list.ParentList + ".", "") }; { node.Value = list.Key; node.ToolTip = String.Format(LocalizeString("NoEntries"), list.EntryCount); node.ImageUrl = IconController.IconURL("Folder"); } if (list.Level == 0) { listTree.Nodes.Add(node); } else { if (indexLookup[list.ParentList] != null) { var parentNode = (DnnTreeNode) indexLookup[list.ParentList]; parentNode.Nodes.Add(node); } } //Add index key here to find it later, should suggest with Joe to add it to DNNTree if (indexLookup[list.Key] == null) { indexLookup.Add(list.Key, node); } } }
private void DeleteItem(int entryId) { if (SelectedListItems.Any()) { try { var ctlLists = new ListController(); ctlLists.DeleteListEntryByID(entryId, true); DataBind(); } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } } else { DeleteList(); } }
private void DeleteList() { var ctlLists = new ListController(); ctlLists.DeleteList(SelectedList, true); Response.Redirect(Globals.NavigateURL(TabId)); }
/// <summary> /// Select a list in dropdownlist /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void SelectListIndexChanged(object sender, EventArgs e) { var ctlLists = new ListController(); if (!String.IsNullOrEmpty(ddlSelectList.SelectedValue)) { ListInfo selList = GetList(ddlSelectList.SelectedItem.Value, false); { ddlSelectParent.Enabled = true; ddlSelectParent.DataSource = ctlLists.GetListEntryInfoItems(selList.Name, selList.ParentKey); ddlSelectParent.DataTextField = "DisplayName"; ddlSelectParent.DataValueField = "EntryID"; ddlSelectParent.DataBind(); } } else { ddlSelectParent.Enabled = false; ddlSelectParent.Items.Clear(); } }
/// <summary> /// Loads top level entry list /// </summary> private void BindListInfo() { lblListName.Text = ListName; lblListParent.Text = ParentKey; rowListParent.Visible = (!String.IsNullOrEmpty(ParentKey)); chkEnableSortOrder.Checked = EnableSortOrder; if (!SystemList && ShowDelete) { cmdDeleteList.Visible = true; ClientAPI.AddButtonConfirm(cmdDeleteList, Localization.GetString("DeleteItem")); } else { cmdDeleteList.Visible = false; } switch (Mode) { case "ListEntries": EnableView(true); break; case "EditEntry": EnableView(false); EnableEdit(false); break; case "AddEntry": EnableView(false); EnableEdit(false); if (SelectedList != null) { txtParentKey.Text = SelectedList.ParentKey; } else { rowEnableSortOrder.Visible = true; } txtEntryName.Text = ListName; rowListName.Visible = false; txtEntryValue.Text = ""; txtEntryText.Text = ""; cmdSaveEntry.CommandName = "SaveEntry"; break; case "AddList": EnableView(false); EnableEdit(true); rowListName.Visible = true; txtParentKey.Text = ""; txtEntryName.Text = ""; txtEntryValue.Text = ""; txtEntryText.Text = ""; txtEntryName.ReadOnly = false; cmdSaveEntry.CommandName = "SaveList"; var ctlLists = new ListController(); ddlSelectList.Enabled = true; ddlSelectList.DataSource = ctlLists.GetListInfoCollection(string.Empty, string.Empty, PortalSettings.ActiveTab.PortalID); ddlSelectList.DataTextField = "DisplayName"; ddlSelectList.DataValueField = "Key"; ddlSelectList.DataBind(); //ddlSelectList.Items.Insert(0, new ListItem(Localization.GetString("None_Specified"), "")); ddlSelectList.InsertItem(0, Localization.GetString("None_Specified"), ""); //Reset dropdownlist ddlSelectParent.ClearSelection(); ddlSelectParent.Enabled = false; break; } }
/// <summary> /// Handles events when clicking image button in the grid (Edit/Up/Down) /// </summary> /// <param name="source"></param> /// <param name="e"></param> protected void EntriesGridItemCommand(object source, GridCommandEventArgs e) { try { var ctlLists = new ListController(); int entryID = Convert.ToInt32(((GridDataItem) e.Item).GetDataKeyValue("EntryID")); switch (e.CommandName.ToLower()) { case "delete": Mode = "ListEntries"; DeleteItem(entryID); break; case "edit": Mode = "EditEntry"; ListEntryInfo entry = ctlLists.GetListEntryInfo(entryID); txtEntryID.Text = entryID.ToString(CultureInfo.InvariantCulture); txtParentKey.Text = entry.ParentKey; txtEntryValue.Text = entry.Value; txtEntryText.Text = entry.Text; rowListName.Visible = false; cmdSaveEntry.CommandName = "Update"; if (!SystemList) { cmdDelete.Visible = true; ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem")); } else { cmdDelete.Visible = false; } e.Canceled = true; //stop the grid from providing inline editing DataBind(); break; case "up": ctlLists.UpdateListSortOrder(entryID, true); DataBind(); break; case "down": ctlLists.UpdateListSortOrder(entryID, false); DataBind(); break; } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
/// <summary> /// Handles cmdSaveEntry.Click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <remarks> /// Using "CommandName" property of cmdSaveEntry to determine action to take (ListUpdate/AddEntry/AddList) /// </remarks> protected void OnSaveEntryClick(object sender, EventArgs e) { String entryValue; String entryText; if (UserInfo.IsSuperUser) { entryValue = txtEntryValue.Text; entryText = txtEntryText.Text; } else { var ps = new PortalSecurity(); entryValue = ps.InputFilter(txtEntryValue.Text, PortalSecurity.FilterFlag.NoScripting); entryText = ps.InputFilter(txtEntryText.Text, PortalSecurity.FilterFlag.NoScripting); } var listController = new ListController(); var entry = new ListEntryInfo(); { entry.DefinitionID = Null.NullInteger; entry.PortalID = ListPortalID; entry.ListName = txtEntryName.Text; entry.Value = entryValue; entry.Text = entryText; } if (Page.IsValid) { Mode = "ListEntries"; switch (cmdSaveEntry.CommandName.ToLower()) { case "update": entry.ParentKey = SelectedList.ParentKey; entry.EntryID = Int16.Parse(txtEntryID.Text); bool canUpdate = true; foreach (var curEntry in listController.GetListEntryInfoItems(SelectedList.Name, entry.ParentKey, entry.PortalID)) { if (entry.EntryID != curEntry.EntryID) //not the same item we are trying to update { if (entry.Value == curEntry.Value && entry.Text == curEntry.Text) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ItemAlreadyPresent", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); canUpdate = false; break; } } } if (canUpdate) { listController.UpdateListEntry(entry); DataBind(); } break; case "saveentry": if (SelectedList != null) { entry.ParentKey = SelectedList.ParentKey; entry.ParentID = SelectedList.ParentID; entry.Level = SelectedList.Level; } if (chkEnableSortOrder.Checked) { entry.SortOrder = 1; } else { entry.SortOrder = 0; } if (listController.AddListEntry(entry) == Null.NullInteger) //entry already found in database { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ItemAlreadyPresent", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); } DataBind(); break; case "savelist": if (ddlSelectParent.SelectedIndex != -1) { int parentID = Int32.Parse(ddlSelectParent.SelectedItem.Value); ListEntryInfo parentEntry = listController.GetListEntryInfo(parentID); entry.ParentID = parentID; entry.DefinitionID = parentEntry.DefinitionID; entry.Level = parentEntry.Level + 1; entry.ParentKey = parentEntry.Key; } if (chkEnableSortOrder.Checked) { entry.SortOrder = 1; } else { entry.SortOrder = 0; } if (listController.AddListEntry(entry) == Null.NullInteger) //entry already found in database { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ItemAlreadyPresent", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); } else { SelectedKey = entry.ParentKey.Replace(":", ".") + ":" + entry.ListName; Response.Redirect(Globals.NavigateURL(TabId, "", "Key=" + SelectedKey)); } break; } } }
private static int ResolveCountry(string country) { int id = -1; ListController controller = new ListController(); ListEntryInfoCollection info = controller.GetListEntryInfoCollection("Country"); // controller.GetListEntryInfo("Country", country); foreach (ListEntryInfo entry in info) { if (entry.Text == country) { id = entry.EntryID; } } return id; }
private static void UpgradeToVersion620() { //add host (system) profanityfilter list const string listName = "ProfanityFilter"; var listController = new ListController(); var entry = new ListEntryInfo(); { entry.DefinitionID = Null.NullInteger; entry.PortalID = Null.NullInteger; entry.ListName = listName; entry.Value = "ReplaceWithNothing"; entry.Text = "FindThisText"; entry.SystemList = true; } listController.AddListEntry(entry); //add same list to each portal foreach (PortalInfo portal in PortalController.Instance.GetPortals()) { entry.PortalID = portal.PortalID; entry.SystemList = false; entry.ListName = listName + "-" + portal.PortalID; listController.AddListEntry(entry); //also create default social relationship entries for the portal RelationshipController.Instance.CreateDefaultRelationshipsForPortal(portal.PortalID); } //Convert old Messages to new schema ConvertOldMessages(); //Replace old Messaging module on User Profile with new ReplaceMessagingModule(); //Move Photo Property to the end of the propert list. MovePhotoProperty(); //Update Child Portal's Default Page UpdateChildPortalsDefaultPage(); //Add core notification types AddCoreNotificationTypesFor620(); //Console module should not be IPortable var consoleModule = DesktopModuleController.GetDesktopModuleByModuleName("Console", Null.NullInteger); consoleModule.SupportedFeatures = 0; consoleModule.BusinessControllerClass = ""; DesktopModuleController.SaveDesktopModule(consoleModule, false, false); }
private string GetBillingFrequencyCode(string Value) { var ctlEntry = new ListController(); ListEntryInfo entry = ctlEntry.GetListEntryInfo("Frequency", Value); return entry.Value; }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); try { UserInfo objUserInfo = null; int intUserID = -1; if (Request.IsAuthenticated) { objUserInfo = UserController.GetCurrentUserInfo(); if (objUserInfo != null) { intUserID = objUserInfo.UserID; } } int intRoleId = -1; if (Request.QueryString["roleid"] != null) { intRoleId = int.Parse(Request.QueryString["roleid"]); } string strProcessorUserId = ""; var objPortalController = new PortalController(); PortalInfo objPortalInfo = objPortalController.GetPortal(PortalSettings.PortalId); if (objPortalInfo != null) { strProcessorUserId = objPortalInfo.ProcessorUserId; } Dictionary<string, string> settings = PortalController.GetPortalSettingsDictionary(PortalSettings.PortalId); string strPayPalURL; if (intUserID != -1 && intRoleId != -1 && !String.IsNullOrEmpty(strProcessorUserId)) { // Sandbox mode if (settings.ContainsKey("paypalsandbox") && !String.IsNullOrEmpty(settings["paypalsandbox"]) && settings["paypalsandbox"] == "true") { strPayPalURL = "https://www.sandbox.paypal.com/cgi-bin/webscr?"; } else { strPayPalURL = "https://www.paypal.com/cgi-bin/webscr?"; } if (Request.QueryString["cancel"] != null) { //build the cancellation PayPal URL strPayPalURL += "cmd=_subscr-find&alias=" + Globals.HTTPPOSTEncode(strProcessorUserId); } else { strPayPalURL += "cmd=_ext-enter"; var objRoles = new RoleController(); RoleInfo objRole = objRoles.GetRole(intRoleId, PortalSettings.PortalId); if (objRole.RoleID != -1) { int intTrialPeriod = 1; if (objRole.TrialPeriod != 0) { intTrialPeriod = objRole.TrialPeriod; } int intBillingPeriod = 1; if (objRole.BillingPeriod != 0) { intBillingPeriod = objRole.BillingPeriod; } //explicitely format numbers using en-US so numbers are correctly built var enFormat = new CultureInfo("en-US"); string strService = string.Format(enFormat.NumberFormat, "{0:#####0.00}", objRole.ServiceFee); string strTrial = string.Format(enFormat.NumberFormat, "{0:#####0.00}", objRole.TrialFee); if (objRole.BillingFrequency == "O" || objRole.TrialFrequency == "O") { //build the payment PayPal URL strPayPalURL += "&redirect_cmd=_xclick&business=" + Globals.HTTPPOSTEncode(strProcessorUserId); strPayPalURL += "&item_name=" + Globals.HTTPPOSTEncode(PortalSettings.PortalName + " - " + objRole.RoleName + " ( " + objRole.ServiceFee.ToString("#.##") + " " + PortalSettings.Currency + " )"); strPayPalURL += "&item_number=" + Globals.HTTPPOSTEncode(intRoleId.ToString()); strPayPalURL += "&no_shipping=1&no_note=1"; strPayPalURL += "&quantity=1"; strPayPalURL += "&amount=" + Globals.HTTPPOSTEncode(strService); strPayPalURL += "¤cy_code=" + Globals.HTTPPOSTEncode(PortalSettings.Currency); } else //recurring payments { //build the subscription PayPal URL strPayPalURL += "&redirect_cmd=_xclick-subscriptions&business=" + Globals.HTTPPOSTEncode(strProcessorUserId); strPayPalURL += "&item_name=" + Globals.HTTPPOSTEncode(PortalSettings.PortalName + " - " + objRole.RoleName + " ( " + objRole.ServiceFee.ToString("#.##") + " " + PortalSettings.Currency + " every " + intBillingPeriod + " " + GetBillingFrequencyCode(objRole.BillingFrequency) + " )"); strPayPalURL += "&item_number=" + Globals.HTTPPOSTEncode(intRoleId.ToString()); strPayPalURL += "&no_shipping=1&no_note=1"; if (objRole.TrialFrequency != "N") { strPayPalURL += "&a1=" + Globals.HTTPPOSTEncode(strTrial); strPayPalURL += "&p1=" + Globals.HTTPPOSTEncode(intTrialPeriod.ToString()); strPayPalURL += "&t1=" + Globals.HTTPPOSTEncode(objRole.TrialFrequency); } strPayPalURL += "&a3=" + Globals.HTTPPOSTEncode(strService); strPayPalURL += "&p3=" + Globals.HTTPPOSTEncode(intBillingPeriod.ToString()); strPayPalURL += "&t3=" + Globals.HTTPPOSTEncode(objRole.BillingFrequency); strPayPalURL += "&src=1"; strPayPalURL += "¤cy_code=" + Globals.HTTPPOSTEncode(PortalSettings.Currency); } } var ctlList = new ListController(); strPayPalURL += "&custom=" + Globals.HTTPPOSTEncode(intUserID.ToString()); strPayPalURL += "&first_name=" + Globals.HTTPPOSTEncode(objUserInfo.Profile.FirstName); strPayPalURL += "&last_name=" + Globals.HTTPPOSTEncode(objUserInfo.Profile.LastName); try { if (objUserInfo.Profile.Country == "United States") { ListEntryInfo colList = ctlList.GetListEntryInfo("Region", objUserInfo.Profile.Region); strPayPalURL += "&address1=" + Globals.HTTPPOSTEncode(Convert.ToString(!String.IsNullOrEmpty(objUserInfo.Profile.Unit) ? objUserInfo.Profile.Unit + " " : "") + objUserInfo.Profile.Street); strPayPalURL += "&city=" + Globals.HTTPPOSTEncode(objUserInfo.Profile.City); strPayPalURL += "&state=" + Globals.HTTPPOSTEncode(colList.Value); strPayPalURL += "&zip=" + Globals.HTTPPOSTEncode(objUserInfo.Profile.PostalCode); } } catch (Exception ex) { //issue getting user address DnnLog.Error(ex); } //Return URL if (settings.ContainsKey("paypalsubscriptionreturn") && !string.IsNullOrEmpty(settings["paypalsubscriptionreturn"])) { strPayPalURL += "&return=" + Globals.HTTPPOSTEncode(settings["paypalsubscriptionreturn"]); } else { strPayPalURL += "&return=" + Globals.HTTPPOSTEncode(Globals.AddHTTP(Globals.GetDomainName(Request))); } //Cancellation URL if (settings.ContainsKey("paypalsubscriptioncancelreturn") && !string.IsNullOrEmpty(settings["paypalsubscriptioncancelreturn"])) { strPayPalURL += "&cancel_return=" + Globals.HTTPPOSTEncode(settings["paypalsubscriptioncancelreturn"]); } else { strPayPalURL += "&cancel_return=" + Globals.HTTPPOSTEncode(Globals.AddHTTP(Globals.GetDomainName(Request))); } //Instant Payment Notification URL if (settings.ContainsKey("paypalsubscriptionnotifyurl") && !string.IsNullOrEmpty(settings["paypalsubscriptionnotifyurl"])) { strPayPalURL += "¬ify_url=" + Globals.HTTPPOSTEncode(settings["paypalsubscriptionnotifyurl"]); } else { strPayPalURL += "¬ify_url=" + Globals.HTTPPOSTEncode(Globals.AddHTTP(Globals.GetDomainName(Request)) + "/admin/Sales/PayPalIPN.aspx"); } strPayPalURL += "&sra=1"; //reattempt on failure } //redirect to PayPal Response.Redirect(strPayPalURL, true); } else { if ((settings.ContainsKey("paypalsubscriptioncancelreturn") && !string.IsNullOrEmpty(settings["paypalsubscriptioncancelreturn"]))) { strPayPalURL = settings["paypalsubscriptioncancelreturn"]; } else { strPayPalURL = Globals.AddHTTP(Globals.GetDomainName(Request)); } //redirect to PayPal Response.Redirect(strPayPalURL, true); } } catch (Exception exc) //Page failed to load { Exceptions.ProcessPageLoadException(exc); } }
/// ----------------------------------------------------------------------------- /// <summary> /// Handles cmdSaveEntry.Click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <remarks> /// Using "CommandName" property of cmdSaveEntry to determine action to take (ListUpdate/AddEntry/AddList) /// </remarks> /// <history> /// [tamttt] 20/10/2004 Created /// [cnurse] 01/30/2007 Extracted to separte user control /// </history> /// ----------------------------------------------------------------------------- protected void OnSaveEntryClick(object sender, EventArgs e) { var ctlLists = new ListController(); var entry = new ListEntryInfo(); { entry.DefinitionID = Null.NullInteger; entry.PortalID = ListPortalID; entry.ListName = txtEntryName.Text; entry.Value = txtEntryValue.Text; entry.Text = txtEntryText.Text; } if (Page.IsValid) { Mode = "ListEntries"; switch (cmdSaveEntry.CommandName.ToLower()) { case "update": entry.ParentKey = SelectedList.ParentKey; entry.EntryID = Int16.Parse(txtEntryID.Text); ctlLists.UpdateListEntry(entry); DataBind(); break; case "saveentry": if (SelectedList != null) { entry.ParentKey = SelectedList.ParentKey; entry.ParentID = SelectedList.ParentID; entry.Level = SelectedList.Level; } if (chkEnableSortOrder.Checked) { entry.SortOrder = 1; } else { entry.SortOrder = 0; } //save the list as system list when its edit by host user. entry.SystemList = ListPortalID == Null.NullInteger; ctlLists.AddListEntry(entry); DataBind(); break; case "savelist": if (ddlSelectParent.SelectedIndex != -1) { int parentID = Int32.Parse(ddlSelectParent.SelectedItem.Value); ListEntryInfo parentEntry = ctlLists.GetListEntryInfo(parentID); entry.ParentID = parentID; entry.DefinitionID = parentEntry.DefinitionID; entry.Level = parentEntry.Level + 1; entry.ParentKey = parentEntry.Key; } if (chkEnableSortOrder.Checked) { entry.SortOrder = 1; } else { entry.SortOrder = 0; } //save the list as system list when its edit by host user. entry.SystemList = ListPortalID == Null.NullInteger; ctlLists.AddListEntry(entry); SelectedKey = entry.ParentKey.Replace(":", ".") + ":" + entry.ListName; Response.Redirect(Globals.NavigateURL(TabId, "", "Key=" + SelectedKey)); break; } } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); try { if (!Page.IsPostBack) { ClientAPI.RegisterKeyCapture(txtSearch, cmdSearch, 13); //Load the Search Combo ddlSearchType.Items.Add(AddSearchItem("Username")); ddlSearchType.Items.Add(AddSearchItem("Email")); ddlSearchType.Items.Add(AddSearchItem("DisplayName")); var controller = new ListController(); ListEntryInfo imageDataType = controller.GetListEntryInfo("DataType", "Image"); ProfilePropertyDefinitionCollection profileProperties = ProfileController.GetPropertyDefinitionsByPortal(PortalId, false, false); foreach (ProfilePropertyDefinition definition in profileProperties) { if (imageDataType != null && definition.DataType != imageDataType.EntryID) { ddlSearchType.Items.Add(AddSearchItem(definition.PropertyName)); } } //Sent controls to current Filter if ((!String.IsNullOrEmpty(Filter) && Filter.ToUpper() != "NONE") && !String.IsNullOrEmpty(FilterProperty)) { txtSearch.Text = Filter; var findedItem = ddlSearchType.Items.FindItemByValue(FilterProperty, true); if (findedItem != null) { findedItem.Selected = true; } } } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
/// <summary> /// Handles cmdSaveEntry.Click /// </summary> /// <remarks> /// Using "CommandName" property of cmdSaveEntry to determine action to take (ListUpdate/AddEntry/AddList) /// </remarks> /// <history> /// [tamttt] 20/10/2004 Created /// </history> protected void cmdSaveEntry_Click(object sender, EventArgs e) { ListController ctlLists = new ListController(); ListEntryInfo entry = new ListEntryInfo(); entry.ListName = txtEntryName.Text; entry.Value = txtEntryValue.Text; entry.Text = txtEntryText.Text; switch (cmdSaveEntry.CommandName.ToLower()) { case "update": entry.ParentKey = txtParentKey.Text; entry.EntryID = Int16.Parse(txtEntryID.Text); ctlLists.UpdateListEntry(entry); InitList(); EnableView(true); //BindListInfo() BindGrid(); break; case "saveentry": entry.ParentKey = txtParentKey.Text; if (EnableSortOrder) { entry.SortOrder = 1; } else { entry.SortOrder = 0; } ctlLists.AddListEntry(entry); InitList(); BindListInfo(); BindTree(); BindGrid(); break; case "savelist": string strKey = ""; string strText = ""; if (ddlSelectParent.SelectedIndex != -1) { strKey = ddlSelectParent.SelectedItem.Value; strText = ddlSelectParent.SelectedItem.Text; entry.ParentKey = strKey; strKey += ":"; strText += ":"; } if (chkEnableSortOrder.Checked) { entry.SortOrder = 1; } else { entry.SortOrder = 0; } ctlLists.AddListEntry(entry); strKey += this.txtEntryName.Text; strText += this.txtEntryName.Text; SelectedKey = strKey; SelectedText = strText; BindTree(); InitList(); BindListInfo(); BindGrid(); //Response.Redirect(NavigateURL(TabId)) break; } }
private ListInfo GetList(string key, bool update) { var ctlLists = new ListController(); int index = key.IndexOf(":", StringComparison.Ordinal); string listName = key.Substring(index + 1); string parentKey = Null.NullString; if (index > 0) { parentKey = key.Substring(0, index); } if (update) { ListName = listName; ParentKey = parentKey; } return ctlLists.GetListInfo(listName, parentKey, ListPortalID); }
private static int ResolveState(string state) { int id = -1; ListController controller = new ListController(); ListEntryInfoCollection regions = controller.GetListEntryInfoCollection("Region"); foreach (ListEntryInfo region in regions) { if (region.Text == state || region.Value == state) { id = region.EntryID; } } return id; }
private static void UpgradeToVersion530() { //update languages module int moduleDefId = GetModuleDefinition("Languages", "Languages"); RemoveModuleControl(moduleDefId, ""); AddModuleControl(moduleDefId, "", "", "DesktopModules/Admin/Languages/languageEnabler.ascx", "~/images/icon_language_32px.gif", SecurityAccessLevel.View, 0, "", true); AddModuleControl(moduleDefId, "Editor", "", "DesktopModules/Admin/Languages/languageeditor.ascx", "~/images/icon_language_32px.gif", SecurityAccessLevel.View, 0); //Add new View Profile module moduleDefId = AddModuleDefinition("ViewProfile", "", "ViewProfile", false, false); AddModuleControl(moduleDefId, "", "", "DesktopModules/Admin/ViewProfile/ViewProfile.ascx", "~/images/icon_profile_32px.gif", SecurityAccessLevel.View, 0); AddModuleControl(moduleDefId, "Settings", "Settings", "DesktopModules/Admin/ViewProfile/Settings.ascx", "~/images/icon_profile_32px.gif", SecurityAccessLevel.Edit, 0); //Add new Sitemap settings module moduleDefId = AddModuleDefinition("Sitemap", "", "Sitemap", false, false); AddModuleControl(moduleDefId, "", "", "DesktopModules/Admin/Sitemap/SitemapSettings.ascx", "~/images/icon_analytics_32px.gif", SecurityAccessLevel.View, 0); AddAdminPages("Search Engine Sitemap", "Configure the sitemap for submission to common search engines.", "~/images/icon_analytics_16px.gif", "~/images/icon_analytics_32px.gif", true, moduleDefId, "Search Engine Sitemap", "~/images/icon_analytics_32px.gif"); //Add new Photo Profile field to Host var listController = new ListController(); Dictionary<string, ListEntryInfo> dataTypes = listController.GetListEntryInfoDictionary("DataType"); var properties = ProfileController.GetPropertyDefinitionsByPortal(Null.NullInteger); ProfileController.AddDefaultDefinition(Null.NullInteger, "Preferences", "Photo", "Image", 0, properties.Count * 2 + 2, UserVisibilityMode.AllUsers, dataTypes); string installTemplateFile = string.Format("{0}Template\\UserProfile.page.template", Globals.InstallMapPath); string hostTemplateFile = string.Format("{0}Templates\\UserProfile.page.template", Globals.HostMapPath); if (File.Exists(installTemplateFile)) { if (!File.Exists(hostTemplateFile)) { File.Copy(installTemplateFile, hostTemplateFile); } } if (File.Exists(hostTemplateFile)) { ArrayList portals = PortalController.Instance.GetPortals(); foreach (PortalInfo portal in portals) { properties = ProfileController.GetPropertyDefinitionsByPortal(portal.PortalID); //Add new Photo Profile field to Portal ProfileController.AddDefaultDefinition(portal.PortalID, "Preferences", "Photo", "Image", 0, properties.Count * 2 + 2, UserVisibilityMode.AllUsers, dataTypes); //Rename old Default Page template string defaultPageTemplatePath = string.Format("{0}Templates\\Default.page.template", portal.HomeDirectoryMapPath); if (File.Exists(defaultPageTemplatePath)) { File.Move(defaultPageTemplatePath, String.Format("{0}Templates\\Default_old.page.template", portal.HomeDirectoryMapPath)); } //Update Default profile template in every portal PortalController.Instance.CopyPageTemplate("Default.page.template", portal.HomeDirectoryMapPath); //Add User profile template to every portal PortalController.Instance.CopyPageTemplate("UserProfile.page.template", portal.HomeDirectoryMapPath); //Synchronize the Templates folder to ensure the templates are accessible FolderManager.Instance.Synchronize(portal.PortalID, "Templates/", false, true); var xmlDoc = new XmlDocument(); try { // open the XML file xmlDoc.Load(hostTemplateFile); } catch (Exception ex) { Exceptions.Exceptions.LogException(ex); } XmlNode userTabNode = xmlDoc.SelectSingleNode("//portal/tabs/tab"); if (userTabNode != null) { string tabName = XmlUtils.GetNodeValue(userTabNode.CreateNavigator(), "name"); var userTab = TabController.Instance.GetTabByName(tabName, portal.PortalID) ?? TabController.DeserializeTab(userTabNode, null, portal.PortalID, PortalTemplateModuleAction.Merge); //Update SiteSettings to point to the new page if (portal.UserTabId > Null.NullInteger) { portal.RegisterTabId = portal.UserTabId; } else { portal.UserTabId = userTab.TabID; } } PortalController.Instance.UpdatePortalInfo(portal); //Add Users folder to every portal string usersFolder = string.Format("{0}Users\\", portal.HomeDirectoryMapPath); if (!Directory.Exists(usersFolder)) { //Create Users folder Directory.CreateDirectory(usersFolder); //Synchronize the Users folder to ensure the user folder is accessible FolderManager.Instance.Synchronize(portal.PortalID, "Users/", false, true); } } } AddEventQueueApplicationStartFirstRequest(); //Change Key for Module Defintions; moduleDefId = GetModuleDefinition("Extensions", "Extensions"); RemoveModuleControl(moduleDefId, "ImportModuleDefinition"); AddModuleControl(moduleDefId, "EditModuleDefinition", "Edit Module Definition", "DesktopModules/Admin/Extensions/Editors/EditModuleDefinition.ascx", "~/images/icon_extensions_32px.png", SecurityAccessLevel.Host, 0); //Module was incorrectly assigned as "IsPremium=False" RemoveModuleFromPortals("Users And Roles"); }
private static void UpgradeToVersion550() { //update languages module int moduleDefId = GetModuleDefinition("Languages", "Languages"); AddModuleControl(moduleDefId, "TranslationStatus", "", "DesktopModules/Admin/Languages/TranslationStatus.ascx", "~/images/icon_language_32px.gif", SecurityAccessLevel.Edit, 0); //due to an error in 5.3.0 we need to recheck and readd Application_Start_FirstRequest AddEventQueueApplicationStartFirstRequest(); // check if UserProfile page template exists in Host folder and if not, copy it from Install folder string installTemplateFile = string.Format("{0}Templates\\UserProfile.page.template", Globals.InstallMapPath); if (File.Exists(installTemplateFile)) { string hostTemplateFile = string.Format("{0}Templates\\UserProfile.page.template", Globals.HostMapPath); if (!File.Exists(hostTemplateFile)) { File.Copy(installTemplateFile, hostTemplateFile); } } //Fix the permission for User Folders foreach (PortalInfo portal in PortalController.Instance.GetPortals()) { foreach (FolderInfo folder in FolderManager.Instance.GetFolders(portal.PortalID)) { if (folder.FolderPath.StartsWith("Users/")) { foreach (PermissionInfo permission in PermissionController.GetPermissionsByFolder()) { if (permission.PermissionKey.ToUpper() == "READ") { //Add All Users Read Access to the folder int roleId = Int32.Parse(Globals.glbRoleAllUsers); if (!folder.FolderPermissions.Contains(permission.PermissionKey, folder.FolderID, roleId, Null.NullInteger)) { var folderPermission = new FolderPermissionInfo(permission) { FolderID = folder.FolderID, UserID = Null.NullInteger, RoleID = roleId, AllowAccess = true }; folder.FolderPermissions.Add(folderPermission); } } } FolderPermissionController.SaveFolderPermissions(folder); } } //Remove user page template from portal if it exists (from 5.3) if (File.Exists(string.Format("{0}Templates\\UserProfile.page.template", portal.HomeDirectoryMapPath))) { File.Delete(string.Format("{0}Templates\\UserProfile.page.template", portal.HomeDirectoryMapPath)); } } //DNN-12894 - Country Code for "United Kingdom" is incorrect var listController = new ListController(); var listItem = listController.GetListEntryInfo("Country", "UK"); if (listItem != null) { listItem.Value = "GB"; listController.UpdateListEntry(listItem); } foreach (PortalInfo portal in PortalController.Instance.GetPortals()) { //fix issue where portal default language may be disabled string defaultLanguage = portal.DefaultLanguage; if (!IsLanguageEnabled(portal.PortalID, defaultLanguage)) { Locale language = LocaleController.Instance.GetLocale(defaultLanguage); Localization.Localization.AddLanguageToPortal(portal.PortalID, language.LanguageId, true); } //preemptively create any missing localization records rather than relying on dynamic creation foreach (Locale locale in LocaleController.Instance.GetLocales(portal.PortalID).Values) { DataProvider.Instance().EnsureLocalizationExists(portal.PortalID, locale.Code); } } }
private static void UpgradeToVersion562() { //Add new Photo Profile field to Host var listController = new ListController(); Dictionary<string, ListEntryInfo> dataTypes = listController.GetListEntryInfoDictionary("DataType"); var properties = ProfileController.GetPropertyDefinitionsByPortal(Null.NullInteger); ProfileController.AddDefaultDefinition(Null.NullInteger, "Preferences", "Photo", "Image", 0, properties.Count * 2 + 2, UserVisibilityMode.AllUsers, dataTypes); HostController.Instance.Update("AutoAddPortalAlias", Globals.Status == Globals.UpgradeStatus.Install ? "Y" : "N"); // remove the system message module from the admin tab // System Messages are now managed through Localization if (CoreModuleExists("System Messages")) { RemoveCoreModule("System Messages", "Admin", "Site Settings", false); } // remove portal alias module if (CoreModuleExists("PortalAliases")) { RemoveCoreModule("PortalAliases", "Admin", "Site Settings", false); } // add the log viewer module to the admin tab int moduleDefId; if (CoreModuleExists("LogViewer") == false) { moduleDefId = AddModuleDefinition("LogViewer", "Allows you to view log entries for site events.", "Log Viewer"); AddModuleControl(moduleDefId, "", "", "DesktopModules/Admin/LogViewer/LogViewer.ascx", "", SecurityAccessLevel.Admin, 0); AddModuleControl(moduleDefId, "Edit", "Edit Log Settings", "DesktopModules/Admin/LogViewer/EditLogTypes.ascx", "", SecurityAccessLevel.Host, 0); //Add the Module/Page to all configured portals AddAdminPages("Log Viewer", "View a historical log of database events such as event schedules, exceptions, account logins, module and page changes, user account activities, security role activities, etc.", "icon_viewstats_16px.gif", "icon_viewstats_32px.gif", true, moduleDefId, "Log Viewer", "icon_viewstats_16px.gif"); } // add the schedule module to the host tab TabInfo newPage; if (CoreModuleExists("Scheduler") == false) { moduleDefId = AddModuleDefinition("Scheduler", "Allows you to schedule tasks to be run at specified intervals.", "Scheduler"); AddModuleControl(moduleDefId, "", "", "DesktopModules/Admin/Scheduler/ViewSchedule.ascx", "", SecurityAccessLevel.Admin, 0); AddModuleControl(moduleDefId, "Edit", "Edit Schedule", "DesktopModules/Admin/Scheduler/EditSchedule.ascx", "", SecurityAccessLevel.Host, 0); AddModuleControl(moduleDefId, "History", "Schedule History", "DesktopModules/Admin/Scheduler/ViewScheduleHistory.ascx", "", SecurityAccessLevel.Host, 0); AddModuleControl(moduleDefId, "Status", "Schedule Status", "DesktopModules/Admin/Scheduler/ViewScheduleStatus.ascx", "", SecurityAccessLevel.Host, 0); //Create New Host Page (or get existing one) newPage = AddHostPage("Schedule", "Add, modify and delete scheduled tasks to be run at specified intervals.", "icon_scheduler_16px.gif", "icon_scheduler_32px.gif", true); //Add Module To Page AddModuleToPage(newPage, moduleDefId, "Schedule", "icon_scheduler_16px.gif"); } // add the Search Admin module to the host tab if (CoreModuleExists("SearchAdmin") == false) { moduleDefId = AddModuleDefinition("SearchAdmin", "The Search Admininstrator provides the ability to manage search settings.", "Search Admin"); AddModuleControl(moduleDefId, "", "", "DesktopModules/Admin/SearchAdmin/SearchAdmin.ascx", "", SecurityAccessLevel.Host, 0); //Create New Host Page (or get existing one) newPage = AddHostPage("Search Admin", "Manage search settings associated with DotNetNuke's search capability.", "icon_search_16px.gif", "icon_search_32px.gif", true); //Add Module To Page AddModuleToPage(newPage, moduleDefId, "Search Admin", "icon_search_16px.gif"); } // add the Search Input module if (CoreModuleExists("SearchInput") == false) { moduleDefId = AddModuleDefinition("SearchInput", "The Search Input module provides the ability to submit a search to a given search results module.", "Search Input", false, false); AddModuleControl(moduleDefId, "", "", "DesktopModules/Admin/SearchInput/SearchInput.ascx", "", SecurityAccessLevel.Anonymous, 0); AddModuleControl(moduleDefId, "Settings", "Search Input Settings", "DesktopModules/Admin/SearchInput/Settings.ascx", "", SecurityAccessLevel.Edit, 0); } // add the Search Results module if (CoreModuleExists("SearchResults") == false) { moduleDefId = AddModuleDefinition("SearchResults", "The Search Reasults module provides the ability to display search results.", "Search Results", false, false); AddModuleControl(moduleDefId, "", "", "DesktopModules/Admin/SearchResults/SearchResults.ascx", "", SecurityAccessLevel.Anonymous, 0); AddModuleControl(moduleDefId, "Settings", "Search Results Settings", "DesktopModules/Admin/SearchResults/Settings.ascx", "", SecurityAccessLevel.Edit, 0); //Add the Search Module/Page to all configured portals AddSearchResults(moduleDefId); } // add the site wizard module to the admin tab if (CoreModuleExists("SiteWizard") == false) { moduleDefId = AddModuleDefinition("SiteWizard", "The Administrator can use this user-friendly wizard to set up the common Extensions of the Portal/Site.", "Site Wizard"); AddModuleControl(moduleDefId, "", "", "DesktopModules/Admin/SiteWizard/Sitewizard.ascx", "", SecurityAccessLevel.Admin, 0); AddAdminPages("Site Wizard", "Configure portal settings, page design and apply a site template using a step-by-step wizard.", "icon_wizard_16px.gif", "icon_wizard_32px.gif", true, moduleDefId, "Site Wizard", "icon_wizard_16px.gif"); } //add Lists module and tab if (HostTabExists("Lists") == false) { moduleDefId = AddModuleDefinition("Lists", "Allows you to edit common lists.", "Lists"); AddModuleControl(moduleDefId, "", "", "DesktopModules/Admin/Lists/ListEditor.ascx", "", SecurityAccessLevel.Host, 0); //Create New Host Page (or get existing one) newPage = AddHostPage("Lists", "Manage common lists.", "icon_lists_16px.gif", "icon_lists_32px.gif", true); //Add Module To Page AddModuleToPage(newPage, moduleDefId, "Lists", "icon_lists_16px.gif"); } if (HostTabExists("Superuser Accounts") == false) { //add SuperUser Accounts module and tab DesktopModuleInfo objDesktopModuleInfo = DesktopModuleController.GetDesktopModuleByModuleName("Security", Null.NullInteger); moduleDefId = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("User Accounts", objDesktopModuleInfo.DesktopModuleID).ModuleDefID; //Create New Host Page (or get existing one) newPage = AddHostPage("Superuser Accounts", "Manage host user accounts.", "icon_users_16px.gif", "icon_users_32px.gif", true); //Add Module To Page AddModuleToPage(newPage, moduleDefId, "SuperUser Accounts", "icon_users_32px.gif"); } //Add Edit Role Groups moduleDefId = GetModuleDefinition("Security", "Security Roles"); AddModuleControl(moduleDefId, "EditGroup", "Edit Role Groups", "DesktopModules/Admin/Security/EditGroups.ascx", "icon_securityroles_32px.gif", SecurityAccessLevel.Edit, Null.NullInteger); AddModuleControl(moduleDefId, "UserSettings", "Manage User Settings", "DesktopModules/Admin/Security/UserSettings.ascx", "~/images/settings.gif", SecurityAccessLevel.Edit, Null.NullInteger); //Add User Accounts Controls moduleDefId = GetModuleDefinition("Security", "User Accounts"); AddModuleControl(moduleDefId, "ManageProfile", "Manage Profile Definition", "DesktopModules/Admin/Security/ProfileDefinitions.ascx", "icon_users_32px.gif", SecurityAccessLevel.Edit, Null.NullInteger); AddModuleControl(moduleDefId, "EditProfileProperty", "Edit Profile Property Definition", "DesktopModules/Admin/Security/EditProfileDefinition.ascx", "icon_users_32px.gif", SecurityAccessLevel.Edit, Null.NullInteger); AddModuleControl(moduleDefId, "UserSettings", "Manage User Settings", "DesktopModules/Admin/Security/UserSettings.ascx", "~/images/settings.gif", SecurityAccessLevel.Edit, Null.NullInteger); AddModuleControl(Null.NullInteger, "Profile", "Profile", "DesktopModules/Admin/Security/ManageUsers.ascx", "icon_users_32px.gif", SecurityAccessLevel.Anonymous, Null.NullInteger); AddModuleControl(Null.NullInteger, "SendPassword", "Send Password", "DesktopModules/Admin/Security/SendPassword.ascx", "", SecurityAccessLevel.Anonymous, Null.NullInteger); AddModuleControl(Null.NullInteger, "ViewProfile", "View Profile", "DesktopModules/Admin/Security/ViewProfile.ascx", "icon_users_32px.gif", SecurityAccessLevel.Anonymous, Null.NullInteger); //Update Child Portal subHost.aspx UpdateChildPortalsDefaultPage(); // add the solutions explorer module to the admin tab if (CoreModuleExists("Solutions") == false) { moduleDefId = AddModuleDefinition("Solutions", "Browse additional solutions for your application.", "Solutions", false, false); AddModuleControl(moduleDefId, "", "", "DesktopModules/Admin/Solutions/Solutions.ascx", "", SecurityAccessLevel.Admin, 0); AddAdminPages("Solutions", "DotNetNuke Solutions Explorer page provides easy access to locate free and commercial DotNetNuke modules, skin and more.", "icon_solutions_16px.gif", "icon_solutions_32px.gif", true, moduleDefId, "Solutions Explorer", "icon_solutions_32px.gif"); } //Add Search Skin Object AddSkinControl("SEARCH", "DotNetNuke.SearchSkinObject", "Admin/Skins/Search.ascx"); //Add TreeView Skin Object AddSkinControl("TREEVIEW", "DotNetNuke.TreeViewSkinObject", "Admin/Skins/TreeViewMenu.ascx"); //Add Text Skin Object AddSkinControl("TEXT", "DotNetNuke.TextSkinObject", "Admin/Skins/Text.ascx"); //Add Styles Skin Object AddSkinControl("STYLES", "DotNetNuke.StylesSkinObject", "Admin/Skins/Styles.ascx"); }
private static void UpgradeToVersion710() { //create a placeholder entry - uses the most common 5 character password (seed list is 6 characters and above) const string listName = "BannedPasswords"; var listController = new ListController(); var entry = new ListEntryInfo(); { entry.DefinitionID = Null.NullInteger; entry.PortalID = Null.NullInteger; entry.ListName = listName; entry.Value = "12345"; entry.Text = "Placeholder"; entry.SystemList = false; } //add list to each portal and update primary alias foreach (PortalInfo portal in PortalController.Instance.GetPortals()) { entry.PortalID = portal.PortalID; entry.SystemList = false; entry.ListName = listName + "-" + portal.PortalID; listController.AddListEntry(entry); var defaultAlias = PortalController.GetPortalSetting("DefaultPortalAlias", portal.PortalID, String.Empty); if (!String.IsNullOrEmpty(defaultAlias)) { foreach (var alias in PortalAliasController.Instance.GetPortalAliasesByPortalId(portal.PortalID).Where(alias => alias.HTTPAlias == defaultAlias)) { alias.IsPrimary = true; PortalAliasController.Instance.UpdatePortalAlias(alias); } } } // Add File Content Type var typeController = new ContentTypeController(); var contentTypeFile = (from t in typeController.GetContentTypes() where t.ContentType == "File" select t).SingleOrDefault(); if (contentTypeFile == null) { typeController.AddContentType(new ContentType { ContentType = "File" }); } var fileContentType = (from t in typeController.GetContentTypes() where t.ContentType == "File" select t).SingleOrDefault(); //only perform following for an existing installation upgrading if (Globals.Status == Globals.UpgradeStatus.Upgrade) { UpdateFoldersForParentId(); ImportDocumentLibraryCategories(); ImportDocumentLibraryCategoryAssoc(fileContentType); } //Add 404 Log var logTypeInfo = new LogTypeInfo { LogTypeKey = EventLogController.EventLogType.PAGE_NOT_FOUND_404.ToString(), LogTypeFriendlyName = "HTTP Error Code 404 Page Not Found", LogTypeDescription = "", LogTypeCSSClass = "OperationFailure", LogTypeOwner = "DotNetNuke.Logging.EventLogType" }; LogController.Instance.AddLogType(logTypeInfo); //Add LogType var logTypeConf = new LogTypeConfigInfo { LoggingIsActive = true, LogTypeKey = EventLogController.EventLogType.PAGE_NOT_FOUND_404.ToString(), KeepMostRecent = "100", NotificationThreshold = 1, NotificationThresholdTime = 1, NotificationThresholdTimeType = LogTypeConfigInfo.NotificationThresholdTimeTypes.Seconds, MailFromAddress = Null.NullString, MailToAddress = Null.NullString, LogTypePortalID = "*" }; LogController.Instance.AddLogTypeConfigInfo(logTypeConf); UninstallPackage("DotNetNuke.SearchInput"); //enable password strength meter for new installs only HostController.Instance.Update("EnableStrengthMeter", Globals.Status == Globals.UpgradeStatus.Install ? "Y" : "N"); //Add IP filter log type var logTypeFilterInfo = new LogTypeInfo { LogTypeKey = EventLogController.EventLogType.IP_LOGIN_BANNED.ToString(), LogTypeFriendlyName = "HTTP Error Code 403.6 forbidden ip address rejected", LogTypeDescription = "", LogTypeCSSClass = "OperationFailure", LogTypeOwner = "DotNetNuke.Logging.EventLogType" }; LogController.Instance.AddLogType(logTypeFilterInfo); //Add LogType var logTypeFilterConf = new LogTypeConfigInfo { LoggingIsActive = true, LogTypeKey = EventLogController.EventLogType.IP_LOGIN_BANNED.ToString(), KeepMostRecent = "100", NotificationThreshold = 1, NotificationThresholdTime = 1, NotificationThresholdTimeType = LogTypeConfigInfo.NotificationThresholdTimeTypes.Seconds, MailFromAddress = Null.NullString, MailToAddress = Null.NullString, LogTypePortalID = "*" }; LogController.Instance.AddLogTypeConfigInfo(logTypeFilterConf); int tabID = TabController.GetTabByTabPath(Null.NullInteger, "//Host//SearchAdmin", Null.NullString); if (tabID > Null.NullInteger) { TabController.Instance.DeleteTab(tabID, Null.NullInteger); } var modDef = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("Search Admin"); if (modDef != null) AddAdminPages("Search Admin", "Manage search settings associated with DotNetNuke's search capability.", "~/Icons/Sigma/Search_16x16_Standard.png", "~/Icons/Sigma/Search_32x32_Standard.png", true, modDef.ModuleDefID, "Search Admin", ""); CopyGettingStartedStyles(); }
/// <summary> /// Handles cmdSaveEntry.Click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <remarks> /// Using "CommandName" property of cmdSaveEntry to determine action to take (ListUpdate/AddEntry/AddList) /// </remarks> protected void OnSaveEntryClick(object sender, EventArgs e) { String entryValue; String entryText; if (UserInfo.IsSuperUser) { entryValue = txtEntryValue.Text; entryText = txtEntryText.Text; } else { var ps = new PortalSecurity(); entryValue = ps.InputFilter(txtEntryValue.Text, PortalSecurity.FilterFlag.NoScripting); entryText = ps.InputFilter(txtEntryText.Text, PortalSecurity.FilterFlag.NoScripting); } var listController = new ListController(); var entry = new ListEntryInfo(); { entry.DefinitionID = Null.NullInteger; entry.PortalID = ListPortalID; entry.ListName = ListName; entry.Value = entryValue; entry.Text = entryText; } if (Page.IsValid) { Mode = "ListEntries"; switch (cmdSaveEntry.CommandName.ToLower()) { case "update": entry.ParentKey = SelectedList.ParentKey; entry.EntryID = Int16.Parse(txtEntryID.Text); bool canUpdate = true; foreach (var curEntry in listController.GetListEntryInfoItems(SelectedList.Name, entry.ParentKey, entry.PortalID)) { if (entry.EntryID != curEntry.EntryID) //not the same item we are trying to update { if (entry.Value == curEntry.Value && entry.Text == curEntry.Text) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ItemAlreadyPresent", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); canUpdate = false; break; } } } if (canUpdate) { listController.UpdateListEntry(entry); DataBind(); } break; case "saveentry": if (SelectedList != null) { entry.ParentKey = SelectedList.ParentKey; entry.ParentID = SelectedList.ParentID; entry.Level = SelectedList.Level; } if (chkEnableSortOrder.Checked) { entry.SortOrder = 1; } else { entry.SortOrder = 0; } if (listController.AddListEntry(entry) == Null.NullInteger) //entry already found in database { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ItemAlreadyPresent", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); } DataBind(); break; case "savelist": if (ddlSelectParent.SelectedIndex != -1) { int parentID = Int32.Parse(ddlSelectParent.SelectedItem.Value); ListEntryInfo parentEntry = listController.GetListEntryInfo(parentID); entry.ParentID = parentID; entry.DefinitionID = parentEntry.DefinitionID; entry.Level = parentEntry.Level + 1; entry.ParentKey = parentEntry.Key; } if (chkEnableSortOrder.Checked) { entry.SortOrder = 1; } else { entry.SortOrder = 0; } if (listController.AddListEntry(entry) == Null.NullInteger) //entry already found in database { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ItemAlreadyPresent", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); } else { SelectedKey = entry.ParentKey.Replace(":", ".") + ":" + entry.ListName; Response.Redirect(Globals.NavigateURL(TabId, "", "Key=" + SelectedKey)); } break; } } }