<%@ page import="com.atlassian.plugin.webresource.UrlMode" %>
<%@ page import="com.atlassian.plugin.webresource.WebResourceManager" %>
<%@ page import="com.atlassian.spring.container.ContainerManager" %>
<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %>
<%@ taglib uri="/webwork" prefix="ww" %>
<!DOCTYPE html>
<html lang="en">
<ww:i18n name="com.atlassian.crowd.console.action.BaseAction">
<ww:push value="@com.atlassian.spring.container.ContainerManager@getComponent('actionHelper')">
<head>
    <decorator:usePage id="sitemeshPage"/>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
    <title><decorator:title/></title>
    <link rel="shortcut icon" href="<ww:if test="getSitemeshPageProperty('meta.favicon') != null"><ww:property value="getSitemeshPageProperty('meta.favicon')"/></ww:if><ww:else><ww:url value="/console/favicon.ico" includeParams="none"/></ww:else>" />
    <decorator:head/>
    <%
        WebResourceManager manager = (WebResourceManager) ContainerManager.getComponent("webResourceManager");
        manager.requireResourcesForContext("atl.admin");
        manager.includeResources(out, UrlMode.AUTO);
    %>
</head>
<body class="aui-layout aui-theme-default">
    <div id="page">
        <header id="header" role="banner">
            <nav class="aui-header aui-dropdown2-trigger-group" role="navigation">
                <div class="aui-header-inner">
                    <div class="aui-header-primary">
                        <h1 id="logo" class="aui-header-logo aui-header-logo-crowd"><a href="<ww:url value="/" includeParams="none" />"><span class="aui-header-logo-device">Crowd</span></a></h1>
                        <ul class="aui-nav">
                            <ww:if test="sysAdmin == true ">
                                <ww:iterator value="getWebSectionsForLocation('navigation.top')">
                                    <ww:iterator value="getWebItemsForSection(key)">
                                        <li><a  id="<ww:property value="link.id"/>" href="<ww:property value="getDisplayableLink(link)"/>"  title="<ww:property value="getText(webLabel.key)"/>">
                                            <ww:property value="getText(webLabel.key)"/>
                                        </a></li>
                                    </ww:iterator>
                                </ww:iterator>
                            </ww:if>
                        </ul>
                    </div>
                </div><!-- .aui-header-inner-->
                <div class="aui-header-secondary">
                    <ul class="aui-nav">
                        <li>
                            <a href="<ww:text name="help.prefix"/><ww:property value="getSitemeshPageProperty('meta.help.url')"/>" target="_crowdhelp">
                                <span class="aui-icon aui-icon-small aui-iconfont-help"><ww:text name="menu.documentation.label"/></span>
                            </a>
                        </li>
                        <li>
                            <a aria-owns="user-dropdown" href="http://example.com/" class="aui-dropdown2-trigger">
                                <div class="aui-avatar aui-avatar-small">
                                    <div class="aui-avatar-inner">
                                        <span class="aui-icon aui-icon-small aui-iconfont-user">User</span>
                                    </div>
                                </div>
                            </a>
                            <div class="aui-dropdown2 aui-style-default aui-dropdown2-in-header" id="user-dropdown" aria-hidden="true">
                                <div class="aui-dropdown2-section">
                                    <ul>
                                        <ww:if test="sysAdmin == true">
                                            <li><a href="<ww:url namespace="/console/user" action="viewprofile" includeParams="none"/>"><ww:text name="menu.profile.label"/></a></li>
                                        </ww:if>
                                        <li><a href="<ww:url namespace="/console" action="logoff" includeParams="none"/>"><ww:text name="menu.logout.label"/></a></li>
                                    </ul>
                                </div>
                            </div>
                        </li>
                    </ul>
                </div>
            </nav><!-- .aui-header -->
        </header>

        <section id="content" role="main">
            <div class="aui-page-panel">
                <div class="aui-page-panel-inner">
                    <ww:if test="!getWebSectionsForLocation('left').empty">
                        <div class="aui-page-panel-nav">
                            <nav id="admin-menu" class="aui-navgroup aui-navgroup-vertical">
                                <div class="aui-navgroup-inner">
                                    <ww:iterator value="getWebSectionsForLocation('left')">
                                        <ww:if test="!getText(webLabel.key).empty">
                                            <div class="aui-nav-heading">
                                                <strong><ww:property value="getText(webLabel.key)"/></strong>
                                            </div>
                                        </ww:if>
                                        <ul class="aui-nav">
                                            <ww:iterator value="getWebItemsForSection(key)" status="count">
                                                <li id="lhstab<ww:property value="#count.index+1"/>"<ww:if test='key.equals(getSitemeshPageProperty("meta.pagename"))'> class="aui-nav-selected"</ww:if>>
                                                    <a id="<ww:property value="link.id"/>" href="<ww:property value="getDisplayableLink(link)"/>"><ww:property value="getText(webLabel.key)"/></a>
                                                </li>
                                            </ww:iterator>
                                        </ul>
                                    </ww:iterator>
                                </div>
                            </nav>
                        </div>
                    </ww:if>
                    <section class="aui-page-panel-content">
                        <decorator:body/>
                    </section>
                </div>
            </div>
        </section>

        <footer id="footer" role="contentinfo">
            <div class="footer-body">
                <p>
                    <ww:text name="footer.poweredby"/> <a href="<ww:text name="application.poweredby.url"/>"><ww:text name="application.title"/></a>
                    <ww:text name="common.words.version"/>:&nbsp;<ww:property value="@com.atlassian.crowd.util.build.BuildUtils@getVersion()"/>
                </p>
                <ww:if test="licenseExpired == true || evaluation == true">
                    <div class="aui-message error">
                        <p class="title">
                            <!-- evaluation -->
                            <ww:if test="evaluation == true">
                                <ww:if test="licenseExpired == true"><ww:text name="license.evaluationexpired"/></ww:if>
                                <ww:else><ww:text name="license.runningevaluation"/></ww:else>
                            </ww:if>
                            <!-- subscription -->
                            <ww:elseif test="subscription == true">
                                <ww:if test="licenseExpired == true && withinGracePeriod == false"><ww:text name="license.runningsubscription.expired"/></ww:if>
                                <ww:elseif test="licenseExpired == true && withinGracePeriod == true">
                                    <ww:text name="license.runningsubscription.graceperiod">
                                        <ww:param name="value0" value="license.numberOfDaysBeforeGracePeriodExpiry" />
                                    </ww:text>
                                </ww:elseif>
                            </ww:elseif>
                            <!-- other licenses -->
                            <ww:else>
                                <ww:if test="licenseExpired == true"><ww:text name="license.expired"/></ww:if>
                            </ww:else>
                        </p>
                        <span class="aui-icon icon-error"></span>
                    </div>
                </ww:if>
                <ul>
                    <li><a href="http://jira.atlassian.com/browse/CWD"><ww:text name="support.bug"/></a></li>
                    <li><a href="http://jira.atlassian.com/browse/CWD"><ww:text name="support.feature"/></a></li>
                    <li><a href="http://www.atlassian.com/about/contact.jsp"><ww:text name="support.contact"/></a></li>
                </ul>
                <div id="footer-logo"><a href="http://www.atlassian.com/">Atlassian</a></div>
            </div>
        </footer>
    </div>
</body>
</ww:push>
</ww:i18n>
</html>
