From 21847edc8b557f795bc6e64ca1f84c23252ab314 Mon Sep 17 00:00:00 2001 From: Ugnich Anton Date: Fri, 25 Jul 2014 18:14:56 +0700 Subject: Reader --- src/java/com/juick/http/www/Main.java | 3 + src/java/com/juick/http/www/PageTemplates.java | 3 +- src/java/com/juick/http/www/Reader.java | 78 ++++++++++++++++++++++++++ web/style3.css | 1 + 4 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 src/java/com/juick/http/www/Reader.java diff --git a/src/java/com/juick/http/www/Main.java b/src/java/com/juick/http/www/Main.java index e0c84734..1d5e64d3 100644 --- a/src/java/com/juick/http/www/Main.java +++ b/src/java/com/juick/http/www/Main.java @@ -49,6 +49,7 @@ public class Main extends HttpServlet implements Stream.StreamListener { Stream xmpp; Home home = new Home(); Discover discover = new Discover(); + Reader reader = new Reader(); PM pm = new PM(); Login login = new Login(); Help help = new Help(); @@ -150,6 +151,8 @@ public class Main extends HttpServlet implements Stream.StreamListener { com.juick.User visitor = Utils.getVisitorUser(sql, request, response); home.doGet(sql, sqlSearch, request, response, visitor); } + } else if (uri.equals("/reader")) { + reader.doGet(sql, request, response); } else if (uri.equals("/post")) { com.juick.User visitor = Utils.getVisitorUser(sql, request, response); if (visitor != null) { diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java index da4c0b81..f0a87c42 100644 --- a/src/java/com/juick/http/www/PageTemplates.java +++ b/src/java/com/juick/http/www/PageTemplates.java @@ -51,7 +51,7 @@ public class PageTemplates { out.println(""); out.print(""); out.print(""); - out.print(""); + out.print(""); out.print(""); out.print(""); if (headers != null) { @@ -74,6 +74,7 @@ public class PageTemplates { out.print(" "); out.print("
. + */ +package com.juick.http.www; + +import com.juick.server.MessagesQueries; +import com.juick.server.TagQueries; +import java.io.IOException; +import java.io.PrintWriter; +import java.net.URLDecoder; +import java.net.URLEncoder; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * + * @author Ugnich Anton + */ +public class Reader { + + protected void doGet(Connection sql, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + com.juick.User visitor = Utils.getVisitorUser(sql, request, response); + + response.setContentType("text/html; charset=UTF-8"); + PrintWriter out = response.getWriter(); + try { + String head = ""; + PageTemplates.pageHead(out, "Ссылки", head); + PageTemplates.pageNavigation(out, visitor, null); + out.println("
"); + + out.println("
    "); + + PreparedStatement stmt = null; + ResultSet rs = null; + try { + stmt = sql.prepareStatement("SELECT rss_id,url,title FROM reader_links ORDER BY ts DESC LIMIT 100"); + rs = stmt.executeQuery(); + rs.beforeFirst(); + while (rs.next()) { + out.println("
  • " + rs.getString(3) + "
  • "); + } + } catch (SQLException e) { + System.err.println(e); + } finally { + Utils.finishSQL(rs, stmt); + } + + out.println("
"); + + out.println("
"); + PageTemplates.pageFooter(request, out, visitor, true); + PageTemplates.pageEnd(out); + } finally { + out.close(); + } + } +} diff --git a/web/style3.css b/web/style3.css index 3bd9141e..ea069c25 100644 --- a/web/style3.css +++ b/web/style3.css @@ -130,6 +130,7 @@ blockquote { border-left: 1px dashed #CCC; margin: 10px 0 10px 10px; padding-lef #readerlinks li { margin: 15px 0; } #readerlinks img { vertical-align: top; margin: 1px 7px 0 0; } #readerlinks a { color: #000; border-bottom: 1px dotted #666; } +#readerlinks a:visited { color: #999; } /********/ -- cgit v1.2.3