/// <summary> /// Adds script references for Js Beautify library. /// </summary> /// <param name="helper">The helper.</param> /// <returns> /// MvcHtmlString /// </returns> public static MvcHtmlString JsBeautifierScriptReference(this HtmlHelper helper) { var result = new StringBuilder(); var urlHelper = new UrlHelper(helper.ViewContext.HttpContext.Request.RequestContext); result.Append(ResourceHelper.Script(helper, urlHelper.EmbeddedResource("Telerik.Sitefinity.Frontend.Startup", "Telerik.Sitefinity.Frontend.Mvc.Scripts.JSBeautifier.beautify-html.js")).ToHtmlString()); return(MvcHtmlString.Create(result.ToString())); }
/// <summary> /// Adds script references required by the Sitefinity's QueryBuilder component. /// </summary> /// <param name="helper">The helper.</param> /// <returns> /// MvcHtmlString /// </returns> public static MvcHtmlString QueryBuilderScriptReferences(this HtmlHelper helper) { var result = new StringBuilder(); var urlHelper = new UrlHelper(helper.ViewContext.HttpContext.Request.RequestContext); result.Append(ResourceHelper.Script(helper, urlHelper.EmbeddedResource("Telerik.Sitefinity.Web.UI.QueryBuilder", "Telerik.Sitefinity.Web.UI.QueryBuilder.Scripts.QueryData.js")).ToHtmlString()); result.Append(ResourceHelper.Script(helper, urlHelper.EmbeddedResource("Telerik.Sitefinity.Web.UI.QueryBuilder", "Telerik.Sitefinity.Web.UI.QueryBuilder.Scripts.QueryDataItem.js")).ToHtmlString()); result.Append(ResourceHelper.Script(helper, urlHelper.EmbeddedResource("Telerik.Sitefinity.Web.UI.QueryBuilder", "Telerik.Sitefinity.Web.UI.QueryBuilder.Scripts.QueryItem.js")).ToHtmlString()); result.Append(ResourceHelper.Script(helper, urlHelper.EmbeddedResource("Telerik.Sitefinity.Web.UI.QueryBuilder", "Telerik.Sitefinity.Web.UI.QueryBuilder.Scripts.QueryGroup.js")).ToHtmlString()); result.Append(ResourceHelper.Script(helper, urlHelper.EmbeddedResource("Telerik.Sitefinity.Web.UI.QueryBuilder", "Telerik.Sitefinity.Web.UI.QueryBuilder.Scripts.QueryBuilder.js")).ToHtmlString()); return(MvcHtmlString.Create(result.ToString())); }
/// <summary> /// Adds script references required by the Sitefinity's CodeMirror component. /// </summary> /// <param name="helper">The helper.</param> /// <returns> /// MvcHtmlString /// </returns> public static MvcHtmlString CodeMirrorScriptReferences(this HtmlHelper helper) { var result = new StringBuilder(); var urlHelper = new UrlHelper(helper.ViewContext.HttpContext.Request.RequestContext); result.Append(ResourceHelper.StyleSheet(helper, urlHelper.EmbeddedResource(typeof(Telerik.Sitefinity.Resources.Reference).FullName, "Telerik.Sitefinity.Resources.Scripts.CodeMirror.codemirror.css")).ToHtmlString()); result.Append(ResourceHelper.StyleSheet(helper, urlHelper.EmbeddedResource(typeof(Telerik.Sitefinity.Resources.Reference).FullName, "Telerik.Sitefinity.Resources.Scripts.CodeMirror.Theme.default.css")).ToHtmlString()); result.Append(ResourceHelper.Script(helper, urlHelper.EmbeddedResource(typeof(Telerik.Sitefinity.Resources.Reference).FullName, "Telerik.Sitefinity.Resources.Scripts.CodeMirror.codemirror.js")).ToHtmlString()); result.Append(ResourceHelper.Script(helper, urlHelper.EmbeddedResource(typeof(Telerik.Sitefinity.Resources.Reference).FullName, "Telerik.Sitefinity.Resources.Scripts.CodeMirror.Mode.htmlmixed.js")).ToHtmlString()); result.Append(ResourceHelper.Script(helper, urlHelper.EmbeddedResource(typeof(Telerik.Sitefinity.Resources.Reference).FullName, "Telerik.Sitefinity.Resources.Scripts.CodeMirror.Mode.xml.js")).ToHtmlString()); result.Append(ResourceHelper.Script(helper, urlHelper.EmbeddedResource(typeof(Telerik.Sitefinity.Resources.Reference).FullName, "Telerik.Sitefinity.Resources.Scripts.CodeMirror.Mode.css.js")).ToHtmlString()); result.Append(ResourceHelper.Script(helper, urlHelper.EmbeddedResource(typeof(Telerik.Sitefinity.Resources.Reference).FullName, "Telerik.Sitefinity.Resources.Scripts.CodeMirror.Mode.javascript.js")).ToHtmlString()); return(MvcHtmlString.Create(result.ToString())); }
/// <summary> /// Registers JavaScript reference and ensures that it loads maximum once for a page. /// </summary> /// <param name="helper">The helper.</param> /// <param name="scriptPath">The path to the JavaScript file.</param> /// <param name="sectionName">The name of the section that will render this script. If null it will render on the same place of the page</param> /// If it is used the script will always be loaded on the top section of the page.</param> /// <returns> /// MvcHtmlString /// </returns> /// <remarks> /// This method uses directly the resource from the <see cref="scriptPath" />. /// In case you want to use embedded scripts from Sitefinity check <see cref="ResourceHelper.Script(this HtmlHelper helper, ScriptRef scriptReference, bool throwException = false)" />. /// </remarks> public static MvcHtmlString Script(this HtmlHelper helper, string scriptPath, string sectionName) { return(ResourceHelper.Script(helper, scriptPath, sectionName, true)); }
/// <summary> /// Registers JavaScript reference and ensures that it loads maximum once for a page. /// </summary> /// <param name="helper">The helper.</param> /// <param name="scriptPath">The path to the JavaScript file.</param> /// If it is used the script will always be loaded on the top section of the page.</param> /// <returns> /// MvcHtmlString /// </returns> /// <remarks> /// This method uses directly the resource from the <see cref="scriptPath" />. /// In case you want to use embedded scripts from Sitefinity check <see cref="ResourceHelper.Script(this HtmlHelper helper, ScriptRef scriptReference, bool throwException = false)" />. /// </remarks> public static MvcHtmlString Script(this HtmlHelper helper, string scriptPath) { return(ResourceHelper.Script(helper, scriptPath, null, false, true)); }
/// <summary> /// Registers JavaScript reference and ensures that it loads maximum once for a page. /// </summary> /// <param name="helper">The helper.</param> /// <param name="scriptPath">The path to the JavaScript file.</param> /// <param name="tryUseScriptManager">Indicates whether to use script manager(if exists) when register JavaScript reference. /// If it is used the script will always be loaded on the top section of the page.</param> /// <returns> /// MvcHtmlString /// </returns> /// <remarks> /// This method uses directly the resource from the <see cref="scriptPath" />. /// In case you want to use embedded scripts from Sitefinity check <see cref="ResourceHelper.Script(this HtmlHelper helper, ScriptRef scriptReference, bool throwException = false)" />. /// </remarks> public static MvcHtmlString Script(this HtmlHelper helper, string scriptPath, bool tryUseScriptManager) { return(ResourceHelper.Script(helper, scriptPath, null, false, tryUseScriptManager)); }
/// <summary> /// Registers JavaScript reference and ensures that it loads maximum once for a page. /// </summary> /// <remarks> /// This helper references the same resource existing in Sitefinity. /// </remarks> /// <param name="helper">The helper.</param> /// <param name="scriptReference">The script reference.</param> /// <param name="sectionName">The name of the section that will render this script. If null it will render on the same place of the page</param> /// <param name="throwException">Indicates whether to throw an exception if the specified section does not exist.</param> /// If it is used the script will always be loaded on the top section of the page.</param> /// <returns> /// MvcHtmlString /// </returns> public static MvcHtmlString Script(this HtmlHelper helper, ScriptRef scriptReference, string sectionName, bool throwException) { return(ResourceHelper.Script(helper, scriptReference, sectionName, throwException, true)); }
/// <summary> /// Registers JavaScript reference and ensures that it loads maximum once for a page. /// </summary> /// <remarks> /// This helper references the same resource existing in Sitefinity. /// </remarks> /// <param name="helper">The helper.</param> /// <param name="scriptReference">The script reference.</param> /// If it is used the script will always be loaded on the top section of the page.</param> /// <returns> /// MvcHtmlString /// </returns> public static MvcHtmlString Script(this HtmlHelper helper, ScriptRef scriptReference) { return(ResourceHelper.Script(helper, scriptReference, null, false, true)); }
/// <summary> /// Registers JavaScript reference and ensures that it loads maximum once for a page. /// </summary> /// <remarks> /// This helper references the same resource existing in Sitefinity. /// </remarks> /// <param name="helper">The helper.</param> /// <param name="scriptReference">The script reference.</param> /// <param name="tryUseScriptManager">Indicates whether to use script manager(if exists) when register JavaScript reference. /// If it is used the script will always be loaded on the top section of the page.</param> /// <returns> /// MvcHtmlString /// </returns> public static MvcHtmlString Script(this HtmlHelper helper, ScriptRef scriptReference, bool tryUseScriptManager) { return(ResourceHelper.Script(helper, scriptReference, null, false, tryUseScriptManager)); }
/// <summary> /// Registers JavaScript reference and ensures that it loads maximum once for a page. /// </summary> /// <remarks> /// This helper references the same resource existing in Sitefinity. /// </remarks> /// <param name="helper">The helper.</param> /// <param name="scriptReference">The script reference.</param> /// <param name="sectionName">The name of the section that will render this script. If null it will render on the same place of the page</param> /// <param name="attributes">The path to the JavaScript file.</param> /// If it is used the script will always be loaded on the top section of the page.</param> /// <returns> /// MvcHtmlString /// </returns> public static MvcHtmlString Script(this HtmlHelper helper, ScriptRef scriptReference, string sectionName, List <KeyValuePair <string, string> > attributes) { return(ResourceHelper.Script(helper, scriptReference, sectionName, true, true, attributes)); }
/// <summary> /// Registers JavaScript reference and ensures that it loads maximum once for a page. /// </summary> /// <param name="helper">The helper.</param> /// <param name="scriptPath">The path to the JavaScript file.</param> /// <param name="sectionName">The name of the section that will render this script. If null it will render on the same place of the page</param> /// <param name="throwException">Indicates whether to throw an exception if the specified section does not exist.</param> /// <param name="attributes">The path to the JavaScript file.</param> /// If it is used the script will always be loaded on the top section of the page.</param> /// <returns> /// MvcHtmlString /// </returns> /// <remarks> /// This method uses directly the resource from the <see cref="scriptPath" />. /// In case you want to use embedded scripts from Sitefinity check <see cref="ResourceHelper.Script(this HtmlHelper helper, ScriptRef scriptReference, bool throwException = false)" />. /// </remarks> public static MvcHtmlString Script(this HtmlHelper helper, string scriptPath, string sectionName, bool throwException, List <KeyValuePair <string, string> > attributes) { return(ResourceHelper.Script(helper, scriptPath, sectionName, throwException, true, attributes)); }
/// <summary> /// Registers JavaScript reference and ensures that it loads maximum once for a page. /// </summary> /// <param name="helper">The helper.</param> /// <param name="scriptPath">The path to the JavaScript file.</param> /// <param name="attributes">The path to the JavaScript file.</param> /// If it is used the script will always be loaded on the top section of the page.</param> /// <returns> /// MvcHtmlString /// </returns> /// <remarks> /// This method uses directly the resource from the <see cref="scriptPath" />. /// In case you want to use embedded scripts from Sitefinity check <see cref="ResourceHelper.Script(this HtmlHelper helper, ScriptRef scriptReference, bool throwException = false)" />. /// </remarks> public static MvcHtmlString Script(this HtmlHelper helper, string scriptPath, List <KeyValuePair <string, string> > attributes) { return(ResourceHelper.Script(helper, scriptPath, null, false, true, attributes)); }