<%@ page language="C#" autoeventwireup="true" inherits="ims.detailLayout, ims.web" enableviewstatemac="false" enableEventValidation="false" %>
<!DOCTYPE html>
<html id="detailLayout">
<head runat="server">
    <title></title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" /><meta name="viewport" content="width=device-width,initial-scale=1">
</head>
<body class="waiting" onbeforeunload="confirmExit(event);">
    <div class="hide"><div class="loadbar"><div></div><div></div><div></div><div></div><div></div></div></div>
    <form id="form1" runat="server">
        <asp:ScriptManager runat="server" ID="sm" OnAsyncPostBackError="AsyncError">
            <CompositeScript Path="js/msajax.js" ScriptMode="Release">
                <Scripts>
                    <asp:ScriptReference Name="WebForms.js" Assembly="System.Web" /><asp:ScriptReference Name="MicrosoftAjax.js" /><asp:ScriptReference Name="MicrosoftAjaxWebForms.js" />
                </Scripts>
            </CompositeScript>
        </asp:ScriptManager>
        <div id="pageTitle" runat="server" class="pageTitle"></div>
        <div class="ui-tabs nobg noborder" id="tabs">
	        <ul>
		        <li><a href="#tableArea">表格版式</a></li>
		        <li><a href="#free">自由排版</a>
                    <asp:UpdatePanel ID="freeList" RenderMode="Inline" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
                        <ContentTemplate>：<asp:DropDownList runat="server" ID="ddlLayouts" AutoPostBack="true" OnSelectedIndexChanged="ddlLayoutsChanged" onmousedown="setOriLayout(this, event);" onchange="return preChange();"></asp:DropDownList></ContentTemplate>
                    </asp:UpdatePanel>
		        </li>
	        </ul>
	        <div id="tableArea">
                <table id="tabLayout" class="comm pconly">
                    <tr><td colspan="2"></td><td class="f-bin fb1 greenish">回收站</td></tr>
			        <tr>
				        <td class="zone" style="width:43%" runat="server" id="zone0">
                        </td>
				        <td class="zone" style="width:43%" runat="server" id="zone1">
                        </td>
				        <td rowspan="3" class="zone" style="width:14%" runat="server" id="recycle">
                        </td>
			        </tr>
			        <tr>
				        <td colspan="2" class="zone" runat="server" id="zone2">
                        </td>
			        </tr>
			        <tr>
				        <td colspan="2" class="vtop">
                            <div class="gray infoico">拖动字段名称调整位置；拖入回收站以隐藏。</div>
                            <div class="footBtnArea">
                                <input type="button" id="btnSaveTable" title="保存排版结果" value="保存" onclick="return setLayout();" class="btn" runat="server" onserverclick="SaveLayout" />
                                <input type="button" id="btnM1" value="管理版式" onclick="ShowPop('manage_popup');" class="btn" />
                                <input type="button" onclick="toBack();" value="返回" class="btn" />
                                <input type="button" value="帮助" onclick="return showHelp('tableLayout');" class="btn pconly" />
                            </div>
                        </td>
			        </tr>
                </table>
                <div class="msgarea mtop_m monly">若需调整表格版式，请在电脑上操作！</div>
            </div>
	        <div id="free">
                <asp:UpdatePanel ID="upEditor" OnPreRender="MakeEditor" ChildrenAsTriggers="false" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                    <asp:TextBox runat="server" ID="ckHtml" Height="300" Width="100%" CssClass="ck" TextMode="MultiLine"></asp:TextBox>
                </ContentTemplate>
                <Triggers><asp:AsyncPostBackTrigger ControlID="ddlLayouts" EventName="SelectedIndexChanged" /></Triggers>
                </asp:UpdatePanel>
                <div id="toolArea">
                    <div id="divQuerys">
                        <div class="blkTitle">查询定义</div>
                        <asp:UpdatePanel ID="upq" class="bgarea" runat="server" RenderMode="Block" UpdateMode="Conditional">
                            <ContentTemplate>
                                <ul runat="server" id="ulQuerys"></ul>
                                <div runat="server" id="divAdd"><asp:LinkButton runat="server" ID="lbAddQuery" OnClick="ShowQuery" Text="添加查询…"></asp:LinkButton></div>
                                <asp:Button runat="server" ID="btnDel" OnClick="DelQuery" CssClass="hide" />
                            </ContentTemplate>
                            <Triggers><asp:AsyncPostBackTrigger ControlID="saveLayout" EventName="serverclick" /></Triggers>
                        </asp:UpdatePanel>
                    </div>
                    <div id="tdSep"></div>
                    <div id="divCodes">
                        <div class="blkTitle">代码速查</div>
                        <div class="bgarea">
                            字段：<asp:DropDownList runat="server" ID="ddlTemplets" OnSelectedIndexChanged="TempletChanged" AutoPostBack="true"></asp:DropDownList>
                            <asp:UpdatePanel ID="up" runat="server" RenderMode="Inline" UpdateMode="Conditional">
                                <ContentTemplate>
                                    <asp:DropDownList runat="server" ID="ddlfs"></asp:DropDownList>
                                    <div class="mtop_s mbottom_s">格式：<select id="ddlFmts" onchange="fmtsChanged();">
                                            <option value="">正常显示</option>
                                            <option value="BarCode_1D">条形码</option>
                                            <option value="BarCode_2D">二维码</option>
                                            <option value="UpperNumeric">大写数字</option>
                                            <option value="OriSize">原始图片</option>
                                            <option value="FirstPhoto">仅显示首图</option>
                                            <option value="OptionsH">横排选项</option>
                                            <option value="OptionsV">竖排选项</option>
                                        </select>
                                        <select id="ddlBarCodes" class="forBarcode hide" onchange="showTag();">
                                            <option value="CODE39">CODE 39</option>
                                            <option value="CODE39Ext">CODE 39 Extended</option>
                                            <option value="CODE128">CODE 128</option>
                                            <option value="EAN13">EAN-13</option>
                                            <option value="EAN8">EAN-8</option>
                                            <option value="UPCA">UPC-A</option>
                                            <option value="UPCE">UPC-E</option>
                                            <option value="Codabar">Codabar</option>
                                            <option value="JAN13">JAN-13</option>
                                            <option value="BOOKLAND">BOOKLAND</option>
                                            <option value="ISBN">ISBN</option>
                                            <option value="PostNet">PostNet</option>
                                            <option value="Sta2of5">Standard 2 of 5</option>
                                            <option value="Ind2of5">Industrial 2 of 5</option>
                                            <option value="Int2of5">Interleaved 2 of 5</option>
                                            <option value="USD8">USD 8</option>
                                            <option value="UCC12">UCC 12</option>
                                            <option value="UCC13">UCC 13</option>
                                            <option value="CODE11">CODE 11</option>
                                            <option value="CODE128A">CODE 128-A</option>
                                            <option value="CODE128B">CODE 128-B</option>
                                            <option value="CODE128C">CODE 128-C</option>
                                            <option value="LOGMARS">LOGMARS</option>
                                            <option value="UPC2Ext">UPC 2 Digit Ext</option>
                                            <option value="UPC5Ext">UPC 5 Digit Ext</option>
                                            <option value="TELEPEN">TELEPEN</option>
                                            <option value="FIM">FIM</option>
                                            <option value="Mod_Plessey">Modified_Plessey</option>
                                            <option value="MSI_Mod10">MSI Mod10</option>
                                            <option value="MSI_Mod11">MSI Mod11</option>
                                            <option value="MSI_2Mod10">MSI-2 Mod10</option>
                                            <option value="UNSPECIFIED">Unspecified</option>
                                        </select>
                                        <select id="ddlSize" class="hide" onchange="showTag();" title="选择尺寸">
                                            <option value="small">小</option>
                                            <option value="smaller">较小</option>
                                            <option value="medium" selected="selected">适中</option>
                                            <option value="larger">较大</option>
                                            <option value="large">大</option>
                                        </select>
                                        <span class="forBarcode hide"><input type="checkbox" id="cbLabel" onchange="showTag();" /><label for="cbLabel">包含文字</label></span>
                                    </div>
                                    代码：<span id="fieldTag"></span>
                                </ContentTemplate>
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="ddlTemplets" EventName="SelectedIndexChanged" />
                                </Triggers>
                            </asp:UpdatePanel>
                        </div>
                    </div>
                </div>
                <div id="btns">
                    <input type="button" id="saveLayout" title="保存当前版式" value="保存" onclick="return setLayout();" class="btn" runat="server" onserverclick="SaveLayout" />
                    <input type="button" id="addLayout" title="添加一个新的自由排版版式" value="添加版式" onclick="toAddLayout();" class="btn" />
                    <input type="button" id="btnM2" value="管理版式" onclick="ShowPop('manage_popup');" class="btn" />
                    <input type="button" onclick="toBack();" value="返回" class="btn" />
                    <input type="button" value="帮助" onclick="return showHelp('freeLayout');" class="btn pconly" />
                </div>
	        </div>
        </div>

        <ims:Pop runat="server" ID="pop" Title="查询设置" OnOkClick="SaveQuery" OnClientUpdated="setCode();" Width="460" OnOkClientClick="return preSaveQuery();" HideOnOkClientClick="false">
        <ContentTemplate>
            <asp:UpdatePanel ID="upQuery" runat="server" RenderMode="inline" ChildrenAsTriggers="true" UpdateMode="conditional">
            <ContentTemplate>
            <div class="middle">名称：<asp:TextBox runat="server" ID="qName" Width="160"></asp:TextBox>，引用标记：<asp:DropDownList runat="server" ID="ddlVarName" onchange="setCode();"></asp:DropDownList></div>
            <fieldset class="mtop_n"><legend>查询： <asp:DropDownList ID="ddlQueryTemplets" AutoPostBack="true" OnSelectedIndexChanged="InitByTemplet" runat="server"></asp:DropDownList></legend>
            <div runat="server" id="queryCond">
            <asp:CheckBox ID="cbCond1" Text="过滤器：" runat="server" /><asp:DropDownList ID="ddlFilters"
            runat="server"></asp:DropDownList>
            <asp:HyperLink ID="hlAddFilter" Text="添加过滤器" runat="server"></asp:HyperLink>
            <div id="d1" runat="server"><asp:RadioButtonList runat="server" ID="rbl1" RepeatDirection="Horizontal" RepeatLayout="Flow" CssClass="rblCond"><asp:ListItem Value="And" Selected="True">并且</asp:ListItem><asp:ListItem Value="Or">或者</asp:ListItem></asp:RadioButtonList>
            <asp:CheckBox ID="cbCond2" Checked="true" runat="server" /><asp:DropDownList ID="ddlSourceFields" runat="server"></asp:DropDownList>
                <asp:DropDownList ID="ddlCondOperators" onchange="checkCondMode(this);" runat="server" Width="52"></asp:DropDownList>
                当前 <asp:DropDownList ID="ddlTargetFields" runat="server"></asp:DropDownList>
            <a runat="server" id="add1" href="#" onclick="return addCond(this);">增加条件</a>
            </div>
            <div id="d2" runat="server"><asp:RadioButtonList runat="server" ID="rbl2" RepeatDirection="Horizontal" RepeatLayout="Flow" CssClass="rblCond"><asp:ListItem Value="And" Selected="True">并且</asp:ListItem><asp:ListItem Value="Or">或者</asp:ListItem></asp:RadioButtonList>
            <asp:CheckBox ID="cbCond3" runat="server" /><asp:DropDownList ID="ddlSourceFields3" runat="server"></asp:DropDownList>
                <asp:DropDownList ID="ddlCondOperators3" onchange="checkCondMode(this);" runat="server" Width="52"></asp:DropDownList>
                当前 <asp:DropDownList ID="ddlTargetFields3" runat="server"></asp:DropDownList>
            <a runat="server" id="add2" href="#" onclick="return addCond(this);">增加条件</a>
            </div>
            <div id="d3" runat="server"><asp:RadioButtonList runat="server" ID="rbl3" RepeatDirection="Horizontal" RepeatLayout="Flow" CssClass="rblCond"><asp:ListItem Value="And" Selected="True">并且</asp:ListItem><asp:ListItem Value="Or">或者</asp:ListItem></asp:RadioButtonList>
            <asp:CheckBox ID="cbCond4" runat="server" /><asp:DropDownList ID="ddlSourceFields4" runat="server"></asp:DropDownList>
                <asp:DropDownList ID="ddlCondOperators4" onchange="checkCondMode(this);" runat="server" Width="52"></asp:DropDownList>
                当前 <asp:DropDownList ID="ddlTargetFields4" runat="server"></asp:DropDownList>
            <a runat="server" id="add3" href="#" onclick="return addCond(this);">增加条件</a>
            </div>
            <div id="d4" runat="server"><asp:RadioButtonList runat="server" ID="rbl4" RepeatDirection="Horizontal" RepeatLayout="Flow" CssClass="rblCond"><asp:ListItem Value="And" Selected="True">并且</asp:ListItem><asp:ListItem Value="Or">或者</asp:ListItem></asp:RadioButtonList>
            <asp:CheckBox ID="cbCond5" runat="server" /><asp:DropDownList ID="ddlSourceFields5" runat="server"></asp:DropDownList>
                <asp:DropDownList ID="ddlCondOperators5" onchange="checkCondMode(this);" runat="server" Width="52"></asp:DropDownList>
                当前 <asp:DropDownList ID="ddlTargetFields5" runat="server"></asp:DropDownList></div>
            </div>
            <div runat="server" id="msg" class="padcenter gray">请选择要查询的对象！</div>
            </fieldset>
            <div runat="server" id="divOptions">排序： <asp:DropDownList ID="ddlResultSortFields" runat="server"></asp:DropDownList>
                <asp:DropDownList ID="ddlSortDirection" runat="server">
                <asp:ListItem Value="Ascending" Selected="true">从小到大</asp:ListItem>
                <asp:ListItem Value="Descending">从大到小</asp:ListItem>
                </asp:DropDownList>
            </div>
            <fieldset class="mtop_n"><legend>引用代码</legend>
                <ul id="ulRefCode">
                    <li>表格：<span id="aTable"></span>， <a href="javascript:void(0);" runat="server" id="aRender" onclick="return showRender();">设置表格</a></li>
                    <li>报表：<span id="aReport"></span>， <asp:DropDownList runat="server" ID="ddlReports" onchange="updateReportCode();"></asp:DropDownList></li>
                    <li>图表：<span id="aChart"></span>， <asp:DropDownList runat="server" ID="ddlCharts" onchange="updateChartCode();"></asp:DropDownList></li>
                </ul>
            </fieldset>
            </ContentTemplate>
            </asp:UpdatePanel>
        </ContentTemplate>
        </ims:Pop>
        <ims:Pop runat="server" ID="add" Title="添加版式" OnOkClientClick="preAddLayout();" HideOnOkClientClick="false" OnOkClick="AddNewLayout">
            <ContentTemplate>
                <div class="mtop_n center">
                    <div class="left inlineBlock">
                        版式名称：<asp:TextBox runat="server" ID="tbName" Width="200"></asp:TextBox>
                        <div class="mtop_s">
                            初始化为：<asp:DropDownList runat="server" ID="ddlFrom"></asp:DropDownList>
                        </div>
                    </div>
                </div>
            </ContentTemplate>
        </ims:Pop>
        <ims:Pop runat="server" ID="manage" Title="管理版式" ShowOkButton="false" CanelButtonText="关闭" HelpSubject="detailLayoutManage" OnOkClick="AddNewLayout" Width="420">
            <ContentTemplate>
                <table class="normal" id="layouts">
                    <tr><th>版式</th><th style="width:32px">默认</th><th style="width:32px">更名</th><th style="width:32px">编辑</th><th style="width:32px">删除</th></tr>
                    <asp:PlaceHolder runat="server" ID="phLayouts"></asp:PlaceHolder>
                </table>
                <fieldset class="mtop_n mbottom_s"><legend>默认版式规则</legend>
                    <div class="padbox">
                        <ol runat="server" id="olRules" class="olRules"></ol>
                        <div class="right"><a href="#" id="aAddRule" runat="server" onserverclick="ToAddRule">添加规则</a></div>
                    </div>
                </fieldset>
                <asp:CheckBox runat="server" ID="cbDisChange" Text="禁止普通用户切换版式" onclick="switchChange();" />
            </ContentTemplate>
        </ims:Pop>
        <ims:Pop runat="server" ID="rule" OnClientUpdated="setTimeout(initRule,0);" OnOkClick="SaveRule" HideOnOkClientClick="false">
            <ContentTemplate>
                <fieldset><legend>以下情况使用：<asp:DropDownList runat="server" ID="ddlAll"></asp:DropDownList></legend>
                    <div id="rulediv" class="notfocus">
                        <asp:CheckBox runat="server" ID="cbFilter" Text="条件：" /><a href="#" onclick="return ShowFilter(getUrlParam('tid'),'DefaultLayoutCond');">设置条件</a>
                        <asp:RadioButtonList runat="server" ID="rblOpera" CssClass="rblCond" RepeatLayout="Flow" RepeatDirection="Horizontal"><asp:ListItem Value="And">并且</asp:ListItem><asp:ListItem Value="Or" Selected="True">或者</asp:ListItem></asp:RadioButtonList>
                        <asp:CheckBox runat="server" ID="cbRoles" Text="角色：" /><asp:TextBox runat="server" ID="tbRoles" acfid="RoleName" chars=";；、,，" ToolTip="输入角色名。多项之间以逗号、分号或顿号分隔"></asp:TextBox>
                        <asp:RadioButtonList runat="server" ID="rblOpera2" CssClass="rblCond" RepeatLayout="Flow" RepeatDirection="Horizontal"><asp:ListItem Value="And">并且</asp:ListItem><asp:ListItem Value="Or" Selected="True">或者</asp:ListItem></asp:RadioButtonList>
                        <asp:CheckBox runat="server" ID="cbDevice" Text="设备：" /><asp:DropDownList runat="server" ID="ddlDevice"><asp:ListItem Value="PC">电脑</asp:ListItem><asp:ListItem Value="Mobile" Selected="True">移动设备</asp:ListItem></asp:DropDownList>
                    </div>
                </fieldset>
            </ContentTemplate>
        </ims:Pop>
        <div id="ts" class="pop" style="width:670px">
        <div class="head">
            <div class="title">设置表格</div><div class="close" onclick="HideDialog(this);"></div>
        </div>
            <div class="body notfocus">
                <fieldset><legend>选择字段<button type="button" class="f-duoxuan btn smest outline" onclick="SelectAll(this,'divFields');">全选</button><button type="button" class="f-ok btn smest outline" onclick="RevSelect('divFields');">反选</button></legend>
                    <asp:UpdatePanel ID="fs" runat="server" UpdateMode="conditional">
                    <ContentTemplate>
                        <div class="padbox green" runat="server" id="divFields"></div>
                    </ContentTemplate>
                    </asp:UpdatePanel>
                </fieldset>
                <input type="checkbox" id="cbNo" /><label for="cbNo">序号</label>
                <input type="checkbox" id="cbBackcolor" /><label for="cbBackcolor">标题行底色</label>
                <input type="checkbox" id="cbFit" /><label for="cbFit">宽度自适应</label>
                <span id="spanPager">
                    <input type="checkbox" id="cbPagesize" /><label for="cbPagesize" style="margin-right:2px">打印时每</label><input type="text" id="tbPagesize" style="width:28px" /> <label for="cbPagesize">行分页&nbsp;</label>
                </span>
                <input type="checkbox" id="cbClass" /><label for="cbClass" class="reset">添加样式类：</label><input type="text" id="tbClass" style="width:54px" /><i title="解释" onclick="What('TableClass')" class="what"></i>
                <div id="previewArea">
                    <div id="container">
                        <table id="previewTable" class="normal autoWidth center"><tbody><tr id="preview"></tr></tbody></table>
                    </div>
                </div>
                <div class="gray middle"><i class="infoico"></i><span id="pmt">鼠标拖动列标题调整顺序，拖动列边界调整宽度</span></div>
            </div>
            <div class="btnArea">
                <input type="button" runat="server" value="确定" id="btnOk" onclick="saveTable();" class="btn" />
                <input type="button" class="btn" value="取消" runat="server" id="btnCancel" onclick="HideDialog(this);" />
            </div>
        </div>
        <asp:Button runat="server" ID="btnManage" OnClick="OperaLayout" CssClass="hide" />
    <script src="js/comm.js"></script><script src="js/detailLayout.js"></script>
    </form>
</body>
</html>