/// <summary> /// renders the startup script, using plupload.startup.js. /// all placeholders within js template file will be resolved. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="html"></param> /// <param name="resPath"></param> /// <param name="onCompleteFunction"></param> /// <returns></returns> public static MvcHtmlString ScriptContent <T>(this HtmlHelper <T> html, string resPath, string onCompleteFunction) { string scriptContent = RessourceHelper.GetTextResource(PluploadConstants.JS_PLUPLOAD_STARTUP); PluploadConfiguration config = PluploadContext.Instance.GetConfiguration(); scriptContent = scriptContent.Replace("[SCRIPT_URL]", resPath.GetAbsoluteWebPathForRessource()). Replace("[ON_COMPLETE_FUNCTION]", onCompleteFunction). Replace("[SCRIPT_JQUERY_URL]", config.JSjQuery.GetAbsoluteWebPath()); return(new MvcHtmlString(scriptContent)); //html.Action("EmbeddedTextRessource", "Ressource", new { textPath = resPath, contentType = "text/javascript" }); }
/// <summary> /// creates a new context. /// loads all configuration files. /// </summary> private PluploadContext() { this.CustomConfiguration = XMLSerializer <PluploadConfiguration> .Load(); string config = RessourceHelper.GetTextResource(PluploadConstants.CONFIGURATION_MAIN); XmlDocument xdoc = new XmlDocument(); xdoc.LoadXml(config); this.GlobalEmbedConfiguration = XMLSerializer <PluploadConfiguration> .Load(xdoc); this.MergedConfiguration = (this.CustomConfiguration != null) ? this.GlobalEmbedConfiguration.Merge(this.CustomConfiguration) : this.GlobalEmbedConfiguration; this.Initialize(); }
/// <summary> /// gets the content of the embedded text ressource. /// </summary> /// <param name="textPath">an embedded dot separated path to the ressource. For example: /// Plupload.Net.Content.css.plupload.net.css</param> /// <param name="contentType">a type of the content</param> /// <returns>a contenResult of the embedded ressource</returns> public ContentResult EmbeddedTextRessource(string textPath, string contentType = "application/octet-stream") { return(Content(RessourceHelper.GetTextResource(textPath), contentType)); }
/// <summary> /// renders the embedded stylesheet as contentResult. This Action can be used as a /// location of the css file, defined within hre attribute of the style tag. /// </summary> /// <param name="cssPath">an embedded dot separated path to the stylesheet ressource for example: /// ~/Ressource/EmbeddedCSS?cssPath=Plupload.Net.Content.css.plupload.net.css </param> /// <returns>the content of embedded css ressource</returns> public ContentResult EmbeddedCSS(string cssPath) { return(Content(RessourceHelper.GetTextResource(cssPath), "text/css")); }
/// <summary> /// renders the embedded javascript as JavaScriptResult. This Action can be used as a /// location of the script, defined within src attribute of the script tag. /// </summary> /// <param name="scriptPath">an embedded dot separated path to the script ressource for example: /// ~/Ressource/EmbeddedJavaScript?scriptPath=Plupload.Net.Scripts.plupload.net.js</param> /// <returns>the content of embedded javascript ressource</returns> public JavaScriptResult EmbeddedJavaScript(string scriptPath) { return(JavaScript(RessourceHelper.GetTextResource(scriptPath))); }