show location nav as selectable nav in search page layout

- switch automatically on upon load of geodata provider
- but allow switch on also without geodata file (and display the location nav if search result has lat/lon location)
This commit is contained in:
reger 2015-04-02 02:10:00 +02:00
parent 5bc1e5cfbf
commit c59ebde083
4 changed files with 20 additions and 3 deletions

View File

@ -96,6 +96,12 @@
</div>
</td>
</tr>
<tr>
<td><input type="checkbox" name="search.navigation.location" value="true" #(search.navigation.location)#::checked="checked" #(/search.navigation.location)# /></td>
<td><ul class="nav nav-sidebar menugroup" id="sidebarLocation" style="padding-left:15px; padding-right:10px;">
<li><h3>Location</h3></li>
</ul></td>
</tr>
<tr>
<td><input type="checkbox" name="search.navigation.protocol" value="true" #(search.navigation.protocol)#::checked="checked" #(/search.navigation.protocol)# /></td>
<td><ul class="nav nav-sidebar menugroup" id="sidebarProtocols" style="padding-left:15px; padding-right:10px;">

View File

@ -35,6 +35,7 @@ import net.yacy.cora.date.GenericFormatter;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.util.ConcurrentLog;
import net.yacy.data.WorkTables;
import net.yacy.document.LibraryProvider;
import net.yacy.search.Switchboard;
import net.yacy.search.SwitchboardConstants;
import net.yacy.server.serverObjects;
@ -80,6 +81,7 @@ public class ConfigSearchPage_p {
// construct navigation String
String nav = "";
if (post.getBoolean("search.navigation.location")) nav += "location,";
if (post.getBoolean("search.navigation.filetype")) nav += "filetype,";
if (post.getBoolean("search.navigation.protocol")) nav += "protocol,";
if (post.getBoolean("search.navigation.hosts")) nav += "hosts,";
@ -159,6 +161,7 @@ public class ConfigSearchPage_p {
prop.put("search.result.show.proxy", sb.getConfigBool("search.result.show.proxy", false) ? 1 : 0);
prop.put("search.result.show.hostbrowser", sb.getConfigBool("search.result.show.hostbrowser", false) ? 1 : 0);
prop.put("search.navigation.location", sb.getConfig("search.navigation", "").indexOf("location",0) >= 0 ? 1 : 0);
prop.put("search.navigation.filetype", sb.getConfig("search.navigation", "").indexOf("filetype",0) >= 0 ? 1 : 0);
prop.put("search.navigation.protocol", sb.getConfig("search.navigation", "").indexOf("protocol",0) >= 0 ? 1 : 0);
prop.put("search.navigation.hosts", sb.getConfig("search.navigation", "").indexOf("hosts",0) >= 0 ? 1 : 0);

View File

@ -76,6 +76,8 @@ public class DictionaryLoader_p {
LibraryProvider.autotagging.addPlaces(LibraryProvider.geoLoc);
prop.put("geon0Status", LibraryProvider.Dictionary.GEON0.file().exists() ? 1 : 0);
prop.put("geon0ActionLoaded", 1);
final String nav = sb.getConfig("search.navigation", "");
if (nav.indexOf("location") < 0) sb.setConfig("search.navigation", "location,"+nav);
} catch (final MalformedURLException e) {
ConcurrentLog.logException(e);
prop.put("geon0ActionLoaded", 2);
@ -118,6 +120,8 @@ public class DictionaryLoader_p {
LibraryProvider.autotagging.addPlaces(LibraryProvider.geoLoc);
prop.put("geon1Status", LibraryProvider.Dictionary.GEON1.file().exists() ? 1 : 0);
prop.put("geon1ActionLoaded", 1);
final String nav = sb.getConfig("search.navigation", "");
if (nav.indexOf("location") < 0) sb.setConfig("search.navigation", "location,"+nav);
} catch (final MalformedURLException e) {
ConcurrentLog.logException(e);
prop.put("geon1ActionLoaded", 2);
@ -160,6 +164,8 @@ public class DictionaryLoader_p {
LibraryProvider.autotagging.addPlaces(LibraryProvider.geoLoc);
prop.put("geon2Status", LibraryProvider.Dictionary.GEON2.file().exists() ? 1 : 0);
prop.put("geon2ActionLoaded", 1);
final String nav = sb.getConfig("search.navigation", "");
if (nav.indexOf("location") < 0) sb.setConfig("search.navigation", "location,"+nav);
} catch (final MalformedURLException e) {
ConcurrentLog.logException(e);
prop.put("geon2ActionLoaded", 2);
@ -203,6 +209,8 @@ public class DictionaryLoader_p {
LibraryProvider.autotagging.addPlaces(LibraryProvider.geoLoc);
prop.put("geo1Status", LibraryProvider.Dictionary.GEODB1.file().exists() ? 1 : 0);
prop.put("geo1ActionLoaded", 1);
final String nav = sb.getConfig("search.navigation", "");
if (nav.indexOf("location") < 0) sb.setConfig("search.navigation", "location,"+nav);
} catch (final MalformedURLException e) {
ConcurrentLog.logException(e);
prop.put("geo1ActionLoaded", 2);

View File

@ -530,9 +530,9 @@ public class yacysearchtrailer {
}
// category: location search
// show only if there is a location database present and if there had been any search results
if ((LibraryProvider.geoLoc.isEmpty() || theSearch.getResultCount() == 0) &&
(theSearch.locationNavigator == null || theSearch.locationNavigator.isEmpty())) {
// show only if active and there is a location database present or if there had been any search results (with lat/lon)
if (theSearch.locationNavigator == null
|| ((LibraryProvider.geoLoc.isEmpty() || theSearch.getResultCount() == 0) && theSearch.locationNavigator.isEmpty())) {
prop.put("cat-location", 0);
} else {
prop.put("cat-location", 1);