private void bindPollItem( PollData p ) { set( "poll.Id", p.Id ); set( "poll.Title", p.Title ); set( "poll.Question", p.Question ); set( "poll.Voters", p.VoteCount ); set( "poll.Created", p.Created ); String replies = p.Replies > 0 ? " "+lang("comment")+":" + p.Replies : ""; set( "poll.Replies", replies ); set( "poll.ShowLink", to( Show, p.Id ) ); }
private String getTitleData(String lnkPost) { PollData data = db.findById <PollData>(this.RootId); String lnkUser = Link.ToMember(data.Creator); String target = string.Format("<a href=\"{0}\">{1}</a>", lnkUser, data.Creator.Name); String blog = string.Format("<a href=\"{0}\">{1}</a>", lnkPost, data.Title); Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("target", target); dic.Add("blog", blog); return(JSON.DicToString(dic)); }
private void bindDetail( PollData poll ) { set( "post.Title", poll.Title ); set( "post.CreateTime", poll.Created ); set( "post.ReplyCount", poll.Replies ); set( "post.Hits", poll.Hits ); User user = (User)ctx.viewer.obj; Boolean hasVote = poll.CheckHasVote( user.Id ); ctx.SetItem( "poll", poll ); if (hasVote) set( "post.Content", loadHtml( sectionPollResult ) ); else set( "post.Content", loadHtml( sectionPoll ) ); }
private String getControl( PollData poll, int optionIndex ) { Html html = new Html(); if (poll.Type == 1) { html.CheckBox( "pollOption", Convert.ToString( (optionIndex + 1) ), "" ); } else { html.Radio( "pollOption", Convert.ToString( (optionIndex + 1) ), "" ); } return html.ToString(); }
private string getCommentUrl( PollData post ) { return t2( new wojilu.Web.Controller.Open.CommentController().List ) + "?url=" + alink.ToAppData( post, ctx ) + "&dataType=" + typeof( PollData ).FullName + "&dataTitle=" + post.Title + "&dataUserId=" + post.Creator.Id + "&dataId=" + post.Id; }
private void bindVoterList( PollData poll ) { ctx.SetItem( "poll", poll ); load( "voteResult", sectionPollResult ); DataPage<PollDataResult> voterList = pollService.GetVoterList( poll.Id, 10 ); IBlock block = getBlock( "list" ); foreach (PollDataResult result in voterList.Results) { block.Set( "user.Name", result.User.Name ); block.Set( "user.Choice", result.Answer ); block.Set( "user.Created", result.Created ); block.Next(); } set( "page", voterList.PageBar ); }
private void bindComment( PollData post ) { set( "commentUrl", getCommentUrl( post ) ); }
private void bindComment( PollData post ) { ctx.SetItem( "createAction", to( new PollCommentController().Create, post.Id ) ); ctx.SetItem( "commentTarget", post ); load( "commentSection", new PollCommentController().ListAndForm ); }