コード例 #1
0
        protected virtual IHtmlString RenderContentPosition(ContentPosition contentPosition)
        {
            var site       = this.PageContext.PageRequestContext.Site;
            var repository = site.GetRepository();

            if (repository == null)
            {
                throw new KoobooException("The repository for site is null.");
            }
            var dataRule        = contentPosition.DataRule;
            var dataRuleContext = new DataRuleContext(this.PageContext.PageRequestContext.Site,
                                                      this.PageContext.PageRequestContext.Page)
            {
                ValueProvider = this.PageContext.PageRequestContext.GetValueProvider()
            };
            var    contentQuery = dataRule.Execute(dataRuleContext);
            string viewPath     = "";
            var    schema       = dataRule.GetSchema(repository);
            Object model        = contentQuery;

            switch (contentPosition.Type)
            {
            case ContentPositionType.Detail:
                viewPath = schema.GetFormTemplate(FormType.Detail);
                model    = contentQuery.FirstOrDefault();
                break;

            case ContentPositionType.List:
            default:
                int top = 10;
                if (int.TryParse(((FolderDataRule)dataRule).Top, out top))
                {
                    model = contentQuery.Take(top);
                }

                viewPath = schema.GetFormTemplate(FormType.List);
                break;
            }
            return(ViewRender.RenderViewInternal(this.Html, viewPath, null, model));
        }
コード例 #2
0
        protected virtual IHtmlString RenderContentPosition(ContentPosition contentPosition)
        {
            var site       = this.PageContext.PageRequestContext.Site;
            var repository = site.GetRepository();

            if (repository == null)
            {
                throw new KoobooException("The repository for site is null.");
            }
            var dataRule        = (IContentDataRule)(contentPosition.DataRule);
            var dataRuleContext = new DataRuleContext(this.PageContext.PageRequestContext.Site,
                                                      this.PageContext.PageRequestContext.Page)
            {
                ValueProvider = this.PageContext.PageRequestContext.GetValueProvider()
            };

            string        viewPath = "";
            TakeOperation operation;
            var           schema = dataRule.GetSchema(repository);

            switch (contentPosition.Type)
            {
            case ContentPositionType.Detail:
                viewPath  = schema.GetFormTemplate(FormType.Detail);
                operation = TakeOperation.First;
                break;

            case ContentPositionType.List:
            default:
                viewPath  = schema.GetFormTemplate(FormType.List);
                operation = TakeOperation.List;
                break;
            }
            var model = dataRule.Execute(dataRuleContext, operation, 0);

            return(ViewRender.RenderViewInternal(this.Html, viewPath, null, model));
        }
コード例 #3
0
 public AdminController(CampContext context, ViewRender view)
 {
     this.view = view;
     db        = context;
 }
コード例 #4
0
ファイル: FrontHtmlHelper.cs プロジェクト: webrot/CMS
 /// <summary>
 /// Renders the view.
 /// </summary>
 /// <param name="viewName">Name of the view.</param>
 /// <param name="viewData">The view data.</param>
 /// <param name="parameters">The parameters.</param>
 /// <param name="executeDataRule">if set to <c>true</c> [execute data rule].</param>
 /// <returns></returns>
 public virtual IHtmlString RenderView(string viewName, ViewDataDictionary viewData, object parameters, bool executeDataRule)
 {
     return(ViewRender.RenderView(this.Html, PageContext, viewName, viewData, parameters, executeDataRule));
 }
コード例 #5
0
 public ModalController(ViewRender view, IUserRepository userRepository)
 {
     _view           = view;
     _userRepository = userRepository;
 }
コード例 #6
0
 public MeetingController(ViewRender view)
 {
     _mailgenerator = new HtmlGenerator(view);
 }
コード例 #7
0
 public UserController(ViewRender view)
 {
     _view          = view;
     _mailgenerator = new HtmlGenerator(view);
 }
コード例 #8
0
 public ModalController(ViewRender view, IUserRepository userRepository, IMapper mapper)
 {
     _view           = view;
     _userRepository = userRepository;
     _mapper         = mapper;
 }
コード例 #9
0
 public HtmlGenerator(ViewRender viewRenderer)
 {
     ViewRenderer = viewRenderer;
 }
コード例 #10
0
 public HomeController(ViewRender view, INodeServices nodeServices)
 {
     this.view         = view;
     this.nodeServices = nodeServices;
 }