java/nekurak.net-web/web/WEB-INF/tags/nekurak/komentareVypis.tag
author František Kučera <franta-hg@frantovo.cz>
Sun Jun 20 14:46:47 2010 +0200 (2010-06-20)
changeset 145 0efefbf5f8b6
parent 143 91c4282ea15f
permissions -rw-r--r--
Formátování kódu, důsledné používání tabulátorů, drobné úpravy, StringBuilder
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@145
    11
	<div class="komentare">
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@145
    27
					<form method="post" action="?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@145
    37
								<option value="TEXY"><fmt:message key="komentar.typ.texy"/></option>
franta-hg@145
    38
							</select>
franta-hg@145
    39
							<br/>
franta-hg@145
    40
							<button style="display: none;" id="tlacitkoNahled" onclick="javascript:komentare.nahled(); return false;"><fmt:message key="komentare.tlacitkoNahled"/></button>
franta-hg@145
    41
							<button value="submit"><fmt:message key="komentare.tlacitkoOdeslat"/></button>
franta-hg@145
    42
						</fieldset>
franta-hg@145
    43
					</form>
franta-hg@145
    44
					<div class="vystup"></div>
franta-hg@145
    45
					<div class="cistic"/>
franta-hg@145
    46
				</div>
franta-hg@145
    47
				<script type="text/javascript">
franta-hg@145
    48
					$("#formularKomentuj").css("display", "none");
franta-hg@145
    49
					$("#tlacitkoNahled").css("display", "inline");
franta-hg@145
    50
					$("#formularKomentujSkryvac").css("display", "block");
franta-hg@145
    51
				</script>
franta-hg@145
    52
			</c:otherwise>
franta-hg@145
    53
		</c:choose>
franta-hg@126
    54
franta-hg@145
    55
		<!-- Výpis komentářů -->
franta-hg@145
    56
		<c:forEach var="k" items="${podnik.komentare}">
franta-hg@145
    57
			<div class="komentar">
franta-hg@145
    58
				<h4>
franta-hg@145
    59
					<fmt:message key="komentare.napsal"/>: <c:out value="${k.uzivatel}" />,
franta-hg@145
    60
					<fmt:formatDate value="${k.datum}" pattern="dd. MMMM yyyy HH:mm"/>
franta-hg@145
    61
					<c:if test="${k.nadpis != null &amp;&amp; k.nadpis != ''}">
franta-hg@145
    62
						<br/>
franta-hg@145
    63
						<fmt:message key="komentare.nadpis"/>: <c:out value="${k.nadpis}" />
franta-hg@145
    64
					</c:if>
franta-hg@145
    65
				</h4>
franta-hg@145
    66
				<!-- Pozor: předpokládáme, že v DB jsou pouze zkontrolovaná data -->
franta-hg@145
    67
				<c:out value="${k.komentar}" escapeXml="false" />
franta-hg@145
    68
			</div>
franta-hg@145
    69
		</c:forEach>
franta-hg@145
    70
	</div>
franta-hg@126
    71
franta-hg@126
    72
</jsp:root>