Zobrazování, zatím vycpávkového, denního souhrnu.
1.1 --- a/java/HrisniciSpameri/nbproject/genfiles.properties Wed Feb 11 17:52:08 2009 +0100
1.2 +++ b/java/HrisniciSpameri/nbproject/genfiles.properties Wed Feb 11 19:36:28 2009 +0100
1.3 @@ -1,8 +1,8 @@
1.4 -build.xml.data.CRC32=4b8c700f
1.5 +build.xml.data.CRC32=0d6b07a9
1.6 build.xml.script.CRC32=20d691ac
1.7 build.xml.stylesheet.CRC32=c0ebde35
1.8 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
1.9 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
1.10 -nbproject/build-impl.xml.data.CRC32=4b8c700f
1.11 +nbproject/build-impl.xml.data.CRC32=0d6b07a9
1.12 nbproject/build-impl.xml.script.CRC32=cde5e1cb
1.13 nbproject/build-impl.xml.stylesheet.CRC32=174458fc
2.1 --- a/java/HrisniciSpameri/nbproject/private/private.properties Wed Feb 11 17:52:08 2009 +0100
2.2 +++ b/java/HrisniciSpameri/nbproject/private/private.properties Wed Feb 11 19:36:28 2009 +0100
2.3 @@ -1,10 +1,16 @@
2.4 -deploy.ant.properties.file=/home/fiki/.netbeans/6.5/glassfish_2.properties
2.5 +auxiliary.org-netbeans-modules-web-client-tools-api.clientdebug=false
2.6 +auxiliary.org-netbeans-modules-web-client-tools-api.FIREFOX=true
2.7 +auxiliary.org-netbeans-modules-web-client-tools-api.INTERNET_5f_EXPLORER=false
2.8 +auxiliary.org-netbeans-modules-web-client-tools-api.serverdebug=true
2.9 +deploy.ant.properties.file=/home/fiki/.netbeans/6.5/glassfish.properties
2.10 j2ee.platform.classpath=/usr/local/glassfish-v2ur2/lib/javaee.jar:/usr/local/glassfish-v2ur2/lib/jsf-impl.jar:/usr/local/glassfish-v2ur2/lib/activation.jar:/usr/local/glassfish-v2ur2/lib/appserv-tags.jar:/usr/local/glassfish-v2ur2/lib/mail.jar:/usr/local/glassfish-v2ur2/lib/appserv-jstl.jar:/usr/local/glassfish-v2ur2/lib/webservices-tools.jar:/usr/local/glassfish-v2ur2/lib/webservices-rt.jar:/usr/local/glassfish-v2ur2/lib/appserv-ws.jar
2.11 j2ee.platform.is.jsr109=true
2.12 j2ee.platform.wscompile.classpath=/usr/local/glassfish-v2ur2/lib/j2ee.jar:/usr/local/glassfish-v2ur2/lib/saaj-api.jar:/usr/local/glassfish-v2ur2/lib/saaj-impl.jar:/usr/local/glassfish-v2ur2/lib/jaxrpc-api.jar:/usr/local/glassfish-v2ur2/lib/jaxrpc-impl.jar:/usr/local/glassfish-v2ur2/lib/endorsed/jaxp-api.jar:/usr/local/glassfish-v2ur2/lib/appserv-ws.jar:/usr/local/glassfish-v2ur2/lib/webservices-tools.jar:/usr/local/glassfish-v2ur2/lib/webservices-rt.jar
2.13 j2ee.platform.wsgen.classpath=/usr/local/glassfish-v2ur2/lib/webservices-tools.jar:/usr/local/glassfish-v2ur2/lib/webservices-rt.jar:/usr/local/glassfish-v2ur2/lib/tools.jar:/usr/local/glassfish-v2ur2/lib/appserv-jstl.jar:/usr/local/glassfish-v2ur2/lib/javaee.jar:/usr/local/glassfish-v2ur2/lib/appserv-ws.jar:/usr/local/glassfish-v2ur2/lib/mail.jar:/usr/local/glassfish-v2ur2/lib/activation.jar
2.14 j2ee.platform.wsimport.classpath=/usr/local/glassfish-v2ur2/lib/webservices-tools.jar:/usr/local/glassfish-v2ur2/lib/webservices-rt.jar:/usr/local/glassfish-v2ur2/lib/tools.jar:/usr/local/glassfish-v2ur2/lib/appserv-jstl.jar:/usr/local/glassfish-v2ur2/lib/javaee.jar:/usr/local/glassfish-v2ur2/lib/appserv-ws.jar:/usr/local/glassfish-v2ur2/lib/mail.jar:/usr/local/glassfish-v2ur2/lib/activation.jar
2.15 j2ee.platform.wsit.classpath=
2.16 -j2ee.server.instance=[/usr/local/glassfish-v2ur2]deployer:Sun:AppServer::hw.frantovo.cz:4949
2.17 +j2ee.server.instance=[/usr/local/glassfish-v2ur2]deployer:Sun:AppServer::frantovo.cz:4949
2.18 +javac.debug=true
2.19 +javadoc.preview=true
2.20 jaxws.endorsed.dir=/usr/local/netbeans-6.5/java2/modules/ext/jaxws21/api:/usr/local/netbeans-6.5/ide10/modules/ext/jaxb/api
2.21 user.properties.file=/home/fiki/.netbeans/6.5/build.properties
3.1 --- a/java/HrisniciSpameri/nbproject/private/private.xml Wed Feb 11 17:52:08 2009 +0100
3.2 +++ b/java/HrisniciSpameri/nbproject/private/private.xml Wed Feb 11 19:36:28 2009 +0100
3.3 @@ -1,6 +1,2 @@
3.4 <?xml version="1.0" encoding="UTF-8"?>
3.5 -<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
3.6 - <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/1">
3.7 - <file>file:/home/fiki/src/HrisniciSpameri/web/index.jsp</file>
3.8 - </open-files>
3.9 -</project-private>
3.10 +<project-private xmlns="http://www.netbeans.org/ns/project-private/1"/>
4.1 --- a/java/HrisniciSpameri/nbproject/project.properties Wed Feb 11 17:52:08 2009 +0100
4.2 +++ b/java/HrisniciSpameri/nbproject/project.properties Wed Feb 11 19:36:28 2009 +0100
4.3 @@ -49,7 +49,6 @@
4.4 javadoc.windowtitle=
4.5 jspcompilation.classpath=${jspc.classpath}:${javac.classpath}
4.6 lib.dir=${web.docbase.dir}/WEB-INF/lib
4.7 -no.dependencies=false
4.8 persistence.xml.dir=${conf.dir}
4.9 platform.active=default_platform
4.10 resource.dir=setup
5.1 --- a/java/HrisniciSpameri/nbproject/project.xml Wed Feb 11 17:52:08 2009 +0100
5.2 +++ b/java/HrisniciSpameri/nbproject/project.xml Wed Feb 11 19:36:28 2009 +0100
5.3 @@ -8,10 +8,10 @@
5.4 <web-module-libraries/>
5.5 <web-module-additional-libraries/>
5.6 <source-roots>
5.7 - <root id="src.dir" name="Source Packages"/>
5.8 + <root id="src.dir"/>
5.9 </source-roots>
5.10 <test-roots>
5.11 - <root id="test.src.dir" name="Test Packages"/>
5.12 + <root id="test.src.dir"/>
5.13 </test-roots>
5.14 </data>
5.15 </configuration>
6.1 --- a/java/HrisniciSpameri/src/java/cz/frantovo/hrisniciSpameri/DenniSouhrn.java Wed Feb 11 17:52:08 2009 +0100
6.2 +++ b/java/HrisniciSpameri/src/java/cz/frantovo/hrisniciSpameri/DenniSouhrn.java Wed Feb 11 19:36:28 2009 +0100
6.3 @@ -1,12 +1,85 @@
6.4 package cz.frantovo.hrisniciSpameri;
6.5
6.6 +import cz.frantovo.hrisniciSpameri.dto.Cil;
6.7 +import cz.frantovo.hrisniciSpameri.dto.Souhrn;
6.8 import java.io.Serializable;
6.9 +import java.net.InetAddress;
6.10 +import java.net.UnknownHostException;
6.11 +import java.sql.Date;
6.12 +import java.text.DateFormat;
6.13 +import java.text.ParseException;
6.14 +import java.text.SimpleDateFormat;
6.15 +import java.util.ArrayList;
6.16 +import java.util.Collection;
6.17 +import java.util.logging.Level;
6.18 +import java.util.logging.Logger;
6.19
6.20 /**
6.21 - * Beana zprostředkovávající denní souhrn hříšníků
6.22 + * Beana zprostředkovávající denní souhrn hříšníků.
6.23 * @author fiki
6.24 */
6.25 public class DenniSouhrn implements Serializable {
6.26
6.27 private static final long serialVersionUID = 7932392366943861342L;
6.28 + private static final Logger log = Logger.getLogger(DenniSouhrn.class.getName());
6.29 + private static final long DEN = 1000 * 60 * 60 * 24;
6.30 + private static String formatDataVzor = "yyyy-mm-dd";
6.31 + public static DateFormat formatData = new SimpleDateFormat(formatDataVzor);
6.32 + private Date den;
6.33 +
6.34 + public Date getDen() {
6.35 + return den;
6.36 + }
6.37 +
6.38 + public void setDen(Date den) {
6.39 + if (den == null) {
6.40 + nastavVychoziDen();
6.41 + } else {
6.42 + this.den = den;
6.43 + }
6.44 + log.log(Level.INFO, "Den nastaven na: " + formatData.format(den));
6.45 + }
6.46 +
6.47 + public void setDen(String den) {
6.48 + if (den == null || den.length() != formatDataVzor.length()) {
6.49 + nastavVychoziDen();
6.50 + }
6.51 +
6.52 + try {
6.53 + this.den = new Date(formatData.parse(den).getTime());
6.54 + } catch (ParseException e) {
6.55 + log.log(Level.INFO, "Chybně zadané datum: " + den, e);
6.56 + nastavVychoziDen();
6.57 + }
6.58 + }
6.59 +
6.60 + /**
6.61 + * Ve výchozím stavu zobrazujeme souhrn za předešlý den.
6.62 + * @return včerejšek
6.63 + */
6.64 + private static Date getVychoziDen() {
6.65 + return new Date(System.currentTimeMillis() - DEN);
6.66 + }
6.67 +
6.68 + private void nastavVychoziDen() {
6.69 + log.log(Level.INFO, "Nastavuji den na výchozí hodnotu.");
6.70 + setDen(getVychoziDen());
6.71 + }
6.72 +
6.73 + public Collection<Souhrn> getSouhrn() {
6.74 + Collection<Souhrn> souhrn = new ArrayList<Souhrn>();
6.75 +
6.76 + Cil cil = new Cil(1, "Frantovo.cz", "http://frantovo.cz/blog/", null, null);
6.77 +
6.78 + for (int i = 1; i < 11; i++) {
6.79 + try {
6.80 + Souhrn s = new Souhrn(getVychoziDen(), InetAddress.getByName("127.0.0.1"), 100 + i, cil);
6.81 + souhrn.add(s);
6.82 + } catch (UnknownHostException e) {
6.83 + log.log(Level.SEVERE, null, e);
6.84 + }
6.85 + }
6.86 +
6.87 + return souhrn;
6.88 + }
6.89 }
7.1 --- a/java/HrisniciSpameri/src/java/cz/frantovo/hrisniciSpameri/dto/Cil.java Wed Feb 11 17:52:08 2009 +0100
7.2 +++ b/java/HrisniciSpameri/src/java/cz/frantovo/hrisniciSpameri/dto/Cil.java Wed Feb 11 19:36:28 2009 +0100
7.3 @@ -54,4 +54,15 @@
7.4 public void setDatabaze(String databaze) {
7.5 this.databaze = databaze;
7.6 }
7.7 +
7.8 + public Cil(int id, String nazev, String url, String selekt, String databaze) {
7.9 + this.id = id;
7.10 + this.nazev = nazev;
7.11 + this.url = url;
7.12 + this.selekt = selekt;
7.13 + this.databaze = databaze;
7.14 + }
7.15 +
7.16 + public Cil() {
7.17 + }
7.18 }
8.1 --- a/java/HrisniciSpameri/src/java/cz/frantovo/hrisniciSpameri/dto/Souhrn.java Wed Feb 11 17:52:08 2009 +0100
8.2 +++ b/java/HrisniciSpameri/src/java/cz/frantovo/hrisniciSpameri/dto/Souhrn.java Wed Feb 11 19:36:28 2009 +0100
8.3 @@ -47,4 +47,14 @@
8.4 public void setAdresa(InetAddress adresa) {
8.5 this.adresa = adresa;
8.6 }
8.7 +
8.8 + public Souhrn(Date den, InetAddress adresa, int pocet, Cil cil) {
8.9 + this.den = den;
8.10 + this.adresa = adresa;
8.11 + this.pocet = pocet;
8.12 + this.cil = cil;
8.13 + }
8.14 +
8.15 + public Souhrn() {
8.16 + }
8.17 }
9.1 --- a/java/HrisniciSpameri/web/WEB-INF/sun-web.xml Wed Feb 11 17:52:08 2009 +0100
9.2 +++ b/java/HrisniciSpameri/web/WEB-INF/sun-web.xml Wed Feb 11 19:36:28 2009 +0100
9.3 @@ -1,11 +1,11 @@
9.4 <?xml version="1.0" encoding="UTF-8"?>
9.5 <!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 2.5//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd">
9.6 <sun-web-app error-url="">
9.7 - <context-root>/HrisniciSpameri</context-root>
9.8 - <class-loader delegate="true"/>
9.9 - <jsp-config>
9.10 - <property name="keepgenerated" value="true">
9.11 - <description>Keep a copy of the generated servlet class' java code.</description>
9.12 - </property>
9.13 - </jsp-config>
9.14 + <context-root>/HrisniciSpameri</context-root>
9.15 + <class-loader delegate="true"/>
9.16 + <jsp-config>
9.17 + <property name="keepgenerated" value="true">
9.18 + <description>Keep a copy of the generated servlet class' java code.</description>
9.19 + </property>
9.20 + </jsp-config>
9.21 </sun-web-app>
10.1 --- a/java/HrisniciSpameri/web/WEB-INF/web.xml Wed Feb 11 17:52:08 2009 +0100
10.2 +++ b/java/HrisniciSpameri/web/WEB-INF/web.xml Wed Feb 11 19:36:28 2009 +0100
10.3 @@ -6,6 +6,7 @@
10.4 </session-timeout>
10.5 </session-config>
10.6 <welcome-file-list>
10.7 + <welcome-file>index.jspx</welcome-file>
10.8 <welcome-file>index.jsp</welcome-file>
10.9 </welcome-file-list>
10.10 </web-app>
11.1 --- a/java/HrisniciSpameri/web/index.jsp Wed Feb 11 17:52:08 2009 +0100
11.2 +++ b/java/HrisniciSpameri/web/index.jsp Wed Feb 11 19:36:28 2009 +0100
11.3 @@ -1,19 +1,28 @@
11.4 -<%--
11.5 - Document : index
11.6 - Created on : 11.2.2009, 16:54:21
11.7 - Author : fiki
11.8 ---%>
11.9 -
11.10 <%@page contentType="text/html" pageEncoding="UTF-8"%>
11.11 +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
11.12 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
11.13 - "http://www.w3.org/TR/html4/loose.dtd">
11.14 +"http://www.w3.org/TR/html4/loose.dtd">
11.15
11.16 <html>
11.17 <head>
11.18 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
11.19 - <title>JSP Page</title>
11.20 + <link href="styl.css" type="text/css" rel="StyleSheet"/>
11.21 + <title>Hříšníci spameři</title>
11.22 </head>
11.23 <body>
11.24 - <h1>Hello World!</h1>
11.25 + <h1>Hříšníci spameři</h1>
11.26 +
11.27 +
11.28 + <c:choose>
11.29 + <c:when test="${param.s == 'ucitele'}">
11.30 + <jsp:include page="souhrn.jspx"/>
11.31 + </c:when>
11.32 + <c:when test="${param.s == 'komise'}">
11.33 + <jsp:include page="souhrn.jspx"/>
11.34 + </c:when>
11.35 + <c:otherwise>
11.36 + <jsp:include page="souhrn.jspx"/>
11.37 + </c:otherwise>
11.38 + </c:choose>
11.39 </body>
11.40 </html>
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2 +++ b/java/HrisniciSpameri/web/souhrn.jspx Wed Feb 11 19:36:28 2009 +0100
12.3 @@ -0,0 +1,37 @@
12.4 +<?xml version="1.0" encoding="UTF-8"?>
12.5 +<!--
12.6 + Document : souhrn
12.7 + Created on : 11.2.2009, 18:54:42
12.8 + Author : fiki
12.9 +-->
12.10 +<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
12.11 + xmlns:c="http://java.sun.com/jsp/jstl/core"
12.12 + version="2.0">
12.13 +
12.14 + <jsp:useBean id="denniSouhrn" class="cz.frantovo.hrisniciSpameri.DenniSouhrn" scope="page"/>
12.15 +
12.16 +
12.17 +
12.18 +
12.19 +
12.20 +
12.21 + <table>
12.22 + <thead>
12.23 + <td title="Jméno a příjmení">IP adresa</td>
12.24 + <td title="Přihlašovací jméno">Doména</td>
12.25 + <td title="Jestli může být předsedou komise">Počet pokusů</td>
12.26 + <td title="Jestli může být předsedou komise">Cíl útoku</td>
12.27 + </thead>
12.28 + <tbody>
12.29 + <c:forEach var="s" items="${denniSouhrn.souhrn}">
12.30 + <tr>
12.31 + <td><c:out value="${s.adresa}"/></td>
12.32 + <td><c:out value="${s.adresa}"/></td>
12.33 + <td><c:out value="${s.pocet}"/></td>
12.34 + <td><c:out value="${s.cil.nazev}"/></td>
12.35 + </tr>
12.36 + </c:forEach>
12.37 + </tbody>
12.38 + </table>
12.39 +
12.40 +</jsp:root>
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13.2 +++ b/java/HrisniciSpameri/web/styl.css Wed Feb 11 19:36:28 2009 +0100
13.3 @@ -0,0 +1,13 @@
13.4 +table {
13.5 + border: 1px solid black;
13.6 + border-collapse:collapse;
13.7 +}
13.8 +td {
13.9 + border: 1px solid black;
13.10 + padding: 3px;
13.11 +}
13.12 +thead {
13.13 + background: silver;
13.14 + font-weight:bold;
13.15 +
13.16 +}
13.17 \ No newline at end of file