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.
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@145
     3
		  xmlns:c="http://java.sun.com/jsp/jstl/core"
franta-hg@145
     4
		  xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
franta-hg@145
     5
		  xmlns:fn="http://java.sun.com/jsp/jstl/functions"
franta-hg@145
     6
		  xmlns:nkfn="/WEB-INF/nekurakFunkce"
franta-hg@145
     7
		  version="2.0">
franta-hg@126
     8
franta-hg@145
     9
	<jsp:directive.attribute name="podnik" type="cz.frantovo.nekurak.dto.Podnik" required="true"/>
franta-hg@126
    10
franta-hg@158
    11
	<div class="komentare oddelovac">
franta-hg@145
    12
		<h3><fmt:message key="komentare.vypisNadpis"/></h3>
franta-hg@128
    13
franta-hg@145
    14
		<!-- Zatím nikdo nekomentoval? -->
franta-hg@145
    15
		<c:if test="${fn:length(podnik.komentare) == 0}">
franta-hg@145
    16
			<p><fmt:message key="komentare.zadneKomentare"/></p>
franta-hg@145
    17
		</c:if>
franta-hg@128
    18
franta-hg@145
    19
		<!-- Komentovat! -->
franta-hg@145
    20
		<c:choose>
franta-hg@145
    21
			<c:when test="${prihlasenyUzivatel == null}">
franta-hg@145
    22
				<p><fmt:message key="komentare.prihlasitSe"/></p>
franta-hg@145
    23
			</c:when>
franta-hg@145
    24
			<c:otherwise>
franta-hg@145
    25
				<p id="formularKomentujSkryvac" style="display: none;"><a href="javascript:komentare.zobrazFormular()"><fmt:message key="komentare.komentovat"/></a></p>
franta-hg@145
    26
				<div id="formularKomentuj">
franta-hg@179
    27
					<form method="post" action="${zc}?akce=odeslatKomentar" onsubmit="javascript:komentare.odeslat(); return false;">
franta-hg@145
    28
						<fieldset>
franta-hg@145
    29
							<input type="hidden" name="podnik" maxlength="255" value="${podnik.id}"/>
franta-hg@145
    30
							<label><fmt:message key="komentare.nadpis"/>: <input type="text" name="nadpis" maxlength="255"/></label>
franta-hg@145
    31
							<br/>
franta-hg@145
    32
							<textarea name="komentar" cols="30" rows="10"></textarea>
franta-hg@145
    33
							<br/>
franta-hg@145
    34
							<select name="typ">
franta-hg@145
    35
								<option value="PROSTY_TEXT" selected="selected"><fmt:message key="komentar.typ.prostyText"/></option>
franta-hg@145
    36
								<option value="XHTML"><fmt:message key="komentar.typ.xhtml"/></option>
franta-hg@197
    37
								<option value="MARKDOWN"><fmt:message key="komentar.typ.markdown"/></option>
franta-hg@145
    38
								<option value="TEXY"><fmt:message key="komentar.typ.texy"/></option>
franta-hg@145
    39
							</select>
franta-hg@145
    40
							<br/>
franta-hg@145
    41
							<button style="display: none;" id="tlacitkoNahled" onclick="javascript:komentare.nahled(); return false;"><fmt:message key="komentare.tlacitkoNahled"/></button>
franta-hg@145
    42
							<button value="submit"><fmt:message key="komentare.tlacitkoOdeslat"/></button>
franta-hg@145
    43
						</fieldset>
franta-hg@145
    44
					</form>
franta-hg@145
    45
					<div class="vystup"></div>
franta-hg@145
    46
					<div class="cistic"/>
franta-hg@145
    47
				</div>
franta-hg@145
    48
				<script type="text/javascript">
franta-hg@145
    49
					$("#formularKomentuj").css("display", "none");
franta-hg@145
    50
					$("#tlacitkoNahled").css("display", "inline");
franta-hg@145
    51
					$("#formularKomentujSkryvac").css("display", "block");
franta-hg@145
    52
				</script>
franta-hg@145
    53
			</c:otherwise>
franta-hg@145
    54
		</c:choose>
franta-hg@126
    55
franta-hg@145
    56
		<!-- Výpis komentářů -->
franta-hg@145
    57
		<c:forEach var="k" items="${podnik.komentare}">
franta-hg@145
    58
			<div class="komentar">
franta-hg@145
    59
				<h4>
franta-hg@145
    60
					<fmt:message key="komentare.napsal"/>: <c:out value="${k.uzivatel}" />,
franta-hg@145
    61
					<fmt:formatDate value="${k.datum}" pattern="dd. MMMM yyyy HH:mm"/>
franta-hg@145
    62
					<c:if test="${k.nadpis != null &amp;&amp; k.nadpis != ''}">
franta-hg@145
    63
						<br/>
franta-hg@145
    64
						<fmt:message key="komentare.nadpis"/>: <c:out value="${k.nadpis}" />
franta-hg@145
    65
					</c:if>
franta-hg@145
    66
				</h4>
franta-hg@145
    67
				<!-- Pozor: předpokládáme, že v DB jsou pouze zkontrolovaná data -->
franta-hg@145
    68
				<c:out value="${k.komentar}" escapeXml="false" />
franta-hg@145
    69
			</div>
franta-hg@145
    70
		</c:forEach>
franta-hg@145
    71
	</div>
franta-hg@126
    72
franta-hg@126
    73
</jsp:root>