1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/java/nekurak.net-ejb/src/conf/Komentar.hbm.xml Tue Jun 08 02:37:04 2010 +0200
1.3 @@ -0,0 +1,17 @@
1.4 +<?xml version="1.0"?>
1.5 +<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
1.6 +"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
1.7 +<hibernate-mapping>
1.8 + <class name="cz.frantovo.nekurak.dto.Komentar" table="komentar">
1.9 + <id name="id" column="id" type="integer">
1.10 + <generator class="sequence">
1.11 + <param name="sequence">komentar_seq</param>
1.12 + </generator>
1.13 + </id>
1.14 + <property name="podnik" column="podnik"/>
1.15 + <property name="uzivatel" column="uzivatel"/>
1.16 + <property name="datum" column="datum"/>
1.17 + <property name="nadpis" column="nadpis"/>
1.18 + <property name="komentar" column="komentar"/>
1.19 + </class>
1.20 +</hibernate-mapping>
1.21 \ No newline at end of file
2.1 --- a/java/nekurak.net-ejb/src/conf/Podnik.hbm.xml Mon Jun 07 23:14:02 2010 +0200
2.2 +++ b/java/nekurak.net-ejb/src/conf/Podnik.hbm.xml Tue Jun 08 02:37:04 2010 +0200
2.3 @@ -21,6 +21,10 @@
2.4 <list-index column="poradi"/>
2.5 <one-to-many class="cz.frantovo.nekurak.dto.Fotka"/>
2.6 </list>
2.7 + <set name="komentare" table="komentar" lazy="false">
2.8 + <key column="podnik" foreign-key="id"/>
2.9 + <one-to-many class="cz.frantovo.nekurak.dto.Komentar"/>
2.10 + </set>
2.11 <property name="sirka" column="sirka"/>
2.12 <property name="delka" column="delka"/>
2.13
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/java/nekurak.net-lib/src/cz/frantovo/nekurak/dto/Komentar.java Tue Jun 08 02:37:04 2010 +0200
3.3 @@ -0,0 +1,65 @@
3.4 +package cz.frantovo.nekurak.dto;
3.5 +
3.6 +import java.util.Date;
3.7 +
3.8 +/**
3.9 + * Komentář k podniku
3.10 + * @author fiki
3.11 + */
3.12 +public class Komentar {
3.13 +
3.14 + private int id;
3.15 + private int podnik;
3.16 + private String uzivatel;
3.17 + private Date datum;
3.18 + private String nadpis;
3.19 + private String komentar;
3.20 +
3.21 + public int getId() {
3.22 + return id;
3.23 + }
3.24 +
3.25 + public void setId(int id) {
3.26 + this.id = id;
3.27 + }
3.28 +
3.29 + public int getPodnik() {
3.30 + return podnik;
3.31 + }
3.32 +
3.33 + public void setPodnik(int podnik) {
3.34 + this.podnik = podnik;
3.35 + }
3.36 +
3.37 + public String getUzivatel() {
3.38 + return uzivatel;
3.39 + }
3.40 +
3.41 + public void setUzivatel(String uzivatel) {
3.42 + this.uzivatel = uzivatel;
3.43 + }
3.44 +
3.45 + public Date getDatum() {
3.46 + return datum;
3.47 + }
3.48 +
3.49 + public void setDatum(Date datum) {
3.50 + this.datum = datum;
3.51 + }
3.52 +
3.53 + public String getNadpis() {
3.54 + return nadpis;
3.55 + }
3.56 +
3.57 + public void setNadpis(String nadpis) {
3.58 + this.nadpis = nadpis;
3.59 + }
3.60 +
3.61 + public String getKomentar() {
3.62 + return komentar;
3.63 + }
3.64 +
3.65 + public void setKomentar(String komentar) {
3.66 + this.komentar = komentar;
3.67 + }
3.68 +}
4.1 --- a/java/nekurak.net-lib/src/cz/frantovo/nekurak/dto/Podnik.java Mon Jun 07 23:14:02 2010 +0200
4.2 +++ b/java/nekurak.net-lib/src/cz/frantovo/nekurak/dto/Podnik.java Tue Jun 08 02:37:04 2010 +0200
4.3 @@ -3,7 +3,9 @@
4.4 import java.io.Serializable;
4.5 import java.util.ArrayList;
4.6 import java.util.Date;
4.7 +import java.util.HashSet;
4.8 import java.util.List;
4.9 +import java.util.Set;
4.10
4.11 /**
4.12 * Podnik – hospoda, bar, kavárna…
4.13 @@ -21,6 +23,7 @@
4.14 private String mesto;
4.15 private String spravce;
4.16 private List<Fotka> fotky = new ArrayList<Fotka>();
4.17 + private Set<Komentar> komentare = new HashSet<Komentar>();
4.18 private Double sirka;
4.19 private Double delka;
4.20
4.21 @@ -127,4 +130,12 @@
4.22 public void setDelka(Double delka) {
4.23 this.delka = delka;
4.24 }
4.25 +
4.26 + public Set<Komentar> getKomentare() {
4.27 + return komentare;
4.28 + }
4.29 +
4.30 + public void setKomentare(Set<Komentar> komentare) {
4.31 + this.komentare = komentare;
4.32 + }
4.33 }
5.1 --- a/java/nekurak.net-lib/src/cz/frantovo/nekurak/preklady_cs.properties Mon Jun 07 23:14:02 2010 +0200
5.2 +++ b/java/nekurak.net-lib/src/cz/frantovo/nekurak/preklady_cs.properties Tue Jun 08 02:37:04 2010 +0200
5.3 @@ -81,8 +81,8 @@
5.4 hlasovani.TODO=TODO: lokalizovat Javascript
5.5
5.6 komentare.vypisNadpis=Koment\u00E1\u0159e k tomuto podniku
5.7 -komentare.=
5.8 -komentare.=
5.9 +komentare.prihlasitSe=Pro vkl\u00E1d\u00E1n\u00ED koment\u00E1\u0159\u016F se pros\u00EDm p\u0159ihla\u0161te.
5.10 +komentare.zadneKomentare=Zat\u00EDm nikdo nekomentoval.
5.11 komentare.=
5.12 komentare.=
5.13 komentare.=
6.1 --- a/java/nekurak.net-web/web/WEB-INF/tags/nekurak/komentareVypis.tag Mon Jun 07 23:14:02 2010 +0200
6.2 +++ b/java/nekurak.net-web/web/WEB-INF/tags/nekurak/komentareVypis.tag Tue Jun 08 02:37:04 2010 +0200
6.3 @@ -12,14 +12,31 @@
6.4 <h3><fmt:message key="komentare.vypisNadpis"/></h3>
6.5 <c:choose>
6.6 <c:when test="${prihlasenyUzivatel == null}">
6.7 - <p>pro vkládání komentářů se prosím přihlašte</p>
6.8 + <p><fmt:message key="komentare.prihlasitSe"/></p>
6.9 </c:when>
6.10 <c:otherwise>
6.11 <p>Uživatel: <c:out value="${prihlasenyUzivatel}" /></p>
6.12 </c:otherwise>
6.13 </c:choose>
6.14
6.15 + <c:if test="${fn:length(podnik.komentare) == 0}">
6.16 + <p><fmt:message key="komentare.zadneKomentare"/></p>
6.17 + </c:if>
6.18
6.19 +
6.20 +
6.21 + <c:forEach var="k" items="${podnik.komentare}">
6.22 + <div class="komentar">
6.23 + <h4>
6.24 + Napsal: <c:out value="${k.uzivatel}" />,
6.25 + <fmt:formatDate value="${k.datum}" pattern="dd. MMMM yyyy HH:mm"/>
6.26 + <br/>
6.27 + Předmět: <c:out value="${k.nadpis}" />
6.28 + </h4>
6.29 + <!-- Pozor: předpokládáme, že v DB jsou pouze zkontrolovaná data -->
6.30 + <c:out value="${k.komentar}" escapeXml="false" />
6.31 + </div>
6.32 + </c:forEach>
6.33 </div>
6.34
6.35 </jsp:root>
6.36 \ No newline at end of file
7.1 --- a/java/nekurak.net-web/web/styl.css Mon Jun 07 23:14:02 2010 +0200
7.2 +++ b/java/nekurak.net-web/web/styl.css Tue Jun 08 02:37:04 2010 +0200
7.3 @@ -211,4 +211,21 @@
7.4
7.5 .komentare {
7.6 border-top: 1px dashed silver;
7.7 + margin-bottom: 8px;
7.8 }
7.9 +
7.10 +.komentar {
7.11 + border-top: 1px solid #e7e6e6;
7.12 +}
7.13 +
7.14 +.komentar h4 {
7.15 + font-size: medium;
7.16 + font-weight: bold;
7.17 + margin-top: 8px;
7.18 + margin-bottom: 0px;
7.19 +}
7.20 +
7.21 +.komentar p {
7.22 + margin-top: 8px;
7.23 + margin-bottom: 8px;
7.24 +}
7.25 \ No newline at end of file