1.1 --- a/java/nekurak.net-web/src/java/cz/frantovo/nekurak/servlet/Podnik.java Wed Jan 26 02:24:34 2011 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,34 +0,0 @@
1.4 -package cz.frantovo.nekurak.servlet;
1.5 -
1.6 -import java.io.IOException;
1.7 -import javax.servlet.ServletException;
1.8 -import javax.servlet.http.HttpServletRequest;
1.9 -import javax.servlet.http.HttpServletResponse;
1.10 -
1.11 -/**
1.12 - *
1.13 - * @author fiki
1.14 - */
1.15 -public class Podnik extends SuperServlet {
1.16 -
1.17 - @Override
1.18 - protected void doGet(HttpServletRequest požadavek, HttpServletResponse odpověď) throws ServletException, IOException {
1.19 - super.doGet(požadavek, odpověď);
1.20 -
1.21 - String[] parametryCesty = (požadavek.getPathInfo().split("/"));
1.22 - int id = Integer.parseInt(parametryCesty[1]);
1.23 -
1.24 - odpověď.getOutputStream().println("URL: " + požadavek.getRequestURL());
1.25 - odpověď.getOutputStream().println("ContextPath: " + požadavek.getContextPath());
1.26 - odpověď.getOutputStream().println("PathInfo: " + požadavek.getPathInfo());
1.27 - odpověď.getOutputStream().println("PathTranslated: " + požadavek.getPathTranslated());
1.28 - odpověď.getOutputStream().println("QueryString: " + požadavek.getQueryString());
1.29 - odpověď.getOutputStream().println("RequestURI: " + požadavek.getRequestURI());
1.30 - odpověď.getOutputStream().println("Scheme: " + požadavek.getScheme());
1.31 - odpověď.getOutputStream().println("ServletPath: " + požadavek.getServletPath());
1.32 - odpověď.getOutputStream().println("ID podniku: " + id);
1.33 - odpověď.getOutputStream().println("počet parametrů: " + parametryCesty.length);
1.34 - odpověď.getOutputStream().println("parametr 0: " + parametryCesty[0]);
1.35 - odpověď.getOutputStream().println("parametr 1: " + parametryCesty[1]);
1.36 - }
1.37 -}
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/java/nekurak.net-web/src/java/cz/frantovo/nekurak/servlet/PodnikServlet.java Wed Jan 26 03:23:32 2011 +0100
2.3 @@ -0,0 +1,55 @@
2.4 +package cz.frantovo.nekurak.servlet;
2.5 +
2.6 +import cz.frantovo.nekurak.dto.Podnik;
2.7 +import cz.frantovo.nekurak.ejb.PodnikRemote;
2.8 +import java.io.IOException;
2.9 +import java.io.UnsupportedEncodingException;
2.10 +import java.net.URLEncoder;
2.11 +import javax.ejb.EJB;
2.12 +import javax.servlet.ServletException;
2.13 +import javax.servlet.http.HttpServletRequest;
2.14 +import javax.servlet.http.HttpServletResponse;
2.15 +
2.16 +/**
2.17 + *
2.18 + * @author fiki
2.19 + */
2.20 +public class PodnikServlet extends SuperServlet {
2.21 +
2.22 + @EJB
2.23 + PodnikRemote ejb;
2.24 +
2.25 + @Override
2.26 + protected void doGet(HttpServletRequest požadavek, HttpServletResponse odpověď) throws ServletException, IOException {
2.27 + super.doGet(požadavek, odpověď);
2.28 +
2.29 + String[] parametryCesty = (požadavek.getPathInfo().split("/"));
2.30 + int id = Integer.parseInt(parametryCesty[1]);
2.31 +
2.32 + Podnik p = ejb.getPodnik(id);
2.33 +
2.34 + if (p == null) {
2.35 + odpověď.sendError(HttpServletResponse.SC_NOT_FOUND);
2.36 + } else {
2.37 + požadavek.setAttribute("podnik", p);
2.38 + požadavek.setAttribute("mapa", getMapa(p));
2.39 + zpracujJSP("detail.jsp", požadavek, odpověď);
2.40 + }
2.41 + }
2.42 +
2.43 + /**
2.44 + * @return URL mapy – obrázku nebo null při chybě nebo absenci souřadnic
2.45 + */
2.46 + private String getMapa(Podnik p) {
2.47 + if (p == null || p.getSirka() == null || p.getDelka() == null) {
2.48 + return null;
2.49 + } else {
2.50 + try {
2.51 + String souradnice = URLEncoder.encode(p.getSirka() + ", " + p.getDelka(), "UTF-8");
2.52 + return "http://maps.google.com/maps/api/staticmap?size=400x400&sensor=false&markers=size:big|color:green|" + souradnice;
2.53 + } catch (UnsupportedEncodingException e) {
2.54 + return null;
2.55 + }
2.56 + }
2.57 + }
2.58 +}
3.1 --- a/java/nekurak.net-web/src/java/cz/frantovo/nekurak/servlet/SuperServlet.java Wed Jan 26 02:24:34 2011 +0100
3.2 +++ b/java/nekurak.net-web/src/java/cz/frantovo/nekurak/servlet/SuperServlet.java Wed Jan 26 03:23:32 2011 +0100
3.3 @@ -2,6 +2,7 @@
3.4
3.5 import java.io.IOException;
3.6 import java.util.Locale;
3.7 +import javax.servlet.RequestDispatcher;
3.8 import javax.servlet.ServletException;
3.9 import javax.servlet.http.HttpServlet;
3.10 import javax.servlet.http.HttpServletRequest;
3.11 @@ -15,6 +16,8 @@
3.12
3.13 public static final String PARAMETR_JAZYK = "jazyk";
3.14 private static final String ATRIBUT_JAZYK = "javax.servlet.jsp.jstl.fmt.locale.session";
3.15 + private static final String ADRESAR_SABLON = "/WEB-INF/casti/";
3.16 +
3.17
3.18 @Override
3.19 protected void doGet(HttpServletRequest požadavek, HttpServletResponse odpověď) throws ServletException, IOException {
3.20 @@ -22,6 +25,33 @@
3.21 }
3.22
3.23 /**
3.24 + * Vykreslí stránku pomocí JSP šablony
3.25 + * @param jsp JSP šablona stránky – např. detail.jsp (nacházejí se v /WEB-INF/casti/)
3.26 + */
3.27 + protected void zpracujJSP(String jsp, HttpServletRequest požadavek, HttpServletResponse odpověď) throws ServletException, IOException {
3.28 + /** Nastavení správného MIME typu */
3.29 + //požadavek.setAttribute("jspMimeTyp", MIME_TYP);
3.30 +
3.31 +
3.32 +
3.33 +
3.34 + /**
3.35 + * odpověď.setContentType(MIME_TYP); – nefunguje (JSP si tam procpe svoje text/xml)
3.36 + */
3.37 + /*
3.38 + * Mělo by jít změnit přes web.xml:
3.39 + <jsp-config>
3.40 + <jsp-property-group>
3.41 + <url-pattern>/</url-pattern>
3.42 + <default-content-type>application/xhtml+xml</default-content-type>
3.43 + </jsp-property-group>
3.44 + </jsp-config>
3.45 + */
3.46 + RequestDispatcher rd = getServletContext().getRequestDispatcher(ADRESAR_SABLON + jsp);
3.47 + rd.forward(požadavek, new XhtmlOdpověď(odpověď));
3.48 + }
3.49 +
3.50 + /**
3.51 * Společné činnosti, které děláme pro všechny HTTP metody (GET, POST atd.)
3.52 */
3.53 private void společné(HttpServletRequest požadavek, HttpServletResponse odpověď) throws ServletException, IOException {
4.1 --- a/java/nekurak.net-web/src/java/cz/frantovo/nekurak/web/Detail.java Wed Jan 26 02:24:34 2011 +0100
4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
4.3 @@ -1,49 +0,0 @@
4.4 -package cz.frantovo.nekurak.web;
4.5 -
4.6 -import cz.frantovo.nekurak.dto.Podnik;
4.7 -import java.io.UnsupportedEncodingException;
4.8 -import java.net.URLEncoder;
4.9 -
4.10 -/**
4.11 - *
4.12 - * @author fiki
4.13 - */
4.14 -public class Detail {
4.15 -
4.16 - private HledacSluzby hledac = new HledacSluzby();
4.17 - private int id;
4.18 - private Podnik podnik;
4.19 -
4.20 - /**
4.21 - * @return URL mapy – obrázku nebo null při chybě nebo absenci souřadnic
4.22 - */
4.23 - public String getMapa() {
4.24 - Podnik p = getPodnik();
4.25 -
4.26 - if (p == null || p.getSirka() == null || p.getDelka() == null) {
4.27 - return null;
4.28 - } else {
4.29 - try {
4.30 - String souradnice = URLEncoder.encode(p.getSirka() + ", " + p.getDelka(), "UTF-8");
4.31 - return "http://maps.google.com/maps/api/staticmap?size=400x400&sensor=false&markers=size:big|color:green|" + souradnice;
4.32 - } catch (UnsupportedEncodingException e) {
4.33 - return null;
4.34 - }
4.35 - }
4.36 - }
4.37 -
4.38 - public int getId() {
4.39 - return id;
4.40 - }
4.41 -
4.42 - public void setId(int id) {
4.43 - this.id = id;
4.44 - }
4.45 -
4.46 - public Podnik getPodnik() {
4.47 - if (podnik == null) {
4.48 - podnik = hledac.getPodnikEJB().getPodnik(id);
4.49 - }
4.50 - return podnik;
4.51 - }
4.52 -}
5.1 --- a/java/nekurak.net-web/web/WEB-INF/atom/atom.jsp Wed Jan 26 02:24:34 2011 +0100
5.2 +++ b/java/nekurak.net-web/web/WEB-INF/atom/atom.jsp Wed Jan 26 03:23:32 2011 +0100
5.3 @@ -32,7 +32,7 @@
5.4 <c:forEach var="podnik" items="${atom.podniky}">
5.5 <entry>
5.6 <title><c:out value="${podnik.nazev}"/></title>
5.7 - <link href="http://nekurak.net/?akce=detail&amp;podnik=${podnik.id}"/>
5.8 + <link href="http://nekurak.net/podnik/${podnik.id}"/>
5.9 <id>urn:NekurakNET:podnik:${podnik.id}</id>
5.10 <updated>
5.11 <fmt:formatDate value="${podnik.datum}" pattern="yyyy-MM-dd'T'HH:mm:ss'Z'"/>
6.1 --- a/java/nekurak.net-web/web/WEB-INF/casti/detail.jsp Wed Jan 26 02:24:34 2011 +0100
6.2 +++ b/java/nekurak.net-web/web/WEB-INF/casti/detail.jsp Wed Jan 26 03:23:32 2011 +0100
6.3 @@ -6,14 +6,14 @@
6.4 xmlns:nk="urn:jsptagdir:/WEB-INF/tags/nekurak"
6.5 version="2.0">
6.6
6.7 - <jsp:useBean id="detail" class="cz.frantovo.nekurak.web.Detail" scope="request"/>
6.8 - <jsp:setProperty name="detail" property="id" value="${param.podnik}"/>
6.9 + <c:set var="podnik" value="${requestScope['podnik']}"/>
6.10 + <c:set var="mapa" value="${requestScope['mapa']}"/>
6.11
6.12 - <nk:stranka titulek="${fn:escapeXml(detail.podnik.nazev)}">
6.13 - <h1><c:out value="${detail.podnik.nazev}" /></h1>
6.14 - <nk:podnikZahlavi podnik="${detail.podnik}" detailPodniku="true"/>
6.15 - <nk:podnikDetail detail="${detail}"/>
6.16 - <nk:podnikKomentare podnik="${detail.podnik}"/>
6.17 + <nk:stranka titulek="${fn:escapeXml(podnik.nazev)}">
6.18 + <h1><c:out value="${podnik.nazev}" /></h1>
6.19 + <nk:podnikZahlavi podnik="${podnik}" detailPodniku="true"/>
6.20 + <nk:podnikDetail podnik="${podnik}" mapa="${mapa}"/>
6.21 + <nk:podnikKomentare podnik="${podnik}"/>
6.22 </nk:stranka>
6.23
6.24 </jsp:root>
7.1 --- a/java/nekurak.net-web/web/WEB-INF/casti/odeslatKomentar.jsp Wed Jan 26 02:24:34 2011 +0100
7.2 +++ b/java/nekurak.net-web/web/WEB-INF/casti/odeslatKomentar.jsp Wed Jan 26 03:23:32 2011 +0100
7.3 @@ -30,7 +30,7 @@
7.4 <c:when test="${odeslatKomentar.ok}">
7.5 <p class="informacniHlaska">
7.6 <fmt:message key="komentar.odeslat.ok"/>,
7.7 - <a href="?akce=detail&amp;podnik=${komentar.podnik}">
7.8 + <a href="${zc}?akce=detail&amp;podnik=${komentar.podnik}">
7.9 <fmt:message key="komentar.odeslat.pokracujte"/>
7.10 </a>.
7.11 </p>
8.1 --- a/java/nekurak.net-web/web/WEB-INF/casti/pridatPodnik.jsp Wed Jan 26 02:24:34 2011 +0100
8.2 +++ b/java/nekurak.net-web/web/WEB-INF/casti/pridatPodnik.jsp Wed Jan 26 03:23:32 2011 +0100
8.3 @@ -31,7 +31,7 @@
8.4 </c:choose>
8.5 </c:when>
8.6 <c:otherwise>
8.7 - <form method="post" action="?akce=pridatPodnik&amp;akcePridat=pridej">
8.8 + <form method="post" action="${zc}?akce=pridatPodnik&amp;akcePridat=pridej">
8.9 <fieldset>
8.10 <label><fmt:message key="dto.podnik.nazev"/>: <input type="text" name="nazev" maxlength="255"/></label><br/>
8.11 <label><fmt:message key="dto.podnik.popis"/>: <input type="text" name="popis" maxlength="255"/></label><br/>
9.1 --- a/java/nekurak.net-web/web/WEB-INF/casti/registrovatUzivatele.jsp Wed Jan 26 02:24:34 2011 +0100
9.2 +++ b/java/nekurak.net-web/web/WEB-INF/casti/registrovatUzivatele.jsp Wed Jan 26 03:23:32 2011 +0100
9.3 @@ -42,7 +42,7 @@
9.4 </p>
9.5
9.6 <p>
9.7 - <a href="?akce=registrovatUzivatele&amp;akceRegistrace=dokonceni&amp;token=${fn:escapeXml(uzivatelPredRegistraci.token)}">
9.8 + <a href="${zc}?akce=registrovatUzivatele&amp;akceRegistrace=dokonceni&amp;token=${fn:escapeXml(uzivatelPredRegistraci.token)}">
9.9 <fmt:message key="registrace.potvrdit"/>
9.10 </a>
9.11 </p>
9.12 @@ -63,7 +63,7 @@
9.13 <!-- Registrace proběhla úspěšně. -->
9.14 <p>
9.15 <fmt:message key="registrace.hotovo"/>&#160;
9.16 - <a href="?akce=prihlaseni">
9.17 + <a href="${zc}?akce=prihlaseni">
9.18 <fmt:message key="registrace.hotovo.prihlasit"/>
9.19 </a>.
9.20 </p>
9.21 @@ -76,7 +76,7 @@
9.22 </c:when>
9.23 <c:otherwise>
9.24 <!-- Zobrazíme uživateli registrační formulář. -->
9.25 - <form method="post" action="?akce=registrovatUzivatele&amp;akceRegistrace=kontrola">
9.26 + <form method="post" action="${zc}?akce=registrovatUzivatele&amp;akceRegistrace=kontrola">
9.27 <fieldset>
9.28 <fmt:message key="dto.uzivatel.prezdivka.tip" var="prezdivkaTip"/>
9.29 <label title="${prezdivkaTip}"><fmt:message key="dto.uzivatel.prezdivka"/>: <input type="text" name="prezdivka" maxlength="64"/></label><br/>
10.1 --- a/java/nekurak.net-web/web/WEB-INF/chyby/404.jsp Wed Jan 26 02:24:34 2011 +0100
10.2 +++ b/java/nekurak.net-web/web/WEB-INF/chyby/404.jsp Wed Jan 26 03:23:32 2011 +0100
10.3 @@ -6,8 +6,6 @@
10.4 version="2.0">
10.5 <jsp:directive.page contentType="application/xhtml+xml" isErrorPage="true"/>
10.6
10.7 - <fmt:setBundle basename="cz.frantovo.nekurak.preklady" scope="application"/>
10.8 -
10.9 <fmt:message key="chybovaStranka.404.nazev" var="nazev"/>
10.10 <fmt:message key="chybovaStranka.404.popis" var="popis"/>
10.11
11.1 --- a/java/nekurak.net-web/web/WEB-INF/chyby/500.jsp Wed Jan 26 02:24:34 2011 +0100
11.2 +++ b/java/nekurak.net-web/web/WEB-INF/chyby/500.jsp Wed Jan 26 03:23:32 2011 +0100
11.3 @@ -6,8 +6,6 @@
11.4 version="2.0">
11.5 <jsp:directive.page contentType="application/xhtml+xml" isErrorPage="true"/>
11.6
11.7 - <fmt:setBundle basename="cz.frantovo.nekurak.preklady" scope="application"/>
11.8 -
11.9 <fmt:message key="chybovaStranka.500.nazev" var="nazev"/>
11.10 <fmt:message key="chybovaStranka.500.popis" var="popis"/>
11.11
12.1 --- a/java/nekurak.net-web/web/WEB-INF/tags/nekurak/fotkyPodniku.tag Wed Jan 26 02:24:34 2011 +0100
12.2 +++ b/java/nekurak.net-web/web/WEB-INF/tags/nekurak/fotkyPodniku.tag Wed Jan 26 03:23:32 2011 +0100
12.3 @@ -11,12 +11,12 @@
12.4 <div id="fotkyPodniku${podnik.id}">
12.5 <c:forEach var="fotka" items="${podnik.fotky}">
12.6 <p>
12.7 - <a href="${nkfn:fotka(fotka.id, false)}" rel="colorbox_p_${podnik.id}" title="${fn:escapeXml(fotka.popis)}">
12.8 - <img src="${nkfn:fotka(fotka.id, true)}" alt="${fn:escapeXml(fotka.popis)}"/>
12.9 + <a href="${zc}${nkfn:fotka(fotka.id, false)}" rel="colorbox_p_${podnik.id}" title="${fn:escapeXml(fotka.popis)}">
12.10 + <img src="${zc}${nkfn:fotka(fotka.id, true)}" alt="${fn:escapeXml(fotka.popis)}"/>
12.11 </a>
12.12 </p>
12.13 </c:forEach>
12.14 - <p><img src="grafika/fotkaPodnikuZadne.png" alt="žádné další fotografie"/></p>
12.15 + <p><img src="${zc}grafika/fotkaPodnikuZadne.png" alt="žádné další fotografie"/></p>
12.16 </div>
12.17
12.18 <c:if test="${!empty podnik.fotky}">
13.1 --- a/java/nekurak.net-web/web/WEB-INF/tags/nekurak/podnikDetail.tag Wed Jan 26 02:24:34 2011 +0100
13.2 +++ b/java/nekurak.net-web/web/WEB-INF/tags/nekurak/podnikDetail.tag Wed Jan 26 03:23:32 2011 +0100
13.3 @@ -6,10 +6,11 @@
13.4 xmlns:nkfn="/WEB-INF/nekurakFunkce"
13.5 version="2.0">
13.6
13.7 - <jsp:directive.attribute name="detail" type="cz.frantovo.nekurak.web.Detail" required="true"/>
13.8 + <jsp:directive.attribute name="podnik" type="cz.frantovo.nekurak.dto.Podnik" required="true"/>
13.9 + <jsp:directive.attribute name="mapa" type="java.lang.String" required="true"/>
13.10
13.11 <c:choose>
13.12 - <c:when test="${detail.mapa == null}">
13.13 + <c:when test="${mapa == null}">
13.14 <p>
13.15 Souřadnice tohoto podniku nejsou známé.<br/>
13.16 (možná ještě nebyl proveden jejich výpočet)
13.17 @@ -17,12 +18,12 @@
13.18 </c:when>
13.19 <c:otherwise>
13.20 <p>
13.21 - Zeměpisná šířka: ${detail.podnik.sirka}<br/>
13.22 - Zeměpisná délka: ${detail.podnik.delka}<br/>
13.23 - Loc: ${detail.podnik.sirka}, ${detail.podnik.delka}<br/>
13.24 + Zeměpisná šířka: ${podnik.sirka}<br/>
13.25 + Zeměpisná délka: ${podnik.delka}<br/>
13.26 + Loc: ${podnik.sirka}, ${podnik.delka}<br/>
13.27 </p>
13.28 <p>
13.29 - <img alt="mapa" src="${fn:escapeXml(detail.mapa)}"/>
13.30 + <img alt="mapa" src="${fn:escapeXml(mapa)}"/>
13.31 </p>
13.32 </c:otherwise>
13.33 </c:choose>
14.1 --- a/java/nekurak.net-web/web/WEB-INF/tags/nekurak/podnikKomentare.tag Wed Jan 26 02:24:34 2011 +0100
14.2 +++ b/java/nekurak.net-web/web/WEB-INF/tags/nekurak/podnikKomentare.tag Wed Jan 26 03:23:32 2011 +0100
14.3 @@ -24,7 +24,7 @@
14.4 <c:otherwise>
14.5 <p id="formularKomentujSkryvac" style="display: none;"><a href="javascript:komentare.zobrazFormular()"><fmt:message key="komentare.komentovat"/></a></p>
14.6 <div id="formularKomentuj">
14.7 - <form method="post" action="?akce=odeslatKomentar" onsubmit="javascript:komentare.odeslat(); return false;">
14.8 + <form method="post" action="${zc}?akce=odeslatKomentar" onsubmit="javascript:komentare.odeslat(); return false;">
14.9 <fieldset>
14.10 <input type="hidden" name="podnik" maxlength="255" value="${podnik.id}"/>
14.11 <label><fmt:message key="komentare.nadpis"/>: <input type="text" name="nadpis" maxlength="255"/></label>
15.1 --- a/java/nekurak.net-web/web/WEB-INF/tags/nekurak/podnikZahlavi.tag Wed Jan 26 02:24:34 2011 +0100
15.2 +++ b/java/nekurak.net-web/web/WEB-INF/tags/nekurak/podnikZahlavi.tag Wed Jan 26 03:23:32 2011 +0100
15.3 @@ -19,7 +19,7 @@
15.4 <!-- Název a adresa podniku -->
15.5 <div class="adresa">
15.6 <c:if test="${!detailPodniku}">
15.7 - <h2><a href="?akce=detail&amp;podnik=${podnik.id}"><c:out value="${podnik.nazev}"/></a></h2>
15.8 + <h2><a href="${zc}podnik/${podnik.id}"><c:out value="${podnik.nazev}"/></a></h2>
15.9 </c:if>
15.10 <p><c:out value="${podnik.popis}"/></p>
15.11 <p>
15.12 @@ -42,7 +42,7 @@
15.13 <c:forEach var="k" items="${podnik.kategorie}">
15.14 <li class="normalni">
15.15 <fmt:message key="dto.kategorie.${k.id}.popis" var="popisKategorie"/>
15.16 - <a href="?kategorie=${k.id}" title="${popisKategorie}">
15.17 + <a href="${zc}?kategorie=${k.id}" title="${popisKategorie}">
15.18 <fmt:message key="dto.kategorie.${k.id}.nazev"/>
15.19 </a>
15.20 </li>
15.21 @@ -55,7 +55,7 @@
15.22 </c:choose>
15.23 <li class="${cssKurackost}">
15.24 <fmt:message key="dto.podnik.kurackost.${podnik.kurackost.id}.popis" var="popisKurackosti"/>
15.25 - <a href="?kurackost=${podnik.kurackost.id}" title="${popisKurackosti}">
15.26 + <a href="${zc}?kurackost=${podnik.kurackost.id}" title="${popisKurackosti}">
15.27 <fmt:message key="dto.podnik.kurackost.${podnik.kurackost.id}.nazev"/>
15.28 </a>
15.29 </li>
15.30 @@ -68,7 +68,7 @@
15.31 </c:choose>
15.32 <li class="${cssSpokojenost}">
15.33 <fmt:message key="dto.podnik.spokojenost.${spokojenost}.popis" var="popisSpokojenosti"/>
15.34 - <a href="#spokojenost_${spokojenost}" title="${popisSpokojenosti}">
15.35 + <a href="${zc}#spokojenost_${spokojenost}" title="${popisSpokojenosti}">
15.36 <fmt:message key="dto.podnik.spokojenost.${spokojenost}.nazev"/>
15.37 </a>
15.38 </li>
16.1 --- a/java/nekurak.net-web/web/WEB-INF/tags/nekurak/prepinaniJazyku.tag Wed Jan 26 02:24:34 2011 +0100
16.2 +++ b/java/nekurak.net-web/web/WEB-INF/tags/nekurak/prepinaniJazyku.tag Wed Jan 26 03:23:32 2011 +0100
16.3 @@ -12,9 +12,9 @@
16.4 <fmt:message key="prepinaniJazyku.slovenstina.tip" var="prepinaniJazykuSlovenstinaTip"/>
16.5 <fmt:message key="prepinaniJazyku.anglictina" var="prepinaniJazykuAnglictina"/>
16.6 <fmt:message key="prepinaniJazyku.anglictina.tip" var="prepinaniJazykuAnglictinaTip"/>
16.7 - <a href="?jazyk=cs"><img src="grafika/jazyk_cs.png" alt="${prepinaniJazykuCestina}" title="${prepinaniJazykuCestinaTip}"/></a>
16.8 - <a href="?jazyk=sk"><img src="grafika/jazyk_sk.png" alt="${prepinaniJazykuSlovenstina}" title="${prepinaniJazykuSlovenstinaTip}"/></a>
16.9 - <a href="?jazyk=en"><img src="grafika/jazyk_en.png" alt="${prepinaniJazykuAnglictina}" title="${prepinaniJazykuAnglictinaTip}"/></a>
16.10 + <a href="${zc}?jazyk=cs"><img src="${zc}grafika/jazyk_cs.png" alt="${prepinaniJazykuCestina}" title="${prepinaniJazykuCestinaTip}"/></a>
16.11 + <a href="${zc}?jazyk=sk"><img src="${zc}grafika/jazyk_sk.png" alt="${prepinaniJazykuSlovenstina}" title="${prepinaniJazykuSlovenstinaTip}"/></a>
16.12 + <a href="${zc}?jazyk=en"><img src="${zc}grafika/jazyk_en.png" alt="${prepinaniJazykuAnglictina}" title="${prepinaniJazykuAnglictinaTip}"/></a>
16.13 </div>
16.14
16.15 </jsp:root>
16.16 \ No newline at end of file
17.1 --- a/java/nekurak.net-web/web/WEB-INF/tags/nekurak/stranka.tag Wed Jan 26 02:24:34 2011 +0100
17.2 +++ b/java/nekurak.net-web/web/WEB-INF/tags/nekurak/stranka.tag Wed Jan 26 03:23:32 2011 +0100
17.3 @@ -15,6 +15,10 @@
17.4 doctype-root-element="html"
17.5 omit-xml-declaration="false"/>
17.6
17.7 + <c:set var="prihlasenyUzivatel" scope="request" value="${pageContext.request.userPrincipal.name}"/>
17.8 + <!-- zc = základní cesta = contextPath s lomítkem na konci -->
17.9 + <c:set var="zc" scope="application" value="${pageContext.request.contextPath}/"/>
17.10 +
17.11 <html xmlns="http://www.w3.org/1999/xhtml">
17.12 <head>
17.13 <c:choose>
17.14 @@ -25,15 +29,15 @@
17.15 <title>${fn:escapeXml(titulek)} – <fmt:message key="nazev"/></title>
17.16 </c:otherwise>
17.17 </c:choose>
17.18 - <link href="styl.css" type="text/css" rel="StyleSheet"/>
17.19 - <link href="js/colorbox/colorbox.css" type="text/css" rel="StyleSheet"/>
17.20 - <script type="text/javascript" src="js/jquery.js"></script>
17.21 - <script type="text/javascript" src="js/jquery.bxSlider.js"></script>
17.22 - <script type="text/javascript" src="js/colorbox/jquery.colorbox-min.js"></script>
17.23 - <script type="text/javascript" src="js/hlasovani.js"></script>
17.24 - <script type="text/javascript" src="js/komentare.js"></script>
17.25 - <script type="text/javascript" src="js/fotkyPodniku.js"></script>
17.26 - <link rel="alternate" type="application/atom+xml" title="podniky" href="atom/" />
17.27 + <link href="${zc}styl.css" type="text/css" rel="StyleSheet"/>
17.28 + <link href="${zc}js/colorbox/colorbox.css" type="text/css" rel="StyleSheet"/>
17.29 + <script type="text/javascript" src="${zc}js/jquery.js"></script>
17.30 + <script type="text/javascript" src="${zc}js/jquery.bxSlider.js"></script>
17.31 + <script type="text/javascript" src="${zc}js/colorbox/jquery.colorbox-min.js"></script>
17.32 + <script type="text/javascript" src="${zc}js/hlasovani.js"></script>
17.33 + <script type="text/javascript" src="${zc}js/komentare.js"></script>
17.34 + <script type="text/javascript" src="${zc}js/fotkyPodniku.js"></script>
17.35 + <link rel="alternate" type="application/atom+xml" title="podniky" href="${zc}atom/" />
17.36 <fmt:message key="meta.popis" var="metaPopis"/>
17.37 <fmt:message key="meta.klicova-slova" var="metaKlicovaSlova"/>
17.38 <fmt:message key="meta.autor" var="metaAutor"/>
17.39 @@ -47,24 +51,24 @@
17.40 <div class="body">
17.41
17.42 <div id="horniPruh">
17.43 - <h1><a href="?"><fmt:message key="nazev"/></a></h1>
17.44 + <h1><a href="${zc}"><fmt:message key="nazev"/></a></h1>
17.45 </div>
17.46
17.47 <ul id="nabidka">
17.48 - <li><a href="?"><fmt:message key="uvod"/></a></li>
17.49 + <li><a href="${zc}"><fmt:message key="uvod"/></a></li>
17.50 <!-- TODO: použít Jabberot, dočasně vypnuté
17.51 <li><a href="?akce=chat"><fmt:message key="chat.nadpis"/></a></li>
17.52 -->
17.53
17.54 <c:choose>
17.55 <c:when test="${prihlasenyUzivatel == null}">
17.56 - <li><a href="?akce=prihlaseni"><fmt:message key="prihlasitSe"/></a></li>
17.57 - <li><a href="?akce=registrovatUzivatele"><fmt:message key="registrovatSe"/></a></li>
17.58 + <li><a href="${zc}?akce=prihlaseni"><fmt:message key="prihlasitSe"/></a></li>
17.59 + <li><a href="${zc}?akce=registrovatUzivatele"><fmt:message key="registrovatSe"/></a></li>
17.60 </c:when>
17.61 <c:otherwise>
17.62 - <li><a href="?akce=pridatPodnik"><fmt:message key="pridatPodnik"/></a></li>
17.63 + <li><a href="${zc}?akce=pridatPodnik"><fmt:message key="pridatPodnik"/></a></li>
17.64 <li id="prihlasenyUzivatel"><fmt:message key="prihlasenyUzivatel"/>: ${prihlasenyUzivatel}</li>
17.65 - <li><a href="?akce=prihlaseni&amp;odhlasit=ano"><fmt:message key="odhlasitSe"/></a></li>
17.66 + <li><a href="${zc}?akce=prihlaseni&amp;odhlasit=ano"><fmt:message key="odhlasitSe"/></a></li>
17.67 </c:otherwise>
17.68 </c:choose>
17.69
17.70 @@ -82,8 +86,8 @@
17.71 <div id="paticka">
17.72 <p>
17.73 <fmt:message key="licence"/>&#160;
17.74 - <a href="nekurak.net-src.zip">nekurak.net-src.zip</a>
17.75 - <a href="nekurak.net-src.zip.SHA-512">.</a>
17.76 + <a href="${zc}nekurak.net-src.zip">nekurak.net-src.zip</a>
17.77 + <a href="${zc}nekurak.net-src.zip.SHA-512">.</a>
17.78 </p>
17.79 </div>
17.80
18.1 --- a/java/nekurak.net-web/web/WEB-INF/web.xml Wed Jan 26 02:24:34 2011 +0100
18.2 +++ b/java/nekurak.net-web/web/WEB-INF/web.xml Wed Jan 26 03:23:32 2011 +0100
18.3 @@ -1,124 +1,124 @@
18.4 <?xml version="1.0" encoding="UTF-8"?>
18.5 <web-app version="3.0" 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_3_0.xsd">
18.6 - <session-config>
18.7 - <session-timeout>30</session-timeout>
18.8 - </session-config>
18.9 - <welcome-file-list>
18.10 - <welcome-file>index.jsp</welcome-file>
18.11 - </welcome-file-list>
18.12 + <session-config>
18.13 + <session-timeout>30</session-timeout>
18.14 + </session-config>
18.15 + <welcome-file-list>
18.16 + <welcome-file>index.jsp</welcome-file>
18.17 + </welcome-file-list>
18.18 <!-- <chybovéStránky> -->
18.19 - <error-page>
18.20 + <error-page>
18.21 <!-- Stránka nenalezena -->
18.22 - <error-code>404</error-code>
18.23 - <location>/WEB-INF/chyby/404.jsp</location>
18.24 - </error-page>
18.25 - <error-page>
18.26 + <error-code>404</error-code>
18.27 + <location>/WEB-INF/chyby/404.jsp</location>
18.28 + </error-page>
18.29 + <error-page>
18.30 <!-- Interní chyba serveru -->
18.31 - <error-code>500</error-code>
18.32 - <location>/WEB-INF/chyby/500.jsp</location>
18.33 - </error-page>
18.34 + <error-code>500</error-code>
18.35 + <location>/WEB-INF/chyby/500.jsp</location>
18.36 + </error-page>
18.37 <!-- </chybovéStránky> -->
18.38 - <listener>
18.39 - <listener-class>cz.frantovo.nekurak.posluchac.OchranaProtiCSRF</listener-class>
18.40 - </listener>
18.41 + <listener>
18.42 + <listener-class>cz.frantovo.nekurak.posluchac.OchranaProtiCSRF</listener-class>
18.43 + </listener>
18.44 <!-- <definiceServletů> -->
18.45 - <servlet>
18.46 - <servlet-name>podnik</servlet-name>
18.47 - <servlet-class>cz.frantovo.nekurak.servlet.PodnikServlet</servlet-class>
18.48 - </servlet>
18.49 - <servlet>
18.50 - <servlet-name>atom</servlet-name>
18.51 - <jsp-file>/WEB-INF/atom/atom.jsp</jsp-file>
18.52 - </servlet>
18.53 - <servlet>
18.54 - <description>
18.55 + <servlet>
18.56 + <servlet-name>podnik</servlet-name>
18.57 + <servlet-class>cz.frantovo.nekurak.servlet.PodnikServlet</servlet-class>
18.58 + </servlet>
18.59 + <servlet>
18.60 + <servlet-name>atom</servlet-name>
18.61 + <jsp-file>/WEB-INF/atom/atom.jsp</jsp-file>
18.62 + </servlet>
18.63 + <servlet>
18.64 + <description>
18.65 Servlet zpřístupňující fotky umístěné ve zvláštním adresáři
18.66 (data oddělená od aplikace).
18.67 </description>
18.68 - <servlet-name>fotky</servlet-name>
18.69 - <servlet-class>cz.frantovo.nekurak.servlet.Fotky</servlet-class>
18.70 - <init-param>
18.71 - <description>
18.72 + <servlet-name>fotky</servlet-name>
18.73 + <servlet-class>cz.frantovo.nekurak.servlet.Fotky</servlet-class>
18.74 + <init-param>
18.75 + <description>
18.76 Adresář na disku, který obsahuje fotky podniků.
18.77 Musí existovat při startu aplikace.
18.78 </description>
18.79 - <param-name>adresar</param-name>
18.80 - <param-value>/var/www/nekurak.net/fotky</param-value>
18.81 - </init-param>
18.82 - <load-on-startup>1</load-on-startup>
18.83 - </servlet>
18.84 - <servlet>
18.85 - <servlet-name>kaptcha</servlet-name>
18.86 - <servlet-class>com.google.code.kaptcha.servlet.KaptchaServlet</servlet-class>
18.87 - </servlet>
18.88 - <servlet>
18.89 - <description>Veřejné REST API (pak máme ještě jedno soukromé, kde musí být uživatel přihlášený)</description>
18.90 - <servlet-name>REST</servlet-name>
18.91 - <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
18.92 - <load-on-startup>1</load-on-startup>
18.93 - </servlet>
18.94 - <servlet>
18.95 - <description>Odesílání a náhledy komentářů pomocí AJAXu.</description>
18.96 - <servlet-name>komentare</servlet-name>
18.97 - <servlet-class>cz.frantovo.nekurak.servlet.Komentare</servlet-class>
18.98 - </servlet>
18.99 + <param-name>adresar</param-name>
18.100 + <param-value>/var/www/nekurak.net/fotky</param-value>
18.101 + </init-param>
18.102 + <load-on-startup>1</load-on-startup>
18.103 + </servlet>
18.104 + <servlet>
18.105 + <servlet-name>kaptcha</servlet-name>
18.106 + <servlet-class>com.google.code.kaptcha.servlet.KaptchaServlet</servlet-class>
18.107 + </servlet>
18.108 + <servlet>
18.109 + <description>Veřejné REST API (pak máme ještě jedno soukromé, kde musí být uživatel přihlášený)</description>
18.110 + <servlet-name>REST</servlet-name>
18.111 + <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
18.112 + <load-on-startup>1</load-on-startup>
18.113 + </servlet>
18.114 + <servlet>
18.115 + <description>Odesílání a náhledy komentářů pomocí AJAXu.</description>
18.116 + <servlet-name>komentare</servlet-name>
18.117 + <servlet-class>cz.frantovo.nekurak.servlet.Komentare</servlet-class>
18.118 + </servlet>
18.119 <!-- </definiceServletů> -->
18.120 <!-- <mapováníServletů> -->
18.121 - <servlet-mapping>
18.122 - <servlet-name>podnik</servlet-name>
18.123 - <url-pattern>/podnik/*</url-pattern>
18.124 - </servlet-mapping>
18.125 - <servlet-mapping>
18.126 - <servlet-name>fotky</servlet-name>
18.127 - <url-pattern>/fotky/*</url-pattern>
18.128 - </servlet-mapping>
18.129 - <servlet-mapping>
18.130 - <servlet-name>atom</servlet-name>
18.131 - <url-pattern>/atom/*</url-pattern>
18.132 - </servlet-mapping>
18.133 - <servlet-mapping>
18.134 - <servlet-name>kaptcha</servlet-name>
18.135 - <url-pattern>/kaptcha.jpg</url-pattern>
18.136 - </servlet-mapping>
18.137 - <servlet-mapping>
18.138 + <servlet-mapping>
18.139 + <servlet-name>podnik</servlet-name>
18.140 + <url-pattern>/podnik/*</url-pattern>
18.141 + </servlet-mapping>
18.142 + <servlet-mapping>
18.143 + <servlet-name>fotky</servlet-name>
18.144 + <url-pattern>/fotky/*</url-pattern>
18.145 + </servlet-mapping>
18.146 + <servlet-mapping>
18.147 + <servlet-name>atom</servlet-name>
18.148 + <url-pattern>/atom/*</url-pattern>
18.149 + </servlet-mapping>
18.150 + <servlet-mapping>
18.151 + <servlet-name>kaptcha</servlet-name>
18.152 + <url-pattern>/kaptcha.jpg</url-pattern>
18.153 + </servlet-mapping>
18.154 + <servlet-mapping>
18.155 <!-- Veřejné REST API -->
18.156 - <servlet-name>REST</servlet-name>
18.157 - <url-pattern>/zdroje/*</url-pattern>
18.158 - </servlet-mapping>
18.159 - <servlet-mapping>
18.160 - <servlet-name>komentare</servlet-name>
18.161 - <url-pattern>/komentare</url-pattern>
18.162 - </servlet-mapping>
18.163 + <servlet-name>REST</servlet-name>
18.164 + <url-pattern>/zdroje/*</url-pattern>
18.165 + </servlet-mapping>
18.166 + <servlet-mapping>
18.167 + <servlet-name>komentare</servlet-name>
18.168 + <url-pattern>/komentare</url-pattern>
18.169 + </servlet-mapping>
18.170 <!-- </mapováníServletů> -->
18.171 - <context-param>
18.172 + <context-param>
18.173 <!-- Pro případ, že chybí hlavička „Accept-language“ v HTTP požadavku -->
18.174 - <param-name>javax.servlet.jsp.jstl.fmt.fallbackLocale</param-name>
18.175 - <param-value>cs</param-value>
18.176 - </context-param>
18.177 - <context-param>
18.178 - <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
18.179 - <param-value>cz.frantovo.nekurak.preklady</param-value>
18.180 - </context-param>
18.181 + <param-name>javax.servlet.jsp.jstl.fmt.fallbackLocale</param-name>
18.182 + <param-value>cs</param-value>
18.183 + </context-param>
18.184 + <context-param>
18.185 + <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
18.186 + <param-value>cz.frantovo.nekurak.preklady</param-value>
18.187 + </context-param>
18.188 <!-- <zabezpečení> -->
18.189 - <security-role>
18.190 - <role-name>opravneny</role-name>
18.191 - </security-role>
18.192 - <security-constraint>
18.193 - <web-resource-collection>
18.194 - <web-resource-name>Správa Nekuřák.net</web-resource-name>
18.195 - <url-pattern>/sprava/*</url-pattern>
18.196 - </web-resource-collection>
18.197 - <auth-constraint>
18.198 - <role-name>opravneny</role-name>
18.199 - </auth-constraint>
18.200 - </security-constraint>
18.201 - <login-config>
18.202 - <auth-method>FORM</auth-method>
18.203 - <realm-name>nekurakNET</realm-name>
18.204 - <form-login-config>
18.205 - <form-login-page>/?akce=prihlaseni</form-login-page>
18.206 - <form-error-page>/?akce=prihlaseni&chyba=ano</form-error-page>
18.207 - </form-login-config>
18.208 - </login-config>
18.209 + <security-role>
18.210 + <role-name>opravneny</role-name>
18.211 + </security-role>
18.212 + <security-constraint>
18.213 + <web-resource-collection>
18.214 + <web-resource-name>Správa Nekuřák.net</web-resource-name>
18.215 + <url-pattern>/sprava/*</url-pattern>
18.216 + </web-resource-collection>
18.217 + <auth-constraint>
18.218 + <role-name>opravneny</role-name>
18.219 + </auth-constraint>
18.220 + </security-constraint>
18.221 + <login-config>
18.222 + <auth-method>FORM</auth-method>
18.223 + <realm-name>nekurakNET</realm-name>
18.224 + <form-login-config>
18.225 + <form-login-page>/?akce=prihlaseni</form-login-page>
18.226 + <form-error-page>/?akce=prihlaseni&chyba=ano</form-error-page>
18.227 + </form-login-config>
18.228 + </login-config>
18.229 <!-- </zabezpečení> -->
18.230 </web-app>
19.1 --- a/java/nekurak.net-web/web/index.jsp Wed Jan 26 02:24:34 2011 +0100
19.2 +++ b/java/nekurak.net-web/web/index.jsp Wed Jan 26 03:23:32 2011 +0100
19.3 @@ -6,31 +6,18 @@
19.4 version="2.0">
19.5 <jsp:directive.page contentType="application/xhtml+xml"/>
19.6
19.7 + <!--
19.8 + TODO: index.jsp po přechodu na servlety přijde vyhodit.
19.9 + -->
19.10 +
19.11 <!-- <lokalizace> -->
19.12 <c:if test="${param.jazyk != null}">
19.13 <fmt:setLocale value="${param.jazyk}" scope="session"/>
19.14 </c:if>
19.15 - <fmt:setBundle basename="cz.frantovo.nekurak.preklady" scope="application"/>
19.16 <!-- </lokalizace> -->
19.17
19.18 - <!-- <autentizace> -->
19.19 - <c:set var="prihlasenyUzivatel" scope="request" value="${pageContext.request.userPrincipal.name}"/>
19.20 - <c:if test="${param.akce == 'prihlaseni' && param.odhlasit == 'ano'}">
19.21 - <!--
19.22 - Uživatele musíme odhlásit dřív, než vykreslíme nabídku,
19.23 - která závisí na tom, zda je uživatel přihlášený nebo ne.
19.24 - „prihlaseni.jsp?odhlasit=ano“ už vypíše jen hlášku, že byl odhlášen.
19.25 - -->
19.26 - <jsp:scriptlet>session.invalidate();</jsp:scriptlet>
19.27 - <c:set var="prihlasenyUzivatel" scope="request" value="${null}"/>
19.28 - </c:if>
19.29 - <!-- </autentizace> -->
19.30 -
19.31 <!-- <výběrStránky> -->
19.32 <c:choose>
19.33 - <c:when test="${param.akce == 'detail'}">
19.34 - <jsp:include page="/WEB-INF/casti/detail.jsp" flush="false"/>
19.35 - </c:when>
19.36 <c:when test="${param.akce == 'pridatPodnik'}">
19.37 <jsp:include page="/WEB-INF/casti/pridatPodnik.jsp" flush="false"/>
19.38 </c:when>
20.1 --- a/java/nekurak.net-web/web/js/hlasovani.js Wed Jan 26 02:24:34 2011 +0100
20.2 +++ b/java/nekurak.net-web/web/js/hlasovani.js Wed Jan 26 03:23:32 2011 +0100
20.3 @@ -6,6 +6,9 @@
20.4
20.5 $.ajax({
20.6 type: "POST",
20.7 + /**
20.8 + * TODO: správné URL – ${zc}
20.9 + */
20.10 url: "zdroje/hlas/",
20.11 data: pozadavek,
20.12 contentType: "text/xml",
21.1 --- a/java/nekurak.net-web/web/js/komentare.js Wed Jan 26 02:24:34 2011 +0100
21.2 +++ b/java/nekurak.net-web/web/js/komentare.js Wed Jan 26 03:23:32 2011 +0100
21.3 @@ -5,9 +5,15 @@
21.4 };
21.5
21.6 komentare.nahled = function() {
21.7 + /**
21.8 + * TODO: správné URL – ${zc}
21.9 + */
21.10 $("#formularKomentuj .vystup").load("komentare", $("#formularKomentuj form").serialize());
21.11 };
21.12
21.13 komentare.odeslat = function() {
21.14 + /**
21.15 + * TODO: správné URL – ${zc}
21.16 + */
21.17 $("#formularKomentuj .vystup").load("komentare?odeslat=true", $("#formularKomentuj form").serialize());
21.18 };