*) adding RSS feed for yacy news

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3496 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 18 years ago
parent 589cbd8cbf
commit 40ce33e664

@ -2,6 +2,14 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>YaCy '#[clientname]#': News</title>
#(table)#
<link rel="alternate" type="application/rss+xml" title="Incoming News" href="News.rss?page=1" />
<link rel="alternate" type="application/rss+xml" title="Processed News" href="News.rss?page=2" />
<link rel="alternate" type="application/rss+xml" title="Outgoing News" href="News.rss?page=3" />
<link rel="alternate" type="application/rss+xml" title="Published News" href="News.rss?page=4" />
::
<link rel="alternate" type="application/rss+xml" title="#(page)#News Overview::Incoming News::Processed News::Outgoing News::Published News#(/page)#" href="News.rss?page=#[page]#" />
#(/table)#
#%env/templates/metas.template%#
</head>
<body id="News">

@ -45,8 +45,11 @@
import java.io.IOException;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Map;
import de.anomic.http.httpHeader;
import de.anomic.http.httpc;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@ -134,17 +137,76 @@ public class News {
if (record == null) continue;
seed = yacyCore.seedDB.getConnected(record.originator());
if (seed == null) seed = yacyCore.seedDB.getDisconnected(record.originator());
String category = record.category();
prop.put("table_list_" + i + "_id", record.id());
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 + "_crerfcdate", httpc.dateString(record.created()));
prop.put("table_list_" + i + "_cat", category);
prop.put("table_list_" + i + "_rec", (record.received() == null) ? "-" : yacyCore.universalDateShortString(record.received()));
prop.put("table_list_" + i + "_dis", record.distributed());
prop.put("table_list_" + i + "_att", record.attributes().toString() );
Map attributeMap = record.attributes();
prop.put("table_list_" + i + "_att", attributeMap.toString() );
int j = 0;
if (attributeMap.size() > 0) {
Iterator attributeKeys = attributeMap.keySet().iterator();
while (attributeKeys.hasNext()) {
String key = (String) attributeKeys.next();
String value = (String) attributeMap.get(key);
prop.put("table_list_" + i + "_attributes_" + j + "_name",key);
prop.put("table_list_" + i + "_attributes_" + j + "_value",value);
j++;
}
}
prop.put("table_list_" + i + "_attributes",j);
// generating link / title / description (taken over from Surftips.java)
String link, title, description;
if (category.equals(yacyNewsPool.CATEGORY_CRAWL_START)) {
link = record.attribute("startURL", "");
title = (record.attribute("intention", "").length() == 0) ? link : record.attribute("intention", "");
description = "Crawl Start Point";
} else if (category.equals(yacyNewsPool.CATEGORY_PROFILE_UPDATE)) {
link = record.attribute("homepage", "");
title = "Home Page of " + record.attribute("nickname", "");
description = "Profile Update";
} else if (category.equals(yacyNewsPool.CATEGORY_BOOKMARK_ADD)) {
link = record.attribute("url", "");
title = record.attribute("title", "");
description = "Bookmark: " + record.attribute("description", "");
} else if (category.equals(yacyNewsPool.CATEGORY_SURFTIPP_ADD)) {
link = record.attribute("url", "");
title = record.attribute("title", "");
description = "Surf Tipp: " + record.attribute("description", "");
} else if (category.equals(yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD)) {
link = record.attribute("url", "");
title = record.attribute("title", "");
description = record.attribute("url", "");
} else if (category.equals(yacyNewsPool.CATEGORY_WIKI_UPDATE)) {
link = "http://" + seed.getAddress() + "/Wiki.html?page=" + record.attribute("page", "");
title = record.attribute("author", "Anonymous") + ": " + record.attribute("page", "");
description = "Wiki Update: " + record.attribute("description", "");
} else if (category.equals(yacyNewsPool.CATEGORY_BLOG_ADD)) {
link = "http://" + seed.getAddress() + "/Blog.html?page=" + record.attribute("page", "");
title = record.attribute("author", "Anonymous") + ": " + record.attribute("page", "");
description = "Blog Entry: " + record.attribute("subject", "");
} else {
link = "";
title = "";
description = "";
}
prop.put("table_list_" + i + "_link", link);
prop.put("table_list_" + i + "_title", title);
prop.put("table_list_" + i + "_description", description);
} catch (IOException e) {e.printStackTrace();}
prop.put("table_list", maxCount);
}
}
// adding the peer address
prop.put("address",yacyCore.seedDB.mySeed.getAddress());
// return rewrite properties
return prop;
}

@ -0,0 +1,33 @@
<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title><![CDATA[YaCy '#[address]#': #(page)#News Overview::Incoming News::Processed News::Outgoing News::Published News#(/page)#]]></title>
<link>http://#[address]#/News.html?page=#[page]#</link>
<image>
<url>http://#[address]#/env/grafics/yacy.png</url>
<title>YaCy</title>
<link>http://#[address]#/</link>
</image>
#(table)#<!-- News Overview -->
::<!-- News Tables -->
#{list}#<item>
<author><![CDATA[#[ori]#]]></author>
<title><![CDATA[#[title]#]]></title>
<link><![CDATA[#[link]#]]></link>
<pubDate>#[crerfcdate]#</pubDate>
<guid>#[id]#</guid>
<description><![CDATA[
<p>#[description]#</p>
<hr />
<table border="1">
#{attributes}#<tr>
<td>#[name]#</td>
<td>#[value]#</td>
</tr>#{/attributes}#
</table>
]]></description>
<category><![CDATA[#[cat]#]]></category>
</item>#{/list}#
#(/table)#
</channel>
</rss>

@ -61,6 +61,7 @@ public class yacyNewsPool {
/* ------------------------------------------------------------------------
* PROFILE related CATEGORIES
* ------------------------------------------------------------------------ */
public static final String CATEGORY_PROFILE = "prfl";
/**
* a profile entry was updated (implemented)
*/
@ -69,6 +70,7 @@ public class yacyNewsPool {
/* ------------------------------------------------------------------------
* CRAWLING related CATEGORIES
* ------------------------------------------------------------------------ */
public static final String CATEGORY_CRAWL = "crwl";
/**
* a crawl with remote indexing was startet
*/
@ -84,7 +86,8 @@ public class yacyNewsPool {
/* ------------------------------------------------------------------------
* BLACKLIST related CATEGORIES
* ------------------------------------------------------------------------ */
* ------------------------------------------------------------------------ */
public static final String CATEGORY_BLACKLIST = "blckl";
/**
* a public blacklist entry was added
*/
@ -105,6 +108,7 @@ public class yacyNewsPool {
/* ------------------------------------------------------------------------
* FLIE-SHARE related CATEGORIES
* ------------------------------------------------------------------------ */
public static final String CATEGORY_FILESHARE = "flshr";
/**
* a file was added to the file share
*/
@ -121,6 +125,7 @@ public class yacyNewsPool {
/* ------------------------------------------------------------------------
* BOOKMARK related CATEGORIES
* ------------------------------------------------------------------------ */
public static final String CATEGORY_BOOKMARK = "bkmrk";
/**
* a bookmark was added/created
*/
@ -149,6 +154,7 @@ public class yacyNewsPool {
/* ------------------------------------------------------------------------
* SURFTIPP related CATEGORIES
* ------------------------------------------------------------------------ */
public static final String CATEGORY_SURFTIPP = "stipp";
/**
* a surf tipp was added
*/
@ -161,6 +167,7 @@ public class yacyNewsPool {
/* ------------------------------------------------------------------------
* WIKI related CATEGORIES
* ------------------------------------------------------------------------ */
public static final String CATEGORY_WIKI = "wiki";
/**
* a wiki page was updated
*/
@ -173,6 +180,7 @@ public class yacyNewsPool {
/* ------------------------------------------------------------------------
* BLOG related CATEGORIES
* ------------------------------------------------------------------------ */
public static final String CATEGORY_BLOG = "blog";
/**
* a blog entry was added
*/

Loading…
Cancel
Save