From 831d62a90532967272ba63fb2b3dc74d262eb6a2 Mon Sep 17 00:00:00 2001 From: Ugnich Anton Date: Wed, 26 Dec 2012 18:09:53 +0700 Subject: /places/ --- src/java/com/juick/http/www/Blogs.java | 25 ++++++++++++++++++++++++- src/java/com/juick/http/www/Main.java | 2 ++ src/java/com/juick/http/www/PageTemplates.java | 4 ++-- src/java/com/juick/http/www/UserThread.java | 4 ++-- 4 files changed, 30 insertions(+), 5 deletions(-) (limited to 'src/java/com/juick/http') diff --git a/src/java/com/juick/http/www/Blogs.java b/src/java/com/juick/http/www/Blogs.java index fb0657ad..a84c562c 100644 --- a/src/java/com/juick/http/www/Blogs.java +++ b/src/java/com/juick/http/www/Blogs.java @@ -62,15 +62,18 @@ public class Blogs { String paramShow = request.getParameter("show"); + String requesturi = request.getRequestURI(); + int paramTag = 0; String paramTagStr = null; - if (request.getRequestURI().startsWith("/tag/")) { + if (requesturi.startsWith("/tag/")) { paramTagStr = URLDecoder.decode(request.getRequestURI().substring(5), "UTF-8"); paramTag = TagQueries.getTagID(sql, paramTagStr, false); if (paramTag == 0) { response.sendError(404); return; } + } else if (requesturi.startsWith("/places/")) { } int paramBefore = 0; @@ -87,6 +90,8 @@ public class Blogs { paramSearch = null; } + com.juick.Place place = null; + if (paramShow == null) { if (paramTag > 0) { title = "*" + Utils.encodeHTML(paramTagStr); @@ -94,6 +99,20 @@ public class Blogs { } else if (paramSearch != null) { title = rb.getString("Search") + ": " + Utils.encodeHTML(paramSearch); mids = MessagesQueries.getSearch(sql, sqlSearch, Utils.encodeSphinx(paramSearch), paramBefore); + } else if (requesturi.matches("^\\/places\\/\\d+$")) { + int place_id = 0; + try { + place_id = Integer.parseInt(requesturi.substring(8)); + } catch (NumberFormatException e) { + } + place = com.juick.server.PlacesQueries.getPlace(sql, place_id); + if (place != null) { + title = place.name; + mids = MessagesQueries.getPlace(sql, place_id, paramBefore); + } else { + response.sendError(404); + return; + } } else { title = rb.getString("Last messages"); mids = MessagesQueries.getAll(sql, paramBefore); @@ -151,6 +170,10 @@ public class Blogs { out.println("
"); out.println("
"); + if (place != null) { + out.println("
\"Map\"/
"); + } + if (mids.size() > 0) { out.println("