diff --git a/defaults/yacy.init b/defaults/yacy.init index 5ae000d2d..725987a98 100644 --- a/defaults/yacy.init +++ b/defaults/yacy.init @@ -979,11 +979,6 @@ publicSearchpage = true # to /Status.html to get the main memu bar back publicTopmenu = true -# flag if a small link to the administration sites on the right bottom of the index -# page should be shown to all users. -# you might want to enabled this, if publicTopmenu is disabled -publicAdministratorPi = false - # Wiki access rights # the built-in wiki system allows by default only that the administrator is allowed to make changes # this can be changed. There are three options: diff --git a/htroot/env/base.css b/htroot/env/base.css index c768fa3e7..0f05d883a 100644 --- a/htroot/env/base.css +++ b/htroot/env/base.css @@ -327,7 +327,7 @@ clear:both; #resNav { /* right part of the progress bar */ - float:right; + float:left; } #resProgFill { @@ -713,7 +713,7 @@ form.search.small { } .searchinput { - font-size:16px; + font-size:18px; } /*---------- @@ -1048,4 +1048,4 @@ div#info:hover span { text-align: left; border: 1px dashed black; z-index: 100; - } \ No newline at end of file + } diff --git a/htroot/env/templates/header.template b/htroot/env/templates/header.template index 099d79534..536b63b68 100644 --- a/htroot/env/templates/header.template +++ b/htroot/env/templates/header.template @@ -10,22 +10,19 @@  Administration - - - + + :: +#(/num-results)# @@ -215,9 +213,6 @@ document.getElementById("search").focus(); // @@ -244,6 +239,8 @@ function latestinfo() { }; self.xmlHttpReq.send(null); } +window.setTimeout('latestinfo();',500); // we need that to get a correct pagination bar at the end of the page +window.setTimeout('latestinfo();',1000); // TODO: resets statistic on navigating to next page in Jetty implementation /* window.setTimeout('latestinfo();',500); diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java index bc3167575..b6c4a19f0 100644 --- a/htroot/yacysearch.java +++ b/htroot/yacysearch.java @@ -127,9 +127,6 @@ public class yacysearch { final servletProperties prop = new servletProperties(); prop.put("topmenu", sb.getConfigBool("publicTopmenu", true) ? 1 : 0); - //get focus option - prop.put("focus", ((post == null) ? true : post.get("focus", "1").equals("1")) ? 1 : 0); - // produce vocabulary navigation sidebars Collection vocabularies = LibraryProvider.autotagging.getVocabularies(); int j = 0; @@ -160,9 +157,8 @@ public class yacysearch { final boolean clustersearch = sb.isRobinsonMode() && sb.getConfig(SwitchboardConstants.CLUSTER_MODE, "").equals(SwitchboardConstants.CLUSTER_MODE_PUBLIC_CLUSTER); final boolean indexReceiveGranted = sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW_SEARCH, true) || clustersearch; boolean p2pmode = sb.peers != null && sb.peers.sizeConnected() > 0 && indexReceiveGranted; - boolean global = post == null || (post.get("resource", "local").equals("global") && p2pmode); + boolean global = post == null || (post.get("resource-switch", post.get("resource", "local")).equals("global") && p2pmode); boolean stealthmode = p2pmode && !global; - prop.put("topmenu_resource-select", !authorized ? 0 : stealthmode ? 2 : global ? 1 : 0); if ( post == null || indexSegment == null || env == null || !searchAllowed ) { if (indexSegment == null) ConcurrentLog.info("yacysearch", "indexSegment == null"); @@ -765,7 +761,7 @@ public class yacysearch { "html", 0, theQuery, - suggestion).toString()); + suggestion, true).toString()); prop.put("didYouMean_suggestions_" + meanCount + "_sep", "|"); meanCount++; } catch (final ConcurrentModificationException e) { @@ -833,44 +829,6 @@ public class yacysearch { prop.put("num-results_globalresults_remoteIndexCount", Formatter.number(theSearch.remote_rwi_available.get() + theSearch.remote_solr_available.get(), true)); prop.put("num-results_globalresults_remotePeerCount", Formatter.number(theSearch.remote_rwi_peerCount.get() + theSearch.remote_solr_peerCount.get(), true)); - // compose page navigation - final StringBuilder resnav = new StringBuilder(200); - resnav.append(""); - final String resnavs = resnav.toString(); - - prop.put("num-results_resnav", resnavs); - prop.put("pageNavBottom", (theSearch.getResultCount() - startRecord > 6) ? 1 : 0); // if there are more results than may fit on the page we add a navigation at the bottom - prop.put("pageNavBottom_resnav", resnavs); - // generate the search result lines; the content will be produced by another servlet for ( int i = 0; i < theQuery.itemsPerPage(); i++ ) { prop.put("results_" + i + "_item", startRecord + i); diff --git a/htroot/yacysearchitem.html b/htroot/yacysearchitem.html index 7de288c77..8f51dfc11 100644 --- a/htroot/yacysearchitem.html +++ b/htroot/yacysearchitem.html @@ -56,6 +56,5 @@ diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.java index cdbbca0b4..f5a49e7ee 100644 --- a/htroot/yacysearchitem.java +++ b/htroot/yacysearchitem.java @@ -105,7 +105,7 @@ public class yacysearchitem { prop.put("remoteResourceSize", Formatter.number(theSearch.remote_rwi_stored.get() + theSearch.remote_solr_stored.get(), true)); prop.put("remoteIndexCount", Formatter.number(theSearch.remote_rwi_available.get() + theSearch.remote_solr_available.get(), true)); prop.put("remotePeerCount", Formatter.number(theSearch.remote_rwi_peerCount.get() + theSearch.remote_solr_peerCount.get(), true)); - prop.put("navurlBase", QueryParams.navurlBase("html", theSearch.query, null).toString()); + prop.put("navurlBase", QueryParams.navurlBase("html", theSearch.query, null, false).toString()); final String target_special_pattern = sb.getConfig(SwitchboardConstants.SEARCH_TARGET_SPECIAL_PATTERN, ""); long timeout = item == 0 ? 10000 : (theSearch.query.isLocal() ? 1000 : 3000); diff --git a/htroot/yacysearchlatestinfo.java b/htroot/yacysearchlatestinfo.java index 95ebeb956..d1895fd8b 100644 --- a/htroot/yacysearchlatestinfo.java +++ b/htroot/yacysearchlatestinfo.java @@ -41,7 +41,7 @@ public class yacysearchlatestinfo { prop.put("remoteResourceSize", Formatter.number(theSearch.remote_rwi_stored.get() + theSearch.remote_solr_stored.get(), true)); prop.put("remoteIndexCount", Formatter.number(theSearch.remote_rwi_available.get() + theSearch.remote_solr_available.get(), true)); prop.put("remotePeerCount", Formatter.number(theSearch.remote_rwi_peerCount.get() + theSearch.remote_solr_peerCount.get(), true)); - prop.putJSON("navurlBase", QueryParams.navurlBase("html", theSearch.query, null).toString()); + prop.putJSON("navurlBase", QueryParams.navurlBase("html", theSearch.query, null, false).toString()); return prop; } diff --git a/htroot/yacysearchtrailer.html b/htroot/yacysearchtrailer.html index 5da16fdb5..874a4dea3 100644 --- a/htroot/yacysearchtrailer.html +++ b/htroot/yacysearchtrailer.html @@ -1,3 +1,33 @@ + + +#(resource-select)#:: + + + + + +:: +
+ + +
+ +#(/resource-select)# #(cat-location)#:: diff --git a/htroot/yacysearchtrailer.java b/htroot/yacysearchtrailer.java index 5d3e3fa17..3c0cebb33 100644 --- a/htroot/yacysearchtrailer.java +++ b/htroot/yacysearchtrailer.java @@ -39,6 +39,7 @@ import net.yacy.kelondro.util.ISO639; import net.yacy.peers.graphics.ProfilingGraph; import net.yacy.search.EventTracker; import net.yacy.search.Switchboard; +import net.yacy.search.SwitchboardConstants; import net.yacy.search.query.QueryParams; import net.yacy.search.query.SearchEvent; import net.yacy.search.query.SearchEventCache; @@ -68,6 +69,14 @@ public class yacysearchtrailer { } final RequestHeader.FileType fileType = header.fileType(); + final boolean authorized = sb.verifyAuthentication(header); + final boolean clustersearch = sb.isRobinsonMode() && sb.getConfig(SwitchboardConstants.CLUSTER_MODE, "").equals(SwitchboardConstants.CLUSTER_MODE_PUBLIC_CLUSTER); + final boolean indexReceiveGranted = sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW_SEARCH, true) || clustersearch; + boolean p2pmode = sb.peers != null && sb.peers.sizeConnected() > 0 && indexReceiveGranted; + boolean global = post == null || (post.get("resource-switch", post.get("resource", "local")).equals("global") && p2pmode); + boolean stealthmode = p2pmode && !global; + prop.put("resource-select", !authorized ? 0 : stealthmode ? 2 : global ? 1 : 0); + // compose search navigation // namespace navigators @@ -99,7 +108,7 @@ public class yacysearchtrailer { nav=""; } prop.put(fileType, "nav-namespace_element_" + i + "_name", name); - prop.put(fileType, "nav-namespace_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, nav).toString()); + prop.put(fileType, "nav-namespace_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, nav, false).toString()); prop.put("nav-namespace_element_" + i + "_count", count); prop.put("nav-namespace_element_" + i + "_nl", 1); i++; @@ -141,7 +150,7 @@ public class yacysearchtrailer { nav=""; } prop.put(fileType, "nav-domains_element_" + i + "_name", name); - prop.put(fileType, "nav-domains_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, nav).toString()); + prop.put(fileType, "nav-domains_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, nav, false).toString()); prop.put("nav-domains_element_" + i + "_count", count); prop.put("nav-domains_element_" + i + "_nl", 1); i++; @@ -184,7 +193,7 @@ public class yacysearchtrailer { } String longname = ISO639.country(name); prop.put(fileType, "nav-languages_element_" + i + "_name", longname == null ? name : longname); - prop.put(fileType, "nav-languages_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, nav).toString()); + prop.put(fileType, "nav-languages_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, nav, false).toString()); prop.put("nav-languages_element_" + i + "_count", count); prop.put("nav-languages_element_" + i + "_nl", 1); i++; @@ -225,7 +234,7 @@ public class yacysearchtrailer { nav=""; } prop.put(fileType, "nav-authors_element_" + i + "_name", name); - prop.put(fileType, "nav-authors_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, nav).toString()); + prop.put(fileType, "nav-authors_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, nav, false).toString()); prop.put("nav-authors_element_" + i + "_count", count); prop.put("nav-authors_element_" + i + "_nl", 1); i++; @@ -270,7 +279,7 @@ public class yacysearchtrailer { prop.put("nav-topics_element_" + i + "_on", 1); prop.put(fileType, "nav-topics_element_" + i + "_modifier", name); prop.put(fileType, "nav-topics_element_" + i + "_name", name); - prop.put(fileType, "nav-topics_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, name).toString()); + prop.put(fileType, "nav-topics_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, name, false).toString()); prop.put("nav-topics_element_" + i + "_count", count); int fontsize = TOPWORDS_MINSIZE + (TOPWORDS_MAXSIZE - TOPWORDS_MINSIZE) * (count - mincount) / (maxcount / mincount); fontsize = Math.max(TOPWORDS_MINSIZE, fontsize - (name.length() - 5)); @@ -311,7 +320,7 @@ public class yacysearchtrailer { nav=""; } prop.put(fileType, "nav-protocols_element_" + i + "_name", name); - prop.put(fileType, "nav-protocols_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, nav).toString()); + prop.put(fileType, "nav-protocols_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, nav, false).toString()); prop.put("nav-protocols_element_" + i + "_count", count); prop.put("nav-protocols_element_" + i + "_nl", 1); i++; @@ -354,7 +363,7 @@ public class yacysearchtrailer { nav=""; } prop.put(fileType, "nav-filetypes_element_" + i + "_name", name); - prop.put(fileType, "nav-filetypes_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, nav).toString()); + prop.put(fileType, "nav-filetypes_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, nav, false).toString()); prop.put("nav-filetypes_element_" + i + "_count", count); prop.put("nav-filetypes_element_" + i + "_nl", 1); i++; @@ -398,7 +407,7 @@ public class yacysearchtrailer { nav=""; } prop.put(fileType, "nav-vocabulary_" + navvoccount + "_element_" + i + "_name", name); - prop.put(fileType, "nav-vocabulary_" + navvoccount + "_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, nav).toString()); + prop.put(fileType, "nav-vocabulary_" + navvoccount + "_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, nav, false).toString()); prop.put("nav-vocabulary_" + navvoccount + "_element_" + i + "_count", count); prop.put("nav-vocabulary_" + navvoccount + "_element_" + i + "_nl", 1); i++; diff --git a/source/net/yacy/search/query/QueryParams.java b/source/net/yacy/search/query/QueryParams.java index b0a5023d2..448260fae 100644 --- a/source/net/yacy/search/query/QueryParams.java +++ b/source/net/yacy/search/query/QueryParams.java @@ -598,9 +598,9 @@ public final class QueryParams { * @param addToQuery * @return */ - public static StringBuilder navurl(final String ext, final int page, final QueryParams theQuery, final String newQueryString) { + public static StringBuilder navurl(final String ext, final int page, final QueryParams theQuery, final String newQueryString, boolean newModifierReplacesOld) { - final StringBuilder sb = navurlBase(ext, theQuery, newQueryString); + final StringBuilder sb = navurlBase(ext, theQuery, newQueryString, newModifierReplacesOld); sb.append("&startRecord="); sb.append(page * theQuery.itemsPerPage()); @@ -619,20 +619,27 @@ public final class QueryParams { * - if isEmpty overwrites (clears) existing modifier * @return url to new search result page */ - public static StringBuilder navurlBase(final String ext, final QueryParams theQuery, final String newModifier) { + public static StringBuilder navurlBase(final String ext, final QueryParams theQuery, final String newModifier, boolean newModifierReplacesOld) { final StringBuilder sb = new StringBuilder(120); sb.append("/yacysearch."); sb.append(ext); sb.append("?query="); - sb.append(theQuery.getQueryGoal().getQueryString(true)); if (newModifier == null) { + sb.append(theQuery.getQueryGoal().getQueryString(true)); if (!theQuery.modifier.isEmpty()) sb.append("+" + theQuery.modifier.toString()); } else { - if(!newModifier.isEmpty()) { - if (!theQuery.modifier.isEmpty()) sb.append("+" + theQuery.modifier.toString()); - sb.append("+" + newModifier); + if (newModifier.isEmpty()) { + sb.append(theQuery.getQueryGoal().getQueryString(true)); + } else { + if (newModifierReplacesOld) { + sb.append(newModifier); + } else { + sb.append(theQuery.getQueryGoal().getQueryString(true)); + if (!theQuery.modifier.isEmpty()) sb.append("+" + theQuery.modifier.toString()); + sb.append("+" + newModifier); + } } }