diff options
author | Ugnich Anton | 2012-12-26 18:09:53 +0700 |
---|---|---|
committer | Ugnich Anton | 2012-12-26 18:09:53 +0700 |
commit | 831d62a90532967272ba63fb2b3dc74d262eb6a2 (patch) | |
tree | 1a63dd03a78c562a99f2f65bdb01b1e44ec16cf2 /src/java/com/juick/http/www/Blogs.java | |
parent | 9adb555fe41f6322310be1fea406d9d8d44acafe (diff) |
/places/
Diffstat (limited to 'src/java/com/juick/http/www/Blogs.java')
-rw-r--r-- | src/java/com/juick/http/www/Blogs.java | 25 |
1 files changed, 24 insertions, 1 deletions
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("<div id=\"wrapper\">"); out.println("<div id=\"content\">"); + if (place != null) { + out.println("<div id=\"geomap\"><img src=\"http://maps.google.com/maps/api/staticmap?center=" + place.lat + "," + place.lon + "&markers=color:orange|" + place.lat + "," + place.lon + "&zoom=14&size=600x300&maptype=hybrid&sensor=false\" width=\"600\" height=\"300\" alt=\"Map\"/></div>"); + } + if (mids.size() > 0) { out.println("<ul>"); PageTemplates.printMessages(out, sql, null, mids, visitor, locale); |