Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

integrated news service: update of profile

orbiterf65dd694a1c9
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).
</tr>
#{list}#
<tr class="TableCell#(dark)#Light::Dark::Summary#(/dark)#">
-<td class="small" align="right">#[ori]#</td>
-<td class="small" align="right">#[cre]#</td>
-<td class="small" align="right">#[cat]#</td>
-<td class="small" align="right">#[rec]#</td>
+<td class="small" align="left">#[ori]#</td>
+<td class="small" align="left">#[cre]#</td>
+<td class="small" align="left">#[cat]#</td>
+<td class="small" align="left">#[rec]#</td>
<td class="small" align="right">#[dis]#</td>
-<td class="small" align="right">#[att]#</td>
+<td class="small" align="left">#[att]#</td>
</tr>
#{/list}#
</table>
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);
}