## -*- coding: utf-8 -*-
<%!
    from baruwa.lib.filters import totals
    from pylons.i18n.translation import set_lang, get_lang
    from baruwa import __version__ as baruwaversion, __copyright__ as baruwacopyr
%>
<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta http-equiv='Pragma' content='no-cache'>
		<meta http-equiv='Cache-Control' content='no-cache'>
        <title>.:. ${config.get('baruwa.custom.name', 'Baruwa')} :: ${next.title()}</title>
        <meta name="description" content="Baruwa Enterprise Edition Leading Spam protection, Virus protection Email Security software">
        <meta name="author" content="Andrew Colin Kissa">
        <meta name="viewport" content="width=device-width">
        % if 'lang' in session and session['lang'] and session['lang'] in ['ar', 'he', 'ur', 'fa']:
		<link rel="stylesheet" href="${h.media_url()}css/vendor/bs-rl.min.css">
        <link rel="stylesheet" href="${h.media_url()}css/vendor/bsr-rl.min.css">
		<link rel="stylesheet" href="${h.media_url()}css/vendor/fa-rl.min.css" />
        <link rel="stylesheet" href="${h.media_url()}css/baruwa-rl.css">
	    <style>body {direction: rtl;} </style>
		% else:
		<link rel="stylesheet" href="${h.media_url()}css/vendor/bs.min.css">
        <link rel="stylesheet" href="${h.media_url()}css/vendor/bsr.min.css">
		<link rel="stylesheet" href="${h.media_url()}css/vendor/fa.min.css" />
        <link rel="stylesheet" href="${h.media_url()}css/baruwa.min.css">
	    % endif
        ${h.javascript_link(h.media_url() + 'js/vendor/modernizr-2.6.2-respond-1.1.0.min.js')}
        <link rel="apple-touch-icon-precomposed" sizes="144x144" href="${h.media_url()}imgs/apple-touch-icon-144-precomposed.png">
	    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="${h.media_url()}imgs/apple-touch-icon-114-precomposed.png">
	    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="${h.media_url()}imgs/apple-touch-icon-72-precomposed.png">
	    <link rel="apple-touch-icon-precomposed" href="${h.media_url()}imgs/apple-touch-icon-57-precomposed.png">
		<link rel="icon" href="${h.media_url()}imgs/favicon.ico" type="image/x-icon" />
		<link rel="shortcut icon" href="${h.media_url()}imgs/favicon.ico" type="image/x-icon" />
		<script type="text/javascript">
		var media_url = "${h.media_url()}";
		% if 'lang' in session and session['lang']:
		var baruwalang = "${session['lang']}";
		% else:
		var baruwalang = 'en';
		% endif
		</script>
		${h.javascript_link(h.media_url() + 'js/vendor/jquery.min.js',
		h.media_url() + 'js/vendor/jquery.mustache.min.js',
		h.media_url() + 'js/vendor/bootstrap.min.js',
		url('jsi18n'),
		h.media_url() + 'js/baruwa/common.min.js')}
		${next.headers()}\
    </head>
    <body>
        <div id="wrap">
            <div class="container-fluid" id="header">
                <div class="row-fluid">
                    <div class="span1 hidden-phone"></div>
                    <div class="span10">
                        <div class="row-fluid">
                            <div class="span4">
                                ${h.link_to(h.portable_img('imgs/logo.png', config.get('baruwa.custom.name', 'Baruwa'), class_='brand'), url('home'))}
                            </div>
                            <div class="span8">
                                <ul>
                    				% if c.user.is_admin:
                    				<li>
                    				    <a href="${url(controller='status')}">
                    				        % if hasattr(c, 'baruwa_status') and c.baruwa_status:
        									<i class="icon-ok green"></i>
        									<span class="badge badge-success">OK</span>
        									% else:
        									<i class="icon-remove red"></i>
        									<span class="badge badge-important">ERROR</span>
        									% endif
                    				    </a>
                    				</li>
                    				% endif
                    				% if hasattr(c, 'baruwa_totals'):
                    				<li class="hidden-phone">
                    					${_('Total ')}<span class="badge badge-info mtotal" id="mtotal">${totals(c.baruwa_totals.total)}</span>
                    					${_('Spam ')}<span class="badge badge-highspam" id="shighspamtotal">${totals(c.baruwa_totals.spam)}</span>
                    					${_('Virus ')}<span class="badge badge-virii" id="svirustotal">${totals(c.baruwa_totals.virii)}</span>
                    				</li>
                    				<li>${_('In: ')}
                    				    <a href="${url('mailq-status-directed', queue='inbound')}">
                    				        <span class="badge badge-info" id="inq">${c.baruwa_inbound}</span>
                    				    </a>
                    					${_('Out: ')}
                    					<a href="${url('mailq-status-directed', queue='outbound')}">
                    					    <span class="badge badge-info" id="outq">${c.baruwa_outbound}</span>
                    					</a>
                    				</li>
                    				% endif
                    				% if c.user:
                    				<li>
                    				    <a class="user-menu dropdown-toggle" href="${url('account-detail', userid=c.user.id)}">
                    				        <i class="icon-user"></i>
        									<span id="user_info">
        										<small>${_('Signed in as, ')}</small>
        										${c.user.username}
        									</span>
        								</a>
                    				</li>
                    				<li><a href="${url('/logout')}"><i class="icon-off"></i> ${_('Logout')}</a></li>
                    				% else:
                    				<li>${_('Not logged in :: ')}${h.link_to(_('Login'), url('/accounts/login'))}</li>
                    				% endif
                    			</ul>
                            </div>
                        </div>
                    </div>
                    <div class="span1 hidden-phone"></div>
                </div>
            </div>
            <div class="container-fluid" id="navigation">
                <div class="row-fluid" id="moji">
                    <div class="span1 hidden-phone"></div>
                    <div class="span10">
                        <div class="navbar navbar-static-top">
                            <div class="navbar-inner">
                                <a class="btn btn-navbar pull-left" data-target=".nav-collapse" data-toggle="collapse">
                                    <span class="icon-bar"></span>
                                    <span class="icon-bar"></span>
                                    <span class="icon-bar"></span>
                                    <span class="icon-bar"></span>
                                </a>
                                % if c.user:
                                <div class="nav-collapse collapse">
                                    <ul class="nav navbar-nav">
                                        <li class="nav_item${' active' if c.selectedtab == 'messages' else ''}">
            								${h.link_to(_('Messages'), url(controller='messages'))}
            							</li>
            							<li class="nav_item${' active' if c.selectedtab == 'lists' else ''}">
            								${h.link_to(_('Lists'), url(controller='lists'))}
            							</li>
            							<li class="nav_item${' active' if c.selectedtab == 'reports' else ''}">
            							    ${h.link_to(_('Reports'), url(controller='reports'))}
            							</li>
            							% if c.user.is_admin:
            							<li class="nav_item${' active' if c.selectedtab == 'status' else ''}">
            								${h.link_to(_('Status'), url(controller='status'))}
            							</li>
            							<li class="nav_item${' active' if c.selectedtab == 'domains' else ''}">
            								${h.link_to(_('Domains'), url(controller='domains'))}
            							</li>
            							<li class="nav_item${' active' if c.selectedtab == 'accounts' else ''}">
            								${h.link_to(_('Accounts'), url(controller='accounts'))}
            							</li>
            								% if c.user.is_superadmin:
            							<li class="nav_item${' active' if c.selectedtab == 'settings' else ''}">
            								${h.link_to(_('Settings'), url(controller='settings'))}
            							</li>
            							<li class="nav_item${' active' if c.selectedtab == 'organizations' else ''}">
            								${h.link_to(_('Organizations'), url(controller='organizations'))}
            							</li>
            								% endif
            							% else:
            							<li class="nav_item${' active' if c.selectedtab == 'accounts' else ''}">
            							    <a href="${url('account-detail', userid=c.user.id)}">${_("Account")}</a>
            							</li>
            				 			% endif
                                    </ul>
                                </div>
                                % endif
                            </div>
                        </div>
                    </div>
                    <div class="span1 hidden-phone"></div>
                </div>
            </div>
            <div class="container-fluid" id="headings">
                <div class="row-fluid">
                    <div class="span1 hidden-phone"></div>
                    <div class="span10">
                        ${self.submenu()}
                    </div>
                    <div class="span1 hidden-phone"></div>
                </div>
            </div>
            <div class="container-fluid" id="body">
                <div class="row-fluid" id="heading">
                    <div class="span1 hidden-phone"></div>
                    <div class="span10" id="pageheader">
                        <h1 id="title">${self.heading()}</h1>
                    </div>
                    <div class="span1 hidden-phone"></div>
                </div>
                <%include file="includes/flash.html"/>
				${next.body()}
            </div>
        </div>
        <footer>
            <div class="container-fluid">
                <div class="row-fluid">
                    <div class="span1 hidden-phone"></div>
                    <div class="span10">
                        <div class="row-fluid">
                            <div class="span8">
                                <p>
        							<a href="${config.get('baruwa.custom.url', 'http://www.baruwa.org')}">${config.get('baruwa.custom.name', 'Baruwa')}</a>
        						</p>
        						<p>
        							${_('Language: ')}<select name="language" id="globallang">
        								% for lang in h.get_languages():
        								  % if lang.keys()[0] == get_lang()[0]:
        								<option value="${lang.keys()[0]}" selected='selected'>${lang[lang.keys()[0]]}</option>
        								  % else:
        								<option value="${lang.keys()[0]}">${lang[lang.keys()[0]]}</option>
        								  % endif
        							    % endfor
        							</select>
        						</p>
                            </div>
                            <div class="span4">
                                <p>Powered by Baruwa [${baruwaversion}] ${baruwacopyr}</p>
                            </div>
                        </div>
                    </div>
                    <div class="span1 hidden-phone"></div>
                </div>
            </div>
        </footer>
        ${self.localscripts()}
    </body>
</html>
