public static void ModuleDataBind(DropDownList ddlModule, int PortalId, string LocalResourceFile, HttpServerUtility Server) { ddlModule.Items.Clear(); ddlModule.Items.Add(Localization.GetString("selectModule", LocalResourceFile)); DesktopModuleController mc = new DesktopModuleController(); var dtmLst = DesktopModuleController.GetDesktopModules(PortalId).Values.Where(m => !m.IsAdmin && !m.FolderName.StartsWith("Admin")); foreach (DesktopModuleInfo dtm in dtmLst) { bool TemplateExist = false; for (int i = 1; i < 4; i++) { string[] pathLst = GetPathList(dtm.FolderName, i, PortalId); foreach (string pathitem in pathLst) { if (Directory.Exists(Server.MapPath(pathitem))) { ddlModule.Items.Add(new ListItem(dtm.FriendlyName, dtm.FolderName)); TemplateExist = true; break; } } if (TemplateExist) { break; } } } ddlModule.Items.Add(new ListItem("Skins", "skins")); ddlModule.Items.Add(new ListItem("Containers", "containers")); ddlModule.Items.Add(new ListItem("Widgets", "widgets")); }
/// <summary> /// BindData fetches the data from the database and updates the controls /// </summary> /// <history> /// [cnurse] 9/28/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> public void BindData() { if (!Page.IsPostBack) { GetFeatures(); } if (Convert.ToString(Globals.HostSettings["CheckUpgrade"]) == "N") { lblUpdate.Visible = false; grdDefinitions.Columns[4].HeaderText = ""; } // Get the portal's defs from the database DesktopModuleController objDesktopModules = new DesktopModuleController(); ArrayList arr = objDesktopModules.GetDesktopModules(); DesktopModuleInfo objDesktopModule = new DesktopModuleInfo(); objDesktopModule.DesktopModuleID = -2; objDesktopModule.FriendlyName = Localization.GetString("SkinObjects"); objDesktopModule.Description = Localization.GetString("SkinObjectsDescription"); objDesktopModule.IsPremium = false; arr.Insert(0, objDesktopModule); //Localize Grid Localization.LocalizeDataGrid(ref grdDefinitions, this.LocalResourceFile); grdDefinitions.DataSource = arr; grdDefinitions.DataBind(); }
private void AddModuleToTab(TabInfo ti, DesktopModuleInfo dmi, string title = "", string paneName = "ContentPane", Dictionary <String, String> settings = null) { if (title == "") { title = dmi.ContentTitle; } PortalSettings ps = new PortalSettings(); int portalId = ps.PortalId; DesktopModuleInfo desktopModuleInfo = null; foreach (KeyValuePair <int, DesktopModuleInfo> kvp in DesktopModuleController.GetDesktopModules(portalId)) { DesktopModuleInfo mod = kvp.Value; if (mod != null) { if ((mod.FriendlyName == dmi.FriendlyName || mod.ModuleName == dmi.FriendlyName)) { desktopModuleInfo = mod; } } } if (desktopModuleInfo != null && ti != null) { foreach (ModuleDefinitionInfo moduleDefinitionInfo in ModuleDefinitionController.GetModuleDefinitionsByDesktopModuleID(desktopModuleInfo.DesktopModuleID).Values) { ModuleInfo moduleInfo = new ModuleInfo(); moduleInfo.PortalID = portalId; moduleInfo.TabID = ti.TabID; moduleInfo.ModuleOrder = 1; moduleInfo.ModuleTitle = title; moduleInfo.PaneName = paneName; moduleInfo.ModuleDefID = moduleDefinitionInfo.ModuleDefID; moduleInfo.CacheTime = moduleDefinitionInfo.DefaultCacheTime; moduleInfo.InheritViewPermissions = true; moduleInfo.AllTabs = false; ModuleController moduleController = new ModuleController(); if (settings != null) { foreach (KeyValuePair <String, String> kvp in settings) { if (kvp.Key.Contains("tabid")) { TabController tc = new TabController(); int id = tc.GetTabByName(kvp.Value, portalId).TabID; moduleInfo.ModuleSettings.Add(kvp.Key, id); moduleController.UpdateModuleSetting(moduleInfo.ModuleID, kvp.Key, "" + id); } else { moduleInfo.ModuleSettings.Add(kvp.Key, kvp.Value); moduleController.UpdateModuleSetting(moduleInfo.ModuleID, kvp.Key, kvp.Value); } } } int moduleId = moduleController.AddModule(moduleInfo); } } }
public static void ProcessLegacyModules() { foreach (DesktopModuleInfo desktopModule in DesktopModuleController.GetDesktopModules(Null.NullInteger).Values) { if (desktopModule.PackageID == Null.NullInteger) { string moduleFolder = Path.Combine(CommonLibrary.Common.Globals.ApplicationMapPath, Path.Combine("DesktopModules", desktopModule.FolderName)); XPathNavigator rootNav = null; try { string hostModules = "Portals, SQL, HostSettings, Scheduler, SearchAdmin, Lists, SkinDesigner, Extensions"; string[] files = Directory.GetFiles(moduleFolder, "*.dnn.config"); if (files.Length > 0) { XPathDocument doc = new XPathDocument(new FileStream(files[0], FileMode.Open, FileAccess.Read)); rootNav = doc.CreateNavigator().SelectSingleNode("CommonLibrary"); } PackageInfo package = new PackageInfo(new InstallerInfo()); package.Name = desktopModule.ModuleName; package.FriendlyName = desktopModule.FriendlyName; package.Description = desktopModule.Description; package.Version = new Version(1, 0, 0); if (!string.IsNullOrEmpty(desktopModule.Version)) { package.Version = new Version(desktopModule.Version); } if (hostModules.Contains(desktopModule.ModuleName)) { package.IsSystemPackage = true; desktopModule.IsAdmin = true; } else { desktopModule.IsAdmin = false; } package.PackageType = "Module"; ParsePackageName(package); if (files.Length > 0) { ModulePackageWriter modulewriter = new ModulePackageWriter(desktopModule, rootNav, package); package.Manifest = modulewriter.WriteManifest(true); } else { package.Manifest = ""; } PackageController.SavePackage(package); desktopModule.PackageID = package.PackageID; DesktopModuleController.SaveDesktopModule(desktopModule, false, false); } catch (Exception ex) { ex.ToString(); } } } }
/// <summary>Called when a module is upgraded.</summary> /// <param name="version">The version.</param> /// <returns>Success if all goes well, otherwise, Failed</returns> public string UpgradeModule(string version) { try { switch (version) { case "07.04.00": const string ResourceFile = ModuleFolder + "/App_LocalResources/ProviderConfiguration.ascx.resx"; string pageName = Localization.GetString("HTMLEditorPageName", ResourceFile); string pageDescription = Localization.GetString("HTMLEditorPageDescription", ResourceFile); // Create HTML Editor Config Page (or get existing one) TabInfo editorPage = Upgrade.AddHostPage(pageName, pageDescription, ModuleFolder + "/images/HtmlEditorManager_Standard_16x16.png", ModuleFolder + "/images/HtmlEditorManager_Standard_32x32.png", false); // Find the RadEditor control and remove it Upgrade.RemoveModule("RadEditor Manager", editorPage.TabName, editorPage.ParentId, false); // Add Module To Page int moduleDefId = this.GetModuleDefinitionID("DotNetNuke.HtmlEditorManager", "Html Editor Management"); Upgrade.AddModuleToPage(editorPage, moduleDefId, pageName, ModuleFolder + "/images/HtmlEditorManager_Standard_32x32.png", true); foreach (var item in DesktopModuleController.GetDesktopModules(Null.NullInteger)) { DesktopModuleInfo moduleInfo = item.Value; if (moduleInfo.ModuleName == "DotNetNuke.HtmlEditorManager") { moduleInfo.Category = "Host"; DesktopModuleController.SaveDesktopModule(moduleInfo, false, false); } } break; case "09.01.01": if (RadEditorProviderInstalled()) { UpdateRadCfgFiles(); } if (TelerikAssemblyExists()) { UpdateWebConfigFile(); } break; } } catch (Exception ex) { var xlc = new ExceptionLogController(); xlc.AddLog(ex); return("Failed"); } return("Success"); }
public static void ProcessLegacyModules() { foreach (DesktopModuleInfo desktopModule in DesktopModuleController.GetDesktopModules(Null.NullInteger).Values) { if (desktopModule.PackageID == Null.NullInteger) { ProcessLegacyModule(desktopModule); } } }
protected void OnRemoveAllModulesClick(object sender, EventArgs e) { //Remove all Modules foreach (DesktopModuleInfo desktopModule in DesktopModuleController.GetDesktopModules(Null.NullInteger).Values) { DesktopModuleController.RemoveDesktopModuleFromPortal(_portalId, desktopModule.DesktopModuleID, false); } DataCache.ClearPortalCache(_portalId, false); BindDesktopModules(); }
protected void OnAddAllModulesClick(object sender, EventArgs e) { //Add all Modules foreach (DesktopModuleInfo desktopModule in DesktopModuleController.GetDesktopModules(Null.NullInteger).Values) { DesktopModuleController.AddDesktopModuleToPortal(_portalId, desktopModule.DesktopModuleID, true, false); } DataCache.ClearPortalCache(_portalId, false); BindDesktopModules(); }
private void BindDesktopModules() { var dicModules = DesktopModuleController.GetDesktopModules(Null.NullInteger); var dicPortalDesktopModules = DesktopModuleController.GetPortalDesktopModulesByPortalID(_portalId); foreach (var objPortalDesktopModule in dicPortalDesktopModules.Values) { dicModules.Remove(objPortalDesktopModule.DesktopModuleID); } ctlDesktopModules.AvailableDataSource = dicModules.Values; ctlDesktopModules.SelectedDataSource = dicPortalDesktopModules.Values; }
/// <summary> /// /// </summary> /// <param name="Version"></param> /// <returns></returns> /// <remarks>This is not localizing Page Name or description.</remarks> public string UpgradeModule(string Version) { try { switch (Version) { case "06.00.00": string resourceFile = ModuleFolder + "/App_LocalResources/ProviderConfig.ascx.resx"; string pageName = Localization.GetString("HTMLEditorPageName", resourceFile); string pageDescription = Localization.GetString("HTMLEditorPageDescription", resourceFile); //Create Rad Editor Config Page (or get existing one) TabInfo newPage = Upgrade.AddHostPage(pageName, pageDescription, ModuleFolder + "/images/radeditor_config_small.png", ModuleFolder + "/images/radeditor_config_large.png", true); //Add Module To Page int moduleDefId = GetModuleDefinitionID(); Upgrade.AddModuleToPage(newPage, moduleDefId, pageName, ModuleFolder + "/images/radeditor_config_large.png", true); foreach (var item in DesktopModuleController.GetDesktopModules(Null.NullInteger)) { DesktopModuleInfo moduleInfo = item.Value; if (moduleInfo.ModuleName == "DotNetNuke.RadEditorProvider") { moduleInfo.Category = "Host"; DesktopModuleController.SaveDesktopModule(moduleInfo, false, false); } } break; case "07.00.06": UpdateConfigOfLinksType(); break; case "07.03.00": UpdateConfigFilesName(); UpdateToolsFilesName(); break; } } catch (Exception ex) { ExceptionLogController xlc = new ExceptionLogController(); xlc.AddLog(ex); return("Failed"); } return("Success"); }
private string GetDeskTopModuleImage(int moduleId) { var portalDesktopModules = DesktopModuleController.GetDesktopModules(PortalSettings.Current.PortalId); var packages = PackageController.Instance.GetExtensionPackages(PortalSettings.Current.PortalId); string imageUrl = (from pkgs in packages join portMods in portalDesktopModules on pkgs.PackageID equals portMods.Value.PackageID where portMods.Value.DesktopModuleID == moduleId select pkgs.IconFile).FirstOrDefault(); imageUrl = String.IsNullOrEmpty(imageUrl) ? Globals.ImagePath + DefaultExtensionImage : imageUrl; return(System.Web.VirtualPathUtility.ToAbsolute(imageUrl)); }
private static string GetDeskTopModuleImage(int PortalID, int DesktopModuleID) { Dictionary <int, DesktopModuleInfo> portalDesktopModules = DesktopModuleController.GetDesktopModules(PortalID); IList <PackageInfo> packages = PackageController.Instance.GetExtensionPackages(PortalID); string imageUrl = (from pkgs in packages join portMods in portalDesktopModules on pkgs.PackageID equals portMods.Value.PackageID where portMods.Value.DesktopModuleID == DesktopModuleID select pkgs.IconFile).FirstOrDefault(); imageUrl = string.IsNullOrEmpty(imageUrl) ? Globals.ImagePath + "icon_extensions_32px.png" : imageUrl; return(System.Web.VirtualPathUtility.ToAbsolute(imageUrl)); }
private void CreateFullPackage() { Locale language = LocaleController.Instance.GetLocale(cboLanguage.SelectedValue); var Package = new PackageInfo(); Package.Name = Globals.CleanFileName(txtFileName.Text); Package.Version = DotNetNukeContext.Current.Application.Version; Package.License = Util.PACKAGE_NoLicense; Package.PackageType = "CoreLanguagePack"; _Files = new Dictionary <string, InstallFile>(); CreateCorePackage(false); foreach (DesktopModuleInfo desktopModule in DesktopModuleController.GetDesktopModules(Null.NullInteger).Values) { if (!desktopModule.FolderName.StartsWith("Admin/")) { CreateModulePackage(desktopModule, false); } } foreach (PackageInfo provider in PackageController.Instance.GetExtensionPackages(Null.NullInteger, p => p.PackageType == "Provider")) { CreateProviderPackage(provider, false); } foreach (PackageInfo authSystem in PackageController.Instance.GetExtensionPackages(Null.NullInteger, p => p.PackageType == "Auth_System")) { CreateAuthSystemPackage(authSystem, false); } foreach (PackageInfo library in PackageController.Instance.GetExtensionPackages(Null.NullInteger, p => p.PackageType == "Library" || p.PackageType == "EvoqConnector")) { //only generate if a folder name is known for the library if (library.FolderName != null) { CreateLibraryPackage(library, false); } } string fileName = Path.Combine(BasePath, "ResourcePack." + Package.Name); fileName = fileName + "." + Package.Version.ToString(3) + "." + language.Code + ".zip"; packageWriter = PackageWriterFactory.GetWriter(Package) as DotNetNuke.Services.Installer.Writers.LanguagePackWriter; packageWriter.Language = language; packageWriter.BasePath = ""; foreach (KeyValuePair <string, InstallFile> kvp in _Files) { packageWriter.Files.Add(kvp.Key, kvp.Value); } packageWriter.CreatePackage(fileName, Package.Name + " " + language.Text + ".dnn", _Manifest, true); }
/// <inheritdoc/> public bool HaveApi() { if (!this.haveChecked) { var modules = DesktopModuleController.GetDesktopModules(PortalSettings.Current.PortalId); foreach (var moduleKeyPair in modules) { if (!string.IsNullOrEmpty(moduleKeyPair.Value.BusinessControllerClass)) { try { this.locApi = Reflection.CreateObject(moduleKeyPair.Value.BusinessControllerClass, moduleKeyPair.Value.BusinessControllerClass); this.locTab = this.locApi.GetType().GetMethod("LocaliseTab", new[] { typeof(TabInfo), typeof(int) }); if (this.locTab != null) { if (this.locTab.IsStatic) { this.locApi = null; } break; } this.locNodes = this.locApi.GetType().GetMethod("LocaliseNodes", new[] { typeof(DNNNodeCollection) }); if (this.locNodes != null) { if (this.locNodes.IsStatic) { this.locApi = null; } break; } } // ReSharper disable EmptyGeneralCatchClause catch { } // ReSharper restore EmptyGeneralCatchClause } } this.haveChecked = true; } return((this.locTab != null) || (this.locNodes != null)); }
private void BindPortalDesktopModuleImages() { var portalDesktopModules = DesktopModuleController.GetDesktopModules(PortalSettings.Current.PortalId); var packages = PackageController.Instance.GetExtensionPackages(PortalSettings.Current.PortalId); foreach (RadComboBoxItem item in this._moduleCombo.Items) { string imageUrl = (from pkgs in packages join portMods in portalDesktopModules on pkgs.PackageID equals portMods.Value.PackageID where portMods.Value.DesktopModuleID.ToString() == item.Value select pkgs.IconFile).FirstOrDefault(); item.ImageUrl = string.IsNullOrEmpty(imageUrl) ? Globals.ImagePath + DefaultExtensionImage : imageUrl; } }
private void BindPortalDesktopModuleImages() { var portalDesktopModules = DesktopModuleController.GetDesktopModules(PortalSettings.Current.PortalId); var packages = PackageController.Instance.GetExtensionPackages(PortalSettings.Current.PortalId); // foreach (var item in _moduleCombo.Items) // { // string imageUrl = // (from pkgs in packages // join portMods in portalDesktopModules on pkgs.PackageID equals portMods.Value.PackageID // where portMods.Value.DesktopModuleID.ToString() == item.Value // select pkgs.IconFile).FirstOrDefault(); // item.ImageUrl = String.IsNullOrEmpty(imageUrl) ? Globals.ImagePath + DefaultExtensionImage : imageUrl; // } }
public void CreateFullPackage(string cultureCode, string fileName) { Locale language = LocaleController.Instance.GetLocale(cultureCode); var package = new PackageInfo { Name = Globals.CleanFileName(fileName), Version = DotNetNukeContext.Current.Application.Version, License = Util.PACKAGE_NoLicense, PackageType = "CoreLanguagePack" }; this._Files = new Dictionary <string, InstallFile>(); this.CreateCorePackage(cultureCode, fileName, false); foreach (var desktopModule in DesktopModuleController.GetDesktopModules(Null.NullInteger).Values.Where(desktopModule => !desktopModule.FolderName.StartsWith("Admin/"))) { this.CreateModulePackage(cultureCode, desktopModule, false); } foreach (var provider in PackageController.Instance.GetExtensionPackages(Null.NullInteger, p => p.PackageType == "Provider")) { this.CreateProviderPackage(cultureCode, provider, false); } foreach (var authSystem in PackageController.Instance.GetExtensionPackages(Null.NullInteger, p => p.PackageType == "Auth_System")) { this.CreateAuthSystemPackage(cultureCode, authSystem, false); } foreach (var library in PackageController.Instance.GetExtensionPackages(Null.NullInteger, p => p.PackageType == "Library" || p.PackageType == "EvoqConnector")) { //only generate if a folder name is known for the library if (library.FolderName != null) { this.CreateLibraryPackage(cultureCode, library, false); } } fileName = Path.Combine(this.BasePath, "ResourcePack." + package.Name); fileName = fileName + "." + package.Version.ToString(3) + "." + language.Code + ".zip"; var packageWriter = PackageWriterFactory.GetWriter(package) as LanguagePackWriter; packageWriter.Language = language; packageWriter.BasePath = ""; foreach (KeyValuePair <string, InstallFile> kvp in this._Files) { packageWriter.Files.Add(kvp.Key, kvp.Value); } packageWriter.CreatePackage(fileName, package.Name + " " + language.Text + ".dnn", this._Manifest, true); }
private string GetTabModuleImage(int tabId, int moduleId) { var tabModules = new ModuleController().GetTabModules(tabId); var portalDesktopModules = DesktopModuleController.GetDesktopModules(PortalSettings.Current.PortalId); var moduleDefnitions = ModuleDefinitionController.GetModuleDefinitions(); var packages = PackageController.GetPackages(PortalSettings.Current.PortalId); string imageUrl = (from pkgs in packages join portMods in portalDesktopModules on pkgs.PackageID equals portMods.Value.PackageID join modDefs in moduleDefnitions on portMods.Value.DesktopModuleID equals modDefs.Value.DesktopModuleID join tabMods in tabModules on modDefs.Value.DesktopModuleID equals tabMods.Value.DesktopModuleID where tabMods.Value.ModuleID == moduleId select pkgs.IconFile).FirstOrDefault(); imageUrl = String.IsNullOrEmpty(imageUrl) ? Globals.ImagePath + DefaultExtensionImage : imageUrl; return(System.Web.VirtualPathUtility.ToAbsolute(imageUrl)); }
private void BindTabModuleImages(int tabID) { var tabModules = ModuleController.Instance.GetTabModules(tabID); var portalDesktopModules = DesktopModuleController.GetDesktopModules(PortalSettings.Current.PortalId); var moduleDefnitions = ModuleDefinitionController.GetModuleDefinitions(); var packages = PackageController.Instance.GetExtensionPackages(PortalSettings.Current.PortalId); // foreach (RadComboBoxItem item in _moduleCombo.Items) // { // string imageUrl = (from pkgs in packages // join portMods in portalDesktopModules on pkgs.PackageID equals portMods.Value.PackageID // join modDefs in moduleDefnitions on portMods.Value.DesktopModuleID equals modDefs.Value.DesktopModuleID // join tabMods in tabModules on modDefs.Value.DesktopModuleID equals tabMods.Value.DesktopModuleID // where tabMods.Value.ModuleID.ToString() == item.Value // select pkgs.IconFile).FirstOrDefault(); // item.ImageUrl = String.IsNullOrEmpty(imageUrl) ? Globals.ImagePath + DefaultExtensionImage : imageUrl; // } }
/// <summary> /// Adds the module to page. /// </summary> /// <param name="portalId">The portal id.</param> /// <param name="tabId">The tab id.</param> /// <exception cref="System.ArgumentException">desktopModuleId</exception> private void AddModuleToPage(int portalId, int tabId) { TabPermissionCollection objTabPermissions = new TabController().GetTab(tabId, portalId, false).TabPermissions; var objPermissionController = new PermissionController(); var objModules = new ModuleController(); new EventLogController(); int desktopModuleId = DesktopModuleController.GetDesktopModuleByFriendlyName("VanityURLs").DesktopModuleID; try { DesktopModuleInfo desktopModule; if (!DesktopModuleController.GetDesktopModules(portalId).TryGetValue(desktopModuleId, out desktopModule)) { throw new ArgumentException("desktopModuleId"); } } catch (Exception ex) { Exceptions.LogException(ex); } foreach (ModuleDefinitionInfo objModuleDefinition in ModuleDefinitionController.GetModuleDefinitionsByDesktopModuleID(desktopModuleId).Values) { var objModule = new ModuleInfo(); objModule.PortalID = portalId; objModule.TabID = tabId; objModule.ModuleOrder = 0; objModule.ModuleTitle = objModuleDefinition.FriendlyName; objModule.PaneName = "ContentPane"; objModule.ModuleDefID = objModuleDefinition.ModuleDefID; objModule.InheritViewPermissions = true; objModule.CultureCode = Null.NullString; objModule.AllTabs = false; objModules.AddModule(objModule); } }
/// <summary> /// Add the module to a page /// </summary> /// <param name="friendlyNameModule"></param> /// <returns></returns> protected bool AddModuleToPage(String friendlyNameModule) { TextBox tbx = (TextBox)FindControl("tbx_nom"); PortalSettings portalSettings = new PortalSettings(); int portalId = portalSettings.PortalId; //Creating page TabController tabController = new TabController(); TabInfo tab = null; //Checking if the page already exists if (!tabController.GetTabsByPortal(portalId).Values.Contains(tabController.GetTabByName(tbx.Text, portalId))) { tab = new TabInfo(); tab.PortalID = portalId; tab.TabName = tbx.Text; tab.Title = tbx.Text; tab.Description = tbx.Text; tab.KeyWords = tbx.Text; tab.IsVisible = true; tab.DisableLink = false; tab.IsDeleted = false; tab.Url = ""; tab.IsSuperTab = true; AddPermissionsOnTab(tab); int tabId = tabController.AddTab(tab, false); tbx.Text = ""; } else if (!tabController.GetTabByName(tbx.Text, portalId).IsDeleted) { tab = tabController.GetTabByName(tbx.Text, portalId); } else { return(false); } DesktopModuleInfo desktopModuleInfo = null; foreach (KeyValuePair <int, DesktopModuleInfo> kvp in DesktopModuleController.GetDesktopModules(portalId)) { DesktopModuleInfo mod = kvp.Value; if (mod != null) { if ((mod.FriendlyName == friendlyNameModule || mod.ModuleName == friendlyNameModule) && (mod.FriendlyName != "AIS_Installer" || mod.ModuleName != "AIS.Installer")) { desktopModuleInfo = mod; } } } if (desktopModuleInfo != null && tab != null) { foreach (ModuleDefinitionInfo moduleDefinitionInfo in ModuleDefinitionController.GetModuleDefinitionsByDesktopModuleID(desktopModuleInfo.DesktopModuleID).Values) { ModuleInfo moduleInfo = new ModuleInfo(); moduleInfo.PortalID = portalId; moduleInfo.TabID = tab.TabID; moduleInfo.ModuleOrder = 1; moduleInfo.ModuleTitle = desktopModuleInfo.FriendlyName; moduleInfo.PaneName = "ContentPane"; moduleInfo.ModuleDefID = moduleDefinitionInfo.ModuleDefID; moduleInfo.CacheTime = moduleDefinitionInfo.DefaultCacheTime; moduleInfo.InheritViewPermissions = true; moduleInfo.AllTabs = false; ModuleController moduleController = new ModuleController(); int moduleId = moduleController.AddModule(moduleInfo); } } //Clearing cache DotNetNuke.Common.Utilities.DataCache.ClearModuleCache(tab.TabID); DotNetNuke.Common.Utilities.DataCache.ClearTabsCache(PortalId); DotNetNuke.Common.Utilities.DataCache.ClearPortalCache(PortalId, false); return(true); }
/// <summary> /// /// </summary> /// <param name="Version"></param> /// <returns></returns> /// <remarks>This is not localizing Page Name or description.</remarks> public string UpgradeModule(string Version) { try { var pageName = Localization.GetString("HTMLEditorPageName", ResourceFile); var pageDescription = Localization.GetString("HTMLEditorPageDescription", ResourceFile); switch (Version) { case "06.00.00": //Create Rad Editor Config Page (or get existing one) TabInfo newPage = Upgrade.AddHostPage(pageName, pageDescription, ModuleFolder + "/images/radeditor_config_small.png", ModuleFolder + "/images/radeditor_config_large.png", true); //Add Module To Page int moduleDefId = GetModuleDefinitionID(); Upgrade.AddModuleToPage(newPage, moduleDefId, pageName, ModuleFolder + "/images/radeditor_config_large.png", true); foreach (var item in DesktopModuleController.GetDesktopModules(Null.NullInteger)) { DesktopModuleInfo moduleInfo = item.Value; if (moduleInfo.ModuleName == "DotNetNuke.RadEditorProvider") { moduleInfo.Category = "Host"; DesktopModuleController.SaveDesktopModule(moduleInfo, false, false); } } break; case "07.00.06": UpdateConfigOfLinksType(); break; case "07.03.00": UpdateConfigFilesName(); UpdateToolsFilesName(); break; case "07.04.00": // Find the RadEditor page. It should already exist and this will return it's reference. var editorPage = Upgrade.AddHostPage(pageName, pageDescription, ModuleFolder + "/images/HtmlEditorManager_Standard_16x16.png", ModuleFolder + "/images/HtmlEditorManager_Standard_32x32.png", true); // If the Html Editor Manager is installed, then remove the old RadEditor Manager var htmlEditorManager = DesktopModuleController.GetDesktopModuleByModuleName("DotNetNuke.HtmlEditorManager", Null.NullInteger); if (htmlEditorManager != null) { Upgrade.RemoveModule("RadEditor Manager", editorPage.TabName, editorPage.ParentId, false); } break; } } catch (Exception ex) { ExceptionLogController xlc = new ExceptionLogController(); xlc.AddLog(ex); return("Failed"); } return("Success"); }
private static void DoAddNewModule(string title, int desktopModuleId, string paneName, int position, int permissionType, string align) { try { DesktopModuleInfo desktopModule; if (!DesktopModuleController.GetDesktopModules(PortalSettings.Current.PortalId).TryGetValue(desktopModuleId, out desktopModule)) { throw new ArgumentException("desktopModuleId"); } } catch (Exception ex) { Exceptions.LogException(ex); } foreach (ModuleDefinitionInfo objModuleDefinition in ModuleDefinitionController.GetModuleDefinitionsByDesktopModuleID(desktopModuleId).Values) { var objModule = new ModuleInfo(); objModule.Initialize(PortalSettings.Current.ActiveTab.PortalID); objModule.PortalID = PortalSettings.Current.ActiveTab.PortalID; objModule.TabID = PortalSettings.Current.ActiveTab.TabID; objModule.ModuleOrder = position; objModule.ModuleTitle = string.IsNullOrEmpty(title) ? objModuleDefinition.FriendlyName : title; objModule.PaneName = paneName; objModule.ModuleDefID = objModuleDefinition.ModuleDefID; if (objModuleDefinition.DefaultCacheTime > 0) { objModule.CacheTime = objModuleDefinition.DefaultCacheTime; if (PortalSettings.Current.DefaultModuleId > Null.NullInteger && PortalSettings.Current.DefaultTabId > Null.NullInteger) { ModuleInfo defaultModule = ModuleController.Instance.GetModule(PortalSettings.Current.DefaultModuleId, PortalSettings.Current.DefaultTabId, true); if (defaultModule != null) { objModule.CacheTime = defaultModule.CacheTime; } } } ModuleController.Instance.InitialModulePermission(objModule, objModule.TabID, permissionType); if (PortalSettings.Current.ContentLocalizationEnabled) { Locale defaultLocale = LocaleController.Instance.GetDefaultLocale(PortalSettings.Current.PortalId); // check whether original tab is exists, if true then set culture code to default language, // otherwise set culture code to current. if (TabController.Instance.GetTabByCulture(objModule.TabID, PortalSettings.Current.PortalId, defaultLocale) != null) { objModule.CultureCode = defaultLocale.Code; } else { objModule.CultureCode = PortalSettings.Current.CultureCode; } } else { objModule.CultureCode = Null.NullString; } objModule.AllTabs = false; objModule.Alignment = align; ModuleController.Instance.AddModule(objModule); } }
private int DoAddNewModule(string title, int desktopModuleId, string paneName, int position, int permissionType, string align) { var objModules = new ModuleController(); try { DesktopModuleInfo desktopModule; if (!DesktopModuleController.GetDesktopModules(PortalSettings.Current.PortalId).TryGetValue(desktopModuleId, out desktopModule)) { throw new ArgumentException("desktopModuleId"); } } catch (Exception ex) { Exceptions.LogException(ex); } var tabModuleId = Null.NullInteger; foreach (ModuleDefinitionInfo objModuleDefinition in ModuleDefinitionController.GetModuleDefinitionsByDesktopModuleID(desktopModuleId).Values) { var objModule = new ModuleInfo(); objModule.Initialize(PortalSettings.Current.ActiveTab.PortalID); objModule.PortalID = PortalSettings.Current.ActiveTab.PortalID; objModule.TabID = PortalSettings.Current.ActiveTab.TabID; objModule.ModuleOrder = position; objModule.ModuleTitle = string.IsNullOrEmpty(title) ? objModuleDefinition.FriendlyName : title; objModule.PaneName = paneName; objModule.ModuleDefID = objModuleDefinition.ModuleDefID; if (objModuleDefinition.DefaultCacheTime > 0) { objModule.CacheTime = objModuleDefinition.DefaultCacheTime; if (PortalSettings.Current.DefaultModuleId > Null.NullInteger && PortalSettings.Current.DefaultTabId > Null.NullInteger) { ModuleInfo defaultModule = objModules.GetModule(PortalSettings.Current.DefaultModuleId, PortalSettings.Current.DefaultTabId, true); if ((defaultModule != null)) { objModule.CacheTime = defaultModule.CacheTime; } } } objModules.InitialModulePermission(objModule, objModule.TabID, permissionType); if (PortalSettings.Current.ContentLocalizationEnabled) { Locale defaultLocale = LocaleController.Instance.GetDefaultLocale(PortalSettings.Current.PortalId); //set the culture of the module to that of the tab var tabInfo = new TabController().GetTab(objModule.TabID, PortalSettings.Current.PortalId, false); objModule.CultureCode = tabInfo != null ? tabInfo.CultureCode : defaultLocale.Code; } else { objModule.CultureCode = Null.NullString; } objModule.AllTabs = false; objModule.Alignment = align; objModules.AddModule(objModule); if (tabModuleId == Null.NullInteger) { tabModuleId = objModule.ModuleID; } //update the position to let later modules with add after previous one. position = objModules.GetTabModule(objModule.TabModuleID).ModuleOrder + 1; } return(tabModuleId); }
private static void DoAddNewModule(string title, int desktopModuleId, string paneName, int position, int permissionType, string align) { TabPermissionCollection objTabPermissions = PortalSettings.Current.ActiveTab.TabPermissions; var objPermissionController = new PermissionController(); var objModules = new ModuleController(); new EventLogController(); try { DesktopModuleInfo desktopModule; if (!DesktopModuleController.GetDesktopModules(PortalSettings.Current.PortalId).TryGetValue(desktopModuleId, out desktopModule)) { throw new ArgumentException("desktopModuleId"); } } catch (Exception ex) { Exceptions.LogException(ex); } foreach (ModuleDefinitionInfo objModuleDefinition in ModuleDefinitionController.GetModuleDefinitionsByDesktopModuleID(desktopModuleId).Values) { var objModule = new ModuleInfo(); objModule.Initialize(PortalSettings.Current.ActiveTab.PortalID); objModule.PortalID = PortalSettings.Current.ActiveTab.PortalID; objModule.TabID = PortalSettings.Current.ActiveTab.TabID; objModule.ModuleOrder = position; objModule.ModuleTitle = string.IsNullOrEmpty(title) ? objModuleDefinition.FriendlyName : title; objModule.PaneName = paneName; objModule.ModuleDefID = objModuleDefinition.ModuleDefID; if (objModuleDefinition.DefaultCacheTime > 0) { objModule.CacheTime = objModuleDefinition.DefaultCacheTime; if (PortalSettings.Current.DefaultModuleId > Null.NullInteger && PortalSettings.Current.DefaultTabId > Null.NullInteger) { ModuleInfo defaultModule = objModules.GetModule(PortalSettings.Current.DefaultModuleId, PortalSettings.Current.DefaultTabId, true); if ((defaultModule != null)) { objModule.CacheTime = defaultModule.CacheTime; } } } switch (permissionType) { case 0: objModule.InheritViewPermissions = true; break; case 1: objModule.InheritViewPermissions = false; break; } // get the default module view permissions ArrayList arrSystemModuleViewPermissions = objPermissionController.GetPermissionByCodeAndKey("SYSTEM_MODULE_DEFINITION", "VIEW"); // get the permissions from the page foreach (TabPermissionInfo objTabPermission in objTabPermissions) { if (objTabPermission.PermissionKey == "VIEW" && permissionType == 0) { //Don't need to explicitly add View permisisons if "Same As Page" continue; } // get the system module permissions for the permissionkey ArrayList arrSystemModulePermissions = objPermissionController.GetPermissionByCodeAndKey("SYSTEM_MODULE_DEFINITION", objTabPermission.PermissionKey); // loop through the system module permissions int j; for (j = 0; j <= arrSystemModulePermissions.Count - 1; j++) { // create the module permission var objSystemModulePermission = (PermissionInfo)arrSystemModulePermissions[j]; if (objSystemModulePermission.PermissionKey == "VIEW" && permissionType == 1 && objTabPermission.PermissionKey != "EDIT") { //Only Page Editors get View permissions if "Page Editors Only" continue; } ModulePermissionInfo objModulePermission = AddModulePermission(objModule, objSystemModulePermission, objTabPermission.RoleID, objTabPermission.UserID, objTabPermission.AllowAccess); // ensure that every EDIT permission which allows access also provides VIEW permission if (objModulePermission.PermissionKey == "EDIT" && objModulePermission.AllowAccess) { AddModulePermission(objModule, (PermissionInfo)arrSystemModuleViewPermissions[0], objModulePermission.RoleID, objModulePermission.UserID, true); } } //Get the custom Module Permissions, Assume that roles with Edit Tab Permissions //are automatically assigned to the Custom Module Permissions if (objTabPermission.PermissionKey == "EDIT") { ArrayList arrCustomModulePermissions = objPermissionController.GetPermissionsByModuleDefID(objModule.ModuleDefID); // loop through the custom module permissions for (j = 0; j <= arrCustomModulePermissions.Count - 1; j++) { // create the module permission var objCustomModulePermission = (PermissionInfo)arrCustomModulePermissions[j]; AddModulePermission(objModule, objCustomModulePermission, objTabPermission.RoleID, objTabPermission.UserID, objTabPermission.AllowAccess); } } } if (PortalSettings.Current.ContentLocalizationEnabled) { Locale defaultLocale = LocaleController.Instance.GetDefaultLocale(PortalSettings.Current.PortalId); //check whether original tab is exists, if true then set culture code to default language, //otherwise set culture code to current. if (new TabController().GetTabByCulture(objModule.TabID, PortalSettings.Current.PortalId, defaultLocale) != null) { objModule.CultureCode = defaultLocale.Code; } else { objModule.CultureCode = PortalSettings.Current.CultureCode; } } else { objModule.CultureCode = Null.NullString; } objModule.AllTabs = false; objModule.Alignment = align; objModules.AddModule(objModule); } }
public int AddModuleToPage(TabInfo t, ModuleType type) { string DesktopModuleFriendlyName = ""; string ModuleDefFriendlyName = ""; ModuleDefinitionInfo moduleDefinitionInfo = new ModuleDefinitionInfo(); ModuleInfo moduleInfo = new ModuleInfo(); moduleInfo.PortalID = t.PortalID; moduleInfo.TabID = t.TabID; moduleInfo.ModuleOrder = 1; moduleInfo.ModuleTitle = ""; moduleInfo.DisplayPrint = false; moduleInfo.IsShareable = true; moduleInfo.IsShareableViewOnly = true; switch (type) { case ModuleType.DisplayPlugg: moduleInfo.PaneName = "RowTwo_Grid8_Pane"; DesktopModuleFriendlyName = "DisplayPlugg"; ModuleDefFriendlyName = "DisplayPlugg"; break; case ModuleType.DisplayCourse: moduleInfo.PaneName = "RowTwo_Grid8_Pane"; DesktopModuleFriendlyName = "DisplayCourse"; ModuleDefFriendlyName = "DisplayCourse"; break; case ModuleType.CourseMenu: moduleInfo.PaneName = "RowTwo_Grid4_Pane"; DesktopModuleFriendlyName = "CourseMenu"; ModuleDefFriendlyName = "CourseMenu"; break; case ModuleType.Rating: moduleInfo.PaneName = "RowTwo_Grid4_Pane"; DesktopModuleFriendlyName = "DNNCentric RnC"; ModuleDefFriendlyName = "DNNCentric.RatingAndComments"; break; case ModuleType.Comments: moduleInfo.PaneName = "RowTwo_Grid8_Pane"; DesktopModuleFriendlyName = "DNNCentric RnC"; ModuleDefFriendlyName = "DNNCentric.RatingAndComments"; break; case ModuleType.DisplayPluggeTitle: moduleInfo.PaneName = "RowTwo_Grid4_Pane"; DesktopModuleFriendlyName = "DisplayPluggeTitle"; ModuleDefFriendlyName = "DisplayPluggeTitle"; break; } DesktopModuleInfo myModule = null; foreach (KeyValuePair <int, DesktopModuleInfo> kvp in DesktopModuleController.GetDesktopModules(t.PortalID)) { DesktopModuleInfo mod = kvp.Value; if (mod != null) { if (mod.FriendlyName == DesktopModuleFriendlyName) { myModule = mod; break; } } } int moduleId = 0; if (myModule != null) { var mc = new ModuleDefinitionController(); var mInfo = new ModuleDefinitionInfo(); mInfo = ModuleDefinitionController.GetModuleDefinitionByFriendlyName(ModuleDefFriendlyName, myModule.DesktopModuleID); moduleInfo.ModuleDefID = mInfo.ModuleDefID; moduleInfo.CacheTime = moduleDefinitionInfo.DefaultCacheTime; //Default Cache Time is 0 moduleInfo.InheritViewPermissions = true; //Inherit View Permissions from Tab moduleInfo.AllTabs = false; moduleInfo.Alignment = "Top"; ModuleController moduleController = new ModuleController(); moduleId = moduleController.AddModule(moduleInfo); } DotNetNuke.Common.Utilities.DataCache.ClearModuleCache(t.TabID); DotNetNuke.Common.Utilities.DataCache.ClearTabsCache(t.PortalID); DotNetNuke.Common.Utilities.DataCache.ClearPortalCache(t.PortalID, false); //Add settings for RnC ModuleController m = new ModuleController(); if (type == ModuleType.Rating) { AddModuleSettingsRnCCommon(moduleId); m.UpdateModuleSetting(moduleId, "PRC_settingCommentObject", "tabid:" + t.TabID); m.UpdateModuleSetting(moduleId, "PRC_settingShow", "OnlyRatings"); m.UpdateModuleSetting(moduleId, "PRC_settingRncWidth", "357"); } if (type == ModuleType.Comments) { AddModuleSettingsRnCCommon(moduleId); m.UpdateModuleSetting(moduleId, "PRC_settingCommentObject", "tabid:" + t.TabID); m.UpdateModuleSetting(moduleId, "PRC_settingShow", "OnlyComments"); m.UpdateModuleSetting(moduleId, "PRC_settingRncWidth", "744"); } if (type == ModuleType.Rating || type == ModuleType.Comments) { RnCController c = new RnCController(); DCC_PRC_CommentObject myCO = new DCC_PRC_CommentObject(); myCO.CommentObject = "tabid:" + t.TabID; myCO.CommentObjectViewCount = 0; myCO.PortalID = t.PortalID; c.CreateCommentObject(myCO); } return(moduleId); }
/// ----------------------------------------------------------------------------- /// <summary> /// Adds a New Module to a Pane. /// </summary> /// <param name="align">The alignment for the Modue.</param> /// <param name="desktopModuleId">The Id of the DesktopModule.</param> /// <param name="permissionType">The View Permission Type for the Module.</param> /// <param name="title">The Title for the resulting module.</param> /// <param name="paneName">The pane to add the module to.</param> /// <param name="position">The relative position within the pane for the module.</param> /// ----------------------------------------------------------------------------- protected void AddNewModule(string title, int desktopModuleId, string paneName, int position, ViewPermissionType permissionType, string align) { TabPermissionCollection objTabPermissions = this.PortalSettings.ActiveTab.TabPermissions; var objPermissionController = new PermissionController(); try { DesktopModuleInfo desktopModule; if (!DesktopModuleController.GetDesktopModules(this.PortalSettings.PortalId).TryGetValue(desktopModuleId, out desktopModule)) { throw new ArgumentException("desktopModuleId"); } } catch (Exception ex) { Exceptions.LogException(ex); } int UserId = -1; if (this.Request.IsAuthenticated) { UserInfo objUserInfo = UserController.Instance.GetCurrentUserInfo(); UserId = objUserInfo.UserID; } foreach (ModuleDefinitionInfo objModuleDefinition in ModuleDefinitionController.GetModuleDefinitionsByDesktopModuleID(desktopModuleId).Values) { var objModule = new ModuleInfo(); objModule.Initialize(this.PortalSettings.PortalId); objModule.PortalID = this.PortalSettings.PortalId; objModule.TabID = this.PortalSettings.ActiveTab.TabID; objModule.ModuleOrder = position; if (string.IsNullOrEmpty(title)) { objModule.ModuleTitle = objModuleDefinition.FriendlyName; } else { objModule.ModuleTitle = title; } objModule.PaneName = paneName; objModule.ModuleDefID = objModuleDefinition.ModuleDefID; if (objModuleDefinition.DefaultCacheTime > 0) { objModule.CacheTime = objModuleDefinition.DefaultCacheTime; if (PortalSettings.Current.DefaultModuleId > Null.NullInteger && PortalSettings.Current.DefaultTabId > Null.NullInteger) { ModuleInfo defaultModule = ModuleController.Instance.GetModule(PortalSettings.Current.DefaultModuleId, PortalSettings.Current.DefaultTabId, true); if (defaultModule != null) { objModule.CacheTime = defaultModule.CacheTime; } } } switch (permissionType) { case ViewPermissionType.View: objModule.InheritViewPermissions = true; break; case ViewPermissionType.Edit: objModule.InheritViewPermissions = false; break; } // get the default module view permissions ArrayList arrSystemModuleViewPermissions = objPermissionController.GetPermissionByCodeAndKey("SYSTEM_MODULE_DEFINITION", "VIEW"); // get the permissions from the page foreach (TabPermissionInfo objTabPermission in objTabPermissions) { if (objTabPermission.PermissionKey == "VIEW" && permissionType == ViewPermissionType.View) { // Don't need to explicitly add View permisisons if "Same As Page" continue; } // get the system module permissions for the permissionkey ArrayList arrSystemModulePermissions = objPermissionController.GetPermissionByCodeAndKey("SYSTEM_MODULE_DEFINITION", objTabPermission.PermissionKey); // loop through the system module permissions int j; for (j = 0; j <= arrSystemModulePermissions.Count - 1; j++) { PermissionInfo objSystemModulePermission; objSystemModulePermission = (PermissionInfo)arrSystemModulePermissions[j]; if (objSystemModulePermission.PermissionKey == "VIEW" && permissionType == ViewPermissionType.Edit && objTabPermission.PermissionKey != "EDIT") { // Only Page Editors get View permissions if "Page Editors Only" continue; } ModulePermissionInfo objModulePermission = this.AddModulePermission( objModule, objSystemModulePermission, objTabPermission.RoleID, objTabPermission.UserID, objTabPermission.AllowAccess); // ensure that every EDIT permission which allows access also provides VIEW permission if (objModulePermission.PermissionKey == "EDIT" && objModulePermission.AllowAccess) { ModulePermissionInfo objModuleViewperm = this.AddModulePermission( objModule, (PermissionInfo)arrSystemModuleViewPermissions[0], objModulePermission.RoleID, objModulePermission.UserID, true); } } // Get the custom Module Permissions, Assume that roles with Edit Tab Permissions // are automatically assigned to the Custom Module Permissions if (objTabPermission.PermissionKey == "EDIT") { ArrayList arrCustomModulePermissions = objPermissionController.GetPermissionsByModuleDefID(objModule.ModuleDefID); // loop through the custom module permissions for (j = 0; j <= arrCustomModulePermissions.Count - 1; j++) { // create the module permission PermissionInfo objCustomModulePermission; objCustomModulePermission = (PermissionInfo)arrCustomModulePermissions[j]; this.AddModulePermission(objModule, objCustomModulePermission, objTabPermission.RoleID, objTabPermission.UserID, objTabPermission.AllowAccess); } } } if (PortalSettings.Current.ContentLocalizationEnabled) { Locale defaultLocale = LocaleController.Instance.GetDefaultLocale(PortalSettings.Current.PortalId); // set the culture of the module to that of the tab var tabInfo = TabController.Instance.GetTab(objModule.TabID, PortalSettings.Current.PortalId, false); objModule.CultureCode = tabInfo != null ? tabInfo.CultureCode : defaultLocale.Code; } else { objModule.CultureCode = Null.NullString; } objModule.AllTabs = false; objModule.Alignment = align; ModuleController.Instance.AddModule(objModule); } }
private void ReadLegacyManifest(XPathNavigator manifestNav) { string fileName = Null.NullString; string filePath = Null.NullString; string sourceFileName = Null.NullString; string resourcetype = Null.NullString; string moduleName = Null.NullString; foreach (XPathNavigator fileNav in manifestNav.Select("Files/File")) { fileName = Util.ReadAttribute(fileNav, "FileName").ToLowerInvariant(); resourcetype = Util.ReadAttribute(fileNav, "FileType"); moduleName = Util.ReadAttribute(fileNav, "ModuleName").ToLowerInvariant(); sourceFileName = Path.Combine(resourcetype, Path.Combine(moduleName, fileName)); string extendedExtension = "." + Language.Code.ToLowerInvariant() + ".resx"; switch (resourcetype) { case "GlobalResource": filePath = "App_GlobalResources"; _IsCore = true; break; case "ControlResource": filePath = "Controls\\App_LocalResources"; break; case "AdminResource": _IsCore = true; switch (moduleName) { case "authentication": filePath = "DesktopModules\\Admin\\Authentication\\App_LocalResources"; break; case "controlpanel": filePath = "Admin\\ControlPanel\\App_LocalResources"; break; case "files": filePath = "DesktopModules\\Admin\\FileManager\\App_LocalResources"; break; case "host": switch (fileName.Replace(extendedExtension, "")) { case "authentication.ascx": filePath = ""; break; case "friendlyurls.ascx": filePath = "DesktopModules\\Admin\\HostSettings\\App_LocalResources"; break; case "hostsettings.ascx": filePath = "DesktopModules\\Admin\\HostSettings\\App_LocalResources"; break; case "requestfilters.ascx": filePath = "DesktopModules\\Admin\\HostSettings\\App_LocalResources"; break; case "solutions.ascx": filePath = "DesktopModules\\Admin\\Solutions\\App_LocalResources"; break; } break; case "lists": filePath = "DesktopModules\\Admin\\Lists\\App_LocalResources"; break; case "localization": switch (fileName.Replace(extendedExtension, "")) { case "languageeditor.ascx": filePath = "DesktopModules\\Admin\\Extensions\\Editors\\App_LocalResources"; break; case "languageeditorext.ascx": filePath = "DesktopModules\\Admin\\Extensions\\Editors\\App_LocalResources"; break; case "timezoneeditor.ascx": filePath = "DesktopModules\\Admin\\Extensions\\Editors\\App_LocalResources"; break; case "resourceverifier.ascx": filePath = "DesktopModules\\Admin\\Extensions\\Editors\\App_LocalResources"; break; default: filePath = ""; break; } break; case "log": filePath = "DesktopModules\\Admin\\SiteLog\\App_LocalResources"; break; case "logging": filePath = "DesktopModules\\Admin\\LogViewer\\App_LocalResources"; break; case "moduledefinitions": switch (fileName.Replace(extendedExtension, "")) { case "editmodulecontrol.ascx": filePath = "DesktopModules\\Admin\\Extensions\\Editors\\App_LocalResources"; break; case "importmoduledefinition.ascx": filePath = "DesktopModules\\Admin\\Extensions\\Editors\\App_LocalResources"; break; case "timezoneeditor.ascx": filePath = "DesktopModules\\Admin\\Extensions\\Editors\\App_LocalResources"; break; default: filePath = ""; break; } break; case "modules": filePath = "Admin\\Modules\\App_LocalResources"; break; case "packages": filePath = "DesktopModules\\Admin\\Extensions\\App_LocalResources"; break; case "portal": switch (fileName.Replace(extendedExtension, "")) { case "editportalalias.ascx": filePath = "DesktopModules\\Admin\\Portals\\App_LocalResources"; break; case "portalalias.ascx": filePath = "DesktopModules\\Admin\\Portals\\App_LocalResources"; break; case "portals.ascx": filePath = "DesktopModules\\Admin\\Portals\\App_LocalResources"; break; case "privacy.ascx": filePath = "Admin\\Portal\\App_LocalResources"; break; case "signup.ascx": filePath = "DesktopModules\\Admin\\Portals\\App_LocalResources"; break; case "sitesettings.ascx": filePath = "DesktopModules\\Admin\\Portals\\App_LocalResources"; break; case "sitewizard.ascx": filePath = "DesktopModules\\Admin\\SiteWizard\\App_LocalResources"; break; case "sql.ascx": filePath = "DesktopModules\\Admin\\SQL\\App_LocalResources"; break; case "systemmessages.ascx": filePath = ""; break; case "template.ascx": filePath = "DesktopModules\\Admin\\Portals\\App_LocalResources"; break; case "terms.ascx": filePath = "Admin\\Portal\\App_LocalResources"; break; } break; case "scheduling": filePath = "DesktopModules\\Admin\\Scheduler\\App_LocalResources"; break; case "search": switch (fileName.Replace(extendedExtension, "")) { case "inputsettings.ascx": filePath = "DesktopModules\\Admin\\SearchInput\\App_LocalResources"; break; case "resultssettings.ascx": filePath = "DesktopModules\\Admin\\SearchResults\\App_LocalResources"; break; case "searchadmin.ascx": filePath = "DesktopModules\\Admin\\SearchAdmin\\App_LocalResources"; break; case "searchinput.ascx": filePath = "DesktopModules\\Admin\\SearchInput\\App_LocalResources"; break; case "searchresults.ascx": filePath = "DesktopModules\\Admin\\SearchResults\\App_LocalResources"; break; } break; case "security": switch (fileName.Replace(extendedExtension, "")) { case "accessdenied.ascx": filePath = "Admin\\Security\\App_LocalResources"; break; case "authenticationsettings.ascx": filePath = ""; break; case "editgroups.ascx": filePath = "DesktopModules\\Admin\\Security\\App_LocalResources"; break; case "editroles.ascx": filePath = "DesktopModules\\Admin\\Security\\App_LocalResources"; break; case "register.ascx": filePath = ""; break; case "roles.ascx": filePath = "DesktopModules\\Admin\\Security\\App_LocalResources"; break; case "securityroles.ascx": filePath = "DesktopModules\\Admin\\Security\\App_LocalResources"; break; case "sendpassword.ascx": filePath = "Admin\\Security\\App_LocalResources"; break; case "signin.ascx": filePath = ""; break; } break; case "skins": switch (fileName.Replace(extendedExtension, "")) { case "attributes.ascx": filePath = "DesktopModules\\Admin\\SkinDesigner\\App_LocalResources"; break; case "editskins.ascx": filePath = "DesktopModules\\Admin\\Extensions\\Editors\\App_LocalResources"; break; default: filePath = "Admin\\Skins\\App_LocalResources"; break; } break; case "syndication": filePath = "DesktopModules\\Admin\\FeedExplorer\\App_LocalResources"; break; case "tabs": switch (fileName.Replace(extendedExtension, "")) { case "export.ascx": filePath = "Admin\\Tabs\\App_LocalResources"; break; case "import.ascx": filePath = "Admin\\Tabs\\App_LocalResources"; break; case "managetabs.ascx": filePath = "DesktopModules\\Admin\\Tabs\\App_LocalResources"; break; case "recyclebin.ascx": filePath = "DesktopModules\\Admin\\RecycleBin\\App_LocalResources"; break; case "tabs.ascx": filePath = "DesktopModules\\Admin\\Tabs\\App_LocalResources"; break; } break; case "users": switch (fileName.Replace(extendedExtension, "")) { case "bulkemail.ascx": filePath = "DesktopModules\\Admin\\Newsletters\\App_LocalResources"; fileName = "Newsletter.ascx" + extendedExtension; break; case "editprofiledefinition.ascx": filePath = "DesktopModules\\Admin\\Security\\App_LocalResources"; break; case "manageusers.ascx": filePath = "DesktopModules\\Admin\\Security\\App_LocalResources"; break; case "memberservices.ascx": filePath = "DesktopModules\\Admin\\Security\\App_LocalResources"; break; case "membership.ascx": filePath = "DesktopModules\\Admin\\Security\\App_LocalResources"; break; case "password.ascx": filePath = "DesktopModules\\Admin\\Security\\App_LocalResources"; break; case "profile.ascx": filePath = "DesktopModules\\Admin\\Security\\App_LocalResources"; break; case "profiledefinitions.ascx": filePath = "DesktopModules\\Admin\\Security\\App_LocalResources"; break; case "user.ascx": filePath = "DesktopModules\\Admin\\Security\\App_LocalResources"; break; case "users.ascx": filePath = "DesktopModules\\Admin\\Security\\App_LocalResources"; break; case "usersettings.ascx": filePath = "DesktopModules\\Admin\\Security\\App_LocalResources"; break; case "viewprofile.ascx": filePath = "Admin\\Users\\App_LocalResources"; break; } break; case "vendors": switch (fileName.Replace(extendedExtension, "")) { case "adsense.ascx": filePath = ""; break; case "editadsense.ascx": filePath = ""; break; case "affiliates.ascx": filePath = "DesktopModules\\Admin\\Vendors\\App_LocalResources"; break; case "banneroptions.ascx": filePath = "DesktopModules\\Admin\\Banners\\App_LocalResources"; break; case "banners.ascx": filePath = "DesktopModules\\Admin\\Vendors\\App_LocalResources"; break; case "displaybanners.ascx": filePath = "DesktopModules\\Admin\\Banners\\App_LocalResources"; break; case "editaffiliate.ascx": filePath = "DesktopModules\\Admin\\Vendors\\App_LocalResources"; break; case "editbanner.ascx": filePath = "DesktopModules\\Admin\\Vendors\\App_LocalResources"; break; case "editvendors.ascx": filePath = "DesktopModules\\Admin\\Vendors\\App_LocalResources"; break; case "vendors.ascx": filePath = "DesktopModules\\Admin\\Vendors\\App_LocalResources"; break; } break; } break; case "LocalResource": filePath = Path.Combine("DesktopModules", Path.Combine(moduleName, "App_LocalResources")); //Two assumptions are made here //1. Core files appear in the package before extension files //2. Module packages only include one module if (!_IsCore && _LanguagePack == null) { //Check if language is installed Locale locale = LocaleController.Instance.GetLocale(_Language.Code); if (locale == null) { LegacyError = "CoreLanguageError"; } else { //Attempt to figure out the Extension foreach (KeyValuePair <int, DesktopModuleInfo> kvp in DesktopModuleController.GetDesktopModules(Null.NullInteger)) { if (kvp.Value.FolderName.ToLowerInvariant() == moduleName) { //Found Module - Get Package var dependentPackage = PackageController.Instance.GetExtensionPackage(Null.NullInteger, p => p.PackageID == kvp.Value.PackageID); Package.Name += "_" + dependentPackage.Name; Package.FriendlyName += " " + dependentPackage.FriendlyName; _LanguagePack = new LanguagePackInfo(); _LanguagePack.DependentPackageID = dependentPackage.PackageID; _LanguagePack.LanguageID = locale.LanguageId; break; } } if (_LanguagePack == null) { LegacyError = "DependencyError"; } } } break; case "ProviderResource": filePath = Path.Combine("Providers", Path.Combine(moduleName, "App_LocalResources")); break; case "InstallResource": filePath = "Install\\App_LocalResources"; break; } if (!string.IsNullOrEmpty(filePath)) { AddFile(Path.Combine(filePath, fileName), sourceFileName); } } }
protected void AddNewModule(string title, int desktopModuleId, string paneName, int position, ViewPermissionType permissionType, string align) { TabPermissionCollection objTabPermissions = PortalSettings.ActiveTab.TabPermissions; PermissionController objPermissionController = new PermissionController(); ModuleController objModules = new ModuleController(); Services.Log.EventLog.EventLogController objEventLog = new Services.Log.EventLog.EventLogController(); int j; try { DesktopModuleInfo desktopModule = null; if (!DesktopModuleController.GetDesktopModules(PortalSettings.PortalId).TryGetValue(desktopModuleId, out desktopModule)) { throw new ArgumentException("desktopModuleId"); } } catch (Exception ex) { Exceptions.LogException(ex); } int UserId = -1; if (Request.IsAuthenticated) { UserInfo objUserInfo = UserController.GetCurrentUserInfo(); UserId = objUserInfo.UserID; } foreach (ModuleDefinitionInfo objModuleDefinition in ModuleDefinitionController.GetModuleDefinitionsByDesktopModuleID(desktopModuleId).Values) { ModuleInfo objModule = new ModuleInfo(); objModule.Initialize(PortalSettings.PortalId); objModule.PortalID = PortalSettings.PortalId; objModule.TabID = PortalSettings.ActiveTab.TabID; objModule.ModuleOrder = position; if (String.IsNullOrEmpty(title)) { objModule.ModuleTitle = objModuleDefinition.FriendlyName; } else { objModule.ModuleTitle = title; } objModule.PaneName = paneName; objModule.ModuleDefID = objModuleDefinition.ModuleDefID; if (objModuleDefinition.DefaultCacheTime > 0) { objModule.CacheTime = objModuleDefinition.DefaultCacheTime; if (PortalSettings.Current.DefaultModuleId > Null.NullInteger && PortalSettings.Current.DefaultTabId > Null.NullInteger) { ModuleInfo defaultModule = objModules.GetModule(PortalSettings.Current.DefaultModuleId, PortalSettings.Current.DefaultTabId, true); if (defaultModule != null) { objModule.CacheTime = defaultModule.CacheTime; } } } switch (permissionType) { case ViewPermissionType.View: objModule.InheritViewPermissions = true; break; case ViewPermissionType.Edit: objModule.InheritViewPermissions = false; break; } ArrayList arrSystemModuleViewPermissions = objPermissionController.GetPermissionByCodeAndKey("SYSTEM_MODULE_DEFINITION", "VIEW"); foreach (TabPermissionInfo objTabPermission in objTabPermissions) { if (objTabPermission.PermissionKey == "VIEW" && permissionType == ViewPermissionType.View) { continue; } ArrayList arrSystemModulePermissions = objPermissionController.GetPermissionByCodeAndKey("SYSTEM_MODULE_DEFINITION", objTabPermission.PermissionKey); for (j = 0; j <= arrSystemModulePermissions.Count - 1; j++) { PermissionInfo objSystemModulePermission; objSystemModulePermission = (PermissionInfo)arrSystemModulePermissions[j]; if (objSystemModulePermission.PermissionKey == "VIEW" && permissionType == ViewPermissionType.Edit && objTabPermission.PermissionKey != "EDIT") { continue; } ModulePermissionInfo objModulePermission = AddModulePermission(objModule, objSystemModulePermission, objTabPermission.RoleID, objTabPermission.UserID, objTabPermission.AllowAccess); if (objModulePermission.PermissionKey == "EDIT" && objModulePermission.AllowAccess) { ModulePermissionInfo objModuleViewperm = AddModulePermission(objModule, (PermissionInfo)arrSystemModuleViewPermissions[0], objModulePermission.RoleID, objModulePermission.UserID, true); } } if (objTabPermission.PermissionKey == "EDIT") { ArrayList arrCustomModulePermissions = objPermissionController.GetPermissionsByModuleDefID(objModule.ModuleDefID); for (j = 0; j <= arrCustomModulePermissions.Count - 1; j++) { PermissionInfo objCustomModulePermission; objCustomModulePermission = (PermissionInfo)arrCustomModulePermissions[j]; AddModulePermission(objModule, objCustomModulePermission, objTabPermission.RoleID, objTabPermission.UserID, objTabPermission.AllowAccess); } } } objModule.AllTabs = false; objModule.Alignment = align; objModules.AddModule(objModule); } }
private void rbPackType_SelectedIndexChanged(Object sender, EventArgs e) { pnlLogs.Visible = false; switch (rbPackType.SelectedValue) { case "Core": rowitems.Visible = false; txtFileName.Text = "Core"; lblFilenameFix.Text = Server.HtmlEncode(".<version>.<locale>.zip"); rowFileName.Visible = true; break; case "Module": rowitems.Visible = true; lstItems.Items.Clear(); lstItems.ClearSelection(); foreach (DesktopModuleInfo objDM in DesktopModuleController.GetDesktopModules(Null.NullInteger).Values) { if (!objDM.FolderName.StartsWith("Admin/")) { if (Null.IsNull(objDM.Version)) { lstItems.Items.Add(new ListItem(objDM.FriendlyName, objDM.DesktopModuleID.ToString())); } else { lstItems.Items.Add(new ListItem(objDM.FriendlyName + " [" + objDM.Version + "]", objDM.DesktopModuleID.ToString())); } } } lblItems.Text = Localization.GetString("SelectModules", LocalResourceFile); rowFileName.Visible = false; break; case "Provider": rowitems.Visible = true; lstItems.Items.Clear(); lstItems.ClearSelection(); foreach (PackageInfo objPackage in PackageController.Instance.GetExtensionPackages(Null.NullInteger, p => p.PackageType == "Provider")) { if (Null.IsNull(objPackage.Version)) { lstItems.Items.Add(new ListItem(objPackage.FriendlyName, objPackage.PackageID.ToString())); } else { lstItems.Items.Add(new ListItem(objPackage.FriendlyName + " [" + Globals.FormatVersion(objPackage.Version) + "]", objPackage.PackageID.ToString())); } } rowFileName.Visible = false; break; case "AuthSystem": rowitems.Visible = true; lstItems.Items.Clear(); lstItems.ClearSelection(); foreach (PackageInfo objPackage in PackageController.Instance.GetExtensionPackages(Null.NullInteger, p => p.PackageType == "Auth_System")) { if (Null.IsNull(objPackage.Version)) { lstItems.Items.Add(new ListItem(objPackage.FriendlyName, objPackage.PackageID.ToString())); } else { lstItems.Items.Add(new ListItem(objPackage.FriendlyName + " [" + Globals.FormatVersion(objPackage.Version) + "]", objPackage.PackageID.ToString())); } } rowFileName.Visible = false; break; case "Full": rowitems.Visible = false; txtFileName.Text = "Full"; lblFilenameFix.Text = Server.HtmlEncode(".<version>.<locale>.zip"); rowFileName.Visible = true; break; } }