aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2012-10-14 11:32:58 +0700
committerGravatar Ugnich Anton2012-10-14 11:32:58 +0700
commit98f036ae01fe90ad9d5853918602b705fdd41f02 (patch)
tree4926b28a09a11376ce29fe0def9c432aab9ae7c2
parent4441c908f773f1b7c2b203fc6f47349408ae82c0 (diff)
A lot of changes.
-rw-r--r--nbproject/project.properties2
-rw-r--r--src/java/Blogs.properties2
-rw-r--r--src/java/Blogs_ru.properties2
-rw-r--r--src/java/Global.properties1
-rw-r--r--src/java/Global_ru.properties1
-rw-r--r--src/java/User.properties1
-rw-r--r--src/java/User_ru.properties1
-rw-r--r--src/java/com/juick/http/www/Blogs.java41
-rw-r--r--src/java/com/juick/http/www/Chats.java77
-rw-r--r--src/java/com/juick/http/www/Login.java1
-rw-r--r--src/java/com/juick/http/www/Main.java13
-rw-r--r--src/java/com/juick/http/www/Map.java64
-rw-r--r--src/java/com/juick/http/www/NewMessage.java1
-rw-r--r--src/java/com/juick/http/www/PageTemplates.java134
-rw-r--r--src/java/com/juick/http/www/Photos.java100
-rw-r--r--src/java/com/juick/http/www/Tags.java87
-rw-r--r--src/java/com/juick/http/www/User.java38
-rw-r--r--src/java/com/juick/http/www/UserThread.java28
-rw-r--r--web/post3.js7
-rw-r--r--web/scripts3.js24
-rw-r--r--web/style3.css112
21 files changed, 355 insertions, 382 deletions
diff --git a/nbproject/project.properties b/nbproject/project.properties
index 3855d649a..1b4e5382d 100644
--- a/nbproject/project.properties
+++ b/nbproject/project.properties
@@ -30,7 +30,7 @@ includes=**
j2ee.compile.on.save=true
j2ee.deploy.on.save=true
j2ee.platform=1.6-web
-j2ee.platform.classpath=${j2ee.server.home}/lib/catalina-ant.jar:${j2ee.server.home}/lib/tomcat-jdbc.jar:${j2ee.server.home}/lib/jasper-el.jar:${j2ee.server.home}/lib/ecj-3.7.jar:${j2ee.server.home}/lib/tomcat-i18n-fr.jar:${j2ee.server.home}/lib/jsp-api.jar:${j2ee.server.home}/lib/catalina.jar:${j2ee.server.home}/lib/tomcat-i18n-ja.jar:${j2ee.server.home}/lib/el-api.jar:${j2ee.server.home}/lib/catalina-tribes.jar:${j2ee.server.home}/lib/tomcat-coyote.jar:${j2ee.server.home}/lib/jasper.jar:${j2ee.server.home}/lib/tomcat-util.jar:${j2ee.server.home}/lib/tomcat-api.jar:${j2ee.server.home}/lib/tomcat-dbcp.jar:${j2ee.server.home}/lib/servlet-api.jar:${j2ee.server.home}/lib/tomcat-i18n-es.jar:${j2ee.server.home}/lib/catalina-ha.jar:${j2ee.server.home}/lib/annotations-api.jar
+j2ee.platform.classpath=${j2ee.server.home}/lib/catalina-ant.jar:${j2ee.server.home}/lib/tomcat-jdbc.jar:${j2ee.server.home}/lib/jasper-el.jar:${j2ee.server.home}/lib/tomcat-i18n-fr.jar:${j2ee.server.home}/lib/jsp-api.jar:${j2ee.server.home}/lib/catalina.jar:${j2ee.server.home}/lib/tomcat-i18n-ja.jar:${j2ee.server.home}/lib/el-api.jar:${j2ee.server.home}/lib/catalina-tribes.jar:${j2ee.server.home}/lib/tomcat-coyote.jar:${j2ee.server.home}/lib/ecj-3.7.1.jar:${j2ee.server.home}/lib/jasper.jar:${j2ee.server.home}/lib/tomcat-util.jar:${j2ee.server.home}/lib/tomcat-api.jar:${j2ee.server.home}/lib/tomcat-dbcp.jar:${j2ee.server.home}/lib/servlet-api.jar:${j2ee.server.home}/lib/tomcat-i18n-es.jar:${j2ee.server.home}/lib/catalina-ha.jar:${j2ee.server.home}/lib/annotations-api.jar
j2ee.server.type=Tomcat
jar.compress=false
javac.classpath=\
diff --git a/src/java/Blogs.properties b/src/java/Blogs.properties
index 3b596f777..d5c6fd26e 100644
--- a/src/java/Blogs.properties
+++ b/src/java/Blogs.properties
@@ -7,7 +7,7 @@ Tags=Tags
Search=Search
My\ feed=My feed
Private=Private
-Incoming=Incoming
+Discussions=Discussions
Recommended=Recommended
All\ messages=All messages
Popular=Popular
diff --git a/src/java/Blogs_ru.properties b/src/java/Blogs_ru.properties
index f5fe415fb..b42f32f55 100644
--- a/src/java/Blogs_ru.properties
+++ b/src/java/Blogs_ru.properties
@@ -7,7 +7,7 @@ Tags=\u0422\u0435\u0433\u0438
Search=\u041f\u043e\u0438\u0441\u043a
My\ feed=\u041c\u043e\u044f \u043b\u0435\u043d\u0442\u0430
Private=\u041f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0435
-Incoming=\u0412\u0445\u043e\u0434\u044f\u0449\u0438\u0435
+Discussions=\u041e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f
Recommended=\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043d\u043d\u043e\u0435
All\ messages=\u0412\u0441\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f
Popular=\u041f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435
diff --git a/src/java/Global.properties b/src/java/Global.properties
index 9f618c919..b0e9525e6 100644
--- a/src/java/Global.properties
+++ b/src/java/Global.properties
@@ -1,6 +1,7 @@
# To change this template, choose Tools | Templates
# and open the template in the editor.
+Search=Search
Blogs=Blogs
Chats=Chats
Photos=Photos
diff --git a/src/java/Global_ru.properties b/src/java/Global_ru.properties
index f87f4c759..8d315dbfe 100644
--- a/src/java/Global_ru.properties
+++ b/src/java/Global_ru.properties
@@ -1,6 +1,7 @@
# To change this template, choose Tools | Templates
# and open the template in the editor.
+Search=\u041f\u043e\u0438\u0441\u043a
Blogs=\u0411\u043b\u043e\u0433\u0438
Chats=\u0427\u0430\u0442\u044b
Photos=\u0424\u043e\u0442\u043e
diff --git a/src/java/User.properties b/src/java/User.properties
index b91d43522..4d54c4989 100644
--- a/src/java/User.properties
+++ b/src/java/User.properties
@@ -15,3 +15,4 @@ Expand\ all=Expand all
View\ as\ list=View as list
View\ as\ tree=View as tree
all=all
+Search=Search
diff --git a/src/java/User_ru.properties b/src/java/User_ru.properties
index 3bf828757..6a257a499 100644
--- a/src/java/User_ru.properties
+++ b/src/java/User_ru.properties
@@ -15,3 +15,4 @@ Expand\ all=\u0420\u0430\u0441\u043a\u0440\u044b\u0442\u044c \u0432\u0441\u0435
View\ as\ list=\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043a\u043e\u043c
View\ as\ tree=\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0434\u0435\u0440\u0435\u0432\u043e\u043c
all=\u0432\u0441\u0435
+Search=\u041f\u043e\u0438\u0441\u043a
diff --git a/src/java/com/juick/http/www/Blogs.java b/src/java/com/juick/http/www/Blogs.java
index a1cfdeb07..ea728eab0 100644
--- a/src/java/com/juick/http/www/Blogs.java
+++ b/src/java/com/juick/http/www/Blogs.java
@@ -98,10 +98,10 @@ public class Blogs {
response.sendError(404);
return;
}
- } else if (paramShow.equals("incoming")) {
+ } else if (paramShow.equals("discuss")) {
if (visitor != null) {
- title = rb.getString("Incoming");
- mids = MessagesQueries.getIncoming(sql, visitor.UID, paramBefore);
+ title = rb.getString("Discussions");
+ mids = MessagesQueries.getDiscussions(sql, visitor.UID, paramBefore);
} else {
response.sendError(404);
return;
@@ -130,18 +130,27 @@ public class Blogs {
try {
PageTemplates.pageHead(out, title, null);
PageTemplates.pageNavigation(out, locale, visitor);
- PageTemplates.pageTitle(out, title);
+ out.println("<div id=\"topwrapper\">");
out.println("<div id=\"wrapper\">");
out.println("<div id=\"content\">");
- out.println("<ul>");
+
+ PageTemplates.pageFilters(out, locale, visitor);
if (mids.size() > 0) {
+ /*
+ if (paramShow != null && paramShow.equals("photos")) {
+ PageTemplates.printPhotos(out, sql, mids, locale);
+ } else {
+ */
+ out.println("<ul>");
PageTemplates.printMessages(out, sql, mids, locale);
+ out.println("</ul>");
+ /*
+ }
+ */
}
- out.println("</ul>");
-
if (mids.size() == 20) {
String nextpage = "?before=" + mids.get(mids.size() - 1);
if (paramShow != null) {
@@ -154,29 +163,33 @@ public class Blogs {
}
out.println("</div>");
+ out.println("</div>"); // wrapper
+
- out.println("<div id=\"column\">");
+ out.println("<div id=\"column\" class=\"stickya\">");
out.println("<h2>" + rb.getString("Lists") + "</h2>");
if (visitor != null) {
out.println("<ul>");
out.println(" <li><a href=\"?show=my\">" + rb.getString("My feed") + "</a></li>");
out.println(" <li><a href=\"?show=private\">" + rb.getString("Private") + "</a></li>");
- out.println(" <li><a href=\"?show=incoming\">" + rb.getString("Incoming") + "</a></li>");
+ out.println(" <li><a href=\"?show=discuss\">" + rb.getString("Discussions") + "</a></li>");
out.println(" <li><a href=\"?show=recommended\">" + rb.getString("Recommended") + "</a></li>");
out.println("</ul>");
+ out.println("<hr/>");
}
out.println("<ul>");
out.println(" <li><a href=\"?\">" + rb.getString("All messages") + "</a></li>");
out.println(" <li><a href=\"?show=top\">" + rb.getString("Popular") + "</a></li>");
out.println(" <li><a href=\"?show=photos\">" + rb.getString("With photos") + "</a></li>");
out.println("</ul>");
- out.println("<h2>" + rb.getString("Tags") + "</h2>");
- out.println("<p style=\"text-align: justify\">" + getTags(sql, 30) + "</p>");
- out.println("<h2>" + rb.getString("Search") + "</h2>");
- out.println("<form action=\"/\" id=\"search\"><p><input type=\"text\" name=\"search\" class=\"inp\"/></p></form>");
- out.println("</div>");
+ out.println("<hr/>");
+ out.println("<p>" + getTags(sql, 30) + "</p>");
out.println("</div>");
+ out.println("<div id=\"rcol\"></div>");
+
+ out.println("</div>"); // topwrapper
+
PageTemplates.pageFooter(request, out, locale, visitor);
} finally {
out.close();
diff --git a/src/java/com/juick/http/www/Chats.java b/src/java/com/juick/http/www/Chats.java
deleted file mode 100644
index d15bb271c..000000000
--- a/src/java/com/juick/http/www/Chats.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Juick
- * Copyright (C) 2008-2011, Ugnich Anton
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package com.juick.http.www;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Locale;
-import java.util.ResourceBundle;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- *
- * @author Ugnich Anton
- */
-public class Chats {
-
- protected void doGet(Connection sql, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- com.juick.User visitor = Utils.getVisitorUser(sql, request);
- Locale locale = request.getLocale();
- ResourceBundle rb = ResourceBundle.getBundle("Chats", locale);
-
- response.setContentType("text/html; charset=UTF-8");
- PrintWriter out = response.getWriter();
- try {
- PageTemplates.pageHead(out, rb.getString("Active chats"), "");
- PageTemplates.pageNavigation(out, locale, visitor);
- PageTemplates.pageTitle(out, rb.getString("Active chats"));
-
- out.println("<div id=\"wrapper\">");
- out.println("<div id=\"content\"><ul id=\"chats\">");
-
- PreparedStatement stmt = null;
- ResultSet rs = null;
- try {
- stmt = sql.prepareStatement("SELECT chats.chat_id,chats.subject,COUNT(chat_users.user_id) AS cnt FROM chats INNER JOIN chat_users USING(chat_id) GROUP BY chat_id ORDER BY cnt DESC");
- rs = stmt.executeQuery();
- rs.beforeFirst();
- while (rs.next()) {
- String chatid = Integer.toString(rs.getInt(1), Character.MAX_RADIX);
- out.println("<li><b>" + Utils.encodeHTML(rs.getString(2)) + "</b><br/><i>" + rb.getString("Users online") + ": " + rs.getInt(3) + "</i><br/><a href=\"xmpp:" + chatid + "@chat.juick.com?join\">" + chatid + "@chat.juick.com</a></li>");
- }
- } catch (SQLException e) {
- System.err.println(e);
- } finally {
- Utils.finishSQL(rs, stmt);
- }
-
- out.println("</ul></div>");
- out.println("</div>");
-
- PageTemplates.pageFooter(request, out, locale, visitor);
- } finally {
- out.close();
- }
- }
-}
diff --git a/src/java/com/juick/http/www/Login.java b/src/java/com/juick/http/www/Login.java
index 0006f9d00..3cf4a318e 100644
--- a/src/java/com/juick/http/www/Login.java
+++ b/src/java/com/juick/http/www/Login.java
@@ -45,7 +45,6 @@ public class Login {
try {
PageTemplates.pageHead(out, rb.getString("Login"), "");
PageTemplates.pageNavigation(out, locale, visitor);
- PageTemplates.pageTitle(out, rb.getString("Login"));
out.println("<div id=\"wrapper\">");
out.println("<div id=\"content\">");
diff --git a/src/java/com/juick/http/www/Main.java b/src/java/com/juick/http/www/Main.java
index 256e70f92..055327dd2 100644
--- a/src/java/com/juick/http/www/Main.java
+++ b/src/java/com/juick/http/www/Main.java
@@ -42,10 +42,8 @@ public class Main extends HttpServlet implements XmppListener {
Connection sqlSearch;
XmppConnection xmpp;
Blogs blogs = new Blogs();
- Chats chats = new Chats();
- Photos photos = new Photos();
+ Tags tags = new Tags();
RootRedirects rootRedirects = new RootRedirects();
- Map map = new Map();
Login login = new Login();
User pagesUser = new User();
UserThread pagesUserThread = new UserThread();
@@ -124,12 +122,9 @@ public class Main extends HttpServlet implements XmppListener {
String uri = request.getRequestURI();
if (uri.equals("/")) {
blogs.doGet(sql, sqlSearch, request, response);
- } else if (uri.equals("/chats")) {
- chats.doGet(sql, request, response);
- } else if (uri.equals("/photos")) {
- photos.doGet(sql, request, response);
- } else if (uri.equals("/map")) {
- map.doGet(sql, request, response);
+ } else if (uri.equals("/tags")) {
+ com.juick.User visitor = Utils.getVisitorUser(sql, request);
+ tags.doGetTags(sql, request, response, visitor);
} else if (uri.equals("/post")) {
com.juick.User visitor = Utils.getVisitorUser(sql, request);
if (visitor != null) {
diff --git a/src/java/com/juick/http/www/Map.java b/src/java/com/juick/http/www/Map.java
deleted file mode 100644
index 96524ac0e..000000000
--- a/src/java/com/juick/http/www/Map.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Juick
- * Copyright (C) 2008-2011, Ugnich Anton
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package com.juick.http.www;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.sql.Connection;
-import java.util.Locale;
-import java.util.ResourceBundle;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- *
- * @author Ugnich Anton
- */
-public class Map {
-
- protected void doGet(Connection sql, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- com.juick.User visitor = Utils.getVisitorUser(sql, request);
- Locale locale = request.getLocale();
- ResourceBundle rb = ResourceBundle.getBundle("Map", locale);
-
- response.setContentType("text/html; charset=UTF-8");
- PrintWriter out = response.getWriter();
- try {
- PageTemplates.pageHead(out, rb.getString("Messages on map"), "<script src=\"http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=ABQIAAAAVVtPtxkw4soCEHg44FsNChRB4OFYjAXt73He16Zkp6a_0tPs2RTU6i6UlcMs4QvPBYvIY8rWvcxqOg\" type=\"text/javascript\"></script>"
- + "<script src=\"http://static.juick.com/mc.js\" type=\"text/javascript\"></script>"
- + "<script src=\"http://static.juick.com/map.js?2010111500\" type=\"text/javascript\"></script>");
- PageTemplates.pageNavigation(out, locale, visitor);
- PageTemplates.pageTitle(out, rb.getString("Messages on map"));
-
- out.println("<div id=\"wrapper\">");
- out.println("<div id=\"geomap\" style=\"height: 400px; margin: 1em 0.5em\"></div>");
- out.println("<div id=\"content\"><ul id=\"messages\"></ul></div>");
- out.println("<div id=\"column\"><h2>" + rb.getString("Popular places") + "</h2><ul id=\"places\"></ul></div>");
- out.println("</div>");
- out.println("<script type=\"text/javascript\">");
- out.println("$(document).ready(mapInit);");
- out.println("$(window).unload(GUnload);");
- out.println("</script>");
-
- PageTemplates.pageFooter(request, out, locale, visitor);
- } finally {
- out.close();
- }
- }
-}
diff --git a/src/java/com/juick/http/www/NewMessage.java b/src/java/com/juick/http/www/NewMessage.java
index 1efb753db..1e00a5532 100644
--- a/src/java/com/juick/http/www/NewMessage.java
+++ b/src/java/com/juick/http/www/NewMessage.java
@@ -49,7 +49,6 @@ public class NewMessage {
+ "<script src=\"http://static.juick.com/map.js?2010111500\" type=\"text/javascript\"></script>"
+ "<script src=\"http://static.juick.com/post3.js\" type=\"text/javascript\"></script>");
PageTemplates.pageNavigation(out, locale, visitor);
- PageTemplates.pageTitle(out, rbnm.getString("New message"));
out.println("<div id=\"wrapper\"><div id=\"content\" class=\"pagetext\">");
out.println("<form action=\"/post\" method=\"post\" id=\"postmsg\" enctype=\"multipart/form-data\">");
diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java
index a76e02806..08e88342b 100644
--- a/src/java/com/juick/http/www/PageTemplates.java
+++ b/src/java/com/juick/http/www/PageTemplates.java
@@ -24,7 +24,11 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.regex.Matcher;
@@ -39,6 +43,9 @@ import ru.sape.Sape;
public class PageTemplates {
public static Sape sape = null;
+ private static SimpleDateFormat sdfSQL = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S");
+ private static SimpleDateFormat sdfSimple = new SimpleDateFormat("d MMM");
+ private static SimpleDateFormat sdfFull = new SimpleDateFormat("d MMM yyyy");
public static void pageHead(PrintWriter out, String title, String headers) {
out.println("<!DOCTYPE html>");
@@ -46,10 +53,10 @@ public class PageTemplates {
out.println("<head>");
out.println(" <meta charset=\"utf-8\"/>");
out.println(" <title>" + title + "</title>");
- out.println(" <link rel=\"stylesheet\" href=\"http://static.juick.com/style3.css?20120306\"/>");
+ out.println(" <link rel=\"stylesheet\" href=\"http://static.juick.com/style3.css?2012030601\"/>");
out.println(" <link rel=\"icon\" type=\"image/png\" href=\"http://static.juick.com/favicon.png\"/>");
- out.println(" <script type=\"text/javascript\" src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js\"></script>");
- out.println(" <script type=\"text/javascript\" src=\"https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js\"></script>");
+ out.println(" <script type=\"text/javascript\" src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js\"></script>");
+ out.println(" <script type=\"text/javascript\" src=\"https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/jquery-ui.min.js\"></script>");
out.println(" <script type=\"text/javascript\" src=\"https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js\"></script>");
out.println(" <script type=\"text/javascript\" src=\"http://static.juick.com/scripts3.js?20120306\"></script>");
out.println(" <script type=\"text/javascript\" src=\"http://static.juick.com/js/jquery.autoresize.js\"></script>");
@@ -63,18 +70,16 @@ public class PageTemplates {
public static void pageNavigation(PrintWriter out, Locale loc, com.juick.User user) {
ResourceBundle rb = ResourceBundle.getBundle("Global", loc);
+ out.println("<div id=\"hwrapper\">");
out.println("<div id=\"header\">");
- out.println("<div id=\"logo\"><a href=\"" + (user != null ? "/?show=my" : "/") + "\"><img src=\"http://static.juick.com/logo3.png\" width=\"120\" height=\"40\" alt=\"Juick\"/></a></div>");
- out.println(" <ul id=\"nav\">");
- out.println(" <li><a href=\"/\">" + rb.getString("Blogs") + "</a></li>");
-// out.println(" <li><a href=\"/chats\">" + rb.getString("Chats") + "</a></li>");
- out.println(" <li><a href=\"/photos\">" + rb.getString("Photos") + "</a></li>");
- out.println(" <li><a href=\"/map\">" + rb.getString("Map") + "</a></li>");
- out.println(" </ul>");
+ out.println(" <div id=\"logo\"><a href=\"" + (user != null ? "/?show=my" : "/") + "\"><img src=\"http://static.juick.com/logo3.png\" width=\"120\" height=\"40\" alt=\"Juick\"/></a></div>");
+ out.println(" <form action=\"/\" id=\"search\">");
+ out.println(" <div id=\"search\"><input type=\"text\" name=\"search\" class=\"text\" placeholder=\"" + rb.getString("Search") + "\"/><input type=\"submit\" class=\"submit\" value=\">\"></div>");
+ out.println(" </form>");
out.println(" <ul id=\"nav-right\">");
if (user != null) {
out.println(" <li><a href=\"/post\">" + rb.getString("Post") + "</a></li>");
- out.println(" <li><a href=\"#\" onclick=\"$('#nav-menu').toggle('blind'); return false\"><img src=\"http://i.juick.com/as/" + user.UID + ".png\" alt=\"" + user.UName + "\"/>" + user.UName + "</a><ul id=\"nav-menu\">");
+ out.println(" <li><a href=\"#\" onclick=\"$('#nav-menu').toggle(); return false\"><img src=\"http://i.juick.com/as/" + user.UID + ".png\" alt=\"" + user.UName + "\"/>" + user.UName + "</a><ul id=\"nav-menu\">");
out.println(" <li><a href=\"/" + user.UName + "/\">" + rb.getString("Blog") + "</a></li>");
out.println(" <li><a href=\"/settings\">" + rb.getString("Settings") + "</a></li>");
out.println(" <li><a href=\"/logout\">" + rb.getString("Logout") + "</a></li>");
@@ -84,11 +89,21 @@ public class PageTemplates {
}
out.println(" </ul>");
out.println("</div>");
+ out.println("</div>");
}
- public static void pageTitle(PrintWriter out, String title) {
- out.println("<div id=\"title\">");
- out.println(" <h1>" + title + "</h1>");
+ public static void pageFilters(PrintWriter out, Locale loc, com.juick.User user) {
+ ResourceBundle rb = ResourceBundle.getBundle("Global", loc);
+
+ out.println("<div id=\"filters\">");
+ out.println("<ul>");
+ out.println(" <li><a href=\"#\">Messages</a></li>");
+ out.println(" <li><a href=\"#\">Photos</a></li>");
+ out.println(" <li><a href=\"#\">Recommendations</a></li>");
+ out.println(" <li><a href=\"#\">Private</a></li>");
+ out.println(" <li><a href=\"#\">Tags</a></li>");
+ out.println(" <li><a href=\"#\">Users</a></li>");
+ out.println("</ul>");
out.println("</div>");
}
@@ -236,7 +251,19 @@ public class PageTemplates {
int days = (minsago / 1440);
return days + " day" + ((days % 10 == 1) ? "" : "s") + " ago";
} else {
- return fulldate;
+ try {
+ Date pDate = sdfSQL.parse(fulldate);
+ Calendar c = Calendar.getInstance();
+ int curyear = c.get(Calendar.YEAR);
+ c.setTime(pDate);
+ if (c.get(Calendar.YEAR) == curyear) {
+ return sdfSimple.format(pDate);
+ } else {
+ return sdfFull.format(pDate);
+ }
+ } catch (ParseException e) {
+ return fulldate;
+ }
}
}
@@ -355,11 +382,11 @@ public class PageTemplates {
txt = formatMessage(txt);
- out.print(" <li id=\"msg-" + mid + "\" class=\"msg\"");
- if (mid == mids.get(0)) {
- out.print(" style=\"border: 0\"");
- }
- out.println(">");
+ out.println(" <li id=\"msg-" + mid + "\" class=\"msg\">");
+ out.println(" <div class=\"msg-avatar\"><a href=\"/" + uname + "/\"><img src=\"http://i.juick.com/a/" + uid + ".png\" alt=\"" + uname + "\"/></a></div>");
+ out.println(" <div class=\"msg-ts\"><a href=\"/" + uname + "/" + mid + "\" title=\"" + rs.getString(9) + "\">" + formatDate(rs.getInt(8), rs.getString(9), locale) + "</a></div>");
+ out.println(" <div class=\"msg-header\"><a href=\"/" + uname + "/\">@" + uname + "</a>:" + tags + "</div>");
+ out.println(" <div class=\"msg-txt\">" + txt + "</div>");
if (rs.getString(12) != null) {
if (rs.getString(12).equals("jpg")) {
@@ -372,15 +399,6 @@ public class PageTemplates {
}
}
- out.println(" <div class=\"msg-avatar\"><a href=\"/" + uname + "/\"><img src=\"http://i.juick.com/a/" + uid + ".png\" alt=\"" + uname + "\"/></a></div>");
- out.println(" <div class=\"msg-ts\"><a href=\"/" + uname + "/" + mid + "\">" + formatDate(rs.getInt(8), rs.getString(9), locale) + "</a><div class=\"msg-menu\"><a href=\"#\" onclick=\"$('#msg-menu-" + mid + "').toggle('blind'); return false\"><img src=\"http://static.juick.com/message-menu-icon.png\"></a><ul id=\"msg-menu-" + mid + "\">");
- out.println(" <li><a href=\"/post?body=%21%20%23" + mid + "\">" + rb.getString("Recommend message") + "</a></li>");
- out.println(" <li><a href=\"/post?body=%40" + uname + "%20\">" + rb.getString("Send private message") + "</a></li>");
- out.println(" <li><a href=\"/post?body=BL%20%40" + uname + "\">" + rb.getString("Block user") + "</a></li>");
- out.println(" </ul></div></div>");
- out.println(" <div class=\"msg-header\"><a href=\"/" + uname + "/\">@" + uname + "</a>:" + tags + "</div>");
- out.println(" <div class=\"msg-txt\">" + txt + "</div>");
-
if (rs.getInt(10) > 0) {
String repliesby = rs.getString(11);
if (repliesby == null) {
@@ -389,7 +407,7 @@ public class PageTemplates {
out.println(" <div class=\"msg-comments\"><a href=\"/" + uname + "/" + mid + "\">" + formatReplies(rs.getInt(10), locale) + "</a> " + rb.getString("(replies) by") + " " + repliesby + "</div>");
} else if (cancomment) {
out.println(" <form action=\"/post\" method=\"POST\" enctype=\"multipart/form-data\"><input type=\"hidden\" name=\"mid\" value=\"" + mid + "\"/>");
- out.println(" <div class=\"msg-comment\"><textarea name=\"body\" rows=\"1\" class=\"reply\" placeholder=\"Add a comment...\" onkeypress=\"postformListener(this.form,event)\"></textarea><input type=\"submit\" value=\"OK\"/></div>");
+ out.println(" <div class=\"msg-comment\"><textarea name=\"body\" rows=\"1\" class=\"reply\" placeholder=\"Add a comment...\" onkeypress=\"postformListener(this.form,event)\"></textarea></div>");
out.println(" </form>");
}
out.println(" </li>");
@@ -400,4 +418,60 @@ public class PageTemplates {
Utils.finishSQL(rs, stmt);
}
}
+ /*
+ public static void printPhotos(PrintWriter out, Connection sql, ArrayList<Integer> mids, Locale locale) {
+ ResourceBundle rb = ResourceBundle.getBundle("Global", locale);
+
+ out.println("<table class=\"photos\">");
+ out.println(" <tr>");
+
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ try {
+ stmt = sql.prepareStatement("SELECT STRAIGHT_JOIN messages.message_id,messages.user_id,users.nick,messages_txt.tags,messages.readonly,messages.privacy,messages_txt.txt,TIMESTAMPDIFF(MINUTE,messages.ts,NOW()),messages.ts,messages.replies,messages_txt.repliesby,messages.attach,messages.place_id,places.name,messages.lat,messages.lon FROM ((messages INNER JOIN messages_txt ON messages.message_id=messages_txt.message_id) INNER JOIN users ON messages.user_id=users.id) LEFT JOIN places ON messages.place_id=places.place_id WHERE messages.message_id IN (" + Utils.convertArray2String(mids) + ") ORDER BY messages.message_id DESC");
+ rs = stmt.executeQuery();
+ rs.beforeFirst();
+ int cnt = 0;
+ while (rs.next()) {
+ int mid = rs.getInt(1);
+ int uid = rs.getInt(2);
+ String uname = rs.getString(3);
+ String tags = rs.getString(4);
+ String txt = rs.getString(7);
+
+ txt = formatMessage(txt);
+
+ if (cnt % 2 == 0 && cnt > 0) {
+ out.println(" </tr>");
+ out.println(" <tr>");
+ }
+
+ out.print(" <td id=\"photo-" + mid + "\" class=\"photo\"");
+ if (mid == mids.get(0)) {
+ out.print(" style=\"border: 0\"");
+ }
+ out.print(">");
+
+ out.println("<div class=\"photowrap\">");
+ out.println(" <a href=\"#\" onclick=\"return photoDetails(" + mid + ")\"><img src=\"http://i.juick.com/" + (rs.getString(12).equals("jpg") ? "photos-512" : "thumbs") + "/" + mid + ".jpg\" alt=\"\"/></a>");
+ out.println(" <div class=\"photo-ts\" title=\"" + rs.getString(9) + "\">" + formatDate(rs.getInt(8), rs.getString(9), locale) + "</div>");
+ out.println(" <div class=\"photo-uname\">@" + uname + "</div>");
+ if (rs.getInt(10) > 0) {
+ out.println(" <div class=\"photo-comments\">" + rs.getInt(10) + "</div>");
+ }
+ out.println(" <div class=\"photo-txt\">" + txt + "</div>");
+ out.println(" </td>");
+
+ cnt++;
+ }
+ } catch (SQLException e) {
+ System.err.println(e);
+ } finally {
+ Utils.finishSQL(rs, stmt);
+ }
+
+ out.println(" </tr>");
+ out.println("</table>");
+ }
+ */
}
diff --git a/src/java/com/juick/http/www/Photos.java b/src/java/com/juick/http/www/Photos.java
deleted file mode 100644
index a26655018..000000000
--- a/src/java/com/juick/http/www/Photos.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Juick
- * Copyright (C) 2008-2011, Ugnich Anton
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package com.juick.http.www;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Locale;
-import java.util.ResourceBundle;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- *
- * @author Ugnich Anton
- */
-public class Photos {
-
- protected void doGet(Connection sql, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- com.juick.User visitor = Utils.getVisitorUser(sql, request);
- Locale locale = request.getLocale();
- ResourceBundle rb = ResourceBundle.getBundle("Photos", locale);
-
- response.setContentType("text/html; charset=UTF-8");
- PrintWriter out = response.getWriter();
- try {
- PageTemplates.pageHead(out, rb.getString("Last photos and videos"), "<script type=\"text/javascript\" src=\"http://static.juick.com/js/jquery.onImagesLoad.min.js\"></script>"
- + "<script type=\"text/javascript\" src=\"http://static.juick.com/js/gallery.js\"></script>"
- + "<script type=\"text/javascript\" src=\"http://static.juick.com/js/jquery.fancybox-1.3.4.js\"></script>"
- + "<link rel=\"stylesheet\" href=\"http://static.juick.com/fancybox/jquery.fancybox-1.3.4.css\"/>");
- PageTemplates.pageNavigation(out, locale, visitor);
- PageTemplates.pageTitle(out, rb.getString("Last photos and videos"));
-
- out.println("<div id=\"wrapper\">");
- out.println("<div id=\"spinner\" style=\"text-align: center\">Loading...</div>");
- out.println("<ul id=\"gallery\" style=\"display: none\">");
-
- PreparedStatement stmt = null;
- ResultSet rs = null;
- try {
- stmt = sql.prepareStatement("SELECT messages.message_id,messages.attach,users.nick FROM messages INNER JOIN users ON messages.user_id=users.id WHERE messages.attach IS NOT NULL ORDER BY message_id DESC LIMIT 20");
- rs = stmt.executeQuery();
- rs.beforeFirst();
- while (rs.next()) {
- if (rs.getString(2).equals("jpg")) {
- out.println("<li class=\"galleryitem\"><a href=\"/" + rs.getString(3) + "/" + rs.getInt(1) + "\" title=\"@" + rs.getString(3) + "\"><img src=\"http://i.juick.com/photos-512/" + rs.getInt(1) + ".jpg\" alt=\"\"></a></li>");
- } else {
- out.println("<li class=\"galleryitem\"><a href=\"/" + rs.getString(3) + "/" + rs.getInt(1) + "\" title=\"@" + rs.getString(3) + "\"><img src=\"http://i.juick.com/thumbs/" + rs.getInt(1) + ".jpg\" alt=\"\"></a></li>");
- }
- }
- } catch (SQLException e) {
- System.err.println(e);
- } finally {
- Utils.finishSQL(rs, stmt);
- }
-
- out.println("</ul>");
- out.println("</div>");
- out.println("<script type=\"text/javascript\">");
- out.println("$('#gallery').onImagesLoad({selectorCallback: galleryResize});");
- out.println("$('.galleryitem a').click(function() {");
- out.println(" $.fancybox({");
- out.println(" 'href': $(this).children('img').attr('src'),");
- out.println(" 'link': this.href,");
- out.println(" 'title': this.title,");
- out.println(" 'orig': this,");
- out.println(" 'transitionIn': 'elastic',");
- out.println(" 'transitionOut': 'none',");
- out.println(" 'easingIn': 'easeOutBack',");
- out.println(" 'easingOut': 'easeInBack'");
- out.println(" });");
- out.println(" return false;");
- out.println("});");
- out.println("</script>");
-
- PageTemplates.pageFooter(request, out, locale, visitor);
- } finally {
- out.close();
- }
- }
-}
diff --git a/src/java/com/juick/http/www/Tags.java b/src/java/com/juick/http/www/Tags.java
new file mode 100644
index 000000000..07cff5821
--- /dev/null
+++ b/src/java/com/juick/http/www/Tags.java
@@ -0,0 +1,87 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.juick.http.www;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Arrays;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ *
+ * @author ugnich
+ */
+public class Tags {
+
+ protected void doGetTags(Connection sql, HttpServletRequest request, HttpServletResponse response, com.juick.User visitor) throws ServletException, IOException {
+ Locale locale = request.getLocale();
+ ResourceBundle rbnm = ResourceBundle.getBundle("Blogs", locale);
+
+ response.setContentType("text/html; charset=UTF-8");
+ PrintWriter out = response.getWriter();
+ try {
+ PageTemplates.pageHead(out, rbnm.getString("Tags"), null);
+ PageTemplates.pageNavigation(out, locale, visitor);
+
+ int cnt = 30;
+ com.juick.Tag tags[] = new com.juick.Tag[cnt];
+ int maxUsageCnt = 0;
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ try {
+ stmt = sql.prepareStatement("SELECT tags.name AS name,COUNT(DISTINCT messages.user_id) AS cnt FROM (messages INNER JOIN messages_tags ON (messages.ts>TIMESTAMPADD(DAY,-3,NOW()) AND messages.message_id=messages_tags.message_id)) INNER JOIN tags ON messages_tags.tag_id=tags.tag_id GROUP BY tags.tag_id ORDER BY cnt DESC LIMIT ?");
+ stmt.setInt(1, cnt);
+ rs = stmt.executeQuery();
+ rs.beforeFirst();
+ cnt = 0;
+ while (rs.next()) {
+ tags[cnt] = new com.juick.Tag();
+ tags[cnt].Name = rs.getString(1);
+ tags[cnt].UsageCnt = rs.getInt(2);
+ if (tags[cnt].UsageCnt > maxUsageCnt) {
+ maxUsageCnt = tags[cnt].UsageCnt;
+ }
+ cnt++;
+ }
+ } catch (SQLException e) {
+ System.err.println(e);
+ } finally {
+ Utils.finishSQL(rs, stmt);
+ }
+
+ Arrays.sort(tags, 0, cnt);
+
+ for (int i = 0; i < cnt; i++) {
+ String tag = Utils.encodeHTML(tags[i].Name);
+ try {
+ tag = "<a href=\"/?tag=" + URLEncoder.encode(tags[i].Name, "UTF-8") + "\">" + tag + "</a>";
+ } catch (UnsupportedEncodingException e) {
+ }
+
+ if (tags[i].UsageCnt > maxUsageCnt / 3 * 2) {
+ out.print("<big>" + tag + "</big> ");
+ } else if (tags[i].UsageCnt > maxUsageCnt / 3) {
+ out.print("<small>" + tag + "</small> ");
+ } else {
+ out.print(tag + " ");
+ }
+ }
+
+ PageTemplates.pageFooter(request, out, locale, visitor);
+ } finally {
+ out.close();
+ }
+ }
+}
diff --git a/src/java/com/juick/http/www/User.java b/src/java/com/juick/http/www/User.java
index 73dd5827d..0ddac42d7 100644
--- a/src/java/com/juick/http/www/User.java
+++ b/src/java/com/juick/http/www/User.java
@@ -100,6 +100,7 @@ public class User {
PageTemplates.pageNavigation(out, locale, visitor);
PageTemplates.pageUserTitle(out, sql, locale, user, visitor);
+ out.println("<div id=\"topwrapper\">");
out.println("<div id=\"wrapper\">");
out.println("<div id=\"content\">");
out.println("<ul>");
@@ -122,6 +123,7 @@ public class User {
pageUserColumn(out, sql, user, visitor, locale);
out.println("</div>");
+ out.println("</div>"); // topwrapper
PageTemplates.pageFooter(request, out, locale, visitor);
} finally {
@@ -146,11 +148,7 @@ public class User {
out.println("<div id=\"wrapper\">");
out.println("<div id=\"content\">");
-
- out.print("<p>");
- pageUserTags(out, sql, user, visitor, 0);
- out.print("</p>");
-
+ out.println("<p>" + pageUserTags(sql, user, visitor, 0) + "</p>");
out.println("</div>");
pageUserColumn(out, sql, user, visitor, locale);
out.println("</div>");
@@ -219,7 +217,7 @@ public class User {
try {
PageTemplates.pageHead(out, "@" + user.UName + ": " + rb.getString("(Stats) I read"), null);
PageTemplates.pageNavigation(out, locale, visitor);
- PageTemplates.pageUserTitle(out, sql, locale, user, visitor);
+ //PageTemplates.pageUserTitle(out, sql, locale, user, visitor);
out.println("<div id=\"wrapper\">");
out.println("<div id=\"content\">");
@@ -260,21 +258,21 @@ public class User {
public static void pageUserColumn(PrintWriter out, Connection sql, com.juick.User user, com.juick.User visitor, Locale locale) {
ResourceBundle rb = ResourceBundle.getBundle("User", locale);
- out.println("<div id=\"column\">");
- out.println("<h2>" + rb.getString("(Menu) Messages") + "</h2>");
+ out.println("<div id=\"column\" class=\"stickya\">");
out.println("<ul>");
- out.println(" <li><a href=\"?\">" + rb.getString("(Menu) Blog") + "</a></li>");
- out.println(" <li><a href=\"?show=recomm\">" + rb.getString("(Menu) Recommendations") + "</a></li>");
- out.println(" <li><a href=\"?show=photos\">" + rb.getString("(Menu) Photos") + "</a></li>");
+ out.println(" <li><a href=\"./\">" + rb.getString("(Menu) Blog") + "</a></li>");
+ out.println(" <li><a href=\"./?show=recomm\">" + rb.getString("(Menu) Recommendations") + "</a></li>");
+ out.println(" <li><a href=\"./?show=photos\">" + rb.getString("(Menu) Photos") + "</a></li>");
out.println("</ul>");
- out.println("<h2>" + rb.getString("(Menu) Tags") + " <a href=\"./tags\">" + rb.getString("all") + "</a></h2>");
- pageUserTags(out, sql, user, visitor, 15);
- out.println("<h2>" + rb.getString("(Menu) Search") + "</h2>");
- out.println("<form action=\"./\" id=\"search\"><p><input type=\"text\" name=\"search\" class=\"inp\"/></p></form>");
+ out.println("<hr/>");
+ out.println("<p>" + pageUserTags(sql, user, visitor, 15) + "</p>");
+ out.println("<form action=\"./\" id=\"searchuser\">");
+ out.println("<p><input type=\"text\" name=\"search\" class=\"inp\" placeholder=\"" + rb.getString("Search") + "\"/></p>");
+ out.println("</form>");
out.println("</div>");
}
- public static void pageUserTags(PrintWriter out, Connection sql, com.juick.User user, com.juick.User visitor, int cnt) {
+ public static String pageUserTags(Connection sql, com.juick.User user, com.juick.User visitor, int cnt) {
com.juick.Tag tags[] = null;
int maxUsageCnt = 0;
@@ -313,6 +311,7 @@ public class User {
Arrays.sort(tags, 0, cnt);
}
+ String ret = "";
for (int i = 0; i < cnt; i++) {
String tag = Utils.encodeHTML(tags[i].Name);
try {
@@ -321,12 +320,13 @@ public class User {
}
if (tags[i].UsageCnt > maxUsageCnt / 3 * 2) {
- out.print("<big>" + tag + "</big> ");
+ ret += "<big>" + tag + "</big> ";
} else if (tags[i].UsageCnt > maxUsageCnt / 3) {
- out.print("<small>" + tag + "</small> ");
+ ret += "<small>" + tag + "</small> ";
} else {
- out.print(tag + " ");
+ ret += tag + " ";
}
}
+ return ret;
}
}
diff --git a/src/java/com/juick/http/www/UserThread.java b/src/java/com/juick/http/www/UserThread.java
index e64b44374..1680ca8e9 100644
--- a/src/java/com/juick/http/www/UserThread.java
+++ b/src/java/com/juick/http/www/UserThread.java
@@ -71,7 +71,7 @@ public class UserThread {
PageTemplates.pageNavigation(out, locale, visitor);
PageTemplates.pageUserTitle(out, sql, locale, user, visitor);
-
+ out.println("<div id=\"topwrapper\">");
out.println("<div id=\"wrapper\">");
out.println("<div id=\"content\" style=\"margin-left: 0; width: 100%\">");
@@ -80,8 +80,8 @@ public class UserThread {
printReplies(out, sql, MID, locale, listview);
out.println("</div>");
-
out.println("</div>");
+ out.println("</div>"); // topwrapper
out.println("<script type=\"text/javascript\">");
out.println("$(document).ready(unfoldReply);");
@@ -143,7 +143,7 @@ public class UserThread {
if (rs.getString(11) != null) {
if (rs.getString(11).equals("jpg")) {
- out.println(" <div class=\"msg-media\"><a href=\"http://i.juick.com/photos-1024/" + mid + ".jpg\"><img src=\"http://i.juick.com/photos-512/" + mid + ".jpg\" alt=\"\"/></a></div>");
+ out.println(" <div class=\"msg-media\"><a href=\"http://i.juick.com/p/" + mid + ".jpg\"><img src=\"http://i.juick.com/photos-512/" + mid + ".jpg\" alt=\"\"/></a></div>");
} else {
out.println(" <div class=\"msg-media\"><div id=\"video-" + mid + "\"><b>Attachment: <a href=\"http://i.juick.com/video/" + mid + ".mp4\">Video</a></b></div></div>");
out.println(" <script type=\"text/javascript\">");
@@ -153,17 +153,13 @@ public class UserThread {
}
out.println(" <div class=\"msg-avatar\"><a href=\"/" + uname + "/\"><img src=\"http://i.juick.com/a/" + uid + ".png\" alt=\"" + uname + "\"/></a></div>");
- out.println(" <div class=\"msg-ts\"><a href=\"/" + uname + "/" + mid + "\">" + PageTemplates.formatDate(rs.getInt(8), rs.getString(9), locale) + "</a><div class=\"msg-menu\"><a href=\"#\" onclick=\"$('#msg-menu-" + mid + "').toggle('blind'); return false\"><img src=\"http://static.juick.com/message-menu-icon.png\"></a><ul id=\"msg-menu-" + mid + "\">");
- out.println(" <li><a href=\"/post?body=%21%20%23" + mid + "\">" + rb.getString("Recommend message") + "</a></li>");
- out.println(" <li><a href=\"/post?body=%40" + uname + "%20\">" + rb.getString("Send private message") + "</a></li>");
- out.println(" <li><a href=\"/post?body=BL%20%40" + uname + "\">" + rb.getString("Block user") + "</a></li>");
- out.println(" </ul></div></div>");
+ out.println(" <div class=\"msg-ts\"><a href=\"/" + uname + "/" + mid + "\" title=\"" + rs.getString(9) + "\">" + PageTemplates.formatDate(rs.getInt(8), rs.getString(9), locale) + "</a></div>");
out.println(" <div class=\"msg-header\"><a href=\"/" + uname + "/\">@" + uname + "</a>:" + tags + "</div>");
out.println(" <div class=\"msg-txt\">" + txt + "</div>");
if (cancomment) {
out.println(" <form action=\"/post\" method=\"POST\" enctype=\"multipart/form-data\"><input type=\"hidden\" name=\"mid\" value=\"" + mid + "\"/>");
- out.println(" <div class=\"msg-comment\"><textarea name=\"body\" rows=\"1\" class=\"reply\" placeholder=\"Add a comment...\" onkeypress=\"postformListener(this.form,event)\"></textarea><input type=\"submit\" value=\"OK\"/></div>");
+ out.println(" <div class=\"msg-comment\"><textarea name=\"body\" rows=\"1\" class=\"reply\" placeholder=\"Add a comment...\" onkeypress=\"postformListener(this.form,event)\"></textarea></div>");
out.println(" </form>");
}
@@ -255,6 +251,10 @@ public class UserThread {
public static void printTree(PrintWriter out, ArrayList<com.juick.Message> replies, int ReplyTo, int margin, Locale locale) {
ResourceBundle rb = ResourceBundle.getBundle("Global", locale);
+ if (margin > 420) {
+ margin = 420;
+ }
+
for (int i = 0; i < replies.size(); i++) {
com.juick.Message msg = replies.get(i);
if (msg.ReplyTo == ReplyTo) {
@@ -278,10 +278,7 @@ public class UserThread {
}
}
out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.User.UName + "/\"><img src=\"http://i.juick.com/a/" + msg.User.UID + ".png\" alt=\"" + msg.User.UName + "\"/></a></div>");
- out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.MID + "#" + msg.RID + "\">" + PageTemplates.formatDate(msg.MinutesAgo, msg.TimestampString, locale) + "</a><div class=\"msg-menu\"><a href=\"#\" onclick=\"$('#msg-menu-" + msg.MID + "-" + msg.RID + "').toggle('blind'); return false\"><img src=\"http://static.juick.com/message-menu-icon.png\"/></a><ul id=\"msg-menu-" + msg.MID + "-" + msg.RID + "\">");
- out.println(" <li><a href=\"/post?body=%40" + msg.User.UName + "%20\">" + rb.getString("Send private message") + "</a></li>");
- out.println(" <li><a href=\"/post?body=BL%20%40" + msg.User.UName + "\">" + rb.getString("Block user") + "</a></li>");
- out.println(" </ul></div></div>");
+ out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.MID + "#" + msg.RID + "\" title=\"" + msg.TimestampString + "\">" + PageTemplates.formatDate(msg.MinutesAgo, msg.TimestampString, locale) + "</a></div>");
out.println(" <div class=\"msg-header\"><a href=\"/" + msg.User.UName + "/\">@" + msg.User.UName + "</a>:</div>");
out.println(" <div class=\"msg-txt\">" + msg.Text + "</div>");
out.println(" <div class=\"msg-links\"><a href=\"#\" onclick=\"return showCommentForm(" + msg.MID + "," + msg.RID + ")\">" + rb.getString("Comment") + "</a></div>");
@@ -317,10 +314,7 @@ public class UserThread {
}
}
out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.User.UName + "/\"><img src=\"http://i.juick.com/a/" + msg.User.UID + ".png\"></a></div>");
- out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.MID + "#" + msg.RID + "\">" + PageTemplates.formatDate(msg.MinutesAgo, msg.TimestampString, locale) + "</a><div class=\"msg-menu\"><a href=\"#\" onclick=\"$('#msg-menu-" + msg.MID + "-" + msg.RID + "').toggle('blind'); return false\"><img src=\"http://static.juick.com/message-menu-icon.png\"></a><ul id=\"msg-menu-" + msg.MID + "\">");
- out.println(" <li><a href=\"/post?body=%40" + msg.User.UName + "%20\">" + rb.getString("Send private message") + "</a></li>");
- out.println(" <li><a href=\"/post?body=BL%20%40" + msg.User.UName + "\">" + rb.getString("Block user") + "</a></li>");
- out.println(" </ul></div></div>");
+ out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.MID + "#" + msg.RID + "\" title=\"" + msg.TimestampString + "\">" + PageTemplates.formatDate(msg.MinutesAgo, msg.TimestampString, locale) + "</a></div>");
out.println(" <div class=\"msg-header\"><a href=\"/" + msg.User.UName + "/\">@" + msg.User.UName + "</a>:</div>");
out.println(" <div class=\"msg-txt\">" + msg.Text + "</div>");
out.print(" <div class=\"msg-links\">/" + msg.RID);
diff --git a/web/post3.js b/web/post3.js
index 31b3f8f2a..3267f9c01 100644
--- a/web/post3.js
+++ b/web/post3.js
@@ -25,7 +25,12 @@ function addLocation() {
}
function addTag(tag) {
- document.forms["postmsg"].body.value='*'+tag+' '+document.forms["postmsg"].body.value;
+ var s = document.forms["postmsg"].body.value;
+ if (s.indexOf ('#') == 0) {
+ document.forms["postmsg"].body.value = s + ' *' + tag;
+ } else {
+ document.forms["postmsg"].body.value = '*' + tag + ' ' + s;
+ }
return false;
}
diff --git a/web/scripts3.js b/web/scripts3.js
index bf3da76f6..580546d2b 100644
--- a/web/scripts3.js
+++ b/web/scripts3.js
@@ -39,7 +39,7 @@ function showCommentForm(mid,rid) {
var c=$('#replies #'+rid+' .msg-comment');
c.wrap('<form action="/post" method="POST" enctype="multipart/form-data"/>');
c.before('<input type="hidden" name="mid" value="'+mid+'"/><input type="hidden" name="rid" value="'+rid+'"/>');
- c.append('<textarea name="body" rows="1" class="reply" placeholder="Add a comment..." onkeypress="postformListener(this.form,event)"></textarea><input type="submit" value="OK"/>');
+ c.append('<textarea name="body" rows="1" class="reply narrow" placeholder="Add a comment..." onkeypress="postformListener(this.form,event)"></textarea><input type="submit" value="OK"/>');
}
// $('#replies #'+rid+' .msg-links').hide();
$('#replies #'+rid+' .msg-comment').show();
@@ -63,8 +63,28 @@ function unfoldReply() {
}
$(document).ready(function() {
- $('textarea.reply').autoResize({
+ var tareply=$('textarea.reply');
+ tareply.autoResize({
extraSpace: 0,
minHeight: 1
});
+ tareply.click(function () {
+ $(this).addClass("narrow");
+ $(this).after('<input type="submit" value="OK"/>');
+ $(this).off('click');
+ });
+
+ if(!!$('.stickya').offset()) {
+ var stickyTop = $('.stickya').offset().top;
+ $(window).scroll(function() {
+ var windowTop = $(window).scrollTop();
+ if (stickyTop < windowTop) {
+ $('.stickya').css({
+ position:'fixed'
+ });
+ } else {
+ $('.stickya').css('position','absolute');
+ }
+ });
+ }
});
diff --git a/web/style3.css b/web/style3.css
index fac16fdc9..cc74497c7 100644
--- a/web/style3.css
+++ b/web/style3.css
@@ -3,31 +3,39 @@ body { margin: 0; padding: 0; }
h1,h2 { font-weight: normal; }
ul { list-style-type: none; }
a { text-decoration: none; }
-hr { display: none; }
img { border: none; }
+form { margin: 0; }
/********/
-#header { width: 900px; margin: 0 auto; }
-#logo { float: left; margin: 8px 16px 0 0; }
+#title-container, #topwrapper { width: 100%; min-width: 1000px; max-width: 1024px; margin: 0 auto; }
+
+/********/
+
+#hwrapper { width: 100%; }
+#header { height: 48px; width: 1000px; margin: 0 auto; }
+#logo { float: left; margin: 3px 0 0 30px; }
#header ul { margin: 0; padding: 0; }
#header a { text-decoration: none; font-size: 18px; }
-#nav li { float: left; }
+#search { float: left; margin: 5px 0 0 32px; }
+#search .text { width: 300px; padding: 4px; border-radius: 2px; }
+#search .submit { padding: 3px; margin-left: 5px; border-radius: 2px; }
+
#nav-right { float: right; }
#nav-right li { float: left; }
-#header ul a { display: block; line-height: 56px; padding: 0 20px; }
+#header ul a { display: block; line-height: 48px; padding: 0 20px 0 20px; }
#nav-right img { vertical-align: middle; margin: 0 4px 0 0; }
#nav-menu { display: none; position: absolute; z-index: 1; }
#nav-menu li { float: none; }
/********/
-#title { clear: both; width: 100%; border-top: 1px solid; border-bottom: 1px solid; background: #F0F0F0; }
-#title>h1 { width: 900px; margin: 20px auto; font-size: 28px; }
+#title { display: none; clear: both; width: 100%; border-top: 1px solid; border-bottom: 1px solid; }
+#title>h1 { margin: 20px auto; font-size: 28px; }
-#title-container { width: 900px; margin: 20px auto; min-height: 100px; }
+#title-container { margin: 20px auto; min-height: 100px; }
#title-av { width: 100px; height: 100px; margin-left: 20px; float: left; }
#title-av img { vertical-align: top; padding: 2px; }
#title-stats { width: 200px; float: right; border-left: 1px solid; }
@@ -37,34 +45,37 @@ img { border: none; }
/********/
-#wrapper { width: 900px; margin: 0 auto; }
-#content { width: 640px; margin-left: 260px; float: left; }
+#topwrapper { position: relative; }
+#wrapper { width: 100%; float: left; }
+#content { width: 600px; margin: 0 auto; padding: 0; }
#content ul { list-style-type: none; margin: 0; padding: 0; }
#content li { background-repeat: no-repeat; }
/********/
-#geomap { margin-top: 1em; width: 640px; height: 360px; overflow: hidden; }
+#filters { display: none; margin: 15px 0; border-bottom: 1px solid; padding: 10px 0; }
+#filters li { display: inline; margin-right: 10px; }
+
+/********/
-#content .msg { padding: 16px 0 0 0; margin: 0 0 16px 0; border-top: 1px solid; width: 640px; }
-#content .msg-media { text-align: center; margin-bottom: 10px; }
+#geomap { margin-top: 1em; width: 570px; height: 360px; overflow: hidden; }
+
+#content .msg { padding: 15px; margin: 8px 0 16px 0; width: 570px; border: 1px solid; }
#content .msg-avatar { float: left; }
#content .msg-avatar img { width: 48px; height: 48px; vertical-align: top; }
#content .msg-ts { float: right; }
-#content .msg-ts a { font-size: small; }
-#content .msg-menu { margin: 0 8px; display: inline; position: relative; }
-#content .msg-menu img { vertical-align: top; }
-#content .msg-menu ul { display: none; position: absolute; top: 20px; right: 0; width: 300px; margin: 0; padding: 5px; }
-#content .msg-menu li { margin: 0; padding: 10px 5px; }
+#content .msg-ts>a { font-size: small; vertical-align: top; }
#content .msg-header { margin-left: 58px; overflow: hidden; }
-#content .msg-txt { margin-left: 58px; padding: 6px 0 0 0; }
-#content .msg-links { font-size: small; margin: 10px 0 0 68px; }
-#content .msg-comments { margin: 10px 0 0 58px; padding: 5px 20px; overflow: hidden; font-size: small; }
-#content .msg-comment { margin: 10px 0 0 58px; padding: 0px 0 0 20px; }
-#content .msg-comment textarea { border: 1px solid; width: 500px; padding: 2px; resize: vertical; }
-#content .msg-comment input { border: 1px solid; width: 50px; margin-left: 5px; vertical-align: top; }
+#content .msg-txt { margin: 8px 0 8px 58px; padding: 0; }
+#content .msg-media { text-align: center; margin: 8px 0 0px 58px; }
+#content .msg-links { font-size: small; margin: 8px 0 0 68px; }
+#content .msg-comments { margin: 10px 0 0 58px; padding: 5px 0 0 10px; overflow: hidden; font-size: small; border-top: 1px solid; }
+#content .msg-comment { margin: 8px 0 0 58px; }
+#content .msg-comment textarea { border: 1px solid; width: 505px; padding: 2px; resize: vertical; }
+#content .msg-comment textarea.narrow { width: 450px; }
+#content .msg-comment input { border: 1px solid; width: 50px; margin-left: 6px; vertical-align: top; }
-#content textarea.newmessage { border: 1px solid; width: 640px; padding: 2px; resize: vertical; }
+#content textarea.newmessage { border: 1px solid; width: 570px; padding: 2px; resize: vertical; }
table.users { width: 100%; margin: 10px 0; }
table.users td { width: 33%; padding: 6px 0; overflow: hidden; }
@@ -72,7 +83,7 @@ table.users img { width: 32px; height: 32px; vertical-align: middle; margin-righ
#chats li { margin: 16px; }
-.title2 { padding: 10px 20px; margin: 20px 0 10px 0; }
+.title2 { padding: 10px 20px; margin: 20px 0 20px 0; }
.title2-right { float: right; line-height: 24px; }
.title2 h2 { margin: 0; font-size: 24px; }
@@ -84,43 +95,56 @@ table.users img { width: 32px; height: 32px; vertical-align: middle; margin-righ
/********/
-#column { float: left; width: 210px; margin-left: -900px; }
+#column { width: 200px; position: absolute; top: 0px; padding-top: 10px; }
#column ul { margin: 8px 0 0 0; padding: 0; }
-#column li { margin: 0; padding: 2px 0 2px 10px; }
-#column p { font-size: 14px; margin: 0 0 0 10px; }
-#column .inp { width: 195px; }
-#column h2 { border-bottom: 1px solid; font-size: 18px; margin: 24px 0 8px 0; padding: 0 2px 2px 2px; }
+#column li { margin: 0; padding: 0; }
+#column li a { display: block; padding: 3px 0 3px 10px; }
+#column p { font-size: small; margin: 10px 5px 0 10px; line-height: 130%; }
+#column hr { height: 1px; border: none; width: 190px; margin: 10px 0 10px 10px;}
+#column .inp { width: 185px; border: 1px solid; padding: 3px; border-radius: 3px; }
+#column h2 { display: none; border-bottom: 1px solid; font-size: 18px; margin: 24px 0 8px 0; padding: 0 2px 2px 2px; }
#column h2>a { float: right; }
/********/
-#footer { clear: both; width: 900px; margin: 0 auto; font-size: small; padding: 25px 0 10px; }
+#rcol { float: left; margin-left: -200px; }
+
+/********/
+
+#footer { clear: both; width: 590px; margin: 0 auto; font-size: small; padding: 15px 0 10px 0; }
#footer-right { float: right; }
/******************************************************************************/
-html { background: #FFF; color: #000; }
+html { background: #EEEEE5; color: #000; }
a { color: #069; }
-#header li a:hover { background: #E0F0FF; }
-#title { border-color: #CCC; }
+#hwrapper { background: #333; }
+#header a { color: #AAA; }
+#header li a:hover { background: #444; }
+#title { border-color: #CCC; background: #F0F0F0; }
#nav-menu { background: #DDD; }
#title-stats { border-color: #CCC; }
-
-#content .msg { border-color: #DDD; }
-#content .msg-comments { background: #F5F5F5; color: #999; }
-#content .msg-ts a { color: #999; }
+#search .text { border: none; background-color: #EEE; }
+#search .submit { border: none; background-color: #DDD; }
+
+#content { }
+#filters { border-color: #CCC; }
+#filters a { color: #999; }
+#content .msg { background: #FFF; border-color: #EEE; }
+#content .msg-comments { color: #AAA; border-color: #DDD; }
+#content .msg-ts>a { color: #999; }
#content .msg-links { color: #999; }
#content .msg-comment textarea { border-color: #DDD; }
#content .msg-comment input { border-color: #CCC; background-color: #EEE; color: #999; }
-#content .msg-menu ul { background: #DDD; }
-#content .msg-menu a { color: #000; }
#content textarea.newmessage { border-color: #DDD; }
-.title2 { background: #F0F0F0; }
-.page { background: #F0F0F0; }
+.title2 { background: #DDDDD0; }
+.page { background: #E5E5DD; }
-#column li:hover { background: #E0F0FF; }
+#column li:hover { background: #D0E0EE; }
#column h2 { border-color: #CCC; }
+#column hr { background-color: #CCC; }
+#column .inp { border-color: #CCC; background: #F5F5E9; }
#footer { color: #999; }