Exemple #1
0
        public void Uninstall()
        {
            #region Remove Widget Files
            _adminWidgetProvider = Telligent.Evolution.Extensibility.Version1.PluginManager.Get <UI.AdminPanels.AdminPanel>().FirstOrDefault();
            UIApi.FactoryDefaultScriptedContentFragmentProviderFiles.DeleteAllFiles(_adminWidgetProvider);
            _manWidgetProvider = Telligent.Evolution.Extensibility.Version1.PluginManager.Get <UI.ManagementPanels.KhartaGroupOptionsManPanel>().FirstOrDefault();
            UIApi.FactoryDefaultScriptedContentFragmentProviderFiles.DeleteAllFiles(_manWidgetProvider);
            _widgetProvider = Telligent.Evolution.Extensibility.Version1.PluginManager.Get <KhartaFactoryDefaultWidgetProvider>().FirstOrDefault();
            UIApi.FactoryDefaultScriptedContentFragmentProviderFiles.DeleteAllFiles(_widgetProvider);
            /******/
            #endregion

            #region Remove Page files
            foreach (var theme in UIApi.Themes.List(UIApi.ThemeTypes.Group))
            {
                UIApi.ThemePages.DeleteFactoryDefault(theme, "kharta-sourceapplist", true);
                UIApi.ThemePages.DeleteDefault(theme, "kharta-sourceapplist", true);
                UIApi.ThemePages.Delete(theme, "kharta-sourceapplist", true);
            }
            #endregion
        }
Exemple #2
0
        public void Install(Version lastInstalledVersion)
        {
            #region Install SQL
            //if (lastInstalledVersion == null || lastInstalledVersion.Major == 0)


            // if (lastInstalledVersion == null || lastInstalledVersion <= new Version(1, 1))

            #endregion

            #region Install Widgets

            #region AdminPanelWidget Install

            _adminWidgetProvider = Telligent.Evolution.Extensibility.Version1.PluginManager.Get <UI.AdminPanels.AdminPanel>().FirstOrDefault();
            UIApi.FactoryDefaultScriptedContentFragmentProviderFiles.DeleteAllFiles(_adminWidgetProvider);
            var definitionFiles = new string[] {
                "KhartaAdminPanel/KhartaAdminPanel.xml"
            };
            foreach (var definitionFile in definitionFiles)
            {
                using (var stream = InternalApi.Utility.EmbeddedResources.GetStream("te.extension.kharta.Resources.Widgets." + definitionFile.Replace("/", ".")))
                {
                    UIApi.FactoryDefaultScriptedContentFragmentProviderFiles.AddUpdateDefinitionFile(_adminWidgetProvider, definitionFile.Substring(definitionFile.LastIndexOf("/", StringComparison.InvariantCultureIgnoreCase) + 1), stream);
                }
            }
            var supplementaryFiles = new Dictionary <Guid, string[]>();
            supplementaryFiles[new Guid("b089b96795074ad1ad130141f62bc937")] = new string[] {
                "KhartaAdminPanel/Supplementary/KhartaAdminPanel.css",
                "KhartaAdminPanel/Supplementary/KhartaAdminPanel.js",
                "KhartaAdminPanel/Supplementary/KhartaAdminPanel.vm",
            };
            foreach (var instanceId in supplementaryFiles.Keys)
            {
                foreach (var relativePath in supplementaryFiles[instanceId])
                {
                    using (var stream = InternalApi.Utility.EmbeddedResources.GetStream("te.extension.kharta.Resources.Widgets." + relativePath.Replace("/", ".")))
                    {
                        UIApi.FactoryDefaultScriptedContentFragmentProviderFiles.AddUpdateSupplementaryFile(_adminWidgetProvider, instanceId, relativePath.Substring(relativePath.LastIndexOf("/", StringComparison.InvariantCultureIgnoreCase) + 1), stream);
                    }
                }
            }
            #endregion
            #region manPanelWidget Install

            _manWidgetProvider = Telligent.Evolution.Extensibility.Version1.PluginManager.Get <UI.ManagementPanels.KhartaGroupOptionsManPanel>().FirstOrDefault();
            UIApi.FactoryDefaultScriptedContentFragmentProviderFiles.DeleteAllFiles(_manWidgetProvider);
            var manDefinitionFiles = new string[] {
                "KhataGroupOptionsManPanel/KhataGroupOptionsManPanel.xml"
            };
            foreach (var manDefinitionFile in manDefinitionFiles)
            {
                using (var stream = InternalApi.Utility.EmbeddedResources.GetStream("te.extension.kharta.Resources.Widgets." + manDefinitionFile.Replace("/", ".")))
                {
                    UIApi.FactoryDefaultScriptedContentFragmentProviderFiles.AddUpdateDefinitionFile(_manWidgetProvider, manDefinitionFile.Substring(manDefinitionFile.LastIndexOf("/", StringComparison.InvariantCultureIgnoreCase) + 1), stream);
                }
            }
            var manSupplementaryFiles = new Dictionary <Guid, string[]>();
            manSupplementaryFiles[new Guid("c23d40789a6d48809ff69da6e868ec8a")] = new string[] {
                "KhataGroupOptionsManPanel/Supplementary/KhataGroupOptionsManPanel.css",
                "KhataGroupOptionsManPanel/Supplementary/KhataGroupOptionsManPanel.js",
                "KhataGroupOptionsManPanel/Supplementary/KhataGroupOptionsManPanel.vm",
            };
            foreach (var manSupFile in manSupplementaryFiles.Keys)
            {
                foreach (var manRelativePath in manSupplementaryFiles[manSupFile])
                {
                    using (var stream = InternalApi.Utility.EmbeddedResources.GetStream("te.extension.kharta.Resources.Widgets." + manRelativePath.Replace("/", ".")))
                    {
                        UIApi.FactoryDefaultScriptedContentFragmentProviderFiles.AddUpdateSupplementaryFile(_manWidgetProvider, manSupFile, manRelativePath.Substring(manRelativePath.LastIndexOf("/", StringComparison.InvariantCultureIgnoreCase) + 1), stream);
                    }
                }
            }
            #endregion
            #region Kharta Sources Widgets



            _widgetProvider = Telligent.Evolution.Extensibility.Version1.PluginManager.Get <KhartaFactoryDefaultWidgetProvider>().FirstOrDefault();
            UIApi.FactoryDefaultScriptedContentFragmentProviderFiles.DeleteAllFiles(_widgetProvider);

            var definitionFilesSources = new string[] {
                "KhartaSourceApps/KhartaSourceApps.xml",
            };

            foreach (var definitionFile in definitionFilesSources)
            {
                using (var stream = InternalApi.Utility.EmbeddedResources.GetStream("te.extension.kharta.Resources.Widgets." + definitionFile.Replace("/", ".")))
                {
                    UIApi.FactoryDefaultScriptedContentFragmentProviderFiles.AddUpdateDefinitionFile(_widgetProvider, definitionFile.Substring(definitionFile.LastIndexOf("/", StringComparison.InvariantCultureIgnoreCase) + 1), stream);
                }
            }

            var supplementaryFilesSources = new Dictionary <Guid, string[]>();
            supplementaryFilesSources[new Guid("2165b010beac4805ad6743b61ce41b7f")] = new string[] {
                "KhartaSourceApps/Supplementary/KhartaSourceApps.js",
                "KhartaSourceApps/Supplementary/KhartaSourceApps.css",
                "KhartaSourceApps/Supplementary/KhartaSourceApps.vm",
            };
            foreach (var instanceId in supplementaryFilesSources.Keys)
            {
                foreach (var relativePath in supplementaryFilesSources[instanceId])
                {
                    using (var stream = InternalApi.Utility.EmbeddedResources.GetStream("te.extension.kharta.Resources.Widgets." + relativePath.Replace("/", ".")))
                    {
                        UIApi.FactoryDefaultScriptedContentFragmentProviderFiles.AddUpdateSupplementaryFile(_widgetProvider, instanceId, relativePath.Substring(relativePath.LastIndexOf("/", StringComparison.InvariantCultureIgnoreCase) + 1), stream);
                    }
                }
            }


            #endregion
            #endregion

            #region Install Pages
            //string pageName = "";
            //int id = 1;
            //bool isCustom = false;
            //Guid themeTypeId = new Guid();
            //Guid themeContextId = new Guid("47bec3c6-b081-4f36-8812-e42953ef133b");
            // ContentFragmentPage page = new ContentFragmentPage(pageName,id,isCustom,themeTypeID, themeContextID);
            //var tabs = page.GetContentFragmentTabs();
            //ContentFragmentTab item = new ContentFragmentTab(page, 1);

            XmlDocument xml;
            foreach (var theme in UIApi.Themes.List(UIApi.ThemeTypes.Group))
            {
                xml = new XmlDocument();
                xml.LoadXml(InternalApi.Utility.EmbeddedResources.GetString("te.extension.kharta.Resources.Pages.kharta-source-appslist-Social-Group-Page.xml"));
                UIApi.ThemePages.AddUpdateFactoryDefault(theme, xml.SelectSingleNode("theme/contentFragmentPages/contentFragmentPage"));

                UIApi.ThemePages.DeleteDefault(theme, "kharta-sourceapplist", true);
            }
            #endregion
        }