@using System.Linq;
<div class="box">
    <div class="left topmenu" id="topmenu">
        <ul>
            <li class="item home-item" title="后台首页"><a href="@Url.ActionUrl("Home")" target="mainContainer"><i class="glyphicon glyphicon-home"></i></a></li>
            @{
                CurrentUser currentUser = (CurrentUser)ViewData["CurrentUser"];
                int SiteId= (int)ViewData["SiteId"];
                int maxShow =7;

                IEnumerable<dynamic> menuList = (IEnumerable<dynamic>)ViewData["MenuList"];
                menuList = menuList.Where(item => item.Level == 1).OrderBy(item => item.Xuhao);
                int rowsCount = menuList.Count();
                int i = 0;
                foreach (var item in menuList)
                {
                    if (i < maxShow)
                    {
                        <li class="item menu-item" date-top-menu-id="@item.Id"><span>@item.Name</span></li>
                    }
                    i++;
                }
                i = 0;
                if (maxShow < rowsCount)
                {
                    <li class="item dropdown dropdown-hover menu-item">
                        <span class="dropdown-toggle" data-toggle="dropdown">
                            更多<b class="caret"></b>
                        </span>
                        <ul class="dropdown-menu">
                            @foreach (var item in menuList)
                            {
                                if (i >= maxShow)
                                {
                                    <li class="menu-item" date-top-menu-id="@item.Id"><i class="glyphicon glyphicon-chevron-right"></i><span>@item.Name</span></li>
                                }
                                i++;
                            }
                        </ul>
                    </li>
                }
            }
        </ul>
    </div>
    <div class="right">
        <ul>
            <li class="item item-webhome" title="网站首页" data-toggle="tooltip" data-placement="bottom"><a href="/E/Preview/Site?id=@SiteId" target="_blank"><i class="glyphicon glyphicon-globe"></i></a></li>
            <li class="item item-restart" title="重启进程" data-toggle="tooltip" data-placement="bottom"><a href="javascript:void(0)" onclick="RestartApplication()"><span class="glyphicon glyphicon-repeat"></span></a></li>
            <li class="item item-shopping-cart hidden" title="我的购物车" data-toggle="tooltip" data-placement="bottom"><a href="#"><span class="glyphicon glyphicon-shopping-cart"></span><span class="badge"></span></a></li>
            <li class="item item-msg hidden" title="我的信息" data-toggle="tooltip" data-placement="bottom"><a href="#"><span class="glyphicon glyphicon-bell"></span><span class="badge"></span></a></li>
            <li class="item item-mylogin dropdown dropdown-hover">
                <a class="dropdown-toggle" data-toggle="dropdown">&nbsp;&nbsp;<span class="glyphicon glyphicon-user"> </span>账户中心<b class="caret"></b></a>
                <ul class="dropdown-menu pull-right">
                    <li><a href="javascript:void(0)" onclick="SelectSite('@Url.ActionUrl("SetCurrentSite","Site")?pagesize=10')"><i class="glyphicon glyphicon-retweet"></i>网站切换</a></li>
                    <li><a href="#" onclick="Exit()"><i class="glyphicon glyphicon-off"></i>退出登录</a></li>
                    <li class="divider"></li>
                    <li><a href="@Url.ActionUrl("Home","Default")"><i class="glyphicon glyphicon-home"></i>后台首页</a></li>
                    <li><a href="@UserApiHelper.LoginUrl(false)"  target="_blank"><i class="glyphicon glyphicon-link"></i>会员中心</a></li>
                    <li><a href="http://bbs.pageadmin.net" target="_blank"><i class="glyphicon glyphicon-link"></i>交流论坛</a></li>
                    <li><a href="http://www.pageadmin.net" target="_blank"><i class="glyphicon glyphicon-link"></i>官方网站</a></li>
                </ul>
            </li>
        </ul>
    </div>
</div>
<script>
    var $tooltip = $("[data-toggle='tooltip']");
    $(function () { $tooltip.tooltip(); });
    //$(".newNotice").tooltip('show');
    function RestartApplication() {
        Loading();
        var url = "@Url.ActionUrl("RestartApplication")";
        var Data = Ajax({ type: "post", async: true, url: url }, function () {
            CloseLoading();
            Msg("重启成功！");
        });
    }

    function Exit()
    {
        Msg("loading...")
        var url = "@Url.ActionUrl("Exit")";
        var Data = Ajax({ type: "get", async: true, url: url }, function () {
            location.href = location.href;
        });
    }
</script>

