<!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>
<script src="/static/js/jquery.floatheading.min.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");
}
$(function () {
    $('#accordion').floatheading({ paddingTop : 50});
});
</script>
${self.head()}
</head>
<%
def inpath(req,menu):
    _path = req.fullpath
    if _path.endswith("/"):
        _path = _path[:-1]
    return _path in [ it['path'] for it in menu['items'] ]

def aclass(req,path):
    _path = req.fullpath
    if _path.endswith("/"):
        _path = _path[:-1]
    return _path==path and 'sl-active' or ''
%>

        <body>
        <div class="navbar  navbar-inverse navbar-fixed-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="/dashboard">控制面板</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
                % if permit.match('/backup'):
                <li><a href="/backup">备份管理</a></li>
                 % endif
                <li><a href="javascript:clean_cache();">刷新缓存</a></li>
                <li><a target="_blank" href="http://support.toughstruct.com" style="text-decoration:none;">技术支持</a></li>
                <li><a href="/logout">(${get_cookie("username")}) 退出</a></li>
              </ul>
            </div><!--/.nav-collapse -->
          </div>
        </div>
        <div class="container">
            <div class="row">
                <div class="col-md-2 " id="sidebar">

                  <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="false">
                      <div class="logo-box">
                          <a target="_blank" href="http://www.toughradius.net"><img
                                  src="/static/img/toughradius-logo.png"></a>
                      </div>
                    % for menu in all_menus:
                    % if permit.check_opr_category(get_cookie('username'),menu['category']):
                    <div class="panel panel-default">
                        <div class="panel-heading" role="tab" id="accordion${loop.index}">
                          <h4 class="panel-title">
                            <a data-toggle="collapse" data-parent="#accordion" href="#collapse${loop.index}" aria-expanded="true" aria-controls="collapse${loop.index}">
                                <span class="glyphicon glyphicon-cog" aria-hidden="true"></span> 
                              ${menu['category']}
                            </a>
                          </h4>
                        </div>
                        <div id="collapse${loop.index}" 
                        class="panel-collapse collapse ${inpath(request,menu) and 'in' or ''}" 
                        role="tabpanel" aria-labelledby="heading${loop.index}">
                            <div class="panel-body sidelinks">
                                  % for item in sorted(menu['items'],key=lambda r:r['order']):
                                      % if item['is_menu'] and permit.match(item['path']):
                                      <li class="${aclass(request,item['path'])}">
                                        <a href="${item['path']}">${item['name']}</a>
                                      </li>
                                      % endif
                                  % endfor
                             </div>
                        </div>
                      </div>
                    % endif
                    % endfor   
                    </div>                                         
            </div>
            <div class="col-md-10 main-box">
                ${self.body()}
            </div>
        </div>
    </div>
    </div>
        % if sys_param_value('online_support') == '1':
        <!-- Start of KF5 supportbox script -->
        <script src="//assets.kf5.com/supportbox/main.js" id="kf5-provide-supportBox" kf5-domain="hts.kf5.com"></script>
        <!-- End of KF5 supportbox script -->
        % endif
    </body>
</html>