Пример #1
0
        public ViewResult Service(Page epPage, Template epTemplate)
        {
            if (epPage == null || epPage.Id == null)
                throw new ApplicationException("page is not specified");

            if (epTemplate == null || epTemplate.Id == null)
                throw new ApplicationException("template is not specified");

            var adminJs = new ResourceCollection();
            adminJs.Load(Resources.Resources.jQuery);
            adminJs.Load(Url.RouteUrl("AdminPanel", new {pageId = epPage.Id}).ToLowerInvariant(), MatchMode.Path,
                      "text/javascript");

            ViewBag.ContentAreas = epPage.ContentAreas.ToList();
            ViewBag.Page = epPage;
            ViewBag.Template = epTemplate;
            ViewBag.Root = contentManager.Folder.RootFolder;
            ViewBag.Js = contentManager.Page.Js(epPage.Id);
            ViewBag.AdminJs = adminJs;
            ViewBag.Css = contentManager.Page.Css(epPage.Id);

            // add cache dependency so we can do sitewide clears on page change
            contentManager.Page.AddOutputCacheDependency(
                ((HttpApplication) HttpContext.GetService(typeof (HttpApplication))).Context);

            return View(Path.GetFileNameWithoutExtension(epTemplate.ViewPath));
        }
Пример #2
0
 public FacebookMetaNode(Template template)
 {
     Id = template.Id;
     CssClass = "facebook";
     Type = "templateFacebook";
     Name = "Facebook";
 }
Пример #3
0
 public SearchEngineMetaNode(Template template)
 {
     Id = template.Id;
     CssClass = "search";
     Type = "templateSearch";
     Name = "Search";
 }
Пример #4
0
        public TemplateNode(Template template)
            : this()
        {
            Id = template.Id;
            Name = template.Name;

            // meta nodes
            Children.Add(new SearchEngineMetaNode(template));
            Children.Add(new FacebookMetaNode(template));
        }
Пример #5
0
        public Template Create(string name, string path, string controller, string action)
        {
            if (string.IsNullOrWhiteSpace(name)) throw new ArgumentNullException("name");
            if (string.IsNullOrWhiteSpace(path)) throw new ArgumentNullException("path");

            var template = new Template
                               {
                                   Name = name,
                                   ViewPath = path,
                                   Controller = controller ?? "Content",
                                   Action = action ?? "Service"
                               };
            session.Store(template);
            return template;
        }
Пример #6
0
 public void AddTemplate(Template template)
 {
     Children.Add(new TemplateNode(template));
 }