コード例 #1
0
        public static RenderRespnose RenderHtml(RenderContext Context, RenderOption option, string relativeurl)
        {
            var sourceprovider = GetSourceProvider(Context, option);

            RenderRespnose response = new RenderRespnose();

            response.ContentType = "text/html";
            string minetype = IOHelper.MimeType(relativeurl);

            if (!string.IsNullOrEmpty(minetype))
            {
                response.ContentType = minetype;
            }

            if (Context == null || sourceprovider == null)
            {
                return(response);
            }
            string htmlbody = sourceprovider.GetString(Context, relativeurl);

            if (string.IsNullOrEmpty(htmlbody))
            {
                return(response);
            }

            var hashid = Lib.Security.Hash.ComputeHashGuid(htmlbody);

            var EvaluatorOption = new EvaluatorOption();

            EvaluatorOption.EnableImageBrowserCache = true;
            EvaluatorOption.EnableJsCssBrowserCache = true;

            EvaluatorOption.Evaluators = Kooboo.Render.Components.EvaluatorContainer.ListWithServerComponent;

            var RenderPlan = RenderPlanCache.GetOrAddRenderPlan(hashid, () => RenderEvaluator.Evaluate(htmlbody, EvaluatorOption));

            // set the culture...
            string culture = Context.Culture;

            if (!string.IsNullOrEmpty(culture))
            {
                Context.DataContext.Push("culture", culture);
            }

            string result = Kooboo.Sites.Render.RenderHelper.Render(RenderPlan, Context);

            string finalreseult = null;

            if (!string.IsNullOrEmpty(finalreseult))
            {
                response.Body = finalreseult;
            }
            else
            {
                response.Body = result;
            }

            return(response);
        }
コード例 #2
0
        public EvaluatorResponse Evaluate(Node node, EvaluatorOption options)
        {
            if (node.nodeType != enumNodeType.COMMENT)
            {
                return(null);
            }

            /// NOTO: There are two place for evaluating comment command.
            if (Commands.CommandManager.IsCommand(node as Comment))
            {
                var response = new EvaluatorResponse();
                List <IRenderTask> result = new List <IRenderTask>();

                Guid OwnerObjectId = options.OwnerObjectId;

                var command = Commands.CommandParser.ParseCommand(node as Comment);

                if (command.Name.ToLower() == "layout")
                {
                    if ((options.IgnoreEvaluators & EnumEvaluator.LayoutCommand) == EnumEvaluator.LayoutCommand)
                    {
                        return(null);
                    }
                    var task = new CommandRenderTask(node as Comment, options);
                    task.ClearBefore = true;
                    result.Add(task);
                    response.AppendTask = result;
                }
                else
                {
                    var task = new CommandRenderTask(node as Comment, options);
                    result.Add(task);
                    response.ContentTask = result;
                }

                response.StopNextEvaluator = true;
                response.OmitTag           = true;

                if (options.RequireBindingInfo)
                {
                    if (response.BindingTask == null)
                    {
                        response.BindingTask = new List <IRenderTask>();
                    }
                    var traceability = new ComponentTrace(command.Name, "command");
                    var bindingTask  = new BindingRenderTask(traceability);
                    response.BindingTask.Add(bindingTask);
                    if (response.EndBindingTask == null)
                    {
                        response.EndBindingTask = new List <IRenderTask>();
                    }
                    response.EndBindingTask.Add(bindingTask.BindingEndRenderTask);
                }
                return(response);
            }

            return(null);
        }
コード例 #3
0
ファイル: Kconfig.cs プロジェクト: weedkiller/Kooboo
        public EvaluatorResponse Evaluate(Node node, EvaluatorOption options)
        {
            if (options.IgnoreEvaluators.HasFlag(EnumEvaluator.kConfig))
            {
                return(null);
            }

            if (node.nodeType != enumNodeType.ELEMENT)
            {
                return(null);
            }
            var element = node as Element;

            string attName  = null;
            string attValue = null;

            foreach (var item in element.attributes)
            {
                if (item.name == "k-config")
                {
                    attName  = item.name;
                    attValue = item.value;
                    break;
                }
            }
            if (!string.IsNullOrEmpty(attName))
            {
                var response = new EvaluatorResponse();
                var result   = new List <IRenderTask>();
                var task     = new KConfigRenderTask(element, attValue);
                result.Add(task);
                response.ContentTask = result;
                response.OmitTag     = true;

                if (options.RequireBindingInfo && task.KConfigTraces.Count > 0)
                {
                    if (response.BindingTask == null)
                    {
                        response.BindingTask = new List <IRenderTask>();
                    }
                    if (response.EndBindingTask == null)
                    {
                        response.EndBindingTask = new List <IRenderTask>();
                    }
                    var bindingRenderTasks = task.KConfigTraces.Select(s => new BindingRenderTask(s)).ToArray();
                    response.BindingTask.AddRange(bindingRenderTasks);
                    response.EndBindingTask.AddRange(bindingRenderTasks.Select(s => s.BindingEndRenderTask).ToArray());
                }

                return(response);
            }
            return(null);
        }
コード例 #4
0
        public EvaluatorResponse Evaluate(Node node, EvaluatorOption options)
        {
            if (options.IgnoreEvaluators.HasFlag(EnumEvaluator.kCache))
            {
                return(null);
            }

            if (node.nodeType != enumNodeType.ELEMENT)
            {
                return(null);
            }
            var element = node as Element;

            int interval = 60 * 60;

            string LabelName = null;

            foreach (var item in element.attributes)
            {
                var lower = item.name.ToLower();
                if (lower == "k-externalcache")
                {
                    LabelName = item.name;
                    break;
                }
            }
            if (!string.IsNullOrEmpty(LabelName))
            {
                var response = new EvaluatorResponse();

                string value = element.getAttribute(LabelName);

                element.removeAttribute(LabelName);

                string strinternval = element.getAttribute("k-interval");
                if (!string.IsNullOrWhiteSpace(strinternval))
                {
                    int.TryParse(strinternval, out interval);

                    element.removeAttribute("k-interval");
                }
                element.removeAttribute("href");

                List <IRenderTask> result = new List <IRenderTask>();
                result.Add(new ContentRenderTask(" href=\""));
                result.Add(new ExternalCacheRenderTask(value, interval));
                result.Add(new ContentRenderTask("\""));
                response.AttributeTask = result;

                return(response);
            }
            return(null);
        }
コード例 #5
0
ファイル: RenderEngine.cs プロジェクト: xhute/Kooboo
        public static RenderRespnose RenderHtml(RenderContext Context, SpaRenderOption option, string relativeurl)
        {
            var sourceprovider = GetSourceProvider(Context, option);

            RenderRespnose response = new RenderRespnose();

            response.ContentType = "text/html";
            string minetype = IOHelper.MimeType(relativeurl);

            if (!string.IsNullOrEmpty(minetype))
            {
                response.ContentType = minetype;
            }

            if (Context == null || sourceprovider == null)
            {
                return(response);
            }
            string htmlbody = sourceprovider.GetString(Context, relativeurl);

            if (string.IsNullOrEmpty(htmlbody))
            {
                return(response);
            }

            var hashid = Lib.Security.Hash.ComputeHashGuid(htmlbody);

            var EvaluatorOption = new EvaluatorOption();

            EvaluatorOption.IgnoreEvaluators = EnumEvaluator.Form | EnumEvaluator.LayoutCommand;
            EvaluatorOption.Evaluators       = Kooboo.Render.Components.EvaluatorContainer.ListWithServerComponent;

            var RenderPlan = RenderPlanCache.GetOrAddRenderPlan(hashid, () => RenderEvaluator.Evaluate(htmlbody, EvaluatorOption));

            string result = Sites.Render.RenderHelper.Render(RenderPlan, Context);

            string finalreseult = null;

            if (!string.IsNullOrEmpty(finalreseult))
            {
                response.Body = finalreseult;
            }
            else
            {
                response.Body = result;
            }
            return(response);
        }
コード例 #6
0
        public EvaluatorResponse Evaluate(Node node, EvaluatorOption options)
        {
            if (node.nodeType != enumNodeType.ELEMENT)
            {
                return(null);
            }
            var element = node as Element;

            if (ComponentService.IsServerComponent(element.tagName))
            {
                var response = new EvaluatorResponse();
                List <IRenderTask> result = new List <IRenderTask>();
                result.Add(new ServerComponentRenderTask(element));
                response.ContentTask       = result;
                response.OmitTag           = true;
                response.StopNextEvaluator = true;
                return(response);
            }
            return(null);
        }
コード例 #7
0
        public EvaluatorResponse Evaluate(Node node, EvaluatorOption options)
        {
            if (options.IgnoreEvaluators.HasFlag(EnumEvaluator.kConfig))
            {
                return(null);
            }

            if (node.nodeType != enumNodeType.ELEMENT)
            {
                return(null);
            }
            var element = node as Element;

            string attName  = null;
            string attValue = null;

            foreach (var item in element.attributes)
            {
                if (item.name == "k-config")
                {
                    attName  = item.name;
                    attValue = item.value;
                    break;
                }
            }
            if (!string.IsNullOrEmpty(attName))
            {
                var response = new EvaluatorResponse();
                List <IRenderTask> result = new List <IRenderTask>();

                result.Add(new KConfigRenderTask(element, attValue));
                response.ContentTask = result;
                response.OmitTag     = true;

                return(response);
            }
            return(null);
        }
コード例 #8
0
        public EvaluatorResponse Evaluate(Node node, EvaluatorOption options)
        {
            if (options.IgnoreEvaluators.HasFlag(EnumEvaluator.System))
            {
                return(null);
            }

            if (node.nodeType != enumNodeType.ELEMENT)
            {
                return(null);
            }
            var element = node as Element;

            string attName = null;

            foreach (var item in element.attributes)
            {
                if (item.name.StartsWith("k-sys-"))
                {
                    attName = item.name;
                    break;
                }
            }
            if (!string.IsNullOrEmpty(attName))
            {
                string conditiontext = element.getAttribute(attName);
                element.removeAttribute(attName);
                var response = new EvaluatorResponse();
                List <IRenderTask> result = new List <IRenderTask>();
                result.Add(new SysRenderTask(element, attName, conditiontext, options));
                response.ContentTask       = result;
                response.StopNextEvaluator = true;
                response.OmitTag           = true;
                return(response);
            }
            return(null);
        }
コード例 #9
0
        public EvaluatorResponse Evaluate(Node node, EvaluatorOption options)
        {
            if (options.IgnoreEvaluators.HasFlag(EnumEvaluator.Version))
            {
                return(null);
            }

            if (!options.EnableImageBrowserCache && !options.EnableJsCssBrowserCache)
            {
                return(null);
            }


            if (node.nodeType != enumNodeType.ELEMENT)
            {
                return(null);
            }
            var element = node as Element;

            // only for style, script and image.
            if (element.tagName != "script" && element.tagName != "link" && element.tagName != "img")
            {
                return(null);
            }

            if (element.tagName == "img")
            {
                if (!options.EnableImageBrowserCache)
                {
                    return(null);
                }
            }

            if (element.tagName == "script" || element.tagName == "style")
            {
                if (!options.EnableJsCssBrowserCache)
                {
                    return(null);
                }
            }

            if (element.tagName == "link")
            {
                if (!options.EnableJsCssBrowserCache)
                {
                    return(null);
                }

                var rel = element.getAttribute("rel");

                var url  = element.getAttribute("href");
                var mine = Kooboo.Lib.Helper.IOHelper.MimeType(url);

                if (mine == null)
                {
                    return(null);
                }

                if (!mine.ToLower().Contains("css") && !mine.ToLower().Contains("font") && !mine.ToLower().Contains("style"))
                {
                    return(null);
                }
            }

            Dictionary <string, string> appendValues = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);

            string attname = null;

            bool IsStyle = false;
            bool IsImage = false;

            if (element.tagName == "script")
            {
                attname = "src";
            }
            else if (element.tagName == "link")
            {
                attname = "href";
                IsStyle = true;
            }
            else if (element.tagName == "img")
            {
                attname = "src";
                IsImage = true;
            }

            string value = element.getAttribute(attname);

            if (string.IsNullOrWhiteSpace(value))
            {
                return(null);
            }

            element.removeAttribute(attname);

            EvaluatorResponse response = new EvaluatorResponse();

            List <IRenderTask> tasks = new List <IRenderTask>();

            tasks.Add(new ContentRenderTask(" " + attname + "=\""));

            tasks.Add(new VersionRenderTask(value, IsStyle, IsImage));

            tasks.Add(new ContentRenderTask("\""));

            if (response.AttributeTask == null)
            {
                response.AttributeTask = tasks;
            }
            else
            {
                response.AttributeTask.AddRange(tasks);
            }

            if (response.AttributeTask == null || response.AttributeTask.Count() == 0)
            {
                return(null);
            }
            else
            {
                return(response);
            }
        }
コード例 #10
0
ファイル: ForEvaluator.cs プロジェクト: weedkiller/Kooboo
        public EvaluatorResponse Evaluate(Node node, EvaluatorOption options)
        {
            if (options.IgnoreEvaluators.HasFlag(EnumEvaluator.For))
            {
                return(null);
            }

            if (node.nodeType != enumNodeType.ELEMENT)
            {
                return(null);
            }
            var element = node as Element;

            string attName = null;

            foreach (var item in element.attributes)
            {
                var lower = item.name.ToLower();
                if (lower == "tal-for" || lower == "k-for")
                {
                    attName = item.name;
                    break;
                }
            }

            if (string.IsNullOrEmpty(attName))
            {
                return(null);
            }
            string repeatitems = element.getAttribute(attName).Trim();

            if (string.IsNullOrEmpty(repeatitems))
            {
                return(null);
            }

            element.removeAttribute(attName);

            bool repeatself = false;

            if (element.hasAttribute("repeat-self"))
            {
                repeatself = true;
                element.removeAttribute("repeat-self");
            }
            else if (element.hasAttribute("tal-repeat-self"))
            {
                repeatself = true;
                element.removeAttribute("tal-repeat-self");
            }
            else if (element.hasAttribute("k-repeat-self"))
            {
                repeatself = true;
                element.removeAttribute("k-repeat-self");
            }

            var para = PrasePara(repeatitems);

            if (para == null)
            {
                return(null);
            }

            ForRenderTask task = new ForRenderTask(para.DataKey, para.LowBound, para.HighBound, repeatself, element, options);

            var response = new EvaluatorResponse();
            var result   = new List <IRenderTask>();

            result.Add(task);
            response.ContentTask       = result;
            response.OmitTag           = true;
            response.StopNextEvaluator = true;

            if (options.RequireBindingInfo)
            {
                if (response.BindingTask == null)
                {
                    response.BindingTask = new List <IRenderTask>();
                }
                var traceability = new RepeatTrace();
                var bindingTask  = new BindingRenderTask(traceability);
                response.BindingTask.Add(bindingTask);
                if (response.EndBindingTask == null)
                {
                    response.EndBindingTask = new List <IRenderTask>();
                }
                response.EndBindingTask.Add(bindingTask.BindingEndRenderTask);
            }

            return(response);
        }
コード例 #11
0
        public string Execute(RenderContext context, Dictionary <string, string> Paras, EvaluatorOption options)
        {
            if (Paras != null && Paras.Count() > 0)
            {
                Dictionary <string, string> datavalue = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);
                foreach (var item in Paras)
                {
                    if (item.Key.ToLower() != "file" && item.Key.ToLower() != "virtual")
                    {
                        datavalue.Add(item.Key, item.Value);
                    }
                }
                if (datavalue.Count() > 0)
                {
                    context.DataContext.Push(datavalue);
                }
            }

            var file = GetFilePath(context, Paras);

            var source = GetSourceFromDb(context, file);

            if (!string.IsNullOrEmpty(source))
            {
                List <IRenderTask> renderplan;

                if (options == null)
                {
                    options              = new EvaluatorOption();
                    options.RenderUrl    = true;
                    options.RenderHeader = false;
                }


                Guid sourceid = Lib.Security.Hash.ComputeGuidIgnoreCase(source);

                if (context.Request.Channel == RequestChannel.InlineDesign)
                {
                    source = DomService.ApplyKoobooId(source);
                    options.RequireBindingInfo = true;
                    renderplan = RenderEvaluator.Evaluate(source, options);
                }
                else
                {
                    SiteDb sitedb;
                    if (context.WebSite == null)
                    {
                        var site = new WebSite()
                        {
                            Name = "__Koobootemp"
                        };
                        sitedb = site.SiteDb();
                    }
                    else
                    {
                        sitedb = context.WebSite.SiteDb();
                    }

                    renderplan = Cache.RenderPlan.GetOrAddRenderPlan(sitedb, sourceid, () => RenderEvaluator.Evaluate(source, options));
                }

                return(RenderHelper.Render(renderplan, context));
            }

            return(null);
        }
コード例 #12
0
ファイル: CommandEvaluator.cs プロジェクト: xhute/Kooboo
        public EvaluatorResponse Evaluate(Node node, EvaluatorOption options)
        {
            if (node.nodeType != enumNodeType.COMMENT)
            {
                return(null);
            }

            /// NOTO: There are two place for evaluating comment command.
            if (Commands.CommandManager.IsCommand(node as Comment))
            {
                var response = new EvaluatorResponse();
                List <IRenderTask> result = new List <IRenderTask>();

                Guid OwnerObjectId = options.OwnerObjectId;

                var command = Commands.CommandParser.ParseCommand(node as Comment);

                if (command.Name.ToLower() == "layout")
                {
                    if ((options.IgnoreEvaluators & EnumEvaluator.LayoutCommand) == EnumEvaluator.LayoutCommand)
                    {
                        return(null);
                    }
                    var task = new CommandRenderTask(node as Comment);
                    task.ClearBefore = true;
                    result.Add(task);
                    response.AppendTask = result;
                }
                else
                {
                    var task = new CommandRenderTask(node as Comment);
                    result.Add(task);
                    response.ContentTask = result;
                }

                response.StopNextEvaluator = true;
                response.OmitTag           = true;

                if (options.RequireBindingInfo)
                {
                    string boundary = Kooboo.Lib.Helper.StringHelper.GetUniqueBoundary();

                    var startbinding = new BindingObjectRenderTask()
                    {
                        ObjectType = "Command", Boundary = boundary, NameOrId = command.Name
                    };
                    List <IRenderTask> bindingstarts = new List <IRenderTask>();
                    bindingstarts.Add(startbinding);
                    response.BindingTask = bindingstarts;

                    var endbinding = new BindingObjectRenderTask()
                    {
                        ObjectType = "Command", IsEndBinding = true, Boundary = boundary, NameOrId = command.Name
                    };

                    List <IRenderTask> bindingends = new List <IRenderTask>();
                    bindingends.Add(endbinding);
                    response.EndBindingTask = bindingends;
                }
                return(response);
            }

            return(null);
        }
コード例 #13
0
ファイル: LayoutCommand.cs プロジェクト: weedkiller/Kooboo
        public string Execute(RenderContext context, Dictionary <string, string> Paras, EvaluatorOption options)
        {
            if (Paras != null && Paras.Count() > 0)
            {
                Dictionary <string, string> datavalue = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);
                foreach (var item in Paras)
                {
                    if (item.Key.ToLower() != "name" && item.Key.ToLower() != "id")
                    {
                        datavalue.Add(item.Key, item.Value);
                    }
                }
                if (datavalue.Count() > 0)
                {
                    context.DataContext.Push(datavalue);
                }
            }

            string layoutNameOrId = GetLayoutNameOrId(Paras);
            string layoutbody     = null;

            if (!string.IsNullOrEmpty(layoutNameOrId))
            {
                layoutbody = GetSourceFromDb(context, layoutNameOrId);

                if (!string.IsNullOrEmpty(layoutbody))
                {
                    List <IRenderTask> renderplan;

                    if (options == null)
                    {
                        options                         = new EvaluatorOption();
                        options.RenderUrl               = false;
                        options.RenderHeader            = false;
                        options.EnableImageBrowserCache = true;
                        options.EnableJsCssBrowserCache = true;
                    }


                    Guid sourceid = Lib.Security.Hash.ComputeHashGuid(layoutbody);  // GetLayoutGuid(layoutNameOrId);

                    if (context.Request.Channel == RequestChannel.InlineDesign)
                    {
                        layoutbody = DomService.ApplyKoobooId(layoutbody);
                        options.RequireBindingInfo = true;
                        renderplan = RenderEvaluator.Evaluate(layoutbody, options);
                    }
                    else
                    {
                        SiteDb sitedb;
                        if (context.WebSite == null)
                        {
                            var site = new WebSite()
                            {
                                Name = "__Koobootemp"
                            };
                            sitedb = site.SiteDb();
                        }
                        else
                        {
                            sitedb = context.WebSite.SiteDb();
                        }

                        renderplan = Cache.RenderPlan.GetOrAddRenderPlan(sitedb, sourceid, () => RenderEvaluator.Evaluate(layoutbody, options));
                    }
                    return(RenderHelper.Render(renderplan, context));
                }
            }

            return(null);
        }
コード例 #14
0
        public EvaluatorResponse Evaluate(Node node, EvaluatorOption options)
        {
            if (options.IgnoreEvaluators.HasFlag(EnumEvaluator.LocalCache))
            {
                return(null);
            }

            if (node.nodeType != enumNodeType.ELEMENT)
            {
                return(null);
            }
            var element = node as Element;

            if (!element.hasAttribute("k-localcache"))
            {
                return(null);
            }

            string attName  = "k-localcache";
            string attvalue = element.getAttribute(attName);
            var    source   = GetSourceLink(element);

            if (string.IsNullOrEmpty(attvalue))
            {
                attvalue = source.AttributeValue;
            }

            element.removeAttribute(attName);

            if (attvalue == null)
            {
                return(null);
            }

            if (source != null)
            {
                element.removeAttribute(source.AttributeName);
            }


            EvaluatorResponse response = new EvaluatorResponse();


            List <IRenderTask> tasks = new List <IRenderTask>();

            tasks.Add(new ContentRenderTask(" " + source.AttributeName + "=\""));

            var local = new LocalCacheRenderTask(attvalue);

            tasks.Add(local);

            tasks.Add(new ContentRenderTask("\""));

            if (response.AttributeTask == null)
            {
                response.AttributeTask = tasks;
            }
            else
            {
                response.AttributeTask.AddRange(tasks);
            }

            if (response.AttributeTask == null || response.AttributeTask.Count() == 0)
            {
                return(null);
            }
            else
            {
                return(response);
            }
        }
コード例 #15
0
 public CommandRenderTask(Comment comment, EvaluatorOption options)
 {
     this.command = CommandParser.ParseCommand(comment);
     this.options = options;
 }
コード例 #16
0
        public Task <string> RenderAsync(RenderContext context, ComponentSetting setting)
        {
            var      frontcontext = context.GetItem <FrontContext>();
            DateTime logstart     = DateTime.UtcNow;

            View view = null;

            if (context.WebSite.EnableFrontEvents && context.IsSiteBinding)
            {
                view = Kooboo.Sites.FrontEvent.Manager.RaiseViewEvent(FrontEvent.enumEventType.ViewFinding, context, setting);

                if (view == null)
                {
                    view = context.WebSite.SiteDb().Views.GetByNameOrId(setting.NameOrId);
                    if (view != null)
                    {
                        var result = FrontEvent.Manager.RaiseViewEvent(FrontEvent.enumEventType.ViewFound, context, setting, view);

                        if (result != null)
                        {
                            view = result;
                        }
                    }
                    else
                    {
                        view = FrontEvent.Manager.RaiseViewEvent(FrontEvent.enumEventType.ViewNotFound, context, setting);
                    }
                }
            }

            if (view == null)
            {
                view = context.WebSite.SiteDb().Views.GetByNameOrId(setting.NameOrId);
            }


            if (view == null)
            {
                frontcontext.AddLogEntry("view", "", logstart, 404);
                return(Task.FromResult(string.Empty));
            }

            view = CheckAlternativeView(view, frontcontext);

            frontcontext.ExecutingView = view;

            var    dataResults = new Dictionary <string, object>();
            string viewBody    = null;

            frontcontext.Views.Add(view);

            if (setting.Settings != null && setting.Settings.Count() > 0)
            {
                context.DataContext.Push(setting.Settings);
            }

            var allviewdatamethods = Cache.SiteObjectCache <ViewDataMethod> .List(frontcontext.SiteDb).Where(o => o.ViewId == view.Id).ToList();

            foreach (var datemethod in allviewdatamethods)
            {
                frontcontext.ViewDataMethods.Add(datemethod);

                var result = DataSources.DataMethodExecutor.ExecuteViewDataMethod(frontcontext, datemethod);

                if (result != null)
                {
                    if (result is PagedResult)
                    {
                        var pagedresult = result as  PagedResult;

                        dataResults[datemethod.AliasName] = pagedresult.DataList;
                        dataResults[datemethod.AliasName + ".TotalPages"] = pagedresult.TotalPages;
                        List <int> PageNrs = new List <int>();
                        for (int i = 1; i <= pagedresult.TotalPages; i++)
                        {
                            PageNrs.Add(i);
                        }
                        dataResults[datemethod.AliasName + ".CurrentPage"] = pagedresult.PageNumber;
                        dataResults[datemethod.AliasName + ".Pages"]       = PageNrs;
                    }
                    else
                    {
                        //if (result is DataMethodResult)
                        //{
                        //    var methodresult = result as DataMethodResult;
                        //    if (methodresult.Value is PagedResult)
                        //    {
                        //        var pagedresult = methodresult.Value as PagedResult;

                        //        dataResults[datemethod.AliasName + ".TotalPages"] = pagedresult.TotalPages;
                        //        List<int> PageNrs = new List<int>();
                        //        for (int i = 1; i <= pagedresult.TotalPages; i++)
                        //        {
                        //            PageNrs.Add(i);
                        //        }
                        //        dataResults[datemethod.AliasName + ".CurrentPage"] = pagedresult.PageNumber;
                        //        dataResults[datemethod.AliasName + ".Pages"] = PageNrs;
                        //    }
                        //}

                        dataResults[datemethod.AliasName] = result;
                    }
                }
            }

            if (dataResults.Count > 0)
            {
                context.DataContext.Push(dataResults);
            }

            viewBody = view.Body;

            Guid viewid = view.Id;

            List <IRenderTask> renderplan;
            string             returnstring = string.Empty;

            EvaluatorOption options = new EvaluatorOption();

            options.RenderUrl     = true;
            options.RenderHeader  = false;
            options.OwnerObjectId = view.Id;

            if (frontcontext.RenderContext.Request.Channel == RequestChannel.InlineDesign)
            {
                viewBody = DomService.ApplyKoobooId(viewBody);
                options.RequireBindingInfo = true;
                renderplan = RenderEvaluator.Evaluate(viewBody, options);
            }
            else
            {
                renderplan = Cache.RenderPlan.GetOrAddRenderPlan(frontcontext.SiteDb, viewid, () => RenderEvaluator.Evaluate(viewBody, options));
            }


            returnstring += RenderHelper.Render(renderplan, frontcontext.RenderContext);

            if (dataResults.Count > 0)
            {
                context.DataContext.Pop();
            }


            if (setting.Settings != null && setting.Settings.Count() > 0)
            {
                context.DataContext.Pop();
            }


            frontcontext.AddLogEntry("view", view.Name, logstart, 200);

            frontcontext.ExecutingView = null;
            return(Task.FromResult(returnstring));
        }