Exemple #1
0
        public static void Render(FrontContext context)
        {
            var script = context.SiteDb.Scripts.Get(context.Route.objectId);

            context.RenderContext.Response.ContentType = "application/javascript;charset=utf-8";

            string result = Getbody(context, script);

            if (context.RenderContext.WebSite != null && context.RenderContext.WebSite.EnableJsCssCompress)
            {
                if (script != null)
                {
                    result = CompressCache.Get(script.Id, script.Version, result, CompressType.js);
                }
            }

            TextBodyRender.SetBody(context, result);

            var version = context.RenderContext.Request.GetValue("version");

            if (!string.IsNullOrWhiteSpace(version))
            {
                context.RenderContext.Response.Headers["Expires"] = DateTime.UtcNow.AddYears(1).ToString("r");
            }
        }
Exemple #2
0
        public static void Render(FrontContext context)
        {
            var css = context.SiteDb.Styles.Get(context.Route.objectId);

            context.RenderContext.Response.ContentType = "text/css;charset=utf-8";

            if (css != null && css.Body != null)
            {
                var body = GetBody(css);

                if (context.RenderContext.WebSite != null && context.RenderContext.WebSite.EnableJsCssCompress)
                {
                    if (css != null)
                    {
                        body = CompressCache.Get(css.Id, css.Version, body, CompressType.css);
                    }
                }

                TextBodyRender.SetBody(context, body);

                var version = context.RenderContext.Request.GetValue("version");

                if (!string.IsNullOrWhiteSpace(version))
                {
                    context.RenderContext.Response.Headers["Expires"] = DateTime.UtcNow.AddYears(1).ToString("r");
                }
            }
        }
Exemple #3
0
        public static void Render(FrontContext context)
        {
            var script = context.SiteDb.Scripts.Get(context.Route.objectId);

            context.RenderContext.Response.ContentType = "application/javascript;charset=utf-8";

            string result = Getbody(context, script);

            TextBodyRender.SetBody(context, result);
        }
Exemple #4
0
        public static void Render(FrontContext context)
        {
            var css = context.SiteDb.Styles.Get(context.Route.objectId);

            context.RenderContext.Response.ContentType = "text/css;charset=utf-8";

            if (css != null && css.Body != null)
            {
                var body = GetBody(css);

                TextBodyRender.SetBody(context, body);
            }
        }
Exemple #5
0
        public static async Task RenderAsync(FrontContext context)
        {
            // fire Page Event. .
            Page page = null;

            if (context.RenderContext.WebSite.EnableFrontEvents && context.RenderContext.IsSiteBinding)
            {
                page = FrontEvent.Manager.RaisePageEvent(FrontEvent.enumEventType.PageFinding, context.RenderContext);

                if (page == null)
                {
                    page = context.SiteDb.Pages.Get(context.Route.objectId);
                    if (page != null)
                    {
                        var changepage = FrontEvent.Manager.RaisePageEvent(FrontEvent.enumEventType.PageFound, context.RenderContext, page);

                        if (changepage != null)
                        {
                            page = changepage;
                        }
                    }
                    else
                    {
                        // page = FrontEvent.Manager.RaisePageEvent(FrontEvent.enumEventType.PageNotFound, context.RenderContext);
                    }
                }
            }

            context.Page = page != null ? page : context.SiteDb.Pages.Get(context.Route.objectId);

            string html = null;

            if (context.Page != null)
            {
                html = await RenderEngine.RenderPageAsync(context);
            }

            if (!string.IsNullOrEmpty(html))
            {
                TextBodyRender.SetBody(context, html);
            }
            else
            {
                context.RenderContext.Response.Body = new byte[0];
            }
        }
Exemple #6
0
        public static void Render(FrontContext context)
        {
            var script = context.SiteDb.Scripts.Get(context.Route.objectId);

            context.RenderContext.Response.ContentType = "application/javascript;charset=utf-8";

            string result = Getbody(context, script);

            if (context.RenderContext.WebSite != null && context.RenderContext.WebSite.EnableJsCssCompress)
            {
                if (script != null)
                {
                    result = CompressCache.Get(script.Id, script.Version, result, CompressType.js);
                }
            }

            TextBodyRender.SetBody(context, result);

            VersionRenderer.ScriptStyleVersion(context);
        }
Exemple #7
0
        public static void Render(FrontContext context)
        {
            var css = context.SiteDb.Styles.Get(context.Route.objectId);

            context.RenderContext.Response.ContentType = "text/css;charset=utf-8";

            if (css != null && css.Body != null)
            {
                var body = GetBody(context.RenderContext, css);

                if (context.RenderContext.WebSite != null && context.RenderContext.WebSite.EnableJsCssCompress)
                {
                    if (css != null)
                    {
                        body = CompressCache.Get(css.Id, css.Version, body, CompressType.css);
                    }
                }
                TextBodyRender.SetBody(context, body);
                VersionRenderer.ScriptStyleVersion(context);
            }
        }