Exemplo n.º 1
0
 private void appendLink(String url, StringBuilder builder, int i)
 {
     builder.AppendFormat("<a href=\"{0}\" target=\"_blank\">{1}</a> ", LinkUtil.appendListPage(PageHelper.AppendNo(url, i), ctx), i);
 }
Exemplo n.º 2
0
        private void bindTopicOne(IBlock block, ForumTopic topic, Boolean isAdmin, Boolean isSticky, int replySize)
        {
            if (topic.Creator == null)
            {
                return;
            }

            String stickyIconName = topic.IsGlobalSticky ? "gsticky" : "sticky";

            if (isSticky)
            {
                block.Set("stickyIconName", stickyIconName);
            }

            String rewardInfo = string.Empty;

            if (topic.Reward > 0)
            {
                rewardInfo = getRewardInfo(topic, rewardInfo);
            }

            String   lblNew  = string.Empty;
            ForumApp app     = ctx.app.obj as ForumApp;
            int      newDays = app.GetSettingsObj().NewDays;

            if (DateTime.Now.Subtract(topic.Created).Days < newDays)
            {
                lblNew = "<span class=\"supNew\">new</span>";
            }


            String lblCategory = string.Empty;

            if (topic.Category != null && topic.Category.Id > 0)
            {
                String lnkCategory = to(new BoardController().Category, topic.ForumBoard.Id) + "?categoryId=" + topic.Category.Id;
                lblCategory = string.Format("<a href=\"{0}\" target=\"_blank\"><span style=\"color:{2}\">[{1}]</span></a>&nbsp;", lnkCategory, topic.Category.Name, topic.Category.NameColor);
            }

            String typeImg = string.Empty;

            if (strUtil.HasText(topic.TypeName))
            {
                typeImg = string.Format("<img src=\"{0}apps/forum/{1}.gif\">", sys.Path.Skin, topic.TypeName);
            }

            String priceInfo = string.Empty;

            if (topic.Price > 0)
            {
                priceInfo = alang("price") + " :" + topic.Price + " ";
            }

            String permissionInfo = string.Empty;

            if (topic.ReadPermission > 0)
            {
                permissionInfo = alang("readPermission") + ":" + topic.ReadPermission + "";
            }

            //String chkId = "";
            //if (isAdmin) chkId = "<input type=\"checkbox\" name=\"postSelect\" id=\"checkbox" + topic.Id + "\" value=\"" + topic.Id + "\" />";
            String chkId = "<input type=\"checkbox\" name=\"postSelect\" id=\"checkbox" + topic.Id + "\" value=\"" + topic.Id + "\" />";


            block.Set("p.CheckBox", chkId);

            block.Set("p.Id", topic.Id);
            block.Set("p.Category", lblCategory);
            block.Set("p.TypeImg", typeImg);
            block.Set("p.Reward", rewardInfo);
            block.Set("p.Price", priceInfo);
            block.Set("p.ReadPermission", permissionInfo);
            block.Set("p.Titile", strUtil.CutString(topic.Title, 40));
            block.Set("p.TitleStyle", topic.TitleStyle);
            block.Set("p.LabelNew", lblNew);

            String lnk = LinkUtil.appendListPage(to(new TopicController().Show, topic.Id), ctx);

            block.Set("p.Url", lnk);

            block.Set("p.Pages", getPostPagesString(alink.ToAppData(topic), topic.Replies, replySize));
            block.Set("p.MemberName", topic.Creator.Name);
            block.Set("p.MemberUrl", toUser(topic.Creator));
            block.Set("p.CreateTime", topic.Created.ToShortDateString());
            block.Set("p.ReplyCount", topic.Replies);
            block.Set("p.Hits", topic.Hits);
            block.Set("p.LastUpdate", topic.Replied.GetDateTimeFormats('g')[0]);
            block.Set("p.LastReplyUrl", toUser(topic.RepliedUserFriendUrl));
            block.Set("p.LastReplyName", topic.RepliedUserName);

            String attachments = topic.Attachments > 0 ? "<img src='" + sys.Path.Img + "attachment.gif'/>" : "";

            block.Set("p.Attachments", attachments);

            String statusImg;

            if (topic.IsLocked == 1)
            {
                statusImg = sys.Path.Skin + "apps/forum/lock.gif";
            }
            else if (topic.IsPicked == 1)
            {
                statusImg = sys.Path.Skin + "apps/forum/pick.gif";
            }
            else
            {
                statusImg = sys.Path.Skin + "apps/forum/topic.gif";
            }

            block.Set("postStatusImage", statusImg);
            block.Next();
        }