Atom syndikace, slovenština, ověřování uživatelů proti DB.
authorFrantišek Kučera <franta-hg@frantovo.cz>
Thu, 04 Mar 2010 10:20:28 +0100
changeset 499b2a597cc862
parent 48 86bd44cebe8f
child 50 d259a2dfea67
Atom syndikace, slovenština, ověřování uživatelů proti DB.
java/nekurak.net-ejb/src/java/cz/frantovo/nekurak/dao/PodnikDAO.java
java/nekurak.net-web/src/java/cz/frantovo/nekurak/preklady_cs.properties
java/nekurak.net-web/src/java/cz/frantovo/nekurak/preklady_en.properties
java/nekurak.net-web/src/java/cz/frantovo/nekurak/preklady_sk.properties
java/nekurak.net-web/src/java/cz/frantovo/nekurak/web/Atom.java
java/nekurak.net-web/src/java/cz/frantovo/nekurak/web/HledacSluzby.java
java/nekurak.net-web/web/WEB-INF/atom/atom.jsp
java/nekurak.net-web/web/WEB-INF/casti/prepinaniJazyku.jsp
java/nekurak.net-web/web/WEB-INF/sun-web.xml
java/nekurak.net-web/web/WEB-INF/web.xml
java/nekurak.net-web/web/grafika/jazyk_sk.png
java/nekurak.net-web/web/index.jsp
java/nekurak.net-web/web/styl.css
     1.1 --- a/java/nekurak.net-ejb/src/java/cz/frantovo/nekurak/dao/PodnikDAO.java	Fri Feb 26 23:45:43 2010 +0100
     1.2 +++ b/java/nekurak.net-ejb/src/java/cz/frantovo/nekurak/dao/PodnikDAO.java	Thu Mar 04 10:20:28 2010 +0100
     1.3 @@ -2,6 +2,7 @@
     1.4  
     1.5  import cz.frantovo.nekurak.dto.Podnik;
     1.6  import java.util.Collection;
     1.7 +import java.util.Date;
     1.8  import javax.ejb.LocalBean;
     1.9  import javax.ejb.Stateless;
    1.10  import javax.persistence.EntityManager;
    1.11 @@ -26,6 +27,10 @@
    1.12      }
    1.13  
    1.14      public void uloz(Podnik p) {
    1.15 +	if (p.getDatum() == null) {
    1.16 +	    p.setDatum(new Date());
    1.17 +	}
    1.18 +
    1.19  	em.persist(p);
    1.20      }
    1.21  
     2.1 --- a/java/nekurak.net-web/src/java/cz/frantovo/nekurak/preklady_cs.properties	Fri Feb 26 23:45:43 2010 +0100
     2.2 +++ b/java/nekurak.net-web/src/java/cz/frantovo/nekurak/preklady_cs.properties	Thu Mar 04 10:20:28 2010 +0100
     2.3 @@ -12,6 +12,8 @@
     2.4  
     2.5  prepinaniJazyku.cestina=\u010De\u0161tina
     2.6  prepinaniJazyku.cestina.tip=str\u00E1nka ji\u017E je v \u010De\u0161tin\u011B
     2.7 +prepinaniJazyku.slovenstina=sloven\u0161tina
     2.8 +prepinaniJazyku.slovenstina.tip=p\u0159epnout na sloven\u0161tinu
     2.9  prepinaniJazyku.anglictina=angli\u010Dtina
    2.10  prepinaniJazyku.anglictina.tip=p\u0159epnout na angli\u010Dtinu
    2.11  
     3.1 --- a/java/nekurak.net-web/src/java/cz/frantovo/nekurak/preklady_en.properties	Fri Feb 26 23:45:43 2010 +0100
     3.2 +++ b/java/nekurak.net-web/src/java/cz/frantovo/nekurak/preklady_en.properties	Thu Mar 04 10:20:28 2010 +0100
     3.3 @@ -12,6 +12,8 @@
     3.4  
     3.5  prepinaniJazyku.cestina=Czech
     3.6  prepinaniJazyku.cestina.tip=switch to Czech
     3.7 +prepinaniJazyku.slovenstina=Slovak
     3.8 +prepinaniJazyku.slovenstina.tip=switch to Slovak
     3.9  prepinaniJazyku.anglictina=English
    3.10  prepinaniJazyku.anglictina.tip=page is already in English
    3.11  
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/java/nekurak.net-web/src/java/cz/frantovo/nekurak/preklady_sk.properties	Thu Mar 04 10:20:28 2010 +0100
     4.3 @@ -0,0 +1,50 @@
     4.4 +jazyk=sloven\u0161tina
     4.5 +
     4.6 +nazev=Neku\u0159\u00E1k.net
     4.7 +popis=Datab\u00E1ze neku\u0159\u00E1ck\u00FDch restaurac\u00ED.
     4.8 +licence=\u00A9 2010 nekurak.net. Licence: Affero GPL.
     4.9 +
    4.10 +uvod=\u00DAvod
    4.11 +prihlasitSe=P\u0159ihl\u00E1sit sa
    4.12 +odhlasitSe=Odhl\u00E1sit sa
    4.13 +pridatPodnik=P\u0159idat podnik
    4.14 +prihlasenyUzivatel=P\u0159ihl\u00E1\u0161en\u00FD u\u017Eivatel
    4.15 +
    4.16 +prepinaniJazyku.cestina=\u010De\u0161tina
    4.17 +prepinaniJazyku.cestina.tip=p\u0159epnout na \u010De\u0161tinu
    4.18 +prepinaniJazyku.slovenstina=sloven\u0161tina
    4.19 +prepinaniJazyku.slovenstina.tip=str\u00E1nka ji\u017E je ve sloven\u0161tin\u011B
    4.20 +prepinaniJazyku.anglictina=angli\u010Dtina
    4.21 +prepinaniJazyku.anglictina.tip=p\u0159epnout na angli\u010Dtinu
    4.22 +
    4.23 +chybovaStranka.404.nazev=404 Str\u00E1nka nenalezena
    4.24 +chybovaStranka.404.popis=Takovou str\u00E1nku tu bohu\u017Eel nem\u00E1me.
    4.25 +chybovaStranka.500.nazev=500 Intern\u00ED chyba serveru
    4.26 +chybovaStranka.500.popis=N\u011Bco se bohu\u017Eel nepovedlo.
    4.27 +
    4.28 +uvod.naposledyPridanePodniky=Naposledy p\u0159idan\u00E9 podniky
    4.29 +uvod.www=www str\u00E1nka
    4.30 +uvod.adresa=Adresa
    4.31 +
    4.32 +
    4.33 +prihlaseni.odhlaseniUspesne=Odhl\u00E1\u0161en\u00ED prob\u011Bhlo \u00FAsp\u011B\u0161n\u011B.
    4.34 +prihlaseni.nadpis=P\u0159ihl\u00E1\u0161en\u00ED
    4.35 +prihlaseni.zadejte=Zadejte jm\u00E9no a heslo.
    4.36 +prihlaseni.chyba=Nespr\u00E1vn\u00E9 jm\u00E9no nebo heslo, zkuste to pros\u00EDm znovu.
    4.37 +prihlaseni.jmeno=Jm\u00E9no
    4.38 +prihlaseni.heslo=Heslo
    4.39 +prihlaseni.tlacitko=P\u0159ihl\u00E1sit se
    4.40 +
    4.41 +pridatPodnik.nadpis=P\u0159id\u00E1n\u00ED nov\u00E9ho podniku
    4.42 +pridatPodnik.bylPridan=Podnik byl \u00FAsp\u011B\u0161n\u011B p\u0159id\u00E1n.
    4.43 +pridatPodnik.tlacitko=P\u0159idat podnik
    4.44 +
    4.45 +dto.podnik.nazev=N\u00E1zev
    4.46 +dto.podnik.popis=Popis
    4.47 +dto.podnik.url=URL
    4.48 +dto.podnik.url.tip=www str\u00E1nka
    4.49 +dto.podnik.datum=Datum
    4.50 +dto.podnik.ulice=Ulice
    4.51 +dto.podnik.cisloPopisne=\u010D.p.
    4.52 +dto.podnik.cisloPopisne.tip=\u010D\u00EDslo popisn\u00E9
    4.53 +dto.podnik.mesto=M\u011Bsto
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/java/nekurak.net-web/src/java/cz/frantovo/nekurak/web/Atom.java	Thu Mar 04 10:20:28 2010 +0100
     5.3 @@ -0,0 +1,29 @@
     5.4 +package cz.frantovo.nekurak.web;
     5.5 +
     5.6 +import cz.frantovo.nekurak.dto.Podnik;
     5.7 +import java.util.Collection;
     5.8 +import java.util.Date;
     5.9 +
    5.10 +/**
    5.11 + *
    5.12 + * @author fiki
    5.13 + */
    5.14 +public class Atom {
    5.15 +
    5.16 +    private HledacSluzby hledac = new HledacSluzby();
    5.17 +    private Collection<Podnik> podniky;
    5.18 +
    5.19 +    public Collection<Podnik> getPodniky() {
    5.20 +	if (podniky == null) {
    5.21 +	    podniky = hledac.getPodnikEJB().getPodniky();
    5.22 +	}
    5.23 +	return podniky;
    5.24 +    }
    5.25 +
    5.26 +    public Date getDatumAktualizace() {
    5.27 +	for (Podnik p : getPodniky()) {
    5.28 +	    return p.getDatum();
    5.29 +	}
    5.30 +	return new Date();
    5.31 +    }
    5.32 +}
     6.1 --- a/java/nekurak.net-web/src/java/cz/frantovo/nekurak/web/HledacSluzby.java	Fri Feb 26 23:45:43 2010 +0100
     6.2 +++ b/java/nekurak.net-web/src/java/cz/frantovo/nekurak/web/HledacSluzby.java	Thu Mar 04 10:20:28 2010 +0100
     6.3 @@ -1,6 +1,5 @@
     6.4  package cz.frantovo.nekurak.web;
     6.5  
     6.6 -import cz.frantovo.nekurak.ejb.PodnikDAORemote;
     6.7  import cz.frantovo.nekurak.ejb.PodnikRemote;
     6.8  import java.io.Serializable;
     6.9  import java.util.logging.Level;
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/java/nekurak.net-web/web/WEB-INF/atom/atom.jsp	Thu Mar 04 10:20:28 2010 +0100
     7.3 @@ -0,0 +1,47 @@
     7.4 +<?xml version="1.0" encoding="UTF-8"?>
     7.5 +<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
     7.6 +	  xmlns:c="http://java.sun.com/jsp/jstl/core"
     7.7 +	  xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
     7.8 +	  version="2.0">
     7.9 +    <jsp:directive.page contentType="application/atom+xml"/>
    7.10 +
    7.11 +    <!-- <lokalizace> -->
    7.12 +    <c:if test="${param.jazyk != null}">
    7.13 +	<fmt:setLocale value="${param.jazyk}" scope="session"/>
    7.14 +    </c:if>
    7.15 +    <fmt:setBundle basename="cz.frantovo.nekurak.preklady" scope="application"/>
    7.16 +    <!-- </lokalizace> -->
    7.17 +
    7.18 +    <jsp:useBean id="atom" class="cz.frantovo.nekurak.web.Atom" scope="request"/>
    7.19 +
    7.20 +    <feed xmlns="http://www.w3.org/2005/Atom">
    7.21 +	<title><fmt:message key="nazev"/></title>
    7.22 +	<subtitle><fmt:message key="popis"/></subtitle>
    7.23 +	<link href="http://nekurak.net/atom/" rel="self"/>
    7.24 +	<link href="http://nekurak.net/"/>
    7.25 +	<updated>
    7.26 +	    <fmt:formatDate value="${atom.datumAktualizace}" pattern="yyyy-MM-dd'T'HH:mm:ss'Z'"/>
    7.27 +	</updated>
    7.28 +	<author>
    7.29 +	    <name>František Kučera</name>
    7.30 +	    <email>franta_nechci_spam@frantovo.cz</email>
    7.31 +	</author>
    7.32 +	<id>urn:uuid:0663f9ab-e289-47b3-893f-5bafcf8dc110</id>
    7.33 +
    7.34 +
    7.35 +	<c:forEach var="podnik" items="${atom.podniky}">
    7.36 +	    <entry>
    7.37 +		<title><c:out value="${podnik.nazev}"/></title>
    7.38 +		<link href="http://nekurak.net/?akce=detail&amp;amp;podnik=${podnik.id}"/>
    7.39 +		<id>urn:NekurakNET:podnik:${podnik.id}</id>
    7.40 +		<updated>
    7.41 +		    <fmt:formatDate value="${podnik.datum}" pattern="yyyy-MM-dd'T'HH:mm:ss'Z'"/>
    7.42 +		</updated>
    7.43 +		<summary><c:out value="${podnik.popis}"/></summary>
    7.44 +	    </entry>
    7.45 +	</c:forEach>
    7.46 +
    7.47 +
    7.48 +    </feed>
    7.49 +
    7.50 +</jsp:root>
     8.1 --- a/java/nekurak.net-web/web/WEB-INF/casti/prepinaniJazyku.jsp	Fri Feb 26 23:45:43 2010 +0100
     8.2 +++ b/java/nekurak.net-web/web/WEB-INF/casti/prepinaniJazyku.jsp	Thu Mar 04 10:20:28 2010 +0100
     8.3 @@ -6,9 +6,12 @@
     8.4      <div id="prepinaniJazyku">
     8.5  	<fmt:message key="prepinaniJazyku.cestina" var="prepinaniJazykuCestina"/>
     8.6  	<fmt:message key="prepinaniJazyku.cestina.tip" var="prepinaniJazykuCestinaTip"/>
     8.7 +	<fmt:message key="prepinaniJazyku.slovenstina" var="prepinaniJazykuSlovenstina"/>
     8.8 +	<fmt:message key="prepinaniJazyku.slovenstina.tip" var="prepinaniJazykuSlovenstinaTip"/>
     8.9  	<fmt:message key="prepinaniJazyku.anglictina" var="prepinaniJazykuAnglictina"/>
    8.10  	<fmt:message key="prepinaniJazyku.anglictina.tip" var="prepinaniJazykuAnglictinaTip"/>
    8.11  	<a href="?jazyk=cs"><img src="grafika/jazyk_cs.png" alt="${prepinaniJazykuCestina}" title="${prepinaniJazykuCestinaTip}"/></a>
    8.12 +	<a href="?jazyk=sk"><img src="grafika/jazyk_sk.png" alt="${prepinaniJazykuSlovenstina}" title="${prepinaniJazykuSlovenstinaTip}"/></a>
    8.13  	<a href="?jazyk=en"><img src="grafika/jazyk_en.png" alt="${prepinaniJazykuAnglictina}" title="${prepinaniJazykuAnglictinaTip}"/></a>
    8.14      </div>
    8.15  
     9.1 --- a/java/nekurak.net-web/web/WEB-INF/sun-web.xml	Fri Feb 26 23:45:43 2010 +0100
     9.2 +++ b/java/nekurak.net-web/web/WEB-INF/sun-web.xml	Thu Mar 04 10:20:28 2010 +0100
     9.3 @@ -11,6 +11,6 @@
     9.4      </jsp-config>
     9.5      <security-role-mapping>
     9.6  	<role-name>opravneny</role-name>
     9.7 -	<group-name>spravce</group-name>
     9.8 +	<group-name>bezny</group-name>
     9.9      </security-role-mapping>
    9.10  </sun-web-app>
    10.1 --- a/java/nekurak.net-web/web/WEB-INF/web.xml	Fri Feb 26 23:45:43 2010 +0100
    10.2 +++ b/java/nekurak.net-web/web/WEB-INF/web.xml	Thu Mar 04 10:20:28 2010 +0100
    10.3 @@ -1,46 +1,56 @@
    10.4  <?xml version="1.0" encoding="UTF-8"?>
    10.5  <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    10.6      <session-config>
    10.7 -        <session-timeout>30</session-timeout>
    10.8 +	<session-timeout>30</session-timeout>
    10.9      </session-config>
   10.10  
   10.11      <welcome-file-list>
   10.12 -        <welcome-file>index.jsp</welcome-file>
   10.13 +	<welcome-file>index.jsp</welcome-file>
   10.14      </welcome-file-list>
   10.15  
   10.16      <error-page>
   10.17 -        <!-- Stránka nenalezena -->
   10.18 -        <error-code>404</error-code>
   10.19 -        <location>/WEB-INF/chyby/404.jsp</location>
   10.20 +	<!-- Stránka nenalezena -->
   10.21 +	<error-code>404</error-code>
   10.22 +	<location>/WEB-INF/chyby/404.jsp</location>
   10.23      </error-page>
   10.24      <error-page>
   10.25 -        <!-- Interní chyba serveru -->
   10.26 -        <error-code>500</error-code>
   10.27 -        <location>/WEB-INF/chyby/500.jsp</location>
   10.28 +	<!-- Interní chyba serveru -->
   10.29 +	<error-code>500</error-code>
   10.30 +	<location>/WEB-INF/chyby/500.jsp</location>
   10.31      </error-page>
   10.32 -    
   10.33 +
   10.34 +    <servlet>
   10.35 +	<servlet-name>atom</servlet-name>
   10.36 +	<jsp-file>/WEB-INF/atom/atom.jsp</jsp-file>
   10.37 +    </servlet>
   10.38 +
   10.39 +    <servlet-mapping>
   10.40 +	<servlet-name>atom</servlet-name>
   10.41 +	<url-pattern>/atom/*</url-pattern>
   10.42 +    </servlet-mapping>
   10.43 +
   10.44      <context-param>
   10.45 -        <!-- Pro případ, že chybí hlavička „Accept-language“ v HTTP požadavku -->
   10.46 -        <param-name>javax.servlet.jsp.jstl.fmt.fallbackLocale</param-name>
   10.47 -        <param-value>cs</param-value>
   10.48 +	<!-- Pro případ, že chybí hlavička „Accept-language“ v HTTP požadavku -->
   10.49 +	<param-name>javax.servlet.jsp.jstl.fmt.fallbackLocale</param-name>
   10.50 +	<param-value>cs</param-value>
   10.51      </context-param>
   10.52  
   10.53      <!--  <zabezpečení> -->
   10.54      <security-role>
   10.55 -        <role-name>opravneny</role-name>
   10.56 +	<role-name>opravneny</role-name>
   10.57      </security-role>
   10.58      <security-constraint>
   10.59 -        <web-resource-collection>
   10.60 -            <web-resource-name>Správa Nekuřák.net</web-resource-name>
   10.61 -            <url-pattern>/sprava/*</url-pattern>
   10.62 -        </web-resource-collection>
   10.63 -        <auth-constraint>
   10.64 -            <role-name>opravneny</role-name>
   10.65 -        </auth-constraint>
   10.66 -    </security-constraint>    
   10.67 +	<web-resource-collection>
   10.68 +	    <web-resource-name>Správa Nekuřák.net</web-resource-name>
   10.69 +	    <url-pattern>/sprava/*</url-pattern>
   10.70 +	</web-resource-collection>
   10.71 +	<auth-constraint>
   10.72 +	    <role-name>opravneny</role-name>
   10.73 +	</auth-constraint>
   10.74 +    </security-constraint>
   10.75      <login-config>
   10.76 -        <auth-method>FORM</auth-method>
   10.77 -        <realm-name>nekurakNET</realm-name>
   10.78 +	<auth-method>FORM</auth-method>
   10.79 +	<realm-name>nekurakNET</realm-name>
   10.80  	<form-login-config>
   10.81  	    <form-login-page>/?akce=prihlaseni</form-login-page>
   10.82  	    <form-error-page>/?akce=prihlaseni&amp;chyba=ano</form-error-page>
    11.1 Binary file java/nekurak.net-web/web/grafika/jazyk_sk.png has changed
    12.1 --- a/java/nekurak.net-web/web/index.jsp	Fri Feb 26 23:45:43 2010 +0100
    12.2 +++ b/java/nekurak.net-web/web/index.jsp	Thu Mar 04 10:20:28 2010 +0100
    12.3 @@ -35,6 +35,7 @@
    12.4  	<head>
    12.5  	    <title><fmt:message key="nazev"/></title>
    12.6  	    <link href="styl.css" type="text/css" rel="StyleSheet"/>
    12.7 +	    <link rel="alternate" type="application/atom+xml" title="podniky" href="atom/" />
    12.8  	</head>
    12.9  	<body>
   12.10  	    <div class="body">
    13.1 --- a/java/nekurak.net-web/web/styl.css	Fri Feb 26 23:45:43 2010 +0100
    13.2 +++ b/java/nekurak.net-web/web/styl.css	Thu Mar 04 10:20:28 2010 +0100
    13.3 @@ -58,9 +58,9 @@
    13.4  
    13.5  #prepinaniJazyku {
    13.6      position: relative;
    13.7 -    left: 940px;
    13.8 +    left: 910px;
    13.9      top: -29px;
   13.10 -    width: 60px;
   13.11 +    width: 90px;
   13.12      margin: 0px;
   13.13      padding: 0px;
   13.14  }
   13.15 @@ -111,6 +111,10 @@
   13.16      color: black;
   13.17  }
   13.18  
   13.19 +.podnik {
   13.20 +    border-top: 1px dashed silver;
   13.21 +}
   13.22 +
   13.23  fieldset {
   13.24  	border: none;
   13.25  }