Merge branch 'master' of ssh://git@gitorious.org/yacy/rc1.git

pull/1/head
Michael Peter Christen 13 years ago
commit 2f6dde92e2

@ -734,7 +734,10 @@ search.items = 10
# possible values: # possible values:
# "_blank" (new window), "_self" (same window), "_parent" (the parent frame of a frameset), # "_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) # "_top" (top of all frames), "searchresult" (a default custom page name for search results)
# a special pattern can be given for exceptions to the default target according to urls
search.target = _self search.target = _self
search.target.special = _self
search.target.special.pattern =
# search result lines may show additional information for each search hit # search result lines may show additional information for each search hit
# these information pieces may be switched on or off # these information pieces may be switched on or off

@ -101,14 +101,26 @@
<dt>Target for Click on Search Results</dt> <dt>Target for Click on Search Results</dt>
<dd> <dd>
<select name="target"> <select name="target">
<option value="_blank" #(selected_blank)#::selected="selected"#(/selected_blank)#>"_blank" (new window)</option> <option value="_blank" #(target_selected_blank)#::selected="selected"#(/target_selected_blank)#>"_blank" (new window)</option>
<option value="_self" #(selected_self)#::selected="selected"#(/selected_self)#>"_self" (same window)</option> <option value="_self" #(target_selected_self)#::selected="selected"#(/target_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="_parent" #(target_selected_parent)#::selected="selected"#(/target_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="_top" #(target_selected_top)#::selected="selected"#(/target_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> <option value="searchresult" #(target_selected_searchresult)#::selected="selected"#(/target_selected_searchresult)#>"searchresult" (a default custom page name for search results)</option>
</select> </select>
</dd> </dd>
<dt>Special Target as Exception for an URL-Pattern</dt>
<dd>
<select name="target_special">
<option value="_blank" #(target_selected_special_blank)#::selected="selected"#(/target_selected_special_blank)#>"_blank" (new window)</option>
<option value="_self" #(target_selected_special_self)#::selected="selected"#(/target_selected_special_self)#>"_self" (same window)</option>
<option value="_parent" #(target_selected_special_parent)#::selected="selected"#(/target_selected_special_parent)#>"_parent" (the parent frame of a frameset)</option>
<option value="_top" #(target_selected_special_top)#::selected="selected"#(/target_selected_special_top)#>"_top" (top of all frames)</option>
<option value="searchresult" #(target_selected_special_searchresult)#::selected="selected"#(/target_selected_special_searchresult)#>"searchresult" (a default custom page name for search results)</option>
</select>
&nbsp;Pattern:<input type="text" name="target_special_pattern" value="#[target_special_pattern]#" size="30" />
</dd>
<dt>Exclude Hosts</dt> <dt>Exclude Hosts</dt>
<dd>List of hosts that shall be excluded from search results by default but can be included using the site:&lt;host&gt; operator:<br/> <dd>List of hosts that shall be excluded from search results by default but can be included using the site:&lt;host&gt; operator:<br/>
<input type="text" name="search.excludehosts" value="#[search.excludehosts]#" size="60" /><br/> <input type="text" name="search.excludehosts" value="#[search.excludehosts]#" size="60" /><br/>

@ -68,7 +68,9 @@ public class ConfigPortal {
sb.setConfig(SwitchboardConstants.GREETING_HOMEPAGE, post.get(SwitchboardConstants.GREETING_HOMEPAGE, "")); 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_LARGE_IMAGE, post.get(SwitchboardConstants.GREETING_LARGE_IMAGE, ""));
sb.setConfig(SwitchboardConstants.GREETING_SMALL_IMAGE, post.get(SwitchboardConstants.GREETING_SMALL_IMAGE, "")); sb.setConfig(SwitchboardConstants.GREETING_SMALL_IMAGE, post.get(SwitchboardConstants.GREETING_SMALL_IMAGE, ""));
sb.setConfig(SwitchboardConstants.SEARCH_TARGET, post.get("target", "_self")); sb.setConfig(SwitchboardConstants.SEARCH_TARGET_DEFAULT, post.get("target", "_self"));
sb.setConfig(SwitchboardConstants.SEARCH_TARGET_SPECIAL, post.get("target_special", "_self"));
sb.setConfig(SwitchboardConstants.SEARCH_TARGET_SPECIAL_PATTERN, post.get("target_special_pattern", "_self"));
sb.setConfig(SwitchboardConstants.SEARCH_ITEMS, post.getInt("maximumRecords", 10)); sb.setConfig(SwitchboardConstants.SEARCH_ITEMS, post.getInt("maximumRecords", 10));
sb.setConfig(SwitchboardConstants.INDEX_FORWARD, post.get(SwitchboardConstants.INDEX_FORWARD, "")); sb.setConfig(SwitchboardConstants.INDEX_FORWARD, post.get(SwitchboardConstants.INDEX_FORWARD, ""));
HTTPDFileHandler.indexForward = post.get(SwitchboardConstants.INDEX_FORWARD, ""); HTTPDFileHandler.indexForward = post.get(SwitchboardConstants.INDEX_FORWARD, "");
@ -87,17 +89,17 @@ public class ConfigPortal {
sb.setConfig("search.result.show.metadata", post.getBoolean("search.result.show.metadata", false)); sb.setConfig("search.result.show.metadata", post.getBoolean("search.result.show.metadata", false));
sb.setConfig("search.result.show.parser", post.getBoolean("search.result.show.parser", false)); sb.setConfig("search.result.show.parser", post.getBoolean("search.result.show.parser", false));
sb.setConfig("search.result.show.pictures", post.getBoolean("search.result.show.pictures", false)); sb.setConfig("search.result.show.pictures", post.getBoolean("search.result.show.pictures", false));
sb.setConfig(SwitchboardConstants.SEARCH_VERIFY, post.get("search.verify", "ifexist")); sb.setConfig(SwitchboardConstants.SEARCH_VERIFY, post.get("search.verify", "ifexist"));
sb.setConfig(SwitchboardConstants.SEARCH_VERIFY_DELETE, post.getBoolean("search.verify.delete", false)); sb.setConfig(SwitchboardConstants.SEARCH_VERIFY_DELETE, post.getBoolean("search.verify.delete", false));
sb.setConfig("about.headline", post.get("about.headline", "")); sb.setConfig("about.headline", post.get("about.headline", ""));
sb.setConfig("about.body", post.get("about.body", "")); sb.setConfig("about.body", post.get("about.body", ""));
String excludehosts = post.get("search.excludehosts", ""); String excludehosts = post.get("search.excludehosts", "");
sb.setConfig("search.excludehosts", excludehosts); sb.setConfig("search.excludehosts", excludehosts);
sb.setConfig("search.excludehosth", DigestURI.hosthashes(excludehosts)); sb.setConfig("search.excludehosth", DigestURI.hosthashes(excludehosts));
// construct navigation String // construct navigation String
String nav = ""; String nav = "";
if (post.getBoolean("search.navigation.hosts", false)) nav += "hosts,"; if (post.getBoolean("search.navigation.hosts", false)) nav += "hosts,";
@ -114,7 +116,9 @@ public class ConfigPortal {
sb.setConfig(SwitchboardConstants.BROWSER_POP_UP_PAGE, "Status.html"); sb.setConfig(SwitchboardConstants.BROWSER_POP_UP_PAGE, "Status.html");
sb.setConfig(SwitchboardConstants.INDEX_FORWARD, ""); sb.setConfig(SwitchboardConstants.INDEX_FORWARD, "");
HTTPDFileHandler.indexForward = ""; HTTPDFileHandler.indexForward = "";
sb.setConfig(SwitchboardConstants.SEARCH_TARGET, "_self"); sb.setConfig(SwitchboardConstants.SEARCH_TARGET_DEFAULT, "_self");
sb.setConfig(SwitchboardConstants.SEARCH_TARGET_SPECIAL, "_self");
sb.setConfig(SwitchboardConstants.SEARCH_TARGET_SPECIAL_PATTERN, "");
sb.setConfig("publicTopmenu", true); sb.setConfig("publicTopmenu", true);
sb.setConfig("publicSearchpage", true); sb.setConfig("publicSearchpage", true);
sb.setConfig("search.navigation", "hosts,authors,namespace,topics"); sb.setConfig("search.navigation", "hosts,authors,namespace,topics");
@ -194,12 +198,20 @@ public class ConfigPortal {
prop.put("maximumRecords", sb.getConfigInt(SwitchboardConstants.SEARCH_ITEMS, 10)); prop.put("maximumRecords", sb.getConfigInt(SwitchboardConstants.SEARCH_ITEMS, 10));
final String target = sb.getConfig(SwitchboardConstants.SEARCH_TARGET, "_self"); final String target = sb.getConfig(SwitchboardConstants.SEARCH_TARGET_DEFAULT, "_self");
prop.put("selected_blank", "_blank".equals(target) ? 1 : 0); prop.put("target_selected_blank", "_blank".equals(target) ? 1 : 0);
prop.put("selected_self", "_self".equals(target) ? 1 : 0); prop.put("target_selected_self", "_self".equals(target) ? 1 : 0);
prop.put("selected_parent", "_parent".equals(target) ? 1 : 0); prop.put("target_selected_parent", "_parent".equals(target) ? 1 : 0);
prop.put("selected_top", "_top".equals(target) ? 1 : 0); prop.put("target_selected_top", "_top".equals(target) ? 1 : 0);
prop.put("selected_searchresult", "searchresult".equals(target) ? 1 : 0); prop.put("target_selected_searchresult", "searchresult".equals(target) ? 1 : 0);
final String target_special = sb.getConfig(SwitchboardConstants.SEARCH_TARGET_SPECIAL, "_self");
prop.put("target_selected_special_blank", "_blank".equals(target_special) ? 1 : 0);
prop.put("target_selected_special_self", "_self".equals(target_special) ? 1 : 0);
prop.put("target_selected_special_parent", "_parent".equals(target_special) ? 1 : 0);
prop.put("target_selected_special_top", "_top".equals(target_special) ? 1 : 0);
prop.put("target_selected_special_searchresult", "searchresult".equals(target_special) ? 1 : 0);
prop.put("target_special_pattern", sb.getConfig(SwitchboardConstants.SEARCH_TARGET_SPECIAL_PATTERN, ""));
String myaddress = (sb.peers == null) ? null : sb.peers.mySeed() == null ? null : sb.peers.mySeed().getPublicAddress(); String myaddress = (sb.peers == null) ? null : sb.peers.mySeed() == null ? null : sb.peers.mySeed().getPublicAddress();
if (myaddress == null) { if (myaddress == null) {

@ -102,16 +102,18 @@ public class yacysearchitem {
prop.put("remoteIndexCount", Formatter.number(theSearch.getRankingResult().getRemoteIndexCount(), true)); prop.put("remoteIndexCount", Formatter.number(theSearch.getRankingResult().getRemoteIndexCount(), true));
prop.put("remotePeerCount", Formatter.number(theSearch.getRankingResult().getRemotePeerCount(), true)); prop.put("remotePeerCount", Formatter.number(theSearch.getRankingResult().getRemotePeerCount(), true));
prop.put("navurlBase", QueryParams.navurlBase("html", theQuery, null, theQuery.urlMask.toString(), theQuery.navigators).toString()); prop.put("navurlBase", QueryParams.navurlBase("html", theQuery, null, theQuery.urlMask.toString(), theQuery.navigators).toString());
final String target_special_pattern = sb.getConfig(SwitchboardConstants.SEARCH_TARGET_SPECIAL_PATTERN, "");
final String target = sb.getConfig(SwitchboardConstants.SEARCH_TARGET, "_self");
if (theQuery.contentdom == ContentDomain.TEXT) { if (theQuery.contentdom == ContentDomain.TEXT) {
// text search // text search
// generate result object // generate result object
final ResultEntry result = theSearch.oneResult(item, theQuery.isLocal() ? 1000 : 5000); final ResultEntry result = theSearch.oneResult(item, theQuery.isLocal() ? 1000 : 5000);
if (result == null) return prop; // no content if (result == null) return prop; // no content
final String resultUrlstring = result.urlstring();
final DigestURI resultURL = result.url(); final DigestURI resultURL = result.url();
final String target = sb.getConfig(resultUrlstring.matches(target_special_pattern) ? SwitchboardConstants.SEARCH_TARGET_SPECIAL : SwitchboardConstants.SEARCH_TARGET_DEFAULT, "_self");
final int port = resultURL.getPort(); final int port = resultURL.getPort();
DigestURI faviconURL = null; DigestURI faviconURL = null;
if ((fileType == FileType.HTML || fileType == FileType.JSON) && !sb.isIntranetMode() && !resultURL.isLocal()) try { if ((fileType == FileType.HTML || fileType == FileType.JSON) && !sb.isIntranetMode() && !resultURL.isLocal()) try {
@ -131,7 +133,7 @@ public class yacysearchitem {
final String urlhash = ASCII.String(result.hash()); final String urlhash = ASCII.String(result.hash());
prop.put("content_authorized_bookmark", sb.tables.bookmarks.hasBookmark("admin", urlhash) ? "0" : "1"); prop.put("content_authorized_bookmark", sb.tables.bookmarks.hasBookmark("admin", urlhash) ? "0" : "1");
prop.putHTML("content_authorized_bookmark_bookmarklink", "/yacysearch.html?query=" + theQuery.queryString.replace(' ', '+') + "&Enter=Search&count=" + theQuery.displayResults() + "&offset=" + (theQuery.neededResults() - theQuery.displayResults()) + "&order=" + crypt.simpleEncode(theQuery.ranking.toExternalString()) + "&resource=" + resource + "&time=3&bookmarkref=" + urlhash + "&urlmaskfilter=.*"); prop.putHTML("content_authorized_bookmark_bookmarklink", "/yacysearch.html?query=" + theQuery.queryString.replace(' ', '+') + "&Enter=Search&count=" + theQuery.displayResults() + "&offset=" + (theQuery.neededResults() - theQuery.displayResults()) + "&order=" + crypt.simpleEncode(theQuery.ranking.toExternalString()) + "&resource=" + resource + "&time=3&bookmarkref=" + urlhash + "&urlmaskfilter=.*");
prop.put("content_authorized_recommend", (sb.peers.newsPool.getSpecific(NewsPool.OUTGOING_DB, NewsPool.CATEGORY_SURFTIPP_ADD, "url", result.urlstring()) == null) ? "1" : "0"); prop.put("content_authorized_recommend", (sb.peers.newsPool.getSpecific(NewsPool.OUTGOING_DB, NewsPool.CATEGORY_SURFTIPP_ADD, "url", resultUrlstring) == null) ? "1" : "0");
prop.putHTML("content_authorized_recommend_deletelink", "/yacysearch.html?query=" + theQuery.queryString.replace(' ', '+') + "&Enter=Search&count=" + theQuery.displayResults() + "&offset=" + (theQuery.neededResults() - theQuery.displayResults()) + "&order=" + crypt.simpleEncode(theQuery.ranking.toExternalString()) + "&resource=" + resource + "&time=3&deleteref=" + urlhash + "&urlmaskfilter=.*"); prop.putHTML("content_authorized_recommend_deletelink", "/yacysearch.html?query=" + theQuery.queryString.replace(' ', '+') + "&Enter=Search&count=" + theQuery.displayResults() + "&offset=" + (theQuery.neededResults() - theQuery.displayResults()) + "&order=" + crypt.simpleEncode(theQuery.ranking.toExternalString()) + "&resource=" + resource + "&time=3&deleteref=" + urlhash + "&urlmaskfilter=.*");
prop.putHTML("content_authorized_recommend_recommendlink", "/yacysearch.html?query=" + theQuery.queryString.replace(' ', '+') + "&Enter=Search&count=" + theQuery.displayResults() + "&offset=" + (theQuery.neededResults() - theQuery.displayResults()) + "&order=" + crypt.simpleEncode(theQuery.ranking.toExternalString()) + "&resource=" + resource + "&time=3&recommendref=" + urlhash + "&urlmaskfilter=.*"); prop.putHTML("content_authorized_recommend_recommendlink", "/yacysearch.html?query=" + theQuery.queryString.replace(' ', '+') + "&Enter=Search&count=" + theQuery.displayResults() + "&offset=" + (theQuery.neededResults() - theQuery.displayResults()) + "&order=" + crypt.simpleEncode(theQuery.ranking.toExternalString()) + "&resource=" + resource + "&time=3&recommendref=" + urlhash + "&urlmaskfilter=.*");
prop.put("content_authorized_urlhash", urlhash); prop.put("content_authorized_urlhash", urlhash);
@ -139,8 +141,8 @@ public class yacysearchitem {
prop.putHTML("content_title", result.title()); prop.putHTML("content_title", result.title());
prop.putXML("content_title-xml", result.title()); prop.putXML("content_title-xml", result.title());
prop.putJSON("content_title-json", result.title()); prop.putJSON("content_title-json", result.title());
prop.putHTML("content_link", result.urlstring()); prop.putHTML("content_link", resultUrlstring);
prop.putHTML("content_showPictures_link", result.urlstring()); prop.putHTML("content_showPictures_link", resultUrlstring);
prop.putHTML("content_target", target); prop.putHTML("content_target", target);
if (faviconURL != null && fileType == FileType.HTML) sb.loader.loadIfNotExistBackground(faviconURL, 1024 * 1024 * 10); if (faviconURL != null && fileType == FileType.HTML) sb.loader.loadIfNotExistBackground(faviconURL, 1024 * 1024 * 10);
prop.putHTML("content_faviconCode", sb.licensedURLs.aquireLicense(faviconURL)); // acquire license for favicon url loading prop.putHTML("content_faviconCode", sb.licensedURLs.aquireLicense(faviconURL)); // acquire license for favicon url loading
@ -216,10 +218,13 @@ public class yacysearchitem {
if (ms == null) { if (ms == null) {
prop.put("content_item", "0"); prop.put("content_item", "0");
} else { } else {
final String resultUrlstring = ms.href.toNormalform(true, false);
final String target = sb.getConfig(resultUrlstring.matches(target_special_pattern) ? SwitchboardConstants.SEARCH_TARGET_SPECIAL : SwitchboardConstants.SEARCH_TARGET_DEFAULT, "_self");
final String license = sb.licensedURLs.aquireLicense(ms.href); final String license = sb.licensedURLs.aquireLicense(ms.href);
sb.loader.loadIfNotExistBackground(ms.href, 1024 * 1024 * 10); sb.loader.loadIfNotExistBackground(ms.href, 1024 * 1024 * 10);
prop.putHTML("content_item_hrefCache", (auth) ? "/ViewImage.png?url=" + ms.href.toNormalform(true, false) : ms.href.toNormalform(true, false)); prop.putHTML("content_item_hrefCache", (auth) ? "/ViewImage.png?url=" + resultUrlstring : resultUrlstring);
prop.putHTML("content_item_href", ms.href.toNormalform(true, false)); prop.putHTML("content_item_href", resultUrlstring);
prop.putHTML("content_item_target", target); prop.putHTML("content_item_target", target);
prop.put("content_item_code", license); prop.put("content_item_code", license);
prop.putHTML("content_item_name", shorten(ms.name, MAX_NAME_LENGTH)); prop.putHTML("content_item_name", shorten(ms.name, MAX_NAME_LENGTH));
@ -254,8 +259,11 @@ public class yacysearchitem {
if (media != null) { if (media != null) {
int c = 0; int c = 0;
for (final MediaSnippet ms : media) { for (final MediaSnippet ms : media) {
prop.putHTML("content_items_" + c + "_href", ms.href.toNormalform(true, false)); final String resultUrlstring = ms.href.toNormalform(true, false);
prop.putHTML("content_items_" + c + "_hrefshort", nxTools.shortenURLString(ms.href.toNormalform(true, false), MAX_URL_LENGTH)); final String target = sb.getConfig(resultUrlstring.matches(target_special_pattern) ? SwitchboardConstants.SEARCH_TARGET_SPECIAL : SwitchboardConstants.SEARCH_TARGET_DEFAULT, "_self");
prop.putHTML("content_items_" + c + "_href", resultUrlstring);
prop.putHTML("content_items_" + c + "_hrefshort", nxTools.shortenURLString(resultUrlstring, MAX_URL_LENGTH));
prop.putHTML("content_items_" + c + "_target", target); prop.putHTML("content_items_" + c + "_target", target);
prop.putHTML("content_items_" + c + "_name", shorten(ms.name, MAX_NAME_LENGTH)); prop.putHTML("content_items_" + c + "_name", shorten(ms.name, MAX_NAME_LENGTH));
prop.put("content_items_" + c + "_col", (col) ? "0" : "1"); prop.put("content_items_" + c + "_col", (col) ? "0" : "1");

@ -436,7 +436,9 @@ public final class SwitchboardConstants {
public static final String UPNP_REMOTEHOST = "upnp.remoteHost"; public static final String UPNP_REMOTEHOST = "upnp.remoteHost";
public static final String SEARCH_ITEMS = "search.items"; public static final String SEARCH_ITEMS = "search.items";
public static final String SEARCH_TARGET = "search.target"; public static final String SEARCH_TARGET_DEFAULT = "search.target";
public static final String SEARCH_TARGET_SPECIAL = "search.target.special"; // exceptions to the search target
public static final String SEARCH_TARGET_SPECIAL_PATTERN = "search.target.special.pattern"; // ie 'own' addresses in topframe, 'other' in iframe
public static final String SEARCH_VERIFY = "search.verify"; public static final String SEARCH_VERIFY = "search.verify";
public static final String SEARCH_VERIFY_DELETE = "search.verify.delete"; public static final String SEARCH_VERIFY_DELETE = "search.verify.delete";

Loading…
Cancel
Save