*)added offline-browsing-support (onlineMode=0)

*)online-mode now can be changed in Status.html

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1010 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
hydrox 2005-10-31 12:25:40 +00:00
parent 4d1e56e4d9
commit 295aff52a3
7 changed files with 61 additions and 11 deletions

View File

@ -138,7 +138,11 @@ Seed Upload method was changed successfully.
<p><b>Port Forwarding Settings changed, but something is wrong.</b></p>
<p><font color="red">#[errormsg]#</font></p>
Port Forwarding was deactivated automatically.<br>
Please return to the settings page and modify the data.<br>
Please return to the settings page and modify the data.<br>
::<!-- 24 -->
You are now <b>event-based online</b>. After a short while you should see the effect on the <a href="Status.html">status</a> page.<br>
::<!-- 25 -->
You are now in <b>Cache Mode</b>. Only Proxy-cache ist available in this mode. After a short while you should see the effect on the <a href="Status.html">status</a> page.<br>
#(/info)#
</p>
<p>You can now go back to the <a href="Settings_p.html">Settings</a> page if you want to make more changes.</p>

View File

@ -297,10 +297,25 @@ public class SettingsAck_p {
if (post.containsKey("pmode")) {
env.setConfig("onlineMode", "2");
prop.put("info", 11);//permanent online mode
yacyCore.setOnlineMode(2);
yacyCore.triggerOnlineAction();
return prop;
}
if (post.containsKey("emode")) {
env.setConfig("onlineMode", "1");
prop.put("info", 24);//event-based online mode
yacyCore.setOnlineMode(1);
return prop;
}
if (post.containsKey("cmode")) {
env.setConfig("onlineMode", "0");
prop.put("info", 25);//cache mode
yacyCore.setOnlineMode(0);
return prop;
}
if (post.containsKey("generalsettings")) {
/*
// set peer language

View File

@ -78,18 +78,30 @@ Last upload: #[lastUpload]# ago.
</td></tr>
<tr class="TableCellLight"><td>Online-mode</td><td>
#(omode)#
<!-- online Mode 0 -->
You are in <i>Cache-browsing</i> mode.<br>
Only Website from the Proxycache are accessable.
To switch online-mode, press one of the following buttons:
<form action="SettingsAck_p.html" method="get">
<input type="submit" name="emode" value="event-based Mode">
<input type="submit" name="pmode" value="Permanent Mode">
</form>
::
You are in <i>event-based</i> online mode.<br>
The YaCy p2p network will boot when you start using the proxy or you switch to permanent mode.
Attention: Using the proxy in permanent mode will keep your internet connection online as long as YaCy runs.
Use this only if you have a flatrate or you have an always-on connection.
To start permanent mode, press this button:
To switch online-mode, press one of the following buttons:
<form action="SettingsAck_p.html" method="get">
<input type="submit" name="pmode" value="Go on-line">
<input type="submit" name="cmode" value="Go to Cache-Mode">
</form>
::
You are in <i>permanent</i> mode. Attention: If you don't have a flatrate or are always-on, you must switch off the proxy to go off-line.
To switch online-mode, press one of the following buttons:
<form action="SettingsAck_p.html" method="get">
<input type="submit" name="emode" value="event-based Mode">
<input type="submit" name="cmode" value="Go to Cache-Mode">
</form>
#(/omode)#
</td></tr>
</table>
@ -100,4 +112,4 @@ You are in <i>permanent</i> mode. Attention: If you don't have a flatrate or are
#[footer]#
</body>
</html>
</html>

View File

@ -225,9 +225,11 @@ public class Status {
prop.put("popup", 1);
}
if (env.getConfig("onlineMode", "1").equals("1")) {
prop.put("omode", 1);
} else {
if (env.getConfig("onlineMode", "1").equals("0")) {
prop.put("omode", 0);
} else if (env.getConfig("onlineMode", "1").equals("1")) {
prop.put("omode", 1);
} else {
prop.put("omode", 2);
}

View File

@ -409,8 +409,15 @@ public final class httpdProxyHandler extends httpdAbstractHandler implements htt
null, // initiator
switchboard.defaultProxyProfile // profile
);
if (cacheExists && cacheEntry.shallUseCacheForProxy()) {
if (yacyCore.getOnlineMode() == 0) {
if (cacheExists) {
fulfillRequestFromCache(conProp,url,ext,requestHeader,cachedResponseHeader,cacheFile,respond);
}
else {
httpd.sendRespondError(conProp,respond,4,404,null,"URL not availabe in Cache",null);
}
}
else if (cacheExists && cacheEntry.shallUseCacheForProxy()) {
fulfillRequestFromCache(conProp,url,ext,requestHeader,cachedResponseHeader,cacheFile,respond);
} else {
fulfillRequestFromWeb(conProp,url,ext,requestHeader,cachedResponseHeader,cacheFile,respond);

View File

@ -105,7 +105,7 @@ public class yacyCore {
private String lastSeedUpload_myPeerType = "";
private String lastSeedUpload_myIP = "";
private int onlineMode = 1;
private static int onlineMode = 1;
private plasmaSwitchboard switchboard;
private static TimeZone GMTTimeZone = TimeZone.getTimeZone("America/Los_Angeles");
@ -221,6 +221,15 @@ public class yacyCore {
return ((onlineMode == 2) || ((System.currentTimeMillis() - lastOnlineTime) < 10000));
}
public static int getOnlineMode() {
return onlineMode;
}
public static void setOnlineMode(int newOnlineMode) {
onlineMode = newOnlineMode;
return;
}
public void loadSeeds() {
//new Thread(new vprobe()).start();
peerActions.loadSeedLists(); // start to bootstrap the network here
@ -716,4 +725,4 @@ public class yacyCore {
}
}
}
}

View File

@ -287,6 +287,7 @@ peerName=anomic
peerCycle=2
# The p2p maintenance can run in either of two online modes:
# - don't process jobs and only access available in cache -> mode 0
# - process any job only if we are online, which is technically only the case
# if the proxy is used -> mode 1
# - process jobs periodically, with periodes according to peerCycle -> mode 2