public System.Web.UI.Control AddTo(System.Web.UI.Control container, ViewContext context)
 {
     Literal l = new Literal();
     l.Text = "Template:" + Name;
     container.Controls.Add(l);
     return l;
 }
예제 #2
0
 public Control AddTo(Control container, ViewContext context)
 {
     Control template = container.Page.LoadControl(VirtualPath);
     if (template is IWikiTemplate)
         (template as IWikiTemplate).Viewed = context;
     container.Controls.Add(template);
     return template;
 }
예제 #3
0
 protected virtual void AddTo(IEnumerable<Fragment> fragments, Control container, ContentItem article, IDictionary<string,object> state)
 {
     foreach (Fragment f in fragments)
     {
         var ctx = new ViewContext { Article = article as IArticle, Fragment = f, State = state };
         if (Renderers.ContainsKey(f.Name))
         {
             Control c = Renderers[f.Name].AddTo(container, ctx);
             if (f.ChildFragments != null)
                 AddTo(f.ChildFragments, c, article, state);
         }
         else if (FallbackRenderer != null)
         {
             FallbackRenderer.AddTo(container, ctx);
         }
     }
 }
예제 #4
0
        protected virtual void AddTo(IEnumerable<Component> fragments, Control container, IArticle article, IDictionary<string, object> state)
        {
            var list = fragments.ToList();
            for (int i = 0; i < list.Count; i++)
            {
                var f = list[i];
                var ctx = new ViewContext { Renderer = this, Article = article, Fragment = f, State = state };
                if (i > 0)
                    ctx.Previous = list[i - 1];
                if (i < list.Count - 1)
                    ctx.Next = list[i + 1];

                if (Renderers.ContainsKey(f.Command))
                {
                    Control c = Renderers[f.Command].AddTo(container, ctx);
                }
                else if (FallbackRenderer != null)
                {
                    FallbackRenderer.AddTo(container, ctx);
                }
            }
        }