author | František Kučera <franta-hg@frantovo.cz> |
Tue, 08 Jun 2010 14:42:00 +0200 | |
changeset 134 | 4bd1e353c527 |
parent 130 | 1bbff3f5181f |
child 135 | ec558dd0ca34 |
permissions | -rw-r--r-- |
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@134 | 28 |
<fieldset> |
franta-hg@134 | 29 |
<input type="hidden" name="podnik" maxlength="255" value="${podnik.id}"/> |
franta-hg@134 | 30 |
<label><fmt:message key="komentare.nadpis"/>: <input type="text" name="nadpis" maxlength="255"/></label> |
franta-hg@134 | 31 |
<br/> |
franta-hg@134 | 32 |
<textarea name="komentar" cols="30" rows="10"></textarea> |
franta-hg@134 | 33 |
<br/> |
franta-hg@134 | 34 |
<select name="typ"> |
franta-hg@134 | 35 |
<option value="PROSTY_TEXT" selected="selected"><fmt:message key="komentar.typ.prostyText"/></option> |
franta-hg@134 | 36 |
<option value="XHTML"><fmt:message key="komentar.typ.xhtml"/></option> |
franta-hg@134 | 37 |
<option value="TEXY"><fmt:message key="komentar.typ.texy"/></option> |
franta-hg@134 | 38 |
</select> |
franta-hg@134 | 39 |
<br/> |
franta-hg@134 | 40 |
<button value="submit"><fmt:message key="komentare.tlacitkoOdeslat"/></button> |
franta-hg@134 | 41 |
</fieldset> |
franta-hg@134 | 42 |
</form> |
franta-hg@134 | 43 |
<p><fmt:message key="komentar.typ.xhtml.povoleneZnacky"/></p> |
franta-hg@128 | 44 |
</div> |
franta-hg@126 | 45 |
</c:otherwise> |
franta-hg@126 | 46 |
</c:choose> |
franta-hg@126 | 47 |
|
franta-hg@128 | 48 |
<!-- Výpis komentářů --> |
franta-hg@127 | 49 |
<c:forEach var="k" items="${podnik.komentare}"> |
franta-hg@127 | 50 |
<div class="komentar"> |
franta-hg@127 | 51 |
<h4> |
franta-hg@129 | 52 |
<fmt:message key="komentare.napsal"/>: <c:out value="${k.uzivatel}" />, |
franta-hg@127 | 53 |
<fmt:formatDate value="${k.datum}" pattern="dd. MMMM yyyy HH:mm"/> |
franta-hg@134 | 54 |
<c:if test="${k.nadpis != null && k.nadpis != ''}"> |
franta-hg@134 | 55 |
<br/> |
franta-hg@134 | 56 |
<fmt:message key="komentare.nadpis"/>: <c:out value="${k.nadpis}" /> |
franta-hg@134 | 57 |
</c:if> |
franta-hg@127 | 58 |
</h4> |
franta-hg@127 | 59 |
<!-- Pozor: předpokládáme, že v DB jsou pouze zkontrolovaná data --> |
franta-hg@127 | 60 |
<c:out value="${k.komentar}" escapeXml="false" /> |
franta-hg@134 | 61 |
|
franta-hg@134 | 62 |
<!-- |
franta-hg@134 | 63 |
Komentáře můžeme kontrolovat i tady |
franta-hg@134 | 64 |
pokud nemůžeme věřit, že v DB jsou zkontrolovaná data |
franta-hg@134 | 65 |
--> |
franta-hg@134 | 66 |
|
franta-hg@134 | 67 |
<c:choose> |
franta-hg@134 | 68 |
<c:when test="${nkfn:zkontrolujKomentar(k.komentar)}"> |
franta-hg@134 | 69 |
<c:out value="${k.komentar}" escapeXml="false" /> |
franta-hg@134 | 70 |
</c:when> |
franta-hg@134 | 71 |
<c:otherwise> |
franta-hg@134 | 72 |
<!-- Špatně formátovaný komentář potom nezobrazíme --> |
franta-hg@134 | 73 |
<p class="chybovaHlaska"><fmt:message key="komentar.nejdeZobrazit"/></p> |
franta-hg@134 | 74 |
</c:otherwise> |
franta-hg@134 | 75 |
</c:choose> |
franta-hg@134 | 76 |
|
franta-hg@134 | 77 |
<!-- Nebo ho jednoduše zobrazíme, ale escapujeme --> |
franta-hg@134 | 78 |
<c:out value="${k.komentar}" escapeXml="${!nkfn:zkontrolujKomentar(k.komentar)}" /> |
franta-hg@127 | 79 |
</div> |
franta-hg@127 | 80 |
</c:forEach> |
franta-hg@126 | 81 |
</div> |
franta-hg@126 | 82 |
|
franta-hg@126 | 83 |
</jsp:root> |