<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SavedSearchEdit.aspx.cs"
    Inherits="OAWeb.SearchView.SavedSearchEdit" EnableEventValidation="false" EnableViewState="true" %>

<%@ Register Src="ViewForm.ascx" TagName="ViewForm" 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">
    <title></title>
    <link href="/css/global.css" rel="Stylesheet" />
    <script type="text/javascript" src="/js/jquery-1.8.0.min.js"></script>
    <script type="text/javascript" src="/js/common.js"></script>
    <script src="/js/artDialog/artDialog.js?skin=default" type="text/javascript"></script>
    <script src="/js/artDialog/plugins/iframeTools.source.js" type="text/javascript"></script>
    <script src="/js/jquery.validate.js" type="text/javascript"></script>
    <script src="/js/jquery.validate.extend.js" type="text/javascript"></script>
    <script src="/js/jquery.form.js" type="text/javascript"></script>
    <script type="text/javascript" src="/js/jquery.form.extend.js"></script>
    <link href="/NewProject/css/style.css" rel="Stylesheet" />
    <script language="javascript" type="text/javascript" src="/js/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript">
        //隐藏指定控件
        function dispalyControl(obj, controlid, values) {
            var control = document.getElementById(controlid);

            if (control == null) return;
            if (obj.value == values) {
                control.style.display = "";
            }
            else {
                control.style.display = "none";
            }
            var txtId = obj.id.replace("ddl", "txt");
            if (obj.value == "SomeDayBefore" || obj.value == "SomeDayIn") {
                
                document.getElementById(txtId).style.display="";
            }
            else {
                document.getElementById(txtId).style.display = "none";
            }
        }
        //创建XMLHTTP对象
        function createXMLRequest() {
            var xmlHttp = false;
            try {
                xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch (e) {
                try {
                    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                }
                catch (E) {
                    xmlHttp = false;
                }
            }
            if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
                xmlHttp = new XMLHttpRequest();
            }
            return xmlHttp;
        }
        //通过ajax获取下拉框数据
        function AjaxLoadListBoxData(url, ListBoxID, DefaultValue) {
            var item = document.getElementsByName(ListBoxID)[0];
            if (item == null || item == undefined) return;
            var result = "";
            var xmlHttp = createXMLRequest();
            xmlHttp.onreadystatechange = function () {
                if (xmlHttp.readyState == 4) {
                    if (xmlHttp.status == 200) {
                        result = xmlHttp.responseText;
                        if (result != "") {
                            item.options.length = 0;
                            item.options.add(new Option("请选择", ""));
                            var piArray = eval(result);
                            for (var i = 0; i < piArray.length; i++) {
                                if (piArray[i] == "undefined" || piArray[i] == null) continue;
                                item.options.add(new Option(piArray[i].Text, piArray[i].Value));
                                if (piArray[i].Value == DefaultValue) {
                                    item.selectedIndex = item.length - 1;
                                }
                            }
                        }
                        else {
                            //alert(result);
                        }
                    }
                    delete xmlHttp;
                    xmlHttp = null;
                }
            }
            xmlHttp.open("GET", url, true);
            xmlHttp.send("");
        }

        //通过JSON获取城市地区数据
        function LoadCity(ProvinceValue, CityID, CityValue) {
            var webUrl = "/Ajax.aspx?op=LoadCityJson&id=" + ProvinceValue;
            AjaxLoadListBoxData(webUrl, CityID, CityValue);
        }  
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div style="width: 650px; height: 400px; padding: 10px;">
        <uc1:ViewForm ID="ViewForm1" runat="server" />
        <table class="edit-view" style="margin: auto">
            <asp:PlaceHolder ID="pnlView" runat="server">
                <tr>
                    <td class="data-field">
                        <table width="100%">
                            <tr>
                                <td class=" tb-label">
                                    视图名称：
                                </td>
                                <td class=" tb-editor">
                                    <asp:TextBox ID="txtSearchViewTitle" runat="server"></asp:TextBox>
                                </td>
                                <td class=" tb-label">
                                    菜单关键字：
                                </td>
                                <td class=" tb-editor">
                                    <asp:TextBox ID="txtMenuKey" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td class=" tb-label">
                                    高级检索：
                                </td>
                                <td class=" tb-editor">
                                    <asp:TextBox ID="txtAdvancedContents" runat="server" CssClass="txt"></asp:TextBox>
                                    &nbsp;如：$1 or $2 or $3
                                </td>
                                <td class=" tb-label">
                                    &nbsp; 选项：
                                </td>
                                <td class=" tb-editor">
                                    <asp:CheckBox ID="chkIsDisplay" runat="server" Text="显示" />
                                    &nbsp;
                                    <asp:CheckBox ID="chkIsSystem" runat="server" Text="系统视图" />
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </asp:PlaceHolder>
            <tr>
                <td class="data-caption">
                    <div align="center">
                        <asp:Button ID="btnSearch" runat="server" Text=" 搜 索 " CssClass="btn_77px" 
                            onclick="btnSearch_Click" />
                        <asp:Button ID="btnSave" runat="server" Text="保 存" CssClass="btn_77px" CommandName="AddSearchView"
                            OnCommand="Page_Command" />
                        <asp:Button ID="btnClose" runat="server" Text="返 回" CssClass="btn_77px" OnClientClick="art.dialog.close();" />
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <asp:PlaceHolder ID="plhSearch" runat="server">
        <script type="text/javascript">
            function closeDialog(value) {
                // 返回数据给页面
                art.dialog.data('departValue', value); // 存储Value数据
                art.dialog.close();
            }
        </script>
    </asp:PlaceHolder>
    </form>
</body>
</html>
