<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="knowledgelistAddandEdit.aspx.cs"
    Inherits="HySoft.BaseCallCenter.Web.knowledgemanage.knowledgelistAddandEdit" %>

<!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></title>
    <link href="../scripts/ui/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
    <link href="../images/style.css" rel="stylesheet" type="text/css" />
    <script src="../scripts/jquery/jquery-1.8.3.min.js" type="text/javascript"></script>
    <script src="../scripts/ui/js/ligerui.min.js" type="text/javascript"></script>
    <script src="../editor/kindeditor-min.js" type="text/javascript"></script>
    <script src="../editor/lang/zh_CN.js" type="text/javascript"></script>
    <script type="text/javascript">
        var treelist = null;
        $(function () {
            treelist = $("#dropF_Category").ligerComboBox({
                width: 130,
                selectBoxWidth: 200,
                selectBoxHeight: 150, valueField: 'id', resize: false, treeLeafOnly: false,
                tree: {
                    url: 'ajax/knowledge.ashx?action=gettreelist',
                    width: 200,
                    height: 150,
                    checkbox: false,
                    ajaxType: 'get',
                    onSuccess: function (data) { SetTreeValue(); }
                }
            });
            var editor = KindEditor.create('textarea[name="txtContent"]', {
                resizeType: 1,
                //uploadJson: '../../tools/upload_ajax.ashx?action=EditorFile&IsWater=1',
                //fileManagerJson: '../../tools/upload_ajax.ashx?action=ManagerFile',
                allowFileManager: true
            });
        });
        function SetTreeValue() {
            try {
                treelist.setValue(document.getElementById("txtF_ParentId").value);
                if (document.getElementById("txtF_ParentId").value == "" || document.getElementById("txtF_ParentId").value == "0") {
                    treelist.setText("顶级分类");
                }
            }
            catch (e) {

            }
        }
        function validatelogin_name() {
            document.getElementById("txtF_ParentId").value = treelist.getValue();
            if ($("#txtF_ParentId").val() == "") {
                document.getElementById("lbParent").innerHTML = "* 不允许为空！";
                document.getElementById("lbParent").style.color = "red";
                $.ligerDialog.error('所属分类不允许为空');
                return false;
            }
            else {
                document.getElementById("lbParent").innerHTML = "*";
                document.getElementById("lbParent").style.color = "#414141";
            }
            if ($("#txtTitle").val() == "") {
                document.getElementById("lblTitle").innerHTML = "* 不允许为空！";
                document.getElementById("lblTitle").style.color = "red";
                $.ligerDialog.error('标题不允许为空');
                return false;
            }
            else {
                document.getElementById("lblTitle").innerHTML = "*";
                document.getElementById("lblTitle").style.color = "#414141";
                return true;
            }
            if ($("#txtContent").val() == "") {
                document.getElementById("lblContent").innerHTML = "* 不允许为空！";
                document.getElementById("lblContent").style.color = "red";
                $.ligerDialog.error('内容不允许为空');
                return false;
            }
            else {
                document.getElementById("lblContent").innerHTML = "*";
                document.getElementById("lblContent").style.color = "#414141";
                return true;
            }
        }
        function validate() {
            var i = 0;
            if (!validatelogin_name()) {
                i++;
            }
            if (i > 0) {
                return false;
            }
            return true;
        }
        function CloseThis() {
            var dialog = frameElement.dialog;
            parent.LoadList();
            dialog.close();
        }
        function SaveInfo(res) {
            switch (res) {
                case 'success':
                    $.ligerDialog.success('保存成功', function (yes) { CloseThis(); });
                    break;
                case 'warn':
                    $.ligerDialog.error('保存失败，请确认数据正确性');
                    break;
                case 'error':
                    $.ligerDialog.error('系统错误，请联系开发商');
                    break;
                default:
                    break;
            }
        }
    </script>
</head>
<body class="mainbody" style="margin-top: 0px;">
    <form id="form1" runat="server">
    <div id="contentTab">
        <div class="tab_con" style="display: block;">
            <table class="form_table">
                <col width="100px" />
                <col />
                <tbody>
                    <tr>
                        <th>
                            所属分类：<asp:HiddenField ID="txtF_ParentId" Value="" runat="server" />
                            <asp:HiddenField ID="txtF_CategoryId" Value="" runat="server" />
                            <asp:HiddenField ID="txtF_RepositoryId" Value="" runat="server" />
                        </th>
                        <td>
                            <div style="float: left;">
                                <asp:TextBox ID="dropF_Category" runat="server"></asp:TextBox></div>
                            <div style="float: left;">
                                <label id="lbParent" for="txtF_CategoryId">
                                    *</label></div>
                        </td>
                    </tr>
                    <tr>
                        <th>
                            标题：
                        </th>
                        <td>
                            <asp:TextBox ID="txtTitle" runat="server" CssClass="txtInput normal" MaxLength="255"></asp:TextBox>
                            <label id="lblTitle" for="txtTitle">
                                *</label>
                        </td>
                    </tr>
                    <tr>
                        <th>
                            关键字：
                        </th>
                        <td>
                            <asp:TextBox ID="txtKeyWords" runat="server" CssClass="txtInput normal" MaxLength="255"></asp:TextBox><label>关键字</label>
                        </td>
                    </tr>
                    <tr style="display:none">
                        <th>
                            描述：
                        </th>
                        <td>
                            <asp:TextBox ID="txtF_Description" runat="server" CssClass="txtInput normal" MaxLength="255"></asp:TextBox><label>描述</label>
                        </td>
                    </tr>
                    <tr>
                        <th valign="top">
                            内容：
                        </th>
                        <td>
                            <textarea id="txtContent" cols="100" rows="8" style="width: 99%; height: 575px; visibility: hidden;"
                                runat="server"></textarea>
                            <label id="lblContent" for="txtContent">
                                *</label>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div class="foot_btn_box">
            <asp:Button ID="btnSubmit" runat="server" Text="保&nbsp;&nbsp;存" CssClass="btnSubmit"
                OnClientClick="return validate();" OnClick="btnSubmit_Click" />
        </div>
    </div>
    </form>
</body>
</html>
