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

<!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>问卷设置</title>
    <link href="../scripts/ui/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
    <script src="../scripts/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script src="../scripts/jquery/jquery-1.8.3.min.js" type="text/javascript"></script>
    <script src="../scripts/ui/js/core/base.js" type="text/javascript"></script>
    <script src="../scripts/ui/js/ligerui.min.js" type="text/javascript"></script>
    <link href="../scripts/ui/skins/Tab/css/tab.css" rel="stylesheet" type="text/css" />
    <link href="../scripts/ui/skins/Tab/css/grid.css" rel="stylesheet" type="text/css" />
    <script src="../scripts/ui/js/plugins/ligerGrid.js" type="text/javascript"></script>
    <script src="../scripts/ui/js/plugins/ligerLayout.js" type="text/javascript"></script>
    <script src="../scripts/ui/js/plugins/ligerTree.js" type="text/javascript"></script>
    <script src="../scripts/ui/js/plugins/ligerMenu.js" type="text/javascript"></script>
    <script src="../scripts/CustomersData.js" type="text/javascript"></script>
    <link href="../scripts/ui/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
    <script src="../scripts/My97DatePicker/lang/zh-cn.js" type="text/javascript"></script>
    <link href="../images/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        var selectpagerid = "";
        var pagerlist;
        var questionlist;
        function SaveRes() {
            document.getElementById("iframepager").style.display = "none";
            document.getElementById("divNull").style.display = "block";
            document.getElementById("iframepager").src = "";
            ZoomOpt();
            LoadPagerList();
        }
        function ShowPager(pagerid) {
            var vheight = $("#form1").height() - 30;
            var vwidth = $("#form1").width() * 0.9;
            if (vwidth > 700) {
                vwidth = 700;
            }
            $.ligerDialog.open({ url: 'pagerview.aspx?pagerid=' + pagerid, title: '预览问卷', height: vheight, width: vwidth, isResize: true
            });
        }
        function LoadPagerList() {
            var key = escape(document.getElementById("txtKeywords").value);
            pagerlist = $("#divPagerList").ligerGrid({
                height: '97%',
                width: 290,
                columns: [
                //{ display: 'Id', width: '0', name: '_f_pagerid',hide:'' },
                { display: '试卷名称', width: '200', name: '_f_title' },
                { display: '问题数量', width: '60', name: '_f_times', render: function (rowdata, rowindex, value) {
                        return "<font color='red'>"+value+"</font>";
                }
                },
                { display: '生成时间', width: '150', name: '_f_createon', type: 'date', format: 'yyyy-MM-dd hh:mm:ss' }
                ],
                toolbar: {
                    items: [
                    { text: '增加', click: itemclick1, icon: 'add' },
                    { line: true },
                    { text: '修改', click: itemclick1, icon: 'modify' },
                    { line: true },
                    { text: '删除', click: itemclick1, icon: 'delete' }
                    ]
                },
                url: 'ajax/pagerinfo.ashx?action=getlist&key=' + key, pageSize: 50, pageSizeOptions: [10, 20, 50], rownumbers: true,
                onSelectRow: function (data, rowindex, rowobj) {
                    document.getElementById("iframepager").style.display = "block";
                    document.getElementById("divNull").style.display = "none";
                    document.getElementById("iframepager").src = "pagerview.aspx?pagerid=" + data._f_pagerid;
                },
                onAfterShowData: function (data) {
                    var vheight = $("#divPagerList").height();
                    document.getElementById("divTree").style.height = vheight+46;
                }
            });
            $("#pageloading").hide();
        }
        function LoadPagerItemList() {
        }
        function itemclick1(item) {
            switch (item.icon) {
                case "add":
                    document.getElementById("divNull").style.display = "none";
                    document.getElementById("iframepager").style.display = "block";
                    zoomtype = "exit";
                    ZoomOpt();
                    document.getElementById("iframepager").src = "pageredit.aspx?otype=new";
                    break;
                case "modify":
                    var id = "";
                    var vtitle = "修改试题";
                    var rowobj;
                    try {
                        rowobj = pagerlist.getSelectedRow();
                        id = rowobj._f_pagerid;
                        vtitle = "【<font color='red'>" + rowobj._f_title + "</font>】修改问卷";
                    }
                    catch (e) {
                    }
                    if (id != "") {
                        document.getElementById("divNull").style.display = "none";
                        document.getElementById("iframepager").style.display = "block";
                        zoomtype = "exit";
                        ZoomOpt();
                        document.getElementById("iframepager").src = "pageredit.aspx?otype=modify&id="+id;
                    }
                    else {
                        $.ligerDialog.error('没有选择要修改的问卷，请选择');
                    }
                    break;
                case "delete":
                    document.getElementById("iframepager").style.display = "none";
                    document.getElementById("divNull").style.display = "block";
                    var id = "";
                    var rowobj;
                    try {
                        rowobj = pagerlist.getSelectedRow();
                        id = rowobj._f_pagerid;
                    }
                    catch (e) {
                    }
                    if (id != "") {
                        $.ligerDialog.confirm('确定要删除【<font color="red">' + rowobj._f_title + '</font>】问卷吗？', function (yes) {
                            if (yes) {
                                $.post("ajax/pagerinfo.ashx?action=delete&id=" + id, function (data) {
                                    if (data == "success") {
                                        $.ligerDialog.success('删除成功');
                                        LoadPagerList();
                                    }
                                    else {
                                        $.ligerDialog.error('删除失败');
                                    }
                                });
                            }
                        });
                    }
                    else {
                        $.ligerDialog.error('没有选择要删除的问卷，请选择');
                    }
                    break;
            }
        }
        var zoomtype = "exit";
        function ZoomOpt() {
            if (zoomtype == "full") {
                zoomtype = "exit";
            }
            else {
                zoomtype = "full";
            }
            ZoomPager(zoomtype);
        }
        function ZoomPager(type) {
            if (type == "full") {
                document.getElementById("spanZoom").innerHTML = "返回";
                document.getElementById("imgZoom").src = "../images/full_screen_exit_24.png";
                document.getElementById("tdLeft").style.display = "none";
            }
            else {
                document.getElementById("spanZoom").innerHTML = "放大";
                document.getElementById("imgZoom").src = "../images/full_screen_24.png";
                document.getElementById("tdLeft").style.display = "inline";
            }
            try {
                document.getElementById("iframepager").contentWindow.ResetWidth();
            }
            catch (e)
            { }
        }
        $(function () {
            LoadPagerList();
        });
        document.onkeydown = function (event) {
            var e = event || window.event || arguments.callee.caller.arguments[0];
            if (e && e.keyCode == 13) {
                LoadPagerList();
            }
        };
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <table id="tableMessage" cellpadding="3" cellspacing="3" border="0" style="width: 100%;">
        <tr>
            <td id="tdLeft" valign="top" style="width: 290px; 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-show-img.png" />&nbsp;试题问卷</div>
                    </div>
                </div>
                <div class="tools_box">
                    <asp:HiddenField ID="hdF_FunctionId" runat="server" />
                    <asp:HiddenField ID="hdF_ModuleId" runat="server" />
                    <div class="tools_bar">
                        <div class="search_box" style="float:left;">
                            关键字：<asp:TextBox ID="txtKeywords" runat="server" CssClass="txtInput"></asp:TextBox>&nbsp;&nbsp;
                            <input id="btnSearch" type="button" value="搜 索" class="btnSearch" onclick="LoadPagerList();" />
                        </div>
                    </div>
                </div>
                <div id="divPagerList">
                </div>
            </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-show-txt.png" />&nbsp;问卷信息</div>
                        <div style="float: right; cursor: hand; padding-top: 6px; padding-right: 10px; font-weight: bold;
                            color: blue;" onclick="ZoomOpt();">
                            <img id="imgZoom" src="../images/full_screen_24.png" style="width: 22px;" />&nbsp;<span
                                id="spanZoom">放大</span></div>
                    </div>
                </div>
                <table id="tableTree" cellpadding="0" cellspacing="0" style="width: 100%; background-color: White;
                    border: 1px solid #D6D6D6;">
                    <tr>
                        <td valign="top">
                            <div id="divTree" style="overflow: auto;">
                                <div id="divNull" style="text-align: center; width: 100%;">
                                    <br />
                                    <br />
                                    <br />
                                    <img src="../images/wjdc.jpg" /></div>
                                <iframe id="iframepager" name="iframepager" runat="server" scrolling="auto" frameborder="0"
                                    src="" style="display: none; width: 100%; height: 100%;"></iframe>
                            </div>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
