活动页面添加参赛作品瀑布流
[PumpkinHouse.git] / PumpkinHouseWeb / Discussion.aspx
blob5c94fc1f852e87e6a92f7ce5a3e92bb9e32a93fd
1 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Discussion.aspx.cs" Inherits="PumpkinHouse.Discussion" MasterPageFile="~/Site.Master" %>\r
2 \r
3 <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">\r
4     <script type="text/javascript" src="/Scripts/reply.js"></script>\r
5     <script type="text/javascript">\r
6         var globalBoardId = <%= BoardId %>;\r
7         var globalBoardName = '<%= BoardName %>';\r
8         var globalDiscussionId = <%= DiscussionId %>;\r
9         var globalDiscussion;\r
10         var globalReplyCol;\r
12         function renderDiscussion(result) {\r
13             renderTemplate('#discussion', '#discussionTemplate', {boardName: globalBoardName, discussion: result, username: globalLogginUser});\r
14             globalDiscussion = result;\r
15             globalReplyCol = globalDiscussion.replyList;\r
17             initReplyDialog(replyAction, globalLoggedIn);\r
18             initReplyReplyControl(replyReplyAction, globalLoggedIn);\r
19             initReplyPagination();\r
21             // 删除按钮\r
22             $('.deleteDiscussionBtn').on('click', function () {\r
23                 showSmallDialog('#confirmDialogTemplate', '.confirmDialog', '确定要删除?');\r
24                 $('#confirmHolder .confirm').on('click', function () {\r
25                     ajaxDeleteDiscussion(true, globalDiscussionId, function() {\r
26                         document.location = "/DiscussionBoard.aspx?boardId=" + globalBoardId;\r
27                     }, handleFault);\r
28                 });\r
29             });\r
30         }\r
32         function initReplyPagination() {\r
33             pagination('#pagination', globalDiscussion.replyList.count, 20, pageSelectCallback);\r
34         }\r
36         function pageSelectCallback(pageNumber, container) {\r
37             ajaxGetDiscussionReply(true, globalDiscussionId, pageNumber, renderReplies, handleFault);\r
38         }\r
40         function replyAction(text) {\r
41             ajaxPostReply(true, new ReplyToPost(text, null, null, globalDiscussionId), replySuccess, handleFault);\r
42         }\r
44         function replyReplyAction(text, replyId) {\r
45             var reply = new ReplyToPost(text, null, null, globalDiscussionId, replyId);\r
46             ajaxPostReply(true, reply, replySuccess, handleFault);\r
47         }\r
49         function renderReplies(paginationList) {\r
50             var t = $('#replyDetailTemplate').tmpl(paginationList.list, { ownedByMe: globalIsMe });\r
51             $('#replies').empty().append(t);\r
53             initReplyReplyControl(replyReplyAction, globalLoggedIn);\r
54         }\r
56         function replySuccess(newReply) {\r
57             globalDiscussion.replyList.list.unshift(newReply);\r
58             globalDiscussion.replyList.count++;\r
59             renderReplies(globalDiscussion.replyList);\r
60             $('#numberOfReply').text(globalDiscussion.replyList.count);\r
61             // jump to the first reply page\r
62             $("#paginationHolder").trigger('setPage', [0]);\r
63             $('#reply').val('');\r
64         }\r
66         function doAction() {\r
67             ajaxGetDiscussion(true, globalDiscussionId, renderDiscussion, handleFault);\r
68             renderTemplate('#ctrlPanel', '#discussionControlPanelTemplate', null);\r
69         }\r
70     \r
71     </script>\r
72 </asp:Content>\r
73 <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">\r
74 <div class="BoardList">\r
75     <div class="siteLink clearfix float_l"><a href="/BoardList.aspx">讨论组首页</a> > <a href="/DiscussionBoard.aspx?boardId=<%= BoardId %>"><%= BoardName %></a></div>\r
76         <div class="BoardLeft BoardDiscussion float_l" id="discussion">\r
77         \r
78     </div>\r
79     <div class="BoardRight float_r" id="ctrlPanel">\r
81     </div>\r
82 </div>\r
83 <div id="pagination"></div>\r
85 <!-- #Include virtual="/template/discussionTemplate.html" -->\r
86 <!-- #Include virtual="/template/replyTemplate.html" -->\r
88 </asp:Content>\r