public void MustHaveSandboxedPaymentSettings() { var portalController = new PortalController(); var site = portalController.GetPortal(0); if (site.ProcessorPassword == string.Empty) { PortalController.UpdatePortalSetting(0, "paypalsandbox", "true"); //uses PayPal sandbox account. site.ProcessorUserId = "PayPal"; site.ProcessorPassword = "******"; site.ProcessorUserId = "*****@*****.**"; portalController.UpdatePortalInfo(site); } WebConfigManager.TouchConfig(PhysicalPath); }
protected void CtlPagesContextMenuItemClick(object sender, RadTreeViewContextMenuEventArgs e) { SelectedNode = e.Node.Value; var tabController = new TabController(); var portalId = rblMode.SelectedValue == "H" ? Null.NullInteger : PortalId; var objTab = tabController.GetTab(int.Parse(e.Node.Value), portalId, false); switch (e.MenuItem.Value.ToLower()) { case "makehome": if (PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName)) { var portalController = new PortalController(); PortalInfo portalInfo = portalController.GetPortal(PortalId); portalInfo.HomeTabId = objTab.TabID; PortalSettings.HomeTabId = objTab.TabID; portalController.UpdatePortalInfo(portalInfo); DataCache.ClearPortalCache(PortalId, false); BindTreeAndShowTab(objTab.TabID); ShowSuccessMessage(string.Format(Localization.GetString("TabMadeHome", LocalResourceFile), objTab.TabName)); } break; case "view": Response.Redirect(objTab.FullUrl); break; case "edit": if (TabPermissionController.CanManagePage(objTab)) { var editUrl = Globals.NavigateURL(objTab.TabID, "Tab", "action=edit", "returntabid=" + TabId); // Prevent PageSettings of the current page in a popup if SSL is enabled and enforced, which causes redirection/javascript broswer security issues. if (PortalSettings.EnablePopUps && !(objTab.TabID == TabId && (PortalSettings.SSLEnabled && PortalSettings.SSLEnforced))) { editUrl = UrlUtils.PopUpUrl(editUrl, this, PortalSettings, true, false); var script = string.Format("<script type=\"text/javascript\">{0}</script>", editUrl); ClientAPI.RegisterStartUpScript(Page, "EditInPopup", script); } else { Response.Redirect(editUrl, true); } } break; case "delete": if (TabPermissionController.CanDeletePage(objTab)) { tabController.SoftDeleteTab(objTab.TabID, PortalSettings); BindTree(); //keep the parent tab selected if (objTab.ParentId != Null.NullInteger) { SelectedNode = objTab.ParentId.ToString(CultureInfo.InvariantCulture); ctlPages.FindNodeByValue(SelectedNode).Selected = true; ctlPages.FindNodeByValue(SelectedNode).ExpandParentNodes(); BindTab(objTab.ParentId); } else { pnlDetails.Visible = false; } ShowSuccessMessage(string.Format(Localization.GetString("TabDeleted", LocalResourceFile), objTab.TabName)); } break; case "add": if ((objTab!= null && TabPermissionController.CanAddPage(objTab)) || (PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName))) { pnlBulk.Visible = true; btnBulkCreate.CommandArgument = e.Node.Value; ctlPages.FindNodeByValue(e.Node.Value).Selected = true; txtBulk.Focus(); pnlDetails.Visible = false; //Response.Redirect(NavigateURL(objTab.TabID, "Tab", "action=add", "returntabid=" & TabId.ToString), True) } break; case "hide": if (TabPermissionController.CanManagePage(objTab)) { objTab.IsVisible = false; tabController.UpdateTab(objTab); BindTreeAndShowTab(objTab.TabID); ShowSuccessMessage(string.Format(Localization.GetString("TabHidden", LocalResourceFile), objTab.TabName)); } break; case "show": if (TabPermissionController.CanManagePage(objTab)) { objTab.IsVisible = true; tabController.UpdateTab(objTab); BindTreeAndShowTab(objTab.TabID); ShowSuccessMessage(string.Format(Localization.GetString("TabShown", LocalResourceFile), objTab.TabName)); } break; case "disable": if (TabPermissionController.CanManagePage(objTab)) { objTab.DisableLink = true; tabController.UpdateTab(objTab); BindTreeAndShowTab(objTab.TabID); ShowSuccessMessage(string.Format(Localization.GetString("TabDisabled", LocalResourceFile), objTab.TabName)); } break; case "enable": if (TabPermissionController.CanManagePage(objTab)) { objTab.DisableLink = false; tabController.UpdateTab(objTab); BindTreeAndShowTab(objTab.TabID); ShowSuccessMessage(string.Format(Localization.GetString("TabEnabled", LocalResourceFile), objTab.TabName)); } break; } }
/// ----------------------------------------------------------------------------- /// <summary> /// cmdUpdate_Click runs when the Update LinkButton is clicked. /// It saves the current Site Settings /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 9/9/2004 Modified /// [aprasad] 1/17/2011 New setting AutoAddPortalAlias /// </history> /// ----------------------------------------------------------------------------- protected void UpdatePortal(object sender, EventArgs e) { if (Page.IsValid) { try { var portalController = new PortalController(); PortalInfo existingPortal = portalController.GetPortal(_portalId); string logo = String.Format("FileID={0}", ctlLogo.FileID); string background = String.Format("FileID={0}", ctlBackground.FileID); //Refresh if Background or Logo file have changed bool refreshPage = (background == existingPortal.BackgroundFile || logo == existingPortal.LogoFile); float hostFee = existingPortal.HostFee; if (!String.IsNullOrEmpty(txtHostFee.Text)) { hostFee = float.Parse(txtHostFee.Text); } int hostSpace = existingPortal.HostSpace; if (!String.IsNullOrEmpty(txtHostSpace.Text)) { hostSpace = int.Parse(txtHostSpace.Text); } int pageQuota = existingPortal.PageQuota; if (!String.IsNullOrEmpty(txtPageQuota.Text)) { pageQuota = int.Parse(txtPageQuota.Text); } int userQuota = existingPortal.UserQuota; if (!String.IsNullOrEmpty(txtUserQuota.Text)) { userQuota = int.Parse(txtUserQuota.Text); } int siteLogHistory = existingPortal.SiteLogHistory; if (!String.IsNullOrEmpty(txtSiteLogHistory.Text)) { siteLogHistory = int.Parse(txtSiteLogHistory.Text); } DateTime expiryDate = existingPortal.ExpiryDate; if (datepickerExpiryDate.SelectedDate.HasValue) { expiryDate = datepickerExpiryDate.SelectedDate.Value; } int intSplashTabId = Null.NullInteger; if (cboSplashTabId.SelectedItem != null) { intSplashTabId = int.Parse(cboSplashTabId.SelectedItem.Value); } int intHomeTabId = Null.NullInteger; if (cboHomeTabId.SelectedItem != null) { intHomeTabId = int.Parse(cboHomeTabId.SelectedItem.Value); } int intLoginTabId = Null.NullInteger; if (cboLoginTabId.SelectedItem != null) { intLoginTabId = int.Parse(cboLoginTabId.SelectedItem.Value); } int intRegisterTabId = Null.NullInteger; if (cboRegisterTabId.SelectedItem != null) { intRegisterTabId = int.Parse(cboRegisterTabId.SelectedItem.Value); } int intUserTabId = Null.NullInteger; if (cboUserTabId.SelectedItem != null) { intUserTabId = int.Parse(cboUserTabId.SelectedItem.Value); } int intSearchTabId = Null.NullInteger; if (cboSearchTabId.SelectedItem != null) { intSearchTabId = int.Parse(cboSearchTabId.SelectedItem.Value); } if (txtPassword.Attributes["value"] != null) { txtPassword.Attributes["value"] = txtPassword.Text; } var portal = new PortalInfo { PortalID = _portalId, PortalGroupID = existingPortal.PortalGroupID, PortalName = txtPortalName.Text, LogoFile = logo, FooterText = txtFooterText.Text, ExpiryDate = expiryDate, UserRegistration = optUserRegistration.SelectedIndex, BannerAdvertising = optBanners.SelectedIndex, Currency = currencyCombo.SelectedItem.Value, AdministratorId = Convert.ToInt32(cboAdministratorId.SelectedItem.Value), HostFee = hostFee, HostSpace = hostSpace, PageQuota = pageQuota, UserQuota = userQuota, PaymentProcessor = String.IsNullOrEmpty(processorCombo.SelectedValue) ? "" : processorCombo.SelectedItem.Text, ProcessorUserId = txtUserId.Text, ProcessorPassword = txtPassword.Text, Description = txtDescription.Text, KeyWords = txtKeyWords.Text, BackgroundFile = background, SiteLogHistory = siteLogHistory, SplashTabId = intSplashTabId, HomeTabId = intHomeTabId, LoginTabId = intLoginTabId, RegisterTabId = intRegisterTabId, UserTabId = intUserTabId, SearchTabId = intSearchTabId, DefaultLanguage = existingPortal.DefaultLanguage, HomeDirectory = lblHomeDirectory.Text, CultureCode = SelectedCultureCode }; portalController.UpdatePortalInfo(portal); if (!refreshPage) { refreshPage = (PortalSettings.DefaultAdminSkin == editSkinCombo.SelectedValue) || (PortalSettings.DefaultAdminContainer == editContainerCombo.SelectedValue); } PortalController.UpdatePortalSetting(_portalId, ClientResourceSettings.OverrideDefaultSettingsKey, chkOverrideDefaultSettings.Checked.ToString(CultureInfo.InvariantCulture), false); PortalController.UpdatePortalSetting(_portalId, ClientResourceSettings.EnableCompositeFilesKey, chkEnableCompositeFiles.Checked.ToString(CultureInfo.InvariantCulture), false); PortalController.UpdatePortalSetting(_portalId, ClientResourceSettings.MinifyCssKey, chkMinifyCss.Checked.ToString(CultureInfo.InvariantCulture), false); PortalController.UpdatePortalSetting(_portalId, ClientResourceSettings.MinifyJsKey, chkMinifyJs.Checked.ToString(CultureInfo.InvariantCulture), false); PortalController.UpdatePortalSetting(_portalId, "EnableSkinWidgets", chkSkinWidgestEnabled.Checked.ToString(), false); PortalController.UpdatePortalSetting(_portalId, "DefaultAdminSkin", editSkinCombo.SelectedValue, false); PortalController.UpdatePortalSetting(_portalId, "DefaultPortalSkin", portalSkinCombo.SelectedValue, false); PortalController.UpdatePortalSetting(_portalId, "DefaultAdminContainer", editContainerCombo.SelectedValue, false); PortalController.UpdatePortalSetting(_portalId, "DefaultPortalContainer", portalContainerCombo.SelectedValue, false); PortalController.UpdatePortalSetting(_portalId, "EnablePopups", enablePopUpsCheckBox.Checked.ToString(), false); PortalController.UpdatePortalSetting(_portalId, "InlineEditorEnabled", chkInlineEditor.Checked.ToString(), false); PortalController.UpdatePortalSetting(_portalId, "HideFoldersEnabled", chkHideSystemFolders.Checked.ToString(), false); PortalController.UpdatePortalSetting(_portalId, "ControlPanelMode", optControlPanelMode.SelectedItem.Value, false); PortalController.UpdatePortalSetting(_portalId, "ControlPanelVisibility", optControlPanelVisibility.SelectedItem.Value, false); PortalController.UpdatePortalSetting(_portalId, "ControlPanelSecurity", optControlPanelSecurity.SelectedItem.Value, false); PortalController.UpdatePortalSetting(_portalId, "MessagingThrottlingInterval", cboMsgThrottlingInterval.SelectedItem.Value, false); PortalController.UpdatePortalSetting(_portalId, "MessagingRecipientLimit", cboMsgRecipientLimit.SelectedItem.Value, false); PortalController.UpdatePortalSetting(_portalId, "MessagingAllowAttachments", optMsgAllowAttachments.SelectedItem.Value, false); PortalController.UpdatePortalSetting(_portalId, "MessagingProfanityFilters", optMsgProfanityFilters.SelectedItem.Value, false); PortalController.UpdatePortalSetting(_portalId, "MessagingSendEmail", optMsgSendEmail.SelectedItem.Value, false); PortalController.UpdatePortalSetting(_portalId, "paypalsandbox", chkPayPalSandboxEnabled.Checked.ToString(), false); PortalController.UpdatePortalSetting(_portalId, "paypalsubscriptionreturn", txtPayPalReturnURL.Text, false); PortalController.UpdatePortalSetting(_portalId, "paypalsubscriptioncancelreturn", txtPayPalCancelURL.Text, false); PortalController.UpdatePortalSetting(_portalId, "TimeZone", cboTimeZone.SelectedValue, false); new FavIcon(_portalId).Update(ctlFavIcon.FileID); if (IsSuperUser()) { PortalController.UpdatePortalSetting(_portalId, "PortalAliasMapping", portalAliasModeButtonList.SelectedValue, false); PortalController.UpdatePortalSetting(_portalId, "DefaultPortalAlias", defaultAliasDropDown.SelectedValue, false); HostController.Instance.Update("AutoAddPortalAlias", chkAutoAddPortalAlias.Checked ? "Y" : "N", true); PortalController.UpdatePortalSetting(_portalId, "SSLEnabled", chkSSLEnabled.Checked.ToString(), false); PortalController.UpdatePortalSetting(_portalId, "SSLEnforced", chkSSLEnforced.Checked.ToString(), false); PortalController.UpdatePortalSetting(_portalId, "SSLURL", AddPortalAlias(txtSSLURL.Text, _portalId), false); PortalController.UpdatePortalSetting(_portalId, "STDURL", AddPortalAlias(txtSTDURL.Text, _portalId), false); } if(registrationFormType.SelectedValue == "1") { var setting = registrationFields.Text; if (!setting.Contains("Email")) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("NoEmail", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); return; } if (!setting.Contains("DisplayName") && Convert.ToBoolean(requireUniqueDisplayName.Value)) { PortalController.UpdatePortalSetting(_portalId, "Registration_RegistrationFormType", "0", false); UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("NoDisplayName", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); return; } PortalController.UpdatePortalSetting(_portalId, "Registration_RegistrationFields", setting); } PortalController.UpdatePortalSetting(_portalId, "Registration_RegistrationFormType", registrationFormType.SelectedValue, false); foreach (DnnFormItemBase item in basicRegistrationSettings.Items) { PortalController.UpdatePortalSetting(_portalId, item.DataField, item.Value.ToString()); } foreach (DnnFormItemBase item in standardRegistrationSettings.Items) { PortalController.UpdatePortalSetting(_portalId, item.DataField, item.Value.ToString()); } foreach (DnnFormItemBase item in validationRegistrationSettings.Items) { try { var regex = new Regex(item.Value.ToString()); PortalController.UpdatePortalSetting(_portalId, item.DataField, item.Value.ToString()); } catch { string message = String.Format(Localization.GetString("InvalidRegularExpression", LocalResourceFile), Localization.GetString(item.DataField, LocalResourceFile), item.Value); UI.Skins.Skin.AddModuleMessage(this, message, ModuleMessage.ModuleMessageType.RedError); return; } } foreach (DnnFormItemBase item in passwordRegistrationSettings.Items) { PortalController.UpdatePortalSetting(_portalId, item.DataField, item.Value.ToString()); } foreach (DnnFormItemBase item in otherRegistrationSettings.Items) { PortalController.UpdatePortalSetting(_portalId, item.DataField, item.Value.ToString()); } foreach (DnnFormItemBase item in loginSettings.Items) { PortalController.UpdatePortalSetting(_portalId, item.DataField, item.Value.ToString()); } foreach (DnnFormItemBase item in profileSettings.Items) { PortalController.UpdatePortalSetting(_portalId, item.DataField, item.Value.GetType().IsEnum ? Convert.ToInt32(item.Value).ToString(CultureInfo.InvariantCulture) : item.Value.ToString() ); } profileDefinitions.Update(); DataCache.ClearPortalCache(PortalId, false); //Redirect to this site to refresh only if admin skin changed or either of the images have changed if (refreshPage) { Response.Redirect(Request.RawUrl, true); } BindPortal(_portalId, SelectedCultureCode); } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } finally { DataCache.ClearPortalCache(_portalId, false); } } }
private static void UpgradeToVersion540() { var configDoc = Config.Load(); var configNavigator = configDoc.CreateNavigator().SelectSingleNode("/configuration/system.web.extensions"); if (configNavigator == null) { //attempt to remove "System.Web.Extensions" configuration section string upgradeFile = string.Format("{0}\\Config\\SystemWebExtensions.config", Globals.InstallMapPath); string message = UpdateConfig(upgradeFile, DotNetNukeContext.Current.Application.Version, "Remove System.Web.Extensions"); var eventLogController = new EventLogController(); eventLogController.AddLog("UpgradeConfig", string.IsNullOrEmpty(message) ? "Remove System Web Extensions" : string.Format("Remove System Web Extensions failed. Error reported during attempt to update:{0}", message), PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, EventLogController.EventLogType.HOST_ALERT); } //Add Styles Skin Object AddSkinControl("TAGS", "DotNetNuke.TagsSkinObject", "Admin/Skins/Tags.ascx"); //Add Content List module definition int moduleDefId = AddModuleDefinition("ContentList", "This module displays a list of content by tag.", "Content List"); AddModuleControl(moduleDefId, "", "", "DesktopModules/Admin/ContentList/ContentList.ascx", "", SecurityAccessLevel.View, 0); //Update registration page var portalController = new PortalController(); ArrayList portals = portalController.GetPortals(); foreach (PortalInfo portal in portals) { //objPortal.RegisterTabId = objPortal.UserTabId; portalController.UpdatePortalInfo(portal); //Add ContentList to Search Results Page var tabController = new TabController(); int tabId = TabController.GetTabByTabPath(portal.PortalID, "//SearchResults", Null.NullString); TabInfo searchPage = tabController.GetTab(tabId, portal.PortalID, false); AddModuleToPage(searchPage, moduleDefId, "Results", ""); } }
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)) { var tabController = new TabController(); var portalController = new PortalController(); ArrayList portals = portalController.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.CopyPageTemplate("Default.page.template", portal.HomeDirectoryMapPath); //Add User profile template to every portal portalController.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.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.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"); }
protected void updateButton_Click(object sender, EventArgs e) { Locale language = null; PortalController.UpdatePortalSetting(ModuleContext.PortalId, "EnableBrowserLanguage", chkBrowser.Checked.ToString()); // first check whether or not portal default language has changed string newDefaultLanguage = languagesComboBox.SelectedValue; if (newDefaultLanguage != PortalSettings.DefaultLanguage) { if (!IsLanguageEnabled(newDefaultLanguage)) { language = LocaleController.Instance.GetLocale(newDefaultLanguage); Localization.AddLanguageToPortal(ModuleContext.PortalId, language.LanguageId, true); } // update portal default language var objPortalController = new PortalController(); PortalInfo objPortal = objPortalController.GetPortal(PortalId); objPortal.DefaultLanguage = newDefaultLanguage; objPortalController.UpdatePortalInfo(objPortal); _PortalDefault = newDefaultLanguage; } BindDefaultLanguageSelector(); BindGrid(); }
/// ----------------------------------------------------------------------------- /// <summary> /// cmdUpdate_Click runs when the Update LinkButton is clicked. /// It saves the current Site Settings /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 9/9/2004 Modified /// [aprasad] 1/17/2011 New setting AutoAddPortalAlias /// </history> /// ----------------------------------------------------------------------------- protected void UpdatePortal(object sender, EventArgs e) { if (Page.IsValid) { try { var objPortalController = new PortalController(); PortalInfo objPortal = objPortalController.GetPortal(_portalId); string strLogo = String.Format("FileID={0}", ctlLogo.FileID); string strBackground = String.Format("FileID={0}", ctlBackground.FileID); //Refresh if Background or Logo file have changed bool refreshPage = (strBackground == objPortal.BackgroundFile || strLogo == objPortal.LogoFile); double dblHostFee = 0; if (!String.IsNullOrEmpty(txtHostFee.Text)) { dblHostFee = double.Parse(txtHostFee.Text); } double dblHostSpace = 0; if (!String.IsNullOrEmpty(txtHostSpace.Text)) { dblHostSpace = double.Parse(txtHostSpace.Text); } int intPageQuota = 0; if (!String.IsNullOrEmpty(txtPageQuota.Text)) { intPageQuota = int.Parse(txtPageQuota.Text); } double intUserQuota = 0; if (!String.IsNullOrEmpty(txtUserQuota.Text)) { intUserQuota = int.Parse(txtUserQuota.Text); } int intSiteLogHistory = 0; if (!String.IsNullOrEmpty(txtSiteLogHistory.Text)) { intSiteLogHistory = int.Parse(txtSiteLogHistory.Text); } DateTime datExpiryDate = Null.NullDate; if (datepickerExpiryDate.SelectedDate.HasValue) { datExpiryDate = datepickerExpiryDate.SelectedDate.Value; } int intSplashTabId = Null.NullInteger; if (cboSplashTabId.SelectedItem != null) { intSplashTabId = int.Parse(cboSplashTabId.SelectedItem.Value); } int intHomeTabId = Null.NullInteger; if (cboHomeTabId.SelectedItem != null) { intHomeTabId = int.Parse(cboHomeTabId.SelectedItem.Value); } int intLoginTabId = Null.NullInteger; if (cboLoginTabId.SelectedItem != null) { intLoginTabId = int.Parse(cboLoginTabId.SelectedItem.Value); } int intRegisterTabId = Null.NullInteger; if (cboRegisterTabId.SelectedItem != null) { intRegisterTabId = int.Parse(cboRegisterTabId.SelectedItem.Value); } int intUserTabId = Null.NullInteger; if (cboUserTabId.SelectedItem != null) { intUserTabId = int.Parse(cboUserTabId.SelectedItem.Value); } int intSearchTabId = Null.NullInteger; if (cboSearchTabId.SelectedItem != null) { intSearchTabId = int.Parse(cboSearchTabId.SelectedItem.Value); } if (txtPassword.Attributes["value"] != null) { txtPassword.Attributes["value"] = txtPassword.Text; } //check only relevant fields altered if (!UserInfo.IsSuperUser) { bool hostChanged = false; if (dblHostFee != objPortal.HostFee) { hostChanged = true; } if (dblHostSpace != objPortal.HostSpace) { hostChanged = true; } if (intPageQuota != objPortal.PageQuota) { hostChanged = true; } if (intUserQuota != objPortal.UserQuota) { hostChanged = true; } if (intSiteLogHistory != objPortal.SiteLogHistory) { hostChanged = true; } if (datExpiryDate != objPortal.ExpiryDate) { hostChanged = true; } if (hostChanged) { throw new Exception(); } } objPortalController.UpdatePortalInfo(_portalId, txtPortalName.Text, strLogo, txtFooterText.Text, datExpiryDate, optUserRegistration.SelectedIndex, optBanners.SelectedIndex, currencyCombo.SelectedItem.Value, Convert.ToInt32(cboAdministratorId.SelectedItem.Value), dblHostFee, dblHostSpace, intPageQuota, (int) intUserQuota, String.IsNullOrEmpty(processorCombo.SelectedValue) ? "" : processorCombo.SelectedItem.Text, txtUserId.Text, txtPassword.Text, txtDescription.Text, txtKeyWords.Text, strBackground, intSiteLogHistory, intSplashTabId, intHomeTabId, intLoginTabId, intRegisterTabId, intUserTabId, intSearchTabId, objPortal.DefaultLanguage, lblHomeDirectory.Text, SelectedCultureCode); if (!refreshPage) { refreshPage = (PortalSettings.DefaultAdminSkin == editSkinCombo.SelectedValue) || (PortalSettings.DefaultAdminContainer == editContainerCombo.SelectedValue); } PortalController.UpdatePortalSetting(_portalId, "EnableSkinWidgets", chkSkinWidgestEnabled.Checked.ToString(), false); PortalController.UpdatePortalSetting(_portalId, "DefaultAdminSkin", editSkinCombo.SelectedValue, false); PortalController.UpdatePortalSetting(_portalId, "DefaultPortalSkin", portalSkinCombo.SelectedValue, false); PortalController.UpdatePortalSetting(_portalId, "DefaultAdminContainer", editContainerCombo.SelectedValue, false); PortalController.UpdatePortalSetting(_portalId, "DefaultPortalContainer", portalContainerCombo.SelectedValue, false); PortalController.UpdatePortalSetting(_portalId, "EnablePopups", enablePopUpsCheckBox.Checked.ToString(), false); PortalController.UpdatePortalSetting(_portalId, "InlineEditorEnabled", chkInlineEditor.Checked.ToString(), false); PortalController.UpdatePortalSetting(_portalId, "HideFoldersEnabled", chkHideSystemFolders.Checked.ToString(), false); PortalController.UpdatePortalSetting(_portalId, "ControlPanelMode", optControlPanelMode.SelectedItem.Value, false); PortalController.UpdatePortalSetting(_portalId, "ControlPanelVisibility", optControlPanelVisibility.SelectedItem.Value, false); PortalController.UpdatePortalSetting(_portalId, "ControlPanelSecurity", optControlPanelSecurity.SelectedItem.Value, false); PortalController.UpdatePortalSetting(_portalId, "paypalsandbox", chkPayPalSandboxEnabled.Checked.ToString(), false); PortalController.UpdatePortalSetting(_portalId, "paypalsubscriptionreturn", txtPayPalReturnURL.Text, false); PortalController.UpdatePortalSetting(_portalId, "paypalsubscriptioncancelreturn", txtPayPalCancelURL.Text, false); PortalController.UpdatePortalSetting(_portalId, "TimeZone", cboTimeZone.SelectedValue, false); PortalController.UpdatePortalSetting(_portalId, "PortalAliasMapping", portalAliasModeButtonList.SelectedValue, false); PortalController.UpdatePortalSetting(_portalId, "DefaultPortalAlias", defaultAliasDropDown.SelectedValue, false); HostController.Instance.Update("AutoAddPortalAlias", chkAutoAddPortalAlias.Checked ? "Y" : "N", true); new FavIcon(_portalId).Update(ctlFavIcon.FileID); if (IsSuperUser()) { PortalController.UpdatePortalSetting(_portalId, "SSLEnabled", chkSSLEnabled.Checked.ToString(), false); PortalController.UpdatePortalSetting(_portalId, "SSLEnforced", chkSSLEnforced.Checked.ToString(), false); PortalController.UpdatePortalSetting(_portalId, "SSLURL", AddPortalAlias(txtSSLURL.Text, _portalId), false); PortalController.UpdatePortalSetting(_portalId, "STDURL", AddPortalAlias(txtSTDURL.Text, _portalId), false); } //Redirect to this site to refresh only if admin skin changed or either of the images have changed if (refreshPage) { Response.Redirect(Request.RawUrl, true); } DataCache.ClearPortalCache(PortalId, false); BindPortal(_portalId, SelectedCultureCode); } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } finally { DataCache.ClearPortalCache(_portalId, false); } } }
/// <summary> /// Wizard_FinishButtonClick runs when the Finish Button on the Wizard is clicked. /// </summary> /// <history> /// [cnurse] 10/12/2004 created /// </history> protected void Wizard_FinishButtonClick(object sender, WizardNavigationEventArgs e) { PortalController objPortalController = new PortalController(); // use Portal Template to update portal content pages if (lstTemplate.SelectedIndex != -1) { string strTemplateFile = lstTemplate.SelectedItem.Text + ".template"; // process zip resource file if present objPortalController.ProcessResourceFile(PortalSettings.HomeDirectoryMapPath, Globals.HostMapPath + strTemplateFile); //Process Template switch (optMerge.SelectedValue) { case "Ignore": objPortalController.ParseTemplate(PortalId, Globals.HostMapPath, strTemplateFile, PortalSettings.AdministratorId, PortalTemplateModuleAction.Ignore, false); break; case "Replace": objPortalController.ParseTemplate(PortalId, Globals.HostMapPath, strTemplateFile, PortalSettings.AdministratorId, PortalTemplateModuleAction.Replace, false); break; case "Merge": objPortalController.ParseTemplate(PortalId, Globals.HostMapPath, strTemplateFile, PortalSettings.AdministratorId, PortalTemplateModuleAction.Merge, false); break; } } // update Portal info in the database PortalInfo objPortal = objPortalController.GetPortal(PortalId); objPortal.Description = txtDescription.Text; objPortal.KeyWords = txtKeyWords.Text; objPortal.PortalName = txtPortalName.Text; objPortal.LogoFile = urlLogo.Url; objPortalController.UpdatePortalInfo(objPortal); //Set Portal Skin SkinController.SetSkin(SkinInfo.RootSkin, PortalId, SkinType.Portal, ctlPortalSkin.SkinSrc); SkinController.SetSkin(SkinInfo.RootSkin, PortalId, SkinType.Admin, ctlPortalSkin.SkinSrc); //Set Portal Container SkinController.SetSkin(SkinInfo.RootContainer, PortalId, SkinType.Portal, ctlPortalContainer.SkinSrc); SkinController.SetSkin(SkinInfo.RootContainer, PortalId, SkinType.Admin, ctlPortalContainer.SkinSrc); }
protected void updateButton_Click(object sender, EventArgs e) { PortalController.UpdatePortalSetting(ModuleContext.PortalId, "EnableBrowserLanguage", chkBrowser.Checked.ToString()); PortalController.UpdatePortalSetting(ModuleContext.PortalId, "AllowUserUICulture", chkUserCulture.Checked.ToString()); // if contentlocalization is enabled, default language cannot be changed if (!PortalSettings.ContentLocalizationEnabled) { // first check whether or not portal default language has changed string newDefaultLanguage = languagesComboBox.SelectedValue; if (newDefaultLanguage != PortalSettings.DefaultLanguage) { var needToRemoveOldDefaultLanguage = LocaleController.Instance.GetLocales(PortalId).Count == 1; var OldDefaultLanguage = LocaleController.Instance.GetLocale(PortalDefault); if (!IsLanguageEnabled(newDefaultLanguage)) { var language = LocaleController.Instance.GetLocale(newDefaultLanguage); Localization.AddLanguageToPortal(ModuleContext.PortalId, language.LanguageId, true); } // update portal default language var objPortalController = new PortalController(); PortalInfo objPortal = objPortalController.GetPortal(PortalId); objPortal.DefaultLanguage = newDefaultLanguage; objPortalController.UpdatePortalInfo(objPortal); _PortalDefault = newDefaultLanguage; if (needToRemoveOldDefaultLanguage) { Localization.RemoveLanguageFromPortal(PortalId, OldDefaultLanguage.LanguageId); } } PortalController.UpdatePortalSetting(ModuleContext.PortalId, "EnableUrlLanguage", chkUrl.Checked.ToString()); } BindDefaultLanguageSelector(); BindGrid(); }
/// <summary> /// cmdUpdate_Click runs when the Update LinkButton is clicked. /// It saves the current Site Settings /// </summary> /// <history> /// [cnurse] 9/9/2004 Modified /// </history> protected void cmdUpdate_Click( object sender, EventArgs e ) { try { string strLogo; string strBackground; strLogo = ctlLogo.Url; strBackground = ctlBackground.Url; double dblHostFee = 0; if( !String.IsNullOrEmpty( txtHostFee.Text ) ) { dblHostFee = double.Parse( txtHostFee.Text ); } double dblHostSpace = 0; if( !String.IsNullOrEmpty( txtHostSpace.Text ) ) { dblHostSpace = double.Parse( txtHostSpace.Text ); } int intPageQuota = 0; if( txtPageQuota.Text != "" ) { intPageQuota = int.Parse( txtPageQuota.Text ); } double intUserQuota = 0; if( txtUserQuota.Text != "" ) { intUserQuota = int.Parse( txtUserQuota.Text ); } int intSiteLogHistory = - 1; if( !String.IsNullOrEmpty( txtSiteLogHistory.Text ) ) { intSiteLogHistory = int.Parse( txtSiteLogHistory.Text ); } DateTime datExpiryDate = Null.NullDate; if( !String.IsNullOrEmpty( txtExpiryDate.Text ) ) { datExpiryDate = Convert.ToDateTime( txtExpiryDate.Text ); } int intSplashTabId = Null.NullInteger; if( cboSplashTabId.SelectedItem != null ) { intSplashTabId = int.Parse( cboSplashTabId.SelectedItem.Value ); } int intHomeTabId = Null.NullInteger; if( cboHomeTabId.SelectedItem != null ) { intHomeTabId = int.Parse( cboHomeTabId.SelectedItem.Value ); } int intLoginTabId = Null.NullInteger; if( cboLoginTabId.SelectedItem != null ) { intLoginTabId = int.Parse( cboLoginTabId.SelectedItem.Value ); } int intUserTabId = Null.NullInteger; if( cboUserTabId.SelectedItem != null ) { intUserTabId = int.Parse( cboUserTabId.SelectedItem.Value ); } if( txtPassword.Attributes["value"] != null ) { txtPassword.Attributes["value"] = txtPassword.Text; } // update Portal info in the database PortalController objPortalController = new PortalController(); //check only relevant fields altered if( ! UserInfo.IsSuperUser ) { PortalInfo objPortal = objPortalController.GetPortal( intPortalId ); bool HostChanged = false; if( dblHostFee != objPortal.HostFee ) { HostChanged = true; } if( dblHostSpace != objPortal.HostSpace ) { HostChanged = true; } if( intPageQuota != objPortal.PageQuota ) { HostChanged = true; } if( intUserQuota != objPortal.UserQuota ) { HostChanged = true; } if( intSiteLogHistory != objPortal.SiteLogHistory ) { HostChanged = true; } if( datExpiryDate != objPortal.ExpiryDate ) { HostChanged = true; } if( HostChanged ) { throw new Exception(); } } objPortalController.UpdatePortalInfo( intPortalId, txtPortalName.Text, strLogo, txtFooterText.Text, datExpiryDate, optUserRegistration.SelectedIndex, optBannerAdvertising.SelectedIndex, cboCurrency.SelectedItem.Value, Convert.ToInt32( cboAdministratorId.SelectedItem.Value ), dblHostFee, dblHostSpace, intPageQuota, (int)intUserQuota, ( ( cboProcessor.SelectedValue == "" ) ? "" : cboProcessor.SelectedItem.Text ).ToString(), txtUserId.Text, txtPassword.Text, txtDescription.Text, txtKeyWords.Text, strBackground, intSiteLogHistory, intSplashTabId, intHomeTabId, intLoginTabId, intUserTabId, cboDefaultLanguage.SelectedValue, Convert.ToInt32( cboTimeZone.SelectedValue ), txtHomeDirectory.Text ); bool blnAdminSkinChanged = SkinChanged( SkinInfo.RootSkin, PortalId, SkinType.Admin, ctlAdminSkin.SkinSrc ) || SkinChanged( SkinInfo.RootContainer, PortalId, SkinType.Admin, ctlAdminContainer.SkinSrc ); //Dim objSkins As New UI.Skins.SkinController SkinController.SetSkin( SkinInfo.RootSkin, PortalId, SkinType.Portal, ctlPortalSkin.SkinSrc ); SkinController.SetSkin( SkinInfo.RootContainer, PortalId, SkinType.Portal, ctlPortalContainer.SkinSrc ); SkinController.SetSkin( SkinInfo.RootSkin, PortalId, SkinType.Admin, ctlAdminSkin.SkinSrc ); SkinController.SetSkin( SkinInfo.RootContainer, PortalId, SkinType.Admin, ctlAdminContainer.SkinSrc ); if( UserInfo.IsSuperUser ) { // delete old portal module assignments DesktopModuleController objDesktopModules = new DesktopModuleController(); objDesktopModules.DeletePortalDesktopModules( intPortalId, Null.NullInteger ); // add new portal module assignments foreach( ListItem objListItem in ctlDesktopModules.Assigned ) { objDesktopModules.AddPortalDesktopModule( intPortalId, int.Parse( objListItem.Value ) ); } } // Redirect to this site to refresh only if admin skin changed if( blnAdminSkinChanged ) { Response.Redirect( Request.RawUrl, true ); } } catch( Exception exc ) //Module failed to load { Exceptions.ProcessModuleLoadException( this, exc ); } }