<%@ Page Language="C#" AutoEventWireup="true" CodeFile="XReport_Box.aspx.cs" Inherits="System_XReport_XReport_Box" ValidateRequest="false"%>

<!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="../../Styles/WebSite.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../../Scripts/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="../../Scripts/asyncbox/asyncbox.v1.5.beta.min.js"></script>
    <script type="text/javascript" src="../../Scripts/WebSite.js"></script>

    <style type="text/css">
        body {
            font-family:"微软雅黑";margin:0px;
        }
        #div_box
        {
            border:solid 0px red;
        }
        .caption {
            text-align:left;
            width:100px;
        }
        .txt {
            width:127px;
            height:18px;
            border:solid 1px #ccc;
	        border-radius: 2px;/*圆角效果*/
	        box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);/*阴影效果*/
        }
        .tbx {
            width:98%;
        }
        #current_script {
            margin-top:4px;
        }
        #main_info {
            margin-top:4px;
        }
        #cbl_filters label{
            margin-right:10px;
        }
    </style>
    <script type="text/javascript">
        window.onload = function () {
            var msg = "<%=xview["msg"]%>";
            var action = "<%=action%>";
            if (msg != "") {
                if (msg == "save_success") {
                    asyncbox.success("保存成功！", "提示", function (buttonResult) {
                        if (action == "Add") {
                            var f_t = parent.document.getElementById("frame_tree");
                            f_t.src = f_t.src;
                            window.location = "XReport_Box.aspx?module_code=" + $F("module_code").value;
                        }
                    });
                } else if (msg == "delete_success") {
                    asyncbox.success("删除成功！", "提示", function (buttonResult) {
                            var f_t = parent.document.getElementById("frame_tree");
                            f_t.src = f_t.src;
                            window.location = "XReport_Box.aspx?module_code=";
                    });
                } else {
                    AlertNO(msg);
                }
            }
        };
        //删除
        function delete_report() {
            asyncbox.confirm('确定要删除此报表吗', '警告', function (buttonResult) {
                if (buttonResult == "ok") {
                    ShowLoadingMask(); //显示遮罩
                    $F("btn_delete").click();
                }
            });
        }
        function check_save() {
            ShowLoadingMask(); //显示遮罩
            $F("btn_save").click();
            
        }
        function select_scripts() {
            var scripts = $F("scripts");
            $F("div_html").style.display = "none";
            $F("div_temp_sql").style.display = "none";
            $F("div_report_sql").style.display = "none";

            $F(scripts.value).style.display = "";
        }
        function view_report() {
            var module_code = $("#module_code").val();
            var module_name = $("#module_name").val();
            var url = "../../System/XReport/ViewReport.aspx?module_code=" + $("#module_code").val() + "&to_debug=" + $('#to_debug').val();
            top.OpenWindow('Activate', 'System_XReport_ViewReport_' + module_code, '预览-' + module_name, url);
            
        }
    </script>
</head>
<body style="overflow:auto;">
    <form id="form1" runat="server">
    <div id='div_box'>
        <div id="main_info">
            <asp:HiddenField ID="xr_id" runat="server" />
            模块编码：<asp:TextBox ID="module_code" CssClass="txt" runat="server" style="width:187px"></asp:TextBox>
            报表名称：<asp:TextBox ID="module_name" CssClass="txt" runat="server" style="width:135px"></asp:TextBox>
            <select class="txt" style="width:100px" id="scripts" onchange="select_scripts()">
                <option value="div_html">HTML脚本</option>
                <option value="div_temp_sql">临时表SQL</option>
                <option value="div_report_sql" selected>报表SQL</option>
            </select>
            <select class="txt" style="width:100px" id="to_debug">
                <option value="0">正常访问</option>
                <option value="1">调试SQL</option>
            </select>
            <asp:Button runat="server" Text="真的保存" id="btn_save" style="display:none" OnClick="btn_save_Click"/>
            <asp:Button runat="server" Text="真的删除" id="btn_delete" style="display:none" OnClick="btn_delete_Click"/>
            <input type="button" value="保存" id="btn_check" class="SiteButton" onclick="check_save()"/>
            <input type="button" value="预览" id="btn_preview" class="SiteButton" onclick="view_report()"/>
            <input type="button" value="删除" id="btn_delete" class="SiteButton" onclick="delete_report()"/>
        </div>
        <div>
        <div id="current_script">
            <div id="div_html" style="display:none">
                <asp:TextBox runat="server" ID="html" CssClass="txt" TextMode="MultiLine" style="width:800px;height:300px;"></asp:TextBox>
            </div>
            <div id="div_temp_sql" style="display:none">
                <asp:TextBox runat="server" ID="temp_sql" CssClass="txt" TextMode="MultiLine" style="width:800px;height:300px;"></asp:TextBox>
            </div>
            <div id="div_report_sql">
                <asp:TextBox runat="server" ID="report_sql" CssClass="txt" TextMode="MultiLine" style="width:800px;height:300px;"></asp:TextBox>
            </div>
        </div>
        <div id="define_area">
            列标题：<asp:TextBox ID="column_names" CssClass="txt" runat="server" style="width:752px;margin-top:4px;"></asp:TextBox><br />
            关键字：<asp:TextBox ID="keywords" CssClass="txt" runat="server" style="width:500px;margin-top:4px;"></asp:TextBox>
            排序字段：<asp:TextBox ID="order_field" CssClass="txt" runat="server" style="width:185px;margin-top:4px;"></asp:TextBox>
            <div style="margin-top:4px;">
                日期控件1：<asp:TextBox ID="date1" CssClass="txt" runat="server"></asp:TextBox>
                日期控件2：<asp:TextBox ID="date2" CssClass="txt" runat="server"></asp:TextBox>
                文本控件1：<asp:TextBox ID="textbox1" CssClass="txt" runat="server" style="width:128px;"></asp:TextBox>
                文本控件2：<asp:TextBox ID="textbox2" CssClass="txt" runat="server" style="width:128px;"></asp:TextBox>
            </div>
        </div>
        <div id="filters_area" style="margin-top:4px;">
            <asp:CheckBoxList ID="cbl_filters" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow"></asp:CheckBoxList>
        </div>
    </div>
    </form>
</body>
</html>
