diff --git a/htroot/Blacklist_p.java b/htroot/Blacklist_p.java
index e9f73a00d..0e1718e49 100644
--- a/htroot/Blacklist_p.java
+++ b/htroot/Blacklist_p.java
@@ -250,8 +250,12 @@ public class Blacklist_p {
* =========================================================== */
blacklistToUse = post.get("currentBlacklist", "").trim();
-
- final String temp = addBlacklistEntry(blacklistToUse, post.get("newEntry", "").trim(), header, supportedBlacklistTypes);
+ String blentry = post.get("newEntry", "").trim();
+
+ // store this call as api call
+ listManager.switchboard.recordAPICall(post, "Blacklist_p.html", "blacklist", "add to blacklist: " + blentry);
+
+ final String temp = addBlacklistEntry(blacklistToUse, blentry, header, supportedBlacklistTypes);
if (temp != null) {
prop.put("LOCATION", temp);
return prop;
diff --git a/htroot/ConfigBasic.java b/htroot/ConfigBasic.java
index 95714bf51..054247c0d 100644
--- a/htroot/ConfigBasic.java
+++ b/htroot/ConfigBasic.java
@@ -70,7 +70,10 @@ public class ConfigBasic {
return prop;
}
- // starting a peer ping
+ // store this call as api call
+ if (post != null && post.containsKey("set")) {
+ sb.recordAPICall(post, "ConfigBasic.html", "configuration", "basic settings");
+ }
//boolean doPeerPing = false;
if ((sb.peers.mySeed().isVirgin()) || (sb.peers.mySeed().isJunior())) {
diff --git a/htroot/ConfigLanguage_p.java b/htroot/ConfigLanguage_p.java
index efcedf281..277897012 100644
--- a/htroot/ConfigLanguage_p.java
+++ b/htroot/ConfigLanguage_p.java
@@ -46,6 +46,7 @@ import de.anomic.data.translator;
import de.anomic.http.client.Client;
import de.anomic.http.server.HeaderFramework;
import de.anomic.http.server.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import java.util.Collections;
@@ -72,6 +73,9 @@ public class ConfigLanguage_p {
if (post != null){
String selectedLanguage = post.get("language");
+ // store this call as api call
+ ((Switchboard) env).recordAPICall(post, "ConfigLanguage.html", "configuration", "language settings: " + selectedLanguage);
+
//change language
if(post.containsKey("use_button") && selectedLanguage != null){
/* Only change language if filename is contained in list of filesnames
diff --git a/htroot/ConfigNetwork_p.java b/htroot/ConfigNetwork_p.java
index d7c4ab758..ef0d1c2c2 100644
--- a/htroot/ConfigNetwork_p.java
+++ b/htroot/ConfigNetwork_p.java
@@ -54,6 +54,9 @@ public class ConfigNetwork_p {
if (post != null) {
+ // store this call as api call
+ sb.recordAPICall(post, "ConfigNetwork.html", "configuration", "network settings");
+
if (post.containsKey("changeNetwork")) {
final String networkDefinition = post.get("networkDefinition", "defaults/yacy.network.freeworld.unit");
if (networkDefinition.equals(sb.getConfig("network.unit.definition", ""))) {
diff --git a/htroot/ConfigPortal.java b/htroot/ConfigPortal.java
index f57872082..4206419fd 100644
--- a/htroot/ConfigPortal.java
+++ b/htroot/ConfigPortal.java
@@ -57,7 +57,11 @@ public class ConfigPortal {
}
}
if (post.containsKey("searchpage_set")) {
- sb.setConfig(SwitchboardConstants.GREETING, post.get(SwitchboardConstants.GREETING, ""));
+ String newGreeting = post.get(SwitchboardConstants.GREETING, "");
+ // store this call as api call
+ sb.recordAPICall(post, "ConfigPortal.html", "appearance", "new portal design. greeting: " + newGreeting);
+
+ sb.setConfig(SwitchboardConstants.GREETING, newGreeting);
sb.setConfig(SwitchboardConstants.GREETING_HOMEPAGE, post.get(SwitchboardConstants.GREETING_HOMEPAGE, ""));
sb.setConfig(SwitchboardConstants.GREETING_LARGE_IMAGE, post.get(SwitchboardConstants.GREETING_LARGE_IMAGE, ""));
sb.setConfig(SwitchboardConstants.GREETING_SMALL_IMAGE, post.get(SwitchboardConstants.GREETING_SMALL_IMAGE, ""));
diff --git a/htroot/Crawler_p.java b/htroot/Crawler_p.java
index 070150d54..4dadbc9c4 100644
--- a/htroot/Crawler_p.java
+++ b/htroot/Crawler_p.java
@@ -130,16 +130,8 @@ public class Crawler_p {
if (sb.peers == null) {
prop.put("info", "3");
} else {
- // log a GET url for this crawl start for possible use in cronjobs
- Log.logInfo("CRAWLSTART-URL", "http://localhost:" + sb.getConfig("port", "8080") + "/Crawler_p.html?" + post.toString());
-
- // set new properties
- final boolean fullDomain = post.get("range", "wide").equals("domain"); // special property in simple crawl start
- final boolean subPath = post.get("range", "wide").equals("subpath"); // special property in simple crawl start
-
String crawlingStart = post.get("crawlingURL","").trim(); // the crawljob start url
-
- // adding the prefix http:// if necessary
+ // add the prefix http:// if necessary
int pos = crawlingStart.indexOf("://");
if (pos == -1) crawlingStart = "http://" + crawlingStart;
@@ -147,6 +139,14 @@ public class Crawler_p {
DigestURI crawlingStartURL = null;
try {crawlingStartURL = new DigestURI(crawlingStart, null);} catch (final MalformedURLException e1) {}
crawlingStart = (crawlingStartURL == null) ? null : crawlingStartURL.toNormalform(true, true);
+
+ // store this call as api call
+ sb.recordAPICall(post, "Crawler_p.html", "crawler", "crawl start for " + crawlingStartURL.getHost());
+
+ // set new properties
+ final boolean fullDomain = post.get("range", "wide").equals("domain"); // special property in simple crawl start
+ final boolean subPath = post.get("range", "wide").equals("subpath"); // special property in simple crawl start
+
// set the crawling filter
String newcrawlingMustMatch = post.get("mustmatch", CrawlProfile.MATCH_ALL);
diff --git a/htroot/Settings_p.html b/htroot/Settings_p.html
index a10298134..6b29782f4 100644
--- a/htroot/Settings_p.html
+++ b/htroot/Settings_p.html
@@ -18,6 +18,11 @@
Performance Settings for Memory
Performance Settings of Search Sequence
+
+ #(showtable)#::
+
+ #(/showtable)#
+ #(showedit)#::
+
+ #(/showedit)#
+ #%env/templates/footer.template%#
+
+
diff --git a/htroot/Tables_p.java b/htroot/Tables_p.java
new file mode 100644
index 000000000..a2bb6e489
--- /dev/null
+++ b/htroot/Tables_p.java
@@ -0,0 +1,194 @@
+// News.java
+// -----------------------
+// part of YaCy
+// (C) by Michael Peter Christen; mc@yacy.net
+// 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
+
+// You must compile this file with
+// javac -classpath .:../classes Network.java
+// if the shell's current path is HTROOT
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import net.yacy.kelondro.index.RowSpaceExceededException;
+import net.yacy.kelondro.logging.Log;
+
+import de.anomic.http.server.RequestHeader;
+import de.anomic.search.Switchboard;
+import de.anomic.server.serverObjects;
+import de.anomic.server.serverSwitch;
+
+public class Tables_p {
+
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
+ final serverObjects prop = new serverObjects();
+ String table = (post == null) ? null : post.get("table", null);
+ if (table != null && !sb.tables.hasHeap(table)) table = null;
+
+ // show table selection
+ int count = 0;
+ Iterator ti = sb.tables.tables();
+ String tablename;
+ while (ti.hasNext()) {
+ tablename = ti.next();
+ prop.put("tables_" + count + "_name", tablename);
+ prop.put("tables_" + count + "_selected", (table != null && table.equals(tablename)) ? 1 : 0);
+ count++;
+ }
+ prop.put("tables", count);
+
+ List columns = null;
+ if (table != null) try {
+ columns = sb.tables.columns(table);
+ } catch (IOException e) {
+ Log.logException(e);
+ }
+
+ // apply deletion requests
+ if (post != null && post.get("deletetable", "").length() > 0) {
+ try {
+ sb.tables.clear(table);
+ } catch (IOException e) {
+ Log.logException(e);
+ }
+ }
+
+ if (post != null && post.get("deleterows", "").length() > 0) {
+ try {
+ for (Map.Entry entry: post.entrySet()) {
+ if (entry.getKey().startsWith("mark_") && entry.getValue().equals("on")) {
+ sb.tables.delete(table, entry.getKey().substring(5).getBytes());
+ }
+ }
+ } catch (IOException e) {
+ Log.logException(e);
+ }
+ }
+
+ if (post != null && post.get("commitrow", "").length() > 0) {
+ String pk = post.get("pk");
+ Map map = new HashMap();
+ for (Map.Entry entry: post.entrySet()) {
+ if (entry.getKey().startsWith("col_")) {
+ map.put(entry.getKey().substring(4), entry.getValue().getBytes());
+ }
+ }
+ try {
+ sb.tables.insert(table, pk.getBytes(), map);
+ } catch (IOException e) {
+ Log.logException(e);
+ } catch (RowSpaceExceededException e) {
+ Log.logException(e);
+ }
+ }
+
+ // generate table
+ prop.put("showtable", 0);
+ prop.put("showedit", 0);
+
+ if (table != null && !post.containsKey("editrow") && !post.containsKey("addrow")) try {
+ prop.put("showtable", 1);
+ prop.put("showtable_table", table);
+
+ // insert the columns
+
+ for (int i = 0; i < columns.size(); i++) {
+ prop.putHTML("showtable_columns_" + i + "_header", columns.get(i));
+ }
+ prop.put("showtable_columns", columns.size());
+
+ // insert all rows
+ final int maxCount = Math.min(1000, sb.tables.size(table));
+ final Iterator>> mapIterator = sb.tables.iterator(table);
+ Map.Entry> record;
+ Map map;
+ byte[] pk;
+ count = 0;
+ boolean dark = true;
+ byte[] cell;
+ while ((mapIterator.hasNext()) && (count < maxCount)) {
+ record = mapIterator.next();
+ if (record == null) continue;
+ pk = record.getKey();
+ map = record.getValue();
+ prop.put("showtable_list_" + count + "_dark", ((dark) ? 1 : 0) ); dark=!dark;
+ prop.put("showtable_list_" + count + "_pk", new String(pk));
+ for (int i = 0; i < columns.size(); i++) {
+ cell = map.get(columns.get(i));
+ prop.putHTML("showtable_list_" + count + "_columns_" + i + "_cell", cell == null ? "" : new String(cell));
+ }
+ prop.put("showtable_list_" + count + "_columns", columns.size());
+
+ count++;
+ }
+ prop.put("showtable_list", count);
+ } catch (IOException e) {}
+
+ if (post != null && table != null && post.containsKey("editrow")) try {
+ // check if we can find a key
+ String pk = null;
+ for (Map.Entry entry: post.entrySet()) {
+ if (entry.getKey().startsWith("mark_") && entry.getValue().equals("on")) {
+ pk = entry.getKey().substring(5);
+ break;
+ }
+ }
+ if (pk != null && sb.tables.has(table, pk.getBytes())) {
+ setEdit(sb, prop, table, pk, columns);
+ }
+ } catch (IOException e) {}
+
+ if (post != null && table != null && post.containsKey("addrow")) try {
+ // get a new key
+ String pk = new String(sb.tables.insert(table, new HashMap()));
+ setEdit(sb, prop, table, pk, columns);
+ } catch (IOException e) {
+ Log.logException(e);
+ } catch (RowSpaceExceededException e) {
+ Log.logException(e);
+ }
+
+ // adding the peer address
+ prop.put("address", sb.peers.mySeed().getPublicAddress());
+
+ // return rewrite properties
+ return prop;
+ }
+
+ private static void setEdit(final Switchboard sb, final serverObjects prop, final String table, final String pk, List columns) throws IOException {
+ prop.put("showedit", 1);
+ prop.put("showedit_table", table);
+ prop.put("showedit_pk", pk);
+ Map map = sb.tables.select(table, pk.getBytes());
+ int count = 0;
+ byte[] cell;
+ for (String col: columns) {
+ cell = map.get(col);
+ prop.put("showedit_list_" + count + "_key", col);
+ prop.put("showedit_list_" + count + "_value", cell == null ? "" : new String(cell));
+ count++;
+ }
+ prop.put("showedit_list", count);
+ }
+}
diff --git a/htroot/env/templates/header.template b/htroot/env/templates/header.template
index b0eee8b56..6564c8869 100644
--- a/htroot/env/templates/header.template
+++ b/htroot/env/templates/header.template
@@ -82,8 +82,6 @@
-
-