Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@455 6c8d7289-2bf4-0310-a012-ef5d649a1542
- Loading branch information
orbiter
committed
Jul 29, 2005
1 parent
b8e294f
commit 60117a2
Showing
12 changed files
with
859 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> | ||
<html> | ||
<head> | ||
<title>YaCy: News</title> | ||
#[metas]# | ||
</head> | ||
<body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0"> | ||
#[header]# | ||
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="SubMenu"> | ||
<tr height="10"><td colspan="9" class="MenuHeader"> Network Menu</td></tr> | ||
<tr height="2"><td colspan="9"></td></tr> | ||
<tr class="TableHeader"> | ||
<td width="20%" class="MenuSubItem"> <a href="/News.html" class="MenuItemLink">News Overview</a> </td> | ||
<td class="MenuSubSpacer"></td> | ||
<td width="20%" class="MenuSubItem"> <a href="/News.html?page=1" class="MenuItemLink">Incoming News</a> </td> | ||
<td class="MenuSubSpacer"></td> | ||
<td width="20%" class="MenuSubItem"> <a href="/News.html?page=2" class="MenuItemLink">Processed News</a> </td> | ||
<td class="MenuSubSpacer"></td> | ||
<td width="20%" class="MenuSubItem"> <a href="/News.html?page=3" class="MenuItemLink">Outgoing News</a> </td> | ||
<td class="MenuSubSpacer"></td> | ||
<td width="20%" class="MenuSubItem"> <a href="/News.html?page=4" class="MenuItemLink">Published News</a> </td> | ||
</tr> | ||
</table> | ||
<br> | ||
#(page)# | ||
<h2>News Overview</h2> | ||
:: | ||
<h2>Incoming News</h2> | ||
:: | ||
<h2>Processed News</h2> | ||
:: | ||
<h2>Outgoing News</h2> | ||
:: | ||
<h2>Published News</h2> | ||
#(/page)# | ||
<p> | ||
#(table)# | ||
<p> | ||
This is the news system (currently under testing). | ||
</p> | ||
:: | ||
<p> | ||
<table border="0" cellpadding="2" cellspacing="1"> | ||
<tr class="TableHeader" valign="bottom"> | ||
<td class="small">Originator</td> | ||
<td class="small">Created</td> | ||
<td class="small">Category</td> | ||
<td class="small">Received</td> | ||
<td class="small">Distributed</td> | ||
<td class="small">Attributes</td> | ||
</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="right">#[dis]#</td> | ||
<td class="small" align="right">#[att]#</td> | ||
</tr> | ||
#{/list}# | ||
</table> | ||
</p> | ||
#(/table)# | ||
#[footer]# | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
// News.java | ||
// ----------------------- | ||
// part of YaCy | ||
// (C) by Michael Peter Christen; mc@anomic.de | ||
// first published on http://www.anomic.de | ||
// Frankfurt, Germany, 2005 | ||
// last major change: 29.07.2005 | ||
// | ||
// This program is free software; you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation; either version 2 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program; if not, write to the Free Software | ||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
// | ||
// Using this software in any meaning (reading, learning, copying, compiling, | ||
// running) means that you agree that the Author(s) is (are) not responsible | ||
// for cost, loss of data or any harm that may be caused directly or indirectly | ||
// by usage of this softare or this documentation. The usage of this software | ||
// is on your own risk. The installation and usage (starting/running) of this | ||
// software may allow other people or application to access your computer and | ||
// any attached devices and is highly dependent on the configuration of the | ||
// software which must be done by the user of the software; the author(s) is | ||
// (are) also not responsible for proper configuration and usage of the | ||
// software, even if provoked by documentation provided together with | ||
// the software. | ||
// | ||
// Any changes to this file according to the GPL as documented in the file | ||
// gpl.txt aside this file in the shipment you received can be done to the | ||
// lines that follows this copyright notice here, but changes must not be | ||
// done inside the copyright notive above. A re-distribution must contain | ||
// the intact and unchanged copyright notice. | ||
// Contributions and changes to the program code must be marked as such. | ||
|
||
// You must compile this file with | ||
// javac -classpath .:../classes Network.java | ||
// if the shell's current path is HTROOT | ||
|
||
import java.util.Enumeration; | ||
import java.util.HashMap; | ||
import java.io.IOException; | ||
|
||
import de.anomic.http.httpHeader; | ||
import de.anomic.server.serverObjects; | ||
import de.anomic.server.serverSwitch; | ||
import de.anomic.server.serverDate; | ||
import de.anomic.yacy.yacyCore; | ||
import de.anomic.yacy.yacyNewsRecord; | ||
|
||
public class News { | ||
|
||
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch sb) { | ||
// return variable that accumulates replacements | ||
serverObjects prop = new serverObjects(); | ||
boolean overview = (post == null) || (((String) post.get("page", "0")).equals("0")); | ||
|
||
if (overview) { | ||
// show overview | ||
prop.put("table", 0); | ||
prop.put("page", 0); | ||
} else { | ||
// generate table | ||
int tableID = Integer.parseInt((String) post.get("page", "1")) - 1; | ||
prop.put("table", 1); | ||
prop.put("page", tableID + 1); | ||
|
||
if (yacyCore.seedDB == null) { | ||
|
||
} else { | ||
int maxCount = yacyCore.newsPool.size(tableID); | ||
if (maxCount > 500) maxCount = 500; | ||
|
||
yacyNewsRecord record; | ||
for (int i = 0; i < maxCount; i++) try { | ||
record = yacyCore.newsPool.get(tableID, i); | ||
prop.put("table_list_" + i + "_ori", record.originator()); | ||
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()); | ||
} catch (IOException e) {e.printStackTrace();} | ||
prop.put("table_list", maxCount); | ||
} | ||
} | ||
// return rewrite properties | ||
return prop; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// yacyNewsAction.java | ||
// ----------------------- | ||
// part of YaCy | ||
// (C) by Michael Peter Christen; mc@anomic.de | ||
// first published on http://www.anomic.de | ||
// Frankfurt, Germany, 2005 | ||
// last major change: 29.07.2005 | ||
// | ||
// This program is free software; you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation; either version 2 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program; if not, write to the Free Software | ||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
// | ||
// Using this software in any meaning (reading, learning, copying, compiling, | ||
// running) means that you agree that the Author(s) is (are) not responsible | ||
// for cost, loss of data or any harm that may be caused directly or indirectly | ||
// by usage of this softare or this documentation. The usage of this software | ||
// is on your own risk. The installation and usage (starting/running) of this | ||
// software may allow other people or application to access your computer and | ||
// any attached devices and is highly dependent on the configuration of the | ||
// software which must be done by the user of the software; the author(s) is | ||
// (are) also not responsible for proper configuration and usage of the | ||
// software, even if provoked by documentation provided together with | ||
// the software. | ||
// | ||
// Any changes to this file according to the GPL as documented in the file | ||
// gpl.txt aside this file in the shipment you received can be done to the | ||
// lines that follows this copyright notice here, but changes must not be | ||
// done inside the copyright notice above. A re-distribution must contain | ||
// the intact and unchanged copyright notice. | ||
// Contributions and changes to the program code must be marked as such. | ||
|
||
package de.anomic.yacy; | ||
|
||
import java.io.IOException; | ||
|
||
public class yacyNewsAction implements yacyPeerAction { | ||
|
||
yacyNewsPool pool; | ||
|
||
public yacyNewsAction(yacyNewsPool pool) { | ||
this.pool = pool; | ||
} | ||
|
||
public void processPeerArrival(yacySeed peer, boolean direct) { | ||
String recordString = peer.get("news", null); | ||
if (recordString == null) return; | ||
yacyNewsRecord record = new yacyNewsRecord(de.anomic.tools.crypt.simpleDecode(recordString, "")); | ||
try { | ||
this.pool.enqueueGlobalNews(record); | ||
} catch (IOException e) {e.printStackTrace();} | ||
} | ||
|
||
public void processPeerDeparture(yacySeed peer) { | ||
} | ||
|
||
public void processPeerPing(yacySeed peer) { | ||
processPeerArrival(peer, true); | ||
} | ||
|
||
} |
Oops, something went wrong.