From bea002dc15e9276e2c446123ba66fcef0489cd78 Mon Sep 17 00:00:00 2001 From: sixcooler Date: Tue, 19 Jun 2012 13:13:00 +0200 Subject: [PATCH 1/5] correct table in new look of Crawler_p --- htroot/Crawler_p.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htroot/Crawler_p.html b/htroot/Crawler_p.html index d480580f3..b9bc539ee 100644 --- a/htroot/Crawler_p.html +++ b/htroot/Crawler_p.html @@ -15,7 +15,7 @@ #%env/templates/submenuCrawlMonitor.template%#

Crawler

-
+
Queues From 84a11ec48cc57e54a82a7c41e3f0c2afa2ff9d79 Mon Sep 17 00:00:00 2001 From: cominch Date: Wed, 20 Jun 2012 07:55:28 +0200 Subject: [PATCH 2/5] Corrected loading of default page settings on ConfigPortal.html --- htroot/ConfigPortal.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htroot/ConfigPortal.java b/htroot/ConfigPortal.java index d2a4d6b03..5429644bc 100644 --- a/htroot/ConfigPortal.java +++ b/htroot/ConfigPortal.java @@ -59,7 +59,7 @@ public class ConfigPortal { } else { sb.setConfig(SwitchboardConstants.BROWSER_POP_UP_PAGE, "Status.html"); } - sb.setConfig(SwitchboardConstants.BROWSER_DEFAULT, sb.getConfig(SwitchboardConstants.BROWSER_POP_UP_PAGE, "index.html")); + sb.setConfig(SwitchboardConstants.BROWSER_POP_UP_PAGE, sb.getConfig(SwitchboardConstants.BROWSER_POP_UP_PAGE, "index.html")); HTTPDFileHandler.initDefaultPath(); } if (post.containsKey("searchpage_set")) { From fa98657bb32e3dd8404b0b7dd84b95cf790f1ceb Mon Sep 17 00:00:00 2001 From: cominch Date: Wed, 20 Jun 2012 09:10:39 +0200 Subject: [PATCH 3/5] Augmented Browsing: changed the settings page --- htroot/AugmentedBrowsingFilters_p.html | 29 ++------------------------ htroot/AugmentedBrowsingFilters_p.java | 21 +------------------ 2 files changed, 3 insertions(+), 47 deletions(-) diff --git a/htroot/AugmentedBrowsingFilters_p.html b/htroot/AugmentedBrowsingFilters_p.html index ae55196b5..3bea2df50 100644 --- a/htroot/AugmentedBrowsingFilters_p.html +++ b/htroot/AugmentedBrowsingFilters_p.html @@ -55,35 +55,10 @@
Enabled

- Show overlay interaction buttons for sciety. + Show overlay interaction buttons.

- - - - + diff --git a/htroot/AugmentedBrowsingFilters_p.java b/htroot/AugmentedBrowsingFilters_p.java index 0ac474f62..294656cb4 100644 --- a/htroot/AugmentedBrowsingFilters_p.java +++ b/htroot/AugmentedBrowsingFilters_p.java @@ -26,15 +26,6 @@ public final class AugmentedBrowsingFilters_p { env.setConfig("interaction.overlayinteraction.enabled", "on".equals(post .get("overlayInteraction")) ? true : false); -// env.setConfig("augmentation.reparse.adduniqueid", "on".equals(post -// .get("augmentedReparseAdduniqueid")) ? true : false); -// -// env.setConfig("augmentation.reparse.addserverinfo", "on".equals(post -// .get("augmentedReparseAddserver")) ? true : false); -// -// env.setConfig("augmentation.reparse.addrdf", "on".equals(post -// .get("augmentedReparseAddrdf")) ? true : false); - } } @@ -49,17 +40,7 @@ public final class AugmentedBrowsingFilters_p { env.getConfigBool("augmentation.reparse", true) ? "1" : "0"); prop.put("overlayInteraction_checked", - env.getConfigBool("interaction.overlayinteraction.enabled", true) ? "1" : "0"); - -// prop.put("augmentedReparseAdduniqueid_checked", -// env.getConfigBool("augmentation.reparse.adduniqueid", true) ? "1" : "0"); -// -// prop.put("augmentedReparseAddserver_checked", -// env.getConfigBool("augmentation.reparse.addserverinfo", true) ? "1" : "0"); -// -// prop.put("augmentedReparseAddrdf_checked", -// env.getConfigBool("augmentation.reparse.addrdf", true) ? "1" : "0"); - + env.getConfigBool("interaction.overlayinteraction.enabled", true) ? "1" : "0"); // return rewrite properties From 786be7d175460cdb5469f8ba59c91b9ff5b225e3 Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Wed, 20 Jun 2012 16:39:04 +0200 Subject: [PATCH 4/5] better integration of RDFaParser --- build.xml | 7 +++++++ source/net/yacy/document/Document.java | 1 + source/net/yacy/document/TextParser.java | 2 +- source/net/yacy/search/index/DocumentIndex.java | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/build.xml b/build.xml index fc5c83f80..b786882fa 100644 --- a/build.xml +++ b/build.xml @@ -58,6 +58,7 @@ + @@ -296,6 +297,12 @@ includes="**/*"/> + + + + + diff --git a/source/net/yacy/document/Document.java b/source/net/yacy/document/Document.java index 9bfecb957..42fb1f190 100644 --- a/source/net/yacy/document/Document.java +++ b/source/net/yacy/document/Document.java @@ -781,6 +781,7 @@ dc_rights for (final Document doc: docs) { + if (doc == null) continue; final String author = doc.dc_creator(); if (author.length() > 0) { if (authors.length() > 0) authors.append(","); diff --git a/source/net/yacy/document/TextParser.java b/source/net/yacy/document/TextParser.java index d4a2ba225..da27a2fd5 100644 --- a/source/net/yacy/document/TextParser.java +++ b/source/net/yacy/document/TextParser.java @@ -261,7 +261,7 @@ public final class TextParser { if (log.isFine()) log.logInfo("Parsing " + location + " with mimeType '" + mimeType + "' and file extension '" + fileExt + "'."); try { final Document[] docs = parser.parse(location, mimeType, documentCharset, sourceStream); - for (final Document d: docs) { assert d.getText() != null; } // verify docs + for (final Document d: docs) { assert d != null && d.getText() != null; } // verify docs return docs; } catch (final Exception e) { throw new Parser.Failure("parser failed: " + parser.getName(), location); diff --git a/source/net/yacy/search/index/DocumentIndex.java b/source/net/yacy/search/index/DocumentIndex.java index a25763844..30af3a83b 100644 --- a/source/net/yacy/search/index/DocumentIndex.java +++ b/source/net/yacy/search/index/DocumentIndex.java @@ -157,6 +157,7 @@ public class DocumentIndex extends Segment final URIMetadataRow[] rows = new URIMetadataRow[documents.length]; int c = 0; for ( final Document document : documents ) { + if (document == null) continue; final Condenser condenser = new Condenser(document, true, true, LibraryProvider.dymLib, true); rows[c++] = super.storeDocument( From c63c3a44953843a10ef41b5190814438460e2cf8 Mon Sep 17 00:00:00 2001 From: cominch Date: Wed, 20 Jun 2012 18:04:23 +0200 Subject: [PATCH 5/5] Show additional interaction elements in footer section on each page, if activated in ConfigPortal.html. This footer is also visible in augmented browsing proxy mode. --- htroot/ConfigPortal.html | 5 + htroot/ConfigPortal.java | 5 + htroot/env/templates/embeddedfooter.template | 1 + htroot/env/templates/footer.template | 3 +- htroot/env/templates/simplefooter.template | 1 + htroot/interaction_elements/Footer.html | 88 ++++++++++++++ htroot/interaction_elements/Footer.java | 35 ++++++ .../Loginstatus_part.html | 10 ++ .../Loginstatus_part.java | 114 ++++++++++++++++++ .../OverlayInteraction.html | 28 +---- .../OverlayInteraction.java | 2 + htroot/interaction_elements/login_admin.png | Bin 0 -> 145 bytes htroot/interaction_elements/login_empty.png | Bin 0 -> 131 bytes htroot/interaction_elements/login_user.png | Bin 0 -> 145 bytes htroot/yacysearch.html | 2 + .../yacy/interaction/AugmentHtmlStream.java | 2 + 16 files changed, 271 insertions(+), 25 deletions(-) create mode 100644 htroot/interaction_elements/Footer.html create mode 100644 htroot/interaction_elements/Footer.java create mode 100644 htroot/interaction_elements/Loginstatus_part.html create mode 100644 htroot/interaction_elements/Loginstatus_part.java create mode 100644 htroot/interaction_elements/login_admin.png create mode 100644 htroot/interaction_elements/login_empty.png create mode 100644 htroot/interaction_elements/login_user.png diff --git a/htroot/ConfigPortal.html b/htroot/ConfigPortal.html index 7fab4068e..3cb3756f1 100644 --- a/htroot/ConfigPortal.html +++ b/htroot/ConfigPortal.html @@ -57,6 +57,11 @@ Applications +
Show additional interaction features in footer
+
+ User-Logon  +
+
Snippet Fetch Strategy & Link Verification
ideaSpeed up search results with this option! (use CACHEONLY or FALSE to switch off verification)
diff --git a/htroot/ConfigPortal.java b/htroot/ConfigPortal.java index 5429644bc..8555889dd 100644 --- a/htroot/ConfigPortal.java +++ b/htroot/ConfigPortal.java @@ -80,6 +80,8 @@ public class ConfigPortal { 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)); @@ -129,6 +131,7 @@ public class ConfigPortal { 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); @@ -160,6 +163,8 @@ public class ConfigPortal { 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); diff --git a/htroot/env/templates/embeddedfooter.template b/htroot/env/templates/embeddedfooter.template index 04f5b8449..c8a7fb0b9 100644 --- a/htroot/env/templates/embeddedfooter.template +++ b/htroot/env/templates/embeddedfooter.template @@ -1 +1,2 @@ + \ No newline at end of file diff --git a/htroot/env/templates/footer.template b/htroot/env/templates/footer.template index 7f5eaa32e..c8a7fb0b9 100644 --- a/htroot/env/templates/footer.template +++ b/htroot/env/templates/footer.template @@ -1 +1,2 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/htroot/env/templates/simplefooter.template b/htroot/env/templates/simplefooter.template index 04f5b8449..c8a7fb0b9 100644 --- a/htroot/env/templates/simplefooter.template +++ b/htroot/env/templates/simplefooter.template @@ -1 +1,2 @@ + \ No newline at end of file diff --git a/htroot/interaction_elements/Footer.html b/htroot/interaction_elements/Footer.html new file mode 100644 index 000000000..77c8a3ecd --- /dev/null +++ b/htroot/interaction_elements/Footer.html @@ -0,0 +1,88 @@ +#(enabled)#:: + + + +
+ +
+ +#(/enabled)# \ No newline at end of file diff --git a/htroot/interaction_elements/Footer.java b/htroot/interaction_elements/Footer.java new file mode 100644 index 000000000..6c3e66c9e --- /dev/null +++ b/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; + } +} diff --git a/htroot/interaction_elements/Loginstatus_part.html b/htroot/interaction_elements/Loginstatus_part.html new file mode 100644 index 000000000..2f01d93c9 --- /dev/null +++ b/htroot/interaction_elements/Loginstatus_part.html @@ -0,0 +1,10 @@ +#(enabled)#:: + +#(logged-in)# + #[username]# +:: + #[username]# +:: + #[username]# +#(/logged-in)# +#(/enabled)# \ No newline at end of file diff --git a/htroot/interaction_elements/Loginstatus_part.java b/htroot/interaction_elements/Loginstatus_part.java new file mode 100644 index 000000000..bc5290384 --- /dev/null +++ b/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; + + } +} diff --git a/htroot/interaction_elements/OverlayInteraction.html b/htroot/interaction_elements/OverlayInteraction.html index 602c9b32b..22605cc94 100644 --- a/htroot/interaction_elements/OverlayInteraction.html +++ b/htroot/interaction_elements/OverlayInteraction.html @@ -9,7 +9,7 @@ font-size: 10px; position: fixed; right: 0; background: #ffffff; -border:1px solid #5a346e; +border:1px solid #[color]#; width: 210px; height: auto; @@ -17,7 +17,7 @@ padding: 30px 110px 30px 30px; z-index:99998; -color: #5a346e; +color: #[color]#; } .sci_right { @@ -36,31 +36,11 @@ padding: 5px 5px 5px 5px; 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; @@ -136,7 +116,7 @@ height: 2px; background: #ffffff; border:0px; -background: #5a346e; +background: #[color]#; padding: 0px 0px 0px 0px; diff --git a/htroot/interaction_elements/OverlayInteraction.java b/htroot/interaction_elements/OverlayInteraction.java index 21af427df..1a1bcc2a6 100644 --- a/htroot/interaction_elements/OverlayInteraction.java +++ b/htroot/interaction_elements/OverlayInteraction.java @@ -17,6 +17,8 @@ public class OverlayInteraction { prop.put("enabled_urlhash", post.get("urlhash", "")); prop.put("enabled_action", post.get("action", "")); + + prop.put("enabled_color", env.getConfig("color_tableheader", "")); return prop; } diff --git a/htroot/interaction_elements/login_admin.png b/htroot/interaction_elements/login_admin.png new file mode 100644 index 0000000000000000000000000000000000000000..f54109ae92392227ba85a00b8b66d1d846e9a040 GIT binary patch literal 145 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1SGw4HSYi^#^NA%Cx&(BWL^R}Ea{HEjtmSN z`?>!lvI6;>1s;*b3=DjSL74G){)!Z!pqi(PV~9j}@}K|z?U~IEa7?LCU)`mq`sIh2 laM)7^$10D8nAWRx47D*ltUa5zwE%T6c)I$ztaD0e0sxFVD4_rV literal 0 HcmV?d00001 diff --git a/htroot/interaction_elements/login_empty.png b/htroot/interaction_elements/login_empty.png new file mode 100644 index 0000000000000000000000000000000000000000..bcaaeb4f32413341a0e53e6c32221e0e1f504ceb GIT binary patch literal 131 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1SGw4HSYi^#^NA%Cx&(BWL^R}Ea{HEjtmSN z`?>!lvI6;>1s;*b3=DjSL74G){)!Z!poFK3V~9j}@{fLI1BRoo4H*Io4ybOhl3-Zy WxYP0RWj-~a8U{~SKbLh*2~7Yk=^<4B literal 0 HcmV?d00001 diff --git a/htroot/interaction_elements/login_user.png b/htroot/interaction_elements/login_user.png new file mode 100644 index 0000000000000000000000000000000000000000..770e29c4e6d47382be7c70bd93e62978794ddb47 GIT binary patch literal 145 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1SGw4HSYi^#^NA%Cx&(BWL^R}Ea{HEjtmSN z`?>!lvI6;>1s;*b3=DjSL74G){)!Z!pqi(PV~9j}@}K|z?U~IEa7?-JEr!qcl=mk= l;jpI;j#VBFF|AkY7}}M1SoKb1)B$xcc)I$ztaD0e0sxUrC@=s3 literal 0 HcmV?d00001 diff --git a/htroot/yacysearch.html b/htroot/yacysearch.html index ff1bd2532..24a7db77a 100644 --- a/htroot/yacysearch.html +++ b/htroot/yacysearch.html @@ -252,5 +252,7 @@ window.setTimeout('latestinfo();',8000); window.setTimeout('latestinfo();',10000); + + diff --git a/source/net/yacy/interaction/AugmentHtmlStream.java b/source/net/yacy/interaction/AugmentHtmlStream.java index 6d7bcf3a2..2ec61e1bd 100644 --- a/source/net/yacy/interaction/AugmentHtmlStream.java +++ b/source/net/yacy/interaction/AugmentHtmlStream.java @@ -381,6 +381,8 @@ public class AugmentHtmlStream { 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);