public void MustHaveEmptyHelpUrlForHtmlModule() { var control = ModuleControlController.GetModuleControlByControlKey("", 111); control.HelpURL = ""; ModuleControlController.UpdateModuleControl(control); }
protected override void RegisterModules(PaFolder Folder, ArrayList Modules, ArrayList Controls) { InstallerInfo.Log.AddInfo(REGISTER_Controls); ModuleControlController objModuleControls = new ModuleControlController(); ModuleControlInfo objModuleControl; foreach (ModuleControlInfo tempLoopVar_objModuleControl in Controls) { objModuleControl = tempLoopVar_objModuleControl; // Skins Objects have a null ModuleDefID objModuleControl.ModuleDefID = Null.NullInteger; // check if control exists ModuleControlInfo objModuleControl2 = objModuleControls.GetModuleControlByKeyAndSrc(Null.NullInteger, objModuleControl.ControlKey, objModuleControl.ControlSrc); if (objModuleControl2 == null) { // add new control objModuleControls.AddModuleControl(objModuleControl); } else { // update existing control objModuleControl.ModuleControlID = objModuleControl2.ModuleControlID; objModuleControls.UpdateModuleControl(objModuleControl); } } InstallerInfo.Log.EndJob(REGISTER_End); }
public void MustHaveHelpUrlFilledOutForHtmlModule() { var moduleDefId = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("Text/HTML").ModuleDefID; var control = ModuleControlController.GetModuleControlByControlKey("", moduleDefId); control.HelpURL = "http://hive.dotnetnuke.com/Default.aspx?tabid=283"; ModuleControlController.UpdateModuleControl(control); }
private static void EnsureEditScriptControlIsRegistered(int moduleDefId) { if (ModuleControlController.GetModuleControlByControlKey("EditRazorScript", moduleDefId) != null) { return; } var m = new ModuleControlInfo { ControlKey = "EditRazorScript", ControlSrc = "DesktopModules/RazorModules/RazorHost/EditScript.ascx", ControlTitle = "Edit Script", ControlType = SecurityAccessLevel.Host, ModuleDefID = moduleDefId }; ModuleControlController.UpdateModuleControl(m); }
private void EnsureEditScriptControlIsRegistered() { var moduleDefId = this.ParentModule.ModuleConfiguration.ModuleDefID; if (ReferenceEquals(ModuleControlController.GetModuleControlByControlKey("EditRazorScript", moduleDefId), null)) { var m = default(ModuleControlInfo); m = new ModuleControlInfo { ControlKey = "EditRazorScript", ControlSrc = "DesktopModules/RazorModules/RazorHost/EditScript.ascx", ControlTitle = "Edit Script", ControlType = SecurityAccessLevel.Host, ModuleDefID = moduleDefId }; ModuleControlController.UpdateModuleControl(m); } }
private static void DoIUpgradeable(PortalInfo pinfo) { UserInfo uInfo = UserController.Instance.GetCurrentUserInfo(); IFolderInfo fi = FolderManager.Instance.GetFolder(pinfo.PortalID, "Images/"); #region Copy Vthemes in portal folder string BaseEditorFolder = HttpContext.Current.Server.MapPath("~/Portals/_default/vThemes/" + ThemeManager.GetCurrentThemeName(pinfo.PortalID) + "/editor"); Copy(BaseEditorFolder, BaseEditorFolder.Replace("_default", pinfo.PortalID.ToString())); try { ThemeManager.ProcessScss(pinfo.PortalID); } catch (Exception ex) { DotNetNuke.Services.Exceptions.Exceptions.LogException(ex); } string UXManagervDefaultPath = HttpContext.Current.Request.PhysicalApplicationPath + "DesktopModules\\Vanjaro\\Core\\Library\\Images"; if (Directory.Exists(UXManagervDefaultPath) && fi != null) { DirectoryInfo source = new DirectoryInfo(UXManagervDefaultPath); foreach (System.IO.FileInfo _file in source.GetFiles()) { if (!FileManager.Instance.FileExists(fi, _file.Name)) { FileStream stream = new FileStream(_file.FullName, FileMode.Open, FileAccess.Read); FileManager.Instance.AddFile(fi, _file.Name, stream); } } } #endregion bool IsVanjaroInstalled = PortalController.Instance.GetPortalSettings(pinfo.PortalID).ContainsKey("IsVanjaroInstalled"); if (IsDistribution(pinfo.PortalID)) { HostController.Instance.Update("ControlPanel", "DesktopModules/Vanjaro/UXManager/Library/Base.ascx"); #region Add Signup TabController controller = new TabController(); if (TabController.Instance.GetTabByName("Signup", pinfo.PortalID) == null) { TabInfo NewSignupTab = new TabInfo { PortalID = pinfo.PortalID, TabName = "Signup", IsVisible = false }; TabController.Instance.AddTab(NewSignupTab); } #endregion #region Removing Subscribers RoleInfo rInfo = RoleController.Instance.GetRoleByName(pinfo.PortalID, "Subscribers"); if (rInfo != null) { RoleController.Instance.DeleteRole(rInfo); } #endregion #region Applying Home and Signup layout List <Layout> pageLayouts = GetLayouts(pinfo); TabInfo HomeTab = TabController.Instance.GetTabByName("Home", pinfo.PortalID); Layout homelayout = pageLayouts.Where(a => a.Name == "Home").FirstOrDefault(); PortalSettings portalSettings = new PortalSettings(pinfo); if (HomeTab != null && homelayout != null && portalSettings != null) { ProcessBlocks(pinfo.PortalID, homelayout.Blocks); if (portalSettings.ActiveTab == null) { portalSettings.ActiveTab = new TabInfo(); } portalSettings.ActiveTab.TabID = HomeTab.TabID; PortalController.UpdatePortalSetting(pinfo.PortalID, "Redirect_AfterLogin", HomeTab.TabID.ToString(), false, portalSettings.CultureCode, false); Dictionary <string, object> LayoutData = new Dictionary <string, object> { ["IsPublished"] = false, ["Comment"] = string.Empty, ["gjs-assets"] = string.Empty, ["gjs-css"] = Managers.PageManager.DeTokenizeLinks(homelayout.Style.ToString(), pinfo.PortalID), ["gjs-html"] = Managers.PageManager.DeTokenizeLinks(homelayout.Content.ToString(), pinfo.PortalID), ["gjs-components"] = Managers.PageManager.DeTokenizeLinks(homelayout.ContentJSON.ToString(), pinfo.PortalID), ["gjs-styles"] = Managers.PageManager.DeTokenizeLinks(homelayout.StyleJSON.ToString(), pinfo.PortalID) }; Core.Managers.PageManager.Update(portalSettings, LayoutData); Pages Page = Managers.PageManager.GetPages(HomeTab.TabID).OrderByDescending(o => o.Version).FirstOrDefault(); if (Page != null && uInfo != null) { WorkflowState state = WorkflowManager.GetStateByID(Page.StateID.Value); Page.Version = 1; Page.StateID = state != null?WorkflowManager.GetLastStateID(state.WorkflowID).StateID : 2; Page.IsPublished = true; Page.PublishedBy = uInfo.UserID; Page.PublishedOn = DateTime.UtcNow; PageFactory.Update(Page, uInfo.UserID); } pinfo.HomeTabId = HomeTab != null && !HomeTab.IsDeleted ? HomeTab.TabID : Null.NullInteger; } TabInfo SignUpTab = TabController.Instance.GetTabByName("Signup", pinfo.PortalID); Layout Signuplayout = pageLayouts.Where(a => a.Name == "Signup").FirstOrDefault(); if (SignUpTab != null && Signuplayout != null && portalSettings != null) { ProcessBlocks(pinfo.PortalID, homelayout.Blocks); if (portalSettings.ActiveTab == null) { portalSettings.ActiveTab = new TabInfo(); } portalSettings.ActiveTab.TabID = SignUpTab.TabID; Dictionary <string, object> LayoutData = new Dictionary <string, object> { ["IsPublished"] = false, ["Comment"] = string.Empty, ["gjs-assets"] = string.Empty, ["gjs-css"] = Managers.PageManager.DeTokenizeLinks(Signuplayout.Style.ToString(), pinfo.PortalID), ["gjs-html"] = Managers.PageManager.DeTokenizeLinks(Signuplayout.Content.ToString(), pinfo.PortalID), ["gjs-components"] = Managers.PageManager.DeTokenizeLinks(Signuplayout.ContentJSON.ToString(), pinfo.PortalID), ["gjs-styles"] = Managers.PageManager.DeTokenizeLinks(Signuplayout.StyleJSON.ToString(), pinfo.PortalID) }; Core.Managers.PageManager.Update(portalSettings, LayoutData); Pages Page = Managers.PageManager.GetPages(SignUpTab.TabID).OrderByDescending(o => o.Version).FirstOrDefault(); if (Page != null && uInfo != null) { WorkflowState state = WorkflowManager.GetStateByID(Page.StateID.Value); Page.Version = 1; Page.StateID = state != null?WorkflowManager.GetLastStateID(state.WorkflowID).StateID : 2; Page.IsPublished = true; Page.PublishedBy = uInfo.UserID; Page.PublishedOn = DateTime.UtcNow; PageFactory.Update(Page, uInfo.UserID); } } TabInfo NotFoundTab = TabController.Instance.GetTabByName("404 Error Page", pinfo.PortalID); Layout NotFoundPagelayout = pageLayouts.Where(a => a.Name == "NotFoundPage").FirstOrDefault(); if (NotFoundTab != null && NotFoundPagelayout != null && portalSettings != null) { ProcessBlocks(pinfo.PortalID, homelayout.Blocks); if (portalSettings.ActiveTab == null) { portalSettings.ActiveTab = new TabInfo(); } portalSettings.ActiveTab.TabID = NotFoundTab.TabID; Dictionary <string, object> LayoutData = new Dictionary <string, object> { ["IsPublished"] = false, ["Comment"] = string.Empty, ["gjs-assets"] = string.Empty, ["gjs-css"] = Managers.PageManager.DeTokenizeLinks(NotFoundPagelayout.Style.ToString(), pinfo.PortalID), ["gjs-html"] = Managers.PageManager.DeTokenizeLinks(NotFoundPagelayout.Content.ToString(), pinfo.PortalID), ["gjs-components"] = Managers.PageManager.DeTokenizeLinks(NotFoundPagelayout.ContentJSON.ToString(), pinfo.PortalID), ["gjs-styles"] = Managers.PageManager.DeTokenizeLinks(NotFoundPagelayout.StyleJSON.ToString(), pinfo.PortalID) }; Core.Managers.PageManager.Update(portalSettings, LayoutData); Pages Page = Managers.PageManager.GetPages(NotFoundTab.TabID).OrderByDescending(o => o.Version).FirstOrDefault(); if (Page != null && uInfo != null) { WorkflowState state = WorkflowManager.GetStateByID(Page.StateID.Value); Page.Version = 1; Page.StateID = state != null?WorkflowManager.GetLastStateID(state.WorkflowID).StateID : 2; Page.IsPublished = true; Page.PublishedBy = uInfo.UserID; Page.PublishedOn = DateTime.UtcNow; PageFactory.Update(Page, uInfo.UserID); } pinfo.Custom404TabId = NotFoundTab.TabID; } TabInfo ProfileTab = TabController.Instance.GetTabByName("Profile", pinfo.PortalID); Layout Profilelayout = pageLayouts.Where(a => a.Name == "Profile").FirstOrDefault(); if (ProfileTab != null && Profilelayout != null && portalSettings != null) { ProfileTab.ParentId = TabController.Instance.GetTabByName("User", pinfo.PortalID).TabID; TabController.Instance.UpdateTab(ProfileTab); ProcessBlocks(pinfo.PortalID, homelayout.Blocks); pinfo.UserTabId = ProfileTab.TabID; if (portalSettings.ActiveTab == null) { portalSettings.ActiveTab = new TabInfo(); } portalSettings.ActiveTab.TabID = ProfileTab.TabID; Dictionary <string, object> LayoutData = new Dictionary <string, object> { ["IsPublished"] = false, ["Comment"] = string.Empty, ["gjs-assets"] = string.Empty, ["gjs-css"] = Managers.PageManager.DeTokenizeLinks(Profilelayout.Style.ToString(), pinfo.PortalID), ["gjs-html"] = Managers.PageManager.DeTokenizeLinks(Profilelayout.Content.ToString(), pinfo.PortalID), ["gjs-components"] = Managers.PageManager.DeTokenizeLinks(Profilelayout.ContentJSON.ToString(), pinfo.PortalID), ["gjs-styles"] = Managers.PageManager.DeTokenizeLinks(Profilelayout.StyleJSON.ToString(), pinfo.PortalID) }; Core.Managers.PageManager.Update(portalSettings, LayoutData); Pages Page = Managers.PageManager.GetPages(ProfileTab.TabID).OrderByDescending(o => o.Version).FirstOrDefault(); if (Page != null && uInfo != null) { WorkflowState state = WorkflowManager.GetStateByID(Page.StateID.Value); Page.Version = 1; Page.StateID = state != null?WorkflowManager.GetLastStateID(state.WorkflowID).StateID : 2; Page.IsPublished = true; Page.PublishedBy = uInfo.UserID; Page.PublishedOn = DateTime.UtcNow; PageFactory.Update(Page, uInfo.UserID); } } TabInfo SearchResultTab = TabController.Instance.GetTabByName("Search Results", pinfo.PortalID); Layout SearchResultlayout = pageLayouts.Where(a => a.Name == "SearchResults").FirstOrDefault(); if (SearchResultTab != null && SearchResultlayout != null && portalSettings != null) { ProcessBlocks(pinfo.PortalID, homelayout.Blocks); if (portalSettings.ActiveTab == null) { portalSettings.ActiveTab = new TabInfo(); } portalSettings.ActiveTab.TabID = SearchResultTab.TabID; Dictionary <string, object> LayoutData = new Dictionary <string, object> { ["IsPublished"] = false, ["Comment"] = string.Empty, ["gjs-assets"] = string.Empty, ["gjs-css"] = Managers.PageManager.DeTokenizeLinks(SearchResultlayout.Style.ToString(), pinfo.PortalID), ["gjs-html"] = Managers.PageManager.DeTokenizeLinks(SearchResultlayout.Content.ToString(), pinfo.PortalID), ["gjs-components"] = Managers.PageManager.DeTokenizeLinks(SearchResultlayout.ContentJSON.ToString(), pinfo.PortalID), ["gjs-styles"] = Managers.PageManager.DeTokenizeLinks(SearchResultlayout.StyleJSON.ToString(), pinfo.PortalID) }; Core.Managers.PageManager.Update(portalSettings, LayoutData); Pages Page = Managers.PageManager.GetPages(SearchResultTab.TabID).OrderByDescending(o => o.Version).FirstOrDefault(); if (Page != null && uInfo != null) { WorkflowState state = WorkflowManager.GetStateByID(Page.StateID.Value); Page.Version = 1; Page.StateID = state != null?WorkflowManager.GetLastStateID(state.WorkflowID).StateID : 2; Page.IsPublished = true; Page.PublishedBy = uInfo.UserID; Page.PublishedOn = DateTime.UtcNow; PageFactory.Update(Page, uInfo.UserID); } } #endregion #region Update Default SignUp Tab and Search Results page pinfo.RegisterTabId = SignUpTab != null && !SignUpTab.IsDeleted ? SignUpTab.TabID : Null.NullInteger; pinfo.LogoFile = fi.FolderPath + "vanjaro_logo.png"; pinfo.SearchTabId = SearchResultTab != null && !SearchResultTab.IsDeleted ? SearchResultTab.TabID : Null.NullInteger; #endregion #region Update SEO Settings List <StringValue> SeoSettings = new List <StringValue> { new StringValue { Text = FriendlyUrlSettings.ReplaceSpaceWithSetting, Value = "-" }, new StringValue { Text = FriendlyUrlSettings.DeletedTabHandlingTypeSetting, Value = "Do404Error" }, new StringValue { Text = FriendlyUrlSettings.ForceLowerCaseSetting, Value = "Y" }, new StringValue { Text = FriendlyUrlSettings.RedirectUnfriendlySetting, Value = "Y" }, new StringValue { Text = FriendlyUrlSettings.RedirectMixedCaseSetting, Value = "True" }, new StringValue { Text = FriendlyUrlSettings.UsePortalDefaultLanguageSetting, Value = "True" }, new StringValue { Text = FriendlyUrlSettings.AutoAsciiConvertSetting, Value = "False" }, new StringValue { Text = "DefaultIconLocation", Value = "icons/Font Awesome" }, }; UpdatePortalSettings(SeoSettings, pinfo.PortalID, uInfo.UserID); #endregion } if (!IsVanjaroInstalled) { #region Signin Tab if (pinfo.LoginTabId == -1) { if (TabController.Instance.GetTabByName("Signin", pinfo.PortalID) == null) { TabController tab = new TabController(); TabInfo NewSigninTab = new TabInfo { PortalID = pinfo.PortalID, TabName = "Signin", IsVisible = false }; int NewSigninTabID = TabController.Instance.AddTab(NewSigninTab); NewSigninTab = tab.GetTab(NewSigninTabID, pinfo.PortalID); if (NewSigninTab.TabPermissions.Where(t => t != null && t.RoleName == "All Users").FirstOrDefault() != null) { foreach (TabPermissionInfo p in NewSigninTab.TabPermissions.Where(t => t != null && t.RoleName == "All Users")) { if (p.PermissionKey.ToLower() == "view") { p.AllowAccess = true; } else { p.AllowAccess = false; } } } else { NewSigninTab.TabPermissions.Add(new TabPermissionInfo { PermissionID = 3, TabID = NewSigninTab.TabID, AllowAccess = true, RoleID = -1, RoleName = "All Users", }); } TabPermissionController.SaveTabPermissions(NewSigninTab); NewSigninTab.SkinSrc = "[g]skins/vanjaro/base.ascx"; NewSigninTab.ContainerSrc = "[g]containers/vanjaro/base.ascx"; tab.UpdateTab(NewSigninTab); } List <Layout> pageLayouts = GetLayouts(pinfo); TabInfo SigninTab = TabController.Instance.GetTabByName("Signin", pinfo.PortalID); Layout Signinlayout = pageLayouts.Where(a => a.Name == "Signin").FirstOrDefault(); PortalSettings portalSettings = new PortalSettings(pinfo); Layout homelayout = pageLayouts.Where(a => a.Name == "Home").FirstOrDefault(); if (SigninTab != null && Signinlayout != null && portalSettings != null) { ProcessBlocks(pinfo.PortalID, homelayout.Blocks); if (portalSettings.ActiveTab == null) { portalSettings.ActiveTab = new TabInfo(); } portalSettings.ActiveTab.TabID = SigninTab.TabID; Dictionary <string, object> LayoutData = new Dictionary <string, object> { ["IsPublished"] = false, ["Comment"] = string.Empty, ["gjs-assets"] = string.Empty, ["gjs-css"] = Managers.PageManager.DeTokenizeLinks(Signinlayout.Style.ToString(), pinfo.PortalID), ["gjs-html"] = Managers.PageManager.DeTokenizeLinks(Signinlayout.Content.ToString(), pinfo.PortalID), ["gjs-components"] = Managers.PageManager.DeTokenizeLinks(Signinlayout.ContentJSON.ToString(), pinfo.PortalID), ["gjs-styles"] = Managers.PageManager.DeTokenizeLinks(Signinlayout.StyleJSON.ToString(), pinfo.PortalID) }; Core.Managers.PageManager.Update(portalSettings, LayoutData); Pages Page = Managers.PageManager.GetPages(SigninTab.TabID).OrderByDescending(o => o.Version).FirstOrDefault(); if (Page != null && uInfo != null) { WorkflowState state = WorkflowManager.GetStateByID(Page.StateID.Value); Page.Version = 1; Page.StateID = state != null?WorkflowManager.GetLastStateID(state.WorkflowID).StateID : 2; Page.IsPublished = true; Page.PublishedBy = uInfo.UserID; Page.PublishedOn = DateTime.UtcNow; PageFactory.Update(Page, uInfo.UserID); } } if (SigninTab != null) { Core.Managers.LoginManager.AddUpdateLoginModule(SigninTab.TabID, pinfo.PortalID); } pinfo.LoginTabId = SigninTab != null && !SigninTab.IsDeleted ? SigninTab.TabID : Null.NullInteger; } #endregion #region Update Portal Settings IFileInfo file; if (fi != null) { if (FileManager.Instance.FileExists(fi, "vanjaro_social.png") && !PortalController.Instance.GetPortalSettings(pinfo.PortalID).ContainsKey("SocialSharingLogo")) { file = FileManager.Instance.GetFile(fi, "vanjaro_social.png"); PortalController.UpdatePortalSetting(pinfo.PortalID, "SocialSharingLogo", "FileID=" + file.FileId, true, pinfo.CultureCode); } if (FileManager.Instance.FileExists(fi, "vanjaro_home.png") && !PortalController.Instance.GetPortalSettings(pinfo.PortalID).ContainsKey("HomeScreenIcon")) { file = FileManager.Instance.GetFile(fi, "vanjaro_home.png"); PortalController.UpdatePortalSetting(pinfo.PortalID, "HomeScreenIcon", "FileID=" + file.FileId, true, pinfo.CultureCode); } } PortalController.Instance.UpdatePortalInfo(pinfo); List <StringValue> SettingNameValue = new List <StringValue> { new StringValue { Text = "DNN_Enabled", Value = "False" }, new StringValue { Text = "Registration_UseEmailAsUserName", Value = "True" }, new StringValue { Text = "ClientResourcesManagementMode", Value = "p" }, new StringValue { Text = DotNetNuke.Web.Client.ClientResourceSettings.EnableCompositeFilesKey, Value = "True" }, new StringValue { Text = DotNetNuke.Web.Client.ClientResourceSettings.MinifyCssKey, Value = "True" }, new StringValue { Text = DotNetNuke.Web.Client.ClientResourceSettings.MinifyJsKey, Value = "True" }, new StringValue { Text = DotNetNuke.Web.Client.ClientResourceSettings.OverrideDefaultSettingsKey, Value = "True" }, }; int CrmVersion = Host.CrmVersion + 1; SettingNameValue.Add(new StringValue { Text = DotNetNuke.Web.Client.ClientResourceSettings.VersionKey, Value = CrmVersion.ToString() }); UpdatePortalSettings(SettingNameValue, pinfo.PortalID, uInfo.UserID); #endregion } #region Delete Unnecessary Files string LayoutPath = HttpContext.Current.Server.MapPath("~/Portals/" + pinfo.PortalID + "/vThemes/" + Core.Managers.ThemeManager.GetCurrentThemeName(pinfo.PortalID) + "/templates"); if (Directory.Exists(LayoutPath)) { Directory.Delete(LayoutPath, true); } #endregion #region Update ResetPassword module control ModuleControlInfo passwordResetModuleControlInfo = ModuleControlController.GetModuleControlByControlKey("PasswordReset", Null.NullInteger); if (passwordResetModuleControlInfo != null) { passwordResetModuleControlInfo.ControlSrc = "DesktopModules/Vanjaro/Core/Providers/Authentication/PasswordReset.ascx"; } ModuleControlController.UpdateModuleControl(passwordResetModuleControlInfo); ModuleControlInfo registerModuleControlInfo = ModuleControlController.GetModuleControlByControlKey("Register", Null.NullInteger); registerModuleControlInfo.ControlSrc = "DesktopModules/Vanjaro/Core/Providers/Authentication/Register.ascx"; if (registerModuleControlInfo != null) { ModuleControlController.UpdateModuleControl(registerModuleControlInfo); } #endregion if (IsDistribution(pinfo.PortalID)) { SoftDeleteModule(pinfo.PortalID, Components.Constants.SearchResult); } if (!IsVanjaroInstalled) { PortalController.UpdatePortalSetting(pinfo.PortalID, "IsVanjaroInstalled", "-1"); } if (fi != null) { UpdateValue(pinfo.PortalID, 0, "security_settings", "Picture_DefaultFolder", fi.FolderID.ToString()); } }
protected void btnUpdate_Click(object sender, EventArgs e) { try { if (controlId == 0) // add control { if (txtControlKey.Text != string.Empty && ModuleControlController.CheckExistsControlKey(txtControlKey.Text)) { this.lblUpdateStatus.Text = MiscUtility.MSG_CONTROKEY_EXISTS; return; } ModuleInfo module = ModuleController.GetModule(moduleId); if (module == null) { return; } ModuleControlInfo moduleControl = new ModuleControlInfo(); moduleControl.ModuleID = module.ModuleID; moduleControl.ControlName = txtControlName.Text.Trim(); moduleControl.ControlKey = txtControlKey.Text.Trim(); moduleControl.ControlPath = dropPath.SelectedValue; moduleControl.ControlIcon = txtControlIcon.Text.Trim(); moduleControl.ControlOrder = ConvertUtility.ToInt32(dropControlOrder.SelectedValue); moduleControl.ControlHeader = chkControlHeader.Checked; string roleList = "|"; foreach (ListItem item in chkControlType.Items) { if (item.Selected) { roleList += item.Value + "|"; } } if (roleList.Length < 2) { roleList = string.Empty; } moduleControl.ControlTitle = txtControlTitle.Text; moduleControl.ControlRole = roleList; moduleControl.ControlDescription = txtControlDescription.Text.Trim(); ModuleControlController.AddModuleControl(moduleControl); } else // update control { ModuleControlInfo moduleControl = ModuleControlController.GetModuleControl(controlId); moduleControl.ControlName = txtControlName.Text.Trim(); moduleControl.ControlDescription = txtControlDescription.Text; moduleControl.ControlKey = txtControlKey.Text.Trim(); moduleControl.ControlPath = dropPath.SelectedValue; moduleControl.ControlIcon = txtControlIcon.Text.Trim(); moduleControl.ControlOrder = ConvertUtility.ToInt32(dropControlOrder.SelectedValue); string roleList = "|"; foreach (ListItem item in chkControlType.Items) { if (item.Selected) { roleList += item.Value + "|"; } } //if (roleList.Length < 2) roleList = string.Empty; moduleControl.ControlRole = roleList; moduleControl.ControlDescription = txtControlDescription.Text.Trim(); moduleControl.ControlHeader = chkControlHeader.Checked; ModuleControlController.UpdateModuleControl(moduleControl); } this.lblUpdateStatus.Text = MiscUtility.MSG_UPDATE_SUCCESS; } catch (Exception ex) { Response.Write(ex.Message); } }
protected virtual void RegisterModules(PaFolder Folder, ArrayList Modules, ArrayList Controls) { InstallerInfo.Log.StartJob(REGISTER_Module); DesktopModuleController objDesktopModules = new DesktopModuleController(); // check if desktop module exists DesktopModuleInfo objDesktopModule = GetDesktopModule(Folder); if (objDesktopModule == null) { objDesktopModule = new DesktopModuleInfo(); objDesktopModule.DesktopModuleID = Null.NullInteger; } objDesktopModule = GetDesktopModuleSettings(objDesktopModule, Folder); if (Null.IsNull(objDesktopModule.DesktopModuleID)) { // new desktop module objDesktopModule.DesktopModuleID = objDesktopModules.AddDesktopModule(objDesktopModule); } else { // existing desktop module objDesktopModules.UpdateDesktopModule(objDesktopModule); } InstallerInfo.Log.AddInfo(REGISTER_Definition); ModuleDefinitionController objModuleDefinitons = new ModuleDefinitionController(); foreach (ModuleDefinitionInfo objModuleDefinition in Modules) { // check if definition exists ModuleDefinitionInfo objModuleDefinition2 = objModuleDefinitons.GetModuleDefinitionByName(objDesktopModule.DesktopModuleID, objModuleDefinition.FriendlyName); if (objModuleDefinition2 == null) { // add new definition objModuleDefinition.DesktopModuleID = objDesktopModule.DesktopModuleID; objModuleDefinition.ModuleDefID = objModuleDefinitons.AddModuleDefinition(objModuleDefinition); } else { // update existing definition objModuleDefinition.ModuleDefID = objModuleDefinition2.ModuleDefID; objModuleDefinitons.UpdateModuleDefinition(objModuleDefinition); } } InstallerInfo.Log.AddInfo(REGISTER_Controls); ModuleControlController objModuleControls = new ModuleControlController(); foreach (ModuleControlInfo objModuleControl in Controls) { // get the real ModuleDefID from the associated Module objModuleControl.ModuleDefID = GetModDefID(objModuleControl.ModuleDefID, Modules); // check if control exists ModuleControlInfo objModuleControl2 = objModuleControls.GetModuleControlByKeyAndSrc(objModuleControl.ModuleDefID, objModuleControl.ControlKey, objModuleControl.ControlSrc); if (objModuleControl2 == null) { // add new control objModuleControls.AddModuleControl(objModuleControl); } else { // update existing control objModuleControl.ModuleControlID = objModuleControl2.ModuleControlID; objModuleControls.UpdateModuleControl(objModuleControl); } } InstallerInfo.Log.EndJob(REGISTER_End); UpgradeModule(objDesktopModule); }
/// <summary> /// cmdUpdate_Click runs when the Update Button is clicked /// </summary> /// <returns></returns> /// <remarks> /// </remarks> /// <history> /// [cnurse] 9/28/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> protected void cmdUpdate_Click(object sender, EventArgs e) { try { if (Page.IsValid) { ModuleControlInfo objModuleControl = new ModuleControlInfo(); objModuleControl.ModuleControlID = ModuleControlId; objModuleControl.ModuleDefID = ModuleDefId; if (!String.IsNullOrEmpty(txtKey.Text)) { objModuleControl.ControlKey = txtKey.Text; } else { objModuleControl.ControlKey = Null.NullString; } if (!String.IsNullOrEmpty(txtTitle.Text)) { objModuleControl.ControlTitle = txtTitle.Text; } else { objModuleControl.ControlTitle = Null.NullString; } objModuleControl.ControlSrc = cboSource.SelectedItem.Text; objModuleControl.ControlType = (SecurityAccessLevel)Enum.Parse(typeof(SecurityAccessLevel), cboType.SelectedItem.Value); if (!String.IsNullOrEmpty(txtViewOrder.Text)) { objModuleControl.ViewOrder = int.Parse(txtViewOrder.Text); } else { objModuleControl.ViewOrder = Null.NullInteger; } if (cboIcon.SelectedIndex > 0) { objModuleControl.IconFile = cboIcon.SelectedItem.Text; } else { objModuleControl.IconFile = Null.NullString; } if (!String.IsNullOrEmpty(txtHelpURL.Text)) { objModuleControl.HelpURL = txtHelpURL.Text; } else { objModuleControl.HelpURL = Null.NullString; } ModuleControlController objModuleControls = new ModuleControlController(); if (Null.IsNull(ModuleControlId)) { try { objModuleControls.AddModuleControl(objModuleControl); } catch { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("AddControl.ErrorMessage", this.LocalResourceFile), ModuleMessageType.RedError); return; } } else { objModuleControls.UpdateModuleControl(objModuleControl); } if (DesktopModuleId == -1) { DesktopModuleId = -2; } Response.Redirect(EditUrl("desktopmoduleid", DesktopModuleId.ToString()), true); } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }