private void CreatePackage()
 {
     CheckSecurity();
     string manifestName = txtManifestName.Text;
     if (string.IsNullOrEmpty(manifestName))
     {
         manifestName = txtArchiveName.Text.ToLower().Replace("zip", "dnn");
     }
     if (chkPackage.Checked)
     {
         //Use the installer to parse the manifest and load the files that need to be packaged
         var installer = new Installer(Package, Request.MapPath("."));
         foreach (InstallFile file in installer.InstallerInfo.Files.Values)
         {
             _Writer.AddFile(file);
         }
         string basePath;
         switch (Package.PackageType)
         {
             case "Auth_System":
                 basePath = Globals.InstallMapPath + ("AuthSystem");
                 break;
             case "Container":
                 basePath = Globals.InstallMapPath + ("Container");
                 break;
             case "CoreLanguagePack":
             case "ExtensionLanguagePack":
                 basePath = Globals.InstallMapPath + ("Language");
                 break;
             case "Module":
                 basePath = Globals.InstallMapPath + ("Module");
                 break;
             case "Provider":
                 basePath = Globals.InstallMapPath + ("Provider");
                 break;
             case "Skin":
                 basePath = Globals.InstallMapPath + ("Skin");
                 break;
             default:
                 basePath = Globals.HostMapPath;
                 break;
         }
         if (!manifestName.EndsWith(".dnn"))
         {
             manifestName += ".dnn";
         }
         if (!txtArchiveName.Text.EndsWith(".zip"))
         {
             txtArchiveName.Text += ".zip";
         }
         _Writer.CreatePackage(Path.Combine(basePath, txtArchiveName.Text), manifestName, Package.Manifest, true);
         UI.Skins.Skin.AddModuleMessage(this,
                                        string.Format(Localization.GetString("Success", LocalResourceFile),
                                                      ModuleContext.PortalSettings.PortalAlias.HTTPAlias + basePath.Replace(Globals.ApplicationMapPath, "").Replace("\\", "/")),
                                        ModuleMessage.ModuleMessageType.GreenSuccess);
     }
     else if (chkManifest.Checked)
     {
         _Writer.WriteManifest(manifestName, Package.Manifest);
     }
     phInstallLogs.Controls.Add(_Writer.Log.GetLogsTable());
 }
        private void RemoveProVersion()
        {
            foreach (PortalInfo portal in PortalController.Instance.GetPortals())
            {
                //Update Site Redirection management page
                var tabId = TabController.GetTabByTabPath(portal.PortalID, "//Admin//SiteRedirectionManagement", Null.NullString);
                TabInfo newTab;
                if(tabId == Null.NullInteger)
                {
                    newTab = Upgrade.AddAdminPage(portal,
                                                 "Site Redirection Management",
                                                 "Site Redirection Management.",
                                                 "~/desktopmodules/MobileManagement/images/MobileManagement_Standard_16x16.png",
                                                 "~/desktopmodules/MobileManagement/images/MobileManagement_Standard_32x32.png",
                                                 true);
                }
                else
                {
                    newTab = TabController.Instance.GetTab(tabId, portal.PortalID, true);
                    newTab.IconFile = "~/desktopmodules/MobileManagement/images/MobileManagement_Standard_16x16.png";
                    newTab.IconFileLarge = "~/desktopmodules/MobileManagement/images/MobileManagement_Standard_32x32.png";
                    TabController.Instance.UpdateTab(newTab);
                }

                //Remove Pro edition module
                int moduleID = Null.NullInteger;
                IDictionary<int, ModuleInfo> modules = ModuleController.Instance.GetTabModules(newTab.TabID);

                if (modules != null)
                {
                    foreach (ModuleInfo m in modules.Values)
                    {
                        if (m.DesktopModule.FriendlyName == "Site Redirection Management")
                        {
                            moduleID = m.ModuleID;
                            break;
                        }
                    }
                }

                if (moduleID != Null.NullInteger)
                {
                    ModuleController.Instance.DeleteTabModule(newTab.TabID, moduleID, false);
                }

                //Add community edition module
                ModuleDefinitionInfo mDef = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("DNN Site Redirection Management");
                if (mDef != null)
                {
                    Upgrade.AddModuleToPage(newTab, mDef.ModuleDefID, "Site Redirection Management", "~/desktopmodules/MobileManagement/images/MobileManagement_Standard_32x32.png", true);
                }
            }

            var package = PackageController.Instance.GetExtensionPackage(Null.NullInteger, p => p.Name == "DotNetNuke.Professional.MobileManagement");
            if(package != null)
            {
                var installer = new Installer(package, Globals.ApplicationMapPath);
                installer.UnInstall(true);
            }
        }
Пример #3
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// This routine creates the Installer
        /// </summary>
        /// <history>
        ///     [cnurse]   07/26/2007    Created
        /// </history>
        /// -----------------------------------------------------------------------------
        private void CreateInstaller()
        {
            CheckSecurity();
            _Installer = new Installer(TempInstallFolder, ManifestFile, Request.MapPath("."), false);

            //The Installer is created automatically with a SecurityAccessLevel of Host
            //Check if the User has lowere Security and update as neccessary
            if (!ModuleContext.PortalSettings.UserInfo.IsSuperUser)
            {
                if (ModuleContext.PortalSettings.UserInfo.IsInRole(ModuleContext.PortalSettings.AdministratorRoleName))
                {
                    //Admin User
                    Installer.InstallerInfo.SecurityAccessLevel = SecurityAccessLevel.Admin;
                }
                else if (ModulePermissionController.CanAdminModule(ModuleContext.Configuration))
                {
                    //Has Edit rights
                    Installer.InstallerInfo.SecurityAccessLevel = SecurityAccessLevel.Edit;
                }
                else if (ModulePermissionController.CanViewModule(ModuleContext.Configuration))
                {
                    //Has View rights
                    Installer.InstallerInfo.SecurityAccessLevel = SecurityAccessLevel.View;
                }
                else
                {
                    Installer.InstallerInfo.SecurityAccessLevel = SecurityAccessLevel.Anonymous;
                }
            }
            Installer.InstallerInfo.PortalID = InstallPortalId;

            //Read the manifest
            if (Installer.InstallerInfo.ManifestFile != null)
            {
                Installer.ReadManifest(true);
            }
        }
Пример #4
0
        private void LoadPackage(string package)
        {
            var packageType = String.Empty;
            var installFolder = String.Empty;

            if (!String.IsNullOrEmpty(Request.QueryString["ptype"]))
            {
                packageType = Request.QueryString["ptype"];
            }
            switch (packageType)
            {
                case "Auth_System":
                    installFolder = "AuthSystem";
                    break;
                case "CoreLanguagePack":
                case "ExtensionLanguagePack":
                    installFolder = "Language";
                    break;
                case "JavaScript_Library":
                    installFolder = "JavaScriptLibrary";
                    break;
                case "Module":
                case "Skin":
                case "Container":
                case "Provider":
                    installFolder = packageType;
                    break;
                case "Library":
                    installFolder = "Module";
                    break;
                default:
                    break;
            }

            if (!String.IsNullOrEmpty(installFolder))
            {
                FileName = String.Format("{0}\\Install\\{1}\\{2}", Globals.ApplicationMapPath, installFolder, package);
                if (File.Exists(FileName) &&
                        (Path.GetExtension(FileName.ToLower()) == ".zip"
                            || Path.GetExtension(FileName.ToLower()) == ".resources"))
                {
                    _Installer = new Installer(new FileStream(FileName, FileMode.Open, FileAccess.Read),
                                                    Globals.ApplicationMapPath,
                                                    true,
                                                    false);
                    TempInstallFolder = Installer.TempInstallFolder;
                    if (Installer.InstallerInfo.ManifestFile != null)
                    {
                        ManifestFile = Path.GetFileName(Installer.InstallerInfo.ManifestFile.TempFileName);
                    }

                    DeleteFile = true;
                    wizInstall.ActiveStepIndex = 1;
                }
            }
        }
Пример #5
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Wizard_NextButtonClickruns when the next Button is clicked.  It provides
        ///	a mechanism for cancelling the page change if certain conditions aren't met.
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// 	[cnurse]	08/13/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void wizInstall_NextButtonClick(object sender, WizardNavigationEventArgs e)
        {
            switch (e.CurrentStepIndex)
            {
                case 0:
                    HttpPostedFile postedFile = cmdBrowse.PostedFile;
                    string strMessage = "";
                    FileName = Path.GetFileName(postedFile.FileName);
                    string strExtension = Path.GetExtension(FileName);
                    if (string.IsNullOrEmpty(postedFile.FileName))
                    {
                        strMessage = Localization.GetString("NoFile", LocalResourceFile);
                    }
                    else if (strExtension.ToLower() != ".zip")
                    {
                        strMessage += string.Format(Localization.GetString("InvalidExt", LocalResourceFile), FileName);
                    }
                    if (string.IsNullOrEmpty(strMessage))
                    {
                        _Installer = new Installer(postedFile.InputStream, Request.MapPath("."), true, false);
                        TempInstallFolder = Installer.TempInstallFolder;
                        if (Installer.InstallerInfo.ManifestFile != null)
                        {
                            ManifestFile = Path.GetFileName(Installer.InstallerInfo.ManifestFile.TempFileName);
                        }
                    }
                    else
                    {
                        lblLoadMessage.Text = strMessage;
                        lblLoadMessage.Visible = true;
                        e.Cancel = true;
                    }
                    break;
                case 1: //Warning Page
                    e.Cancel = !ValidatePackage();
                    break;
                case 4: //Accept Terms
                    if (chkAcceptLicense.Checked)
                    {
                        InstallPackage(e);
                    }
                    else
                    {
                        lblAcceptMessage.Text = Localization.GetString("AcceptTerms", LocalResourceFile);
                        lblAcceptMessage.Visible = true;
                        e.Cancel = true;

                        //Rebind package
                        BindPackage();
                    }
                    break;
            }
        }
 /// -----------------------------------------------------------------------------
 /// <summary>
 /// This routine uninstalls the package
 /// </summary>
 /// <history>
 ///     [cnurse]   07/31/2007    Created
 /// </history>
 /// -----------------------------------------------------------------------------
 private void UnInstallPackage()
 {
     phPaLogs.Visible = true;
     var installer = new Installer(Package, Request.MapPath("."));
     installer.UnInstall(chkDelete.Checked);
     phPaLogs.Controls.Add(installer.InstallerInfo.Log.GetLogsTable());
 }
Пример #7
0
        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 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;
		}
        private void RemoveProVersion()
        {
            //update the tab module to use CE version
            var tabController = new TabController();
            var moduleController = new ModuleController();
            TabInfo newTab;

            var portalController = new PortalController();

            foreach (PortalInfo portal in portalController.GetPortals())
            {
                //Update Site Redirection management page
                var tabId = TabController.GetTabByTabPath(portal.PortalID, "//Admin//DevicePreviewManagement", Null.NullString);
                if (tabId == Null.NullInteger)
                {
                    newTab = Upgrade.AddAdminPage(portal,
                                                 "Device Preview Management",
                                                 "Device Preview Management.",
                                                 "~/desktopmodules/DevicePreviewManagement/images/DevicePreview_Standard_16X16.png",
                                                 "~/desktopmodules/DevicePreviewManagement/images/DevicePreview_Standard_32X32.png",
                                                 true);
                }
                else
                {
                    newTab = tabController.GetTab(tabId, portal.PortalID, true);
                    newTab.IconFile = "~/desktopmodules/DevicePreviewManagement/images/DevicePreview_Standard_16X16.png";
                    newTab.IconFileLarge = "~/desktopmodules/DevicePreviewManagement/images/DevicePreview_Standard_32X32.png";
                    tabController.UpdateTab(newTab);
                }

                //Remove Pro edition module
                int moduleID = Null.NullInteger;
                IDictionary<int, ModuleInfo> modules = moduleController.GetTabModules(newTab.TabID);

                if (modules != null)
                {
                    foreach (ModuleInfo m in modules.Values)
                    {
                        if (m.DesktopModule.FriendlyName == "Device Preview Management")
                        {
                            moduleID = m.ModuleID;
                            break;
                        }
                    }
                }

                if (moduleID != Null.NullInteger)
                {
                    moduleController.DeleteTabModule(newTab.TabID, moduleID, false);
                }

                //Add community edition module
                ModuleDefinitionInfo mDef = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("DNN Device Preview Management");
                if (mDef != null)
                {
                    Upgrade.AddModuleToPage(newTab, mDef.ModuleDefID, "Device Preview Management", "~/desktopmodules/DevicePreviewManagement/images/DevicePreview_Standard_32X32.png", true);
                }

                //reset default devices created flag
                string defaultPreviewProfiles;
                var settings = PortalController.GetPortalSettingsDictionary(portal.PortalID);
                if (settings.TryGetValue("DefPreviewProfiles_Created", out defaultPreviewProfiles) && defaultPreviewProfiles == "DNNCORP.CE")
                {
                    PortalController.DeletePortalSetting(portal.PortalID, "DefPreviewProfiles_Created");
                }
            }

            var package = PackageController.Instance.GetExtensionPackage(Null.NullInteger, p => p.Name == "DotNetNuke.Professional.PreviewProfileManagement");
            if (package != null)
            {
                var installer = new Installer(package, Globals.ApplicationMapPath);
                installer.UnInstall(true);
            }
        }