author | František Kučera <franta-hg@frantovo.cz> |
Tue, 23 Apr 2013 21:43:37 +0200 | |
changeset 204 | bebec432330a |
parent 154 | bf21a4abea9b |
permissions | -rw-r--r-- |
franta-hg@66 | 1 |
package cz.frantovo.nekurak.web; |
franta-hg@66 | 2 |
|
franta-hg@66 | 3 |
import cz.frantovo.nekurak.servlet.Fotky; |
franta-hg@134 | 4 |
import cz.frantovo.nekurak.util.Komentare; |
franta-hg@134 | 5 |
import cz.frantovo.nekurak.vyjimky.KomentarovaVyjimka; |
franta-hg@66 | 6 |
|
franta-hg@66 | 7 |
/** |
franta-hg@66 | 8 |
* Knihovna funkcí použitelná v EL |
franta-hg@66 | 9 |
* @author fiki |
franta-hg@66 | 10 |
*/ |
franta-hg@66 | 11 |
public class FunkceEL { |
franta-hg@66 | 12 |
|
franta-hg@145 | 13 |
/** Musí odpovídat cestě, kam je namapovaný servlet. */ |
franta-hg@145 | 14 |
private static final String SERVLET = "fotky"; |
franta-hg@66 | 15 |
|
franta-hg@145 | 16 |
public static String fotka(int id, boolean nahled) { |
franta-hg@145 | 17 |
String prostredek = nahled ? Fotky.PODADRESAR_NAHLED : Fotky.PODADRESAR_ORIGINAL; |
franta-hg@145 | 18 |
return SERVLET + "/" + prostredek + "/" + id + "." + Fotky.PRIPONA; |
franta-hg@145 | 19 |
} |
franta-hg@68 | 20 |
|
franta-hg@145 | 21 |
/** |
franta-hg@145 | 22 |
* @param komentar komentář včetně kořenové značky, XML jako text |
franta-hg@145 | 23 |
* @return true, pokud vyhovuje XML schématu |
franta-hg@145 | 24 |
*/ |
franta-hg@145 | 25 |
public static boolean zkontrolujKomentar(String komentar) { |
franta-hg@145 | 26 |
try { |
franta-hg@145 | 27 |
Komentare.zkontroluj(komentar); |
franta-hg@145 | 28 |
return true; |
franta-hg@145 | 29 |
} catch (KomentarovaVyjimka ex) { |
franta-hg@145 | 30 |
return false; |
franta-hg@145 | 31 |
} |
franta-hg@134 | 32 |
} |
franta-hg@66 | 33 |
} |