Skip to content

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

added a parent configuration option. see /ConfigPortal.html requested here: http://forum.yacy-websuche.de/viewtopic.php?p=21099#p21099

orbiterfacfd204e9ca
diff --git a/defaults/yacy.init b/defaults/yacy.init
index 0b9f4c685..b98149938 100644
--- a/defaults/yacy.init
+++ b/defaults/yacy.init
@@ -704,6 +704,12 @@ search.app = true
# number of search results displayed by default
search.items = 10
+# target for search results; this is the href target attribute inside every search result link
+# possible values:
+# "_blank" (new window), "_self" (same window), "_parent" (the parent frame of a frameset),
+# "_top" (top of all frames), "searchresult" (a default custom page name for search results)
+search.target = _self
+
# specifies if yacy should set it's own referer if no referer URL
# was set by the client.
useYacyReferer = false
diff --git a/htroot/ConfigPortal.html b/htroot/ConfigPortal.html
index 976fd78ac..4f73f8e42 100644
--- a/htroot/ConfigPortal.html
+++ b/htroot/ConfigPortal.html
@@ -38,6 +38,18 @@
<input type="radio" name="popup" value="interactive" #(popupInteractive)#::checked="checked"#(/popupInteractive)# />Interactive Search Page&nbsp;
</dd>
+ <dt>Target for Click on Search Results</dt>
+ <dd>
+ <select name="target">
+ <option value="_blank" #(selected_blank)#::selected="selected"#(/selected_blank)#>"_blank" (new window)</option>
+ <option value="_self" #(selected_self)#::selected="selected"#(/selected_self)#>"_self" (same window)</option>
+ <option value="_parent" #(selected_parent)#::selected="selected"#(/selected_parent)#>"_parent" (the parent frame of a frameset)</option>
+ <option value="_top" #(selected_top)#::selected="selected"#(/selected_top)#>"_top" (top of all frames)</option>
+ <option value="searchresult" #(selected_searchresult)#::selected="selected"#(/selected_searchresult)#>"searchresult" (a default custom page name for search results)</option>
+ </select>
+ </dd>
+
+ <dt></dt>
<dd>
<input type="submit" name="searchpage_set" value="Change Search Page" />&nbsp;&nbsp;
<input type="submit" name="searchpage_default" value="Set to Default Values" />
diff --git a/htroot/ConfigPortal.java b/htroot/ConfigPortal.java
index 95f6c82fe..524fc7628 100644
--- a/htroot/ConfigPortal.java
+++ b/htroot/ConfigPortal.java
@@ -66,6 +66,7 @@ public class ConfigPortal {
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, ""));
+ sb.setConfig(SwitchboardConstants.SEARCH_TARGET, post.get("target", "_self"));
}
if (post.containsKey("searchpage_default")) {
sb.setConfig(SwitchboardConstants.GREETING, "P2P Web Search");
@@ -73,6 +74,7 @@ public class ConfigPortal {
sb.setConfig(SwitchboardConstants.GREETING_LARGE_IMAGE, "/env/grafics/YaCyLogo_120ppi.png");
sb.setConfig(SwitchboardConstants.GREETING_SMALL_IMAGE, "/env/grafics/YaCyLogo_60ppi.png");
sb.setConfig(SwitchboardConstants.BROWSER_POP_UP_PAGE, "Status.html");
+ sb.setConfig(SwitchboardConstants.SEARCH_TARGET, "_self");
}
}
@@ -95,6 +97,13 @@ public class ConfigPortal {
} else {
prop.put("popupStatus", 1);
}
+ String target = sb.getConfig(SwitchboardConstants.SEARCH_TARGET, "_self");
+ prop.put("selected_blank", target.equals("_blank") ? 1 : 0);
+ prop.put("selected_self", target.equals("_self") ? 1 : 0);
+ prop.put("selected_parent", target.equals("_parent") ? 1 : 0);
+ prop.put("selected_top", target.equals("_top") ? 1 : 0);
+ prop.put("selected_searchresult", target.equals("searchresult") ? 1 : 0);
+
String myaddress = sb.peers.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 ea4341598..fd4510d0d 100644
--- a/htroot/index.java
+++ b/htroot/index.java
@@ -67,7 +67,7 @@ public class index {
final int searchoptions = (post == null) ? 0 : post.getInt("searchoptions", 0);
final String former = (post == null) ? "" : post.get("former", "");
final int count = Math.min(100, (post == null) ? 10 : post.getInt("count", 10));
- final int maximumRecords = Integer.parseInt((sb.getConfig(SwitchboardConstants.DEFAULT_SEARCHITEMS, "10")));
+ final int maximumRecords = Integer.parseInt((sb.getConfig(SwitchboardConstants.SEARCH_ITEMS, "10")));
final String urlmaskfilter = (post == null) ? ".*" : post.get("urlmaskfilter", ".*");
final String prefermaskfilter = (post == null) ? "" : post.get("prefermaskfilter", "");
final String constraint = (post == null) ? "" : post.get("constraint", "");
diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java
index b3b1aa17d..9b952bba4 100644
--- a/htroot/yacysearch.java
+++ b/htroot/yacysearch.java
@@ -170,7 +170,7 @@ public class yacysearch {
int offset = (newsearch) ? 0 : post.getInt("startRecord", post.getInt("offset", 0));
int newcount;
- if ( authenticated && (newcount = post.getInt("count", 0)) > 0 ) sb.setConfig(SwitchboardConstants.DEFAULT_SEARCHITEMS, newcount); // set new default maximumRecords if search with "more options"
+ if ( authenticated && (newcount = post.getInt("count", 0)) > 0 ) sb.setConfig(SwitchboardConstants.SEARCH_ITEMS, newcount); // set new default maximumRecords if search with "more options"
boolean global = post.get("resource", "local").equals("global") && sb.peers.sizeConnected() > 0;
final boolean indexof = (post != null && post.get("indexof","").equals("on"));
diff --git a/htroot/yacysearchitem.html b/htroot/yacysearchitem.html
index 8dab3d17d..5ca571ff2 100644
--- a/htroot/yacysearchitem.html
+++ b/htroot/yacysearchitem.html
@@ -2,7 +2,7 @@
<div class="searchresults">
<h4 class="linktitle">
<img width="16" height="16" src="ViewImage.png?width=16&amp;height=16&amp;code=#[faviconCode]#" id="f#[urlhash]#" class="favicon" style="width:16px; height:16px;" alt="" />
- <a href="#[link]#">#[title]#</a></h4>
+ <a href="#[link]#" target="#[target]#">#[title]#</a></h4>
<div class="urlactions">
#(heuristic)#::
<img width="16" height="9" src="/env/grafics/heuristic_redundant.gif" title="heuristic:#[name]# (redundant)" style="width:16px; height:9px;" alt="heuristic:#[name]# (redundant)"/>::
@@ -20,7 +20,7 @@
#(/authorized)#
</div>
<p class="snippet"><span class="snippetLoaded" id="h#[urlhash]#">#[description]#</span></p>
- <p class="url"><a href="#[link]#" id="url#[urlhash]#">#[urlname]#</a></p>
+ <p class="url"><a href="#[link]#" id="url#[urlhash]#" target="#[target]#">#[urlname]#</a></p>
<p class="urlinfo">#[date]# | #[sizename]# | <a href="api/yacydoc.html?urlhash=#[urlhash]#" onclick="return hs.htmlExpand(this, { objectType: 'ajax'} )">Metadata</a> | <a href="ViewFile.html?urlHash=#[urlhash]#&amp;words=#[words]#&amp;display=#[display]#">Parser</a> | <a href="yacysearch.html?cat=image&amp;url=#[link]#&amp;query=#[former]#&amp;display=#[display]#">Pictures</a></p>
</div>
::
diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.java
index a346bab02..87c883760 100644
--- a/htroot/yacysearchitem.java
+++ b/htroot/yacysearchitem.java
@@ -43,6 +43,7 @@ import de.anomic.search.SearchEvent;
import de.anomic.search.ResultEntry;
import de.anomic.search.SearchEventCache;
import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.search.TextSnippet;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@@ -125,6 +126,7 @@ public class yacysearchitem {
prop.putXML("content_title-xml", result.title());
prop.putJSON("content_title-json", result.title());
prop.putHTML("content_link", result.urlstring());
+ prop.putHTML("content_target", sb.getConfig(SwitchboardConstants.SEARCH_TARGET, "_self"));
prop.put("content_display", display);
if (faviconURL != null && isHtml) sb.loader.loadIfNotExistBackground(faviconURL.toNormalform(true, false), 1024 * 1024 * 10);
prop.putHTML("content_faviconCode", sb.licensedURLs.aquireLicense(faviconURL)); // acquire license for favicon url loading
diff --git a/source/de/anomic/search/SwitchboardConstants.java b/source/de/anomic/search/SwitchboardConstants.java
index 018324266..b383198c8 100644
--- a/source/de/anomic/search/SwitchboardConstants.java
+++ b/source/de/anomic/search/SwitchboardConstants.java
@@ -426,8 +426,9 @@ public final class SwitchboardConstants {
public static final String UPNP_ENABLED = "upnp.enabled";
public static final String UPNP_REMOTEHOST = "upnp.remoteHost";
-
- public static final String DEFAULT_SEARCHITEMS = "search.items";
+
+ public static final String SEARCH_ITEMS = "search.items";
+ public static final String SEARCH_TARGET = "search.target";
/**
* system tray