aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2012-12-26 18:09:53 +0700
committerGravatar Ugnich Anton2012-12-26 18:09:53 +0700
commit831d62a90532967272ba63fb2b3dc74d262eb6a2 (patch)
tree1a63dd03a78c562a99f2f65bdb01b1e44ec16cf2
parent9adb555fe41f6322310be1fea406d9d8d44acafe (diff)
/places/
-rw-r--r--src/java/com/juick/http/www/Blogs.java25
-rw-r--r--src/java/com/juick/http/www/Main.java2
-rw-r--r--src/java/com/juick/http/www/PageTemplates.java4
-rw-r--r--src/java/com/juick/http/www/UserThread.java4
-rw-r--r--web/maps.js8
-rw-r--r--web/style3.css5
6 files changed, 34 insertions, 14 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 + "&amp;markers=color:orange|" + place.lat + "," + place.lon + "&amp;zoom=14&amp;size=600x300&amp;maptype=hybrid&amp;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>");
diff --git a/web/maps.js b/web/maps.js
index 39ac3d6f..2ae8cd8e 100644
--- a/web/maps.js
+++ b/web/maps.js
@@ -178,10 +178,6 @@ JuickControl.prototype.setButtonStyle_ = function(button) {
var htmlAddPlace='<form><p style="width: 440px"><b>Name:</b><br/>\
<input type="text" name="description" maxlength="64" style="width: 400px"/><br/>\
-Impersonal description (max 255 symbols):<br/>\
-<textarea name="text" rows="5" style="width: 400px"></textarea><br/>\
-URL:<br/>\
-<input type="text" name="url" maxlength="128" style="width: 400px"/><br/>\
Tags (separated by space, 10 max):\
<input type="text" name="tags" maxlength="255" style="width: 400px"/></p>\
<p style="width: 400px; text-align: right; margin-bottom: 0"><input type="button" value=" Add " onclick="addPlace(this.form)"/></p>\
@@ -206,8 +202,6 @@ function addPlace(form) {
alert('Enter place name.');
return;
}
- var text=form.text.value;
- var url=form.url.value;
var tags=form.tags.value;
map.closeInfoWindow();
GDownloadUrl("/_mapxml",function(data) {
@@ -224,5 +218,5 @@ function addPlace(form) {
icon
));
mc.addMarkers(markers);
- },'lat='+placeLatLng.lat()+'&lon='+placeLatLng.lng()+'&description='+escape(description)+'&text='+escape(text)+'&url='+escape(url)+'&tags='+escape(tags));
+ },'lat='+placeLatLng.lat()+'&lon='+placeLatLng.lng()+'&description='+escape(description)+'&tags='+escape(tags));
}
diff --git a/web/style3.css b/web/style3.css
index 13cdf987..23a6d124 100644
--- a/web/style3.css
+++ b/web/style3.css
@@ -35,7 +35,7 @@ hr { height: 1px; background: #CCC; }
/********/
-#geomap { width: 570px; height: 360px; margin-top: 1em; overflow: hidden; }
+#geomap { width: 600px; height: 300px; margin-top: 1em; overflow: hidden; }
.msg { padding: 15px; margin: 8px 0 16px 0; width: 570px; border: 1px solid #EEE; background: #FFF; }
.msgthread { margin-bottom: 0; border-bottom-color: #CCC; }
@@ -46,7 +46,8 @@ hr { height: 1px; background: #CCC; }
.msg-menu { margin: 0 0 0 6px; padding: 2px 0; }
.msg-menu img { vertical-align: top; }
.msg-header { margin-left: 58px; overflow: hidden; }
-.msg-place { font-size: small; margin: 8px 0 8px 58px; color: #999; }
+.msg-place { font-size: small; margin: 8px 0 8px 58px; }
+.msg-place>a { color: #999; }
.msg-txt { margin: 8px 0 8px 58px; overflow: hidden; }
.msg-media { text-align: center; margin: 8px 0 0px 58px; }
.msg-links { font-size: small; margin: 8px 0 0 68px; color: #999; }