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); } } }
/// <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; } } }
/// <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; } } }
/// <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; } }
/// <summary>Handles the <see cref="GridView.RowCommand"/> event of the <see cref="LeadItemsGridView"/> control.</summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="CommandEventArgs"/> instance containing the event data.</param> private void LeadItemsGridView_RowCommand(object sender, CommandEventArgs e) { if (!this.Page.IsValid || e == null) { return; } int rowIndex; if (!int.TryParse(e.CommandArgument.ToString(), NumberStyles.Integer, CultureInfo.InvariantCulture, out rowIndex)) { return; } if (!string.Equals("Save", e.CommandName, StringComparison.OrdinalIgnoreCase)) { return; } var leadId = this.GetLeadItemId(rowIndex); if (!leadId.HasValue) { return; } var lists = new ListController(); var leadItem = lists.GetListEntryInfo(leadId.Value); var newLeadText = this.GetLeadItemText(rowIndex); var oldLeadText = leadItem.Text; if (string.Equals(newLeadText, oldLeadText, StringComparison.CurrentCultureIgnoreCase) || lists.GetListEntryInfo(Utility.LeadListName, newLeadText) == null) { leadItem.Value = newLeadText; leadItem.Text = newLeadText; lists.UpdateListEntry(leadItem); this.LeadItemsGridView.EditIndex = -1; this.BindLeadItems(); } else { this.cvLeadEdit.IsValid = false; } }
/// ----------------------------------------------------------------------------- /// <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; } 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; } ctlLists.AddListEntry(entry); SelectedKey = entry.ParentKey.Replace(":", ".") + ":" + entry.ListName; Response.Redirect(Globals.NavigateURL(TabId, "", "Key=" + SelectedKey)); break; } } }
/// <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; } }
/// ----------------------------------------------------------------------------- /// <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; } } }