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

<!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" />
    <link href="/css/Dd_video.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" language="javascript" src="/jscript/jquery-1.4.2.js"></script>
    <script src="/jscript/Dd_image_deal.js" type="text/javascript"></script>

    <script language="javascript" type="text/javascript">
        function check() {
            var d = document.forms[0];
            if (d.title.value.replace(/(^\s*)|(\s*$)/g, "") == "") {
                alert("请填写视频地址或内容～");
                return false;
            }
            if (d.textarea.value.length > 4000) {
                var num = d.textarea.value.length - 4000;
                alert("不能超过4000个字符！当前字数为：" + d.textarea.value.length + " 应减去：" + num + "个字");
                return false;
            }
            return true;
        }
        var jq = jQuery.noConflict();
        var istrue = false;
        var radiourl = "";
        var imageurl = "";
        var playurl = "";
        var user = "";

        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("#not-support").hide();
            jq("#is-search").hide();
            jq("#pb-video-preview-holder").hide();
            var text = jq("#pb-text-title").val();

            var edit = '<%=video_edit %>';
            if (edit == "edit") {
                //jq("#pb-video-thumb").attr("src", result);                
            }
            jq("#pb-text-title").keyup(function () {
                if (!istrue) {
                    title_check();
                }
            });
            jq("#pb-text-title").mouseleave(function () {
                if (!istrue) {
                    title_check();
                }
            });
            jq("#pb-video-repick-btn").click(function () {

                jq("#pb-video-preview-holder").hide();
                jq("#pb-text-title-holder").show();
                jq("#pb-text-title").val("");
            });

            jq("post-tag-input").click(function () { document.getElementById("post-tag-list").style.display = "none"; });

            //发布
            jq("#pb-submit").click(function () {
                if (jq("#pb-main-title-name").html() == "转载视频") {
                    if (istrue == true) {
                        jq("#pb-submiting-tip").css("display", "");
                        jq.ajax({
                            url: "/ashx/Dd_Video_Save.ashx",
                            data: {
                                originID: "<%=video_originID %>",
                                ArticleID: "<%=text_ID %>",
                                CopyFrom: "<%=userid %>",
                                Order: "4",
                                state: "reship_Video",
                                userID: user[0],
                                radiourl: radiourl,
                                imageurl: imageurl,
                                content: jq('#pb-text-textarea').val(),
                                label: jq('#post-tag-input').val(),
                                check: jq('#pb-top-post').attr("checked"),
                                mark: "video_submit",
                                time: new Date().getDate()
                            },
                            success: function (data) {
                                if (data == "1") {
                                    window.location.href = "/Default.aspx";
                                }
                            },
                            error: function () {
                                alert("视频地址不支持~~");
                                jq("#not-support").show();
                            }
                        });
                    }
                    else {
                        alert("视频地址不支持~~");
                        return false;
                    }
                }
                else {
                    if (istrue == true) {
                        jq("#pb-submiting-tip").css("display", "");
                        jq.ajax({
                            url: "/ashx/Dd_Video_Save.ashx",
                            data: { userID: user[0], radiourl: radiourl, imageurl: imageurl, content: jq('#pb-text-textarea').val(), label: jq('#post-tag-input').val(), check: jq('#pb-top-post').attr("checked"), state: "Video", mark: "video_submit", time: new Date().getDate() },
                            success: function (data) {
                                if (data == "1") {
                                    window.location.href = "/Default.aspx";
                                }
                                else {
                                    alert("发布失败~");
                                }
                            },
                            error: function () {
                                alert("视频地址不支持~~");
                                jq("#not-support").show();
                            }
                        });
                    }
                    else {
                        alert("视频地址不支持~~");
                        return false;
                    }
                }
            });
            jq("#pb-cancel").click(function () {
                if (confirm('确定要取消吗？')) {
                    window.location.href = "/Default.aspx";
                }
            })
            jq("#pb-preview").click(function () {
                if (check()) {
                    jq.ajax({
                        type: "post",
                        url: "/web/Dd_preview.aspx",
                        data: { title: jq("#pb-text-title").val(), address: imageurl, content: jq('#pb-text-textarea').val(), lable: jq('#post-tag-input').val(), type: "4", user: "视频预览", time: new Date().getTime() },
                        success: function () {
                            window.open("Dd_preview.aspx");
                        },
                        error: function () {

                        }
                    });
                }
            });

        });

        function title_check() {          
            if (jq("#pb-text-title").val() == "") {
                jq("#not-support").hide();
                jq("#is-search").hide();
                return false;
            }
            jq("#not-support").hide();
            jq("#is-search").show();
            jq.ajax({
                url: "/ashx/Dd_search_video_image.ashx",
                data: { url: jq("#pb-text-title").val(), mark: "1" },
                success: function (result) {
                    if (result == "error") {
                        jq("#not-support").show();
                        jq("#is-search").hide()
                    }
                    else {
                        var img_cont = result.split(',');
                        imageurl = img_cont[0];
                        radiourl = jq("#pb-text-title").val();
                        jq("#pb-text-title-holder").hide();
                        jq("#pb-video-thumb").attr("src", img_cont[0]);
                        jq("#pb-video-preview-holder").show();
                        jq("#is-search").hide();
                        jq("#text_content").text(img_cont[1]);
                        jq("#pb-text-textarea").text(img_cont[1]);
                        istrue = true;
                    }
                },
                error: function () {
                    jq("#not-support").show();
                    jq("#is-search").hide()
                }
            });          
        }
        function lable_check() {
            document.getElementById("post-tag-list").style.display = "none";
            jq("#post-tag-input").focus();

        }
      
    </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代码  
             resizeMode: 0 //2或1或0，2时可以拖动改变宽度和高度，1时只能改变高度，0时不能拖动。
         });
         function txtTitle_onclick() {

         }

     </script>
<!-- 编辑器代码结束 -->
</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="/Web/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;">
                            <span><%=text %></span> <span class="pb-main-title-to">至</span>
                            <div id="Div1" class="dd-publisher" default="" style="width: 224px;">
                                <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="/UpLoadImage/HeadImg/Thumbnail_pics/avatar_64_64_$1095.png" />
                                            <span class="blog-name" style="width: 160px;"><%=username %></span>
                                        </nobr>
                                    </div>
                                </div>
                            </div>
                        </h2>
                    <div id="pb-post-area">
                        <div id="pb-text-title-holder" class="pb-post-section" >
                            <h3 class="pb-section-title">链接地址
                                <span>
                                    (支持优酷视频发布)
                                </span>
                            </h3>
                            <div id="pb-video-search-tip" class="pb-input-tip">
                                <span id="not-support"style="color:Red;">不支持的视频地址</span>
                                <span id="is-search" style=" display:none;">正在搜索</span>
                            </div>
                            <input id="pb-text-title" tabindex="1" class="pb-input-text" type="text" name="title" value='<%=video_address %>'/>
                        </div>
                        <div class="pb-post-media-preview clearfix" id="pb-video-preview-holder">
                            <a class="pb-post-media-preview-close" id="pb-video-repick-btn">重新选择视频</a>
                            <%--<img id="pb-video-thumb" src="http://g1.ykimg.com/0100641F464B83098CFEC4004D89F158270366-4C52-B4FE-0991-AA0235E912AC">--%>
                            <img id="pb-video-thumb" src="">
                        </div>
                        <div class="pb-post-section" id="pb-text-post-holder">
                            <h3 class="pb-section-title">描述<span>(可不填)</span></h3>
                            <textarea class="pb-input-text" id="pb-text-textarea" cols=""rows="" name="textarea"><%=video_descript %></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" selected="">立即发布</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" tip="{&quot;class&quot;:&quot;pb-tag-tip&quot;,&quot;text&quot;:&quot;添加标签...&quot;}" id="post-tag-input" name="lable" value='<%=video_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>