java/nekurak.net-web/web/WEB-INF/tags/nekurak/komentareVypis.tag
author František Kučera <franta-hg@frantovo.cz>
Sat, 19 Jun 2010 14:00:11 +0200
changeset 143 91c4282ea15f
parent 142 44ef544460ca
child 145 0efefbf5f8b6
permissions -rw-r--r--
doladění CSS pro lidi bez JS
     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:nkfn="/WEB-INF/nekurakFunkce"
     7 	  version="2.0">
     8 
     9     <jsp:directive.attribute name="podnik" type="cz.frantovo.nekurak.dto.Podnik" required="true"/>
    10 
    11     <div class="komentare">
    12 	<h3><fmt:message key="komentare.vypisNadpis"/></h3>
    13 
    14 	<!-- Zatím nikdo nekomentoval? -->
    15 	<c:if test="${fn:length(podnik.komentare) == 0}">
    16 	    <p><fmt:message key="komentare.zadneKomentare"/></p>
    17 	</c:if>
    18 
    19 	<!-- Komentovat! -->
    20 	<c:choose>
    21 	    <c:when test="${prihlasenyUzivatel == null}">
    22 		<p><fmt:message key="komentare.prihlasitSe"/></p>
    23 	    </c:when>
    24 	    <c:otherwise>
    25 		<p><a href="javascript:komentare.zobrazFormular()"><fmt:message key="komentare.komentovat"/></a></p>
    26 		<div id="formularKomentuj">
    27 		    <form method="post" action="?akce=odeslatKomentar" onsubmit="javascript:komentare.odeslat(); return false;">
    28 			<fieldset>
    29 			    <input type="hidden" name="podnik" maxlength="255" value="${podnik.id}"/>
    30 			    <label><fmt:message key="komentare.nadpis"/>: <input type="text" name="nadpis" maxlength="255"/></label>
    31 			    <br/>
    32 			    <textarea name="komentar" cols="30" rows="10"></textarea>
    33 			    <br/>
    34 			    <select name="typ">
    35 				<option value="PROSTY_TEXT" selected="selected"><fmt:message key="komentar.typ.prostyText"/></option>
    36 				<option value="XHTML"><fmt:message key="komentar.typ.xhtml"/></option>
    37 				<option value="TEXY"><fmt:message key="komentar.typ.texy"/></option>
    38 			    </select>
    39 			    <br/>
    40 			    <button style="display: none;" id="tlacitkoNahled" onclick="javascript:komentare.nahled(); return false;"><fmt:message key="komentare.tlacitkoNahled"/></button>
    41 			    <button value="submit"><fmt:message key="komentare.tlacitkoOdeslat"/></button>
    42 			</fieldset>
    43 		    </form>
    44 		    <div class="vystup"></div>
    45 		    <div class="cistic"/>
    46 		</div>
    47 		<script type="text/javascript">
    48 		    $("#formularKomentuj").css("display", "none");
    49 		    $("#tlacitkoNahled").css("display", "inline");
    50 		</script>
    51 	    </c:otherwise>
    52 	</c:choose>
    53 
    54 	<!-- Výpis komentářů -->
    55 	<c:forEach var="k" items="${podnik.komentare}">
    56 	    <div class="komentar">
    57 		<h4>
    58 		    <fmt:message key="komentare.napsal"/>: <c:out value="${k.uzivatel}" />,
    59 		    <fmt:formatDate value="${k.datum}" pattern="dd. MMMM yyyy HH:mm"/>
    60 		    <c:if test="${k.nadpis != null &amp;&amp; k.nadpis != ''}">
    61 			<br/>
    62 			<fmt:message key="komentare.nadpis"/>: <c:out value="${k.nadpis}" />
    63 		    </c:if>
    64 		</h4>
    65 		<!-- Pozor: předpokládáme, že v DB jsou pouze zkontrolovaná data -->
    66 		<c:out value="${k.komentar}" escapeXml="false" />
    67 	    </div>
    68 	</c:forEach>
    69     </div>
    70 
    71 </jsp:root>