<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Dd_text.aspx.cs" Inherits="HteamDd.Web.Web.Dd_text"  ValidateRequest="false"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>发布文字|海客轻微博</title>
  <meta content="IE=EmulateIE7" http-equiv="X-UA-Compatible" />
  <meta http-equiv="Content-Type" content="text/html;charset=gb2312"/>
    <link href="/css/opration.css" rel="stylesheet" type="text/css" />
    <script src="/jscript/jquery-1.4.2.js" type="text/javascript"></script>
    <script src="/jscript/Dd_image_deal.js" type="text/javascript"></script>
      <!--编辑器代码-开始 -->
    <script src="/kindeditor/kindeditor.js" type="text/javascript"></script>
      <script type="text/javascript">
         KE.show({
             id: 'pb-text-textarea',
             imageUploadJson: '/kindeditor/plugins/upload_json.ashx',
             fileManagerJson: '/kindeditor/plugins/file_manager_json.ashx',
             allowFileManager: true,
             width: "100%", //编辑器的宽度为70%  
             height: "353px", //编辑器的高度为100px    
             filterMode: false, //不会过滤HTML代码
             allowUpload: true, //设置是否上传图片
             resizeMode: 0 //2或1或0，2时可以拖动改变宽度和高度，1时只能改变高度，0时不能拖动。
            
         });
     </script>
<!-- 编辑器代码结束 -->

<script type="text/javascript">
    var user = "";
    function check() {
        var d = document.forms[0];
        if (d.title.value.replace(/(^\s*)|(\s*$)/g, "") == "" && d.textarea.value.replace(/(^\s*)|(\s*$)/g, "") == "") {
            alert("标题 或者 内容 至少要填写一项才可以发布噢～");
            return false;
        }
//        else if (document.getElementById("post-tag-input").value.replace(/(^\s*)|(\s*$)/g, "") == "") {
//            alert("为文章添加个标签吧~");
//            return false;
//        }
        if (d.textarea.value.length > 8000) {
            var num = d.textarea.value.length - 8000;
            alert("不能超过4000个字！当前字数为：" + d.textarea.value.length + " 应减去：" + num + "个字");
            return false;
        }
        return true;
    }

    var jq = jQuery.noConflict();
    jq(document).ready(function () {
        var cookie_info = ' <%=user_Mes%>';
        if (cookie_info != "") {
            user = cookie_info.split(',');
            blogname.innerHTML = user[1];
            img_user(user[0], "2"); //处理个人图片问题
        }
        //退出时，进行session和cookie的清空
        jq("#uer_Exit").click(function () {
            jq.ajax({
                type: "post",
                url: '/ashx/Dd_userExit.ashx',
                data: { type: "exit", time: new Date().getDate() },
                success: function (data) {
                    if (data == "1") {
                        window.location.href = "/Dd_login.aspx";
                    }
                },
                error: function () {

                }
            });
        });

        jq("#pb-submit").click(function () {
            if (jq("#pb-main-title-name").html() == "转载文字") {
                if (check()) {
                    jq("#pb-submiting-tip").css("display", "");
                    jq.ajax({
                        type: "post",
                        url: '/ashx/Dd_text.ashx',
                        data: {
                            userID: user[0],
                            originID: "<%=text_originID %>",
                            ArticleID: "<%=text_ID %>",
                            CopyFrom: "<%=userid %>",
                            Order: "0",
                            state: "reship_text",
                            title: (jq('#pb-text-title').val()),
                            content: (jq('#pb-text-textarea').val()),
                            lable: (jq('#post-tag-input').val()),
                            check: jq('#pb-top-post').attr("checked"),
                            time: new Date().getTime()
                        },
                        success: function (data) {
                            if (data == "1") {
                                window.location.href = "/Default.aspx";
                            }
                        },
                        error: function () {
                            alert("转载失败！");
                        }
                    });
                }
            }
            else {
                if (check()) {
                    jq("#pb-submiting-tip").css("display", "");
                    jq.ajax({
                        type: "post",
                        url: '/ashx/Dd_text.ashx',
                        data: { userID: user[0],
                            originID: user[1],
                            title: (jq('#pb-text-title').val()),
                            content: (jq('#pb-text-textarea').val()),
                            lable: (jq('#post-tag-input').val()),
                            check: jq('#pb-top-post').attr("checked"),
                            state: "text",
                            time: new Date().getTime()
                        },
                        success: function (data) {
                            if (data == "1") {
                                window.location.href = "/Default.aspx";
                            }
                        },
                        error: function () {
                            alert("发布失败！");
                        }
                    });
                }
            }
        });

        jq("#pb-cancel").click(function () {
            var re = confirm('确定要取消吗？');
            if (re == true) {
                window.location.href = "/Default.aspx";
            }
            else
            { }
        })
        jq("#pb-preview").click(function () {
            if (check()) {
                jq.ajax({
                    type: "post",
                    url: "/Web/Dd_preview.aspx",
                    data: { title: (jq('#pb-text-title').val()),
                        content: (jq('#pb-text-textarea').val()),
                        lable: (jq('#post-tag-input').val()),
                        type: "0", user: "文章预览",
                        time: new Date().getTime()
                    },
                    success: function () {
                        window.open("Dd_preview.aspx");
                    },
                    error: function () {

                    }
                });
            }
        });
    });
         function lable_check() {
             jq("#post-tag-list").css("display","none");
             jq("#post-tag-input").focus();
         }


         jq(document).ready(function () {
             if ('<%=text %>' == '发布文字') {
                 jq("#pb-main-title-name").css("display", "block");
             }
             else if ('<%=text %>' == '编辑文字') {
                 jq("#pb-main-title").css("display", "block");
                 jq(".pb-section-title").css("margin-top", "70px");
                 //jq("#content").css("height", "730px");
             }
             else if ('<%=text %>' == '转载文字') {
                 jq("#pb-main-title").css("display", "block");
                 jq(".pb-section-title").css("margin-top", "70px");
                 //jq("#content").css("height", "730px");                 
             }
         });    
</script> 
<style type="text/css">
    .pb-input-text
    {
           word-wrap: break-word;

        }
         ul#nav-blog-list li.active a, ul#nav-blog-list li  {
            background: url("/images/header_$2174.png") no-repeat scroll -238px 39px transparent;
        }

        ul#nav-blog-list .nav-blog-name {
            color: #ffffff;
            font-size: 18px;
            line-height: 50px;
        }
        ul#nav li.active a.nav-item
        {
            color:#A3B2BE;
        }
        ul#nav li a.nav-item:hover {
            background: url("/images/header_$2174.png") no-repeat scroll center 39px transparent;
            color: #FFFFFF;
        } 
</style> 
</head>
<body>
<div id="wrap">
        <div id="header" class="clearfix">
        <div id="logo">
            <a href="/Default.aspx">海客网</a>
        </div>
        <ul id="nav">
            <li id="nav-index" class="active">
                <a class="nav-item" href="/Default.aspx">首页</a>
                <a id="new-feed-count" class="header-pop-notice" style="display:none"></a>
            </li>
            <li>
                <a id="nav-explore" class="nav-item" href="/Web/Dd_discover/Dd_FerverTag.aspx">发现</a>
            </li>
        </ul>
        <ul id="sub-nav">
            <li>
                <a href="/Dd_login.aspx" id="uer_Exit">退出</a>
            </li>
            <li>
                <a href="/Web/Dd_setting.aspx">设置</a>
            </li>
            <li>
                <a href="/Web/Dd_Intro_Master/Dd_aboutme.aspx">关于</a>
            </li>
           <%-- <li>
                <a href="#">手机</a>
            </li>
            <li>
                <a href="#">邀请</a>
            </li>--%>
        </ul>
        <ul id="nav-blog-list" class="clearfix">
            <li id="nav-blog-8500453" >
                <a href="./Dd_private_index.aspx">
                    <span class="nav-blog-avatar">
                        <img width="20" height="20" id="img_personal" src="/images/avatar_30_30.$1095.png" alt=""/>
                    </span>
                    <span class="nav-blog-name" id="blogname"></span>

                </a>
            </li>
        </ul>
    </div>
    <div id="content-holder">
    <form id="form1" runat="server" name="form" action="" method="post">
        <div id="content" 
            style="background-image: url('/images/publisher_content_$1349.png'); background-repeat: repeat-y;">
                <div id="pb-main">
                     <h2 id="pb-main-title-name" style="display:none;"><%=text %></h2>  
                        <h2 id="pb-main-title" class="clearfix" style="display: none;">
                            <div style=" float:left;"><span><%=text %></span> <span class="pb-main-title-to">至</span></div>
                            <div id="Div1" class="dd-publisher" default="" style="width: 224px; float:left;">
                                <div id="ctrlcomboboxpublisher-menu" class="ui-combobox skin-combobox-publisher" data-control="publisher-menu">
                                    <div id="ctrlcomboboxpublisher-menutext" class="ui-combobox-text skin-combobox-publisher-text"
                                        value="">
                                        <nobr>
                                            <img class="avatar"  src="/images/avatar_30_30.$1095.png" alt="" />
                                            <span class="blog-name" style="width: 160px;"><%=username %></span>
                                        </nobr>
                                    </div>
                                </div>
                            </div>
                        </h2>
                    <div id="pb-post-area">
                        <div class="pb-post-section" id="pb-text-title-holder">
                            <h3 class="pb-section-title">标题<span>(可不填)</span></h3>
                            <input tabindex="1" class="pb-input-text" id="pb-text-title" type="text"  name="title" value='<%=text_title %>' />
                        </div>
                        <div class="pb-post-section" id="pb-text-post-holder">
                            <h3 class="pb-section-title">内容</h3>
                            <textarea class="pb-input-text" id="pb-text-textarea" cols="" rows="" name="textarea"><%=text_content %></textarea>
                         
                        </div>
                    </div>
                    <div id="pb-action-holder">
                       <a id="pb-submit" class="blue-button">发布</a>
                        <a id="pb-preview" class="gray-button" >预览</a>
                    <div style="display:none">
                        <a id="pb-draft" class="gray-button">保存草稿</a></div>
                        <a id="pb-cancel" class="gray-button" >取消</a>
                        <span style="display:none;" id="pb-submiting-tip">正在保存...</span>
                    </div>
                </div>
                <div id="pb-aside"><div class="aside-item" id="post-to-holder">
<label for="post-to-select">发布至</label>
<select id="post-to-select">
<option value="langzi88">超级管理员</option></select>
</div>
<hr class="separator"/>
<div class="aside-item" id="post-privacy-holder">
<select id="post-privacy-select">
<option value="0">立即发布</option>
<option value="draft">保存到草稿</option>
<option value="queue">加入到自动发布列表</option>
<option value="2">仅自己可见</option></select>
</div>
<hr class="separator"/>
<div class="aside-item" id="post-tag-holder">
<div id="post-tag" onclick="lable_check()">
<ul class="clearfix" id="post-tag-list">
    <li>添加标签，用逗号分隔</li>
</ul>
<div id="post-tag-input-holder">
<input type="text"  id="post-tag-input" value='<%=text_tag %>'/>
</div>
</div>
</div>
<div style="display:none;" class="aside-item" id="recommand-tag-holder">
<h4>常用标签</h4>
<ul class="clearfix" id="recommand-tag-list"></ul>
</div>
<hr class="separator"/>
<div class="aside-item pb-side-opt" id="top-post-holder">
<label><input type="checkbox" id="pb-top-post"/>文章置顶</label>
<p id="top-post-tip">每个博客只能置顶一篇文章</p>
</div><hr id="pb-sync-sep" class="separator" style="display: none;"/>
</div>
        </div>
    </form>
    </div>
    </div>
</body>
</html>