Exemplo n.º 1
0
        private void bindFriendList(DataPage <FriendShip> list, int userId)
        {
            IBlock            block   = getBlock("list");
            List <FriendShip> friends = list.Results;

            List <FriendCategory> cats = FriendCategory.GetByOwner(userId);

            foreach (FriendShip ship in friends)
            {
                if (ship.User == null || ship.Friend == null)
                {
                    continue;
                }

                User           friend;
                FriendCategory category;
                String         description;

                if (ship.User.Id == userId)
                {
                    friend      = ship.Friend;
                    category    = getCategory(cats, ship.CategoryId);
                    description = ship.Description;
                }
                else
                {
                    friend      = ship.User;
                    category    = getCategory(cats, ship.CategoryIdFriend);
                    description = ship.DescriptionFriend;
                }

                String HideClass = "";
                if (friend.Id <= 0)
                {
                    HideClass = "hide";
                }

                block.Set("m.HideClass", HideClass);

                block.Set("m.Id", friend.RealId);
                block.Set("m.Name", friend.Name);

                block.Set("m.FaceFull", friend.PicMedium);
                block.Set("m.UrlFull", toUser(friend));
                block.Set("m.DeleteUrl", to(Delete, friend.RealId));
                block.Set("m.DeleteFollowingLink", to(DeleteFollowing, friend.RealId));

                block.Set("m.CreateTime", friend.Created);
                block.Set("m.LastLoginTime", friend.LastLoginTime);

                block.Set("m.CategoryName", category == null ? lang("none") : category.Name);
                block.Set("m.CategoryId", category == null ? 0 : category.Id);

                block.Set("m.Description", description);

                block.Next();
            }
            set("page", list.PageBar);
        }
Exemplo n.º 2
0
        private void bindFriends(DataPage <FriendShip> list)
        {
            bindFriendList(list, ctx.owner.Id);

            // 修改类别
            List <FriendCategory> categories = FriendCategory.GetByOwner(ctx.owner.Id);

            dropList("FriendCategory", categories, "Name=Id", 0);
            set("saveCategoryLink", to(SaveCategory));
            set("categoryLink", to(new FriendCategoryController().List));
        }
Exemplo n.º 3
0
        public override void Layout()
        {
            set("f.AddLink", to(Add));
            set("categoryLink", to(new FriendCategoryController().List));
            set("allLink", to(List, 0));
            set("blacklistLink", to(new BlacklistController().Index));

            List <FriendCategory> categories = FriendCategory.GetByOwner(ctx.owner.Id);

            bindCategories(categories);
        }
Exemplo n.º 4
0
        public void List(int categoryId)
        {
            DataPage <FriendShip> list = friendService.GetPageByCategory(ctx.owner.Id, categoryId, 20);

            bindFriendList(list, ctx.owner.Id);

            // 修改类别
            List <FriendCategory> categories = FriendCategory.GetByOwner(ctx.owner.Id);

            dropList("FriendCategory", categories, "Name=Id", 0);
            set("saveCategoryLink", to(SaveCategory));
            set("categoryLink", to(new FriendCategoryController().List));
        }
Exemplo n.º 5
0
        public void SelectBox()
        {
            List <FriendShip> ulist = friendService.GetFriendsAll(ctx.owner.Id);

            set("friendAll", getUserNames(ulist));

            List <FriendCategory> categories = FriendCategory.GetByOwner(ctx.owner.Id);

            bindSelectCategories(categories, ulist);


            DataPage <User> friends = friendService.GetFriendsPage(ctx.owner.Id, 50);

            bindList("list", "f", friends.Results);
            set("page", friends.PageBar);
        }
Exemplo n.º 6
0
        public override void Layout()
        {
            set("searchAction", to(Query));
            String friendName = getSearchName();

            set("qValue", friendName);


            set("f.AddLink", to(Add));
            set("categoryLink", to(new FriendCategoryController().List));
            set("allLink", to(List, 0));
            set("blacklistLink", to(new BlacklistController().Index));

            List <FriendCategory> categories = FriendCategory.GetByOwner(ctx.owner.Id);

            bindCategories(categories);
        }