From facfd204e9ca5b92a1b43c5a0be9b331b2b27cef Mon Sep 17 00:00:00 2001 From: orbiter Date: Mon, 25 Oct 2010 22:16:07 +0000 Subject: [PATCH] added a parent configuration option. see /ConfigPortal.html requested here: http://forum.yacy-websuche.de/viewtopic.php?p=21099#p21099 git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7271 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- defaults/yacy.init | 6 ++++++ htroot/ConfigPortal.html | 12 ++++++++++++ htroot/ConfigPortal.java | 9 +++++++++ htroot/index.java | 2 +- htroot/yacysearch.java | 2 +- htroot/yacysearchitem.html | 4 ++-- htroot/yacysearchitem.java | 2 ++ source/de/anomic/search/SwitchboardConstants.java | 5 +++-- 8 files changed, 36 insertions(+), 6 deletions(-) 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 @@ Interactive Search Page  +
Target for Click on Search Results
+
+ +
+ +
   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 @@

- #[title]#

+ #[title]#
#(heuristic)#:: heuristic:#[name]# (redundant):: @@ -20,7 +20,7 @@ #(/authorized)#

#[description]#

-

#[urlname]#

+

#[urlname]#

#[date]# | #[sizename]# | Metadata | Parser | Pictures

:: 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