<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="FrontMenu_List.aspx.cs" Inherits="RM.Web.RMBase.SysFrontMenu.FrontMenu_List" %>
<%@ Register Src="/UserControl/LoadButton.ascx" TagName="LoadButton" 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 runat="server">
   <title><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Menu_List")%></title>
    <link href="/Themes/Styles/Site.css" rel="stylesheet" type="text/css" />
    <link href="/Themes/Styles/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="/Training/AskVolume/js/jquery-1.11.3.min.js"></script>
    <script src="/Themes/Scripts/bootstrap.min.js" type="text/javascript"></script>
      <script src="/Themes/Scripts/jquery.minicolors.js" type="text/javascript"></script>    
    <link href="/Themes/Styles/jquery.minicolors.css" rel="stylesheet" type="text/css" />
    <script src="/Themes/Scripts/TreeTable/jquery.treeTable.js" type="text/javascript"></script>
    <link href="/Themes/Scripts/TreeTable/css/jquery.treeTable.css" rel="stylesheet" type="text/css" />
    <script src="/Themes/Scripts/FunctionJS.js" type="text/javascript"></script>
    
  
    <script type="text/javascript">
        $(function () {
            divresize(63);
            FixedTableHeader("#dnd-example", $(window).height() - 91);
            FixedTableHeader("#dnd-example1", $(window).height() - 91);
            GetClickTableValue();
            $('#dnd-example').show();
            $("#dnd-example1").hide();
            $("#table1").hide();
        })
        /**
        获取table TD值
        主键ID
        column:列名
        **/
        var Menu_Id = '';
        function GetClickTableValue() {
            $('table tr').not('#td').click(function () {
                $(this).find('td').each(function (i) {
                    if (i == 7) {
                        Menu_Id = $(this).text();                       
                    }
                });
            });
            $("#dnd-example1").treeTable({
                initialState: "collapsed" //collapsed 收缩 expanded展开的
            });             
            $("#dnd-example").treeTable({
                initialState: "collapsed" //collapsed 收缩 expanded展开的
            }); 
            $("#dnd-example1 tr").click(function () {
                $('#dnd-example1 tr').removeClass("selected");
                $(this).addClass("selected"); //添加选中样式   
            });
        }
        //新增
        function add() {
            var menu_t= $("#menu_t").val();
            var url = "/RMBase/SysFrontMenu/FrontMenu_Form.aspx?ParentId=" + Menu_Id + "&menu_t="+menu_t;
            top.openDialog(url, 'FrontMenu_Form', '<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Menu_List")%>', 450, 280, 50, 50);
        }
        //编辑
        function edit() {
            var key = Menu_Id;            
            var menu_t= $("#menu_t").val();
            if (IsEditdata(key)) {
                var url = "/RMBase/SysFrontMenu/FrontMenu_Form.aspx?key=" + key + "&menu_t="+menu_t;
                top.openDialog(url, 'FrontMenu_Form', '<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Menu_List")%>', 450, 280, 50, 50);
            }
        }
         //删除
        function Delete() {
            var key = Menu_Id;
            if (IsDelData(key)) {
                var isExistparm = 'action=IsExist&tableName=Base_FrontMenu&clName=Menu_Id&pkName=ParentId&pkVal=' + key;
                var result = IsExist_Data('/Ajax/Common_Ajax.ashx', isExistparm, "type");
                var delparm;
                var menu_t= $("#menu_t").val();
                var module = "";
                if(menu_t == "1")
                {
                    module = "<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("FrontXYCD")%>";
                }
                else
                {
                    module = "<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("FrontWXCD")%>";
                }
                if (result && result.length > 0) {
                    delparm = 'action=Virtualdelete&module='+module+'&tableName=Base_FrontMenu&pkName=Menu_Id&pkVal=' + (result += ('' + key));
                    delConfig('/Ajax/Common_Ajax.ashx', delparm, "<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("FrontTS")%>");
                } else {
                    delparm = 'action=Virtualdelete&module='+module+'&tableName=Base_FrontMenu&pkName=Menu_Id&pkVal=' + key;
                    delConfig('/Ajax/Common_Ajax.ashx', delparm);
                }
            }
        }
        //面板
        function panel(obj) {
            if (obj == 1) {
                $('#dnd-example').show();
                $("#dnd-example1").hide();
                $("#table1").hide();
                $("#menu_t").val("0");                
            } else if (obj == 2) {
                $('#dnd-example').hide();
                $("#dnd-example1").show();
                $("#table1").hide();
                $("#menu_t").val("1");                
            } else if (obj == 3) {
                $('#dnd-example').hide();
                $("#dnd-example1").hide();
                $("#table1").show();                           
            }
            Menu_Id = 0; //父级清除
            $('.example tr').removeClass("selected");
        }        
        function GetTabClick(e) {
            Loading(true);
            $(".menutab div").each(function () {
                this.className = "Tabremovesel";
            });
            e.className = "Tabsel";
            Loading(false);
        }
        //是否显示
        function EditShow(obj,id,flag){                          
            getAjax("FrontMenu_List.ashx", "action=IsShow&menu_id="+id+"&flag="+flag, function (rs) {
                if(rs >0)
                {
                    if(flag == 0)
                    {
                        $(obj).attr("onclick","EditShow(this,'"+id+"',1)");
                        $(obj).children().attr("src","/Themes/images/sex_null.png");                        
                    }
                    else
                    {
                        $(obj).attr("onclick","EditShow(this,'"+id+"',0)");
                        $(obj).children().attr("src","/Themes/images/sex_man.png");
                    }
                 }
            });                        
        }
        //颜色
         $(document).ready(function () {

	        $('.demo').each(function () {
	            //
	            // Dear reader, it's actually very easy to initialize MiniColors. For example:
	            //
	            //  $(selector).minicolors();
	            //
	            // The way I've done it below is just for the demo, so don't get confused 
	            // by it. Also, data- attributes aren't supported at this time...they're 
	            // only used for this demo.
	            //
	            $(this).minicolors({
	                control: $(this).attr('data-control') || 'hue',
	                defaultValue: $(this).attr('data-defaultValue') || '',
	                inline: $(this).attr('data-inline') === 'true',
	                letterCase: $(this).attr('data-letterCase') || 'lowercase',
	                opacity: $(this).attr('data-opacity'),
	                position: $(this).attr('data-position') || 'bottom left',
	                change: function (hex, opacity) {
	                    if (!hex) return;
	                    if (opacity) hex += ', ' + opacity;
	                    try {
	                        console.log(hex);
	                    } catch (e) { }
	                },
	                theme: 'bootstrap'
	            });

	        });

	    });
    </script>
    <style type="text/css">
    .imgtree{display:none;}
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div class="btnbartitle">
        <div>
            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Menu_List")%> &nbsp;&nbsp;<span style="color: Red;"><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("AppendProperty_Form_zysy")%><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("FrontWXTS")%></span>
        </div>
    </div>
    <div class="btnbarcontetn">
        <div style="float: left;">
            <table style="padding: 0px; margin: 0px; height: 100%;" cellpadding="0" cellspacing="0">
                <tr>
                    <td class="menutab" style="vertical-align: bottom;">
                        <div id="tab0" class="Tabsel" onclick="GetTabClick(this);panel(1)">
                            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("FrontWXCD")%></div>
                    </td>
                    <td class="menutab" style="vertical-align: bottom;">
                        <div id="tab2" class="Tabremovesel" onclick="GetTabClick(this);panel(2)">
                            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("FrontXYCD")%></div>
                    </td>
                    <td class="menutab" style="vertical-align: bottom;">
                        <div id="tab3" class="Tabremovesel" onclick="GetTabClick(this);panel(3)">
                            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("NavZTYS")%></div>
                    </td>
                </tr>
            </table>
        </div>
        <div style="text-align: right">
            <uc1:LoadButton ID="LoadButton1" runat="server" />
        </div>
    </div>
    <input type="hidden" value="0" id="menu_t"/>
    <div class="div-body">
        <table class="example" id="dnd-example">
            <thead>
                <tr>
                    <td style="width: 200px; padding-left: 20px;">
                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Menu_Form_name")%>
                    </td>
                    <td style="width: 30px; text-align: center;display:none;">
                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Button_List_ico")%>
                    </td>
                    <td style="width: 60px; text-align: center;">
                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("FrontSFXS")%>
                    </td>
                    <td style="width: 60px; text-align: center;">
                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Type")%>
                    </td>                                        
                    <td style="width: 60px; text-align: center;">
                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Menu_Form_mubiao")%>
                    </td>
                    <td style="width: 60px; text-align: center;">
                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Button_Form_shunxu")%>
                    </td>
                    <td>
                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Menu_Form_ljdz")%>
                    </td>
                </tr>
            </thead>
            <tbody>     
            <%=TableTree_Menu.ToString()%>          
                 
            </tbody>
        </table>
        <table class="example" id="dnd-example1">
            <thead>
                <tr>
                    <td style="width: 200px; padding-left: 20px;">
                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Menu_Form_name")%>
                    </td>
                    <td style="width: 30px; text-align: center;display:none;">
                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Button_List_ico")%>
                    </td>
                    <td style="width: 60px; text-align: center;">
                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("FrontSFXS")%>
                    </td>
                    <td style="width: 60px; text-align: center;">
                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Type")%>
                    </td>                                        
                    <td style="width: 60px; text-align: center;">
                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Menu_Form_mubiao")%>
                    </td>
                    <td style="width: 60px; text-align: center;">
                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Button_Form_shunxu")%>
                    </td>
                    <td>
                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Menu_Form_ljdz")%>
                    </td>
                </tr>
            </thead>
            <tbody>     
               <%=TableTree_StuMenu.ToString()%>      
            </tbody>
        </table>


        <table id="table1" border="0" cellpadding="0" cellspacing="0" class="frm" style="">
            <tr>
                <td style="width: 200px; text-align: right;">
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("NavZTYS")%>:
                </td>
                <td>
                    <input id="ColID" maxlength="35" runat="server" type="text" class="form-control demo"
                        datacol="yes" err="颜色值" checkexpession="NotNull" style="width: 200px" data-control="wheel" />
                </td>
            </tr>
            <tr>
                <td style="width: 200px; text-align: right;">
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("NavFTYS")%>:
                </td>
                <td>
                    <input id="FonID" maxlength="35" runat="server" type="text" class="form-control demo"
                        datacol="yes" err="颜色值" checkexpession="NotNull" style="width: 200px" data-control="wheel" />
                </td>
            </tr>
            <tr>
                <td style="width: 200px; text-align: right;">
                    <input id="Res" runat="server" type="checkbox" />
                </td>
                <td>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("NavHYZT")%>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <div class="frmbottom">
                        <asp:LinkButton ID="Save" runat="server" class="l-btn" OnClientClick="editor.sync(); return CheckDataValid('#form1');"
                            OnClick="Save_Click"><span class="l-btn-left">
            <img src="/Themes/Images/disk.png" alt="" /><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Save")%></span></asp:LinkButton>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
