1.1 --- a/java/HrisniciSpameri/src/java/cz/frantovo/hrisniciSpameri/DenniSouhrn.java Thu Feb 12 21:17:09 2009 +0100
1.2 +++ b/java/HrisniciSpameri/src/java/cz/frantovo/hrisniciSpameri/DenniSouhrn.java Fri Feb 13 00:26:59 2009 +0100
1.3 @@ -23,11 +23,19 @@
1.4 private static final long serialVersionUID = 7932392366943861342L;
1.5 private static final Logger log = Logger.getLogger(DenniSouhrn.class.getName());
1.6 private static final long DEN = 1000 * 60 * 60 * 24;
1.7 - private static String formatDataVzor = "yyyy-mm-dd";
1.8 + private static String formatDataVzor = "yyyy-MM-dd";
1.9 public static DateFormat formatData = new SimpleDateFormat(formatDataVzor);
1.10 private Date den;
1.11 + private int cil;
1.12 +
1.13 + public String getDenString() {
1.14 + return formatData.format(getDen());
1.15 + }
1.16
1.17 public Date getDen() {
1.18 + if (den == null) {
1.19 + nastavVychoziDen();
1.20 + }
1.21 return den;
1.22 }
1.23
1.24 @@ -37,22 +45,42 @@
1.25 } else {
1.26 this.den = den;
1.27 }
1.28 - log.log(Level.INFO, "Den nastaven na: " + formatData.format(den));
1.29 + log.log(Level.FINE, "Den nastaven na: " + formatData.format(den));
1.30 }
1.31
1.32 - public void setDen(String den) {
1.33 - if (den == null || den.length() != formatDataVzor.length()) {
1.34 + public void setDenString(String den) {
1.35 + if (den == null) {
1.36 nastavVychoziDen();
1.37 }
1.38
1.39 try {
1.40 this.den = new Date(formatData.parse(den).getTime());
1.41 } catch (ParseException e) {
1.42 - log.log(Level.INFO, "Chybně zadané datum: " + den, e);
1.43 + log.log(Level.FINE, "Chybně zadané datum: " + den, e);
1.44 nastavVychoziDen();
1.45 }
1.46 }
1.47
1.48 + public void setCilString(String cil) {
1.49 + try {
1.50 + this.cil = Integer.parseInt(cil);
1.51 + } catch (Exception e) {
1.52 + this.cil = 0;
1.53 + }
1.54 + }
1.55 +
1.56 + public void setCil(int cil) {
1.57 + this.cil = cil;
1.58 + }
1.59 +
1.60 + public String getCilString() {
1.61 + return String.valueOf(cil);
1.62 + }
1.63 +
1.64 + public int getCil() {
1.65 + return cil;
1.66 + }
1.67 +
1.68 /**
1.69 * Ve výchozím stavu zobrazujeme souhrn za předešlý den.
1.70 * @return včerejšek
1.71 @@ -62,17 +90,17 @@
1.72 }
1.73
1.74 private void nastavVychoziDen() {
1.75 - log.log(Level.INFO, "Nastavuji den na výchozí hodnotu.");
1.76 + log.log(Level.FINE, "Nastavuji den na výchozí hodnotu.");
1.77 setDen(getVychoziDen());
1.78 }
1.79
1.80 public Collection<Souhrn> getSouhrn() {
1.81 Collection<Souhrn> souhrn = new ArrayList<Souhrn>();
1.82
1.83 - Cil cil = new Cil(1, "Frantovo.cz", "http://frantovo.cz/blog/", null, null);
1.84 + Cil c = new Cil(1, "Frantovo.cz", "http://frantovo.cz/blog/", null, null);
1.85
1.86 for (int i = 1; i < 11; i++) {
1.87 - Souhrn s = new Souhrn(getVychoziDen(), new SitovaAdresa("10.0.0.8", i + ".frantovo.cz"), 100 + i, cil);
1.88 + Souhrn s = new Souhrn(getVychoziDen(), new SitovaAdresa("10.0.0.8", i + ".frantovo.cz"), 100 + i, c);
1.89 souhrn.add(s);
1.90 }
1.91
2.1 --- a/java/HrisniciSpameri/src/java/cz/frantovo/hrisniciSpameri/dao/HrisniciSuperDAO.java Thu Feb 12 21:17:09 2009 +0100
2.2 +++ b/java/HrisniciSpameri/src/java/cz/frantovo/hrisniciSpameri/dao/HrisniciSuperDAO.java Fri Feb 13 00:26:59 2009 +0100
2.3 @@ -46,7 +46,6 @@
2.4 jndi = orizniJNDI(jndi);
2.5 DataSource zdroj = null;
2.6 try {
2.7 - System.out.println("XXXXXX:" + jndi + ":XXXXX");
2.8 zdroj = (DataSource) kontext.lookup(jndi);
2.9 return zdroj.getConnection();
2.10 } catch (NamingException ex) {
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/java/HrisniciSpameri/web/funkce.js Fri Feb 13 00:26:59 2009 +0100
3.3 @@ -0,0 +1,13 @@
3.4 +function zobrazNeboSkryj(idElementu)
3.5 +{
3.6 + prvek = document.getElementById(idElementu);
3.7 +
3.8 + if (prvek.style.display == "none" || prvek.style.display == "")
3.9 + {
3.10 + prvek.style.display = "block";
3.11 + }
3.12 + else
3.13 + {
3.14 + prvek.style.display = "none";
3.15 + }
3.16 +}
4.1 --- a/java/HrisniciSpameri/web/index.jsp Thu Feb 12 21:17:09 2009 +0100
4.2 +++ b/java/HrisniciSpameri/web/index.jsp Fri Feb 13 00:26:59 2009 +0100
4.3 @@ -8,6 +8,7 @@
4.4 <meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8"/>
4.5 <link href="styl.css" type="text/css" rel="StyleSheet"/>
4.6 <script type="text/javascript" src="tridenitabulky.js"></script>
4.7 + <script type="text/javascript" src="funkce.js"></script>
4.8 <title>Hříšníci spameři</title>
4.9 </head>
4.10 <body>
5.1 --- a/java/HrisniciSpameri/web/souhrn.jspx Thu Feb 12 21:17:09 2009 +0100
5.2 +++ b/java/HrisniciSpameri/web/souhrn.jspx Fri Feb 13 00:26:59 2009 +0100
5.3 @@ -10,28 +10,47 @@
5.4 version="2.0">
5.5
5.6 <jsp:useBean id="denniSouhrn" class="cz.frantovo.hrisniciSpameri.DenniSouhrn" scope="page"/>
5.7 + <jsp:setProperty name="denniSouhrn" property="denString" value="${param.den}"/>
5.8 + <jsp:setProperty name="denniSouhrn" property="cilString" value="${param.cil}"/>
5.9
5.10
5.11 + <p><a onclick="JavaScript: zobrazNeboSkryj('seznamCilu')" href="#">Seznam cílů</a></p>
5.12 + <div id="seznamCilu">
5.13 + <ul>
5.14 + <c:forEach var="c" items="${denniSouhrn.seznamCilu}">
5.15 + <li>
5.16 + <c:choose>
5.17 + <c:when test="${c.url == null}">
5.18 + <c:out value="${c.nazev}"/>
5.19 + </c:when>
5.20 + <c:otherwise>
5.21 + <a href="${f:escapeXml(c.url)}"><c:out value="${c.nazev}"/></a>
5.22 + </c:otherwise>
5.23 + </c:choose>
5.24 + </li>
5.25 + </c:forEach>
5.26 + </ul>
5.27 + </div>
5.28
5.29
5.30 - <h2>Seznam cílů</h2>
5.31 - <ul>
5.32 - <c:forEach var="c" items="${denniSouhrn.seznamCilu}">
5.33 - <li>
5.34 + <h2>Denní souhrn</h2>
5.35 + <form action="#" method="get">
5.36 + <input name="den" type="text" value="${denniSouhrn.den}"/>
5.37 + <select name="cil">
5.38 + <option value="0">Všechny cíle</option>
5.39 + <c:forEach var="c" items="${denniSouhrn.seznamCilu}">
5.40 <c:choose>
5.41 - <c:when test="${c.url == null}">
5.42 - <c:out value="${c.nazev}"/>
5.43 + <c:when test="${c.id == denniSouhrn.cil}">
5.44 + <option value="${c.id}" selected="selected"><c:out value="${c.nazev}"/></option>
5.45 </c:when>
5.46 <c:otherwise>
5.47 - <a href="${f:escapeXml(c.url)}"><c:out value="${c.nazev}"/></a>
5.48 + <option value="${c.id}"><c:out value="${c.nazev}"/></option>
5.49 </c:otherwise>
5.50 </c:choose>
5.51 - </li>
5.52 - </c:forEach>
5.53 - </ul>
5.54 -
5.55 -
5.56 - <h2>Denní souhrn</h2>
5.57 + </c:forEach>
5.58 + </select>
5.59 + <button>Zobrazit</button>
5.60 + </form>
5.61
5.62 <table class="sortable" id="seznamHrisniku">
5.63 <thead>
6.1 --- a/java/HrisniciSpameri/web/styl.css Thu Feb 12 21:17:09 2009 +0100
6.2 +++ b/java/HrisniciSpameri/web/styl.css Fri Feb 13 00:26:59 2009 +0100
6.3 @@ -34,4 +34,8 @@
6.4 margin-bottom: 1em;
6.5 text-align: center;
6.6 background-color: #e6e6e6;
6.7 +}
6.8 +
6.9 +#seznamCilu {
6.10 + display: none;
6.11 }
6.12 \ No newline at end of file