1 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Discussion.aspx.cs" Inherits="PumpkinHouse.Discussion" MasterPageFile="~/Site.Master" %>
\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
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
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
32 function initReplyPagination() {
\r
33 pagination('#pagination', globalDiscussion.replyList.count, 20, pageSelectCallback);
\r
36 function pageSelectCallback(pageNumber, container) {
\r
37 ajaxGetDiscussionReply(true, globalDiscussionId, pageNumber, renderReplies, handleFault);
\r
40 function replyAction(text) {
\r
41 ajaxPostReply(true, new ReplyToPost(text, null, null, globalDiscussionId), replySuccess, handleFault);
\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
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
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
66 function doAction() {
\r
67 ajaxGetDiscussion(true, globalDiscussionId, renderDiscussion, handleFault);
\r
68 renderTemplate('#ctrlPanel', '#discussionControlPanelTemplate', null);
\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
79 <div class="BoardRight float_r" id="ctrlPanel">
\r
83 <div id="pagination"></div>
\r
85 <!-- #Include virtual="/template/discussionTemplate.html" -->
\r
86 <!-- #Include virtual="/template/replyTemplate.html" -->
\r