<%@ Page Language="C#" enableEventValidation="false" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" Inherits="Kesion.NET.WebSite.Admin.Exam.Admin_InportFromWord" Title="试卷管理" Codebehind="KS.InportFromWord.aspx.cs" %>
<%@ Import Namespace="Kesion.Cache" %>
<%@ Import Namespace="Kesion.Publics" %>
<asp:Content ID="Content1" ContentPlaceHolderID="KSContent" Runat="Server">
<div class="content-area mt20">  
    <asp:Panel ID="ProcessPanel" runat="server" Visible="false">
        <!--<KS:TopNav ID="TopNav2" runat="server" Text="试题导入情况" />-->
        <table cellpadding="1" width="99%" cellspacing="1"class="CTable" border="0"> 
           <%=importInfo %>   
		</table>
        <div style="margin-top:20px;text-align:center">
        	成功导入了<font color=red><%=succNum %></font>道试题。
        	<input type="button" onclick="location.href='KS.SJTK.aspx'" class="button" value="查看题库" />
        </div>
    </asp:Panel>
     
    <asp:Panel ID="AddPanel" runat="server"  Width="100%" >
        <!--<KS:TopNav ID="TopNav1" runat="server" Text="从WORD导入试题到题库" />-->
        
        <div class="tab-page" id="sjfromword">
          <script type="text/javascript">
               var tabPane1 = new WebFXTabPane( document.getElementById( "sjfromword" ), 1 )
          </script>   
          <div class="tab-page" id="tab0">
                <h2 class="tab">基本信息</h2>
                <script type="text/javascript">
                    tabPane1.addTabPage( document.getElementById( "tab0" ) );
                </script>
                <table width="100%" border="0" cellpadding="1" cellspacing="1" class="CTable no-borderTable"> 
                    <tr>
                        <td align="right" class="lefttd" height="30" style="width: 102px"><strong>试题分类：</strong></td>
                        <td class="righttd">
                            <asp:DropDownList ID="DrpClassID" runat="server" >
                                <asp:ListItem Value="0">--选择试题分类--</asp:ListItem>
                            </asp:DropDownList>
            
                            所属知识点：<asp:DropDownList ID="DrpKnowLedge" runat="server">
                            <asp:ListItem Value="0">--选择知识点--</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td class="lefttd" height="30" align="right"><b>所属章节：</b></td>
                        <td class="righttd">
                            <asp:DropDownList ID="drpSJtypeClass" runat="server" >
                            	<asp:ListItem Value="0">-选择章节-</asp:ListItem>
                            </asp:DropDownList> 该题目不属于任何章节可不选             
                        </td>
                    </tr>     
            
                    <tr>
                        <td align="right" class="lefttd" height="30" style="width: 102px"><strong>试题设置：</strong></td>
                        <td class="righttd">
                            每题分数：
                            <asp:TextBox ID="txtTMScore" style="text-align:center" value="1" runat="server" Width="50px" CssClass="textbox"></asp:TextBox>
                            题目难度：
                            <select name="Difficulty" id="Difficulty" runat="server">
                                <option value="0">易</option>
                                <option value="1">中</option>
                                <option value="2">难</option>
                            </select>
                         </td>
                    </tr>
                    <tr class="fromWordFile" id="inprotClass">
                        <td align="right" class="lefttd" height="30" ><strong>从Word文件导入：</strong></td>
                        <td class="righttd"><table border="0" cellpadding="0" cellspacing="0">
                             <tr>
                              <td width="150" style="padding-left:2px"><iframe src="../include/UpLoad.aspx?FieldID=doc&ChannelID=1"  marginheight="0" marginwidth="0"  width="100%" height="34" frameborder="0" scrolling="no"></iframe></td>
                              <td><a href="../../admin/exam/word题库示例.doc" style="color:green">下载Word示例格式</a></td>
                             </tr>
                            </table>
                            <input type="text" style="display:inline;position:absolute; left:-9999px;" id="doc" value="0"  />
                        </td>
                    </tr>
            
                    <tr>
                        <td align="right" class="lefttd" height="30" style="width: 102px"><strong>试题详情：</strong><br /><input type="button" class="button" value="存Word图片" onclick="KesionJS.saveWordPic('admin','');" /></td>
                        <td class="righttd">
                            <asp:TextBox ID="TxtIntro" runat="server" style="width:98%;height:300px;" TextMode="MultiLine"></asp:TextBox>
                            <%
                                  Kesion.APPCode.EditorAPI.EchoEditor("editor", TxtIntro.ClientID, "Common", 0, false, true,false,false,true);    
                            %> 
                        </td>
                    </tr>
                </table>
          </div>
          <div class="tab-page" id="tab2" >
                <h2 class="tab" >导入说明</h2>
                <script type="text/javascript">
                    tabPane1.addTabPage(document.getElementById("tab2"));
                </script>
                <table style="width:100%;margin:0 auto;" cellpadding="2" cellspacing="1" class="CTable">
                    <tr>
                         <td align="right" class="lefttd" height="30" style="width: 152px"><strong>导入出错解决方法：</strong></td>
                         <td class="righttd">
                        <pre>
                        <strong>解决方法一:</strong>
                        1.控制面板－》管理工具－》组件服务－》计算机－》我的电脑－》DCom配置－》找到Microsoft Word文档
                        之后
                        单击属性打开此应用程序的属性对话框。  
                        2. 单击标识选项卡，然后选择交互式用户。 
                        3.单击"安全"选项卡,分别在"启动和激活权限"和"访问权限"组中选中"自定义",然后
                        自定义->编辑->添加ASP.NET账户和IUSER_计算机名
                         Tips:这些帐户仅在计算机上安装有 IIS 的情况下才存在。 
                        4. 确保允许每个用户访问，然后单击确定。 
                        5. 单击确定关闭 DCOMCNFG。
                        
                        <strong>解决方法二:</strong>
                        如果上述方法不能解决问题,就应该是权限问题,请尝试用下面的方法:
                        在web.config中使用身份模拟,在<system.web>节中加入 
                         &lt;identity impersonate="true" userName="你的用户名" password="密码"/&gt;
                        </pre>
                         </td>
                    </tr>
                </table>
          </div>
        </div>
        <asp:Label ID="labsjinfo" runat="server"></asp:Label>
        <div style="clear:both;text-align:center">
            <KS:Foot ID="Foot1" runat="server" OnSubmit="Foot1_Submit" />
        </div>
    </asp:Panel>
    <script type="text/javascript">
             function CheckForm() {
              if (jQuery("#<%=this.DrpClassID.ClientID %> option:selected").val() == "0") {
                  KesionJS.Alert("请选择要导入的分类！", "");
                  return false;
                 }
              return true;
              }
            function getKnowLedge(classid) {
                jQuery.get("KS.SjAjax.ashx", { action: "sjtypeclass", classid: classid }, function (v) {
                 
                    jQuery("#<%=this.drpSJtypeClass.ClientID %>").empty().append("<option value='0'>--选择章节</option>").append(v);
                    });
                  jQuery.get("KS.SjAjax.ashx", { action: "getknowledge", classid: classid }, function (v) {
                      jQuery("#<%=this.DrpKnowLedge.ClientID %>").empty().append("<option value='0'>--选择知识点--</option>").append(v);
                  });
              }
            jQuery(function(){
                var ie = !-[1,];  
                var evs="focus";
                if (ie) evs="propertychange";

                jQuery('#inprotClass,#doc').bind(evs, function(){
                    var path = jQuery("#doc").val();
                    if(path == 0)
                    {
                        return;
                    }
                    //KesionJS.Alert(path);
                    jQuery.ajax({
                        type: "POST",
                        url: "InportFromWord.ashx",
                        data: "path="+path,
                        success: function(s){
                            if(s.substring(0,3) == "err" && s.indexOf("找不到此文件")==-1)
                            {
                                jQuery.dialog.alert(s);
                                return;
                            }
                            editor.setContent(s);
                        }
                    });
                });

            });
            
    </script>
 </div>   
</asp:Content>
