aboutsummaryrefslogtreecommitdiff
path: root/src/java/com/juick/http/www/PageTemplates.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/com/juick/http/www/PageTemplates.java')
-rw-r--r--src/java/com/juick/http/www/PageTemplates.java35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java
index c76ded41..f9cce99e 100644
--- a/src/java/com/juick/http/www/PageTemplates.java
+++ b/src/java/com/juick/http/www/PageTemplates.java
@@ -52,7 +52,7 @@ public class PageTemplates {
out.println("<!DOCTYPE html>");
out.print("<html>");
out.print("<head>");
- out.print("<link rel=\"stylesheet\" href=\"/style.2014022100.css\"/>");
+ out.print("<link rel=\"stylesheet\" href=\"/style.2014030800.css\"/>");
out.print("<script type=\"text/javascript\" src=\"//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js\" defer=\"defer\"></script>");
out.print("<script type=\"text/javascript\" src=\"/scripts.2014021500.js\" defer=\"defer\"></script>");
if (headers != null) {
@@ -136,6 +136,7 @@ public class PageTemplates {
out.println("<aside id=\"column\">");
out.println(" <p class=\"tags\">" + tagsHTML + "</p>");
+ printContestRating(out, sql);
out.println("</aside>");
}
@@ -188,6 +189,38 @@ public class PageTemplates {
return ret;
}
+ public static void printContestRating(PrintWriter out, Connection sql) {
+ out.println("<hr/>");
+ out.println("<!--noindex-->");
+ out.println("<p style=\"font-size: 14pt\">Кто <a href=\"/help/ru/contest\">выиграет iPod</a>?</p>");
+ out.println("<table width=\"100%\">");
+
+ int i = 0;
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ try {
+ stmt = sql.prepareStatement("SELECT users.id,users.nick,COUNT(users_refs.user_id) AS cnt FROM users INNER JOIN users_refs ON users.id=users_refs.ref GROUP BY users_refs.ref ORDER BY cnt DESC LIMIT 10");
+ rs = stmt.executeQuery();
+ rs.beforeFirst();
+ while (rs.next()) {
+ String uname = rs.getString(2);
+ if (i == 0) {
+ out.println(" <tr><td><b><a href=\"/" + uname + "/\">" + uname + "</a></b></td><td align=\"right\"><b>" + rs.getInt(3) + "</b></td></tr>");
+ } else {
+ out.println(" <tr><td><a href=\"/" + uname + "/\">" + uname + "</a></td><td align=\"right\">" + rs.getInt(3) + "</td></tr>");
+ }
+ i++;
+ }
+ } catch (SQLException e) {
+ System.err.println(e);
+ } finally {
+ Utils.finishSQL(rs, stmt);
+ }
+
+ out.println("</table>");
+ out.println("<!--/noindex-->");
+ }
+
public static void pageDialogTemplate(PrintWriter out) {
out.println("<div id=\"dialogb\" onclick=\"$('#dialogb').hide();$('#dialogw').hide()\"></div>");
out.println("<div id=\"dialogw\">Ссылка на сообщение:");