<%-- 
    Document   : index
    Created on : 29.3.2010, 18:14:44
    Author     : Pavel Jandera
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<c:if test="${RequestData.jmeno == null}">
    <c:redirect url="index.jsp" />
</c:if>

<sql:setDataSource
    var="dataSource"
    driver="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost:3306/videokonference?useUnicode=true&characterEncoding=UTF-8"
  user="videokonf"
  password="Purk118*"
/>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Konfigurace videokonference</title>
        <link rel="stylesheet" type="text/css" href="style.css" />
        <script src="functions.js" type="text/javascript" charset="utf-8"></script>

    </head>

    <body onload="change();">
        <div id="header"></div>

            <div id="content" style="min-width: 930px">
            <div id="menu">
                <a href="logout.jsp">Odhlásit</a>
                <a href="profile.jsp">Profil</a>
            </div>
            
            <h1>Konfigurace videokonference</h1>

            <form style="float: left" onsubmit="return validate(this)" name="form" action="GenerateV2XML" method="GET">
            
            Počet účastníků:
            <select name="pocetUcastniku" onchange="change();">
                <option value="1" selected>1</option>
                <option value="2">2</option>
                <option value="3">3</option>
                <option value="4">4</option>
                <option value="5">5</option>
                <option value="6">6</option>
                <option value="7">7</option>
            </select>
            <br />
            <div id="ucastnici">
            </div>
            <input class="float_right" type="submit" value="Pokračovat">
        </form>

            <div id="group">
            <h2>Uživatelé ve Vaší skupině:</h2>


            <jsp:useBean id="RequestData" type="com.videokonference.bean.RequestData" scope="session" />
            <sql:query var="skupiny" dataSource="${dataSource}">
                SELECT skupiny.nazev, skupiny.id FROM prirazeni, skupiny
                WHERE prirazeni.uzivatel='${RequestData.login}' AND skupiny.id=prirazeni.skupina
            </sql:query>
            <dl>
            <c:forEach var="row" items="${skupiny.rows}">
                <dt>${row.nazev}</dt>
                <sql:query var="uzivatele" dataSource="${dataSource}">
                    SELECT uzivatele.login, uzivatele.jmeno,uzivatele.prijmeni,uzivatele.uri FROM prirazeni, uzivatele
                    WHERE prirazeni.skupina='${row.id}' AND uzivatele.login=prirazeni.uzivatel
                </sql:query>
                <c:forEach var="row2" items="${uzivatele.rows}">
                    <c:if test="${row2.login != RequestData.login}">
                        <dd>
                            ${row2.jmeno} ${row2.prijmeni} &lt;<a href="#" onclick="addUser(this)" title="Kliknutím přidáte uživatele do videokonference." >${row2.uri}</a>&gt;
                        </dd>
                    </c:if>
                </c:forEach>
            </c:forEach>
            </dl>
        </div>
        </div>
    </body>
</html>
