{layout:default} {class:Shop.admin.plugin.weinxin._default}
<lbhead>
    <title>
        <%=Tag("微信管理") %>-<%=site.title%></title>
</lbhead>
<lbfile>
    <style>
        .bottom{height: 0;overflow: hidden;display: none;}
    </style>
</lbfile>
<lbpath>
    <div class="tools">
        <ul>
            <%if (PageReturnMsg == ""){%>
            <li class="add"><a href="javascript:void(0);" onclick="Edit(0,0);"><b></b><span><%=Tag("添加")%></span></a></li>
            <li class="edit"><a href="javascript:void(0);" onclick="down();"><b></b><span><%=Tag("从微信下载")%></span></a></li>
            <li class="edit"><a href="javascript:void(0);" onclick="publish();"><b></b><span><%=Tag("提交至微信")%></span></a></li>
            <%}%>
            <li class="name"><span id="navIgation">
                <%=Tag("当前位置")%>：<a href="<%=site.AdminPath %>/Ajax/ajax_admin.aspx?__Action=MenuJump&pid=0"><%=Tag("管理首页")%></a>
                >
                <%=Tag("微信管理")%></span></li>
        </ul>
    </div>
</lbpath>
<lbbody>
    <table class="datalist">
        <tr class="title">
            <th style="width: 200px">
                <%=Tag("名称")%>
            </th>
            <th style="width: 400px">
                <%=Tag("链接")%>
            </th>
            <th style="width: 80px">
                <%=Tag("排序")%>
            </th>
            <th>
                <%=Tag("操作")%>
            </th>
        </tr>
        <%foreach (DB.LebiShop.Lebi_weixin_menu pm in GetwxMenus(0))
            { %>
            <tr class="list" ondblclick="Edit(<%=pm.parentid %>,<%=pm.id %>);">
                <td><img style="cursor: pointer; text-align: center; vertical-align:absmiddle"  src="<%=AdminImage("plus.gif") %>"> <%=pm.name %></td>
                <td><%=pm.url %></td>
                <td><%=pm.Sort %></td>
                <td>
                    <a href="javascript:void(0)" onclick="Edit(<%=pm.parentid %>,<%=pm.id %>);"><%=Tag("编辑")%></a> 
                    | <a href="javascript:void(0)" onclick="Edit(<%=pm.id %>,0);"><%=Tag("添加下级")%></a> 
                    | <a href="javascript:void(0)" onclick="Del(<%=pm.id %>);"><%=Tag("删除")%></a> 
                </td>
            </tr>
            <%foreach (DB.LebiShop.Lebi_weixin_menu m in GetwxMenus(pm.id))
                { %>
                <tr class="list" ondblclick="Edit(<%=m.parentid %>,<%=m.id %>);">
                    <td>&nbsp;&nbsp;&nbsp;<img style="cursor: pointer; text-align: center; vertical-align:absmiddle" src="<%=AdminImage("minus.gif") %>"> <%=m.name %></td>
                    <td><%=m.url %></td>
                    <td><%=m.Sort %></td>
                    <td>
                        <a href="javascript:void(0)" onclick="Edit(<%=m.parentid %>,<%=m.id %>);"><%=Tag("编辑")%></a> 
                        | <a href="javascript:void(0)" onclick="Del(<%=m.id %>);"><%=Tag("删除")%></a> 
                    </td>
                </tr>
            <%} %>
        <%} %>
    </table>
</lbbody>
<lbbottom>
    <div class="bottom" id="body_bottom">
    </div>
    <script type="text/javascript">
        function Del(id) {
            if (!confirm("<%=Tag("确认要删除吗？")%>")){
                return false;
            }
            var postData;
            postData = { "id": id };
            var url = "ajax.aspx?__Action=Menu_Del";
            RequestAjax(url,postData,function(res){MsgBox(1, "<%=Tag("操作成功")%>", "?")});
        }
        function Edit(pid, id) {
            var title_ = "<%=Tag("编辑菜单")%>";
            var url_ = "menu_edit_window.aspx?pid=" + pid + "&id=" + id;
            var width_ = 600;
            var height_ = "auto";
            var modal_ = true;
            EditWindow(title_, url_, width_, height_, modal_);
        }
        function publish()
        {
            if (!confirm("<%=Tag("确认要提交吗？")%>")){
                return false;
            }
            var url = "ajax.aspx?__Action=Menu_publish";
            RequestAjax(url,'',function(res){MsgBox(1, "<%=Tag("操作成功")%>", "?")});
        }
        function down()
        {
            if (!confirm("确认操作，并覆盖本地菜单吗？")){
                return false;
            }
            var url = "ajax.aspx?__Action=Menu_download";
            RequestAjax(url,'',function(res){MsgBox(1, "<%=Tag("操作成功")%>", "?")});
        }
    </script>
</lbbottom>
