<%@ page language="C#" autoeventwireup="true" inherits="ims.web.table, ims.web" enableviewstatemac="false" enableEventValidation="false" %>
<%@ Register Src="~/UserControls/FileUploader.ascx" TagName="Uploader" TagPrefix="ims" %>
<!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" id="table">
<head runat="server"><title></title>
</head>
<body class="waiting">
    <div class="hide"><img src="images/loading.gif" />正在生成，请稍候 …</div>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="s1" runat="server" AsyncPostBackTimeout="900">
            <Scripts><asp:ScriptReference Name="MicrosoftAjax.js" ScriptMode="Auto" Path="~/js/MsAjax.js"/><asp:ScriptReference Name="MicrosoftAjaxWebForms.js" ScriptMode="Auto" Path="~/js/MsAjax.js"/></Scripts>
        </asp:ScriptManager>
        <div id="printArea">
        <asp:UpdatePanel ID="upObjs" runat="server" OnPreRender="TablePreRender" RenderMode="Block" UpdateMode="conditional">
        <ContentTemplate>
            <asp:GridView ID="gv" runat="server" ShowHeader="true" ShowFooter="true" DataKeyNames="ID" AutoGenerateColumns="False" GridLines="None" CellSpacing="1" AllowPaging="false" AllowSorting="true"
            OnDataBound="GvDataBound" OnRowDataBound="GvRowBound" OnRowCreated="GvRowCreated" OnSorting="GvSorting">
            </asp:GridView>
        </ContentTemplate>
        </asp:UpdatePanel>
        <asp:HiddenField ID="curObjItemId" runat="server" /><asp:HiddenField ID="curFieldId" runat="server" />
        <asp:UpdatePanel ID="upPager" runat="server" ChildrenAsTriggers="false" UpdateMode="conditional" RenderMode="Inline">
        <ContentTemplate>
            <table cellspacing="0" runat="server" id="PagerBar" class="PagerBar"><tr><td>
                <asp:DropDownList runat="server" Width="84" ID="ddlFilters" OnSelectedIndexChanged="FastFilter" onchange="toFilter()"></asp:DropDownList>
                <span runat="server" id="pagebtns">
                <asp:LinkButton ID="btnFirst" Text="首页" runat="server" ToolTip="快捷键：Home" AccessKey="F" OnClick="ToPage" />
                <asp:LinkButton ID="btnPrevious" Text="< 上一页" runat="server" ToolTip="快捷键：←或PageUp" AccessKey="P" OnClick="ToPage" />
                <asp:Label ID="lblCount" CssClass="count" runat="server"></asp:Label>
                <asp:LinkButton ID="btnNext" Text="下一页 >" runat="server" ToolTip="快捷键：→或PageDown" AccessKey="N" OnClick="ToPage" />
                <asp:LinkButton ID="btnLast" Text="末页" runat="server" ToolTip="快捷键：End" AccessKey="L" OnClick="ToPage" />
                </span>
                <img src="images/data_add.gif" title="添加新记录" runat="server" id="imgAdd" />
            </td><td align="right">
                <asp:DropDownList runat="server" id="ddlPagesize" AutoPostBack="True" OnSelectedIndexChanged="PageSizeChanged">
                    <asp:ListItem Value="5">5项/页</asp:ListItem>
                    <asp:ListItem Value="10">10项/页</asp:ListItem>
                    <asp:ListItem Value="15" Selected="True">15项/页</asp:ListItem>
                    <asp:ListItem Value="20">20项/页</asp:ListItem>
                    <asp:ListItem Value="30">30项/页</asp:ListItem>
                    <asp:ListItem Value="50">50项/页</asp:ListItem>
                    <asp:ListItem Value="100">100项/页</asp:ListItem>
                    <asp:ListItem Value="500">500项/页</asp:ListItem>
                </asp:DropDownList>
                <asp:DropDownList ID="ddlPager" AutoPostBack="true" OnSelectedIndexChanged="ToPage" runat="server"></asp:DropDownList>
            </td></tr></table>
            <ul class="hide" id="AttributeInfo"><li>共<asp:Literal ID="recordCount" runat="server"></asp:Literal>项</li></ul>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="Del" EventName="serverclick" />
            <asp:AsyncPostBackTrigger ControlID="Edit_InPlace" EventName="serverclick" />
            <asp:AsyncPostBackTrigger ControlID="Edit_Save" EventName="serverclick" />
            <asp:AsyncPostBackTrigger ControlID="Edit_Canel" EventName="serverclick" />
        </Triggers>
        </asp:UpdatePanel>
        <asp:DropDownList ID="stats" runat="server" AutoPostBack="true" OnSelectedIndexChanged="stats_Changed" />
        </div>
        <asp:UpdatePanel ID="btnArea" UpdateMode="Conditional" runat="server" RenderMode="Block">
        <ContentTemplate>
            <input type="button" runat="server" id="btnFilter" class="btn" value="筛选" onserverclick="ShowFastFilter" />
            <input type="button" runat="server" id="btnBatch" class="btn" value="批量操作" onclick="showBatchPop()" />
            <input type="button" id="saveLayout" runat="server" title="保存当前表格版面设置（列顺序、宽度等）" value="保存版面" onclick="return setLayout();" onserverclick="ApplyLayout" class="btn" />
            <input type="button" class="btn" value="更多…" id="btnMore" onclick="return showMenu()" />           
            <input type="button" value="打印" runat="server" id="btnPrint" onclick="toPrint()" class="btn" />
		    <input type="button" onclick="back();" value="返回" class="btn" />
        </ContentTemplate>
        </asp:UpdatePanel>
        <div class="menu" id="tools">
            <a accesskey="O" href="#" id="onlySelected" onclick="return showSelected()">查看选中的　Alt+O</a>
            <a accesskey="A" href="#" runat="server" id="addRecord">添加记录　　Alt+A</a>
            <a accesskey="F" href="#" runat="server" id="search">就地搜索　　Alt+F</a>
            <div></div>
            <a accesskey="S" href="#" onclick="toggleStyle()">切换样式　　Alt+S</a>
            <a accesskey="L" href="#" runat="server" onclick="return selectFields('p_popup')" id="cols" title="选择显示或隐藏表中的某些列">显示/隐藏列 &nbsp;Alt+L</a>
            <a accesskey="C" href="###" runat="server" id="condfmt" onserverclick="ShowCondFmt" title="将满足指定条件的记录用特殊格式显示">条件格式　　Alt+C</a>
            <div></div>
            <a href="###" runat="server" id="exportas" onclick="preExport();">导出</a>
            <a href="#" runat="server" id="saveSc" onclick="return ShowPop('sc_popup')">保存快捷方式</a>
            <div></div>
            <a accesskey="R" id="v6" href="report.aspx">报表视图　　Alt+R</a>
            <a accesskey="B" id="v5" href="chart.aspx">图表视图　　Alt+B</a>
            <a accesskey="V" id="v3" href="summary.aspx">概要视图　　Alt+V</a>
            <div></div>
            <a accesskey="H" href="#" onclick="return showHelp()">帮助　　　　Alt+H</a>
        </div>
        <div class="menu" id="menu_tr">
            <a accesskey="S" href="#" runat="server" id="Edit_Save" onserverclick="UpdateRow">保存修改　 Alt+S</a>
            <a accesskey="C" href="#" runat="server" id="Edit_Canel" onserverclick="CancelChange">放弃修改　 Alt+C</a>
            <a accesskey="O" href="#" onclick="return detail()">打开 　　　Alt+O</a>
            <a accesskey="Z" href="#" onclick="return InPlaceOpen()" title="按住Ctrl键双击行可就地打开">就地打开 　Alt+Z</a>
            <a href="#" onclick="return CanelEvent()" onmouseover="showSubMenu('sub_add')" onmouseout="hideSubMenu('sub_add')" id="addsub" runat="server" class="hasSubMenus">添加</a>
            <a href="#" onclick="return CanelEvent()" onmouseover="showSubMenu('sub_gen')" onmouseout="hideSubMenu('sub_gen')" id="aGen" runat="server" class="hasSubMenus">生成</a>
            <a accesskey="F" href="#" runat="server" id="aAddToFav" onclick="return addToFav(tid, curRid)">收藏　　　 Alt+F</a>
            <a accesskey="A" href="#" onclick="return addToCart(tid, curRid)" runat="server" id="aAddToCart">加入购物车 Alt+A</a>
            <a accesskey="E" href="#" onclick="return toEdit()" runat="server" id="Edit_Full">编辑　　　 Alt+E</a>
            <a accesskey="I" href="#" runat="server" id="Edit_InPlace" onserverclick="InPlaceEdit">就地编辑　 Alt+I</a>
            <a accesskey="D" href="#" runat="server" id="Del" onclick="return delConfirm()" onserverclick="DelObjItem">删除 　　　Alt+D</a>
            <div></div>
            <a accesskey="B" href="#" runat="server" id="aBatch" onclick="return showBatchPop()">批量操作　 Alt+B</a>
            <a href="###">双击：<select runat="server" id="behave" onchange="setBehave();"><option value="InPlaceEdit">就地编辑</option><option value="InPlaceOpen">就地打开</option><option value="Edit">编辑</option><option value="Open">打开</option></select></a>
        </div>
        <div class="menu" id="sub_add" runat="server" onmouseout="hideSubMenu(this)"></div>
        <div class="menu" id="sub_gen" runat="server" onmouseout="hideSubMenu(this)"></div>
        <ims:Pop runat="server" ID="p" Title="选择要显示的列" Width="450" OnClientCanel="restoreFieldsPanel();" CustomCss="noline" ShowProgress="false">
        <ContentTemplate>
            <asp:CheckBoxList ID="fs" CssClass="colorText" runat="server" CellPadding="0" CellSpacing="0" OnSelectedIndexChanged="selectedFieldsChanged" RepeatLayout="Flow" RepeatDirection="Horizontal"></asp:CheckBoxList>　<img src='images/selectall.gif' class='slt' title='全选/全不选' onclick="SelectAll('p_fs');" /><img src='images/revselect.gif' class='slt' title='反选' onclick="RevSelect('p_fs');" />
        </ContentTemplate>
        </ims:Pop>
        <ims:Pop runat="server" ID="query" OnOkClick="ExecQuery" Title="查看相关数据" OnOkClientClick="return toQuery();" ShowProgress="false">
            <ContentTemplate>
                查看： <asp:DropDownList runat="server" ID="tarTemplets" AutoPostBack="true" OnDataBound="BindQueryFields" OnSelectedIndexChanged="BindQueryFields"></asp:DropDownList><br />
                筛选： <asp:DropDownList runat="server" ID="queryFields"></asp:DropDownList> 包含于当前 <asp:DropDownList runat="server" ID="ddlRange"><asp:ListItem Value="Selected">选中</asp:ListItem><asp:ListItem Value="All">所有</asp:ListItem></asp:DropDownList> 的“<span id="colName" class="blod"></span>”
            </ContentTemplate>
        </ims:Pop>
        <ims:Pop runat="server" ID="batch" ShowOkButton="false" OnClientUpdated="setBatchPop();" ShowCancelButton="false" Width="425" CustomCss="noline">
            <ContentTemplate>
                <asp:UpdatePanel ID="range" runat="server" UpdateMode="conditional">
                    <ContentTemplate><b>批量操作：</b><asp:RadioButton runat="server" ID="rbSelected" GroupName="range" Text="选中的记录" Checked="true" />　<asp:RadioButton runat="server" ID="rbAll" GroupName="range" Text="当前所有记录" /></ContentTemplate>
                </asp:UpdatePanel>
                <fieldset runat="server" id="sms">
                    <legend>发送短信：<asp:DropDownList runat="server" ID="ddlMobFields"></asp:DropDownList></legend>
                    <asp:TextBox runat="server" ID="tbSms" TextMode="MultiLine" Rows="4" Width="99%"></asp:TextBox>
                </fieldset>
                <div id="btnSms" class="right" runat="server">
                    <asp:Button ID="btnSendSms" runat="server" Text="发送" ToolTip="群发短信" OnClick="BatchSendSms" OnClientClick="return smsConfirm();" CssClass="btn" />
                </div>
                <fieldset runat="server" id="mail">
                    <legend>发送邮件：<asp:DropDownList runat="server" ID="ddlMailFields"></asp:DropDownList></legend>
                    <asp:TextBox runat="server" ID="tbMail" TextMode="MultiLine" Rows="4" Width="99%"></asp:TextBox>
                    <table><tr><td>
                            主题：<asp:TextBox runat="server" ID="tbSubject" ToolTip="输入邮件主题" Width="300"></asp:TextBox>
                        </td><td align="right">
                            <asp:Button ID="btnSendMail" runat="server" Text="发送" ToolTip="群发邮件" OnClick="BatchSendMail" OnClientClick="return mailConfirm();" CssClass="btn" />
                        </td></tr>
                    </table>
                </fieldset>
            <asp:UpdatePanel ID="upBu" runat="server" UpdateMode="conditional" RenderMode="Block">
                <ContentTemplate>
                <fieldset runat="server" id="update">
                    <legend>批量更新 <asp:DropDownList ID="fsUpdate" runat="server" AutoPostBack="true" OnSelectedIndexChanged="SetEditControls"></asp:DropDownList><span id="spanValue" class="hide"> 为 <asp:DropDownList runat="server" ID="ddlValue" onchange="valueChanged();"></asp:DropDownList></span>：</legend>
                    <div style="padding:2px" runat="server" id="editArea">
                    <asp:TextBox ID="_tb" runat="server" Width="99%" Visible="false"></asp:TextBox>
                    <span runat="server" id="ddlspan" visible="false"><asp:Literal runat="server" ID="ddltext"></asp:Literal><asp:DropDownList ID="_ddl" runat="server"></asp:DropDownList></span>
                    <asp:CheckBox ID="_cb" runat="server" Visible="false" />
                    <asp:CheckBoxList ID="_cbl" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow" Width="100%" Visible="false"></asp:CheckBoxList>
                    <asp:RadioButtonList ID="_rbl" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow" Width="100%" Visible="false"></asp:RadioButtonList>
                    <asp:TextBox runat="server" ID="_ck" CssClass="ck" Width="99%" TextMode="MultiLine" Visible="false"></asp:TextBox>
                    <ims:Uploader runat="server" ID="_uploader" Visible="false" />
                    <table ID="_hl" runat="server" cellspacing="0" style="table-layout:fixed;width:98%" visible="false">
                        <tr><td style="width:60px">链接文字：</td><td><asp:TextBox ID="_tbText" runat="server" Width="99%"></asp:TextBox></td></tr>
                        <tr><td>链接地址：</td><td><asp:TextBox ID="_tbUrl" runat="server" Width="99%"></asp:TextBox></td></tr>
                    </table>
                    </div>
                    <div id="buMsg" class="padcenter gray hide"></div>
                </fieldset>
                <div class="right"><asp:Button ID="btnUpdate" runat="server" Text="更新" OnClick="BatchUpdate" OnClientClick="return doConfirm();" CssClass="btn" /></div>
                </ContentTemplate>
            </asp:UpdatePanel>
                <fieldset runat="server" id="buildTo"><legend>生成</legend>
                    <div class="padcenter">
                        生成：<asp:DropDownList runat="server" ID="ddlTo"></asp:DropDownList><asp:UpdatePanel ID="gen" runat="server" UpdateMode="conditional" RenderMode="Inline">
                            <ContentTemplate><asp:Button runat="server" ID="btnGenerate" Text="生成" OnClick="ToGenerate" OnClientClick="return preGenerate();" CssClass="btn" /></ContentTemplate>
                        </asp:UpdatePanel>
                    </div>
                </fieldset>
                <fieldset runat="server" id="addTo" class="mtop_m"><legend>添加到 <asp:DropDownList runat="server" ID="ddlAddTo" onchange="showKey();"></asp:DropDownList></legend>
                    <div class="padcenter notfocus">
                        <span id="keyText"></span><asp:TextBox runat="server" ID="tbKey" Width="135"></asp:TextBox><asp:UpdatePanel ID="add" runat="server" UpdateMode="conditional" RenderMode="Inline">
                            <ContentTemplate><asp:Button runat="server" ID="btnAddto" Text="添加" OnClick="ToAdd" OnClientClick="return preAddTo();" CssClass="btn" /></ContentTemplate>
                        </asp:UpdatePanel>
                    </div>
                </fieldset>
                <div class="footBtnArea">
                    <asp:Button ID="btnDel" CssClass="btn" runat="server" Text="删除" OnClientClick="return beforeDel();" OnClick="DelRows" />
                    <asp:Button ID="btnRemove" CssClass="btn" runat="server" Text="移到指定目录" Width="84" OnClick="RemoveTo" OnClientClick="return moveToDir()" />
                    <input type="button" runat="server" id="ExportExcel" style="width:78px" value="导出到Excel" onclick="return toXls();" onserverclick="toExcel" class="btn" />
                    <input type="button" value="关闭" class="btn" onclick="HideDialog();" />
                </div>
            </ContentTemplate>
        </ims:Pop>
        <ims:Pop runat="server" ID="ff" OnOkClick="doFilter" OnClientUpdated="InitFilter('ff_popup');" Width="450" HideOnOkClientClick="false" HelpSubject="fastFilter" CustomCss="noline" ShowProgress="false">
        <ContentTemplate>
            <fieldset><legend>
                筛选：<asp:RadioButtonList runat="server" ID="rblRange" RepeatDirection="Horizontal" RepeatLayout="Flow">
                    <asp:ListItem Value="Current" Selected="True">从当前结果中筛选 </asp:ListItem>
                    <asp:ListItem Value="All">从当前模板所有记录中筛选</asp:ListItem>
                </asp:RadioButtonList>
            </legend>
            <ul runat="server" id="ulFilter" class="notfocus"></ul>
            </fieldset>
            <div id="links">
                <asp:LinkButton runat="server" ID="lbUndo" OnClick="CanelLastFilter" Text="取消上次筛选"></asp:LinkButton>
            </div>
        </ContentTemplate>
        </ims:Pop>
        <ims:Pop runat="server" ID="fmt" OnOkClick="SaveCondFmt" Width="485" OnClientUpdated="fmtUpdated();" HideOnOkClientClick="false" HelpSubject="CondFormat" Title="条件格式" CustomCss="noline" ShowProgress="false">
        <ContentTemplate>
            <fieldset><legend>条件格式一</legend>
                <asp:CheckBox runat="server" ID="cbFmt1" Text="启用" />
                <div class="options">
                条件：<a href="javascript:void(0);" onclick="return ShowFilter('fmtCond1');">设置</a><br />
                格式：<asp:DropDownList runat="server" ID="ddlFmt1"></asp:DropDownList> 背景色：<asp:TextBox runat="server" ID="tbColor1" CssClass="iColorPicker"></asp:TextBox>&nbsp;前景色：<asp:TextBox runat="server" ID="tbForeColor1" CssClass="iColorPicker"></asp:TextBox>　<asp:CheckBox runat="server" ID="cbTop1" Text="置顶" />
                </div>
            </fieldset>
            <fieldset><legend>条件格式二</legend>
                <asp:CheckBox runat="server" ID="cbFmt2" Text="启用" />
                <div class="options">
                条件：<a href="javascript:void(0);" onclick="return ShowFilter('fmtCond2');">设置</a><br />
                格式：<asp:DropDownList runat="server" ID="ddlFmt2"></asp:DropDownList> 背景色：<asp:TextBox runat="server" ID="tbColor2" CssClass="iColorPicker"></asp:TextBox>&nbsp;前景色：<asp:TextBox runat="server" ID="tbForeColor2" CssClass="iColorPicker"></asp:TextBox>　<asp:CheckBox runat="server" ID="cbTop2" Text="置顶" />
                </div>
            </fieldset>
            <fieldset><legend>条件格式三</legend>
                <asp:CheckBox runat="server" ID="cbFmt3" Text="启用" />
                <div class="options">
                条件：<a href="javascript:void(0);" onclick="return ShowFilter('fmtCond3');">设置</a><br />
                格式：<asp:DropDownList runat="server" ID="ddlFmt3"></asp:DropDownList> 背景色：<asp:TextBox runat="server" ID="tbColor3" CssClass="iColorPicker"></asp:TextBox>&nbsp;前景色：<asp:TextBox runat="server" ID="tbForeColor3" CssClass="iColorPicker"></asp:TextBox>　<asp:CheckBox runat="server" ID="cbTop3" Text="置顶" />
                </div>
            </fieldset>
            <fieldset><legend>条件格式四</legend>
                <asp:CheckBox runat="server" ID="cbFmt4" Text="启用" />
                <div class="options">
                条件：<a href="javascript:void(0);" onclick="return ShowFilter('fmtCond4');">设置</a><br />
                格式：<asp:DropDownList runat="server" ID="ddlFmt4"></asp:DropDownList> 背景色：<asp:TextBox runat="server" ID="tbColor4" CssClass="iColorPicker"></asp:TextBox>&nbsp;前景色：<asp:TextBox runat="server" ID="tbForeColor4" CssClass="iColorPicker"></asp:TextBox>　<asp:CheckBox runat="server" ID="cbTop4" Text="置顶" />
                </div>
            </fieldset>
            <fieldset><legend>条件格式五</legend>
                <asp:CheckBox runat="server" ID="cbFmt5" Text="启用" />
                <div class="options">
                条件：<a href="javascript:void(0);" onclick="return ShowFilter('fmtCond5');">设置</a><br />
                格式：<asp:DropDownList runat="server" ID="ddlFmt5"></asp:DropDownList> 背景色：<asp:TextBox runat="server" ID="tbColor5" CssClass="iColorPicker"></asp:TextBox>&nbsp;前景色：<asp:TextBox runat="server" ID="tbForeColor5" CssClass="iColorPicker"></asp:TextBox>　<asp:CheckBox runat="server" ID="cbTop5" Text="置顶" />
                </div>
            </fieldset>
        </ContentTemplate>
        </ims:Pop>
        <ims:Pop runat="server" ID="sc" Title="保存快捷方式" OkButtonText="保存" OnOkClick="SaveasSc" OnOkClientClick="return preSavesc();" HideOnOkClientClick="false" ShowProgress="false">
            <ContentTemplate>
                <div class="footBtnArea">名称：<asp:TextBox runat="server" ID="tbsc" Width="160"></asp:TextBox> <img src="images/what.gif" title="查看解释" onclick="What('Shortcut')" class="what" /></div>
            </ContentTemplate>
        </ims:Pop>
        <ims:Pop runat="server" ID="prn" Title="准备打印…" OnOkClientClick="return exePrint();" OkButtonText="打印" Width="408" OnClientCanel="outPreview();" CustomCss="noline" ShowProgress="false">
            <ContentTemplate>
                <fieldset><legend>打印选项</legend>
                    <div class="padbox">
                    <input type="checkbox" checked="checked" id="cbTitle" /><label for="cbTitle">标题：</label><asp:TextBox runat="server" ID="tbTitle" Width="310"></asp:TextBox><br />
                    <input type="checkbox" id="cbUser" value="<%= ims.web.ui.UserContext.UserInfo.RealName %>" /><label for="cbUser">打印人</label><br />
                    <input type="checkbox" id="cbTime" value="<%= DateTime.Now.ToString("g") %>" /><label for="cbTime">打印时间</label>
                    </div>
                </fieldset>
                <div id="printPrompt"></div>
            </ContentTemplate>
        </ims:Pop>
        <asp:Button runat="server" ID="btnQuery" CssClass="hide" OnClick="ToQuery" />
    <script src="js/comm.js"></script><script src="js/table.js"></script>
    </form>
</body>
</html>