public static IDependency GetDependency(XPathNavigator dependencyNav)
 {
     IDependency dependency = null;
     string dependencyType = Util.ReadAttribute(dependencyNav, "type");
     switch (dependencyType.ToLowerInvariant())
     {
         case "coreversion":
             dependency = new CoreVersionDependency();
             break;
         case "package":
             dependency = new PackageDependency();
             break;
         case "permission":
             dependency = new PermissionsDependency();
             break;
         case "type":
             dependency = new TypeDependency();
             break;
         default:
             ListController listController = new ListController();
             ListEntryInfo entry = listController.GetListEntryInfo("Dependency", dependencyType);
             if (entry != null && !string.IsNullOrEmpty(entry.Text))
             {
                 dependency = (DependencyBase)Reflection.CreateObject(entry.Text, "Dependency_" + entry.Value);
             }
             break;
     }
     if (dependency == null)
     {
         dependency = new InvalidDependency(Util.INSTALL_Dependencies);
     }
     dependency.ReadManifest(dependencyNav);
     return dependency;
 }
Example #2
0
        public static PackageWriterBase GetWriter(PackageInfo package)
        {
            PackageWriterBase writer = null;

            switch (package.PackageType)
            {
            case "Auth_System":
                writer = new AuthenticationPackageWriter(package);
                break;

            case "Module":
                writer = new ModulePackageWriter(package);
                break;

            case "Container":
                writer = new ContainerPackageWriter(package);
                break;

            case "Skin":
                writer = new SkinPackageWriter(package);
                break;

            case "CoreLanguagePack":
            case "ExtensionLanguagePack":
                writer = new LanguagePackWriter(package);
                break;

            case "SkinObject":
                writer = new SkinControlPackageWriter(package);
                break;

            case "Provider":
                writer = new ProviderPackageWriter(package);
                break;

            case "Library":
                writer = new LibraryPackageWriter(package);
                break;

            case "Widget":
                writer = new WidgetPackageWriter(package);
                break;

            default:
                CommonLibrary.Common.Lists.ListController listController = new CommonLibrary.Common.Lists.ListController();
                ListEntryInfo entry = listController.GetListEntryInfo("PackageWriter", package.PackageType);
                if (entry != null && !string.IsNullOrEmpty(entry.Text))
                {
                    writer = (PackageWriterBase)Reflection.CreateObject(entry.Text, "PackageWriter_" + entry.Value);
                }
                break;
            }
            return(writer);
        }
 public static PackageWriterBase GetWriter(PackageInfo package)
 {
     PackageWriterBase writer = null;
     switch (package.PackageType)
     {
         case "Auth_System":
             writer = new AuthenticationPackageWriter(package);
             break;
         case "Module":
             writer = new ModulePackageWriter(package);
             break;
         case "Container":
             writer = new ContainerPackageWriter(package);
             break;
         case "Skin":
             writer = new SkinPackageWriter(package);
             break;
         case "CoreLanguagePack":
         case "ExtensionLanguagePack":
             writer = new LanguagePackWriter(package);
             break;
         case "SkinObject":
             writer = new SkinControlPackageWriter(package);
             break;
         case "Provider":
             writer = new ProviderPackageWriter(package);
             break;
         case "Library":
             writer = new LibraryPackageWriter(package);
             break;
         case "Widget":
             writer = new WidgetPackageWriter(package);
             break;
         default:
             CommonLibrary.Common.Lists.ListController listController = new CommonLibrary.Common.Lists.ListController();
             ListEntryInfo entry = listController.GetListEntryInfo("PackageWriter", package.PackageType);
             if (entry != null && !string.IsNullOrEmpty(entry.Text))
             {
                 writer = (PackageWriterBase)Reflection.CreateObject(entry.Text, "PackageWriter_" + entry.Value);
             }
             break;
     }
     return writer;
 }
Example #4
0
        private static void UpgradeToVersion_530()
        {
            int ModuleDefID = 0;

            //update languages module
            ModuleDefID = GetModuleDefinition("Languages", "Languages");
            RemoveModuleControl(ModuleDefID, "");
            AddModuleControl(ModuleDefID, "", "", "DesktopModules/Admin/Languages/languageEnabler.ascx", "~/images/icon_language_32px.gif", SecurityAccessLevel.View, 0, "", true);
            AddModuleControl(ModuleDefID, "Editor", "", "DesktopModules/Admin/Languages/languageeditor.ascx", "~/images/icon_language_32px.gif", SecurityAccessLevel.View, 0);

            //Add new View Profile module
            ModuleDefID = AddModuleDefinition("ViewProfile", "", "ViewProfile", false, false);
            AddModuleControl(ModuleDefID, "", "", "DesktopModules/Admin/ViewProfile/ViewProfile.ascx", "~/images/icon_profile_32px.gif", SecurityAccessLevel.View, 0);
            AddModuleControl(ModuleDefID, "Settings", "Settings", "DesktopModules/Admin/ViewProfile/Settings.ascx", "~/images/icon_profile_32px.gif", SecurityAccessLevel.Edit, 0);

            //Add new Sitemap settings module
            ModuleDefID = AddModuleDefinition("Sitemap", "", "Sitemap", false, false);
            AddModuleControl(ModuleDefID, "", "", "DesktopModules/Admin/Sitemap/SitemapSettings.ascx", "~/images/icon_analytics_32px.gif", SecurityAccessLevel.View, 0);
            AddAdminPages("Search Engine Sitemap", "Configure the sitemap for submission to common search engines.", "~/images/icon_analytics_16px.gif", "~/images/icon_analytics_32px.gif", true, ModuleDefID, "Search Engine Sitemap", "~/images/icon_analytics_32px.gif");


            //Add new Photo Profile field to Host
            ListController objListController = new ListController();
            ListEntryInfoCollection dataTypes = objListController.GetListEntryInfoCollection("DataType");

            ProfilePropertyDefinitionCollection properties = ProfileController.GetPropertyDefinitionsByPortal(Null.NullInteger);
            ProfileController.AddDefaultDefinition(Null.NullInteger, "Preferences", "Photo", "Image", 0, properties.Count * 2 + 2, dataTypes);

            string strHostTemplateFile = string.Format("{0}Templates\\UserProfile.page.template", Globals.HostMapPath);
            if (File.Exists(strHostTemplateFile))
            {
                TabController tabController = new TabController();
                PortalController objPortals = new PortalController();
                ArrayList arrPortals = objPortals.GetPortals();
                foreach (PortalInfo objPortal in arrPortals)
                {
                    properties = ProfileController.GetPropertyDefinitionsByPortal(objPortal.PortalID);

                    //Add new Photo Profile field to Portal
                    ProfileController.AddDefaultDefinition(objPortal.PortalID, "Preferences", "Photo", "Image", 0, properties.Count * 2 + 2, dataTypes);

                    //Rename old Default Page template
                    File.Move(string.Format("{0}Templates\\Default.page.template", objPortal.HomeDirectoryMapPath), string.Format("{0}Templates\\Default_old.page.template", objPortal.HomeDirectoryMapPath));

                    //Update Default profile template in every portal
                    objPortals.CopyPageTemplate("Default.page.template", objPortal.HomeDirectoryMapPath);

                    //Add User profile template to every portal
                    objPortals.CopyPageTemplate("UserProfile.page.template", objPortal.HomeDirectoryMapPath);

                    //Synchronize the Templates folder to ensure the templates are accessible
                    FileSystemUtils.SynchronizeFolder(objPortal.PortalID, string.Format("{0}Templates\\", objPortal.HomeDirectoryMapPath), "Templates/", false, true, true, false);

                    XmlDocument xmlDoc = new XmlDocument();
                    try
                    {
                        // open the XML file
                        xmlDoc.Load(string.Format("{0}Templates\\UserProfile.page.template", objPortal.HomeDirectoryMapPath));
                    }
                    catch (Exception ex)
                    {
                        Exceptions.Exceptions.LogException(ex);
                    }

                    TabInfo newTab = new TabInfo();
                    newTab = TabController.DeserializeTab(xmlDoc.SelectSingleNode("//portal/tabs/tab"), null, objPortal.PortalID, PortalTemplateModuleAction.Merge);
                    TabController.DeserializePanes(xmlDoc.SelectSingleNode("//portal/tabs/tab/panes"), newTab.PortalID, newTab.TabID, PortalTemplateModuleAction.Ignore, new Hashtable());

                    //Update SiteSettings to point to the new page
                    objPortal.RegisterTabId = objPortal.UserTabId;
                    objPortal.UserTabId = newTab.TabID;
                    objPortals.UpdatePortalInfo(objPortal);

                    //Add Users folder to every portal
                    string strUsersFolder = string.Format("{0}Users\\", objPortal.HomeDirectoryMapPath);

                    if (!Directory.Exists(strUsersFolder))
                    {
                        //Create Users folder
                        Directory.CreateDirectory(strUsersFolder);

                        //Synchronize the Users folder to ensure the user folder is accessible
                        FileSystemUtils.SynchronizeFolder(objPortal.PortalID, strUsersFolder, "Users/", false, true, true, false);
                    }
                }
            }

            //Add new EventQueue Event
            CommonLibrary.Services.EventQueue.Config.EventQueueConfiguration config = CommonLibrary.Services.EventQueue.Config.EventQueueConfiguration.GetConfig();
            if (config != null)
            {
                if (!config.PublishedEvents.ContainsKey("Application_Start_FirstRequest"))
                {
                    foreach (CommonLibrary.Services.EventQueue.Config.SubscriberInfo subscriber in config.EventQueueSubscribers.Values)
                    {
                        CommonLibrary.Services.EventQueue.Config.EventQueueConfiguration.RegisterEventSubscription(config, "Application_Start_FirstRequest", subscriber);
                    }

                    EventQueueConfiguration.SaveConfig(config, string.Format("{0}EventQueue\\EventQueue.config", Globals.HostMapPath));
                }
            }
            //Change Key for Module Defintions
            ModuleDefID = GetModuleDefinition("Extensions", "Extensions");
            RemoveModuleControl(ModuleDefID, "ImportModuleDefinition");
            AddModuleControl(ModuleDefID, "EditModuleDefinition", "Edit Module Definition", "DesktopModules/Admin/Extensions/Editors/EditModuleDefinition.ascx", "~/images/icon_extensions_32px.gif", SecurityAccessLevel.Host, 0);

            //Module was incorrectly assigned as "IsPremium=False"
            RemoveModuleFromPortals("Users And Roles");
        }
 public static ComponentInstallerBase GetInstaller(string installerType)
 {
     ComponentInstallerBase installer = null;
     switch (installerType)
     {
         case "File":
             installer = new FileInstaller();
             break;
         case "Assembly":
             installer = new AssemblyInstaller();
             break;
         case "ResourceFile":
             installer = new ResourceFileInstaller();
             break;
         case "AuthenticationSystem":
         case "Auth_System":
             installer = new AuthenticationInstaller();
             break;
         case "DashboardControl":
             installer = new DashboardInstaller();
             break;
         case "Script":
             installer = new ScriptInstaller();
             break;
         case "Config":
             installer = new ConfigInstaller();
             break;
         case "Cleanup":
             installer = new CleanupInstaller();
             break;
         case "Skin":
             installer = new SkinInstaller();
             break;
         case "Container":
             installer = new ContainerInstaller();
             break;
         case "Module":
             installer = new ModuleInstaller();
             break;
         case "CoreLanguage":
             installer = new LanguageInstaller(LanguagePackType.Core);
             break;
         case "ExtensionLanguage":
             installer = new LanguageInstaller(LanguagePackType.Extension);
             break;
         case "Provider":
             installer = new ProviderInstaller();
             break;
         case "SkinObject":
             installer = new SkinControlInstaller();
             break;
         case "Widget":
             installer = new WidgetInstaller();
             break;
         default:
             ListController listController = new ListController();
             ListEntryInfo entry = listController.GetListEntryInfo("Installer", installerType);
             if (entry != null && !string.IsNullOrEmpty(entry.Text))
             {
                 installer = (ComponentInstallerBase)Reflection.CreateObject(entry.Text, "Installer_" + entry.Value);
             }
             break;
     }
     return installer;
 }
 public object Item(string key, bool Cache)
 {
     int index;
     object obj = null;
     bool itemExists = false;
     try
     {
         if (mKeyIndexLookup[key.ToLower()] != null)
         {
             itemExists = true;
         }
     }
     catch (Exception ex)
     {
     }
     if (!itemExists)
     {
         ListController ctlLists = new ListController();
         string listName = key.Substring(key.IndexOf(":") + 1);
         string parentKey = key.Replace(listName, "").TrimEnd(':');
         ListInfo listInfo = ctlLists.GetListInfo(listName, parentKey);
         if (Cache)
         {
             this.Add(listInfo.Key, listInfo);
             return listInfo;
         }
     }
     else
     {
         index = Convert.ToInt32(mKeyIndexLookup[key.ToLower()]);
         obj = base.List[index];
     }
     return obj;
 }
 private void ParseProfileDefinitions(XmlNode nodeProfileDefinitions, int PortalId)
 {
     ListController objListController = new ListController();
     ListEntryInfoCollection colDataTypes = objListController.GetListEntryInfoCollection("DataType");
     int OrderCounter = -1;
     ProfilePropertyDefinition objProfileDefinition;
     foreach (XmlNode node in nodeProfileDefinitions.SelectNodes("//profiledefinition"))
     {
         OrderCounter += 2;
         ListEntryInfo typeInfo = colDataTypes["DataType:" + XmlUtils.GetNodeValue(node.CreateNavigator(), "datatype")];
         if (typeInfo == null)
         {
             typeInfo = colDataTypes["DataType:Unknown"];
         }
         objProfileDefinition = new ProfilePropertyDefinition(PortalId);
         objProfileDefinition.DataType = typeInfo.EntryID;
         objProfileDefinition.DefaultValue = "";
         objProfileDefinition.ModuleDefId = Null.NullInteger;
         objProfileDefinition.PropertyCategory = XmlUtils.GetNodeValue(node.CreateNavigator(), "propertycategory");
         objProfileDefinition.PropertyName = XmlUtils.GetNodeValue(node.CreateNavigator(), "propertyname");
         objProfileDefinition.Required = false;
         objProfileDefinition.Visible = true;
         objProfileDefinition.ViewOrder = OrderCounter;
         objProfileDefinition.Length = XmlUtils.GetNodeValueInt(node, "length");
         ProfileController.AddPropertyDefinition(objProfileDefinition);
     }
 }