예제 #1
0
 public static void ProcessLegacySkinControls()
 {
     foreach (SkinControlInfo skinControl in SkinControlController.GetSkinControls().Values)
     {
         if (skinControl.PackageID == Null.NullInteger)
         {
             try
             {
                 PackageInfo package = new PackageInfo(new InstallerInfo());
                 package.Name         = skinControl.ControlKey;
                 package.FriendlyName = skinControl.ControlKey;
                 package.Description  = Null.NullString;
                 package.Version      = new Version(1, 0, 0);
                 package.PackageType  = "SkinObject";
                 ParsePackageName(package);
                 SkinControlPackageWriter skinControlWriter = new SkinControlPackageWriter(skinControl, package);
                 package.Manifest = skinControlWriter.WriteManifest(true);
                 PackageController.SavePackage(package);
                 skinControl.PackageID = package.PackageID;
                 SkinControlController.SaveSkinControl(skinControl);
             }
             catch (Exception ex)
             {
                 ex.ToString();
             }
         }
     }
 }
예제 #2
0
 public override void Rollback()
 {
     if (InstalledSkinControl == null)
     {
         DeleteSkinControl();
     }
     else
     {
         SkinControlController.SaveSkinControl(InstalledSkinControl);
     }
 }
 public override void UpdatePackage()
 {
     if (skinObjectForm.IsValid)
     {
         var skinControl = skinObjectForm.DataSource as SkinControlInfo;
         if (skinControl != null)
         {
             SkinControlController.SaveSkinControl(skinControl);
         }
     }
 }
 /// -----------------------------------------------------------------------------
 /// <summary>
 /// The Rollback method undoes the installation of the component in the event
 /// that one of the other components fails
 /// </summary>
 /// -----------------------------------------------------------------------------
 public override void Rollback()
 {
     //If Temp SkinControl exists then we need to update the DataStore with this
     if (InstalledSkinControl == null)
     {
         //No Temp SkinControl - Delete newly added SkinControl
         DeleteSkinControl();
     }
     else
     {
         //Temp SkinControl - Rollback to Temp
         SkinControlController.SaveSkinControl(InstalledSkinControl);
     }
 }
예제 #5
0
 public override void Install()
 {
     try
     {
         InstalledSkinControl = SkinControlController.GetSkinControlByKey(SkinControl.ControlKey);
         if (InstalledSkinControl != null)
         {
             SkinControl.SkinControlID = InstalledSkinControl.SkinControlID;
         }
         SkinControl.PackageID     = Package.PackageID;
         SkinControl.SkinControlID = SkinControlController.SaveSkinControl(SkinControl);
         Completed = true;
         Log.AddInfo(string.Format(Util.MODULE_Registered, SkinControl.ControlKey));
     }
     catch (Exception ex)
     {
         Log.AddFailure(ex);
     }
 }
예제 #6
0
        /// <summary>
        /// Process legacy skinobject version 3 .dnn install package
        /// </summary>
        public static void ProcessLegacySkinControls()
        {
            foreach (SkinControlInfo skinControl in SkinControlController.GetSkinControls().Values)
            {
                if (skinControl.PackageID == Null.NullInteger)
                {
                    try
                    {
                        //SkinControl is not affiliated with a Package
                        var package = new PackageInfo(new InstallerInfo());
                        package.Name = skinControl.ControlKey;

                        package.FriendlyName = skinControl.ControlKey;
                        package.Description  = Null.NullString;
                        package.Version      = new Version(1, 0, 0);
                        package.PackageType  = "SkinObject";

                        //See if the SkinControl is using a "Namespace" for its name
                        ParsePackageName(package);

                        var skinControlWriter = new SkinControlPackageWriter(skinControl, package);
                        package.Manifest = skinControlWriter.WriteManifest(true);

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

                        //Update SkinControl with new PackageID
                        skinControl.PackageID = package.PackageID;

                        //Save SkinControl
                        SkinControlController.SaveSkinControl(skinControl);
                    }
                    catch (Exception exc)
                    {
                        Logger.Error(exc);
                    }
                }
            }
        }
예제 #7
0
        public bool SavePackageSettings(PackageSettingsDto packageSettings, out string errorMessage)
        {
            errorMessage = string.Empty;

            try
            {
                string value;
                var    skinControl = SkinControlController.GetSkinControlByPackageID(packageSettings.PackageId);

                if (packageSettings.EditorActions.TryGetValue("controlKey", out value) &&
                    !string.IsNullOrEmpty(value))
                {
                    skinControl.ControlKey = value;
                }
                if (packageSettings.EditorActions.TryGetValue("controlSrc", out value) &&
                    !string.IsNullOrEmpty(value))
                {
                    skinControl.ControlSrc = value;
                }
                if (packageSettings.EditorActions.TryGetValue("supportsPartialRendering", out value) &&
                    !string.IsNullOrEmpty(value))
                {
                    bool b;
                    bool.TryParse(value, out b);
                    skinControl.SupportsPartialRendering = b;
                }

                SkinControlController.SaveSkinControl(skinControl);
                return(true);
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                errorMessage = ex.Message;
                return(false);
            }
        }
예제 #8
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The Install method installs the Module component.
        /// </summary>
        /// -----------------------------------------------------------------------------
        public override void Install()
        {
            try
            {
                // Attempt to get the SkinControl
                this.InstalledSkinControl = SkinControlController.GetSkinControlByKey(this.SkinControl.ControlKey);

                if (this.InstalledSkinControl != null)
                {
                    this.SkinControl.SkinControlID = this.InstalledSkinControl.SkinControlID;
                }

                // Save SkinControl
                this.SkinControl.PackageID     = this.Package.PackageID;
                this.SkinControl.SkinControlID = SkinControlController.SaveSkinControl(this.SkinControl);

                this.Completed = true;
                this.Log.AddInfo(string.Format(Util.MODULE_Registered, this.SkinControl.ControlKey));
            }
            catch (Exception ex)
            {
                this.Log.AddFailure(ex);
            }
        }
예제 #9
0
        /// -----------------------------------------------------------------------------
        /// <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;
            }
        }
예제 #10
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,
                                                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);
        }