<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@taglib prefix="a4j" uri="http://richfaces.org/a4j"%>
<%@taglib prefix="rich" uri="http://richfaces.org/rich"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="p" uri="http://primefaces.prime.com.tr/ui"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<%--
    This file is an entry point for JavaServer Faces application.
--%>
<f:view>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
            <title>BackupServer</title>
            <%--<link type="text/css" rel="stylesheet" href="css/theme.css">--%>
            <link type="text/css" rel="stylesheet" href="css/skin.css" />
            <link type="text/css" rel="stylesheet" href="css/divs.css" />
            <link type="text/css" rel="stylesheet" href="css/main.css" />
            <link type="text/css" rel="stylesheet" href="css/menus.css" />
            <link type="text/css" rel="stylesheet" href="css/forms.css" />
            <link type="text/css" rel="stylesheet" href="css/tables.css" />
            <link type="text/css" rel="stylesheet" href="css/texts.css" />
            <link type="text/css" rel="stylesheet" href="css/login-box.css"  />
            <p:resources />
        </head>
        <body>
            <p:layout fullPage="true" style="background: #5c9ccc;">
                <p:layoutUnit position="top" height="70" gutter="0px"
                              styleClass="bg-brown">
                    <h:graphicImage value="images/logo.png" />
                    <div id="basicInfo">
                        <h:form>
                            <h:panelGrid columns="2" styleClass="whiteNormal">
                                <h:outputText value="Prihlásený:" />
                                <h:outputText styleClass= "bold"
                                              value="#{user.helper.user.username}" />


                                <h:commandLink action="logout">
                                    <h:outputText value="ODHLÁSIŤ" styleClass="whiteNormal"
                                                  style="font-weight: bold;"/>
                                </h:commandLink>
                            </h:panelGrid>
                        </h:form>
                    </div>
                </p:layoutUnit>
                <p:layoutUnit position="bottom" header="#{msg.systemLog}" height="100" gutter="0px">
                    <c:import url="log.jsp" />
                </p:layoutUnit>
                <p:layoutUnit position="left" width="230" gutter="0px">
                    <h:form>
                        <p:menu style="width: 300px;">
                            <p:submenu label="#{msg.monitoring} & #{msg.reporting}">
                                <p:menuitem value="#{msg.serverStatus}"
                                            action="#{user.showServerStatus}"
                                            ajax="false"/>
                                <p:menuitem value="#{msg.monitoring}"
                                            action="#{user.showMonitoring}"
                                            ajax="false"/>
                                <p:menuitem value="#{msg.reporting}"
                                            action="#{user.showReporting}"
                                            ajax="false"/>
                            </p:submenu>
                            <p:submenu label="#{msg.mediaAgent}">
                                <p:menuitem value="#{msg.mediaManagement}"
                                            action="#{user.showMediaAdmin}"
                                            ajax="false" />
                            </p:submenu>
                            <p:submenu label="#{msg.administration}">
                                <p:menuitem value="#{msg.clientManagement}"
                                            action="#{user.showClientsManagement}"
                                            ajax="false"/>
                                <p:menuitem value="#{msg.settings}"
                                            action="#{user.showSystemManagement}"
                                            ajax="false"/>
                                <p:menuitem value="#{msg.userManagement}"
                                            action="#{user.showUserManagement}"
                                            ajax="false"/>
                            </p:submenu>
                        </p:menu>
                    </h:form>
                </p:layoutUnit>

                <%--
                <p:layoutUnit position="right" width="300" gutter="0px">
                    <h:panelGrid columns="1">
                        <h:outputText id="server_status" value="Backupserver is started: #{app.started}" />
                    </h:panelGrid>
                </p:layoutUnit>
                --%>

                <p:layoutUnit position="center" gutter="0px" scrollable="true">
                    <c:choose>
                        <c:when test="${user.actualPage != null}">
                            <c:import url="${user.actualPage}" />
                        </c:when>
                        <c:otherwise>
                            <h:outputText value="#{msg.pageError}" />
                        </c:otherwise>
                    </c:choose>
                </p:layoutUnit>
            </p:layout>
        </body>
    </html>
</f:view>
