added new buttons to search result page in p2p mode which show the

switch between p2p search and the 'stealth mode' which is simply a
non-p2p search within the p2p network. The functionality was there all
the time, but the switch to this was not very visible.
pull/1/head
Michael Peter Christen 12 years ago
parent 2b320313d9
commit 5132bf719c

@ -947,12 +947,6 @@ div#api {
z-index: 100;
}
div#yacylivesearch {
float:right;
margin-right: 90px;
margin-top: -27px;
}
div#api span {
display: none;
}
@ -961,9 +955,9 @@ div#api:hover span {
display: block;
position: absolute;
font-size:1em;
top: 40px;
left: -170px; /* 30 - width */
width: 200px;
top: 48px;
left: -200px; /* 30 - width */
width: 160px;
padding: 3px;
color: #000000;
background: #DDDDDD;
@ -972,6 +966,39 @@ div#api:hover span {
z-index: 100;
}
div#searchmode {
position:absolute;
top:51px;
right:20px;
z-index: 100;
}
div#searchmode span {
display: none;
}
div#searchmode:hover span {
display: block;
position: absolute;
font-size:1em;
top: 1px;
left: -169px; /* 30 - width */
width: 160px;
padding: 3px;
color: #000000;
background: #DDDDDD;
text-align: center;
border: 1px dashed black;
z-index: 100;
}
div#yacylivesearch {
float:right;
margin-right: 90px;
margin-top: -27px;
}
div#info {
float:left;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

@ -91,8 +91,13 @@
#(resource-select)#::
<td><label for="resource">Resource</label>:</td>
<td>
<input type="radio" name="resource" id="rglobal" value="global" #(global)#::checked="checked"#(/global)# #(global-disabled)#::disabled="disabled"#(/global-disabled)#/><label for="rglobal">the peer-to-peer network</label>
<input type="radio" name="resource" id="rlocal" value="local" #(local)#::checked="checked"#(/local)#/><label for="rlocal">only the local index</label>
<input type="radio" name="resource" id="rglobal" value="global" checked="checked" /><label for="rglobal">the peer-to-peer network</label>
<input type="radio" name="resource" id="rlocal" value="local"><label for="rlocal">only the local index</label>
</td>::
<td><label for="resource">Resource</label>:</td>
<td>
<input type="radio" name="resource" id="rglobal" value="global"/><label for="rglobal">the peer-to-peer network</label>
<input type="radio" name="resource" id="rlocal" value="local" checked="checked"/><label for="rlocal">only the local index</label>
</td>
#(/resource-select)#
</tr>

@ -102,10 +102,7 @@ public class index {
prop.put("searchoptions_count-10", (count == 10) ? "1" : "0");
prop.put("searchoptions_count-50", (count == 50) ? "1" : "0");
prop.put("searchoptions_count-100", (count == 100) ? "1" : "0");
prop.put("searchoptions_resource-select", (sb.peers == null || sb.peers.sizeConnected() == 0 || !global) ? 0 : 1);
prop.put("searchoptions_resource-select_global", global ? "1" : "0");
prop.put("searchoptions_resource-select_global-disabled", indexReceiveGranted ? "0" : "1");
prop.put("searchoptions_resource-select_local", global ? "0" : "1");
prop.put("searchoptions_resource-select", (sb.peers == null || sb.peers.sizeConnected() == 0 || !indexReceiveGranted) ? 0 : global ? 1 : 2);
prop.put("searchoptions_prefermaskoptions", "0");
prop.putHTML("searchoptions_prefermaskoptions_prefermaskfilter", prefermaskfilter);
prop.put("searchoptions_indexofChecked", "");

@ -77,6 +77,17 @@ The query format is similar to <a href="http://www.loc.gov/standards/sru/">SRU</
Click the API icon to see an example call to the search rss API.
To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de/wiki/index.php/Dev:API">API wiki page</a>.</span>
</div>
#(resource-select)#::
<div id="searchmode">
<a href="yacysearch.html?resource=local"><img src="env/grafics/searchmode_p2p_activated_32.png" width="91" height="32"/></a><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 cause that your search is only done in your own peer, giving you full privacy.</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/>
<a href="yacysearch.html?resource=global"><img src="env/grafics/searchmode_stealth_activated_32.png" width="91" height="32"/></a>
<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%#
#(/topmenu)#
<script type="text/javascript">

@ -153,6 +153,13 @@ public class yacysearch {
prop.put("searchBaseURL", "http://" + hostName + "/yacysearch.html");
prop.put("rssYacyImageURL", "http://" + hostName + "/env/grafics/yacy.gif");
prop.put("thisaddress", hostName);
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, true)
|| sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_AUTODISABLED, true)
|| clustersearch;
boolean global = post == null || (post.get("resource", "local").equals("global") && sb.peers.sizeConnected() > 0 && indexReceiveGranted);
prop.put("topmenu_resource-select", (sb.peers == null || sb.peers.sizeConnected() == 0 || !indexReceiveGranted) ? 0 : global ? 1 : 2);
if ( post == null || indexSegment == null || env == null || !searchAllowed ) {
// we create empty entries for template strings
@ -222,7 +229,6 @@ public class yacysearch {
post.getInt("maximumRecords", post.getInt("count", post.getInt("rows", 10)))); // SRU syntax with old property as alternative
int startRecord = post.getInt("startRecord", post.getInt("offset", post.getInt("start", 0)));
boolean global = post.get("resource", "local").equals("global") && sb.peers.sizeConnected() > 0;
final boolean indexof = (post != null && post.get("indexof", "").equals("on"));
String prefermask = (post == null) ? "" : post.get("prefermaskfilter", "");
@ -240,12 +246,6 @@ public class yacysearch {
}
// SEARCH
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, true)
|| sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_AUTODISABLED, true)
|| clustersearch;
global = global && indexReceiveGranted; // if the user does not want indexes from remote peers, it cannot be a global searchnn
final boolean intranetMode = sb.isIntranetMode() || sb.isAllIPMode();
// increase search statistic counter

Loading…
Cancel
Save