diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/java/com/juick/http/www/Blogs.java | 25 | ||||
-rw-r--r-- | src/java/com/juick/http/www/Main.java | 2 | ||||
-rw-r--r-- | src/java/com/juick/http/www/PageTemplates.java | 4 | ||||
-rw-r--r-- | src/java/com/juick/http/www/UserThread.java | 4 |
4 files changed, 30 insertions, 5 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); diff --git a/src/java/com/juick/http/www/Main.java b/src/java/com/juick/http/www/Main.java index ee601ede..e4b79962 100644 --- a/src/java/com/juick/http/www/Main.java +++ b/src/java/com/juick/http/www/Main.java @@ -145,6 +145,8 @@ public class Main extends HttpServlet implements XmppListener { help.doGetHelp(sql, request, response); } else if (uri.startsWith("/tag/")) { blogs.doGet(sql, sqlSearch, request, response); + } else if (uri.startsWith("/places/")) { + blogs.doGet(sql, sqlSearch, request, response); } else if (uri.matches("^/\\d+$")) { rootRedirects.doGetPostID(sql, request, response); } else if (uri.matches("^/[^/]+$")) { diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java index 4e499344..053b020d 100644 --- a/src/java/com/juick/http/www/PageTemplates.java +++ b/src/java/com/juick/http/www/PageTemplates.java @@ -55,7 +55,7 @@ public class PageTemplates { out.println("<html>"); out.println("<head>"); out.println(" <title>" + title + "</title>"); - out.println(" <link rel=\"stylesheet\" href=\"//static.juick.com/style3.2012122600.css\"/>"); + out.println(" <link rel=\"stylesheet\" href=\"//static.juick.com/style3.2012122601.css\"/>"); out.println(" <link rel=\"icon\" type=\"image/png\" href=\"//static.juick.com/favicon.png\"/>"); out.println(" <script type=\"text/javascript\" src=\"//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js\" defer=\"defer\"></script>"); out.println(" <script type=\"text/javascript\" src=\"//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js\" defer=\"defer\" async=\"async\"></script>"); @@ -350,7 +350,7 @@ public class PageTemplates { out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.User.UName + "/" + msg.MID + "\" title=\"" + msg.TimestampString + " GMT\">" + formatDate(msg.TimeAgo, msg.TimestampString, locale) + "</a><a href=\"#\" onclick=\"showMessageLinksDialog(" + msg.MID + "); return false\" class=\"msg-menu\"><img src=\"http://static.juick.com/message-menu-icon.png\"></a></div>"); out.println(" <div class=\"msg-header\"><a href=\"/" + msg.User.UName + "/\">@" + msg.User.UName + "</a>:" + tags + "</div>"); if (msg.Place != null) { - out.println(" <div class=\"msg-place\">" + msg.Place.name + "</div>"); + out.println(" <div class=\"msg-place\"><a href=\"/places/" + msg.Place.pid + "\">" + msg.Place.name + "</a></div>"); } out.println(" <div class=\"msg-txt\">" + formatMessage(msg.Text) + "</div>"); diff --git a/src/java/com/juick/http/www/UserThread.java b/src/java/com/juick/http/www/UserThread.java index dcdb66da..191b34f1 100644 --- a/src/java/com/juick/http/www/UserThread.java +++ b/src/java/com/juick/http/www/UserThread.java @@ -119,8 +119,8 @@ public class UserThread { out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.User.UName + "/\"><img src=\"//i.juick.com/a/" + msg.User.UID + ".png\" alt=\"" + msg.User.UName + "\"/></a></div>"); out.println(" <div class=\"msg-ts\">" + PageTemplates.formatJSLocalTime(msg.TimestampString) + "<a href=\"#\" onclick=\"showMessageLinksDialog(" + msg.MID + "); return false\" class=\"msg-menu\"><img src=\"http://static.juick.com/message-menu-icon.png\"></a></div>"); out.println(" <div class=\"msg-header\"><a href=\"/" + msg.User.UName + "/\">@" + msg.User.UName + "</a>:" + tags + "</div>"); - if (msg.Place != null && msg.Place.pid > 0) { - out.println(" <div class=\"msg-place\">" + msg.Place.name + "</div>"); + if (msg.Place != null) { + out.println(" <div class=\"msg-place\"><a href=\"/places/" + msg.Place.pid + "\">" + msg.Place.name + "</a></div>"); } out.println(" <div class=\"msg-txt\">" + PageTemplates.formatMessage(msg.Text) + "</div>"); |