<%@ Page Title="" Language="C#" MasterPageFile="~/Dialog/DialogMaster.Master" AutoEventWireup="true"
    CodeBehind="KnowledgeEdit.aspx.cs" Inherits="OAWeb.Knowledge.KnowledgeEdit" ValidateRequest="false" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script language="javascript" type="text/javascript" src='<%=ResolveUrl("~/ckeditor/ckeditor.js")%>'></script>
    <div class="form" style="width: 600px;height:480px; padding: 10px;">
        <table cellpadding="0" cellspacing="0" border="0" class="table_form">
            <tr>
                <td class="right">
                    <span class="red">*</span> 标题：
                </td>
                <td>
                    <asp:TextBox ID="txtTitle" runat="server" CssClass="text width200" MaxLength="50"></asp:TextBox>
                    &nbsp;<asp:CheckBox ID="chkQA" Text="是否QA" runat="server" />
                </td>
            </tr>
            <tr>
                <td class="right">
                    <span class="red">*</span> 分类：
                </td>
                <td>
                    <asp:DropDownList ID="ddlTypeId" runat="server">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="right">
                    <span class="red">*</span> 内容：
                </td>
                <td>
                    <asp:TextBox ID="txtContent" runat="server" CssClass="text" Width="99%" Height="200px"
                        TextMode="MultiLine"></asp:TextBox>
                    <script type="text/javascript">
                        CKEDITOR.replace('<%=txtContent.ClientID %>',
                    {
                        skin: 'v2',
                        width: '98%',
                        height: '239',
                        font_names: '宋体/宋体;黑体/黑体;仿宋/仿宋_GB2312;楷体/楷体_GB2312;隶书/隶书;幼圆/幼圆;微软雅黑/微软雅黑;',
                        toolbar: [
                        ['Bold', 'Italic', 'Underline', 'Strike', '-', 'NumberedList', 'BulletedList', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'Link', 'Unlink', 'Anchor', '-', 'Table', 'HorizontalRule', 'SpecialChar'],
                        ['Format', 'Font', 'FontSize', 'TextColor', 'BGColor']
                        ],
                        language: 'zh-cn'
                    })
                   
                    </script>
                </td>
            </tr>
            <tr>
                <td class="right">
                    备注：
                </td>
                <td>
                    <asp:TextBox ID="txtRemark" runat="server" CssClass="text" Width="99%" MaxLength="50"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                    <input id="btnSave" type="button" value=" 保 存 " class="btn_77px" />
                    <input id="btnClose" type="button" value=" 返 回 " onclick="art.dialog.close();return false;"
                        class="btn_77px" />
                </td>
            </tr>
        </table>
    </div>
    <script type="text/javascript">
        $(document).ready(function () {

            rulesValue = { '<%=txtTitle.UniqueID %>': { required: true }, '<%=ddlTypeId.UniqueID %>': { required: true }, '<%=txtContent.UniqueID %>': { required: true} };
            messagesValue = { '<%=txtTitle.UniqueID %>': { required: "请输入标题" }, '<%=ddlTypeId.UniqueID %>': { required: "请选择分类" }, '<%=txtContent.UniqueID %>': { required: "请输入内容"} }
            var form = jQuery.validator.ValidateForm($("#aspnetForm"), rulesValue, messagesValue);
            $("#btnSave").click(function () {
                //把编辑值赋值到实际文本框，编辑器只在有post动作时才把值赋值给实际文本框。
                CKEDITOR.instances.<%=txtContent.ClientID %>.updateElement(); 
                if (form.form()) {
                    $("#aspnetForm").ajaxSubmit({
                        url: "/Knowledge/KnowledgeEdit.aspx?op=Save&Id=<%=Id %>",
                        success: function (result) {
                            if (result == "ok") {
                                alert("保存成功");
                                CloseReload();
                            } else {
                                alert(result);
                            }
                        }
                    });
                }
                return false;
            })
        });
    </script>
</asp:Content>
