java/nekurak.net-web/web/WEB-INF/tags/nekurak/komentareVypis.tag
author František Kučera <franta-hg@frantovo.cz>
Tue, 08 Jun 2010 09:09:17 +0200
changeset 130 1bbff3f5181f
parent 129 420d7024f6f4
child 134 4bd1e353c527
permissions -rw-r--r--
komentáře – escapování a EJB
franta-hg@126
     1
<?xml version="1.0" encoding="UTF-8"?>
franta-hg@126
     2
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
franta-hg@126
     3
	  xmlns:c="http://java.sun.com/jsp/jstl/core"
franta-hg@126
     4
	  xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
franta-hg@126
     5
	  xmlns:fn="http://java.sun.com/jsp/jstl/functions"
franta-hg@126
     6
	  xmlns:nkfn="/WEB-INF/nekurakFunkce"
franta-hg@126
     7
	  version="2.0">
franta-hg@126
     8
franta-hg@126
     9
    <jsp:directive.attribute name="podnik" type="cz.frantovo.nekurak.dto.Podnik" required="true"/>
franta-hg@126
    10
franta-hg@126
    11
    <div class="komentare">
franta-hg@126
    12
	<h3><fmt:message key="komentare.vypisNadpis"/></h3>
franta-hg@128
    13
franta-hg@128
    14
	<!-- Zatím nikdo nekomentoval? -->
franta-hg@128
    15
	<c:if test="${fn:length(podnik.komentare) == 0}">
franta-hg@128
    16
	    <p><fmt:message key="komentare.zadneKomentare"/></p>
franta-hg@128
    17
	</c:if>
franta-hg@128
    18
franta-hg@128
    19
	<!-- Komentovat! -->
franta-hg@126
    20
	<c:choose>
franta-hg@126
    21
	    <c:when test="${prihlasenyUzivatel == null}">
franta-hg@127
    22
		<p><fmt:message key="komentare.prihlasitSe"/></p>
franta-hg@126
    23
	    </c:when>
franta-hg@126
    24
	    <c:otherwise>
franta-hg@128
    25
		<p><a href="javascript:komentare.zobrazFormular()"><fmt:message key="komentare.komentovat"/></a></p>
franta-hg@128
    26
		<div id="formularKomentuj" style="display: none;">
franta-hg@129
    27
		    <form method="post" action="?akce=odeslatKomentar">
franta-hg@129
    28
		    <fieldset>
franta-hg@129
    29
			<input type="hidden" name="podnik" maxlength="255" value="${podnik.id}"/>
franta-hg@130
    30
			<label><fmt:message key="komentare.nadpis"/>: <input type="text" name="nadpis" maxlength="255"/></label>
franta-hg@130
    31
			<br/>
franta-hg@130
    32
			<textarea name="komentar" cols="30" rows="10"></textarea>
franta-hg@130
    33
			<br/>
franta-hg@130
    34
			<select name="typ">
franta-hg@130
    35
			    <option value="PROSTY_TEXT" selected="selected"><fmt:message key="komentar.typ.prostyText"/></option>
franta-hg@130
    36
			    <option value="XHTML"><fmt:message key="komentar.typ.xhtml"/></option>
franta-hg@130
    37
			    <option value="TEXY"><fmt:message key="komentar.typ.texy"/></option>
franta-hg@130
    38
			</select>
franta-hg@130
    39
			<br/>
franta-hg@129
    40
			<button value="submit"><fmt:message key="komentare.tlacitkoOdeslat"/></button>
franta-hg@129
    41
		    </fieldset>
franta-hg@129
    42
		</form>
franta-hg@128
    43
		</div>
franta-hg@126
    44
	    </c:otherwise>
franta-hg@126
    45
	</c:choose>
franta-hg@126
    46
franta-hg@128
    47
	<!-- Výpis komentářů -->
franta-hg@127
    48
	<c:forEach var="k" items="${podnik.komentare}">
franta-hg@127
    49
	    <div class="komentar">
franta-hg@127
    50
		<h4>
franta-hg@129
    51
		    <fmt:message key="komentare.napsal"/>: <c:out value="${k.uzivatel}" />,
franta-hg@127
    52
		    <fmt:formatDate value="${k.datum}" pattern="dd. MMMM yyyy HH:mm"/>
franta-hg@127
    53
		    <br/>
franta-hg@129
    54
		    <fmt:message key="komentare.nadpis"/>: <c:out value="${k.nadpis}" />
franta-hg@127
    55
		</h4>
franta-hg@127
    56
		<!-- Pozor: předpokládáme, že v DB jsou pouze zkontrolovaná data -->
franta-hg@127
    57
		<c:out value="${k.komentar}" escapeXml="false" />
franta-hg@127
    58
	    </div>
franta-hg@127
    59
	</c:forEach>
franta-hg@126
    60
    </div>
franta-hg@126
    61
franta-hg@126
    62
</jsp:root>