tuning User.html

FIXED: Now admin can logout
ADDED: Nice Progressbar, representing your remaining onlinetime.


git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1727 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
allo 19 years ago
parent 013b24ea0d
commit ff476c19a5

@ -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)#
::

@ -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 properties
return prop;

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

@ -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
}

Loading…
Cancel
Save