示例#1
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The Install method installs the UrlProvider component.
        /// </summary>
        /// -----------------------------------------------------------------------------
        public override void Install()
        {
            try
            {
                // Ensure DesktopModule Cache is cleared
                DataCache.RemoveCache(string.Format(DataCache.DesktopModuleCacheKey, Null.NullInteger));

                var desktopModule = DesktopModuleController.GetDesktopModuleByModuleName(this._desktopModuleName, Null.NullInteger);
                if (desktopModule != null)
                {
                    this._extensionUrlProvider.DesktopModuleId = desktopModule.DesktopModuleID;
                }

                // Attempt to get the Desktop Module
                this._installedExtensionUrlProvider = ExtensionUrlProviderController.GetProviders(Null.NullInteger)
                                                      .SingleOrDefault(p => p.ProviderType == this._extensionUrlProvider.ProviderType);

                if (this._installedExtensionUrlProvider != null)
                {
                    this._extensionUrlProvider.ExtensionUrlProviderId = this._installedExtensionUrlProvider.ExtensionUrlProviderId;
                }

                ExtensionUrlProviderController.SaveProvider(this._extensionUrlProvider);

                this.Completed = true;
                this.Log.AddInfo(string.Format(Util.URLPROVIDER_Registered, this._extensionUrlProvider.ProviderName));
            }
            catch (Exception ex)
            {
                this.Log.AddFailure(ex);
            }
        }
示例#2
0
        public HttpResponseMessage GetExtensionUrlProviders()
        {
            try
            {
                var providers = ExtensionUrlProviderController.GetProviders(this.PortalId).Select(p => new
                {
                    p.ExtensionUrlProviderId,
                    p.ProviderName,
                    p.IsActive,
                    SettingUrl = this.NavigationManager.NavigateURL(this.PortalSettings.AdminTabId, "UrlProviderSettings", "Display=settings&popUp=true&ProviderId=" + p.ExtensionUrlProviderId)
                }).ToList();

                var response = new
                {
                    Success   = true,
                    Providers = providers
                };
                return(this.Request.CreateResponse(HttpStatusCode.OK, response));
            }
            catch (Exception exc)
            {
                Logger.Error(exc);
                return(this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc));
            }
        }
        public void BindAction(int portalId, int tabId, int moduleId)
        {
            var providers = ExtensionUrlProviderController.GetProviders(portalId);

            Localization.LocalizeDataGrid(ref providersGrid, LocalResourceFile);
            providersGrid.DataSource = providers;
            providersGrid.DataBind();

            UrlSettingsExtensionControl.BindAction(portalId, tabId, moduleId);

            var settings = new DotNetNuke.Entities.Urls.FriendlyUrlSettings(portalId);

            if (settings.EnableCustomProviders == false)
            {
                providersGrid.Visible         = false;
                providersWarningLabel.Visible = true;
                providersWarningLabel.Text    = LocalizeString("ExtensionProvidersDisabled.Text");
            }
            else
            {
                if (providersGrid.Items.Count == 0)
                {
                    providersGrid.Visible         = false;
                    providersWarningLabel.Visible = true;
                    providersWarningLabel.Text    = LocalizeString("NoProvidersInstalled.Text");
                }
            }
        }
示例#4
0
        public void BindAction(int portalId, int tabId, int moduleId)
        {
            var providers = ExtensionUrlProviderController.GetProviders(portalId);

            Localization.LocalizeDataGrid(ref providersGrid, LocalResourceFile);
            providersGrid.DataSource = providers;
            providersGrid.DataBind();

            UrlSettingsExtensionControl.BindAction(portalId, tabId, moduleId);
        }
示例#5
0
        private void DeleteProvider()
        {
            try
            {
                ExtensionUrlProviderInfo tempUrlProvider = ExtensionUrlProviderController.GetProviders(Null.NullInteger).Where(p => p.ProviderName == this._extensionUrlProvider.ProviderName && p.ProviderType == this._extensionUrlProvider.ProviderType).FirstOrDefault();
                if (tempUrlProvider != null)
                {
                    ExtensionUrlProviderController.DeleteProvider(tempUrlProvider);

                    this.Log.AddInfo(string.Format(Util.URLPROVIDER_UnRegistered, tempUrlProvider.ProviderName));
                }
            }
            catch (Exception ex)
            {
                this.Log.AddFailure(ex);
            }
        }
        private void DeleteProvider()
        {
            try
            {
                //Attempt to get the Desktop Module
                //Attempt to get the Desktop Module
                DesktopModuleInfo desktopModule = DesktopModuleController.GetDesktopModuleByPackageID(Package.PackageID);

                ExtensionUrlProviderInfo tempUrlProvider = ExtensionUrlProviderController.GetProviders(Null.NullInteger)
                                                           .SingleOrDefault(p => p.DesktopModuleId == desktopModule.DesktopModuleID);
                if (tempUrlProvider != null)
                {
                    ExtensionUrlProviderController.DeleteProvider(tempUrlProvider);

                    Log.AddInfo(string.Format(Util.URLPROVIDER_UnRegistered, tempUrlProvider.ProviderName));
                }
            }
            catch (Exception ex)
            {
                Log.AddFailure(ex);
            }
        }