<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Admin/AdminMain.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
    <link href="../../Scripts/flora/flora.all.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .AdminMenus {
            width: 200px;
            height: 20px;
            float: left;
        }
    </style>
    <script src="../../Scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script src="../../Scripts/ui.core.js" type="text/javascript"></script>
    <script src="../../Scripts/ui.tabs.js" type="text/javascript"></script>
    <script src="../../Scripts/Admin.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.loading.js" type="text/javascript"></script>
    <script src="../../Scripts/category.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function() { $('#tables > ul').tabs(); });
    </script>
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    管理权限
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <table width="100%">
        <tr>
            <th colspan="2">
                权限管理：选择管理员进行操作
            </th>
        </tr>
        <tr>
            <td align="center" width="100" valign="top" style="white-space: nowrap">
                现有管理员：
                <ul style="text-align: left">
                    <%
                        string AdminName = Request.QueryString["AdminName"];
                        var AdminUsers = new AdminService().GetAll().Where(m => m.AdminName != "admin");
                        if (AdminUsers.Count() == 0)
                        {
                            Response.Write("请先<a href='AdminEdit'>添加管理员</a>");
                        }
                        else
                        {
                            foreach (var adminuser in AdminUsers)
                            {
                                Response.Write("<li>");
                                if (AdminName == adminuser.AdminName + ",")
                                {
                                    Response.Write("<font color='#ff0000'>" + adminuser.AdminName + "</font>");
                                }
                                else
                                {
                                    Response.Write("<a href='?AdminName=" + adminuser.AdminName + ",'>" + adminuser.AdminName + "</a>");
                                }
                                Response.Write("</li>");
                            }
                        }
                    %>
                </ul>
            </td>
            <td align="left">
                <%if (!string.IsNullOrEmpty(AdminName))
                  {%>
                <form method="post" id="formSave" action="?AdminName=<%=AdminName%>">
                <div id="tables">
                    <ul>
                        <li><a href="#fragment-1">
                            <span>综合权限</span></a></li>
                        <li><a href="#fragment-2">
                            <span>新闻类别</span></a></li>
                        <li><a href="#fragment-3">
                            <span>产品类别</span></a></li>
                        <li><a href="#fragment-6">
                            <span>下载类别</span></a></li>
                    </ul>
                    <div id="fragment-1">
                        <%= new CategoryService<DataSet1.AdminMenusSortRow,DataSet1.ValidationAdminMenusSort>(new AdminMenusSortService()).ShowCategoryForAdminPurview(1,AdminName) %>
                        <br class="clearfloat" />
                    </div>
                    <div id="fragment-2">
                        <%= new CategoryService<DataSet1.ArticleSortRow,DataSet1.ValidationArticleSort>(new ArticleSortService()).ShowCategoryForAdminPurview(1,AdminName) %>
                        <br class="clearfloat" />
                    </div>
                    <div id="fragment-3">
                        <%= new CategoryService<DataSet1.ProductSortRow, DataSet1.ValidationProductSort>(new ProductSortService()).ShowCategoryForAdminPurview(1, AdminName)%>
                        <br class="clearfloat" />
                    </div>
                    <div id="fragment-6">
                        <%= new CategoryService<DataSet1.DownloadSortRow, DataSet1.ValidationDownloadSort>(new DownloadSortService()).ShowCategoryForAdminPurview(1, AdminName)%>
                        <br class="clearfloat" />
                    </div>
                    <br class="clearfloat" />
                </div>
                <p><input type="submit" value="保 存" /></p>
                </form>
                <%}%>
            </td>
        </tr>
    </table>
</asp:Content>

