Fixed numberbug in Blog, see http://forum.yacy-websuche.de/viewtopic.php?f=6&t=639. This wont fix existing Blogentrys (comes later).

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4443 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
lulabad 17 years ago
parent 141db7ba48
commit 40a0591942

@ -362,11 +362,7 @@ public class Blog {
prop.put("mode_entries_" + number + "_commentsactive", "1");
prop.put("mode_entries_" + number + "_commentsactive_pageid", entry.key());
prop.put("mode_entries_" + number + "_commentsactive_address", address);
try {
prop.put("mode_entries_" + number + "_commentsactive_comments", new String(entry.commentsSize(),"UTF-8"));
} catch (UnsupportedEncodingException e) {
prop.put("mode_entries_" + number + "_commentsactive_comments", new String(entry.commentsSize()));
}
prop.put("mode_entries_" + number + "_commentsactive_comments", entry.commentsSize());
}
prop.put("mode_entries_" + number + "_date", dateString(entry.date()));

@ -246,11 +246,7 @@ public class BlogComments {
prop.putHTML("mode_author", new String(page.author()));
prop.putHTML("mode_allow_author", new String(author));
}
try {
prop.put("mode_comments", new String(page.commentsSize(),"UTF-8"));
} catch (UnsupportedEncodingException e) {
prop.put("mode_comments", new String(page.commentsSize()));
}
prop.put("mode_comments", page.commentsSize());
prop.put("mode_date", dateString(page.date()));
prop.putWiki("mode_page", page.page());
if(hasRights) {
@ -272,7 +268,7 @@ public class BlogComments {
int num = post.getInt("num",10); //indicates how many entries should be shown
boolean prev = false; //indicates if there were previous comments to the ones that are dispalyed
if(xml) num = 0;
if (start < 1) start = 1; // dirrrty fix for incorrect comment count, need to find reason
if (start < 0) start = 0;
if (start > 1) prev = true;
int nextstart = start+num; //indicates the starting offset for next results
int prevstart = start-num; //indicates the starting offset for previous results

@ -189,17 +189,13 @@ public class blogBoard {
return b;
}
public byte[] commentsSize() {
public int commentsSize() {
ArrayList<String> m = listManager.string2arraylist(record.get("comments"));
if (m == null) return new byte[0];
byte[] b = Integer.toString(m.size()).getBytes();
if (b == null) return "".getBytes();
return b;
return m.size();
}
public ArrayList<String> comments() {
ArrayList<String> m = listManager.string2arraylist(record.get("comments"));
if (m == null) return new ArrayList<String>();
return m;
}

@ -327,7 +327,7 @@ public class listManager {
public static ArrayList<String> string2arraylist(String string){
ArrayList<String> l;
if (string != null) {
if (string != null && string.length() > 0) {
l = new ArrayList<String>(Arrays.asList(string.split(",")));
} else {
l = new ArrayList<String>();

Loading…
Cancel
Save