<%@ Page Title="" Language="C#" MasterPageFile="~/admin/Admin.Master" AutoEventWireup="true" CodeBehind="menu_toolbar.aspx.cs" Inherits="Math.admin.menu_toolbar" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    
    <style>
        .hd{ display:none }
    </style>

    
 <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  <legend>工具栏管理</legend>
</fieldset>



    
     <div class="layui-form-item">
   

            <div class="layui-inline">
      <label class="layui-form-label">工具栏名称</label>
      <div class="layui-input-inline">
          <asp:TextBox runat="server"    lay-verify="required" ID="txt_toolbartext"  autocomplete="off" class="layui-input"></asp:TextBox>
     </div>
    </div>


    <div class="layui-inline">
      <label class="layui-form-label">工具栏类型</label>
      <div class="layui-input-inline"> 
        <asp:DropDownList runat="server" 
              ID="ddl_type" ClientIDMode="Static"
             lay-ignore  CssClass="form-control" > 

            <asp:ListItem Text="LaTex" Value="tex"></asp:ListItem>
            <asp:ListItem Text="弹窗" Value="pop"></asp:ListItem> 
        </asp:DropDownList>
  
      </div>
    </div>


   
      
       <div class="layui-inline">
      <label class="layui-form-label">顺序ID</label>
      <div class="layui-input-inline">
         <asp:TextBox runat="server"  lay-verify="required" ID="txt_orderid" Text="0.0"  autocomplete="off" class="layui-input"></asp:TextBox>
      </div>
    </div>

          
    

  </div>




    
  <div class="layui-form-item" id="tex">

 
    <div class="layui-inline">
      <label class="layui-form-label">工具栏Latex</label>
      <div class="layui-input-inline">
         <asp:TextBox runat="server"   ID="txt_toolbarvalue"  autocomplete="off" class="layui-input"></asp:TextBox>
      </div>
    </div>


      
              <div class="layui-inline">
      <label class="layui-form-label">块级元素</label>
      <div class="layui-input-inline">
         <asp:DropDownList runat="server" ID="ddl_isblock" lay-ignore CssClass="form-control">
               <asp:ListItem Text="否" Value="0"></asp:ListItem>
              <asp:ListItem Text="是" Value="1"></asp:ListItem>
          </asp:DropDownList>
         </div>
             </div>





 
    

                    
   </div>
     



    
    
  <div class="layui-form-item"  id="pop" style="display:none">

 
    <div class="layui-block">
      <label class="layui-form-label">弹窗URL</label>
      <div class="layui-input-block">
         <asp:TextBox runat="server"   Width="80%"  ID="txt_url"  autocomplete="off" class="layui-input"></asp:TextBox>

         
          目前可以填写的值为：<u>../pop/常用符号.aspx</u> &nbsp;&nbsp;
           <u>../pop/三角变换.aspx</u>&nbsp;&nbsp;
           <u>../pop/微分表.aspx</u>&nbsp;&nbsp;
          
             <u>../pop/积分表.aspx</u>&nbsp;&nbsp;
            <u>../pop/解析几何.aspx</u>&nbsp;&nbsp; 请访问<a href="http://www.dotnetcms.org">官网</a>获取最新
      </div>
    </div>

       
       
  
   
                    
   </div>
     

     


     

      
  <div class="layui-form-item">

         <div class="layui-input-block">
              

                           <asp:Button runat="server"
                                OnClientClick="chkIsSystem(); " 
                                ID="btn_add"
                                lay-submit
                                Text="添加" 
                                ValidationGroup="add"
               
                               class="layui-btn add" OnClick="btn_add_Click"  
                                />
                          
                      
                       </div>

      </div>

     
    <script>

        $("#ddl_type").change(
            function ()
            {
                var value = $(this).val();
                
                if (value== "tex") {
                    $("#tex").show();
                    $("#pop").hide();

                }
                else {
                    $("#tex").hide();
                    $("#pop").show();
                }


            });

    </script>

    
    <hr />






    

    

    <asp:GridView ID="GridView1" AutoGenerateColumns="False"  
    DataKeyNames="id" runat="server" class="layui-table" 
         GridLines="None"  AllowPaging="false"
         DataSourceID="sds"
    >
    <HeaderStyle BackColor="#f5f5f5" />
    <Columns>
   
     
    <asp:BoundField DataField="id"  ReadOnly="true"  HeaderText="ID" HeaderStyle-Width="60px" InsertVisible="False" /> 
   <asp:BoundField DataField="toolbartext"  ControlStyle-CssClass="layui-input"  HeaderText="工具栏名"   HeaderStyle-Width="150px"  />

   <asp:BoundField DataField="toolbarvalue" HeaderText="工具栏值"   ControlStyle-CssClass="layui-input"   HeaderStyle-Width="260px" />
  


        
     <asp:TemplateField>
         <HeaderTemplate>类型</HeaderTemplate>

         <ItemTemplate> 
             <%#Eval("types").ToString()=="tex"?"LaTex":"弹窗" %>
             </ItemTemplate>
         </asp:TemplateField>




        
   <asp:BoundField DataField="orderid"   HeaderText="顺序ID"  ControlStyle-CssClass="layui-input"  HeaderStyle-Width="100px" />

         
  
     <asp:TemplateField>
         <HeaderTemplate>显示效果</HeaderTemplate>

         <ItemTemplate> 

            
             <%#Eval("types").ToString()=="tex"? ("$"+Eval("toolbarvalue")+"$"):"" %>
             </ItemTemplate>
         </asp:TemplateField>




 
 
          <asp:TemplateField>
         <HeaderTemplate>是否启用</HeaderTemplate>

         <ItemTemplate> 
             <input type="checkbox"  ID="cb_isuse" value="<%#Eval("id") %>" 
                 <%#Eval("isuse").ToString()=="1"?"checked":"" %>
                 lay-filter="item-isuse"  lay-skin="primary"  /> 
         </ItemTemplate>
         
         <EditItemTemplate>

         </EditItemTemplate>
     </asp:TemplateField>   

      

          <asp:TemplateField>
         <HeaderTemplate>块级元素</HeaderTemplate>

         <ItemTemplate> 
             <div  <%#Eval("types").ToString()=="tex"?"":"class=hd" %> > 
            
             <input type="checkbox"  ID="cb_isblock" value="<%#Eval("id") %>" 
                 <%#Eval("isblock").ToString()=="1"?"checked":"" %>
                 lay-filter="item-isblock"  lay-skin="primary"  /> 
                  </div>
         </ItemTemplate>
         
         <EditItemTemplate>

         </EditItemTemplate>
     </asp:TemplateField>   

   



          <asp:TemplateField>
 <HeaderStyle Width="120" />
         <HeaderTemplate>操作</HeaderTemplate>
         <ItemTemplate>
      
 
         <asp:LinkButton runat="server" ID="btnEdit" CssClass="layui-btn layui-btn-sm" CommandName="Edit" Text="编辑" ></asp:LinkButton> 

        <asp:LinkButton runat="server" ID="btnDel" CssClass="layui-btn layui-btn-danger layui-btn-sm" CommandName="Delete" Text="删除" OnClientClick="return confirm('确定要删除吗？');"></asp:LinkButton>
        
         </ItemTemplate>
 
         <EditItemTemplate>
 
          <asp:LinkButton runat="server" CssClass="layui-btn  layui-btn-sm" CausesValidation="false" ID="lbUpdate" CommandName="Update" Text="更新" ></asp:LinkButton>
           <asp:LinkButton runat="server" CssClass="layui-btn layui-btn-primary layui-btn-sm"  CausesValidation="false" ID="lbCanel" CommandName="Cancel" Text="取消" ></asp:LinkButton>

         </EditItemTemplate>
 
         </asp:TemplateField>











    </Columns>
      
    </asp:GridView>



    <asp:SqlDataSource ID="sds" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
         DeleteCommand="DELETE FROM [math_toolbar] WHERE [id] = @id" 
         SelectCommand="SELECT * from math_toolbar     order by isuse desc, orderid asc, id asc  " 
         UpdateCommand="UPDATE [math_toolbar] SET [toolbartext] = @toolbartext,  [toolbarvalue] = @toolbarvalue, [orderid] = @orderid  WHERE [id] = @id" 
         
    > 
    
    
    </asp:SqlDataSource>


     

     <script>


         layui.use('form', function () {
             var form = layui.form;

             form.on('checkbox(item-isuse)', function (data) {
                 var isuse = data.elem.checked ? "1" : "0";
                 var id = data.value;
                 $.get("menu_toolbar.aspx?t=isuse&id=" + id + "&isuse=" + isuse + "&r=" + Math.random());
                 layer.msg("更新成功");

             });


             form.on('checkbox(item-isblock)', function (data) {
                 var isblock = data.elem.checked ? "1" : "0";
                 var id = data.value;
                 $.get("menu_toolbar.aspx?t=isblock&id=" + id + "&isblock=" + isblock + "&r=" + Math.random());
                 layer.msg("更新成功");

             });

         });



    </script>


</asp:Content>

