public static MvcHtmlString Script(this HtmlHelper helper, ScriptRef scriptReference, bool throwException = false) { if (ResourceHelper.TryConfigureScriptManager(scriptReference)) return MvcHtmlString.Empty; var resourceKey = scriptReference.ToString(); var context = helper.ViewContext.HttpContext; var resourceUrl = ResourceHelper.GetWebResourceUrl(scriptReference); if (string.IsNullOrEmpty(resourceUrl)) throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Script reference for {0} is not found.", resourceKey)); return ResourceHelper.RegisterResource(context, resourceKey, resourceUrl, throwException); }
public static MvcHtmlString Script(this HtmlHelper helper, ScriptRef scriptReference, bool throwException = false) { if (ResourceHelper.TryConfigureScriptManager(scriptReference)) return MvcHtmlString.Empty; var resourceKey = scriptReference.ToString(); var context = helper.ViewContext.HttpContext; var resourceUrl = ResourceHelper.GetWebResourceUrl(scriptReference); if (string.IsNullOrEmpty(resourceUrl)) return MvcHtmlString.Empty; return ResourceHelper.RegisterResource(context, resourceKey, resourceUrl, throwException); }
public static System.Web.Mvc.MvcHtmlString Script(this HtmlHelper helper, ScriptRef scriptReference, bool throwException = false) { if (ResourceHelper.TryConfigureScriptManager(scriptReference)) { return(System.Web.Mvc.MvcHtmlString.Empty); } var resourceKey = scriptReference.ToString(); var context = helper.ViewContext.HttpContext; var resourceUrl = ResourceHelper.GetWebResourceUrl(scriptReference); if (string.IsNullOrEmpty(resourceUrl)) { return(System.Web.Mvc.MvcHtmlString.Empty); } return(ResourceHelper.RegisterResource(context, resourceKey, resourceUrl, throwException)); }
public static MvcHtmlString Script(this HtmlHelper helper, ScriptRef scriptReference, bool throwException = false) { if (ResourceHelper.TryConfigureScriptManager(scriptReference)) { return(MvcHtmlString.Empty); } var resourceKey = scriptReference.ToString(); var context = helper.ViewContext.HttpContext; var resourceUrl = ResourceHelper.GetWebResourceUrl(scriptReference); if (string.IsNullOrEmpty(resourceUrl)) { throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Script reference for {0} is not found.", resourceKey)); } return(ResourceHelper.RegisterResource(context, resourceKey, resourceUrl, throwException)); }
public static string GetWebResourceUrl(ScriptRef scriptReference) { var config = Config.Get <PagesConfig>().ScriptManager; var scriptConfig = config.ScriptReferences[scriptReference.ToString()]; string resourceUrl = string.Empty; if (config.EnableCdn || (scriptConfig.EnableCdn.HasValue && scriptConfig.EnableCdn.Value)) { resourceUrl = scriptConfig.Path; } else { var page = HttpContext.Current.Handler.GetPageHandler() ?? new PageProxy(null); resourceUrl = page.ClientScript.GetWebResourceUrl( TypeResolutionService.ResolveType("Telerik.Sitefinity.Resources.Reference"), scriptConfig.Name); } return(resourceUrl); }
public static string GetWebResourceUrl(ScriptRef scriptReference) { var config = Config.Get<PagesConfig>().ScriptManager; var scriptConfig = config.ScriptReferences[scriptReference.ToString()]; string resourceUrl = string.Empty; if (config.EnableCdn || (scriptConfig.EnableCdn.HasValue && scriptConfig.EnableCdn.Value)) { resourceUrl = scriptConfig.Path; } else { var page = HttpContext.Current.Handler.GetPageHandler() ?? new PageProxy(null); resourceUrl = page.ClientScript.GetWebResourceUrl( TypeResolutionService.ResolveType("Telerik.Sitefinity.Resources.Reference"), scriptConfig.Name); } return resourceUrl; }