Beispiel #1
0
 public SkinPackageWriter(SkinPackageInfo skinPackage, PackageInfo package, string basePath, string subFolder)
     : base(package)
 {
     _SkinPackage  = skinPackage;
     _SubFolder    = subFolder;
     this.BasePath = Path.Combine(basePath, subFolder);
 }
Beispiel #2
0
        private static void ProcessLegacySkin(string skinFolder, string skinType)
        {
            string skinName = Path.GetFileName(skinFolder);

            if (skinName != "_default")
            {
                SkinPackageInfo skin = new SkinPackageInfo();
                skin.SkinName = skinName;
                skin.SkinType = skinType;
                PackageInfo       package    = CreateSkinPackage(skin);
                SkinPackageWriter skinWriter = new SkinPackageWriter(skin, package);
                skinWriter.GetFiles(false);
                package.Manifest = skinWriter.WriteManifest(true);
                CommonLibrary.Services.Installer.Packages.PackageController.SavePackage(package);
                skin.PackageID     = package.PackageID;
                skin.SkinPackageID = SkinController.AddSkinPackage(skin);
                foreach (InstallFile skinFile in skinWriter.Files.Values)
                {
                    if (skinFile.Type == InstallFileType.Ascx)
                    {
                        if (skinType == "Skin")
                        {
                            SkinController.AddSkin(skin.SkinPackageID, Path.Combine("[G]" + SkinController.RootSkin, Path.Combine(skin.SkinName, skinFile.FullName)));
                        }
                        else
                        {
                            SkinController.AddSkin(skin.SkinPackageID, Path.Combine("[G]" + SkinController.RootContainer, Path.Combine(skin.SkinName, skinFile.FullName)));
                        }
                    }
                }
            }
        }
 protected override void ReadCustomManifest(XPathNavigator nav)
 {
     SkinPackage          = new SkinPackageInfo();
     SkinPackage.PortalID = Package.PortalID;
     SkinPackage.SkinName = Util.ReadElement(nav, SkinNameNodeName);
     base.ReadCustomManifest(nav);
 }
Beispiel #4
0
 protected void ctlSkin_ItemAdded(object sender, PropertyEditorEventArgs e)
 {
     if (!string.IsNullOrEmpty(e.StringValue))
     {
         SkinPackageInfo skin = SkinController.GetSkinByPackageID(PackageID);
         SkinController.AddSkin(skin.SkinPackageID, e.StringValue);
     }
     BindSkin();
 }
        protected void OnDeleteClick(object sender, EventArgs e)
        {
            var failure          = false;
            var strSkinPath      = Globals.ApplicationMapPath.ToLower() + cboSkins.SelectedItem.Value;
            var strContainerPath = Globals.ApplicationMapPath.ToLower() + cboContainers.SelectedItem.Value;

            string strMessage;

            if (UserInfo.IsSuperUser == false && cboSkins.SelectedItem.Value.IndexOf("\\portals\\_default\\", 0) != -1)
            {
                strMessage = Localization.GetString("SkinDeleteFailure", LocalResourceFile);
                UI.Skins.Skin.AddModuleMessage(this, strMessage, ModuleMessage.ModuleMessageType.RedError);
                failure = true;
            }
            else
            {
                if (cboSkins.SelectedIndex > 0)
                {
                    SkinPackageInfo skinPackage = SkinController.GetSkinPackage(PortalId, cboSkins.SelectedItem.Text, "Skin");
                    if (skinPackage != null)
                    {
                        strMessage = Localization.GetString("UsePackageUnInstall", LocalResourceFile);
                        UI.Skins.Skin.AddModuleMessage(this, strMessage, ModuleMessage.ModuleMessageType.RedError);
                        return;
                    }
                    if (Directory.Exists(strSkinPath))
                    {
                        Globals.DeleteFolderRecursive(strSkinPath);
                    }
                    if (Directory.Exists(strSkinPath.Replace("\\" + SkinController.RootSkin.ToLower() + "\\", "\\" + SkinController.RootContainer + "\\")))
                    {
                        Globals.DeleteFolderRecursive(strSkinPath.Replace("\\" + SkinController.RootSkin.ToLower() + "\\", "\\" + SkinController.RootContainer + "\\"));
                    }
                }
                else if (cboContainers.SelectedIndex > 0)
                {
                    var skinPackage = SkinController.GetSkinPackage(PortalId, cboContainers.SelectedItem.Text, "Container");
                    if (skinPackage != null)
                    {
                        strMessage = Localization.GetString("UsePackageUnInstall", LocalResourceFile);
                        UI.Skins.Skin.AddModuleMessage(this, strMessage, ModuleMessage.ModuleMessageType.RedError);
                        return;
                    }
                    if (Directory.Exists(strContainerPath))
                    {
                        Globals.DeleteFolderRecursive(strContainerPath);
                    }
                }
            }
            if (!failure)
            {
                LoadCombos();
                ShowSkins();
                ShowContainers();
            }
        }
Beispiel #6
0
        public static bool CanDeletePackage(PackageInfo package, PortalSettings portalSettings)
        {
            bool bCanDelete = true;

            switch (package.PackageType)
            {
            case "Skin":
            case "Container":
                string          strFolderPath    = string.Empty;
                string          strRootSkin      = package.PackageType == "Skin" ? SkinController.RootSkin : SkinController.RootContainer;
                SkinPackageInfo _SkinPackageInfo = SkinController.GetSkinByPackageID(package.PackageID);
                foreach (System.Collections.Generic.KeyValuePair <int, string> kvp in _SkinPackageInfo.Skins)
                {
                    if (kvp.Value.Contains(Common.Globals.HostMapPath))
                    {
                        strFolderPath = Path.Combine(Path.Combine(Common.Globals.HostMapPath, strRootSkin), _SkinPackageInfo.SkinName);
                    }
                    else
                    {
                        strFolderPath = Path.Combine(Path.Combine(portalSettings.HomeDirectoryMapPath, strRootSkin), _SkinPackageInfo.SkinName);
                    }
                    break;
                }

                bCanDelete = SkinController.CanDeleteSkin(strFolderPath, portalSettings.HomeDirectoryMapPath);
                break;

            case "Provider":
                XmlDocument configDoc    = Config.Load();
                string      providerName = package.Name;
                if (providerName.IndexOf(".") > Null.NullInteger)
                {
                    providerName = providerName.Substring(providerName.IndexOf(".") + 1);
                }
                switch (providerName)
                {
                case "SchedulingProvider":
                    providerName = "DNNScheduler";
                    break;

                case "SearchIndexProvider":
                    providerName = "ModuleIndexProvider";
                    break;

                case "SearchProvider":
                    providerName = "SearchDataStoreProvider";
                    break;
                }
                XPathNavigator providerNavigator = configDoc.CreateNavigator().SelectSingleNode("/configuration/dotnetnuke/*[@defaultProvider='" + providerName + "']");
                bCanDelete = (providerNavigator == null);
                break;
            }
            return(bCanDelete);
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The ReadCustomManifest method reads the custom manifest items.
        /// </summary>
        /// <param name="nav">The XPathNavigator representing the node.</param>
        /// -----------------------------------------------------------------------------
        protected override void ReadCustomManifest(XPathNavigator nav)
        {
            this.SkinPackage          = new SkinPackageInfo();
            this.SkinPackage.PortalID = this.Package.PortalID;

            // Get the Skin name
            this.SkinPackage.SkinName = Util.ReadElement(nav, this.SkinNameNodeName);

            // Call base class
            base.ReadCustomManifest(nav);
        }
        public static bool CanDeletePackage(PackageInfo package, PortalSettings portalSettings)
        {
            bool bCanDelete = true;

            switch (package.PackageType)
            {
            case "Skin":
            case "Container":
                //Need to get path of skin being deleted so we can call the public CanDeleteSkin function in the SkinController
                string          strFolderPath    = string.Empty;
                string          strRootSkin      = package.PackageType == "Skin" ? SkinController.RootSkin : SkinController.RootContainer;
                SkinPackageInfo _SkinPackageInfo = SkinController.GetSkinByPackageID(package.PackageID);
                if (_SkinPackageInfo.PortalID == Null.NullInteger)
                {
                    strFolderPath = Path.Combine(Path.Combine(Globals.HostMapPath, strRootSkin), _SkinPackageInfo.SkinName);
                }
                else
                {
                    strFolderPath = Path.Combine(Path.Combine(portalSettings.HomeDirectoryMapPath, strRootSkin), _SkinPackageInfo.SkinName);
                }

                bCanDelete = SkinController.CanDeleteSkin(strFolderPath, portalSettings.HomeDirectoryMapPath);
                break;

            case "Provider":
                //Check if the provider is the default provider
                XmlDocument configDoc    = Config.Load();
                string      providerName = package.Name;
                if (providerName.IndexOf(".") > Null.NullInteger)
                {
                    providerName = providerName.Substring(providerName.IndexOf(".") + 1);
                }
                switch (providerName)
                {
                case "SchedulingProvider":
                    providerName = "DNNScheduler";
                    break;

                case "SearchIndexProvider":
                    providerName = "ModuleIndexProvider";
                    break;

                case "SearchProvider":
                    providerName = "SearchDataStoreProvider";
                    break;
                }
                XPathNavigator providerNavigator = configDoc.CreateNavigator().SelectSingleNode("/configuration/dotnetnuke/*[@defaultProvider='" + providerName + "']");
                bCanDelete = (providerNavigator == null);
                break;
            }
            return(bCanDelete);
        }
Beispiel #9
0
        private static PackageInfo CreateSkinPackage(SkinPackageInfo skin)
        {
            PackageInfo package = new PackageInfo(new InstallerInfo());

            package.Name         = skin.SkinName;
            package.FriendlyName = skin.SkinName;
            package.Description  = Null.NullString;
            package.Version      = new Version(1, 0, 0);
            package.PackageType  = skin.SkinType;
            package.License      = Util.PACKAGE_NoLicense;
            ParsePackageName(package);
            return(package);
        }
Beispiel #10
0
        private static void CreateSkinManifest(XmlWriter writer, string skinFolder, string skinType, string tempInstallFolder, string subFolder)
        {
            string          skinName = Path.GetFileNameWithoutExtension(skinFolder);
            SkinPackageInfo skin     = new SkinPackageInfo();

            skin.SkinName = skinName;
            skin.SkinType = skinType;
            PackageInfo       package    = CreateSkinPackage(skin);
            SkinPackageWriter skinWriter = new SkinPackageWriter(skin, package, tempInstallFolder, subFolder);

            skinWriter.GetFiles(false);
            skinWriter.SetBasePath();
            skinWriter.WriteManifest(writer, true);
        }
 private void DeleteSkinPackage()
 {
     try
     {
         SkinPackageInfo skinPackage = SkinController.GetSkinByPackageID(Package.PackageID);
         if (skinPackage != null)
         {
             SkinController.DeleteSkinPackage(skinPackage);
         }
         Log.AddInfo(string.Format(Util.SKIN_UnRegistered, skinPackage.SkinName));
     }
     catch (Exception ex)
     {
         Log.AddFailure(ex);
     }
 }
Beispiel #12
0
        private static PackageInfo CreateSkinPackage(SkinPackageInfo skin)
        {
            //Create a Package
            var package = new PackageInfo(new InstallerInfo());

            package.Name         = skin.SkinName;
            package.FriendlyName = skin.SkinName;
            package.Description  = Null.NullString;
            package.Version      = new Version(1, 0, 0);
            package.PackageType  = skin.SkinType;
            package.License      = Util.PACKAGE_NoLicense;

            //See if the Skin is using a Namespace (or is a known skin)
            ParsePackageName(package);

            return(package);
        }
Beispiel #13
0
        private static void ProcessLegacySkin(string skinFolder, string skinType)
        {
            string skinName = Path.GetFileName(skinFolder);

            if (skinName != "_default")
            {
                var skin = new SkinPackageInfo();
                skin.SkinName = skinName;
                skin.SkinType = skinType;

                //Create a Package
                PackageInfo package = CreateSkinPackage(skin);

                //Create a SkinPackageWriter
                var skinWriter = new SkinPackageWriter(skin, package);
                skinWriter.GetFiles(false);

                //Save the manifest
                package.Manifest = skinWriter.WriteManifest(true);

                //Save Package
                PackageController.Instance.SaveExtensionPackage(package);

                //Update Skin Package with new PackageID
                skin.PackageID = package.PackageID;

                //Save Skin Package
                skin.SkinPackageID = SkinController.AddSkinPackage(skin);

                foreach (InstallFile skinFile in skinWriter.Files.Values)
                {
                    if (skinFile.Type == InstallFileType.Ascx)
                    {
                        if (skinType == "Skin")
                        {
                            SkinController.AddSkin(skin.SkinPackageID, Path.Combine("[G]" + SkinController.RootSkin, Path.Combine(skin.SkinName, skinFile.FullName)));
                        }
                        else
                        {
                            SkinController.AddSkin(skin.SkinPackageID, Path.Combine("[G]" + SkinController.RootContainer, Path.Combine(skin.SkinName, skinFile.FullName)));
                        }
                    }
                }
            }
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The DeleteSkinPackage method deletes the Skin Package
        /// from the data Store.
        /// </summary>
        /// -----------------------------------------------------------------------------
        private void DeleteSkinPackage()
        {
            try
            {
                // Attempt to get the Authentication Service
                SkinPackageInfo skinPackage = SkinController.GetSkinByPackageID(this.Package.PackageID);
                if (skinPackage != null)
                {
                    SkinController.DeleteSkinPackage(skinPackage);
                }

                this.Log.AddInfo(string.Format(Util.SKIN_UnRegistered, skinPackage.SkinName));
            }
            catch (Exception ex)
            {
                this.Log.AddFailure(ex);
            }
        }
Beispiel #15
0
        private void BindSkin()
        {
            SkinPackageInfo skin = SkinController.GetSkinByPackageID(PackageID);

            if (!ModuleContext.PortalSettings.ActiveTab.IsSuperTab)
            {
                skinFormReadOnly.DataSource = skin;
                skinFormReadOnly.DataBind();
                skinFormReadOnly.Visible = true;

                lblHelp.Visible = false;
            }
            if (skin != null && ModuleContext.PortalSettings.ActiveTab.IsSuperTab)
            {
                skinForm.DataSource = skin;
                skinForm.DataBind();
                skinForm.Visible = true;
            }
        }
Beispiel #16
0
        private static void CreateSkinManifest(XmlWriter writer, string skinFolder, string skinType, string tempInstallFolder, string subFolder)
        {
            string skinName = Path.GetFileNameWithoutExtension(skinFolder);
            var    skin     = new SkinPackageInfo();

            skin.SkinName = skinName;
            skin.SkinType = skinType;

            //Create a Package
            PackageInfo package = CreateSkinPackage(skin);

            //Create a SkinPackageWriter
            var skinWriter = new SkinPackageWriter(skin, package, tempInstallFolder, subFolder);

            skinWriter.GetFiles(false);

            //We need to reset the BasePath so it using the correct basePath rather than the Temp InstallFolder
            skinWriter.SetBasePath();

            //Writer package manifest fragment to writer
            skinWriter.WriteManifest(writer, true);
        }
 public SkinPackageWriter(SkinPackageInfo skinPackage, PackageInfo package, string basePath) : base(package)
 {
     _SkinPackage = skinPackage;
     BasePath     = basePath;
 }
 public SkinPackageWriter(SkinPackageInfo skinPackage, PackageInfo package) : base(package)
 {
     _SkinPackage = skinPackage;
     SetBasePath();
 }
 public SkinPackageWriter(PackageInfo package) : base(package)
 {
     _SkinPackage = SkinController.GetSkinByPackageID(package.PackageID);
     SetBasePath();
 }
 public ContainerPackageWriter(SkinPackageInfo skinPackage, PackageInfo package) : base(skinPackage, package)
 {
     BasePath = "Portals\\_default\\Containers\\" + skinPackage.SkinName;
 }
Beispiel #21
0
        public static bool CanDeletePackage(PackageInfo package, PortalSettings portalSettings)
        {
            bool bCanDelete = true;

            var dependencies = Instance.GetPackageDependencies(d => d.PackageName == package.Name && d.Version <= package.Version);

            if (dependencies.Count > 0)
            {
                //There is at least one package dependent on this package.
                foreach (var dependency in dependencies)
                {
                    var dep = dependency;

                    //Check if there is an alternative package
                    var packages = Instance.GetExtensionPackages(package.PortalID,
                                                                 p => p.Name == dep.PackageName &&
                                                                 p.Version >= dep.Version &&
                                                                 p.PackageID != package.PackageID);
                    if (packages.Count == 0)
                    {
                        bCanDelete = false;
                    }
                }
            }

            if (bCanDelete)
            {
                switch (package.PackageType)
                {
                case "Skin":
                case "Container":
                    //Need to get path of skin being deleted so we can call the public CanDeleteSkin function in the SkinController
                    string          strRootSkin      = package.PackageType == "Skin" ? SkinController.RootSkin : SkinController.RootContainer;
                    SkinPackageInfo _SkinPackageInfo = SkinController.GetSkinByPackageID(package.PackageID);
                    string          strFolderPath    = Path.Combine(_SkinPackageInfo.PortalID == Null.NullInteger
                                                                ? Path.Combine(Globals.HostMapPath, strRootSkin)
                                                                : Path.Combine(portalSettings.HomeDirectoryMapPath, strRootSkin), _SkinPackageInfo.SkinName);

                    bCanDelete = SkinController.CanDeleteSkin(strFolderPath, portalSettings.HomeDirectoryMapPath);
                    break;

                case "Provider":
                    //Check if the provider is the default provider
                    XmlDocument configDoc    = Config.Load();
                    string      providerName = package.Name;
                    if (providerName.IndexOf(".", StringComparison.Ordinal) > Null.NullInteger)
                    {
                        providerName = providerName.Substring(providerName.IndexOf(".", StringComparison.Ordinal) + 1);
                    }
                    switch (providerName)
                    {
                    case "SchedulingProvider":
                        providerName = "DNNScheduler";
                        break;

                    case "SearchIndexProvider":
                        providerName = "ModuleIndexProvider";
                        break;

                    case "SearchProvider":
                        providerName = "SearchDataStoreProvider";
                        break;
                    }
                    XPathNavigator providerNavigator = configDoc.CreateNavigator().SelectSingleNode("/configuration/dotnetnuke/*[@defaultProvider='" + providerName + "']");
                    bCanDelete = (providerNavigator == null);
                    break;
                }
            }

            return(bCanDelete);
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The Install method installs the skin component
        /// </summary>
        public override void Install()
        {
            bool bAdd = Null.NullBoolean;

            try
            {
                //Attempt to get the Skin Package
                TempSkinPackage = SkinController.GetSkinPackage(SkinPackage.PortalID, SkinPackage.SkinName, SkinType);
                if (TempSkinPackage == null)
                {
                    bAdd = true;
                    SkinPackage.PackageID = Package.PackageID;
                }
                else
                {
                    SkinPackage.SkinPackageID = TempSkinPackage.SkinPackageID;
                    if (TempSkinPackage.PackageID != Package.PackageID)
                    {
                        Completed = false;
                        Log.AddFailure(Util.SKIN_Installed);
                        return;
                    }
                    else
                    {
                        SkinPackage.PackageID = TempSkinPackage.PackageID;
                    }
                }
                SkinPackage.SkinType = SkinType;
                if (bAdd)
                {
                    //Add new skin package
                    SkinPackage.SkinPackageID = SkinController.AddSkinPackage(SkinPackage);
                }
                else
                {
                    //Update skin package
                    SkinController.UpdateSkinPackage(SkinPackage);
                }
                Log.AddInfo(string.Format(Util.SKIN_Registered, SkinPackage.SkinName));

                //install (copy the files) by calling the base class
                base.Install();

                //process the list of skin files
                if (SkinFiles.Count > 0)
                {
                    Log.StartJob(Util.SKIN_BeginProcessing);
                    string strMessage = Null.NullString;
                    var    NewSkin    = new SkinFileProcessor(RootPath, SkinRoot, SkinPackage.SkinName);
                    foreach (string skinFile in SkinFiles)
                    {
                        strMessage += NewSkin.ProcessFile(skinFile, SkinParser.Portable);
                        skinFile.Replace(Globals.HostMapPath + "\\", "[G]");
                        switch (Path.GetExtension(skinFile))
                        {
                        case ".htm":
                            SkinController.AddSkin(SkinPackage.SkinPackageID, skinFile.Replace("htm", "ascx"));
                            break;

                        case ".html":
                            SkinController.AddSkin(SkinPackage.SkinPackageID, skinFile.Replace("html", "ascx"));
                            break;

                        case ".ascx":
                            SkinController.AddSkin(SkinPackage.SkinPackageID, skinFile);
                            break;
                        }
                    }
                    Array arrMessage = strMessage.Split(new[] { "<br />" }, StringSplitOptions.None);
                    foreach (string strRow in arrMessage)
                    {
                        Log.AddInfo(HtmlUtils.StripTags(strRow, true));
                    }
                    Log.EndJob(Util.SKIN_EndProcessing);
                }
                Completed = true;
            }
            catch (Exception ex)
            {
                Log.AddFailure(ex);
            }
        }
        public static int AddPackage(PackageInfo package, bool includeDetail)
        {
            int packageID = provider.AddPackage(package.PortalID,
                                                package.Name,
                                                package.FriendlyName,
                                                package.Description,
                                                package.PackageType,
                                                package.Version.ToString(3),
                                                package.License,
                                                package.Manifest,
                                                package.Owner,
                                                package.Organization,
                                                package.Url,
                                                package.Email,
                                                package.ReleaseNotes,
                                                package.IsSystemPackage,
                                                UserController.GetCurrentUserInfo().UserID,
                                                package.FolderName,
                                                package.IconFile);
            var objEventLog = new EventLogController();

            objEventLog.AddLog(package, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.PACKAGE_CREATED);
            if (includeDetail)
            {
                Locale           locale;
                LanguagePackInfo languagePack;
                switch (package.PackageType)
                {
                case "Auth_System":
                    //Create a new Auth System
                    var authSystem = new AuthenticationInfo();
                    authSystem.AuthenticationType = package.Name;
                    authSystem.IsEnabled          = Null.NullBoolean;
                    authSystem.PackageID          = packageID;
                    AuthenticationController.AddAuthentication(authSystem);
                    break;

                case "Container":
                case "Skin":
                    var skinPackage = new SkinPackageInfo();
                    skinPackage.SkinName  = package.Name;
                    skinPackage.PackageID = packageID;
                    skinPackage.SkinType  = package.PackageType;
                    SkinController.AddSkinPackage(skinPackage);
                    break;

                case "CoreLanguagePack":
                    locale                          = LocaleController.Instance.GetLocale(PortalController.GetCurrentPortalSettings().DefaultLanguage);
                    languagePack                    = new LanguagePackInfo();
                    languagePack.PackageID          = packageID;
                    languagePack.LanguageID         = locale.LanguageId;
                    languagePack.DependentPackageID = -2;
                    LanguagePackController.SaveLanguagePack(languagePack);
                    break;

                case "ExtensionLanguagePack":
                    locale                          = LocaleController.Instance.GetLocale(PortalController.GetCurrentPortalSettings().DefaultLanguage);
                    languagePack                    = new LanguagePackInfo();
                    languagePack.PackageID          = packageID;
                    languagePack.LanguageID         = locale.LanguageId;
                    languagePack.DependentPackageID = Null.NullInteger;
                    LanguagePackController.SaveLanguagePack(languagePack);
                    break;

                case "Module":
                    //Create a new DesktopModule
                    var desktopModule = new DesktopModuleInfo();
                    desktopModule.PackageID         = packageID;
                    desktopModule.ModuleName        = package.Name;
                    desktopModule.FriendlyName      = package.FriendlyName;
                    desktopModule.FolderName        = package.Name;
                    desktopModule.Description       = package.Description;
                    desktopModule.Version           = package.Version.ToString(3);
                    desktopModule.SupportedFeatures = 0;
                    int desktopModuleId = DesktopModuleController.SaveDesktopModule(desktopModule, false, true);
                    if (desktopModuleId > Null.NullInteger)
                    {
                        DesktopModuleController.AddDesktopModuleToPortals(desktopModuleId);
                    }
                    break;

                case "SkinObject":
                    var skinControl = new SkinControlInfo();
                    skinControl.PackageID  = packageID;
                    skinControl.ControlKey = package.Name;
                    SkinControlController.SaveSkinControl(skinControl);
                    break;
                }
            }

            DataCache.ClearPackagesCache(package.PortalID);
            return(packageID);
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// wizNewExtension_NextButtonClick 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/25/2008	created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void wizNewExtension_NextButtonClick(object sender, WizardNavigationEventArgs e)
        {
            switch (e.CurrentStepIndex)
            {
            case 0:
                if (extensionForm.IsValid)
                {
                    var         newPackage = extensionForm.DataSource as PackageInfo;
                    PackageInfo tmpPackage = PackageController.Instance.GetExtensionPackage(Null.NullInteger, p => p.Name == newPackage.Name);
                    if (tmpPackage == null)
                    {
                        switch (Mode)
                        {
                        case "All":
                            newPackage.PackageType = cboExtensionType.SelectedValue;
                            break;

                        default:
                            newPackage.PackageType = Mode;
                            break;
                        }
                        PackageController.Instance.SaveExtensionPackage(newPackage);
                        PackageID = newPackage.PackageID;
                        Locale           locale;
                        LanguagePackInfo languagePack;
                        switch (newPackage.PackageType)
                        {
                        case "Auth_System":
                            //Create a new Auth System
                            var authSystem = new AuthenticationInfo
                            {
                                AuthenticationType = newPackage.Name,
                                IsEnabled          = Null.NullBoolean,
                                PackageID          = newPackage.PackageID
                            };
                            AuthenticationController.AddAuthentication(authSystem);
                            break;

                        case "Container":
                        case "Skin":
                            var skinPackage = new SkinPackageInfo
                            {
                                SkinName  = newPackage.Name,
                                PackageID = newPackage.PackageID,
                                SkinType  = newPackage.PackageType
                            };
                            SkinController.AddSkinPackage(skinPackage);
                            break;

                        case "CoreLanguagePack":
                            locale       = LocaleController.Instance.GetLocale(PortalController.Instance.GetCurrentPortalSettings().DefaultLanguage);
                            languagePack = new LanguagePackInfo
                            {
                                PackageID          = newPackage.PackageID,
                                LanguageID         = locale.LanguageId,
                                DependentPackageID = -2
                            };
                            LanguagePackController.SaveLanguagePack(languagePack);
                            break;

                        case "ExtensionLanguagePack":
                            locale       = LocaleController.Instance.GetLocale(PortalController.Instance.GetCurrentPortalSettings().DefaultLanguage);
                            languagePack = new LanguagePackInfo
                            {
                                PackageID          = newPackage.PackageID,
                                LanguageID         = locale.LanguageId,
                                DependentPackageID = Null.NullInteger
                            };
                            LanguagePackController.SaveLanguagePack(languagePack);
                            break;

                        case "Module":
                            //Create a new DesktopModule
                            var desktopModule = new DesktopModuleInfo
                            {
                                PackageID         = newPackage.PackageID,
                                ModuleName        = newPackage.Name,
                                FriendlyName      = newPackage.FriendlyName,
                                FolderName        = newPackage.Name,
                                Description       = newPackage.Description,
                                Version           = newPackage.Version.ToString(3),
                                SupportedFeatures = 0
                            };
                            int desktopModuleId = DesktopModuleController.SaveDesktopModule(desktopModule, false, true);
                            if (desktopModuleId > Null.NullInteger)
                            {
                                DesktopModuleController.AddDesktopModuleToPortals(desktopModuleId);
                            }
                            break;

                        case "SkinObject":
                            var skinControl = new SkinControlInfo {
                                PackageID = newPackage.PackageID, ControlKey = newPackage.Name
                            };
                            SkinControlController.SaveSkinControl(skinControl);
                            break;
                        }
                    }
                    else
                    {
                        e.Cancel         = true;
                        lblError.Text    = string.Format(Localization.GetString("DuplicateName", LocalResourceFile), newPackage.Name);
                        lblError.Visible = true;
                    }
                }
                if (PackageEditor != null && PackageID > Null.NullInteger)
                {
                    BindPackageEditor();
                }
                break;

            case 1:
                if (PackageEditor != null)
                {
                    PackageEditor.UpdatePackage();
                }
                break;

            case 2:
                if (ownerForm.IsValid)
                {
                    PackageController.Instance.SaveExtensionPackage(ownerForm.DataSource as PackageInfo);
                }
                Response.Redirect(Globals.NavigateURL(), true);
                break;
            }
        }