/// <summary>
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        private bool CreateModuleDefinition()
        {
            try
            {
                if (PackageController.Instance.GetExtensionPackage(Null.NullInteger, p => p.Name == GetClassName()) == null)
                {
                    var controlName = Null.NullString;

                    //Create module folder
                    CreateModuleFolder();

                    //Create module control
                    controlName = CreateModuleControl();
                    if (controlName != "")
                    {
                        //Create package
                        var objPackage = new PackageInfo();
                        objPackage.Name         = GetClassName();
                        objPackage.FriendlyName = txtModule.Text;
                        objPackage.Description  = txtDescription.Text;
                        objPackage.Version      = new Version(1, 0, 0);
                        objPackage.PackageType  = "Module";
                        objPackage.License      = "";
                        objPackage.Owner        = txtOwner.Text;
                        objPackage.Organization = txtOwner.Text;
                        objPackage.FolderName   = "DesktopModules/" + GetFolderName();
                        objPackage.License      = "The license for this package is not currently included within the installation file, please check with the vendor for full license details.";
                        objPackage.ReleaseNotes = "This package has no Release Notes.";
                        PackageController.Instance.SaveExtensionPackage(objPackage);

                        //Create desktopmodule
                        var objDesktopModules = new DesktopModuleController();
                        var objDesktopModule  = new DesktopModuleInfo();
                        objDesktopModule.DesktopModuleID         = Null.NullInteger;
                        objDesktopModule.ModuleName              = GetClassName();
                        objDesktopModule.FolderName              = GetFolderName();
                        objDesktopModule.FriendlyName            = txtModule.Text;
                        objDesktopModule.Description             = txtDescription.Text;
                        objDesktopModule.IsPremium               = false;
                        objDesktopModule.IsAdmin                 = false;
                        objDesktopModule.Version                 = "01.00.00";
                        objDesktopModule.BusinessControllerClass = "";
                        objDesktopModule.CompatibleVersions      = "";
                        objDesktopModule.Dependencies            = "";
                        objDesktopModule.Permissions             = "";
                        objDesktopModule.PackageID               = objPackage.PackageID;
                        objDesktopModule.DesktopModuleID         = objDesktopModules.AddDesktopModule(objDesktopModule);
                        objDesktopModule = objDesktopModules.GetDesktopModule(objDesktopModule.DesktopModuleID);

                        //Add OwnerName to the DesktopModule taxonomy and associate it with this module
                        var vocabularyId      = -1;
                        var termId            = -1;
                        var objTermController = DotNetNuke.Entities.Content.Common.Util.GetTermController();
                        var objTerms          = objTermController.GetTermsByVocabulary("Module_Categories");
                        foreach (Term term in objTerms)
                        {
                            vocabularyId = term.VocabularyId;
                            if (term.Name == txtOwner.Text)
                            {
                                termId = term.TermId;
                            }
                        }
                        if (termId == -1)
                        {
                            termId = objTermController.AddTerm(new Term(vocabularyId)
                            {
                                Name = txtOwner.Text
                            });
                        }
                        var objTerm = objTermController.GetTerm(termId);
                        var objContentController = DotNetNuke.Entities.Content.Common.Util.GetContentController();
                        var objContent           = objContentController.GetContentItem(objDesktopModule.ContentItemId);
                        objTermController.AddTermToContent(objTerm, objContent);

                        //Add desktopmodule to all portals
                        DesktopModuleController.AddDesktopModuleToPortals(objDesktopModule.DesktopModuleID);

                        //Create module definition
                        var objModuleDefinition = new ModuleDefinitionInfo();
                        objModuleDefinition.ModuleDefID     = Null.NullInteger;
                        objModuleDefinition.DesktopModuleID = objDesktopModule.DesktopModuleID;
                        // need core enhancement to have a unique DefinitionName
                        objModuleDefinition.FriendlyName = GetClassName();
                        //objModuleDefinition.FriendlyName = txtModule.Text;
                        //objModuleDefinition.DefinitionName = GetClassName();
                        objModuleDefinition.DefaultCacheTime = 0;
                        objModuleDefinition.ModuleDefID      = ModuleDefinitionController.SaveModuleDefinition(objModuleDefinition, false, true);

                        //Create modulecontrol
                        var objModuleControl = new ModuleControlInfo();
                        objModuleControl.ModuleControlID          = Null.NullInteger;
                        objModuleControl.ModuleDefID              = objModuleDefinition.ModuleDefID;
                        objModuleControl.ControlKey               = "";
                        objModuleControl.ControlSrc               = "DesktopModules/" + GetFolderName() + "/" + controlName;
                        objModuleControl.ControlTitle             = "";
                        objModuleControl.ControlType              = SecurityAccessLevel.View;
                        objModuleControl.HelpURL                  = "";
                        objModuleControl.IconFile                 = "";
                        objModuleControl.ViewOrder                = 0;
                        objModuleControl.SupportsPartialRendering = false;
                        objModuleControl.SupportsPopUps           = false;
                        ModuleControlController.AddModuleControl(objModuleControl);

                        //Update current module to reference new moduledefinition
                        var objModules = new ModuleController();
                        var objModule  = objModules.GetModule(ModuleId, TabId, false);
                        objModule.ModuleDefID = objModuleDefinition.ModuleDefID;
                        objModule.ModuleTitle = txtModule.Text;

                        //HACK - need core enhancement to be able to update ModuleDefID
                        DotNetNuke.Data.DataProvider.Instance().ExecuteSQL("Update dbo.Modules set ModuleDefID = " + objModule.ModuleDefID.ToString() + " where ModuleID = " + ModuleId.ToString());

                        objModules.UpdateModule(objModule);

                        return(true);
                    }
                    else
                    {
                        DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("TemplateProblem.ErrorMessage", LocalResourceFile), ModuleMessage.ModuleMessageType.YellowWarning);
                        return(false);
                    }
                }
                else
                {
                    DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("AlreadyExists.ErrorMessage", LocalResourceFile), ModuleMessage.ModuleMessageType.YellowWarning);
                    return(false);
                }
            }
            catch (Exception exc)
            {
                Exceptions.LogException(exc);
                DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, exc.ToString(), ModuleMessage.ModuleMessageType.RedError);
                return(false);
            }
        }
        private int CreateModuleFromControl(CreateModuleDto createModuleDto, out string newPageUrl, out string errorMessage)
        {
            newPageUrl   = string.Empty;
            errorMessage = string.Empty;
            if (string.IsNullOrEmpty(createModuleDto.FileName))
            {
                errorMessage = "NoControl";
                return(Null.NullInteger);
            }

            try
            {
                var folder        = PathUtils.Instance.RemoveTrailingSlash(this.GetSourceFolder(createModuleDto));
                var friendlyName  = createModuleDto.ModuleName;
                var name          = createModuleDto.ModuleName;
                var moduleControl = "DesktopModules/" + folder + "/" + createModuleDto.FileName;

                var packageInfo = PackageController.Instance.GetExtensionPackage(Null.NullInteger, p =>
                                                                                 p.Name.Equals(createModuleDto.ModuleName, StringComparison.OrdinalIgnoreCase) ||
                                                                                 p.FriendlyName.Equals(createModuleDto.ModuleName, StringComparison.OrdinalIgnoreCase));
                if (packageInfo != null)
                {
                    errorMessage = "NonuniqueName";
                    return(Null.NullInteger);
                }

                var package = new PackageInfo
                {
                    Name         = name,
                    FriendlyName = friendlyName,
                    Description  = createModuleDto.Description,
                    Version      = new Version(1, 0, 0),
                    PackageType  = "Module",
                    License      = Util.PACKAGE_NoLicense
                };

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

                var objDesktopModule = new DesktopModuleInfo
                {
                    DesktopModuleID         = Null.NullInteger,
                    ModuleName              = name,
                    FolderName              = folder,
                    FriendlyName            = friendlyName,
                    Description             = createModuleDto.Description,
                    IsPremium               = false,
                    IsAdmin                 = false,
                    Version                 = "01.00.00",
                    BusinessControllerClass = "",
                    CompatibleVersions      = "",
                    Dependencies            = "",
                    Permissions             = "",
                    PackageID               = package.PackageID
                };

                objDesktopModule.DesktopModuleID = DesktopModuleController.SaveDesktopModule(objDesktopModule, false, true);

                //Add module to all portals
                DesktopModuleController.AddDesktopModuleToPortals(objDesktopModule.DesktopModuleID);

                //Save module definition
                var moduleDefinition = new ModuleDefinitionInfo();

                moduleDefinition.ModuleDefID      = Null.NullInteger;
                moduleDefinition.DesktopModuleID  = objDesktopModule.DesktopModuleID;
                moduleDefinition.FriendlyName     = friendlyName;
                moduleDefinition.DefaultCacheTime = 0;

                moduleDefinition.ModuleDefID = ModuleDefinitionController.SaveModuleDefinition(moduleDefinition, false, true);

                //Save module control
                var objModuleControl = new ModuleControlInfo();

                objModuleControl.ModuleControlID          = Null.NullInteger;
                objModuleControl.ModuleDefID              = moduleDefinition.ModuleDefID;
                objModuleControl.ControlKey               = "";
                objModuleControl.ControlSrc               = moduleControl;
                objModuleControl.ControlTitle             = "";
                objModuleControl.ControlType              = SecurityAccessLevel.View;
                objModuleControl.HelpURL                  = "";
                objModuleControl.IconFile                 = "";
                objModuleControl.ViewOrder                = 0;
                objModuleControl.SupportsPartialRendering = false;

                ModuleControlController.AddModuleControl(objModuleControl);

                if (createModuleDto.AddPage)
                {
                    newPageUrl = this.CreateNewPage(moduleDefinition);
                }

                return(package.PackageID);
            }
            catch (Exception ex)
            {
                Exceptions.LogException(ex);
                errorMessage = "CreateModuleFailed";
                return(Null.NullInteger);
            }
        }
Ejemplo n.º 3
0
        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);

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

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

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

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

                case "Module":
                    DesktopModuleInfo 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":
                    SkinControlInfo skinControl = new SkinControlInfo();
                    skinControl.PackageID  = packageID;
                    skinControl.ControlKey = package.Name;
                    SkinControlController.SaveSkinControl(skinControl);
                    break;
                }
            }
            return(packageID);
        }
Ejemplo n.º 4
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The Commit method finalises the Install and commits any pending changes.
        /// </summary>
        /// <remarks>In the case of Modules this is not neccessary.</remarks>
        /// -----------------------------------------------------------------------------
        public override void Commit()
        {
            // Add CodeSubDirectory
            if (!string.IsNullOrEmpty(this._desktopModule.CodeSubDirectory))
            {
                Config.AddCodeSubDirectory(this._desktopModule.CodeSubDirectory);
            }

            if (this._desktopModule.SupportedFeatures == Null.NullInteger)
            {
                // Set an Event Message so the features are loaded by reflection on restart
                var oAppStartMessage = new EventMessage
                {
                    Priority         = MessagePriority.High,
                    ExpirationDate   = DateTime.Now.AddYears(-1),
                    SentDate         = DateTime.Now,
                    Body             = string.Empty,
                    ProcessorType    = "DotNetNuke.Entities.Modules.EventMessageProcessor, DotNetNuke",
                    ProcessorCommand = "UpdateSupportedFeatures",
                };

                // Add custom Attributes for this message
                oAppStartMessage.Attributes.Add("BusinessControllerClass", this._desktopModule.BusinessControllerClass);
                oAppStartMessage.Attributes.Add("desktopModuleID", this._desktopModule.DesktopModuleID.ToString());

                // send it to occur on next App_Start Event
                EventQueueController.SendMessage(oAppStartMessage, "Application_Start_FirstRequest");
            }

            // Add Event Message
            if (this._eventMessage != null)
            {
                if (!string.IsNullOrEmpty(this._eventMessage.Attributes["UpgradeVersionsList"]))
                {
                    this._eventMessage.Attributes.Set("desktopModuleID", this._desktopModule.DesktopModuleID.ToString());
                    EventQueueController.SendMessage(this._eventMessage, "Application_Start");
                }
            }

            // Add DesktopModule to all portals
            if (!this._desktopModule.IsPremium)
            {
                DesktopModuleController.AddDesktopModuleToPortals(this._desktopModule.DesktopModuleID);
            }

            // Add DesktopModule to all portals
            if (!string.IsNullOrEmpty(this._desktopModule.AdminPage))
            {
                foreach (PortalInfo portal in PortalController.Instance.GetPortals())
                {
                    bool createdNewPage = false, addedNewModule = false;
                    DesktopModuleController.AddDesktopModulePageToPortal(this._desktopModule, this._desktopModule.AdminPage, portal.PortalID, ref createdNewPage, ref addedNewModule);

                    if (createdNewPage)
                    {
                        this.Log.AddInfo(string.Format(Util.MODULE_AdminPageAdded, this._desktopModule.AdminPage, portal.PortalID));
                    }

                    if (addedNewModule)
                    {
                        this.Log.AddInfo(string.Format(Util.MODULE_AdminPagemoduleAdded, this._desktopModule.AdminPage, portal.PortalID));
                    }
                }
            }

            // Add host items
            if (this._desktopModule.Page != null && !string.IsNullOrEmpty(this._desktopModule.HostPage))
            {
                bool createdNewPage = false, addedNewModule = false;
                DesktopModuleController.AddDesktopModulePageToPortal(this._desktopModule, this._desktopModule.HostPage, Null.NullInteger, ref createdNewPage, ref addedNewModule);

                if (createdNewPage)
                {
                    this.Log.AddInfo(string.Format(Util.MODULE_HostPageAdded, this._desktopModule.HostPage));
                }

                if (addedNewModule)
                {
                    this.Log.AddInfo(string.Format(Util.MODULE_HostPagemoduleAdded, this._desktopModule.HostPage));
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// </summary>
        /// <remarks>
        /// Loads the cboSource control list with locations of controls.
        /// </remarks>
        /// <history>
        /// </history>
        private ModuleDefinitionInfo ImportControl(string controlSrc)
        {
            ModuleDefinitionInfo moduleDefinition = null;

            try
            {
                string folder        = PathUtils.Instance.RemoveTrailingSlash(GetSourceFolder());
                string friendlyName  = txtName.Text;
                string name          = GetClassName();
                string moduleControl = "DesktopModules/" + folder + "/" + controlSrc;

                var packageInfo = PackageController.GetPackages().FirstOrDefault(p => p.Name == name || p.FriendlyName == friendlyName);
                if (packageInfo != null)
                {
                    UI.Skins.Skin.AddModuleMessage(this, String.Format(Localization.GetString("NonuniqueNameModule", LocalResourceFile), packageInfo.FriendlyName), ModuleMessage.ModuleMessageType.RedError);
                }
                else
                {
                    var package = new PackageInfo();
                    package.Name         = name;
                    package.FriendlyName = friendlyName;
                    package.Description  = txtDescription.Text;
                    package.Version      = new Version(1, 0, 0);
                    package.PackageType  = "Module";
                    package.License      = Util.PACKAGE_NoLicense;

                    //Save Package
                    PackageController.SavePackage(package);

                    var objDesktopModules = new DesktopModuleController();
                    var objDesktopModule  = new DesktopModuleInfo();

                    objDesktopModule.DesktopModuleID         = Null.NullInteger;
                    objDesktopModule.ModuleName              = name;
                    objDesktopModule.FolderName              = folder;
                    objDesktopModule.FriendlyName            = friendlyName;
                    objDesktopModule.Description             = txtDescription.Text;
                    objDesktopModule.IsPremium               = false;
                    objDesktopModule.IsAdmin                 = false;
                    objDesktopModule.Version                 = "01.00.00";
                    objDesktopModule.BusinessControllerClass = "";
                    objDesktopModule.CompatibleVersions      = "";
                    objDesktopModule.Dependencies            = "";
                    objDesktopModule.Permissions             = "";
                    objDesktopModule.PackageID               = package.PackageID;

#pragma warning disable 612,618
                    objDesktopModule.DesktopModuleID = objDesktopModules.AddDesktopModule(objDesktopModule);
#pragma warning restore 612,618

                    //Add module to all portals
                    DesktopModuleController.AddDesktopModuleToPortals(objDesktopModule.DesktopModuleID);

                    //Save module definition
                    moduleDefinition = new ModuleDefinitionInfo();

                    moduleDefinition.ModuleDefID      = Null.NullInteger;
                    moduleDefinition.DesktopModuleID  = objDesktopModule.DesktopModuleID;
                    moduleDefinition.FriendlyName     = friendlyName;
                    moduleDefinition.DefaultCacheTime = 0;

                    moduleDefinition.ModuleDefID = ModuleDefinitionController.SaveModuleDefinition(moduleDefinition, false, true);

                    //Save module control
                    var objModuleControl = new ModuleControlInfo();

                    objModuleControl.ModuleControlID          = Null.NullInteger;
                    objModuleControl.ModuleDefID              = moduleDefinition.ModuleDefID;
                    objModuleControl.ControlKey               = "";
                    objModuleControl.ControlSrc               = moduleControl;
                    objModuleControl.ControlTitle             = "";
                    objModuleControl.ControlType              = SecurityAccessLevel.View;
                    objModuleControl.HelpURL                  = "";
                    objModuleControl.IconFile                 = "";
                    objModuleControl.ViewOrder                = 0;
                    objModuleControl.SupportsPartialRendering = false;

                    ModuleControlController.AddModuleControl(objModuleControl);
                }
            }
            catch (Exception exc)
            {
                Exceptions.LogException(exc);
                UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ImportControl.ErrorMessage", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
            }
            return(moduleDefinition);
        }
        /// -----------------------------------------------------------------------------
        /// <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);

                        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.GetCurrentPortalSettings().DefaultLanguage);
                            languagePack = new LanguagePackInfo
                            {
                                PackageID          = newPackage.PackageID,
                                LanguageID         = locale.LanguageId,
                                DependentPackageID = -2
                            };
                            LanguagePackController.SaveLanguagePack(languagePack);
                            break;

                        case "ExtensionLanguagePack":
                            locale       = LocaleController.Instance.GetLocale(PortalController.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;
            }
        }