added tutorial mode - some menu items will only appear if you 'qualify'

for them. Thus, the first-time user will only see four menu items. The
other items will unfold as the user interacts.
This commit is contained in:
Michael Peter Christen 2014-04-02 02:33:17 +02:00
parent 7a49f72480
commit 39b641d6cd
4 changed files with 50 additions and 37 deletions

View File

@ -76,6 +76,7 @@ server.https=false
# if the used missed configuration steps that should be done, then a help system
# is possible which leads the used based on the list of servlets that had been used
# the list distinguishes called and submitted servlets
server.servlets.called =
server.servlets.submitted =
# server tracking: maximum time a track entry is hold in the internal cache
@ -1208,7 +1209,6 @@ interaction.autocrawler.categoryfilter = .*
browser.autoload = false
browser.load4everyone = false
# greedy learning: fast information acquisition heuristic for new peers
# to make greedy learning work, it must be enabled in the network definition
# the user may switch it off at any time, but if the automatic learning limit is reached
@ -1218,3 +1218,7 @@ browser.load4everyone = false
# with some heuristics like: loading linked documents and adding a twitter search.
# When the learning mode is finished, the user may switch on individual heuristics by himself.
greedylearning.active = true
# postprocessing parametrization
postprocessing.clickdepth.maxtime = 100
postprocessing.clickdepth.maxdepth = 6

View File

@ -62,9 +62,7 @@ public class Status
// check if the basic configuration was accessed before and forward
prop.put("forwardToConfigBasic", 0);
if ( (post == null || !post.containsKey("noforward"))
&& sb.getConfig("server.servlets.submitted", "").indexOf("ConfigBasic.html", 0) < 0
&& Seed.isDefaultPeerName(sb.peers.mySeed().getName()) ) {
if ((post == null || !post.containsKey("noforward")) && sb.getConfig("server.servlets.called", "").indexOf("ConfigBasic.html", 0) < 0) {
// forward to ConfigBasic
prop.put("forwardToConfigBasic", 1);
}

View File

@ -75,21 +75,20 @@
<ul class="nav nav-sidebar menugroup">
<li><h3>Monitoring</h3></li>
<li><a href="Status.html" class="MenuItemLink">System Status</a></li>
<li><a href="Network.html" accesskey="w" class="MenuItemLink">YaCy Peer-to-Peer Network</a></li>
<li><a href="HostBrowser.html?admin=true&hosts=" class="MenuItemLink">Web Visualization</a></li>
<li><a href="Crawler_p.html" class="MenuItemLink lock">Crawler Monitor</a></li>
<li><a href="AccessGrid_p.html" class="MenuItemLink lock">Network Access</a></li>
#(navigation-p2p)#::<li><a href="Network.html" accesskey="w" class="MenuItemLink">Peer-to-Peer Network</a></li>#(/navigation-p2p)#
#(navigation-advanced)#::<li><a href="AccessGrid_p.html" class="MenuItemLink lock">Network Access</a></li>#(/navigation-advanced)#
#(navigation-crawlmonitor)#::<li><a href="HostBrowser.html?admin=true&hosts=" class="MenuItemLink">Web Visualization</a></li>#(/navigation-crawlmonitor)#
#(navigation-crawlmonitor)#::<li><a href="Crawler_p.html" class="MenuItemLink lock">Crawler Monitor</a></li>#(/navigation-crawlmonitor)#
<!-- <li><a href="terminal_p.html" accesskey="t" class="MenuItemLink lock">Terminal</a></li> -->
</ul>
#(navigation-advanced)#::
<ul class="nav nav-sidebar menugroup">
<li><h3>Production</h3></li>
<li><a href="CrawlStartExpert.html" class="MenuItemLink">Advanced Crawler</a></li>
<li><a href="Load_RSS_p.html" class="MenuItemLink lock">Content Importer</a></li>
<li><a href="Table_API_p.html" class="MenuItemLink lock">Process Scheduler</a></li>
<li><a href="Tables_p.html?table=robots&count=100" class="MenuItemLink lock">Target Analysis</a></li>
<li><a href="Table_API_p.html" class="MenuItemLink lock">Process Scheduler</a></li>
</ul>
<ul class="nav nav-sidebar menugroup">
<li><h3>Administration</h3></li>
<li><a href="Settings_p.html" class="MenuItemLink lock">System Administration</a></li>
@ -103,6 +102,7 @@
<li><a href="ConfigAppearance_p.html" class="MenuItemLink lock">Design</a></li>
<li><a href="RankingSolr_p.html" class="MenuItemLink lock">Ranking and Heuristics</a></li>
</ul>
#(/navigation-advanced)#
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">

View File

@ -137,8 +137,9 @@ public class YaCyDefaultServlet extends HttpServlet {
/* ------------------------------------------------------------ */
@Override
public void init() throws UnavailableException {
_htDocsPath = Switchboard.getSwitchboard().htDocsPath;
_htLocalePath = Switchboard.getSwitchboard().getDataPath("locale.translated_html", "DATA/LOCALE/htroot");
Switchboard sb = Switchboard.getSwitchboard();
_htDocsPath = sb.htDocsPath;
_htLocalePath = sb.getDataPath("locale.translated_html", "DATA/LOCALE/htroot");
_servletContext = getServletContext();
@ -160,7 +161,7 @@ public class YaCyDefaultServlet extends HttpServlet {
if (rb != null) {
_resourceBase = Resource.newResource(rb);
} else {
_resourceBase = Resource.newResource(Switchboard.getSwitchboard().getConfig(SwitchboardConstants.HTROOT_PATH, SwitchboardConstants.HTROOT_PATH_DEFAULT)); //default
_resourceBase = Resource.newResource(sb.getConfig(SwitchboardConstants.HTROOT_PATH, SwitchboardConstants.HTROOT_PATH_DEFAULT)); //default
}
} catch (IOException e) {
ConcurrentLog.severe("FILEHANDLER", "YaCyDefaultServlet: resource base (htRootPath) missing");
@ -601,9 +602,7 @@ public class YaCyDefaultServlet extends HttpServlet {
}
}
if (in != null) {
in.close();
}
if (in != null) in.close();
multi.close();
}
}
@ -646,7 +645,7 @@ public class YaCyDefaultServlet extends HttpServlet {
legacyRequestHeader.put(HeaderFramework.CONNECTION_PROP_CLIENTIP, request.getRemoteAddr());
legacyRequestHeader.put(HeaderFramework.CONNECTION_PROP_PATH, target);
legacyRequestHeader.put(HeaderFramework.CONNECTION_PROP_EXT, targetExt);
Switchboard sb = Switchboard.getSwitchboard();
if (legacyRequestHeader.containsKey(RequestHeader.AUTHORIZATION)) {
if (HttpServletRequest.BASIC_AUTH.equalsIgnoreCase(request.getAuthType())) {
} else {
@ -654,14 +653,14 @@ public class YaCyDefaultServlet extends HttpServlet {
if (request.getUserPrincipal() != null) {
String userpassEncoded = request.getHeader(RequestHeader.AUTHORIZATION); // e.g. "Basic AdminMD5hash"
if (userpassEncoded != null) {
if (request.isUserInRole(AccessRight.ADMIN_RIGHT.toString()) && !Switchboard.getSwitchboard().getConfig(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5,"").isEmpty()) {
if (request.isUserInRole(AccessRight.ADMIN_RIGHT.toString()) && !sb.getConfig(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5,"").isEmpty()) {
// fake admin authentication for legacyRequestHeader (as e.g. DIGEST is not supported by legacyRequestHeader)
legacyRequestHeader.put(RequestHeader.AUTHORIZATION, HttpServletRequest.BASIC_AUTH + " "
+ Switchboard.getSwitchboard().getConfig(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5, ""));
+ sb.getConfig(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5, ""));
} else {
// fake Basic auth header for Digest auth (Basic username:md5pwdhash)
String username = request.getRemoteUser();
Entry user = Switchboard.getSwitchboard().userDB.getEntry(username);
Entry user = sb.userDB.getEntry(username);
if (user != null) {
legacyRequestHeader.put(RequestHeader.AUTHORIZATION, HttpServletRequest.BASIC_AUTH + " "
+ username + ":" + user.getMD5EncodedUserPwd());
@ -756,7 +755,7 @@ public class YaCyDefaultServlet extends HttpServlet {
HttpServletResponse response) throws IOException, ServletException {
Switchboard sb = Switchboard.getSwitchboard();
String localeSelection = Switchboard.getSwitchboard().getConfig("locale.language", "default");
String localeSelection = sb.getConfig("locale.language", "default");
File targetFile = getLocalizedFile(target, localeSelection);
File targetClass = rewriteClassFile(_resourceBase.addPath(target).getFile());
String targetExt = target.substring(target.lastIndexOf('.') + 1);
@ -876,21 +875,27 @@ public class YaCyDefaultServlet extends HttpServlet {
response.setStatus(HttpServletResponse.SC_FOUND);
return;
}
// add the application version, the uptime and the client name to every rewrite table
templatePatterns.put(servletProperties.PEER_STAT_VERSION, yacyBuildProperties.getVersion());
templatePatterns.put(servletProperties.PEER_STAT_UPTIME, ((System.currentTimeMillis() - serverCore.startupTime) / 1000) / 60); // uptime in minutes
templatePatterns.putHTML(servletProperties.PEER_STAT_CLIENTNAME, sb.peers.mySeed().getName());
templatePatterns.putHTML(servletProperties.PEER_STAT_CLIENTID, sb.peers.myID());
templatePatterns.put(servletProperties.PEER_STAT_MYTIME, GenericFormatter.SHORT_SECOND_FORMATTER.format());
Seed myPeer = sb.peers.mySeed();
templatePatterns.put("newpeer", myPeer.getAge() >= 1 ? 0 : 1);
templatePatterns.putHTML("newpeer_peerhash", myPeer.hash);
templatePatterns.put("p2p", sb.getConfigBool(SwitchboardConstants.DHT_ENABLED, true) || !sb.isRobinsonMode() ? 1 : 0);
templatePatterns.put(SwitchboardConstants.GREETING_HOMEPAGE, sb.getConfig(SwitchboardConstants.GREETING_HOMEPAGE, ""));
templatePatterns.put(SwitchboardConstants.GREETING_SMALL_IMAGE, sb.getConfig(SwitchboardConstants.GREETING_SMALL_IMAGE, ""));
if (targetFile.exists() && targetFile.isFile() && targetFile.canRead()) {
sb.setConfig("server.servlets.called", appendPath(sb.getConfig("server.servlets.called", ""), target));
if (args != null && args.size() > 0) sb.setConfig("server.servlets.submitted", appendPath(sb.getConfig("server.servlets.submitted", ""), target));
// add the application version, the uptime and the client name to every rewrite table
templatePatterns.put(servletProperties.PEER_STAT_VERSION, yacyBuildProperties.getVersion());
templatePatterns.put(servletProperties.PEER_STAT_UPTIME, ((System.currentTimeMillis() - serverCore.startupTime) / 1000) / 60); // uptime in minutes
templatePatterns.putHTML(servletProperties.PEER_STAT_CLIENTNAME, sb.peers.mySeed().getName());
templatePatterns.putHTML(servletProperties.PEER_STAT_CLIENTID, sb.peers.myID());
templatePatterns.put(servletProperties.PEER_STAT_MYTIME, GenericFormatter.SHORT_SECOND_FORMATTER.format());
Seed myPeer = sb.peers.mySeed();
templatePatterns.put("newpeer", myPeer.getAge() >= 1 ? 0 : 1);
templatePatterns.putHTML("newpeer_peerhash", myPeer.hash);
templatePatterns.put("navigation-p2p", sb.getConfigBool(SwitchboardConstants.DHT_ENABLED, true) || !sb.isRobinsonMode() ? 1 : 0);
templatePatterns.put("navigation-crawlmonitor", sb.getConfig("server.servlets.submitted", "").indexOf("Crawler_p") >= 0);
templatePatterns.put("navigation-advanced", sb.getConfig("server.servlets.submitted", "").indexOf("Config") >= 0 || sb.getConfig("server.servlets.called", "").indexOf("CrawlStart") >= 0);
templatePatterns.put(SwitchboardConstants.GREETING_HOMEPAGE, sb.getConfig(SwitchboardConstants.GREETING_HOMEPAGE, ""));
templatePatterns.put(SwitchboardConstants.GREETING_SMALL_IMAGE, sb.getConfig(SwitchboardConstants.GREETING_SMALL_IMAGE, ""));
String mimeType = Classification.ext2mime(targetExt, MimeTypes.TEXT_HTML);
InputStream fis;
@ -915,7 +920,13 @@ public class YaCyDefaultServlet extends HttpServlet {
}
}
}
private static final String appendPath(String proplist, String path) {
if (proplist.length() == 0) return path;
if (proplist.indexOf(path) >= 0) return proplist;
return proplist + "," + path;
}
/**
* parse SSI line and include resource (<!--#include virtual="file.html" -->)
*/