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

<%@ Register Src="~/UserControl/PageControl.ascx" TagName="PageControl" TagPrefix="uc1" %>
<%@ 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 id="Head1" runat="server">
    <title><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Ques_list")%></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>
    <link href="/Themes/Scripts/artDialog/skins/opera.css" rel="stylesheet" type="text/css" />
    <script src="/Themes/Scripts/artDialog/artDialog.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/artDialog/iframeTools.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/jQuery.lightMenu-1.0.0.min.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/FunctionJS.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/jQuery.path2html.js" type="text/javascript"></script>
    <style type="text/css">
        .specialStyle { background-color: #fcf1fb !important; }
        .div-body img { display: none; }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <input type="hidden" id="txtrfP" runat="server" value="" />
    <div class="btnbartitle">
        <div>
            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Ques_list")%>
        </div>
    </div>
    <div class="btnbarcontetn">
        <div style="text-align: right">
        
        <a class="button green" title="添加子项" onclick="addch();"><span style='background: url("/Themes/images/16/edit.png") no-repeat 0px 4px;' class="icon-botton"></span>添加子项</a>

        <a class="button green" title="添加标签" onclick="addtag();"><span style='background: url("/Themes/images/16/edit.png") no-repeat 0px 4px;' class="icon-botton"></span>添加标签</a>

            <uc2:LoadButton ID="LoadButton1" runat="server" />
        </div>
    </div>
    <div class="div-body">
        <%=TableHtml%>
    </div>
    <uc1:PageControl ID="PageControl1" runat="server" />
    </form>
    <script type="text/javascript">
        $(function () {
            //把分页定位到屏幕下面
            divresize(90);
            FixedTableHeader("#table1", $(window).height() - 121);
        });

        //添加
        function add() {
            var url = "/Training/TrainingTest/Questions_Form.aspx";
            top.openDialog(url, 'Questions_Form', '<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Ques_list")%> - <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Ques_add")%>', 750, 570, 50, 50);
        }

        //添加标签
        function addtag() {
//            var arrt = new Array();
//            arrt = CheckboxValue().split('|');
//            var key = arrt[0];
//            if (key.split(',').length >= 2) {
//                alert(lgznyh);
//                return;
            //            }
            var key=CheckboxValue();
            if (IsEditdata(CheckboxValue())) {
                var url = "/Training/TrainingTest/Questions_Tags.aspx?key=" + key;
                top.openDialog(url, 'Questions_Form', '<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Ques_list")%> - ' + lgtag, 500, 200, 50, 50);
            }
        }

        //添加子题目
        function addch() {
            var arrt = new Array();
            arrt = CheckboxValue().split('|');
            var key = arrt[0];
            if (key.split(',').length >= 2) {
                alert(lgznyh);
                return;
            }
            if (IsEditdata(CheckboxValue())) {
                var url = "/Training/TrainingTest/Questions_Form.aspx?qtid=" + key;
                top.openDialog(url, 'Questions_Form', '<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Ques_list")%> - <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Ques_addsub")%>', 750, 570, 50, 50);
            } 
        }

        //编辑
        function edit() {
            var arrt = new Array();
            arrt = CheckboxValue().split('|');
            var key = arrt[0];
            if (key.split(',').length >= 2) {
                alert(lgznyh);
                return;
            }
            if (IsEditdata(CheckboxValue())) {
                var url = "/Training/TrainingTest/Questions_Form.aspx?HashKey=" + key;
                top.openDialog(url, 'Questions_Form', '<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Ques_list")%> - <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Ques_edit")%>', 750, 570, 50, 50);
            }
        }

        //设置
        function set() {
            var url = "/RMBase/SysWindows/Base_WindowsSQLForm.aspx?key=<%=TableTitle %>";
            top.openDialog(url, 'Questions_SetDisplay', '<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Ques_list")%> - <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Display settings")%>', 750, 400, 50, 50);
        }
        globalSetTags('<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Question_manage")%>', 'Questions_Id');

        //导入题库EXCEL
        function importExcel() {
            var url = "/Training/Exam/ExamImport.aspx";
            top.openDialog(url, 'Questions_ExamImport', '<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Ques_list")%> - <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Question_input")%>', 240, 120, 50, 50);
        }

        function Delete() {
            var arrt = new Array();
            arrt = CheckboxValue().split(',');
            if (IsDelData(arrt)) {
                showConfirmMsg("确定要删除此题目吗？", Delete2);
            }
        }

        //删除
        function Delete2() {        
            var arrt = new Array();
            arrt = CheckboxValue().split(',');
            if (IsDelData(arrt)) {
                var key = "";
                if (arrt.length > 0) {
                    for (var i = 0; i < arrt.length; i++) {
                        if (i == 0) {
                            key += "'" + arrt[i] + "'";
                        } else {
                            key += ",'" + arrt[i] + "'";
                        }
                    }
                }

                $.get("/Training/TrainingTest/Question_List.aspx", { action: "delque", keys: key }, function (data) {
                    var retStr = data.split(',');
                    if (retStr[0] == 1) {
                        showFaceMsg("题目存在 " + retStr[1] + " 试卷中，请先删除试卷！");

                    } else if (retStr[0] == 2) {
                        showFaceMsg("删除题目数：" + retStr[1]);
                        location.reload();
                    }
                });
            }
        }

//        $(document).ready(function () {
//            $("table").find("td").each(function (i) {//搜寻表格里的每一个区间 
                //if(i%2 == 0){ //‘4'代表表格总共有4列，如果区间编号被4整除，那么它就属于第一列 
                //$(this).addClass("col_1");}//给区间加上特定样式 
                //$(this).css({"text-align":"left","color":"red"}); 
                //$(this).css("color","red");
//                $(this).css("text-align", "left");
                //}
//            });
//        }); 
           

    </script>
    <script src="../../Themes/Scripts/CreateContextJs.js" type="text/javascript"></script>
      <script type="text/javascript">
          var i = 0;
          $("annex").each(function () {
              $(this).attr("id", "aa" + i);
              var fileUrl = $(this).text();
              window.path2html("aa" + i, fileUrl);
              i++;
          });   
    </script>
</body>
</html>
