Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

removed default line 'P2P WEB SEARCH' if no line is given

orbiteref82cced0110
diff --git a/htroot/ConfigAppearance_p.java b/htroot/ConfigAppearance_p.java
index 2c5efcd0d..b82245c3a 100644
--- a/htroot/ConfigAppearance_p.java
+++ b/htroot/ConfigAppearance_p.java
@@ -40,6 +40,7 @@ import de.anomic.http.HttpClient;
import de.anomic.http.httpRequestHeader;
import de.anomic.kelondro.util.FileUtils;
import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.plasma.plasmaSwitchboardConstants;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyURL;
@@ -115,16 +116,16 @@ public class ConfigAppearance_p {
}
}
if (post.containsKey("searchpage_set")) {
- sb.setConfig("promoteSearchPageGreeting", post.get("promoteSearchPageGreeting", ""));
- sb.setConfig("promoteSearchPageGreeting.homepage", post.get("promoteSearchPageGreeting.homepage", ""));
- sb.setConfig("promoteSearchPageGreeting.largeImage", post.get("promoteSearchPageGreeting.largeImage", ""));
- sb.setConfig("promoteSearchPageGreeting.smallImage", post.get("promoteSearchPageGreeting.smallImage", ""));
+ sb.setConfig(plasmaSwitchboardConstants.GREETING, post.get(plasmaSwitchboardConstants.GREETING, ""));
+ sb.setConfig(plasmaSwitchboardConstants.GREETING_HOMEPAGE, post.get(plasmaSwitchboardConstants.GREETING_HOMEPAGE, ""));
+ sb.setConfig(plasmaSwitchboardConstants.GREETING_LARGE_IMAGE, post.get(plasmaSwitchboardConstants.GREETING_LARGE_IMAGE, ""));
+ sb.setConfig(plasmaSwitchboardConstants.GREETING_SMALL_IMAGE, post.get(plasmaSwitchboardConstants.GREETING_SMALL_IMAGE, ""));
}
if (post.containsKey("searchpage_default")) {
- sb.setConfig("promoteSearchPageGreeting", "P2P Web Search");
- sb.setConfig("promoteSearchPageGreeting.homepage", "http://yacy.net");
- sb.setConfig("promoteSearchPageGreeting.largeImage", "/env/grafics/YaCyLogo_120ppi.png");
- sb.setConfig("promoteSearchPageGreeting.smallImage", "/env/grafics/YaCyLogo_60ppi.png");
+ sb.setConfig(plasmaSwitchboardConstants.GREETING, "P2P Web Search");
+ sb.setConfig(plasmaSwitchboardConstants.GREETING_HOMEPAGE, "http://yacy.net");
+ sb.setConfig(plasmaSwitchboardConstants.GREETING_LARGE_IMAGE, "/env/grafics/YaCyLogo_120ppi.png");
+ sb.setConfig(plasmaSwitchboardConstants.GREETING_SMALL_IMAGE, "/env/grafics/YaCyLogo_60ppi.png");
}
}
@@ -143,10 +144,10 @@ public class ConfigAppearance_p {
prop.putHTML("currentskin", env.getConfig("currentSkin", "default"));
- prop.putHTML("promoteSearchPageGreeting", sb.getConfig("promoteSearchPageGreeting", ""));
- prop.putHTML("promoteSearchPageGreeting.homepage", sb.getConfig("promoteSearchPageGreeting.homepage", ""));
- prop.putHTML("promoteSearchPageGreeting.largeImage", sb.getConfig("promoteSearchPageGreeting.largeImage", ""));
- prop.putHTML("promoteSearchPageGreeting.smallImage", sb.getConfig("promoteSearchPageGreeting.smallImage", ""));
+ prop.putHTML(plasmaSwitchboardConstants.GREETING, sb.getConfig(plasmaSwitchboardConstants.GREETING, ""));
+ prop.putHTML(plasmaSwitchboardConstants.GREETING_HOMEPAGE, sb.getConfig(plasmaSwitchboardConstants.GREETING_HOMEPAGE, ""));
+ prop.putHTML(plasmaSwitchboardConstants.GREETING_LARGE_IMAGE, sb.getConfig(plasmaSwitchboardConstants.GREETING_LARGE_IMAGE, ""));
+ prop.putHTML(plasmaSwitchboardConstants.GREETING_SMALL_IMAGE, sb.getConfig(plasmaSwitchboardConstants.GREETING_SMALL_IMAGE, ""));
String myaddress = sb.webIndex.seedDB.mySeed().getPublicAddress();
if (myaddress == null) myaddress = "localhost:" + sb.getConfig("port", "8080");
prop.put("myaddress", myaddress);
diff --git a/htroot/index.java b/htroot/index.java
index 141bd1c1f..0b8939961 100644
--- a/htroot/index.java
+++ b/htroot/index.java
@@ -81,12 +81,11 @@ public class index {
if (cds.equals("app")) contentdom = plasmaSearchQuery.CONTENTDOM_APP;
// we create empty entries for template strings
- String promoteSearchPageGreeting = env.getConfig("promoteSearchPageGreeting", "");
- if (env.getConfigBool("promoteSearchPageGreeting.useNetworkName", false)) promoteSearchPageGreeting = env.getConfig("network.unit.description", "");
- if (promoteSearchPageGreeting.length() == 0) promoteSearchPageGreeting = "P2P Web Search";
- prop.putHTML("promoteSearchPageGreeting", promoteSearchPageGreeting);
- prop.put("promoteSearchPageGreeting.homepage", sb.getConfig("promoteSearchPageGreeting.homepage", ""));
- prop.put("promoteSearchPageGreeting.largeImage", sb.getConfig("promoteSearchPageGreeting.largeImage", ""));
+ String promoteSearchPageGreeting = env.getConfig(plasmaSwitchboardConstants.GREETING, "");
+ if (env.getConfigBool(plasmaSwitchboardConstants.GREETING_NETWORK_NAME, false)) promoteSearchPageGreeting = env.getConfig("network.unit.description", "");
+ prop.putHTML(plasmaSwitchboardConstants.GREETING, promoteSearchPageGreeting);
+ prop.put(plasmaSwitchboardConstants.GREETING_HOMEPAGE, sb.getConfig(plasmaSwitchboardConstants.GREETING_HOMEPAGE, ""));
+ prop.put(plasmaSwitchboardConstants.GREETING_LARGE_IMAGE, sb.getConfig(plasmaSwitchboardConstants.GREETING_LARGE_IMAGE, ""));
prop.putHTML("former", former);
prop.put("num-results", "0");
prop.put("excluded", "0");
diff --git a/htroot/opensearchdescription.java b/htroot/opensearchdescription.java
index 1e10aa58a..65f2da862 100644
--- a/htroot/opensearchdescription.java
+++ b/htroot/opensearchdescription.java
@@ -26,6 +26,7 @@
import de.anomic.http.httpRequestHeader;
import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.plasma.plasmaSwitchboardConstants;
import de.anomic.server.serverCore;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@@ -35,10 +36,9 @@ public class opensearchdescription {
public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch<?> env) {
final plasmaSwitchboard sb = (plasmaSwitchboard) env;
// generate message content for open search description
- String promoteSearchPageGreeting = env.getConfig("promoteSearchPageGreeting", "");
- if (env.getConfigBool("promoteSearchPageGreeting.useNetworkName", false)) promoteSearchPageGreeting = env.getConfig("network.unit.description", "");
- if (promoteSearchPageGreeting.length() == 0) promoteSearchPageGreeting = "P2P WEB SEARCH";
-
+ String promoteSearchPageGreeting = env.getConfig(plasmaSwitchboardConstants.GREETING, "");
+ if (env.getConfigBool(plasmaSwitchboardConstants.GREETING_NETWORK_NAME, false)) promoteSearchPageGreeting = env.getConfig("network.unit.description", "");
+
String thisaddress = (String) header.get("Host", "localhost");
if (thisaddress.indexOf(":") == -1) thisaddress += ":" + serverCore.getPortNr(env.getConfig("port", "8080"));
diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java
index 2e6e0a7ea..c1abbb809 100644
--- a/htroot/yacysearch.java
+++ b/htroot/yacysearch.java
@@ -71,9 +71,8 @@ public class yacysearch {
int display = (post == null) ? 0 : post.getInt("display", 0);
if ((display == 1) && (!authenticated)) display = 0;
final int input = (post == null) ? 2 : post.getInt("input", 2);
- String promoteSearchPageGreeting = env.getConfig("promoteSearchPageGreeting", "");
- if (env.getConfigBool("promoteSearchPageGreeting.useNetworkName", false)) promoteSearchPageGreeting = env.getConfig("network.unit.description", "");
- if (promoteSearchPageGreeting.length() == 0) promoteSearchPageGreeting = "P2P Web Search";
+ String promoteSearchPageGreeting = env.getConfig(plasmaSwitchboardConstants.GREETING, "");
+ if (env.getConfigBool(plasmaSwitchboardConstants.GREETING_NETWORK_NAME, false)) promoteSearchPageGreeting = env.getConfig("network.unit.description", "");
final String client = header.get(httpRequestHeader.CONNECTION_PROP_CLIENTIP); // the search client who initiated the search
// get query
@@ -83,8 +82,8 @@ public class yacysearch {
//final boolean rss = (post == null) ? false : post.get("rss", "false").equals("true");
prop.put("input_promoteSearchPageGreeting", promoteSearchPageGreeting);
- prop.put("input_promoteSearchPageGreeting.homepage", sb.getConfig("promoteSearchPageGreeting.homepage", ""));
- prop.put("input_promoteSearchPageGreeting.smallImage", sb.getConfig("promoteSearchPageGreeting.smallImage", ""));
+ prop.put("input_promoteSearchPageGreeting.homepage", sb.getConfig(plasmaSwitchboardConstants.GREETING_HOMEPAGE, ""));
+ prop.put("input_promoteSearchPageGreeting.smallImage", sb.getConfig(plasmaSwitchboardConstants.GREETING_SMALL_IMAGE, ""));
if ((post == null) || (env == null) || (querystring.length() == 0) || (!searchAllowed)) {
// we create empty entries for template strings
prop.put("searchagain", "0");
diff --git a/source/de/anomic/plasma/plasmaSwitchboardConstants.java b/source/de/anomic/plasma/plasmaSwitchboardConstants.java
index e9eeab8a9..f1ecabbde 100644
--- a/source/de/anomic/plasma/plasmaSwitchboardConstants.java
+++ b/source/de/anomic/plasma/plasmaSwitchboardConstants.java
@@ -525,4 +525,13 @@ public final class plasmaSwitchboardConstants {
public static final String NETWORK_WHITELIST = "network.unit.access.whitelist";
public static final String NETWORK_BLACKLIST = "network.unit.access.blacklist";
+ /**
+ * appearance
+ */
+ public static final String GREETING = "promoteSearchPageGreeting";
+ public static final String GREETING_NETWORK_NAME = "promoteSearchPageGreeting.useNetworkName";
+ public static final String GREETING_HOMEPAGE = "promoteSearchPageGreeting.homepage";
+ public static final String GREETING_LARGE_IMAGE = "promoteSearchPageGreeting.largeImage";
+ public static final String GREETING_SMALL_IMAGE = "promoteSearchPageGreeting.smallImage";
+
}