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

<!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("Certificate_management")%></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/jquery.form.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/Validator/JValidator.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/artDialog/artDialog.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/artDialog/iframeTools.source.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/FunctionJS.js" type="text/javascript"></script>
    <style type="text/css">
        .formImg { position: relative; top: -355px; left: 603px; }
        .coverName { height: 110px; width: 150px; margin-top: 30px; }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <table id="tablebody" border="0" cellpadding="0" cellspacing="0" class="frm">
        <tr>
            <th style="width: 80px;">
                <span style="color: Red;">*</span><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Certificate_management")%>:
            </th>
            <td>
                <input id="Certificate_Name" runat="server" maxlength="40" type="text" class="txt"
                    datacol="yes" err="证书名称" checkexpession="NotNull" style="width: 200px" />
            </td>
            <th>
                <span style="color: Red;">*</span><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Certificate_classification")%>:
            </th>
            <td>
                <select id="Certificate_TypeId" class="select" runat="server" style="width: 206px;">
                </select>
            </td>
        </tr>
        <tr>
            <th style="width: 80px;">
                <span style="color: Red;">*</span><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Certificate_Authority")%>:
            </th>
            <td>
                <input id="Certificate_Orgran" runat="server" maxlength="40" type="text" class="txt"
                    datacol="yes" err="颁发机构" checkexpession="NotNull" style="width: 200px" />
            </td>
            <th>
                <span style="color: Red;">*</span><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Certificate_Level")%>:
            </th>
            <td>
                <input id="Certificate_Level" runat="server" type="text" maxlength="40" class="txt"
                    datacol="yes" err="证书级别" checkexpession="NotNull" style="width: 200px" />
            </td>
        </tr>
        <tr>
            <th style="width: 80px;">
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Certificate_Icon")%>:
            </th>
            <td>
                <img id="Img_Menu_Img" alt="" style="vertical-align: middle; padding-right: 10px;"
                    src="/Themes/Images/32/128.png" runat="server">
                <a class="button green" onclick="SelectOpenImg()" href="javascript:void(0)"><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Certificate_take all")%></a>
                <input type="hidden" value="128.png" id="Certificate_Icon" runat="server" />
            </td>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Certificate_casing")%>:
            </th>
            <td>
                <img src="/Training/Certificate/Images/certTemplent.gif" alt="" id="converImg" class="coverName"
                    runat="server" />
                <input type="hidden" id="Certificate_Bg" runat="server" />
            </td>
        </tr>
        <tr>
        <th>  <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("ModelStyle")%>:</th>
        <td>
        <select id="Model" runat="server">
        <option value="default">默认样式</option>
        <option value="Filemode">档案样式</option>
        </select>
        </td>
        </tr>
        <tr>
            <th>
                <span style="color: Red;">*</span><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Certificate_template")%>:
            </th>
            <td colspan="3">
      
                <textarea id="Certificate_Templent" class="txtRemark" runat="server" style="width: 687px;
                    height: 80px;" datacol="yes" err='证书模板' checkexpession="NotNull"></textarea>
            </td>
        </tr>
        <tr>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Certificate_Remarks")%>:
            </th>
            <td colspan="3">
                <textarea id="Certificate_Remark" class="txtRemark" runat="server" style="width: 687px;
                 height: 80px;"></textarea>
            </td>
        </tr>
    </table>
    
    <div class="frmbottom">
        <asp:LinkButton ID="Save" runat="server" class="l-btn" OnClientClick="return saveForm();"
            OnClick="Save_Click"><span class="l-btn-left">
            <img src="/Themes/Images/disk.png" alt="" /><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Save")%></span></asp:LinkButton>
        <a class="l-btn" href="javascript:void(0)" onclick="OpenClose();"><span class="l-btn-left">
            <img src="/Themes/Images/cancel.png" alt="" /><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Close")%></span></a>
    </div>
    </form>
    <form id="formImg" method="post" action="" class="formImg" enctype="multipart/form-data">
    <input id="uploadImg" runat="server" class="imgFile" type="file" name="uploadImg" />
    </form>
    <script type="text/javascript">
        function saveForm() {
            if (!CheckDataValid('#form1')) return false;
            return true;
        }
        //选取系统图标
        function SelectOpenImg() {
            var url = "/RMBase/SysMenu/Icons_List.aspx?Size=32";
            top.openDialog(url, 'Icons_List', '<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Button_Form_tubiao")%>', 615, 400, 100, 100);
        }
        //选取图标
        function Get_Menu_Img(img) {
            $("#Img_Menu_Img").attr("src", '/Themes/Images/32/' + img);
            document.getElementById('Certificate_Icon').value = img;
        }
        $(function () {
            document.getElementById('uploadImg').onchange = function () {
                //上传图片
                var fileName = $(this).val(); //文件名
                if (fileName.length < 1) {//不合法
                    showTipsMsg("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("upload_pictures")%>", 2000, 3);
                } else {
                    var extension = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length).toLowerCase(); //获取扩展名
                    if (extension == "bmp" || extension == "jpg" || extension == "jpge" || extension == "gif") {//合法
                        $("#formImg").ajaxSubmit({
                            type: "post",
                            url: "UploadImg.ashx",
                            success: function (data) {
                                if (data) {
                                    switch (data) {
                                        case "1":
                                            showTipsMsg("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("File_not")%>", 2000, 3);
                                            return;
                                        case "2":
                                            showTipsMsg("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("File_size")%>", 2000, 3);
                                            return;
                                        case "3":
                                            showTipsMsg("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("File_format")%>", 2000, 3);
                                            return;
                                        case "4":
                                            showTipsMsg("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Abnormal network connection")%>", 2000, 5);
                                            return;
                                        default:
                                            //插入图片
                                            $("#converImg").attr('src', '/Resources/Certificate/' + data); //给图片赋值
                                            $("#Certificate_Bg").val(data); //给隐藏域赋值
                                            break;
                                    }
                                } else {
                                    showTipsMsg("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Abnormal network connection")%>", 3000, 5);
                                }
                            }
                        });
                    } else {
                        showTipsMsg("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("File_format")%>", 2000, 3);
                    }
                }

            };
        });
    </script>
</body>
</html>
