diff --git a/htroot/News.html b/htroot/News.html index f0b9b4c07..170b4d114 100644 --- a/htroot/News.html +++ b/htroot/News.html @@ -2,6 +2,14 @@ YaCy '#[clientname]#': News + #(table)# + + + + + :: + + #(/table)# #%env/templates/metas.template%# diff --git a/htroot/News.java b/htroot/News.java index ba522e749..f19daaa87 100644 --- a/htroot/News.java +++ b/htroot/News.java @@ -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; } diff --git a/htroot/News.rss b/htroot/News.rss new file mode 100644 index 000000000..54d59888b --- /dev/null +++ b/htroot/News.rss @@ -0,0 +1,33 @@ + + + + <![CDATA[YaCy '#[address]#': #(page)#News Overview::Incoming News::Processed News::Outgoing News::Published News#(/page)#]]> + http://#[address]#/News.html?page=#[page]# + + http://#[address]#/env/grafics/yacy.png + YaCy + http://#[address]#/ + + #(table)# + :: + #{list}# + + <![CDATA[#[title]#]]> + + #[crerfcdate]# + #[id]# + #[description]#

+
+ + #{attributes}# + + + #{/attributes}# +
#[name]##[value]#
+ ]]>
+ +
#{/list}# + #(/table)# +
+
\ No newline at end of file diff --git a/source/de/anomic/yacy/yacyNewsPool.java b/source/de/anomic/yacy/yacyNewsPool.java index 5ae81d658..61a06b230 100644 --- a/source/de/anomic/yacy/yacyNewsPool.java +++ b/source/de/anomic/yacy/yacyNewsPool.java @@ -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 */