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

pull/1/head
orbiter 11 years ago
commit 22618e3ba2

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

@ -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;
}
}

@ -10,22 +10,19 @@
</button>
<a class="forceNoExternalIcon navbar-brand" id="navbar-brand" href="/" style="position:absolute;top:-6px;display:inline;white-space:nowrap;">
<img id="greeting-icon" class="yacylogo" src="/env/grafics/yacy.png" style="height:auto; width:auto; max-width:200px; max-height:32px;vertical-align:middle">&nbsp;Administration
</a>
<form class="navbar-form " method="get" accept-charset="UTF-8" action="/yacysearch.html" style="padding-left:200px;">
<input name="query" placeholder="Search..." class="form-control" type="text" size="20" maxlength="80" value=""/>
<form class="navbar-form" method="get" accept-charset="UTF-8" action="/yacysearch.html" style="padding-left:200px;max-width:400px;">
<input name="query" placeholder="Search..." class="form-control" type="text" size="36" maxlength="200" value=""/>
<input type="hidden" name="verify" value="cacheonly" />
<input type="hidden" name="maximumRecords" value="10" />
<input type="hidden" name="resource" value="local" />
<input type="hidden" name="urlmaskfilter" value=".*" />
<input type="hidden" name="prefermaskfilter" value="" />
<input type="hidden" name="nav" value="all" />
</form>
</form>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>
<li id="header_restart">
<form action="/Steering.html" method="get" role="form">
<input type="hidden" name="restart" value="" />

@ -4,6 +4,7 @@
#(forward)#::<meta http-equiv="REFRESH" content="0; url=#[target]#" />#(/forward)#
<title>YaCy '#[clientname]#': Search Page</title>
#%env/templates/metas.template%#
<link href="/env/bootstrap/css/jumbotron-narrow.css" rel="stylesheet">
<link rel="alternate" type="application/rss+xml" title="Search for #[former]#" href="yacysearch.rss?query=#[former]#" />
<link rel="search" type="application/opensearchdescription+xml" title="YaCy Search on '#[clientname]#'" href="opensearchdescription.xml" />
<link rel="stylesheet" type="text/css" media="screen" href="env/highslide.css" />
@ -44,18 +45,14 @@
document.getElementById("navbar-brand").href="#[promoteSearchPageGreeting.homepage]#";
</script>
#(/topmenu)#
#(pi)#::
<div style="position:fixed; bottom: 0; right: 1px;"><a href="Status.html">&pi;</a></div>
#(/pi)#
<h2 class="yacy"><a href="#[promoteSearchPageGreeting.homepage]#" class="yacylogo"><img src="#[promoteSearchPageGreeting.largeImage]#" alt="yacy" style="margin: auto;"/></a></h2>
<h2 class="yacy">#[promoteSearchPageGreeting]#</h2>
<form class="search" action="yacysearch.html" method="get" id="searchform" accept-charset="UTF-8">
<fieldset class="maininput">
<input name="query" class="searchinput" id="search" type="text" size="40" maxlength="80" value="#[former]#" onFocus="this.select()" />
<input type="submit" name="Enter" value="Search" />
<input name="query" class="searchinput" id="search" type="text" size="40" maxlength="80" value="#[former]#" onFocus="this.select()" style="position:relative;top:1px;" />
<button type="submit" name="query" id="search" class="btn btn-primary">Search</button>
<input type="hidden" name="verify" value="#[search.verify]#" />
#(searchdomswitches)#::
<div class="yacysearch">
@ -64,11 +61,11 @@
#(searchaudio)#::<input type="radio" id="audio" name="contentdom" value="audio" #(check)#::checked="checked"#(/check)# />&nbsp;Audio&nbsp;&nbsp;#(/searchaudio)#
#(searchvideo)#::<input type="radio" id="video" name="contentdom" value="video" #(check)#::checked="checked"#(/check)# />&nbsp;Video&nbsp;&nbsp;#(/searchvideo)#
#(searchapp)#::<input type="radio" id="app" name="contentdom" value="app" #(check)#::checked="checked"#(/check)# />&nbsp;Applications#(/searchapp)#
#(searchoptions)#&nbsp;&nbsp;<a href="index.html?searchoptions=1" onclick="this.href='/index.html?searchoptions=1&amp;former='+document.getElementById('searchform').search.value+'&amp;contentdom='+radioValue(document.getElementById('searchform').contentdom)">more options...</a>::#(/searchoptions)#
#(searchoptions)#&nbsp;&nbsp;<a href="index.html?searchoptions=1" onclick="this.href='/index.html?searchoptions=1&amp;former='+document.getElementById('searchinput').search.value+'&amp;contentdom='+radioValue(document.getElementById('searchinput').contentdom)">more options...</a>::#(/searchoptions)#
</div>
#(/searchdomswitches)#
<input type="hidden" name="nav" value="#[search.navigation]#" />
<input type="hidden" name="startRecord" value="0" />
<input type="hidden" name="startRecord" id="startRecord" value="0" />
<input type="hidden" name="indexof" value="off" />
<input type="hidden" name="meanCount" value="5" />
#(searchoptions)#

@ -117,7 +117,6 @@ public class index {
prop.put("depth", "0");
prop.put("topmenu", sb.getConfigBool("publicTopmenu", true) ? 1 : 0);
prop.put("focus", focus ? 1 : 0);
prop.put("pi", sb.getConfigBool("publicAdministratorPi", false) ? 1 : 0);
prop.putHTML("constraint", constraint);
prop.put("searchdomswitches", sb.getConfigBool("search.text", true) || sb.getConfigBool("search.audio", true) || sb.getConfigBool("search.video", true) || sb.getConfigBool("search.image", true) || sb.getConfigBool("search.app", true) ? 1 : 0);
prop.put("searchdomswitches_searchoptions", searchoptions);

@ -1,58 +1,3 @@
function Progressbar(length, parent) {
// the number of steps of the bar
this.length = length;
// the current position, expressed in steps (so 100% = length)
this.position = 0;
// the current percentage of the bar
this.percentage = 0
// use this function to display the progress, because it updates everything
this.step = function(count) {
if (this.position < this.length)
this.position += count;
// update the bar
this.percentage = this.position*(100/this.length);
this.fill.style.width = this.percentage + "%";
// if the end is reached, the bar is hidden/removed
if(this.position >= this.length) {
this.fill.style.visibility = "hidden";
}
}
// the actual progressbar
var bar = document.createElement("div");
bar.id = "resProgBar";
bar.className ="ProgressBar";
// the actual bar
this.fill = document.createElement("div");
this.fill.id = "resProgFill";
this.fill.className = "ProgressBarFill";
this.fill.style.width = "0%"
bar.appendChild(this.fill);
// the container for the elements used by the Progressbar
this.element = document.createElement("div");
this.element.style.textAlign = "center";
// get hasLayout in IE, needed because of the percentage as width of the bar
this.element.className = "gainlayout";
// results counter inside progress bar
var resCounter = document.getElementById("resCounter");
resCounter.style.display = "inline";
bar.appendChild(resCounter);
// the result sites navigation
var resNav = document.getElementById("resNav");
resNav.style.display = "inline";
bar.appendChild(resNav);
this.element.appendChild(bar);
parent.appendChild(this.element);
}
function addHover() {
if (document.all&&document.getElementById) {
var divs = document.getElementsByTagName("div");
@ -70,19 +15,33 @@ function addHover() {
}
}
function fadeOutBar() {
document.getElementById("progressbar").setAttribute('style',"transition:transform 0s;backgroundColor:transparent;");
}
function statistics(offset, itemscount, itemsperpage, totalcount, localResourceSize, remoteResourceSize, remoteIndexCount, remotePeerCount, navurlbase) {
if (totalcount == 0) return;
if (offset >= 0) document.getElementById("resultsOffset").firstChild.nodeValue = offset;
if (offset >= 0) document.getElementById("offset").innerHTML = offset;
if (offset >= 0) document.getElementById("startRecord").setAttribute('value', offset - 1);
if (itemscount >= 0) document.getElementById("itemscount").firstChild.nodeValue = itemscount;
document.getElementById("totalcount").firstChild.nodeValue = totalcount;
if (document.getElementById("localResourceSize") != null) document.getElementById("localResourceSize").firstChild.nodeValue = localResourceSize;
if (document.getElementById("remoteResourceSize") != null) document.getElementById("remoteResourceSize").firstChild.nodeValue = remoteResourceSize;
if (document.getElementById("remoteIndexCount") != null) document.getElementById("remoteIndexCount").firstChild.nodeValue = remoteIndexCount;
if (document.getElementById("remotePeerCount") != null) document.getElementById("remotePeerCount").firstChild.nodeValue = remotePeerCount;
document.getElementById("resNav").firstChild.nodeValue = "X";
// compose page navigation
resnav = "<ul class=\"pagination\">";
if (document.getElementById("progressbar").getAttribute('class') != "progress-bar progress-bar-success") {
var percent = 100 * (itemscount - offset + 1) / itemsperpage;
if (percent == 100) {
document.getElementById("progressbar").setAttribute('style',"transition:transform 0s;");
document.getElementById("progressbar").setAttribute('class',"progress-bar progress-bar-success");
window.setTimeout(fadeOutBar, 500);
}
document.getElementById("progressbar").setAttribute('style',"width:" + percent + "%");
}
var resnav = "<ul class=\"pagination\">";
thispage = Math.floor(offset / itemsperpage);
if (thispage == 0) {
resnav += "<li class=\"disabled\"><a href=\"#\">&laquo;</a></li>";

@ -58,19 +58,6 @@
#(topmenu)#
#%env/templates/embeddedheader.template%#
::
#(resource-select)#::
<div id="searchmode">
<img src="env/grafics/searchmode_p2p_activated_32.png" width="91" height="32"/><br/>
<a href="yacysearch.html?resource=local"><img src="env/grafics/searchmode_stealth_deactivated_32.png" width="91" height="32"/></a>
<span>Your search is done using peers in the YaCy P2P network. You can switch to 'Stealth Mode' which will switch off P2P, giving you full privacy. Expect less results then, because then only your own search index is used.</span>
</div>::
<div id="searchmode">
<a href="yacysearch.html?resource=global"><img src="env/grafics/searchmode_p2p_deactivated_32.png" width="91" height="32"/></a><br/>
<img src="env/grafics/searchmode_stealth_activated_32.png" width="91" height="32"/>
<span>Your search is done using only your own peer, locally. You can switch to 'Peer-to-Peer Mode' which will cause that your search is done using the other peers in the YaCy network.</span>
</div>#(/resource-select)#
#%env/templates/simpleheader.template%#
<script type="text/javascript">
document.getElementById("header_websearch").className += " active";
@ -98,10 +85,16 @@ To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de
<div class="row">
<div class="col-sm-8 col-sm-offset-4 col-md-9 col-md-offset-3 main">
<form class="search small" action="" method="get" accept-charset="UTF-8">
<fieldset class="yacys">
<input id="search" class="searchinput" name="query" type="text" size="40" maxlength="80" value="#[former]#" onFocus="this.select()" onclick="document.getElementById('Enter').value = 'Search'" />
<input id="Enter" type="submit" name="Enter" value="Search" />
<form class="search small" action="" method="get" accept-charset="UTF-8" style="position:absolute;top:-48px;left:200;z-index:1052;max-width:500px;">
<div class="input-group">
<input type="text" class="form-control searchinput typeahead" size="40" maxlength="200" placeholder="#(topmenu)##[promoteSearchPageGreeting]#::#[promoteSearchPageGreeting]##(/topmenu)#" name="query" value="#[former]#" onFocus="this.select()" id="search" onclick="document.getElementById('Enter').innerHTML = 'search'"/>
<div class="input-group-btn">
<button id="Enter" class="btn btn-default" type="submit">search</button>
</div>
</div>
<!--
#(searchdomswitches)#::
<div class="yacysearch">
#(searchtext)#::<input type="radio" id="text" name="contentdom" value="text" #(check)#::checked="checked"#(/check)# />&nbsp;Text&nbsp;&nbsp;#(/searchtext)#
@ -113,9 +106,10 @@ To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de
<a href="index.html?searchoptions=2&amp;count=#[count]#&amp;prefermaskfilter=#[prefermaskfilter]#&amp;cat=#[cat]#&amp;constraint=#[constraint]#&amp;contentdom=#[contentdom]#&amp;former=#[former]#&amp;meanCount=#[meanCount]#">more options</a>
</div>
#(/searchdomswitches)#
-->
<input type="hidden" name="former" value="#[former]#" />
<input type="hidden" name="maximumRecords" value="#[count]#" />
<input type="hidden" name="startRecord" value="0" />
<input type="hidden" name="startRecord" id="startRecord" value="0" />
<input type="hidden" name="verify" value="#[search.verify]#" />
<input type="hidden" name="resource" value="#[resource]#" />
<input type="hidden" name="nav" value="#[search.navigation]#" />
@ -124,8 +118,27 @@ To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de
<input type="hidden" name="cat" value="#[cat]#" />
<input type="hidden" name="constraint" value="#[constraint]#" />
<input type="hidden" name="meanCount" value="#[meanCount]#" />
</fieldset>
</form>
<!-- type the number of results and navigation bar -->
#(num-results)#
::
<p>No Results.</p>
::
<p>No Results. (length of search words must be at least 2 characters)</p>
::
<div id="results"></div>
<div class="progress">
<div class="progress-bar progress-bar-info" id="progressbar" role="progressbar" style="width:0%;">
<span style="position:absolute;display:block;text-align:left;width:100%;color:black;">&nbsp;&nbsp;&nbsp;<strong id="offset">#[offset]#</strong>-<strong id="itemscount">#[itemscount]#</strong> of <strong id="totalcount">#[totalcount]#</strong> #(globalresults)#::; (<strong id="localResourceSize">#[localResourceSize]#</strong> local, <strong id="remoteResourceSize">#[remoteResourceSize]#</strong> remote), <strong id="remoteIndexCount">#[remoteIndexCount]#</strong> from <strong id="remotePeerCount">#[remotePeerCount]#</strong> remote YaCy peers.#(/globalresults)#</span>
</div>
</div>
::
<p>Searching the web with this peer is disabled for unauthorized users. Please <a href="Status.html?login=">log in</a> as administrator to use the search function</p>
#(/num-results)#
<script>$("input:text:visible:first").focus();</script>
#(urlmaskerror)#::
<p><b>Illegal URL mask:</b> <i>#[urlmask]#</i> (not a valid regular expression), mask ignored.</p>
#(/urlmaskerror)#
@ -141,7 +154,7 @@ To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de
#(searchagain)#
::
<script type="text/javascript">
document.getElementById("Enter").value = "search again";
document.getElementById("Enter").innerHTML = "search again";
</script>
#(/searchagain)#
@ -151,27 +164,6 @@ document.getElementById("Enter").value = "search again";
<p><strong>The following words are stop-words and had been excluded from the search: #[stopwords]#.</strong></p>
#(/excluded)#
<!-- type the number of results and navigation bar -->
#(num-results)#
::
<p>No Results.</p>
::
<p>No Results. (length of search words must be at least 2 characters)</p>
::
<div id="results"></div>
<span id="resCounter" style="display: inline;"><strong id="resultsOffset">#[offset]#</strong>-<strong id="itemscount">#[itemscount]#</strong> of <strong id="totalcount">#[totalcount]#</strong> #(globalresults)#::; (<strong id="localResourceSize">#[localResourceSize]#</strong> local, <strong id="remoteResourceSize">#[remoteResourceSize]#</strong> remote), <strong id="remoteIndexCount">#[remoteIndexCount]#</strong> from <strong id="remotePeerCount">#[remotePeerCount]#</strong> remote YaCy peers.#(/globalresults)#</span>
<span id="resNav" style="display: inline;">#[resnav]#</span>
::
<p>Searching the web with this peer is disabled for unauthorized users. Please <a href="Status.html?login=">log in</a> as administrator to use the search function</p>
#(/num-results)#
<!-- the search results -->
<script type="text/javascript">
var progressbar = new Progressbar(#[results]#, document.getElementById("results"));
#(focus)#::
document.getElementById("search").focus();
#(/focus)#
</script>
<!-- show openstreetmap tiles if geoinfo was found -->
#(geoinfo)#
@ -203,8 +195,14 @@ document.getElementById("search").focus();
#(resultTable)#::</table>#(/resultTable)#
<!-- linklist end -->
<!-- attach the bottomline (customer option) -->
<!--#(pageNavBottom)#::<div id="pageNavBottom" style="text-align:center">#[resnav]#</div>#(/pageNavBottom)#-->
#(num-results)#
::
::
::
<span id="resNav" style="display: inline;"></span>
</div>
::
#(/num-results)#
</div> <!-- close main -->
@ -215,9 +213,6 @@ document.getElementById("search").focus();
//<![CDATA[
$(function() {
$("#sidebarTopics").tagcloud({type:"sphere",power:.25,seed:0,sizemin:10,sizemax:20,height:80,colormin:"682",colormax:"20C"}).find("li").tsort();
#(focus)#::
$("#search").focus();
#(/focus)#
});
//]]>
</script>
@ -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);

@ -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<Tagging> 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("<ul class=\"pagination\">");
final int thispage = startRecord / theQuery.itemsPerPage();
if (thispage == 0) {
resnav.append("<li class=\"disabled\"><a href=\"#\">&laquo;</a></li>");
} else {
resnav.append("<li><a id=\"prevpage\" href=\"");
resnav.append(QueryParams.navurl("html", thispage - 1, theQuery, null).toString());
resnav.append("\">&laquo;</a></li>");
}
final int numberofpages = Math.min(10, 1 + ((theSearch.getResultCount() - 1) / theQuery.itemsPerPage()));
for (int i = 0; i < numberofpages; i++) {
if (i == thispage) {
resnav.append("<li class=\"active\"><a href=\"#\">");
resnav.append(i + 1);
resnav.append("</a></li>");
} else {
resnav.append("<li><a href=\"");
resnav.append(QueryParams.navurl("html", i, theQuery, null).toString());
resnav.append("\">" + (i + 1) + "</a></li>");
}
}
if (thispage >= numberofpages) {
resnav.append("<li><a href=\"#\">&raquo;</a></li>");
} else {
resnav.append("<li><a id=\"nextpage\" href=\"");
resnav.append(QueryParams.navurl("html", thispage + 1, theQuery, null).toString());
resnav.append("\">&raquo;</a>");
}
resnav.append("</ul>");
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);

@ -56,6 +56,5 @@
<script type="text/javascript">
statistics("#[offset]#", "#[itemscount]#", "#[itemsperpage]#", "#[totalcount]#", "#[localResourceSize]#", "#[remoteResourceSize]#", "#[remoteIndexCount]#", "#[remotePeerCount]#", "#[navurlBase]#");
progressbar.step(1);
</script>

@ -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);

@ -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;
}

@ -1,3 +1,33 @@
<script>
if (document.getElementById("progressbar").getAttribute('class') != "progress-bar progress-bar-success") {
document.getElementById("progressbar").setAttribute('style',"width:100%");
document.getElementById("progressbar").setAttribute('style',"transition:transform 0s;");
document.getElementById("progressbar").setAttribute('class',"progress-bar progress-bar-success");
window.setTimeout(fadeOutBar, 500);
}
</script>
#(resource-select)#::
<form action="yacysearch.html" method="get" accept-charset="UTF-8">
<input type="checkbox" name="resource-switch" value="local" data-size="large" style="width:100%" checked="checked" onchange="this.form.submit()">
<script>$("[name='resource-switch']").bootstrapSwitch();
$("[name='resource-switch']").bootstrapSwitch('onText', '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Peer-to-Peer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
$("[name='resource-switch']").bootstrapSwitch('offText', '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Stealth&nbsp;Mode&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');</script>
</form>
<!--
<span>Your search is done using peers in the YaCy P2P network. You can switch to 'Stealth Mode' which will switch off P2P, giving you full privacy. Expect less results then, because then only your own search index is used.</span>
-->
::
<form action="yacysearch.html" method="get" accept-charset="UTF-8">
<input type="checkbox" name="resource-switch" value="global" data-size="large" onchange="this.form.submit()">
<script>$("[name='resource-switch']").bootstrapSwitch();
$("[name='resource-switch']").bootstrapSwitch('onText', '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Peer-to-Peer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
$("[name='resource-switch']").bootstrapSwitch('offText', '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Stealth&nbsp;Mode&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');</script>
</form>
<!--
<span>Your search is done using only your own peer, locally. You can switch to 'Peer-to-Peer Mode' which will cause that your search is done using the other peers in the YaCy network.</span>
-->
#(/resource-select)#
#(cat-location)#::
<a href="yacysearch_location.html?query=#[queryenc]#">

@ -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++;

@ -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);
}
}
}

Loading…
Cancel
Save