/// <summary>
        /// Requests that a CSS file be registered on the client browser. Allows for overriding the default provider.
        /// </summary>
        /// <param name="page">The current page. Used to get a reference to the client resource loader.</param>
        /// <param name="filePath">The relative file path to the CSS resource.</param>
        /// <param name="priority">The relative priority in which the file should be loaded.</param>
        /// <param name="provider">The provider name to be used to render the css file on the page.</param>
        /// <param name="name">Name of framework like Bootstrap, Angular, etc</param>
        /// <param name="version">Version nr of framework</param>
        public static void RegisterStyleSheet(Page page, string filePath, int priority, string provider, string name, string version)
        {
            var fileExists = false;

            // Some "legacy URLs" could be using their own query string versioning scheme (and we've forced them to use the new API through re-routing PageBase.RegisterStyleSheet
            // Ensure that physical CSS files with query strings have their query strings removed
            if (filePath.Contains(".css?"))
            {
                var filePathSansQueryString = RemoveQueryString(filePath);
                if (File.Exists(page.Server.MapPath(filePathSansQueryString)))
                {
                    fileExists = true;
                    filePath   = filePathSansQueryString;
                }
            }
            else if (filePath.Contains("WebResource.axd"))
            {
                fileExists = true;
            }

            if (fileExists || FileExists(page, filePath))
            {
                var include = new DnnCssInclude {
                    ForceProvider = provider, Priority = priority, FilePath = filePath, Name = name, Version = version
                };
                var loader = page.FindControl("ClientResourceIncludes");

                if (loader != null)
                {
                    loader.Controls.Add(include);
                }
            }
        }
예제 #2
0
		public override void Register (DnnJsInclude includeJs, DnnCssInclude includeCss, Literal literalScript)
		{
			includeJs.FilePath = "~/Resources/Shared/components/lightbox/js/lightbox.min.js";
			includeCss.FilePath = "~/Resources/Shared/components/lightbox/css/lightbox.css";

			// no startup script required for the Lightbox
			literalScript.Visible = false;
		}
예제 #3
0
		public override void Register (DnnJsInclude includeJs, DnnCssInclude includeCss, Literal literalScript)
		{
			// HACK: point to already defined stylesheet and dummy script
			includeJs.FilePath = "~/DesktopModules/R7.MiniGallery/R7.MiniGallery/js/dummy.js"; 
			includeCss.FilePath = "~/DesktopModules/R7.MiniGallery/R7.MiniGallery/module.css";

			// hide startup script block
			literalScript.Visible = false;
		}
예제 #4
0
		public override void Register (DnnJsInclude includeJs, DnnCssInclude includeCss, Literal literalScript)
		{
			includeJs.FilePath = "~/Resources/Shared/components/colorbox/jquery.colorbox-min.js";
			includeCss.FilePath = "~/Resources/Shared/components/colorbox/example1/colorbox.css";

			var scriptTemplate = "<script type=\"text/javascript\">" +
				"$(document).ready(function(){" +
				"$(\"a[data-colorbox=module_[KEY]]\")" +
				".colorbox({rel:\"module_[KEY]\",photo:true,maxWidth:\"95%\",maxHeight:\"95%\"});" +
			    "});</script>";

			literalScript.Text = scriptTemplate.Replace ("[KEY]", Key);
		}
        /// <summary>
        /// Requests that a CSS file be registered on the client browser. Allows for overriding the default provider.
        /// </summary>
        /// <param name="page">The current page. Used to get a reference to the client resource loader.</param>
        /// <param name="filePath">The relative file path to the CSS resource.</param>
        /// <param name="priority">The relative priority in which the file should be loaded.</param>
        /// <param name="provider">The provider name to be used to render the css file on the page.</param>
        public static void RegisterStyleSheet(Page page, string filePath, int priority, string provider)
        {
            var fileExists = false;

            // Some "legacy URLs" could be using their own query string versioning scheme (and we've forced them to use the new API through re-routing PageBase.RegisterStyleSheet
            // Ensure that physical CSS files with query strings have their query strings removed
            if (filePath.Contains(".css?"))
            {
                var filePathSansQueryString = RemoveQueryString(filePath);
                if (File.Exists(page.Server.MapPath(filePathSansQueryString)))
                {
                    fileExists = true;
                    filePath = filePathSansQueryString;
                }
            }

            if (fileExists || FileExists(page, filePath))
            {
                var include = new DnnCssInclude {ForceProvider = provider, Priority = priority, FilePath = filePath.ToLowerInvariant(), AddTag = false};
                var loader = page.FindControl("ClientResourceIncludes");

                if (loader != null)
                {
                    loader.Controls.Add(include);
                }
            }
        }
예제 #6
0
		// NOTE: using ClientResourceManager.RegisterStyleSheet(), ClientResourceManager.RegisterScript() and
		// Page.ClientScript.RegisterStartupScript() methods won't produce cached content, 
		// so we use DnnJsInclude, DnnCssInclude controls to make links on the lighbox scripts and stylesheets, 
		// and literal to store startup script block. Produced content will be cached this way. 	

		public abstract void Register (DnnJsInclude includeJs, DnnCssInclude includeCss, Literal literalScript);