public void ProcessRequest(HttpContext context) { var type = context.Request["logotype"]; if (string.IsNullOrEmpty(type)) { return; } var imgUrl = ""; var coBrandingType = (CoBrandingLogoTypeEnum)Convert.ToInt32(type); var general = Convert.ToBoolean(context.Request["general"] ?? "true"); var isDefIfNoCoBranding = Convert.ToBoolean(context.Request["defifnoco"] ?? "false"); if (TenantLogoManager.CoBrandingEnabled) { var _tenantCoBrandingSettings = SettingsManager.Instance.LoadSettings <TenantCoBrandingSettings>(TenantProvider.CurrentTenantID); imgUrl = _tenantCoBrandingSettings.GetAbsoluteLogoPath(coBrandingType, general); if (coBrandingType == CoBrandingLogoTypeEnum.Dark) { var defaultDarkLogoPath = TenantCoBrandingSettings.GetAbsoluteDefaultLogoPath(CoBrandingLogoTypeEnum.Dark, general); if (String.Equals(imgUrl, defaultDarkLogoPath, StringComparison.OrdinalIgnoreCase)) { /*** simple scheme ***/ var _tenantInfoSettings = SettingsManager.Instance.LoadSettings <TenantInfoSettings>(TenantProvider.CurrentTenantID); imgUrl = _tenantInfoSettings.GetAbsoluteCompanyLogoPath(); /***/ } } } else { if (isDefIfNoCoBranding) { imgUrl = TenantCoBrandingSettings.GetAbsoluteDefaultLogoPath(coBrandingType, general); } else { if (coBrandingType == CoBrandingLogoTypeEnum.Dark) { /*** simple scheme ***/ var _tenantInfoSettings = SettingsManager.Instance.LoadSettings <TenantInfoSettings>(TenantProvider.CurrentTenantID); imgUrl = _tenantInfoSettings.GetAbsoluteCompanyLogoPath(); /***/ } else { imgUrl = TenantCoBrandingSettings.GetAbsoluteDefaultLogoPath(coBrandingType, general); } } } context.Response.ContentType = "image"; context.Response.Redirect(imgUrl); }
public object RestoreCoBrandingOptions(bool isRetina) { try { SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings); var _tenantCoBrandingSettings = SettingsManager.Instance.LoadSettings <TenantCoBrandingSettings>(TenantProvider.CurrentTenantID); _tenantCoBrandingSettings.RestoreDefault(); SettingsManager.Instance.SaveSettings(_tenantCoBrandingSettings, TenantProvider.CurrentTenantID); /*** simple scheme restore logo***/ var _tenantInfoSettings = SettingsManager.Instance.LoadSettings <TenantInfoSettings>(TenantProvider.CurrentTenantID); _tenantInfoSettings.RestoreDefaultLogo(); SettingsManager.Instance.SaveSettings(_tenantInfoSettings, TenantProvider.CurrentTenantID); /***/ return(new { Status = 1, Message = CoBrandingResource.SuccessfullySaveCoBrandingSettingsMessage, LogoPath = JsonConvert.SerializeObject( new Dictionary <int, string>() { { (int)CoBrandingLogoTypeEnum.Light, TenantCoBrandingSettings.GetAbsoluteDefaultLogoPath(CoBrandingLogoTypeEnum.Light, !isRetina) }, { (int)CoBrandingLogoTypeEnum.LightSmall, TenantCoBrandingSettings.GetAbsoluteDefaultLogoPath(CoBrandingLogoTypeEnum.LightSmall, !isRetina) }, { (int)CoBrandingLogoTypeEnum.Dark, TenantCoBrandingSettings.GetAbsoluteDefaultLogoPath(CoBrandingLogoTypeEnum.Dark, !isRetina) }, { (int)CoBrandingLogoTypeEnum.Favicon, TenantCoBrandingSettings.GetAbsoluteDefaultLogoPath(CoBrandingLogoTypeEnum.Favicon, !isRetina) }, { (int)CoBrandingLogoTypeEnum.DocsEditor, TenantCoBrandingSettings.GetAbsoluteDefaultLogoPath(CoBrandingLogoTypeEnum.DocsEditor, !isRetina) } }) }); } catch (Exception e) { return(new { Status = 0, Message = e.Message.HtmlEncode() }); } }