diff options
Diffstat (limited to 'src/java/com/juick/http/www/PageTemplates.java')
-rw-r--r-- | src/java/com/juick/http/www/PageTemplates.java | 71 |
1 files changed, 8 insertions, 63 deletions
diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java index e8f96be3..ba5665ed 100644 --- a/src/java/com/juick/http/www/PageTemplates.java +++ b/src/java/com/juick/http/www/PageTemplates.java @@ -52,9 +52,8 @@ public class PageTemplates { out.println("<!DOCTYPE html>"); out.println("<html>"); out.println("<head>"); - out.println(" <meta charset=\"utf-8\"/>"); out.println(" <title>" + title + "</title>"); - out.println(" <link rel=\"stylesheet\" href=\"//static.juick.com/style3.2012102203.css\"/>"); + out.println(" <link rel=\"stylesheet\" href=\"//static.juick.com/style3.2012110200.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>"); @@ -72,8 +71,8 @@ public class PageTemplates { out.println("<div id=\"hwrapper\">"); out.println("<div id=\"header\">"); out.println(" <div id=\"logo\"><a href=\"" + (user != null ? "/?show=my" : "/") + "\"><img src=\"//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 action=\"/\">"); + out.println(" <div id=\"search\"><input type=\"text\" name=\"search\" class=\"text\" placeholder=\"" + rb.getString("Search") + "\"/></div>"); out.println(" </form>"); out.println(" <ul id=\"nav-right\">"); if (user != null) { @@ -275,7 +274,7 @@ public class PageTemplates { return msg; } - public static void printMessages(PrintWriter out, Connection sql, ArrayList<Integer> mids, Locale locale) { + public static void printMessages(PrintWriter out, Connection sql, ArrayList<Integer> mids, com.juick.User visitor, Locale locale) { ResourceBundle rb = ResourceBundle.getBundle("Global", locale); PreparedStatement stmt = null; @@ -300,12 +299,14 @@ public class PageTemplates { // lat // lon - boolean cancomment = true; + boolean cancomment = visitor != null; tags = (tags != null) ? formatTags(tags) : ""; if (rs.getInt(5) == 1) { tags += " *readonly"; - cancomment = false; + if (visitor != null && visitor.UID != uid) { + cancomment = false; + } } switch (rs.getInt(6)) { case 2: @@ -357,60 +358,4 @@ 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>"); - } - */ } |