/// <summary>
        /// Writes all registered javascripts into a string surrounded by html script tags,
        /// ready to be written to an html page.
        /// </summary>
        /// <returns>HTML script tags with containing javascript</returns>
        public string BuildScriptTags()
        {
            if (standardScripts == null)
            {
                standardScripts = string.Concat(
                    ResourceLoader.LoadTextResource("Sprocket.Web.javascript.generic.js"),
                    ResourceLoader.LoadTextResource("Sprocket.Web.javascript.browser-tools.js"),
                    ResourceLoader.LoadTextResource("Sprocket.Web.javascript.json.js"),
                    ResourceLoader.LoadTextResource("Sprocket.Web.javascript.ajax.js"),
                    GetAjaxMethodsScript(SystemCore.Instance.ModuleRegistry)
                    );
            }

            Dictionary <string, string> scripts = new Dictionary <string, string>();
            JavaScriptCollection        jsc     = new JavaScriptCollection();

            jsc.SetKey("$APPLICATIONROOT$", WebUtility.BasePath);
            jsc.Add("standard", standardScripts);

            if (OnBeforeRenderJavaScript != null)
            {
                OnBeforeRenderJavaScript(jsc);
            }

            return(jsc.CreateScriptTags());
        }
        /// <summary>
        /// Writes all registered javascripts into a string surrounded by html script tags,
        /// ready to be written to an html page.
        /// </summary>
        /// <returns>HTML script tags with containing javascript</returns>
        public string BuildStandardScriptsBlock()
        {
            Dictionary <string, string> scripts = new Dictionary <string, string>();
            JavaScriptCollection        jsc     = new JavaScriptCollection();

            jsc.SetKey("$APPLICATIONROOT$", WebUtility.BasePath);
            jsc.SetKey("$LOADTIMESTAMP$", AjaxRequestHandler.Instance.PageTimeStamp.Ticks.ToString());
            jsc.Add("standard", StandardScripts);

            if (OnBeforeRenderJavaScript != null)
            {
                OnBeforeRenderJavaScript(jsc);
            }

            return(jsc.CreateScriptTags());
        }
Exemple #3
0
        private void OnPreRenderJavaScript(JavaScriptCollection scripts)
        {
            HttpContext c          = HttpContext.Current;
            HttpCookie  authcookie = c.Request.Cookies["Sprocket_Persistent_Login"];

            if (authcookie == null)
            {
                return;
            }
            scripts.SetKey(AuthKeyPlaceholder, authcookie["c"]);
        }
        /// <summary>
        /// Writes all registered javascripts into a string surrounded by html script tags,
        /// ready to be written to an html page.
        /// </summary>
        /// <returns>HTML script tags with containing javascript</returns>
        public string BuildStandardScriptsBlock()
        {
            Dictionary <string, string> scripts = new Dictionary <string, string>();
            JavaScriptCollection        jsc     = new JavaScriptCollection();

            jsc.SetKey("$APPLICATIONROOT$", WebUtility.BasePath);
            jsc.Add("standard", StandardScripts);

            if (OnBeforeRenderJavaScript != null)
            {
                OnBeforeRenderJavaScript(jsc);
            }

            return(jsc.CreateScriptTags());
        }
 private void OnPreRenderJavaScript(JavaScriptCollection scripts)
 {
     HttpContext c = HttpContext.Current;
     HttpCookie authcookie = c.Request.Cookies["Sprocket_Persistent_Login"];
     if (authcookie == null) return;
     scripts.SetKey(AuthKeyPlaceholder, authcookie["c"]);
 }
		/// <summary>
		/// Writes all registered javascripts into a string surrounded by html script tags,
		/// ready to be written to an html page.
		/// </summary>
		/// <returns>HTML script tags with containing javascript</returns>
		public string BuildStandardScriptsBlock()
		{
			Dictionary<string, string> scripts = new Dictionary<string, string>();
			JavaScriptCollection jsc = new JavaScriptCollection();
			jsc.SetKey("$APPLICATIONROOT$", WebUtility.BasePath);
			jsc.SetKey("$LOADTIMESTAMP$", AjaxRequestHandler.Instance.PageTimeStamp.Ticks.ToString());
			jsc.Add("standard", StandardScripts);

			if (OnBeforeRenderJavaScript != null) OnBeforeRenderJavaScript(jsc);

			return jsc.CreateScriptTags();
		}
        /// <summary>
        /// Writes all registered javascripts into a string surrounded by html script tags,
        /// ready to be written to an html page.
        /// </summary>
        /// <returns>HTML script tags with containing javascript</returns>
        public string BuildStandardScriptsBlock()
        {
            Dictionary<string, string> scripts = new Dictionary<string, string>();
            JavaScriptCollection jsc = new JavaScriptCollection();
            jsc.SetKey("$APPLICATIONROOT$", WebUtility.BasePath);
            jsc.Add("standard", StandardScripts);

            if (OnBeforeRenderJavaScript != null) OnBeforeRenderJavaScript(jsc);

            return jsc.CreateScriptTags();
        }
        /// <summary>
        /// Writes all registered javascripts into a string surrounded by html script tags,
        /// ready to be written to an html page.
        /// </summary>
        /// <returns>HTML script tags with containing javascript</returns>
        public string BuildScriptTags()
        {
            if (standardScripts == null)
            {
                standardScripts = string.Concat(
                    ResourceLoader.LoadTextResource("Sprocket.Web.javascript.generic.js"),
                    ResourceLoader.LoadTextResource("Sprocket.Web.javascript.browser-tools.js"),
                    ResourceLoader.LoadTextResource("Sprocket.Web.javascript.json.js"),
                    ResourceLoader.LoadTextResource("Sprocket.Web.javascript.ajax.js"),
                    GetAjaxMethodsScript(SystemCore.Instance.ModuleRegistry)
                    );
            }

            Dictionary<string, string> scripts = new Dictionary<string, string>();
            JavaScriptCollection jsc = new JavaScriptCollection();
            jsc.SetKey("$APPLICATIONROOT$", WebUtility.BasePath);
            jsc.Add("standard", standardScripts);

            if (OnBeforeRenderJavaScript != null) OnBeforeRenderJavaScript(jsc);

            return jsc.CreateScriptTags();
        }