Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
tuning User.html FIXED: Now admin can logout ADDED: Nice Progressbar, representing your remaining onlinetime.
alloff476c19a5ae
diff --git a/htroot/User.html b/htroot/User.htmlindex 8b73f6030..f3b5f6c2d 100644--- a/htroot/User.html+++ b/htroot/User.html@@ -17,7 +17,9 @@ You are currently logged in as #[username]#.<br /><input type="submit" name="logout" value="logout"></form>#(limit)#::-You have used <i>#[timeused]#</i> minutes of your onlinetime limit of <i>#[timelimit]#</i> minutes per day.<br />+#{percent}#<img src="/env/grafics/red-bar.png">#{/percent}##{percent2}#<img src="/env/grafics/green-bar.png">#{/percent2}#+<br />+You have used <strong>#[timeused]#</strong> minutes of your onlinetime limit of <strong>#[timelimit]#</strong> minutes per day.<br />#(/limit)#<form action="User.html" method="POST"><table border="1">@@ -38,6 +40,11 @@ You have used <i>#[timeused]#</i> minutes of your onlinetime limit of <i>#[timel</form><p /><b>+::+You are currently logged in as admin.<br />+<form action="User.html">+ <input type="submit" name="logout" value="logout">+</form>#(/logged-in)##(status)#::diff --git a/htroot/User.java b/htroot/User.javaindex b48046c1f..555d0d317 100644--- a/htroot/User.java+++ b/htroot/User.java@@ -79,11 +79,20 @@ public class User{if(entry != null){prop.put("logged-in", 1);prop.put("logged-in_username", entry.getUserName());- if(entry.getTimeLimit().intValue() > 0){+ if(entry.getTimeLimit() > 0){prop.put("logged-in_limit", 1);- prop.put("logged-in_limit_timelimit", entry.getTimeLimit());- prop.put("logged-in_limit_timeused", entry.getTimeUsed());+ long limit=entry.getTimeLimit();+ long used=entry.getTimeUsed();+ prop.put("logged-in_limit_timelimit", limit);+ prop.put("logged-in_limit_timeused", used);+ int percent=0;+ if(limit!=0 && used != 0)+ percent=(int)((float)used/(float)limit*100);+ prop.put("logged-in_limit_percent", percent/3);+ prop.put("logged-in_limit_percent2", (100-percent)/3);}+ }else if(sb.verifyAuthentication(header, true)){+ prop.put("logged-in", 2);}if(post!= null && entry != null){if(post.containsKey("logout")){@@ -108,6 +117,11 @@ public class User{prop.put("status_password", 1); //old pw wrong}}+ }else if(post!=null && post.containsKey("logout")){+ prop.put("logged-in",0);+ if(sb.verifyAuthentication(header, true)){+ prop.put("AUTHENTICATE","admin log-in");+ }}// return rewrite propertiesreturn prop;diff --git a/htroot/env/grafics/green-bar.png b/htroot/env/grafics/green-bar.pngnew file mode 100644index 000000000..a5d796166Binary files /dev/null and b/htroot/env/grafics/green-bar.png differdiff --git a/htroot/env/grafics/red-bar.png b/htroot/env/grafics/red-bar.pngnew file mode 100644index 000000000..d97e616b9Binary files /dev/null and b/htroot/env/grafics/red-bar.png differdiff --git a/source/de/anomic/data/userDB.java b/source/de/anomic/data/userDB.javaindex 35187db10..f885bd9bc 100644--- a/source/de/anomic/data/userDB.java+++ b/source/de/anomic/data/userDB.java@@ -316,18 +316,22 @@ public final class userDB {}try {this.setProperty(TIME_USED,"0");- } catch (IOException e) {- e.printStackTrace();- }+ } catch (IOException e) {}return 0;}- public Long getTimeLimit() {- try{- return (this.mem.containsKey(TIME_LIMIT)?Long.valueOf((String)this.mem.get(TIME_LIMIT)):null);- }catch(NumberFormatException e){- return new Long(0);+ public long getTimeLimit() {+ if (this.mem.containsKey(TIME_LIMIT)) {+ try{+ return Long.valueOf((String)this.mem.get(TIME_LIMIT)).longValue();+ }catch(NumberFormatException e){+ return 0;+ }}+ try {+ this.setProperty(TIME_LIMIT,"0");+ } catch (IOException e) {}+ return 0;}public long getTrafficSize() {@@ -370,9 +374,9 @@ public final class userDB {if(this.hasProxyRight() == false)return false;- return ( this.getTimeLimit() == null ||- this.getTimeLimit().longValue() <= 0 ||- ( timeUsed < this.getTimeLimit().longValue())+ return ( this.getTimeLimit() == 0 ||+ this.getTimeLimit() <= 0 ||+ ( timeUsed < this.getTimeLimit() )); //no timelimit or timelimit not reached}