<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Courseware_Script.aspx.cs"
    Inherits="RM.Web.Training.Courseware.Courseware_Script" %>

<%@ Register Src="~/UserControl/LoadButton.ascx" TagName="LoadButton" TagPrefix="uc2" %>
<!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 runat="server">
    <title>
        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_Script_Title")%>
    </title>
    <link href="/Themes/Styles/Site.css" rel="stylesheet" type="text/css" />
    <script src="/Themes/Scripts/jquery-1.8.2.min.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/TreeTable/jquery.treeTable.js" type="text/javascript"></script>
    <link href="/Themes/Scripts/TreeTable/css/jquery.treeTable.css" rel="stylesheet"
        type="text/css" />
    <script src="/Themes/Scripts/FunctionJS.js" type="text/javascript"></script>
</head>
<body>
    <div class="btnbarcontetn">
        <div style="float: left; padding: 5px;">
            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_Script_kjjbbz")%>
        </div>
        <div style="text-align: right">
            <uc2:LoadButton ID="LoadButton1" runat="server" />
        </div>
    </div>
    <input id="csKey" type="hidden" value="<%=csKey %>" />
    <div title="<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_Form_sp")%>"
        style="width: 18%; height: 100%; float: left; border-right: 1px #ccc solid;"
        class="iframeleft">
        <div class="btnbartitle">
            <div>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("ChapterPlan_Form_zjm")%>
            </div>
        </div>
        <ul>
            <%=CdTitle %>
        </ul>
    </div>
    <div title=" <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_Script_spdetial")%>"
        style="width: 30%; height: 100%; border-right: 1px #ccc solid; float: left">
        <div class="btnbartitle">
            <div>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_Form_sp")%>
            </div>
        </div>
        <div id="video" style="position: relative; z-index: 100; width: 100%; height: 200px;
            background-color: Black;">
            <div id="a1">
            </div>
        </div>
        <div>
            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_Script_dqbfsj")%>
            ：<input id="Timetext" value="0" type="text" onclick="Gethuode()" style="font-size: 24px;
                color: Red;"><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Learn_miao")%></div>
        <div>
            <fieldset id="exam_Matter">
                <legend>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_Script_czsm")%></legend>
                <ol id="exma_Notice" style="margin: 5px;">
                    <li>
                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_Script_djzcxytjjbdzj")%></li>
                    <li>
                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_Script_zsmdspzxzxycrjbdsj")%></li>
                    <li>
                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_Script_zyczjdydjbnrjk")%></li>
                </ol>
            </fieldset>
        </div>
    </div>
    <div title="<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_Script_spjb")%>" style="width: 50%; height: 100%; float: left">
        <div class="btnbartitle">
            <div> <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_Script_spjb")%>
                <a href="#" onclick="Getplayer(asdas)">asasa</a>
            </div>
        </div>
        <table class="example" id="dnd-example">
            <tbody id="ScriptTB">
                <tr>
                    <td>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_Script_qxzbczj")%>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>    
    <script src="/Training/Learn/m/ckplayer/ckplayer.js" type="text/javascript"></script>
    <script type="text/javascript">
        function Getplayer(flashvars) {
            var params = { bgcolor: '#000', allowFullScreen: true, allowScriptAccess: 'always', wmode: 'opaque' };
            var video = [flashvars.f + '->video/mp4'];
            CKobject.embed('/Training/Learn/m/ckplayer/ckplayer.swf', 'a1', 'ckplayer_a1', '100%', '200', false, flashvars, video, params);
        }
        var asdas = { f: 'http://movie.ks.js.cn/flv/other/1_0.flv', c: 0, b: 1 };
        <%=getflashvars %>
        var zanting = 1;
        var playTime = 0;  //全局变量，当前视频播放时间,单位秒
        var playVodieId = "";
        var dqbh = 0; //当前应该播放的视频索引，默认是0
        function ckplayer_status(str) {
            //103暂停，102开始播放，101播放结束，105全屏，108加载结束（准备就绪）
            //$("#interText").val(str);//反馈数据测试
            var nowtime = str.substring(0, 5);
            if (nowtime == "time:") {
                document.getElementById("Timetext").value = str.substr(5); //当前播放时间
                zanting = 1;
            }
            else if (str == 106) {
                // alert("很抱歉，教学视频加载失败！"); //106打开视频错误
            }
            else if (str == 'pause') {
                zanting = 0;
            } else if (str == 'play') {//当正在播放才触发事件

            }
            else if (str.length > 10) {
                //alert(str); 
            }
        }
        //获得当前时间
        function Gethuode() {
            try {
                CKobject.getObjectById('ckplayer_a1').videoPause();
                } catch (error) { 
                //alert(error);
                }
                var array = document.getElementById("Timetext").value.split(".");
                if (array.length > 1) {
                    document.getElementById("Timetext").value = array[0];
                }
                document.getElementById("Timetext").select();
            
        }
        //切换视频
        function vodgo(url) {
            //swfobject.getObjectById('ckplayer_a1').ckplayer_newaddress("{f->" + url + "}");
            Getplayer(url);
        }
        //视频列表操作
        var cs_id = "";
        function OnButton(id, valobj) {
            vodgo(valobj);
            var parm = "id=" + id;
            getAjax("Courseware_GetScript.ashx", parm, function (rs) {
                $("#ScriptTB").html(rs);
                FixedTableHeader("#dnd-example", $(window).height() - 91);
                GetClickTableValue();
                cs_id = id;
            });
        }
        //获取脚本id
        var ScriptID = '';
        function GetClickTableValue() {
            $('table tr').not('#td').click(function () {
                $(this).find('td').each(function (i) {
                    if (i == 1) {
                        ScriptID = $(this).text();
                    }
                });
            });
            $("#dnd-example").treeTable({
                initialState: "expanded" //collapsed 收缩 expanded展开的
            });
        }
        //添加
        function addCsScript() {
            Gethuode();
            var cskey = $("#csKey").val();
            var cstime = $("#Timetext").val();
            if (cs_id == "") {
                alert(" <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("ChapterPlan_Form_nxyzsxz")%>");
                return;
            }
            var url = "/Training/Courseware/Courseware_Script_Form.aspx?cskey=" + cskey + "&cs_ID=" + cs_id + "&t=" + cstime;
            top.openDialog(url, 'Courseware_Script_Form', '<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_Script_spjb")%> - <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Add")%>', 700, 350, 50, 50);
            //alert(url);
        }
        //编辑
        function edit() {
            var cskey = $("#csKey").val();
            var url = "/Training/Courseware/Courseware_Script_Form.aspx?cskey=" + cskey + "&cs_ID=" + cs_id + "&key=" + ScriptID;
            top.openDialog(url, 'Courseware_Script_Form', '<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_Script_spjb")%> - <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Edit")%>', 700, 350, 50, 50);
        }
        //删除
        function Delete() {
            delConfig('/Training/Courseware/DeleteCourseware_Script.ashx', 'key=' + ScriptID, "<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_Script_dletebz")%>")
        }
    </script>
</body>
</html>
