java/nekurak.net-web/web/WEB-INF/casti/chat.jsp
author František Kučera <franta-hg@frantovo.cz>
Sun Aug 15 22:20:10 2010 +0200 (2010-08-15)
changeset 151 d7b5099bf65e
permissions -rw-r--r--
chat
     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
     3 		  xmlns:c="http://java.sun.com/jsp/jstl/core"
     4 		  xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
     5 		  xmlns:fn="http://java.sun.com/jsp/jstl/functions"
     6 		  xmlns:nk="urn:jsptagdir:/WEB-INF/tags/nekurak"
     7 		  version="2.0">
     8 
     9 	<c:choose>
    10 		<c:when test="${param.akceChat == 'odesli'}">
    11 			<!-- TODO: servlet -->
    12 			<jsp:useBean id="odesilac" class="cz.frantovo.nekurak.web.chat.OdesilacZprav" scope="request"/>
    13 			<jsp:setProperty name="odesilac" property="mistnost" value="${param.mistnost}"/>
    14 			<jsp:setProperty name="odesilac" property="od" value="${param.od}"/>
    15 			<jsp:setProperty name="odesilac" property="zprava" value="${param.zprava}"/>
    16 
    17 			<c:if test="${odesilac.odeslano}">
    18 				<p>Zpráva byla odeslána.</p>
    19 			</c:if>
    20 		</c:when>
    21 		<c:when test="${param.akceChat == 'vypis'}">
    22 			<!-- TODO: servlet + JSP -->
    23 			<jsp:useBean id="vypis" class="cz.frantovo.nekurak.web.chat.VypisZprav" scope="request"/>
    24 			<jsp:setProperty name="vypis" property="mistnost" value="${param.mistnost}"/>
    25 			<jsp:setProperty name="vypis" property="poradoveCislo" value="${param.poradoveCislo}"/>
    26 			<!-- Náš vlastní XML formát -->
    27 			<zpravy>
    28 				<c:forEach var="z" items="${vypis.zpravy}">
    29 					<zprava>
    30 						<poradoveCislo><c:out value="${z.poradoveCislo}"/></poradoveCislo>
    31 						<od><c:out value="${z.od}"/></od>
    32 						<text><c:out value="${z.text}"/></text>
    33 						<kdy><fmt:formatDate value="${z.kdy}" pattern="yyyy-MM-dd HH:mm:ss"/></kdy>
    34 						<overeny><c:out value="${z.overenyUzivatel}"/></overeny>
    35 					</zprava>
    36 				</c:forEach>
    37 			</zpravy>
    38 		</c:when>
    39 		<c:otherwise>
    40 			<fmt:message key="chat.nadpis" var="titulekStranky"/>
    41 			<nk:stranka titulek="${titulekStranky}">
    42 
    43 				<h1><c:out value="${titulekStranky}"/></h1>
    44 				<script type="text/javascript" src="js/chat.js"></script>
    45 
    46 				<div id="chat">
    47 					<form action="javascript:ajaxOdesli();" id="odesilaciFormular">
    48 						<fieldset>
    49 							<!-- TODO: jméno místnosti konfigurovat na jednom místě -->
    50 							<input type="hidden" name="mistnost" value="nekurak@konference.frantovo.cz"/>
    51 							<fmt:message key="chat.anonym" var="chatAnonym"/>
    52 							<input title="vaše přezdívka" type="text" name="od" class="chatOd" value="${chatAnonym}"/>
    53 							<input title="text zprávy" type="text" name="text" class="chatText" value="…"/>
    54 							<button type="submit" class="chatOdeslat"><fmt:message key="chat.tlacitkoOdeslat"/></button>
    55 						</fieldset>
    56 					</form>
    57 					<div id="vypisZprav">…</div>
    58 				</div>
    59 
    60 				<script type="text/javascript">
    61 					spustCasovac();
    62 				</script>
    63 			</nk:stranka>
    64 		</c:otherwise>
    65 	</c:choose>
    66 
    67 </jsp:root>