<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="/static/favicon.ico"/>
<title>${sys_param_value('system_name') or ''}</title>
<link href="/static/css/bootstrap.min.css" rel="stylesheet" media="all">
<link href="/static/css/manage.css" rel="stylesheet" media="all">     
<script src="/static/js/jquery-1.11.0.min.js"></script>
<script src="/static/js/bootstrap.min.js"></script>
<script src="/static/js/json2.js"></script>
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]>
<script src="/static/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="/static/js/html5shiv.min.js"></script>
<script src="/static/js/respond.min.js"></script>
<![endif]-->
<script>
function clean_cache()
{
    $.get("/cache/clean", {}, function (data) {
        alert(data.msg)
    },"json");
}
</script>
${self.head()}
</head>
        <body>
        <div class="navbar  navbar-inverse navbar-static-top" role="navigation">
          <div class="container">
            <div class="navbar-header">
              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
              </button>
              <a class="navbar-brand" href="/">${sys_param_value('system_name') or ''}</a>
            </div>
            <div class="navbar-collapse collapse">
              <ul class="nav navbar-nav navbar-right">
                <li><a href="/">管理首页</a></li>
                <li><a href="/passwd">修改密码</a></li>
                 % if permit.match('/logquery/radiusd'):
                <li class="dropdown">
                  <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">系统日志 <span class="caret"></span></a>
                  <ul class="dropdown-menu" role="menu">
                    <li><a href="/logquery/radiusd">Radius认证计费系统日志</a></li>
                    <li><a href="/logquery/admin">Radius管理系统日志</a></li>
                    <li><a href="/logquery/customer">Radius自助服务系统日志</a></li>
                  </ul>
                </li>
                % endif
                <li><a href="javascript:clean_cache();">刷新缓存</a></li>
                <li><a href="/logout">退出</a></li>
              </ul>
            </div><!--/.nav-collapse -->
          </div>
        </div>
        <div class="container">
            <div class="row">
                <div class="col-md-2 " id="sidebar">
                    % for menu in all_menus:
                    % if permit.check_opr_category(get_cookie('username'),menu['category']):
                     <div class="accordion" id="accordion${loop.index}">
                         <div class="accordion-group">
                             <div class="accordion-heading left-header">
                             <span class="glyphicon glyphicon-play-circle"></span>
                             <a class="accordion-toggle" data-toggle="collapse" 
                                 data-parent="#accordion${loop.index}"
                                  href="#collapse${loop.index}">${menu['category']}</a>
                             </div>
                             <div id="collapse${loop.index}" class="accordion-body collapse in">
                                 <div class="accordion-inner ">
                                    % for item in sorted(menu['items'],key=lambda r:r['order']):
                                        % if item['is_menu'] and permit.match(item['path']):
                                        <li><a href="${item['path']}">${item['name']}</a></li>
                                        % endif
                                    % endfor
                                    </div>
                                </div>
                            </div>
                        </div>
                    % endif
                    % endfor                                            
            </div>
            <div class="col-md-9 main-box">
                ${self.body()}
            </div>
        </div>
    </div>
        <div id="footer">
            <div class="container">
            <p class="text-muted">© 2014 toughradius.net</p>
        </div>
    </div>
    </body>
</html>