Skip to content

Commit

Permalink
Show additional interaction elements in footer section on each page, if
Browse files Browse the repository at this point in the history
activated in ConfigPortal.html.
This footer is also visible in augmented browsing proxy mode.
  • Loading branch information
Cominch committed Jun 20, 2012
1 parent fa98657 commit c63c3a4
Show file tree
Hide file tree
Showing 16 changed files with 271 additions and 25 deletions.
5 changes: 5 additions & 0 deletions htroot/ConfigPortal.html
Expand Up @@ -57,6 +57,11 @@ <h2>Integration of a Search Portal</h2>
<input type="checkbox" name="search.app" value="true" #(search.app)#::checked="checked"#(/search.app)# />Applications
</dd>

<dt>Show additional interaction features in footer</dt>
<dd>
<input type="checkbox" name="interaction.userlogon" value="true" #(interaction.userlogon)#::checked="checked"#(/interaction.userlogon)# />User-Logon&nbsp;
</dd>

<dt>Snippet Fetch Strategy &amp; Link Verification</dt>
<dd>
<img src="env/grafics/idea.png" width="32" height="32" alt="idea" align="center"/>Speed up search results with this option! (use CACHEONLY or FALSE to switch off verification)<br/>
Expand Down
5 changes: 5 additions & 0 deletions htroot/ConfigPortal.java
Expand Up @@ -80,6 +80,8 @@ public static serverObjects respond(final RequestHeader header, final serverObje
sb.setConfig("publicTopmenu", post.getBoolean("publicTopmenu", true));
sb.setConfig("publicSearchpage", post.getBoolean("publicSearchpage", true));
sb.setConfig("search.options", post.getBoolean("search.options", false));

sb.setConfig("interaction.userlogon.enabled", post.getBoolean("interaction.userlogon", false));

sb.setConfig("search.text", post.getBoolean("search.text", false));
sb.setConfig("search.image", post.getBoolean("search.image", false));
Expand Down Expand Up @@ -129,6 +131,7 @@ public static serverObjects respond(final RequestHeader header, final serverObje
sb.setConfig("publicSearchpage", true);
sb.setConfig("search.navigation", "hosts,authors,namespace,topics");
sb.setConfig("search.options", true);
sb.setConfig("interaction.userlogon.enabled", false);
sb.setConfig("search.text", true);
sb.setConfig("search.image", true);
sb.setConfig("search.audio", false);
Expand Down Expand Up @@ -160,6 +163,8 @@ public static serverObjects respond(final RequestHeader header, final serverObje
prop.put("publicSearchpage", sb.getConfigBool("publicSearchpage", false) ? 1 : 0);
prop.put("search.options", sb.getConfigBool("search.options", false) ? 1 : 0);

prop.put("interaction.userlogon", sb.getConfigBool("interaction.userlogon.enabled", false) ? 1 : 0);

prop.put("search.text", sb.getConfigBool("search.text", false) ? 1 : 0);
prop.put("search.image", sb.getConfigBool("search.image", false) ? 1 : 0);
prop.put("search.audio", sb.getConfigBool("search.audio", false) ? 1 : 0);
Expand Down
1 change: 1 addition & 0 deletions htroot/env/templates/embeddedfooter.template
@@ -1 +1,2 @@
</div>
<!--#include virtual="/interaction_elements/Footer.html" -->
3 changes: 2 additions & 1 deletion htroot/env/templates/footer.template
@@ -1 +1,2 @@
</div>
</div>
<!--#include virtual="/interaction_elements/Footer.html" -->
1 change: 1 addition & 0 deletions htroot/env/templates/simplefooter.template
@@ -1 +1,2 @@
</div>
<!--#include virtual="/interaction_elements/Footer.html" -->
88 changes: 88 additions & 0 deletions htroot/interaction_elements/Footer.html
@@ -0,0 +1,88 @@
#(enabled)#::
<!-- BEGIN Footer.html -->
<style type="text/css">


.SubMenuFooter h3 {
-webkit-border-radius: 5px;
-khtml-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;

background-color:#[color]#;
color:white;
}

a.MenuItemLinkFooter, ul.SubMenuFooter em {
background-color: #[color]#;
color:#[color]#;
}

a:hover.MenuItemLinkFooter {
background-color:#[color]#;
color:#[color]#;
}

ul.SubMenuFooter a.MenuItemLinkFooter {
margin-top:0;
}

a.MenuItemLinkFooter{
display:block;
text-decoration:none;
margin-top:1px;
margin-bottom:1px;
padding:1px 10px 1px 15px;
font-size:0.9em;
white-space:nowrap;
}



a:hover.MenuItemLinkFooter {
text-decoration:none;
}


ul.SubMenuFooter em {
margin-top:0;
}


ul.SubMenuFooter em {
display:block;
text-decoration:none;
margin-top:1px;
margin-bottom:1px;
padding:1px 10px 1px 15px;
font-size:0.9em;
}

ul.SubMenuFooter {
clear:left;
padding:0;
margin:0;
}

ul.SubMenuFooter li {
list-style:none;
margin:0;
margin-top:1px;
padding:0;
}

ul.SubMenuFooter li {
float:left;
margin-right:1px;
margin-top:0;
}

</style>

<div style="position: fixed; bottom: 0px; width: 100%;">
<ul class="SubMenuFooter">
#(userlogonenabled)#::<li style="width:#[ratio]#%;"><!--#include virtual="/currentyacypeer/interaction_elements/Loginstatus_part.html" --></li>#(/userlogonenabled)#
</ul>
</div>
<!-- END Footer.html -->
#(/enabled)#
35 changes: 35 additions & 0 deletions htroot/interaction_elements/Footer.java
@@ -0,0 +1,35 @@
package interaction_elements;


import net.yacy.cora.protocol.RequestHeader;
import net.yacy.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;

public class Footer {

public static serverObjects respond(final RequestHeader requestHeader, final serverObjects post, final serverSwitch env) {

final Switchboard sb = (Switchboard) env;

final serverObjects prop = new serverObjects();

prop.put("enabled_color", env.getConfig("color_tableheader", ""));

int count = 0;

prop.put("enabled_userlogonenabled", env.getConfigBool("interaction.userlogon.enabled", false) ? "1" : "0");
if (env.getConfigBool("interaction.userlogon.enabled", false)) count++;

if (count > 0) {
prop.put("enabled", "1");
prop.put("enabled_userlogonenabled_ratio", Math.round(100/count)-1);

} else {
prop.put("enabled", "0");
}


return prop;
}
}
10 changes: 10 additions & 0 deletions htroot/interaction_elements/Loginstatus_part.html
@@ -0,0 +1,10 @@
#(enabled)#::
<!-- Loginbutton_part -->
#(logged-in)#
<a id="logon_trigger" href="" class="MenuItemLinkFooter" style="color: #fff; background-color: #[color]#;" onclick="return false;"><img src="/currentyacypeer/interaction_elements/login_empty.png"> #[username]#</a>
::
<a id="logon_trigger" href="" class="MenuItemLinkFooter" style="color: #fff; background-color: #[color]#;" onclick="return false;"><img src="/currentyacypeer/interaction_elements/login_user.png"> #[username]#</a>
::
<a id="logon_trigger" href="" class="MenuItemLinkFooter" style="color: #fff; background-color: #[color]#;" onclick="return false;"><img src="/currentyacypeer/interaction_elements/login_admin.png"> #[username]#</a>
#(/logged-in)#
#(/enabled)#
114 changes: 114 additions & 0 deletions htroot/interaction_elements/Loginstatus_part.java
@@ -0,0 +1,114 @@
package interaction_elements;

//ViewLog_p.java
//-----------------------
//part of the AnomicHTTPD caching proxy
//(C) by Michael Peter Christen; mc@yacy.net
//first published on http://www.anomic.de
//Frankfurt, Germany, 2004
//
//This File is contributed by Alexander Schier
//last major change: 14.12.2004
//
//This program is free software; you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation; either version 2 of the License, or
//(at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with this program; if not, write to the Free Software
//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA


//You must compile this file with
//javac -classpath .:../classes ViewLog_p.java
//if the shell's current path is HTROOT

import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.search.Switchboard;
import de.anomic.data.UserDB;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.server.servletProperties;

public class Loginstatus_part {

public static serverObjects respond(final RequestHeader requestHeader, final serverObjects post, final serverSwitch env) {

final Switchboard sb = (Switchboard) env;

final servletProperties prop = new servletProperties();

prop.put("enabled", env.getConfigBool("interaction.userlogon.enabled", false) ? "1" : "0");

prop.put("enabled_color", env.getConfig("color_tableheader", ""));

prop.put("enabled_logged-in_registrationenabled", env.getConfigBool("interaction.userselfregistration.enabled", false) ? "1" : "0");

//
// final String address = sb.peers.mySeed().getPublicAddress();

prop.put("enabled_peer", sb.peers.myName());

prop.put("enabled_logged-in_returnto", "/index.html");


UserDB.Entry entry=null;

//default values
prop.put("enabled_logged_in", "0");
prop.put("enabled_logged-in_limit", "0");
prop.put("enabled_logged-in_username", "anonymous");
prop.put("enabled_status", "0");
//identified via HTTPPassword
entry=sb.userDB.proxyAuth((requestHeader.get(RequestHeader.AUTHORIZATION, "xxxxxx")));
if(entry != null){
prop.put("enabled_logged-in_identified-by", "1");
//try via cookie
}else{
entry=sb.userDB.cookieAuth(requestHeader.getHeaderCookies());
prop.put("enabled_logged-in_identified-by", "2");
//try via ip
if(entry == null){
entry=sb.userDB.ipAuth((requestHeader.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, "xxxxxx")));
if(entry != null){
prop.put("enabled_logged-in_identified-by", "0");
}
}
}

//identified via userDB
if(entry != null){
prop.put("enabled_logged-in", "1");
prop.put("enabled_logged-in_username", entry.getUserName());
if(entry.getTimeLimit() > 0){
prop.put("enabled_logged-in_limit", "1");
final long limit=entry.getTimeLimit();
final long used=entry.getTimeUsed();
prop.put("enabled_logged-in_limit_timelimit", limit);
prop.put("enabled_logged-in_limit_timeused", used);
int percent=0;
if(limit!=0 && used != 0)
percent=(int)((float)used/(float)limit*100);
prop.put("enabled_logged-in_limit_percent", percent/3);
prop.put("enabled_logged-in_limit_percent2", (100-percent)/3);
}
//logged in via static Password
}else if(sb.verifyAuthentication(requestHeader)){
prop.put("enabled_logged-in", "2");
prop.put("enabled_logged-in_username", "staticadmin");
//identified via form-login
//TODO: this does not work for a static admin, yet.
}

// return rewrite properties
return prop;

}
}
28 changes: 4 additions & 24 deletions htroot/interaction_elements/OverlayInteraction.html
Expand Up @@ -9,15 +9,15 @@
position: fixed;
right: 0;
background: #ffffff;
border:1px solid #5a346e;
border:1px solid #[color]#;

width: 210px;
height: auto;
padding: 30px 110px 30px 30px;

z-index:99998;

color: #5a346e;
color: #[color]#;
}

.sci_right {
Expand All @@ -36,31 +36,11 @@

z-index:99998;

color: #5a346e;
color: #[color]#;

}


.sci_hide {

font: arial,helvetica,sans-serif;
font-size: 10px;
position: fixed;
right: 0px;
top: 0;
background: #ffffff;
border:0px;

width: 100px;
height: 20px;
padding: 5px 5px 5px 5px;

z-index:99998;

color: #5a346e;

}

.sci_left {

font: arial,helvetica,sans-serif;
Expand Down Expand Up @@ -136,7 +116,7 @@
background: #ffffff;
border:0px;

background: #5a346e;
background: #[color]#;

padding: 0px 0px 0px 0px;

Expand Down
2 changes: 2 additions & 0 deletions htroot/interaction_elements/OverlayInteraction.java
Expand Up @@ -17,6 +17,8 @@ public static serverObjects respond(final RequestHeader header, final serverObje
prop.put("enabled_urlhash", post.get("urlhash", ""));

prop.put("enabled_action", post.get("action", ""));

prop.put("enabled_color", env.getConfig("color_tableheader", ""));

return prop;
}
Expand Down
Binary file added htroot/interaction_elements/login_admin.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added htroot/interaction_elements/login_empty.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added htroot/interaction_elements/login_user.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions htroot/yacysearch.html
Expand Up @@ -252,5 +252,7 @@ <h4 class="linktitle">
window.setTimeout('latestinfo();',10000);
</script>

<!--#include virtual="/interaction_elements/Footer.html" -->

</body>
</html>
2 changes: 2 additions & 0 deletions source/net/yacy/interaction/AugmentHtmlStream.java
Expand Up @@ -381,6 +381,8 @@ public int read() throws IOException {
NodeList bodychildren = bt.getChildren();

bodychildren.add(new org.htmlparser.nodes.TextNode(loadInternal("interaction_elements/OverlayInteraction.html?action="+action+"&urlhash="+ ASCII.String(url.hash()) +"&url="+url.toNormalform(false, true), requestHeader)));

bodychildren.add(new org.htmlparser.nodes.TextNode(loadInternal("interaction_elements/Footer.html?action="+action+"&urlhash="+ ASCII.String(url.hash()) +"&url="+url.toNormalform(false, true), requestHeader)));

bt.setChildren(bodychildren);

Expand Down

0 comments on commit c63c3a4

Please sign in to comment.