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

<!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("CS_AddShares_scgxwj")%></title>
   
    <link href="../../Themes/Scripts/uploadify/uploadify.css" rel="stylesheet" type="text/css" />
    <script src="/Themes/Scripts/jquery-1.8.2.min.js" type="text/javascript"></script>
    <link href="../Exam/Themes/Css/ExamGlobal.css" rel="stylesheet" type="text/css" />
    <script src="../../Themes/Scripts/uploadify/swfobject.js" type="text/javascript"></script>
    <script src="../../Themes/Scripts/uploadify/jquery.uploadify.min.js" type="text/javascript"></script>
    <link href="../../Themes/Scripts/ShowMsg/msgbox.css" rel="stylesheet" type="text/css" />
    <script src="../../Themes/Scripts/ShowMsg/msgbox.js" type="text/javascript"></script>
    <script src="../../Themes/Scripts/FunctionJS.js" type="text/javascript"></script>
    <style type="text/css">
        #pageContainer { width: 490px; padding: 5px; }
        #page_Title { text-align: center; }
        #page_Title h1 { font-size: 13pt; }
        #fileList { float: left; }
        #fileList label { display: inline-block; width: 70px; text-align: center; font-size: 9pt; word-break: break-all; /*支持IE，chrome，FF不支持*/ word-wrap: break-word; /*支持IE，chrome，FF*/ }
        .bottomBor { border-bottom: 1px solid #CCC; }
        #opraterContainer { float: right; overflow-y: scroll; height: 300px; }
        #linkContainer { padding-top: 20px; }
        .examLink { background: url("/Themes/Images/ExamButton.png") no-repeat; text-align: center; font-size: 11pt !important; padding: 5px 12px; font-size: 15px; color: #666; transition: none; }
        .examLink:hover { background-position: 0 -30px; color: #666; transition: none; }
        #contextContainer { padding: 10px 0; }
        #btnOK { background-position: 0 -60px; color: White; }
        #btnOK:hover { background-position: left bottom; }
        #file_upload { display: inline-block; position: relative; bottom: 2px; }
    </style>
    <script type="text/javascript">
        $(function () {
            var uN = "";
            if ($.browser.mozilla || $.browser.chrome) uN = $("#btnOK").attr("ffuser"); //ff下session丢失
            var key = QueryString("key");
            $("#file_upload").uploadify({
                //开启调试
                'formData': { "key": key, "uN": uN },
                'debug': false,
                //是否自动上传
                'auto': false,
                'buttonText': '<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("CoursewareType_Form_xzwj")%>',
                //flash
                'swf': "../../Themes/Scripts/uploadify/uploadify.swf",
                //文件选择后的容器ID
                'queueID': 'uploadfileQueue',
                'uploader': 'UpLoadShares.ashx',
                'width': '83',
                'height': '30',
                'fileTypeDesc': '<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("File_zcdgs")%>：',
                'fileTypeExts': '*.jpg;*.jpge;*.gif;*.png;*.rar;*.zip;*.doc;*.docx;*.wps;*.avi;*.chm;*.mp3;*.mp4;*.xls;*.xlsx;*.txt;*.pdf;*.ppt',
                'fileSizeLimit': '10MB',
                'removeTimeout': 1,
                'queueSizeLimit': 10,
                'preventCaching': true,
                'multi ': true,
                //返回一个错误，选择文件的时候触发
                'onSelectError': function (file, errorCode, errorMsg) {
                    switch (errorCode) {
                        case -100:
                            ZENG.msgbox.show("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("CoursewareType_Form_scdwjslyjccxtxzd")%>" + $('#file_upload').uploadify('settings', 'queueSizeLimit') + "<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("CoursewareType_Form_gwj")%>！", 3, 2000);
                            break;
                        case -110:
                            ZENG.msgbox.show("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("FileName")%> [" + file.name + "] <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("CoursewareType_Form_dxccxtxzd")%>" + $('#file_upload').uploadify('settings', 'fileSizeLimit') + "<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Size")%>！", 3, 2000);
                            break;
                        case -120:
                            ZENG.msgbox.show("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("FileName")%> [" + file.name + "] <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("File_SizeErr")%>！", 3, 2000);
                            break;
                        case -130:
                            ZENG.msgbox.show("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("FileName")%> [" + file.name + "] <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("File_TypeNot")%>！", 3, 2000);
                            break;
                    }
                },
                //检测FLASH失败调用
                'onFallback': function () {
                    ZENG.msgbox.show("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("File_NotFlasH")%>", 5, 2000);
                },
                //上传到服务器，服务器返回相应信息到data里
                'onUploadSuccess': function (file, data, response) {
                    switch (parseInt(data)) {
                        case 1:
                            $("#fileList").append('<li><label>' + file.name + '</label><label>' + (file.size / 1024 / 1024).toFixed(2) + '</label><label>' + file.type + '</label></li>');
                            break;
                        case -3:
                            ZENG.msgbox.show("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("FileName")%> [" + file.name + "] <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("File_TypeNot")%> ！", 5, 2000);
                            break;
                        case -2:
                            ZENG.msgbox.show("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("FileName")%> [" + file.name + "] <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("CoursewareType_Form_dxccxtxzd")%> " + $('#file_upload').uploadify('settings', 'fileSizeLimit') + "<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Size")%>！", 5, 2000);
                            break;
                        default:
                            ZENG.msgbox.show("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Abnormal network connection")%>", 5, 2000);
                            break;
                    }
                }
            });
        });

        function doUplaod() {
            $('#file_upload').uploadify('upload', '*');
        }

        function closeLoad() {
            $('#file_upload').uploadify('cancel', '*');
        }
        function closew() {
            top.main.windowload(); 
            OpenClose();
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div id="pageContainer">
        <div id="page_Title">
            <h1>
               <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("CS_AddShares_scgxwj")%> </h1>
        </div>
        <div id="opraterContainer">
            <div id="uploadfileQueue" style="padding: 3px;">
            </div>
        </div>
        <ul id="fileList">
            <li class="bottomBor">
                <label>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("FileName")%> </label>
                <label>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("FileSize")%> </label>
                <label>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("File_suffix")%> </label>
            </li>
        </ul>
        <div class="clear">
        </div>
        <div id="linkContainer">
            <div id="file_upload">
            </div>
            <a href="javascript:void(0)" class="examLink" id="btnOK" ffuser="" runat="server"
                onclick="doUplaod()"><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Start_upload")%> </a> <a href="javascript:void(0)" onclick="closeLoad()"
                    class="examLink"><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Clear_Close")%></a> <a href="javascript:void(0)" onclick="closew()" class="examLink"><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Close")%></a>
        </div>
    </div>
    </form>
</body>
</html>
