From f65dd694a1c928defb5a75dc1f18e71c44548f70 Mon Sep 17 00:00:00 2001 From: orbiter Date: Fri, 29 Jul 2005 15:14:48 +0000 Subject: [PATCH] integrated news service: update of profile git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@456 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/EditProfile_p.java | 29 ++++++++++++++++++++--------- htroot/News.html | 10 +++++----- htroot/News.java | 11 ++++++++--- 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/htroot/EditProfile_p.java b/htroot/EditProfile_p.java index c894c0804..60414b3c6 100644 --- a/htroot/EditProfile_p.java +++ b/htroot/EditProfile_p.java @@ -50,10 +50,15 @@ import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.Properties; +import java.util.Map; +import java.util.HashMap; import de.anomic.http.httpHeader; import de.anomic.server.serverObjects; import de.anomic.server.serverSwitch; +import de.anomic.yacy.yacyNewsRecord; +import de.anomic.yacy.yacyCore; + public class EditProfile_p { @@ -82,7 +87,22 @@ public class EditProfile_p { profile.setProperty("msn", (String)post.get("msn")); profile.setProperty("comment", (String)post.get("comment")); + + // write new values + FileOutputStream fileOut = null; + try{ + fileOut = new FileOutputStream(new File("DATA/SETTINGS/profile.txt")); + profile.store(fileOut , null ); + + // generate a news message + //HashMap map = new HashMap(); + yacyCore.newsPool.enqueueMyNews(new yacyNewsRecord("updprfle", profile)); + }catch(IOException e){ + } finally { + if (fileOut != null) try { fileOut.close(); } catch (Exception e) {} + } } + prop.put("name", profile.getProperty("name", "")); prop.put("nickname", profile.getProperty("nickname", "")); prop.put("homepage", profile.getProperty("homepage", "")); @@ -95,15 +115,6 @@ public class EditProfile_p { prop.put("comment", profile.getProperty("comment", "")); - FileOutputStream fileOut = null; - try{ - fileOut = new FileOutputStream(new File("DATA/SETTINGS/profile.txt")); - profile.store(fileOut , null ); - }catch(IOException e){ - } finally { - if (fileOut != null) try { fileOut.close(); } catch (Exception e) {} - } - return prop; } diff --git a/htroot/News.html b/htroot/News.html index 5e0d166e0..479de85c5 100644 --- a/htroot/News.html +++ b/htroot/News.html @@ -51,12 +51,12 @@ This is the news system (currently under testing). #{list}# -#[ori]# -#[cre]# -#[cat]# -#[rec]# +#[ori]# +#[cre]# +#[cat]# +#[rec]# #[dis]# -#[att]# +#[att]# #{/list}# diff --git a/htroot/News.java b/htroot/News.java index cc16a8708..771b682d2 100644 --- a/htroot/News.java +++ b/htroot/News.java @@ -52,6 +52,7 @@ import de.anomic.server.serverObjects; import de.anomic.server.serverSwitch; import de.anomic.server.serverDate; import de.anomic.yacy.yacyCore; +import de.anomic.yacy.yacySeed; import de.anomic.yacy.yacyNewsRecord; public class News { @@ -78,13 +79,17 @@ public class News { if (maxCount > 500) maxCount = 500; yacyNewsRecord record; + yacySeed seed; for (int i = 0; i < maxCount; i++) try { record = yacyCore.newsPool.get(tableID, i); - prop.put("table_list_" + i + "_ori", record.originator()); + seed = yacyCore.seedDB.getConnected(record.originator()); + if (seed == null) seed = yacyCore.seedDB.getDisconnected(record.originator()); + prop.put("table_list_" + i + "_ori", (seed == null) ? record.originator() : seed.getName()); prop.put("table_list_" + i + "_cre", yacyCore.universalDateShortString(record.created())); prop.put("table_list_" + i + "_cat", record.category()); - prop.put("table_list_" + i + "_rec", record.received()); - prop.put("table_list_" + i + "_dis", record.attributes().toString()); + prop.put("table_list_" + i + "_rec", yacyCore.universalDateShortString(record.received())); + prop.put("table_list_" + i + "_dis", record.distributed()); + prop.put("table_list_" + i + "_att", record.attributes().toString()); } catch (IOException e) {e.printStackTrace();} prop.put("table_list", maxCount); }