1.1 --- a/java/nekurak.net-web/src/java/cz/frantovo/nekurak/web/FunkceEL.java Sun Mar 14 01:05:35 2010 +0100
1.2 +++ b/java/nekurak.net-web/src/java/cz/frantovo/nekurak/web/FunkceEL.java Sun Mar 14 01:37:40 2010 +0100
1.3 @@ -1,5 +1,6 @@
1.4 package cz.frantovo.nekurak.web;
1.5
1.6 +import cz.frantovo.nekurak.dto.Podnik;
1.7 import cz.frantovo.nekurak.servlet.Fotky;
1.8
1.9 /**
1.10 @@ -15,4 +16,8 @@
1.11 String prostredek = nahled ? Fotky.PODADRESAR_NAHLED : Fotky.PODADRESAR_ORIGINAL;
1.12 return SERVLET + "/" + prostredek + "/" + id + "." + Fotky.PRIPONA;
1.13 }
1.14 +
1.15 + public static boolean maFotky(Podnik p) {
1.16 + return !p.getFotky().isEmpty();
1.17 + }
1.18 }
2.1 --- a/java/nekurak.net-web/web/WEB-INF/casti/uvod.jsp Sun Mar 14 01:05:35 2010 +0100
2.2 +++ b/java/nekurak.net-web/web/WEB-INF/casti/uvod.jsp Sun Mar 14 01:37:40 2010 +0100
2.3 @@ -4,7 +4,6 @@
2.4 xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
2.5 xmlns:fn="http://java.sun.com/jsp/jstl/functions"
2.6 xmlns:nk="urn:jsptagdir:/WEB-INF/tags/nekurak"
2.7 - xmlns:nkfn="/WEB-INF/nekurakFunkce"
2.8 version="2.0">
2.9
2.10 <jsp:useBean id="uvod" class="cz.frantovo.nekurak.web.Uvod" scope="request"/>
2.11 @@ -35,16 +34,11 @@
2.12 <!-- Hlasování a graf -->
2.13 <div class="hlasovani">
2.14 <nk:hlasovani podnik="${p.id}"/>
2.15 -
2.16 - <c:forEach var="fotka" items="${p.fotky}">
2.17 - <p>${fotka.id} | ${fotka.popis}</p>
2.18 - </c:forEach>
2.19 -
2.20 </div>
2.21
2.22 <!-- Fotky podniku -->
2.23 <div class="fotky">
2.24 - <nk:fotkyPodniku podnik="${p.id}"/>
2.25 + <nk:fotkyPodniku podnik="${p}"/>
2.26 </div>
2.27
2.28 </div>
3.1 --- a/java/nekurak.net-web/web/WEB-INF/nekurakFunkce.tld Sun Mar 14 01:05:35 2010 +0100
3.2 +++ b/java/nekurak.net-web/web/WEB-INF/nekurakFunkce.tld Sun Mar 14 01:37:40 2010 +0100
3.3 @@ -10,5 +10,11 @@
3.4 <function-class>cz.frantovo.nekurak.web.FunkceEL</function-class>
3.5 <function-signature>java.lang.String fotka(int, boolean)</function-signature>
3.6 </function>
3.7 + <function>
3.8 + <name>maFotky</name>
3.9 + <description>Zda podnik má přiřazené nějaké fotky</description>
3.10 + <function-class>cz.frantovo.nekurak.web.FunkceEL</function-class>
3.11 + <function-signature>boolean maFotky(cz.frantovo.nekurak.dto.Podnik)</function-signature>
3.12 + </function>
3.13
3.14 </taglib>
4.1 --- a/java/nekurak.net-web/web/WEB-INF/tags/nekurak/fotkyPodniku.tag Sun Mar 14 01:05:35 2010 +0100
4.2 +++ b/java/nekurak.net-web/web/WEB-INF/tags/nekurak/fotkyPodniku.tag Sun Mar 14 01:37:40 2010 +0100
4.3 @@ -3,19 +3,25 @@
4.4 xmlns:c="http://java.sun.com/jsp/jstl/core"
4.5 xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
4.6 xmlns:fn="http://java.sun.com/jsp/jstl/functions"
4.7 + xmlns:nkfn="/WEB-INF/nekurakFunkce"
4.8 version="2.0">
4.9
4.10 - <jsp:directive.attribute name="podnik" type="java.lang.Integer" required="true" description="ID podniku"/>
4.11 + <jsp:directive.attribute name="podnik" type="cz.frantovo.nekurak.dto.Podnik" required="true"/>
4.12
4.13 - <div id="fotkyPodniku${podnik}">
4.14 - <p><img src="grafika/fotkaPodnikuVzorova.png" alt="demo"/></p>
4.15 - <p><img src="grafika/fotkaPodnikuVzorova.png" alt="demo"/></p>
4.16 - <p><img src="grafika/fotkaPodnikuVzorova.png" alt="demo"/></p>
4.17 + <div id="fotkyPodniku${podnik.id}">
4.18 + <c:forEach var="fotka" items="${podnik.fotky}">
4.19 + <p>
4.20 + <a href="${nkfn:fotka(fotka.id, false)}">
4.21 + <img src="${nkfn:fotka(fotka.id, true)}" alt="fotka" title="${fn:escapeXml(fotka.popis)}"/>
4.22 + </a>
4.23 + </p>
4.24 + </c:forEach>
4.25 <p><img src="grafika/fotkaPodnikuZadne.png" alt="žádné další fotografie"/></p>
4.26 </div>
4.27
4.28 - <script type="text/javascript">
4.29 - fotkyPodniku.aktivuj(${podnik});
4.30 - </script>
4.31 -
4.32 + <c:if test="${nkfn:maFotky(podnik)}">
4.33 + <script type="text/javascript">
4.34 + fotkyPodniku.aktivuj(${podnik.id});
4.35 + </script>
4.36 + </c:if>
4.37 </jsp:root>
4.38 \ No newline at end of file
5.1 --- a/java/nekurak.net-web/web/styl.css Sun Mar 14 01:05:35 2010 +0100
5.2 +++ b/java/nekurak.net-web/web/styl.css Sun Mar 14 01:37:40 2010 +0100
5.3 @@ -162,6 +162,10 @@
5.4 height: 280px;
5.5 }
5.6
5.7 +.podnik .fotky img {
5.8 + border: none;
5.9 +}
5.10 +
5.11 .podnik {
5.12 clear: both;
5.13 }