<%@ Page Language="C#" AutoEventWireup="true" Inherits="Kesion.NET.WebSite.Admin.Course.KS_CosPropWenjuan" Codebehind="KS.CosPropWenjuan.aspx.cs" %>
<%@ Import Namespace="System.Text" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="Kesion.Cache" %>
<%@ Import Namespace="Kesion.BLL" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <link href="<%=Request.ApplicationPath=="/"?"":Request.ApplicationPath%>/admin/images/style.css" rel="stylesheet" type="text/css" />
    <script src="../../admin/images/pannel/tabpane.js" type="text/javascript"></script>
    <link href="<%=Request.ApplicationPath=="/"?"":Request.ApplicationPath%>/admin/images/pannel/tabpane.CSS" rel="stylesheet" type="text/css" />
    <script src="<%=ResolveUrl("~/KS_Inc/Jquery.js") %>" type="text/javascript"></script>
    <script src="<%=ResolveUrl("~/KS_Inc/Kesion.Common.js") %>" type="text/javascript"></script>
	<script src="/admin/include/comm.js"></script>
    <script src="<%=ResolveUrl("~/KS_Inc/DatePicker/WdatePicker.js") %>"></script>
    
    <script type="text/javascript" charset="utf-8" src="/ks_inc/ueditor/ueditor.config.js"></script>
	<script type="text/javascript" charset="utf-8" src="/ks_inc/ueditor/ueditor.all.js"> </script>
	<script type="text/javascript" charset="utf-8" src="/ks_inc/ueditor/lang/zh-cn/zh-cn.js"></script> 

</head>
<body>
    <form id="form1" runat="server">
    <div>
         <div class="content-area">  
        <%if(KSCMS.S("type")=="wenjuan"){ %>
            <script>
                //获取题库信息
                function getids(num) {
                    //获取选中的富文本信息
                    var sid ;
                    var wennum ;
                    for (var i = 0; i < document.getElementsByName("ids").length; i++) {
                        var KS = document.getElementsByName("ids")[i];
                        if (KS.checked == true) {
                            if (sid == null){
                                sid = KS.value;
                                wennum=1;}
                            else{
                                sid += "," + KS.value;
                                wennum++;
                            }
                        }
                    }
                    jQuery("#wenjuannum"+ num, top.frames["main"].document).html("("+wennum+")");
                    jQuery("#count" + num, top.frames["main"].document).val(wennum);//传值到父页面
                    jQuery("#wenjuan" + num, top.frames["main"].document).val(sid);//传值到父页面
                    parent.box.close();//关闭子窗口
                }
                function SetDate() {
                    var today = new Date();
                    if ($("#showdate").is(":hidden")) {
                        $("#showdate").show();
                        $('#<%=TxtBeginDate.ClientID%>').val(today.getFullYear() + '-' + (today.getMonth() + 1) + '-01');
                        $('#<%=TxtEndDate.ClientID%>').val(today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate());
                    }
                    else {
                        $("#showdate").hide();
                        $('#<%=TxtBeginDate.ClientID%>').val('');
                        $('#<%=TxtEndDate.ClientID%>').val('');
                    }
                }
                function keyWordFocus() {
                    if (jQuery("#<%=this.KeyWord.ClientID %>").val() == '请输入关键字！') {
                        jQuery("#<%=this.KeyWord.ClientID %>").val('');
                    }
                }
                function keyWordBlur() {
                    if (jQuery("#<%=this.KeyWord.ClientID %>").val() == '') {
                                jQuery("#<%=this.KeyWord.ClientID %>").val('请输入关键字！');
                            }
                        }
                    </script>
             <input type="button" value="绑定问卷" class="button" onclick="getids('<%=KSCMS.S("bianhao")%>')" />
             
             <div class="quickSearch"> 
                 <asp:DropDownList ID="Condition" runat="server">
                    <asp:ListItem Value="0">名称</asp:ListItem>
                    <asp:ListItem Value="1">ID</asp:ListItem>
                </asp:DropDownList>
                <asp:TextBox onfocus="keyWordFocus();" onblur="keyWordBlur();" Style="color: #ccc" Text="请输入关键字！" CssClass="textbox" ID="KeyWord" runat="server" Width="180px"></asp:TextBox>
                <span onclick="SetDate()" class="link-color" style="cursor: pointer">日期范围？</span>
                    <span id="showdate" <%if (this.TxtBeginDate.Text == "")
                                      { %> style="display: none" <%} %>>
                    <asp:TextBox ID="TxtBeginDate" placeholder="格式：YYYY-MM-DD" Width="150px" runat="server" onclick="WdatePicker({dateFmt:&#39;yyyy-MM-dd&#39;});" CssClass="textbox Wdate"></asp:TextBox>至
                   <asp:TextBox ID="TxtEndDate" placeholder="格式：YYYY-MM-DD" Width="150px" runat="server" onclick="WdatePicker({dateFmt:&#39;yyyy-MM-dd&#39;});" CssClass="textbox Wdate"></asp:TextBox>
                </span>
                    <asp:Button ID="search" runat="server" CssClass="button" Text="开始搜索" OnClick="search_Click" />
                    </div>
             <asp:Repeater ID="WenjuanRepeater" runat="server" >
                <HeaderTemplate>
                    <table width="100%"border="0" cellpadding="1" cellspacing="1" class="CTable">
                    <tr class="CTitle">
                        <td style="text-align:center">编号</td>
                        <td style="text-align:center">问卷名称</td>
                        <td style="text-align:center">添加时间</td>
                        <td style="text-align:center">上传者</td>
                    </tr>
                </HeaderTemplate>
                <ItemTemplate>
                    <tr>
                        <td style="text-align:center;width:50px"><input type="checkbox" name="ids" value="<%#Eval("id") %>" <%# KSCMS.S("action")!="save"?checkinfo(Utils.StrToInt(KSCMS.S("courseid")),Utils.StrToInt(KSCMS.S("bianhao")),Utils.StrToInt(Eval("id"))):"" %>/><%#Eval("id") %></td>
                        <td style="text-align:left"><a href="<%#Kesion.HtmlTags.BasicField.GetRewriteUrl("wjview",Convert.ToInt32(Eval("id").ToString())) %>" target="_blank"><span class='doc_1'></span></a><%#Eval("title") %></td>
                        <td style="text-align:center"><%#Eval("adddate") %></td>
                        <td style="text-align:center"><%#Eval("inputer") %></td> 
                    </tr>
                </ItemTemplate>
                <FooterTemplate>
                    <tr style="display:<%=this.WenjuanRepeater.Items.Count>0?"none":""%>">
                        <td colspan="4"> 
                            <div class="empty">暂无信息</div>
                        </td>
                    </tr>
                    </table>
                </FooterTemplate>
            </asp:Repeater>
             
             <%}else{ %>
               <script>
                   //获取题库信息
                   function getgameids(num) {
                       //获取选中的富文本信息
                       var sid ;
                       var name;
                       for (var i = 0; i < document.getElementsByName("ids").length; i++) {
                           var KS = document.getElementsByName("ids")[i];
                           if (KS.checked == true) {
                               sid = KS.value;
                               name=document.getElementsByName("name")[i].value;//获取游戏库的名字
                           }
                       }
                       jQuery("#game"+num, top.frames["main"].document).html(name);
                       jQuery("#areanum" + num, top.frames["main"].document).val(name);//传值到名称
                       jQuery("#propinfo" + num, top.frames["main"].document).val(sid);//传值到父页面
                       parent.box.close();//关闭子窗口
                   }
                   function SetDate() {
                       var today = new Date();
                       if ($("#Span1").is(":hidden")) {
                           $("#Span1").show();
                           $('#<%=TextBox2.ClientID%>').val(today.getFullYear() + '-' + (today.getMonth() + 1) + '-01');
                           $('#<%=TextBox3.ClientID%>').val(today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate());
                       }
                       else {
                           $("#Span1").hide();
                           $('#<%=TextBox2.ClientID%>').val('');
                           $('#<%=TextBox3.ClientID%>').val('');
                       }
                   }
                   function keyWordFocus() {
                       if (jQuery("#<%=this.TextBox1.ClientID %>").val() == '请输入关键字！') {
                           jQuery("#<%=this.TextBox1.ClientID %>").val('');
                       }
                   }
                   function keyWordBlur() {
                       if (jQuery("#<%=this.TextBox1.ClientID %>").val() == '') {
                           jQuery("#<%=this.TextBox1.ClientID %>").val('请输入关键字！');
                       }
                   }
                    </script>
             <input type="button" value="绑定游戏库" class="button" onclick="getgameids('<%=KSCMS.S("bianhao")%>')" />
             
             <div class="quickSearch"> 
                 <asp:DropDownList ID="DropDownList1" runat="server">
                    <asp:ListItem Value="0">名称</asp:ListItem>
                    <asp:ListItem Value="1">ID</asp:ListItem>
                </asp:DropDownList>
                <asp:TextBox onfocus="keyWordFocus();" onblur="keyWordBlur();" Style="color: #ccc" Text="请输入关键字！" CssClass="textbox" ID="TextBox1" runat="server" Width="180px"></asp:TextBox>
                <span onclick="SetDate()" class="link-color" style="cursor: pointer">日期范围？</span>
                    <span id="Span1" <%if (this.TextBox2.Text == "")
                                      { %> style="display: none" <%} %>>
                    <asp:TextBox ID="TextBox2" placeholder="格式：YYYY-MM-DD" Width="150px" runat="server" onclick="WdatePicker({dateFmt:&#39;yyyy-MM-dd&#39;});" CssClass="textbox Wdate"></asp:TextBox>至
                   <asp:TextBox ID="TextBox3" placeholder="格式：YYYY-MM-DD" Width="150px" runat="server" onclick="WdatePicker({dateFmt:&#39;yyyy-MM-dd&#39;});" CssClass="textbox Wdate"></asp:TextBox>
                </span>
                    <asp:Button ID="Button1" runat="server" CssClass="button" Text="开始搜索" OnClick="search_Click" />
                    </div>
             <asp:Repeater ID="gameRepeater1" runat="server">
                  <HeaderTemplate>
                    <table width="100%"border="0" cellpadding="1" cellspacing="1" class="CTable">
                    <tr class="CTitle">
                        <td style="text-align:center">编号</td>
                        <td style="text-align:center">游戏库名名称</td>
                        <td style="text-align:center">添加时间</td>
                    </tr>
                </HeaderTemplate>
                <ItemTemplate>
                    <tr>
                        <td style="text-align:center;width:50px"><input type="radio" name="ids" value="<%#Eval("id") %>" <%# KSCMS.S("action")!="save"?checkinfo(Utils.StrToInt(KSCMS.S("courseid")),Utils.StrToInt(KSCMS.S("bianhao")),Utils.StrToInt(Eval("id"))):"" %>/><%#Eval("id") %></td>
                        <td style="text-align:left"><input type="hidden" name="name" value="<%#Eval("acname") %>" /><%#Eval("acname") %></td>
                        <td style="text-align:center"><%#Eval("adddate") %></td>
                    </tr>
                </ItemTemplate>
                <FooterTemplate>
                    <tr style="display:<%=this.gameRepeater1.Items.Count>0?"none":""%>">
                        <td colspan="3"> 
                            <div class="empty">暂无信息</div>
                        </td>
                    </tr>
                    </table>
                </FooterTemplate>
             </asp:Repeater>
              <%} %>
             <KS:Page ID="Page1" runat="server" />
         </div>
    </div>
    </form>
</body>
</html>
