Add menu entries for urlproxy / augmented browsing

This commit is contained in:
cominch 2012-01-19 14:24:17 +01:00 committed by Michael Peter Christen
parent a32943b382
commit 1626be7916
6 changed files with 314 additions and 0 deletions

View File

@ -0,0 +1,90 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>YaCy '#[clientname]#': Augmented Browsing - Filters and Modules</title>
#%env/templates/metas.template%#
</head>
<body id="Settings">
#%env/templates/header.template%#
#%env/templates/submenuAugmentation.template%#
<h2>Augmented Browsing - Filters and Modules</h2>
<form id="augmentationFilters" action="AugmentedBrowsingFilters_p.html" method="post" enctype="multipart/form-data">
<fieldset><legend id="urlproxy">Augmented Browsing Filters</legend>
<p>
Select the desired functionality.
</p>
<dl>
<dt><label for="content">External REFLECT:</label></dt>
<dd>
<input type="checkbox" name="augmentedReflect" id="augmentedReflect" #(augmentedReflect_checked)#:: checked="checked"#(/augmentedReflect_checked)# />Enabled<br/>
<p class="help">
Send webpages to REFLECT (<a href="http://reflect.ws/" target="_blank">http://reflect.ws/</a>)
</p>
</dd>
</dl>
<p>
Select the desired inbuilt functionality
</p>
<dl>
<dt><label for="content">Add DOCTYPE:</label></dt>
<dd>
<input type="checkbox" name="augmentedAddDoctype" id="augmentedAddDoctype" #(augmentedAddDoctype_checked)#:: checked="checked"#(/augmentedAddDoctype_checked)# />Enabled<br/>
<p class="help">
Add DOCTYPE information if not given. This is required for IE to render position:absolute correctly.
</p>
</dd>
<dt><label for="content">Reparse webpage:</label></dt>
<dd>
<input type="checkbox" name="augmentedReparse" id="augmentedReparse" #(augmentedReparse_checked)#:: checked="checked"#(/augmentedReparse_checked)# />Enabled<br/>
<p class="help">
Put webpage back into schema (htmlparser document) to allow node by node manipulation.
</p>
</dd>
<!-- <dt><label for="content">Add unique IDs to every node:</label></dt>
<dd>
<input type="checkbox" name="augmentedReparseAdduniqueid" id="augmentedReparseAdduniqueid" #(augmentedReparseAdduniqueid_checked)#:: checked="checked"#(/augmentedReparseAdduniqueid_checked)# />Enabled<br/>
<p class="help">
Requires webpage reparsing.
</p>
</dd>
<dt><label for="content">Add sciencenet domain info:</label></dt>
<dd>
<input type="checkbox" name="augmentedReparseAddserver" id="augmentedReparseAddserver" #(augmentedReparseAddserver_checked)#:: checked="checked"#(/augmentedReparseAddserver_checked)# />Enabled<br/>
<p class="help">
Requires webpage reparsing.
</p>
</dd>
<dt><label for="content">Add RDF from DB:</label></dt>
<dd>
<input type="checkbox" name="augmentedReparseAddrdf" id="augmentedReparseAddrdf" #(augmentedReparseAddrdf_checked)#:: checked="checked"#(/augmentedReparseAddrdf_checked)# />Enabled<br/>
<p class="help">
Requires webpage reparsing.
</p>
</dd> -->
</dl>
<input type="submit" name="augmentationFiltersSettings" value="Submit"/>
</fieldset>
</form>
#%env/templates/footer.template%#
</body>
</html>

View File

@ -0,0 +1,63 @@
import net.yacy.cora.protocol.RequestHeader;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public final class AugmentedBrowsingFilters_p {
public static serverObjects respond(final RequestHeader header,
final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
if (post != null) {
if (post.containsKey("augmentationFiltersSettings")) {
env.setConfig("augmentation.reflect", "on".equals(post
.get("augmentedReflect")) ? true : false);
env.setConfig("augmentation.addDoctype", "on".equals(post
.get("augmentedAddDoctype")) ? true : false);
env.setConfig("augmentation.reparse", "on".equals(post
.get("augmentedReparse")) ? true : false);
// env.setConfig("augmentation.reparse.adduniqueid", "on".equals(post
// .get("augmentedReparseAdduniqueid")) ? true : false);
//
// env.setConfig("augmentation.reparse.addserverinfo", "on".equals(post
// .get("augmentedReparseAddserver")) ? true : false);
//
// env.setConfig("augmentation.reparse.addrdf", "on".equals(post
// .get("augmentedReparseAddrdf")) ? true : false);
}
}
prop.put("augmentedReflect_checked",
env.getConfigBool("augmentation.reflect", false) ? "1" : "0");
prop.put("augmentedAddDoctype_checked",
env.getConfigBool("augmentation.addDoctype", true) ? "1" : "0");
prop.put("augmentedReparse_checked",
env.getConfigBool("augmentation.reparse", true) ? "1" : "0");
// prop.put("augmentedReparseAdduniqueid_checked",
// env.getConfigBool("augmentation.reparse.adduniqueid", true) ? "1" : "0");
//
// prop.put("augmentedReparseAddserver_checked",
// env.getConfigBool("augmentation.reparse.addserverinfo", true) ? "1" : "0");
//
// prop.put("augmentedReparseAddrdf_checked",
// env.getConfigBool("augmentation.reparse.addrdf", true) ? "1" : "0");
// return rewrite properties
return prop;
}
}

View File

@ -0,0 +1,91 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>YaCy '#[clientname]#': Augmented Browsing</title>
#%env/templates/metas.template%#
</head>
<body id="Settings">
#%env/templates/header.template%#
#%env/templates/submenuAugmentation.template%#
<h2>Augmented Browsing</h2>
<form id="parsersettings" action="AugmentedBrowsing_p.html" method="post" enctype="multipart/form-data">
<fieldset><legend id="urlproxy">URL Proxy Settings</legend>
<p>
With this settings you can activate or deactivate URL proxy which is the method used for augmentation.
Service call: http://localhost:8080/proxy.html?url=parameter, where parameter is the url of an external web page.
</p>
<dl>
<dt><label for="content">URL proxy:</label></dt>
<dd>
<input type="checkbox" name="urlproxyenabled" id="urlproxyenabled" #(urlproxyenabled_checked)#:: checked="checked"#(/urlproxyenabled_checked)# />Enabled<br/>
<p class="help">
Globally enables or disables URL proxy via http://yourpeer:yourport/proxy.html?url=http://externalurl/
</p>
</dd>
<dt><label for="content">Show search results via URL proxy:</label></dt>
<dd>
<input type="checkbox" name="urlproxyuseforresults" id="urlproxyuseforresults" #(urlproxyuseforresults_checked)#:: checked="checked"#(/urlproxyuseforresults_checked)# />Enabled<br/>
<p class="help">
Enables or disables URL proxy for all search results. If enabled, all search results will be tunneled through URL proxy.
</p>
</dd>
<dt><label for="author">Restrict URL proxy use:</label></dt>
<dd>
<input type="text" name="urlproxyfilter" value="#[urlproxyfilter]#" size="60" /><br/><br/>
<p class="help">
Define client filter. Default: 127.0.0.1,0:0:0:0:0:0:0:1.
</p>
</dd>
<dt><label for="subject">URL substitution:</label></dt>
<dd>
<input type="text" name="urlproxydomains" value="#[urlproxydomains]#" size="60" /><br/><br/>
<p class="help">
Define URL substitution rules which allow navigating in proxy environment. Possible values: all, domainlist. Default: domainlist.
</p>
</dd>
</dl>
<input type="submit" name="urlproxySettings" value="Submit"/>
</fieldset>
</form>
<form id="parsersettings" action="AugmentedBrowsing_p.html" method="post" enctype="multipart/form-data">
<fieldset><legend id="augmentation">Augmented Browsing Settings</legend>
<p>
With this settings you can activate or deactivate augmented browsing which happens usually via the URL proxy.
</p>
<dl>
<dt><label for="content">Augmented Browsing:</label></dt>
<dd>
<input type="checkbox" name="augmentationenabled" id="augmentationenabled" #(augmentationenabled_checked)#:: checked="checked"#(/augmentationenabled_checked)# />Enabled<br/>
<p class="help">
Enables or disables augmented browsing. If enabled, all websites will be modified during loading.
</p>
</dd>
</dl>
<input type="submit" name="augmentationSettings" value="Submit"/>
</fieldset>
</form>
#%env/templates/footer.template%#
</body>
</html>

View File

@ -0,0 +1,57 @@
import net.yacy.cora.protocol.RequestHeader;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public final class AugmentedBrowsing_p {
public static serverObjects respond(final RequestHeader header,
final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
if (post != null) {
if (post.containsKey("urlproxySettings")) {
env.setConfig("proxyURL.access", post.get("urlproxyfilter"));
env.setConfig("proxyURL.rewriteURLs",
post.get("urlproxydomains"));
env.setConfig("proxyURL",
"on".equals(post.get("urlproxyenabled")) ? true : false);
env.setConfig("proxyURL.useforresults",
"on".equals(post.get("urlproxyuseforresults")) ? true : false);
}
if (post.containsKey("augmentationSettings")) {
env.setConfig("proxyAugmentation", "on".equals(post
.get("augmentationenabled")) ? true : false);
}
}
prop.putHTML("urlproxyfilter",
env.getConfig("proxyURL.access", "127.0.0.1,0:0:0:0:0:0:0:1"));
prop.putHTML("urlproxydomains",
env.getConfig("proxyURL.rewriteURLs", "domainlist"));
prop.put("urlproxyenabled_checked",
env.getConfigBool("proxyURL", false) ? "1" : "0");
prop.put("urlproxyuseforresults_checked",
env.getConfigBool("proxyURL.useforresults", false) ? "1" : "0");
prop.put("augmentationenabled_checked",
env.getConfigBool("proxyAugmentation", false) ? "1" : "0");
// return rewrite properties
return prop;
}
}

View File

@ -23,6 +23,12 @@
<li><a href="/Wiki.html?display=1" class="MenuItemLink">Local Peer Wiki</a></li>
</ul>
</li>
<li class="menugroup" id="menugroupInteraction">
<h3>Interaction</h3>
<ul class="menu">
<li><a href="/AugmentedBrowsing_p.html" class="MenuItemLink">Augmented Browsing</a></li>
</ul>
</li>
<li class="menugroup" id="menugroupCrawlerControl">
<h3>Index&nbsp;Production</h3>
<ul class="menu">

View File

@ -0,0 +1,7 @@
<div class="SubMenu">
<h3>Augmented Browsing</h3>
<ul class="SubMenu">
<li><a href="/AugmentedBrowsing_p.html" class="MenuItemLink lock">Augmented Browsing</a></li>
<li><a href="/AugmentedBrowsingFilters_p.html" class="MenuItemLink lock">Filters and Modules</a></li>
</ul>
</div>