Permalink
Browse files

Show hide or show public surftip button depending on current config s…

…tatus,

to show the button to switch the status (hiding button of current status)
  • Loading branch information...
reger24 committed Dec 10, 2017
1 parent b907819 commit 20bba135fe3e5c85bd194155feba143634abd1ce
Showing with 11 additions and 7 deletions.
  1. +8 −5 htroot/Surftips.html
  2. +3 −2 htroot/Surftips.java
@@ -55,19 +55,22 @@ <h4 class="linktitle"><a href="Supporter.html">YaCy Supporters</a></h4>
</p>
<form action="Surftips.html" method="get" class="PeerControl" accept-charset="UTF-8"><div>
<button type="submit" name="publicPage" class="btn btn-primary" value="0">
<img src="env/grafics/lock.gif" alt="authentication required" />
Hide surftips for users without autorization
</button>
#(publicSurftips)#
<button type="submit" name="publicPage" class="btn btn-primary" value="1">
<img src="env/grafics/lock.gif" alt="authentication required" />
Show surftips to everyone
</button>
::
<button type="submit" name="publicPage" class="btn btn-primary" value="0">
<img src="env/grafics/lock.gif" alt="authentication required" />
Hide surftips for users without autorization
</button>
#(/publicSurftips)#
</div></form>
<script type="text/javascript">
addHover();
</script>
#(/surftips)#
#(/surftips)#
#%env/templates/footer.template%#
</body>
@@ -72,14 +72,15 @@ public static serverObjects respond(final RequestHeader header, final serverObje
publicPage = post.get("publicPage", "0").equals("1");
sb.setConfig("publicSurftips", publicPage);
}
prop.put("surftips_publicSurftips", publicPage);
if ((publicPage) || (authorizedAccess)) {
// read voting
String hash;
if ((post != null) && ((hash = post.get("voteNegative", null)) != null)) {
if (!sb.verifyAuthentication(header)) {
prop.authenticationRequired();
prop.authenticationRequired();
return prop;
}
// make new news message with voting
@@ -93,7 +94,7 @@ public static serverObjects respond(final RequestHeader header, final serverObje
}
if ((post != null) && ((hash = post.get("votePositive", null)) != null)) {
if (!sb.verifyAuthentication(header)) {
prop.authenticationRequired();
prop.authenticationRequired();
return prop;
}
// make new news message with voting

0 comments on commit 20bba13

Please sign in to comment.