<%@ Page Title="" Language="C#" MasterPageFile="~/Master/Main.Master" AutoEventWireup="true" EnableViewState="false" CodeBehind="Content.aspx.cs" Inherits="MyCms.Page.Content" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="path"><a href="">首页</a> > <%=path %> ></div>
    <h2 class="article_title">
        <%=article.Title %>
    </h2>
    <div class="summary">
        发布时间：<span><%=article.CreateTime.ToString("yyyy-MM-dd") %></span> 标签：<span><%=article.Keywords %></span>
    </div>
    <div class="article_content">
        <%=article.AContent %>
    </div>
    <div class="share">
        <div class="sharebox" style="width: 42px;">分享：</div>
        <div class="sharebox">
            <script type="text/javascript">
                (function () {
                    var p = {
                        url: location.href,
                        showcount: '0',/*是否显示分享总数,显示：'1'，不显示：'0' */
                        desc: '',/*默认分享理由(可选)*/
                        summary: '',/*分享摘要(可选)*/
                        title: '',/*分享标题(可选)*/
                        site: '',/*分享来源 如：腾讯网(可选)*/
                        pics: '', /*分享图片的路径(可选)*/
                        style: '202',
                        width: 31,
                        height: 31
                    };
                    var s = [];
                    for (var i in p) {
                        s.push(i + '=' + encodeURIComponent(p[i] || ''));
                    }
                    document.write(['<a version="1.0" class="qzOpenerDiv" href="http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?', s.join('&'), '" target="_blank">分享</a>'].join(''));
                })();
            </script>
            <script src="http://qzonestyle.gtimg.cn/qzone/app/qzlike/qzopensl.js#jsdate=20111201" charset="utf-8"></script>
        </div>
        <div class="sharebox">
            <script type="text/javascript">
                (function () {
                    var p = {
                        url: location.href, /*获取URL，可加上来自分享到QQ标识，方便统计*/
                        desc: '', /*分享理由(风格应模拟用户对话),支持多分享语随机展现（使用|分隔）*/
                        title: '', /*分享标题(可选)*/
                        summary: '', /*分享摘要(可选)*/
                        pics: '', /*分享图片(可选)*/
                        flash: '', /*视频地址(可选)*/
                        site: '', /*分享来源(可选) 如：QQ分享*/
                        style: '202',
                        width: 24,
                        height: 24
                    };
                    var s = [];
                    for (var i in p) {
                        s.push(i + '=' + encodeURIComponent(p[i] || ''));
                    }
                    document.write(['<a class="qcShareQQDiv" href="http://connect.qq.com/widget/shareqq/index.html?', s.join('&'), '" target="_blank">分享到QQ</a>'].join(''));
                })();
            </script>
            <script src="http://connect.qq.com/widget/loader/loader.js" widget="shareqq" charset="utf-8"></script>
        </div>
    </div>
    <%=contentAD %>
    <div class="comment">
        <div class="comment_form">
            <table>
                <tr>
                    <td style="width: 421px;">我要评论+</td>
                    <td>相关文章</td>
                </tr>
                <tr>
                    <td>
                        <textarea id="ccontent"></textarea></td>
                    <td>
                        <ul>
                            <asp:Repeater ID="rpSameCategory" runat="server">
                                <ItemTemplate>
                                    <li>
                                        <a href="<%#ResolveUrl("~/Page/Content.aspx?id=")+Eval("ArticleID") %>">
                                            <%#Common.StringHelper.GetTextLength(Eval("Title").ToString())>36?(Eval("Title").ToString().Substring(0,18)+"..."):Eval("Title") %>
                                        </a>
                                    </li>
                                </ItemTemplate>
                            </asp:Repeater>
                        </ul>
                    </td>
                </tr>
                <tr>
                    <td>
                        <input type="text" value="" class="vc" id="vc" />
                        <input type="button" class="commentsubmit" onclick="commentSubmit()" value=" 提 交 " />
                        <img class="vcimg" id="vcimg" onclick="changevcimg()" src="<%=ResolveUrl("~/Handler/VerificationCode.ashx") %>" /></td>
                    <td></td>
                </tr>
            </table>

        </div>

    </div>
    <asp:PlaceHolder ID="phCommentList" runat="server">
    <div class="commentlist">
        <table>
            <tr>
                <td>评论列表+</td>
            </tr>
            <tr>
                <td>
                    <ul id="commentul">
                        <asp:Repeater ID="rpCommentList" runat="server">
                            <ItemTemplate>
                                <li><%#Convert.ToDateTime(Eval("CreateTime")).ToString("yyyy-MM-dd") %> <%#Eval("NickName") %>：<%#Eval("CContent") %></li>
                            </ItemTemplate>
                        </asp:Repeater>
                        
                    </ul>

                </td>
            </tr>
        </table>
    </div>
    </asp:PlaceHolder>
    <script>
        $.ajax({ url: '<%=ResolveUrl("~/Handler/ViewCount.ashx?aid="+id)%>', async: false });
        function commentSubmit() {
            var ct = $('#ccontent').val();
            $.ajax({
                url: '<%=ResolveUrl("~/Handler/CommentAction.ashx")%>',
                data: {aid:<%=article.ArticleID%>,ct:ct,vc:$('#vc').val()},
                timeout: 3000,
                type: 'post',
                dataType: 'json',
                beforeSend: function () {
                    $('.commentsubmit').attr('disabled',"true");
                },
                success: function (data) {
                    if (data.status) {
                        var commentlist = $('#commentul');
                        if(commentlist.length>0){
                            commentlist.append('<li>'+data.returnstr+'</li>');
                        }else{
                            var html = '';
                            html +='<div class="commentlist">';
                            html +='<table>';
                            html +='<tr><td>评论列表+</td></tr>';
                            html+='<tr><td><ul id="commentul"><li>'+data.returnstr+'</li></ul></td></tr>';
                            html+='</table></div>';
                            $('.comment').after(html);
                        }
                    }else{
                        alert('评论失败咯~原因不详~');
                    }
                    $('#ccontent').val('');
                    $('#vc').val('');
                    $('.commentsubmit').removeAttr("disabled");
                    $('#vcimg').attr('src','<%=ResolveUrl("~/Handler/VerificationCode.ashx")%>?rnd='+Math.random());
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    if (textStatus == "timeout") {
                        //网络不给力
                    }
                    $('#ccontent').val('');
                    $('#vc').val('');
                    $('.commentsubmit').removeAttr("disabled");
                    $('#vcimg').attr('src','<%=ResolveUrl("~/Handler/VerificationCode.ashx")%>?rnd='+Math.random());
                }
            });
        }
        function changevcimg(){
            $('#vcimg').attr('src','<%=ResolveUrl("~/Handler/VerificationCode.ashx")%>?rnd='+Math.random());
        }
    </script>
</asp:Content>
