java/nekurak.net-web/web/WEB-INF/tags/nekurak/podnikKomentare.tag
author František Kučera <franta-hg@frantovo.cz>
Mon Nov 07 20:31:44 2011 +0100 (2011-11-07)
changeset 197 40b7aa9126d0
parent 179 2ed9f3231a28
permissions -rw-r--r--
Podpora Markdown syntaxe pro komentáře.
     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 oddelovac">
    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 id="formularKomentujSkryvac" style="display: none;"><a href="javascript:komentare.zobrazFormular()"><fmt:message key="komentare.komentovat"/></a></p>
    26 				<div id="formularKomentuj">
    27 					<form method="post" action="${zc}?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="MARKDOWN"><fmt:message key="komentar.typ.markdown"/></option>
    38 								<option value="TEXY"><fmt:message key="komentar.typ.texy"/></option>
    39 							</select>
    40 							<br/>
    41 							<button style="display: none;" id="tlacitkoNahled" onclick="javascript:komentare.nahled(); return false;"><fmt:message key="komentare.tlacitkoNahled"/></button>
    42 							<button value="submit"><fmt:message key="komentare.tlacitkoOdeslat"/></button>
    43 						</fieldset>
    44 					</form>
    45 					<div class="vystup"></div>
    46 					<div class="cistic"/>
    47 				</div>
    48 				<script type="text/javascript">
    49 					$("#formularKomentuj").css("display", "none");
    50 					$("#tlacitkoNahled").css("display", "inline");
    51 					$("#formularKomentujSkryvac").css("display", "block");
    52 				</script>
    53 			</c:otherwise>
    54 		</c:choose>
    55 
    56 		<!-- Výpis komentářů -->
    57 		<c:forEach var="k" items="${podnik.komentare}">
    58 			<div class="komentar">
    59 				<h4>
    60 					<fmt:message key="komentare.napsal"/>: <c:out value="${k.uzivatel}" />,
    61 					<fmt:formatDate value="${k.datum}" pattern="dd. MMMM yyyy HH:mm"/>
    62 					<c:if test="${k.nadpis != null &amp;&amp; k.nadpis != ''}">
    63 						<br/>
    64 						<fmt:message key="komentare.nadpis"/>: <c:out value="${k.nadpis}" />
    65 					</c:if>
    66 				</h4>
    67 				<!-- Pozor: předpokládáme, že v DB jsou pouze zkontrolovaná data -->
    68 				<c:out value="${k.komentar}" escapeXml="false" />
    69 			</div>
    70 		</c:forEach>
    71 	</div>
    72 
    73 </jsp:root>