Ejemplo n.º 1
0
        public virtual void Index()
        {
            ctx.Page.Title       = PhotoAppSetting.Instance.MetaTitle;
            ctx.Page.Keywords    = PhotoAppSetting.Instance.MetaKeywords;
            ctx.Page.Description = PhotoAppSetting.Instance.MetaDescription;

            // 从第二页开始,是ajax获取,所以不需要多余的layout内容
            if (CurrentRequest.getCurrentPage() > 1)
            {
                HideLayout(typeof(wojilu.Web.Controller.LayoutController));
                HideLayout(typeof(wojilu.Web.Controller.Photo.LayoutController));
                HideLayout(typeof(wojilu.Web.Controller.Photo.Wf.LayoutController));
            }

            // 1) 超过最大滚页数,则不再自动翻页
            int maxPage = 10;

            if (CurrentRequest.getCurrentPage() > maxPage)
            {
                echoText(".");
                return;
            }

            DataPage <PhotoPost> list = sysPostService.GetShowRecent(20);

            // 2) 或者超过实际页数,也不再自动翻页
            if (CurrentRequest.getCurrentPage() > list.PageCount && list.PageCount > 0)
            {
                echoText(".");
                return;
            }

            PhotoBinder.BindPhotoList(this, list, ctx.viewer.Id);
        }
Ejemplo n.º 2
0
        public virtual void Category(long categoryId)
        {
            view("Index");

            // 从第二页开始,是ajax获取,所以不需要多余的layout内容
            if (CurrentRequest.getCurrentPage() > 1)
            {
                HideLayout(typeof(wojilu.Web.Controller.LayoutController));
                HideLayout(typeof(wojilu.Web.Controller.Photo.LayoutController));
                HideLayout(typeof(wojilu.Web.Controller.Photo.Wf.LayoutController));
            }

            // 1) 超过最大滚页数,则不再自动翻页
            int maxPage = 10;

            if (CurrentRequest.getCurrentPage() > maxPage)
            {
                echoText(".");
                return;
            }

            DataPage <PhotoPost> list = sysPostService.GetShowByCategory(categoryId, 20);

            // 2) 或者超过实际页数,也不再自动翻页
            if (CurrentRequest.getCurrentPage() > list.PageCount && list.PageCount > 0)
            {
                echoText(".");
                return;
            }

            PhotoBinder.BindPhotoList(this, list, ctx.viewer.Id);
        }
Ejemplo n.º 3
0
        public void Category(int id)
        {
            setWaterfallView();

            String userUrl = ctx.route.getItem("user");
            User   u       = userService.GetByUrl(userUrl);

            if (u == null)
            {
                echoRedirect("用户不存在");
                return;
            }

            PhotoAlbum album = categoryService.GetById(id);

            set("albumName", album.Name);
            set("showAlbumCss", "display:block");
            set("albumDataCount", album.DataCount);


            DataPage <PhotoPost> list = postService.GetShowByUser(u.Id, id, 12);

            // 2) 或者超过实际页数,也不再自动翻页
            if (CurrentRequest.getCurrentPage() > list.PageCount && list.PageCount > 0)
            {
                echoText(".");
                return;
            }

            PhotoBinder.BindPhotoList(this, list, u.Id);
        }
Ejemplo n.º 4
0
        private void bindOtherPosts()
        {
            List <PhotoPost> list  = postService.GetNew(15);
            IBlock           block = getBlock("xposts");

            foreach (PhotoPost x in list)
            {
                PhotoBinder.BindPostSingle(ctx, block, x, new List <long>());
                block.Next();
            }
        }
Ejemplo n.º 5
0
        public virtual void Post(long id)
        {
            PhotoPost x = ctx.Get <PhotoPost>();

            postService.AddtHits(x);

            ctx.Page.Title    = x.Title;
            ctx.Page.Keywords = x.Tag.TextString;

            User owner = x.Creator;

            if (ctx.viewer.IsFollowing(owner.Id))
            {
                set("lblFollow", "已经关注");
                set("clsFollow", "btnUnFollow");
            }
            else
            {
                set("lblFollow", "关注");
                set("clsFollow", "btnFollow");
            }

            Boolean isLiked = likeService.IsLiked(ctx.viewer.Id, id);

            List <long> ids = new List <long>();

            if (isLiked)
            {
                ids.Add(id);
            }

            PhotoBinder.BindPostSingleFull(ctx, base.utils.getCurrentView(), x, ids);
            set("lnkPrevNext", getPreNextHtml(x));

            bindAlbumPosts(x);
            bindOtherPosts();

            String commentUrl = t2(new wojilu.Web.Controller.Open.CommentController().List)
                                + "?url=" + PhotoLink.ToPost(x.Id)
                                + "&dataType=" + typeof(PhotoPost).FullName
                                + "&dataTitle=" + x.Title
                                + "&dataUserId=" + x.Creator.Id
                                + "&dataId=" + x.Id
                                + "&appId=" + x.AppId;

            set("thisUrl", commentUrl);
        }
Ejemplo n.º 6
0
        private void bindAlbumPosts(PhotoPost post)
        {
            IBlock block = getBlock("cposts");

            if (post.PhotoAlbum == null)
            {
                return;
            }

            List <PhotoPost> list = postService.GetByAlbum(post.PhotoAlbum.Id, 9);

            foreach (PhotoPost x in list)
            {
                PhotoBinder.BindPostSingle(ctx, block, x, new List <long>());
                block.Next();
            }
        }
Ejemplo n.º 7
0
        public void Like()
        {
            setWaterfallView();

            String userUrl = ctx.route.getItem("user");
            User   u       = userService.GetByUrl(userUrl);

            if (u == null)
            {
                echoRedirect("用户不存在");
                return;
            }

            DataPage <PhotoPost> list = likeService.GetByUser(u.Id, 12);

            // 2) 或者超过实际页数,也不再自动翻页
            if (CurrentRequest.getCurrentPage() > list.PageCount && list.PageCount > 0)
            {
                echoText(".");
                return;
            }

            PhotoBinder.BindPhotoList(this, list, ctx.viewer.Id);
        }