- added stealth button to navigation menu

- more fixes to progress bar
pull/1/head
Michael Peter Christen 11 years ago
parent f0f22e68bb
commit d1091e79f8

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

@ -157,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");
@ -762,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) {

@ -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,22 +619,29 @@ 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 (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);
}
}
}
sb.append("&maximumRecords=");
sb.append(theQuery.itemsPerPage());

Loading…
Cancel
Save