<%@ Page Language="c#" CodeBehind="PostReport.aspx.cs" AutoEventWireup="True" Inherits="MTCUN.Report.PostReport"
    Title="增加/修改报表-分析" ValidateRequest="false" %>

<%@ Import Namespace="MTCUN" %>
<%@ Register Src="../UserCol/CodeBox.ascx" TagName="CodeBox" TagPrefix="uc1" %>
<!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">
    <link id="linkStyle" runat="server" href="../Themes/Blue/css.css" rel="stylesheet"
        type="text/css" />
    <script language="javascript" type="text/javascript">
        function checkIssueType(source, args) {
            var chkListaTipoModificaciones = document.getElementById('cblLocation');
            var chkLista = chkListaTipoModificaciones.getElementsByTagName("input");
            for (var i = 0; i < chkLista.length; i++) {
                if (chkLista[i].checked) {
                    args.IsValid = true;
                    return;
                }
            }
            args.IsValid = false;
        }
    </script>
    <script type="text/javascript">
        function Print() {
            if (reportid == null || keyid == null) {
                alert("请先保存报表！");
            }
            else {

                if (keyid == 0) {
                    alert("没有可用数据，无法预览！");
                    return;
                }

                document.frames.PrintWeb.location = "../Report/Print.aspx?PrintMode=2&ReportID=" + reportid + "&KeyID=" + keyid;
            }
        }

        var h = 300;
        function AddHeight(num) {
            var div = document.getElementById("tbxContent_div_HtmlBox");
            if (num < 0 && h < 300) {

            } else {
                h += num;
            }

            if (h > 0) {
                div.style.height = h + "px";
            }

            document.getElementById("codeboxheight").value = h;
        }

        function EditDataSet() {
            var ddlDataSet = document.getElementById("ddlDataSet");
            var DataSetID = ddlDataSet.options[ddlDataSet.selectedIndex].value;
            openwindow('PostDataSet.aspx?action=small&DataSetID=' + DataSetID, 'new', 800, 550, 'yes');
        }
    </script>
</head>
<body>
    <form id="Form1" method="post" runat="server">
    <div class="divpanel">
        <table class="table" cellspacing="0">
            <tr>
                <th colspan="2">
                    编辑报表
                </th>
            </tr>
            <tr>
                <td align="right" style="width: 83px">
                    报表名称：
                </td>
                <td>
                    <asp:TextBox runat="server" ID="tbxReportName" Width="288px"></asp:TextBox>
                    <span style="color: Red">*</span>
                    <asp:RequiredFieldValidator ID="_tbxReportName" runat="server" ControlToValidate="tbxReportName"
                        ErrorMessage="请输入报表标题！" Display="Dynamic"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td align="right" style="width: 83px">
                    数据源：
                </td>
                <td style="vertical-align: baseline">
                    <asp:DropDownList ID="ddlDataSet" runat="server" DataTextField="DataSetName" DataValueField="DataSetID"
                        AutoPostBack="True" OnSelectedIndexChanged="ddlDataSet_SelectedIndexChanged">
                    </asp:DropDownList>
                    <asp:HyperLink ID="hlkEdit" runat="server" NavigateUrl="javascript:EditDataSet(); void(0);">[查看]</asp:HyperLink>
                </td>
            </tr>
            <tr>
                <td align="right" style="width: 83px">
                    出现位置：
                </td>
                <td style="vertical-align: baseline">
                    <ul style="padding: 0px; margin: 0px">
                        <li style="list-style-type: none; float: left">
                            <asp:Label ID="labMsg" runat="server" ForeColor="Red" Text="abc"></asp:Label>
                        </li>
                        <li style="list-style-type: none; float: left">
                            <asp:CheckBoxList ID="cblLocation" DataTextField="LocationName" DataValueField="LocationID"
                                runat="server" RepeatDirection="Horizontal">
                            </asp:CheckBoxList>
                        </li>
                        <li style="list-style-type: none; float: left">
                            <%--<asp:CustomValidator ID="CustomValidator1" runat="server" ClientValidationFunction="checkIssueType"
                                    Display="Dynamic" ErrorMessage="*请选择出现位置（至少选择一个）！"></asp:CustomValidator>--%></li>
                        <li style="list-style-type: none; clear: both; height: 0px; line-height: 0px; font-size: 1px">
                        </li>
                    </ul>
                </td>
            </tr>
            <tr>
                <td align="right" style="width: 83px">
                    &nbsp;
                </td>
                <td style="vertical-align: baseline">
                    <label class="lab_button">
                        <asp:Button ID="btnSave" runat="server" Text="保存" OnClick="btnSave_Click" />
                    </label>
                    <label class="lab_button">
                        <input id="btnShow" type="button" value="预览" onclick="Print();" /></label>
                    <label class="lab_button">
                        <input id="btnAddHeight" type="button" value="+" title="加高编辑器" onclick="AddHeight(100);" /></label>
                    <label class="lab_button">
                        <input id="btnClearHeight" type="button" value="-" title="减高编辑器" onclick="AddHeight(-100);" /></label>
                                            <label class="lab_button">
                        <asp:Button ID="btnRestoreDef" runat="server" Text="恢复出厂默认" 
                        OnClick="btnRestoreDef_Click" />
                    </label>
                </td>
            </tr>
            <tr>
                <td align="right" style="width: 83px">
                    报表设计：
                </td>
                <td style="vertical-align: baseline">
                    <div style="float: left; width: 90%">
                        <uc1:CodeBox ID="tbxContent" runat="server" Width="100%" Height="300px" Rendering="RenderingXsl" />
                    </div>
                    <div style="float: left">
                        <span style="color: Red; margin-left: 10px">*</span></div>
                    <div style="clear: both">
                    </div>
                </td>
            </tr>
            <tr>
                <td align="right" style="width: 83px">
                    访问权限：
                </td>
                <td>
                    <table>
                        <tr>
                            <td>
                                已选用户/组<asp:DropDownList ID="ddlAllow" runat="server">
                                    <asp:ListItem Value="0">禁止访问</asp:ListItem>
                                    <asp:ListItem Value="1">允许访问</asp:ListItem>
                                </asp:DropDownList>
                            </td>
                            <td>
                                &nbsp;
                            </td>
                            <td>
                                <asp:DropDownList ID="ddlGroupAndUsers" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlGroupAndUsers_SelectedIndexChanged">
                                    <asp:ListItem Value="0">所有用户组</asp:ListItem>
                                    <asp:ListItem Value="1">所有用户</asp:ListItem>
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:ListBox ID="lbxSelected" runat="server" Height="129px" Width="150px" SelectionMode="Multiple">
                                </asp:ListBox>
                            </td>
                            <td>
                                <label class="lab_button">
                                    <asp:Button ID="btnAdd" runat="server" Text="&lt;加入" OnClick="btnAdd_Click" />
                                </label>
                                <br />
                                <br />
                                <label class="lab_button">
                                    <asp:Button ID="btnClear" runat="server" Text="移除&gt;" OnClick="btnClear_Click" />
                                </label>
                            </td>
                            <td>
                                <asp:ListBox ID="lbxGroupAndUsers" runat="server" Height="129px" Width="150px" SelectionMode="Multiple">
                                </asp:ListBox>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td align="right" style="width: 83px">
                    状态：
                </td>
                <td>
                    <asp:RadioButtonList ID="rblLockState" runat="server" Width="120px" RepeatDirection="Horizontal">
                        <asp:ListItem Value="0" Text="禁用"></asp:ListItem>
                        <asp:ListItem Value="1" Text="启用"></asp:ListItem>
                    </asp:RadioButtonList>
                </td>
            </tr>
            <tr>
                <td align="right" style="width: 83px">
                    备注：
                </td>
                <td>
                    <asp:TextBox ID="tbxRemark" runat="server" Width="448px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td align="right" style="width: 83px">
                </td>
                <td>
                    <label class="lab_button">
                        <asp:Button ID="btnSubmit" runat="server" Text="提交" OnClick="btnSubmit_Click"></asp:Button>
                    </label>
                    <label class="lab_button" id="__mt_labBack" runat="server">
                        <input causesvalidation="false" type="button" runat="server" onclick="back(this)" value="返回" /></label>
                </td>
            </tr>
        </table>
    </div>
    <input id="codeboxheight" name="codeboxheight" type="hidden" value="300" />
    </form>
    <div class="printWeb">
        <iframe id="PrintWeb" width="0" height="0"></iframe>
    </div>
</body>
</html>
