Ejemplo n.º 1
0
        public void Index()
        {
            target(Save);
            BlogApp app = ctx.app.obj as BlogApp;

            bindSettings(app.GetSettingsObj());
        }
Ejemplo n.º 2
0
        public override void Layout()
        {
            BlogApp blog = ctx.app.obj as BlogApp;

            if (blog == null)
            {
                throw new NullReferenceException("BlogApp");
            }
            blogService.AddHits(blog);

            set("adminUrl", to(new Admin.MyListController().Index));
            bindAdminLink();


            bindAppInfo(blog);

            load("blog.UserMenu", new Users.ProfileController().UserMenu);

            BlogSetting s = blog.GetSettingsObj();

            List <BlogCategory> categories = categoryService.GetByApp(ctx.app.Id);
            List <BlogPost>     newBlogs   = postService.GetNewBlog(ctx.app.Id, s.NewBlogCount);

            List <OpenComment> comments = commentService.GetByApp(typeof(BlogPost), ctx.app.Id, s.NewCommentCount);

            List <Blogroll> blogrolls = rollService.GetByApp(ctx.app.Id, ctx.owner.obj.Id);

            bindBlogroll(blogrolls);
            bindCategories(categories);
            bindPostList(newBlogs);
            bindComments(comments);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 列出相应发表日期的文章
        /// </summary>
        /// <param name="id"></param>
        public void List(int id)
        {
            BlogApp     app = ctx.app.obj as BlogApp;
            BlogSetting s   = app.GetSettingsObj();

            DataPage <BlogPost> list = postService.GetPageByCreatedCate(ctx.app.Id, id, s.PerPageBlogs);

            //bindCategory("list", "post", blogs, bindLink);

            //bindCategory( category );
            bindPostList(list);

            set("pager", list.PageBar);
        }
Ejemplo n.º 4
0
        private void bindComment(BlogPost post)
        {
            ctx.SetItem("createAction", to(new BlogCommentController().Create, post.Id));
            ctx.SetItem("commentTarget", post);

            BlogApp app = ctx.app.obj as BlogApp;

            if (app.GetSettingsObj().AllowComment == 1)
            {
                load("commentSection", new BlogCommentController().ListAndForm);
            }
            else
            {
                set("commentSection", "");
            }
        }
Ejemplo n.º 5
0
        public void Rss()
        {
            BlogApp     app = ctx.app.obj as BlogApp;
            BlogSetting s   = app.GetSettingsObj();

            RssChannel c = postService.GetRssByAppId(ctx.app.Id, s.RssCount);

            c.Generator = ctx.url.SiteUrl;

            c.Link = strUtil.Join(ctx.url.SiteUrl, c.Link);
            foreach (RssItem i in c.RssItems)
            {
                i.Link = strUtil.Join(ctx.url.SiteUrl, i.Link);
            }

            ctx.RenderXml(c.GetRenderContent());
        }
Ejemplo n.º 6
0
        private string getCommentUrl(BlogPost post)
        {
            BlogApp app = ctx.app.obj as BlogApp;

            if (app.GetSettingsObj().AllowComment == 0)
            {
                return("#");
            }

            return(t2(new wojilu.Web.Controller.Open.CommentController().List)
                   + "?url=" + alink.ToAppData(post, ctx)
                   + "&dataType=" + typeof(BlogPost).FullName
                   + "&dataTitle=" + post.Title
                   + "&dataUserId=" + post.Creator.Id
                   + "&dataId=" + post.Id
                   + "&appId=" + post.AppId);
        }
Ejemplo n.º 7
0
        public void Show(int id)
        {
            BlogCategory category = categoryService.GetById(id, ctx.owner.Id);

            if (category == null)
            {
                echoRedirect(lang("exDataNotFound"));
                return;
            }

            BlogApp     app = ctx.app.obj as BlogApp;
            BlogSetting s   = app.GetSettingsObj();


            DataPage <BlogPost> list = postService.GetPageByCategory(ctx.app.Id, id, s.PerPageBlogs);

            bindCategory(category);
            bindPostList(list);

            set("pager", list.PageBar);
        }
Ejemplo n.º 8
0
        //  [CacheAction( typeof( BlogIndexCache ) )]
        public void Index()
        {
            WebUtils.pageTitle(this, lang("blog"));

            BlogApp     app = ctx.app.obj as BlogApp;
            BlogSetting s   = app.GetSettingsObj();


            DataPage <BlogPost> results = postService.GetPage(ctx.app.Id, s.PerPageBlogs);

            IBlock block = getBlock("topblog");

            if (ctx.route.page == 1)
            {
                bindTopPosts(s, block);
            }

            bindPosts(results, s);

            set("pager", results.PageBar);
        }
Ejemplo n.º 9
0
        //[CacheAction( typeof( BlogLayoutCache ) )]
        public override void Layout()
        {
            BlogApp blog = ctx.app.obj as BlogApp;

            blogService.AddHits(blog);

            set("adminUrl", to(new Admin.MyListController().Index));


            bindAppInfo(blog);//个人博客统计

            load("blog.UserMenu", new Users.ProfileController().UserMenu);

            BlogSetting s = blog.GetSettingsObj();


            List <BlogCategory> categories = categoryService.GetByApp(ctx.app.Id);
            List <BlogPost>     newBlogs   = postService.GetNewBlog(ctx.app.Id, s.NewBlogCount);


            //List<BlogPostComment> newComments = commentService.GetNew( ctx.owner.Id, ctx.app.Id, s.NewCommentCount );
            List <BlogPostComment> newComments = BlogPostComment.find("AppId=" + ctx.app.Id).list(s.NewCommentCount);


            List <Blogroll> blogrolls = rollService.GetByApp(ctx.app.Id, ctx.owner.obj.Id);


            List <BlogPost> Blogs = postService.GetByApp(ctx.app.Id);

            //bindBlogroll(blogrolls);
            bindCategories(categories);
            //bindPostList(newBlogs);
            bindBlogByDateTime(Blogs);
            bindComments(newComments);

            User user = ctx.owner.obj as User;

            set("m.Signature", user.Signature);
        }
Ejemplo n.º 10
0
        public void Show(int id)
        {
            BlogCategory category = categoryService.GetById(id, ctx.owner.Id);

            if (category == null)
            {
                echoRedirect(lang("exDataNotFound"));
                return;
            }

            //List<BlogCategory> lstblogcategory = categoryService.GetByIdName(id);

            BlogApp     app = ctx.app.obj as BlogApp;
            BlogSetting s   = app.GetSettingsObj();


            DataPage <BlogPost> list = postService.GetPageByCategory(ctx.app.Id, id, s.PerPageBlogs);

            //bindCategory("list", "post", blogs, bindLink);

            //bindCategory( category );



            //IBlock block = getBlock("topblog");
            //if (ctx.route.page == 1)
            //{
            //    bindTopPosts(s, block);
            //}

            bindPostList(list);



            set("pager", list.PageBar);
        }