private int CreateModuleFromManifest(CreateModuleDto createModuleDto, out string newPageUrl, out string errorMessage) { newPageUrl = string.Empty; errorMessage = string.Empty; if (string.IsNullOrEmpty(createModuleDto.Manifest)) { errorMessage = "MissingManifest"; return(Null.NullInteger); } try { var folder = PathUtils.Instance.RemoveTrailingSlash(GetSourceFolder(createModuleDto)); var manifest = Path.Combine(Globals.ApplicationMapPath, "DesktopModules", folder, createModuleDto.Manifest); var installer = new Installer(manifest, Globals.ApplicationMapPath, true); if (installer.IsValid) { installer.InstallerInfo.Log.Logs.Clear(); installer.Install(); if (installer.IsValid) { if (createModuleDto.AddPage) { var desktopModule = DesktopModuleController.GetDesktopModuleByPackageID(installer.InstallerInfo.PackageID); if (desktopModule != null && desktopModule.ModuleDefinitions.Count > 0) { foreach (var kvp in desktopModule.ModuleDefinitions) { var moduleDefinition = kvp.Value; newPageUrl = CreateNewPage(moduleDefinition); break; } } } return(installer.InstallerInfo.PackageID); } else { errorMessage = "InstallError"; return(Null.NullInteger); } } else { errorMessage = "InstallError"; return(Null.NullInteger); } } catch (Exception ex) { Exceptions.LogException(ex); errorMessage = "CreateModuleFailed"; return(Null.NullInteger); } }
public bool SavePackageSettings(PackageSettingsDto packageSettings, out string errorMessage) { errorMessage = string.Empty; try { var desktopModule = DesktopModuleController.GetDesktopModuleByPackageID(packageSettings.PackageId); if (desktopModule == null) { return(false); } var isHostUser = UserController.Instance.GetCurrentUserInfo().IsSuperUser; this.UpdatePermissions(desktopModule, packageSettings); if (isHostUser) { this.UpdateModuleProperties(desktopModule, packageSettings.Settings); this.UpdateModuleProperties(desktopModule, packageSettings.EditorActions); DesktopModuleController.SaveDesktopModule(desktopModule, false, true); } return(true); } catch (Exception ex) { Logger.Error(ex); errorMessage = ex.Message; return(false); } }
private static void AddModulesToList(int portalId, List <PackageInfo> packages) { Dictionary <int, PortalDesktopModuleInfo> portalModules = DesktopModuleController.GetPortalDesktopModulesByPortalID(portalId); packages.AddRange(from modulePackage in PackageController.Instance.GetExtensionPackages(Null.NullInteger, p => p.PackageType == "Module") let desktopModule = DesktopModuleController.GetDesktopModuleByPackageID(modulePackage.PackageID) from portalModule in portalModules.Values where desktopModule != null && portalModule.DesktopModuleID == desktopModule.DesktopModuleID select modulePackage); }
private void AddModulesToList(List <PackageInfo> packages) { Dictionary <int, PortalDesktopModuleInfo> portalModules = DesktopModuleController.GetPortalDesktopModulesByPortalID(ModuleContext.PortalId); packages.AddRange(from modulePackage in PackageController.GetPackagesByType(Null.NullInteger, "Module") let desktopModule = DesktopModuleController.GetDesktopModuleByPackageID(modulePackage.PackageID) from portalModule in portalModules.Values where desktopModule != null && portalModule.DesktopModuleID == desktopModule.DesktopModuleID select modulePackage); }
public PackageInfoDto GetPackageDetail(int portalId, PackageInfo package) { var desktopModule = DesktopModuleController.GetDesktopModuleByPackageID(package.PackageID); var isHostUser = UserController.Instance.GetCurrentUserInfo().IsSuperUser; var detail = isHostUser ? new ModulePackageDetailDto(portalId, package, desktopModule) : new ModulePackagePermissionsDto(portalId, package); detail.DesktopModuleId = desktopModule.DesktopModuleID; detail.Permissions = GetPermissionsData(portalId, desktopModule.DesktopModuleID); return(detail); }
private ModuleDefinitionInfo ImportManifest(string manifest) { ModuleDefinitionInfo moduleDefinition = null; try { var _Installer = new Installer(manifest, Request.MapPath("."), true); if (_Installer.IsValid) { //Reset Log _Installer.InstallerInfo.Log.Logs.Clear(); //Install _Installer.Install(); if (_Installer.IsValid) { DesktopModuleInfo desktopModule = DesktopModuleController.GetDesktopModuleByPackageID(_Installer.InstallerInfo.PackageID); if (desktopModule != null && desktopModule.ModuleDefinitions.Count > 0) { foreach (KeyValuePair <string, ModuleDefinitionInfo> kvp in desktopModule.ModuleDefinitions) { moduleDefinition = kvp.Value; break; } } } else { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("InstallError.Text", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); phInstallLogs.Controls.Add(_Installer.InstallerInfo.Log.GetLogsTable()); } } else { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("InstallError.Text", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); phInstallLogs.Controls.Add(_Installer.InstallerInfo.Log.GetLogsTable()); } } catch (Exception exc) { Exceptions.LogException(exc); UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ImportControl.ErrorMessage", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); } return(moduleDefinition); }
private void AddModulesToList(List <PackageInfo> packages) { Dictionary <int, PortalDesktopModuleInfo> portalModules = DesktopModuleController.GetPortalDesktopModulesByPortalID(ModuleContext.PortalId); foreach (PackageInfo modulePackage in PackageController.GetPackagesByType(Null.NullInteger, "Module")) { DesktopModuleInfo desktopModule = DesktopModuleController.GetDesktopModuleByPackageID(modulePackage.PackageID); foreach (PortalDesktopModuleInfo portalModule in portalModules.Values) { if (desktopModule != null && portalModule.DesktopModuleID == desktopModule.DesktopModuleID) { packages.Add(modulePackage); } } } }
private ModuleDefinitionInfo ImportManifest() { ModuleDefinitionInfo moduleDefinition = null; try { var folder = PathUtils.Instance.RemoveTrailingSlash(GetSourceFolder()); var manifest = Server.MapPath("~/DesktopModules/" + folder + "/" + cboFile.SelectedValue); var installer = new Installer(manifest, Request.MapPath("."), true); if (installer.IsValid) { installer.InstallerInfo.Log.Logs.Clear(); installer.Install(); if (installer.IsValid) { var desktopModule = DesktopModuleController.GetDesktopModuleByPackageID(installer.InstallerInfo.PackageID); if (desktopModule != null && desktopModule.ModuleDefinitions.Count > 0) { foreach (var kvp in desktopModule.ModuleDefinitions) { moduleDefinition = kvp.Value; break; // TODO: might not be correct. Was : Exit For } } } else { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("InstallError.Text", LocalResourceFile), UI.Skins.Controls.ModuleMessage.ModuleMessageType.RedError); phInstallLogs.Controls.Add(installer.InstallerInfo.Log.GetLogsTable()); } } else { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("InstallError.Text", LocalResourceFile), UI.Skins.Controls.ModuleMessage.ModuleMessageType.RedError); phInstallLogs.Controls.Add(installer.InstallerInfo.Log.GetLogsTable()); } } catch (Exception exc) { Exceptions.LogException(exc); UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ImportControl.ErrorMessage", LocalResourceFile), UI.Skins.Controls.ModuleMessage.ModuleMessageType.RedError); } return(moduleDefinition); }
public void DeleteExtensionPackage(PackageInfo package) { switch (package.PackageType) { case "Auth_System": AuthenticationInfo authSystem = AuthenticationController.GetAuthenticationServiceByPackageID(package.PackageID); if (authSystem != null) { AuthenticationController.DeleteAuthentication(authSystem); } break; case "CoreLanguagePack": LanguagePackInfo languagePack = LanguagePackController.GetLanguagePackByPackage(package.PackageID); if (languagePack != null) { LanguagePackController.DeleteLanguagePack(languagePack); } break; case "Module": var controller = new DesktopModuleController(); DesktopModuleInfo desktopModule = DesktopModuleController.GetDesktopModuleByPackageID(package.PackageID); if (desktopModule != null) { controller.DeleteDesktopModule(desktopModule); } break; case "SkinObject": SkinControlInfo skinControl = SkinControlController.GetSkinControlByPackageID(package.PackageID); if (skinControl != null) { SkinControlController.DeleteSkinControl(skinControl); } break; } DeletePackageInternal(package); }
private void DeleteModule() { try { DesktopModuleInfo tempDesktopModule = DesktopModuleController.GetDesktopModuleByPackageID(Package.PackageID); if (tempDesktopModule != null) { if ((DesktopModule != null) && (!string.IsNullOrEmpty(DesktopModule.CodeSubDirectory))) { Config.RemoveCodeSubDirectory(DesktopModule.CodeSubDirectory); } DesktopModuleController controller = new DesktopModuleController(); controller.DeleteDesktopModule(tempDesktopModule); } Log.AddInfo(string.Format(Util.MODULE_UnRegistered, tempDesktopModule.ModuleName)); } catch (Exception ex) { Log.AddFailure(ex); } }
private void DeleteProvider() { try { //Attempt to get the Desktop Module //Attempt to get the Desktop Module DesktopModuleInfo desktopModule = DesktopModuleController.GetDesktopModuleByPackageID(Package.PackageID); ExtensionUrlProviderInfo tempUrlProvider = ExtensionUrlProviderController.GetProviders(Null.NullInteger) .SingleOrDefault(p => p.DesktopModuleId == desktopModule.DesktopModuleID); if (tempUrlProvider != null) { ExtensionUrlProviderController.DeleteProvider(tempUrlProvider); Log.AddInfo(string.Format(Util.URLPROVIDER_UnRegistered, tempUrlProvider.ProviderName)); } } catch (Exception ex) { Log.AddFailure(ex); } }
/// ----------------------------------------------------------------------------- /// <summary> /// The DeleteModule method deletes the Module from the data Store. /// </summary> /// ----------------------------------------------------------------------------- private void DeleteModule() { try { //Attempt to get the Desktop Module DesktopModuleInfo tempDesktopModule = DesktopModuleController.GetDesktopModuleByPackageID(Package.PackageID); if (tempDesktopModule != null) { var modules = ModuleController.Instance.GetModulesByDesktopModuleId(tempDesktopModule.DesktopModuleID); //Remove CodeSubDirectory if ((_desktopModule != null) && (!string.IsNullOrEmpty(_desktopModule.CodeSubDirectory))) { Config.RemoveCodeSubDirectory(_desktopModule.CodeSubDirectory); } var controller = new DesktopModuleController(); Log.AddInfo(string.Format(Util.MODULE_UnRegistered, tempDesktopModule.ModuleName)); //remove admin/host pages if (!String.IsNullOrEmpty(tempDesktopModule.AdminPage)) { string tabPath = "//Admin//" + tempDesktopModule.AdminPage; var portals = PortalController.Instance.GetPortals(); foreach (PortalInfo portal in portals) { var tabID = TabController.GetTabByTabPath(portal.PortalID, tabPath, Null.NullString); TabInfo temp = TabController.Instance.GetTab(tabID, portal.PortalID); if ((temp != null)) { var mods = TabModulesController.Instance.GetTabModules((temp)); bool noOtherTabModule = true; foreach (ModuleInfo mod in mods) { if (mod.DesktopModuleID != tempDesktopModule.DesktopModuleID) { noOtherTabModule = false; } } if (noOtherTabModule) { Log.AddInfo(string.Format(Util.MODULE_AdminPageRemoved, tempDesktopModule.AdminPage, portal.PortalID)); TabController.Instance.DeleteTab(tabID, portal.PortalID); } Log.AddInfo(string.Format(Util.MODULE_AdminPagemoduleRemoved, tempDesktopModule.AdminPage, portal.PortalID)); } } } if (!String.IsNullOrEmpty(tempDesktopModule.HostPage)) { Upgrade.Upgrade.RemoveHostPage(tempDesktopModule.HostPage); Log.AddInfo(string.Format(Util.MODULE_HostPageRemoved, tempDesktopModule.HostPage)); Log.AddInfo(string.Format(Util.MODULE_HostPagemoduleRemoved, tempDesktopModule.HostPage)); } controller.DeleteDesktopModule(tempDesktopModule); //Remove all the tab versions related with the module. foreach (var module in modules) { var moduleInfo = module as ModuleInfo; if (moduleInfo != null) { TabVersionController.Instance.DeleteTabVersionDetailByModule(moduleInfo.ModuleID); } } } } catch (Exception ex) { Log.AddFailure(ex); } }
public ModulePackageWriter(PackageInfo package) : base(package) { DesktopModule = DesktopModuleController.GetDesktopModuleByPackageID(package.PackageID); Initialize(DesktopModule.FolderName); }
public bool SavePackageSettings(PackageSettingsDto packageSettings, out string errorMessage) { errorMessage = string.Empty; try { var desktopModule = DesktopModuleController.GetDesktopModuleByPackageID(packageSettings.PackageId); var isHostUser = UserController.Instance.GetCurrentUserInfo().IsSuperUser; UpdatePermissions(desktopModule, packageSettings); if (isHostUser) { foreach (var settingName in packageSettings.EditorActions.Keys) { var settingValue = packageSettings.EditorActions[settingName]; switch (settingName.ToLowerInvariant()) { case "foldername": desktopModule.FolderName = settingValue; break; case "category": desktopModule.Category = settingValue; break; case "businesscontroller": desktopModule.BusinessControllerClass = settingValue; break; case "dependencies": desktopModule.Dependencies = settingValue; break; case "hostpermissions": desktopModule.Permissions = settingValue; break; case "premiummodule": desktopModule.IsPremium = Convert.ToBoolean(settingValue); break; case "shareable": desktopModule.Shareable = (ModuleSharing)Convert.ToInt32(settingValue); break; case "assignportal": AssignPortals(desktopModule, JsonConvert.DeserializeObject <IList <ListItemDto> >(settingValue)); break; case "unassignportal": UnassignPortals(desktopModule, JsonConvert.DeserializeObject <IList <ListItemDto> >(settingValue)); break; case "savedefinition": var definition = JsonConvert.DeserializeObject <ModuleDefinitionDto>(settingValue); SaveModuleDefinition(definition); break; case "deletedefinition": DeleteModuleDefinition(Convert.ToInt32(settingValue)); break; case "savemodulecontrol": var moduleControl = JsonConvert.DeserializeObject <ModuleControlDto>(settingValue); SaveModuleControl(moduleControl); break; case "deletemodulecontrol": DeleteModuleControl(Convert.ToInt32(settingValue)); break; } } DesktopModuleController.SaveDesktopModule(desktopModule, false, true); } return(true); } catch (Exception ex) { Logger.Error(ex); errorMessage = ex.Message; return(false); } }