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

<!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>
    <script src="../scripts/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script src="../scripts/ui/js/ligerui.min.js" type="text/javascript"></script>
    <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" />
    <link href="../scripts/ui/skins/Tab/css/grid.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        var actionNodeID;
        var gridlist;
        var singleClick;
        var count = 0;
        var counts = 0;
        $(function () {
//            $("#layout1").ligerLayout({
//                leftWidth: 200,
//                allowCenterBottomResize: false
//            });
            try {
                var vheight = document.body.clientHeight;
                document.getElementById("tableMessage").style.height = vheight - 130;
                document.getElementById("divTree").style.height = vheight - 130;
            }
            catch (e)
            { }
            $("#tree1").ligerTree({
                nodeWidth: 135,
                checkbox: false,
                url: 'ajax/knowledge.ashx?action=gettreelist',
                onClick: function (node, e) {
                    actionNodeID = node.data.id;
                    LoadList();
                }
            });
            LoadList();
        });
        function getWhereStr() {
            var keyWords = "";
            if (document.getElementById("txtKeywords").value != "") {
                keyWords += document.getElementById("txtKeywords").value;
            }
            return keyWords;
        }
        function LoadList() {
            count += 1;
            counts = count;
            if (actionNodeID == undefined) {
                actionNodeID = "";
            }
            try {
                gridlist = $("#divDataList").ligerGrid({
                    height: '97%',
                    columns: [
                                { display: 'Id', name: '_f_repositoryid', width: '1%', hide: 'Id' },
                                { display: '标题', name: '_f_title', align: 'left', width: '20%' },
                                { display: '内容', name: '_f_description', align: 'left', width: '40%', render: cutContent },
                                { display: '关键字', name: '_f_keywords', width: '20%' },
                                { display: '创建时间', name: '_f_createon', width: '16%', type: 'date', format: 'yyyy-MM-dd hh:mm:ss' }
                             ],
                    url: 'ajax/knowledge.ashx?action=getKnowledgeList' + '&keyWords=' + getWhereStr() + '&categoryId=' + actionNodeID, pageSize: 10, rownumbers: true,
                    onSelectRow: function (data, rowindex, rowobj) {
                        singleClick = data._f_repositoryid;
                    },
                    onDblClickRow: function (data, rowindex, rowobj) {
                        if (count > 1) {
                            count -= 1;
                            return;
                        } else {
                            count = counts;
                            View();
                        }
                    },
                    onAfterShowData: function (data) {
                        var vheight = $("#divDataList").height();
                        document.getElementById("divTree").style.height = vheight;
                    }
                });
            }
            catch (e) {
                alert(e.Message);
            }
            gridlist.changePage('first');
            $("#pageloading").hide();
        }
        function cutContent(rowdata, index, value) {
            if (value.length < 20) return value;
            else return value.substr(0, 20) + "...";
        }
        function View() {
            if (singleClick == null || singleClick == undefined || singleClick == "") {
                alert("请选择查看行！");
            }
            else {
                var vheight = $("#form1").height();
                var vwidth = $("#form1").width();
                $.ligerDialog.open({ url: 'knowledgeview.aspx?action=view&singleFlage=' + singleClick, title: '查看知识库', height: vheight, width: vwidth, isResize: true
                });
            }
        }
        document.onkeydown = function (event) {
            var e = event || window.event || arguments.callee.caller.arguments[0];
            if (e && e.keyCode == 13) {
                LoadList();
            }
        };
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div class="tools_box">
        <div class="tools_bar">
        <a class="tools_btn" href="#" onclick="View();"><span><b>查看</b></span></a>
            <div class="search_box">
                搜索内容：<asp:TextBox ID="txtKeywords" runat="server" CssClass="txtInput"></asp:TextBox>&nbsp;&nbsp;
                <input id="btnSearch" type="button" value="搜 索" class="btnSearch" onclick="LoadList();" />
            </div>
        </div>
    </div>
    <table id="tableMessage" cellpadding="3" cellspacing="3" border="0" style="width: 100%;">
        <tr>
            <td valign="top" style="width: 230px; padding: 0px 2px 5px 2px;">
                <div class="tools_box" style="height: 30px;">
                    <div class="tools_bar">
                        <div style="float: left; padding-top: 6px; padding-left: 1px; font-weight: bold;
                            color: red;">
                            <img src="../images/icon_site.gif" />&nbsp;知识库分类</div>
                    </div>
                </div>
                <table id="tableTree" cellpadding="0" cellspacing="0" style="width: 100%; border: 1px solid #D6D6D6;">
                    <tr>
                        <td valign="top">
                            <div id="divTree" style="overflow: auto;">
                                <ul id="tree1">
                                    <li isexpand="false" id="-1"><span>知识库信息</span>
                                        <ul>
                                        </ul>
                                    </li>
                                </ul>
                            </div>
                        </td>
                    </tr>
                </table>
            </td>
            <td valign="top" style="padding: 0px 2px 5px 2px;">
                <div class="tools_box" style="height: 30px;">
                    <div class="tools_bar">
                        <div style="float: left; padding-top: 6px; padding-left: 1px; font-weight: bold;
                            color: red;">
                            <img src="../images/ico_16_2.gif" />&nbsp;知识库列表</div>
                    </div>
                </div>
                <div id="divDataList">
                </div>
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
