integrated news service: update of profile

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@456 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 20 years ago
parent 60117a2073
commit f65dd694a1

@ -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;
}

@ -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>

@ -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);
}

Loading…
Cancel
Save