Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
- renamed interactivesearch to yacyinteractive - added a configuration option to set the pop up page in Config Appearance - added a minimized header option to yacyinteractive - fixed a bug in yacysearch: default values when no query is done
orbiter9d282d2c1626
diff --git a/htroot/ConfigAppearance_p.html b/htroot/ConfigAppearance_p.htmlindex ecaf05ba9..da658fafa 100644--- a/htroot/ConfigAppearance_p.html+++ b/htroot/ConfigAppearance_p.html@@ -75,6 +75,14 @@<dt>URL of a Large Corporate Image</dt><dd><input type="text" name="promoteSearchPageGreeting.largeImage" value="#[promoteSearchPageGreeting.largeImage]#" size="60" /></dd>+ <dt>Default Pop-Up Page</dt>+ <dd>+ <input type="radio" name="popup" value="status" #(popupStatus)#::checked="checked"#(/popupStatus)# />Status Page + <input type="radio" name="popup" value="front" #(popupFront)#::checked="checked"#(/popupFront)# />Search Front Page + <input type="radio" name="popup" value="search" #(popupSearch)#::checked="checked"#(/popupSearch)# />Search Page (small header) + <input type="radio" name="popup" value="interactive" #(popupInteractive)#::checked="checked"#(/popupInteractive)# />Interactive Search Page + </dd>+<dd><input type="submit" name="searchpage_set" value="Change Search Page" /> <input type="submit" name="searchpage_default" value="Set to Default Values" />@@ -83,10 +91,10 @@</fieldset></form>- <p>+ <h3>The search page can be integrated in your own web pages with an iframe. Simply use the following code:- <p>- <pre>+ </h3>+ <fieldset><pre><iframe name="target"src="http://#[myaddress]#/index.html?display=2&resource=local"width="100%"@@ -95,14 +103,60 @@scrolling="auto"id="target"></iframe>- </pre>+ </pre></fieldset>This would look like:<iframe name="target"src="http://#[myaddress]#/index.html?display=2&resource=local"width="100%"+ height="340"+ frameborder="0"+ scrolling="auto"+ id="target">+ </iframe>++ <h3>+ For a search page with a small header, use this code:+ </h3>+ <fieldset><pre>+ <iframe name="target"+ src="http://#[myaddress]#/yacysearch.html?display=2&resource=local"+ width="100%"height="560"frameborder="0"scrolling="auto"+ id="target">+ </iframe>+ </pre></fieldset>+ This would look like:+ <iframe name="target"+ src="http://#[myaddress]#/yacysearch.html?display=2&resource=local"+ width="100%"+ height="180"+ frameborder="0"+ scrolling="auto"+ id="target">+ </iframe>++ <h3>+ A third option is the interactive search. Use this code:+ </h3>+ <fieldset><pre>+ <iframe name="target"+ src="http://#[myaddress]#/yacyinteractive.html?display=2"+ width="100%"+ height="560"+ frameborder="0"+ scrolling="auto"+ id="target">+ </iframe>+ </pre></fieldset>+ This would look like:+ <iframe name="target"+ src="http://#[myaddress]#/yacyinteractive.html?display=2"+ width="100%"+ height="180"+ frameborder="0"+ scrolling="auto"id="target"></iframe>diff --git a/htroot/ConfigAppearance_p.java b/htroot/ConfigAppearance_p.javaindex b82245c3a..56be66f25 100644--- a/htroot/ConfigAppearance_p.java+++ b/htroot/ConfigAppearance_p.java@@ -128,6 +128,19 @@ public class ConfigAppearance_p {sb.setConfig(plasmaSwitchboardConstants.GREETING_SMALL_IMAGE, "/env/grafics/YaCyLogo_60ppi.png");}+ if (post.containsKey("popup")) {+ String popup = post.get("popup", "status");+ if (popup.equals("front")) {+ sb.setConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_PAGE, "index.html?display=2");+ } else if (popup.equals("search")) {+ sb.setConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_PAGE, "yacysearch.html?display=2");+ } else if (popup.equals("interactive")) {+ sb.setConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_PAGE, "yacyinteractive.html?display=2");+ } else {+ sb.setConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_PAGE, "Status.html");+ }+ }+}// reread skins@@ -148,6 +161,22 @@ public class ConfigAppearance_p {prop.putHTML(plasmaSwitchboardConstants.GREETING_HOMEPAGE, sb.getConfig(plasmaSwitchboardConstants.GREETING_HOMEPAGE, ""));prop.putHTML(plasmaSwitchboardConstants.GREETING_LARGE_IMAGE, sb.getConfig(plasmaSwitchboardConstants.GREETING_LARGE_IMAGE, ""));prop.putHTML(plasmaSwitchboardConstants.GREETING_SMALL_IMAGE, sb.getConfig(plasmaSwitchboardConstants.GREETING_SMALL_IMAGE, ""));++ final String browserPopUpPage = sb.getConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_PAGE, "ConfigBasic.html");+ prop.put("popupFront", 0);+ prop.put("popupSearch", 0);+ prop.put("popupInteractive", 0);+ prop.put("popupStatus", 0);+ if (browserPopUpPage.startsWith("index")) {+ prop.put("popupFront", 1);+ } else if (browserPopUpPage.startsWith("yacysearch")) {+ prop.put("popupSearch", 1);+ } else if (browserPopUpPage.startsWith("yacyinteractive")) {+ prop.put("popupInteractive", 1);+ } else {+ prop.put("popupStatus", 1);+ }+String myaddress = sb.webIndex.seedDB.mySeed().getPublicAddress();if (myaddress == null) myaddress = "localhost:" + sb.getConfig("port", "8080");prop.put("myaddress", myaddress);diff --git a/htroot/env/templates/header.template b/htroot/env/templates/header.templateindex d81f029c4..74784671b 100644--- a/htroot/env/templates/header.template+++ b/htroot/env/templates/header.template@@ -7,8 +7,7 @@<ul class="menu"><li><a href="/index.html?display=1" accesskey="s" class="MenuItemLink">Search Page</a></li><li><a href="/yacy/ui/" accesskey="s" class="MenuItemLink">Rich Client Search</a></li>- <li><a href="/interactivesearch.html?display=1" class="MenuItemLink">Interactive local Search</a></li>- <!--<li><a href="/yacy/user/ysearch.html?display=1" accesskey="s" class="MenuItemLink">Search Page (alternative)</a></li>-->+ <li><a href="/yacyinteractive.html?display=1" class="MenuItemLink">Interactive local Search</a></li><li><a href="/compare_yacy.html?display=1" class="MenuItemLink">Compare Search</a></li><li><a href="/Ranking_p.html" class="MenuItemLink lock">Ranking Config</a></li><li><a href="/Surftips.html?display=1" class="MenuItemLink">Surftips</a></li>diff --git a/htroot/index.java b/htroot/index.javaindex 0b8939961..a06c7e5e3 100644--- a/htroot/index.java+++ b/htroot/index.java@@ -58,6 +58,12 @@ public class index {final boolean authenticated = sb.adminAuthenticated(header) >= 2;int display = (post == null) ? 0 : post.getInt("display", 0);if ((display == 1) && (!authenticated)) display = 0;+ final boolean browserPopUpTrigger = sb.getConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_TRIGGER, "true").equals("true");+ if (browserPopUpTrigger) {+ final String browserPopUpPage = sb.getConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_PAGE, "ConfigBasic.html");+ if (browserPopUpPage.startsWith("index") || browserPopUpPage.startsWith("yacysearch")) display = 2;+ }+final int searchoptions = (post == null) ? 0 : post.getInt("searchoptions", 0);final String former = (post == null) ? "" : post.get("former", "");final int count = Math.min(100, (post == null) ? 10 : post.getInt("count", 10));diff --git a/htroot/interactivesearch.html b/htroot/yacyinteractive.htmlsimilarity index 72%rename from htroot/interactivesearch.htmlrename to htroot/yacyinteractive.htmlindex e098f5588..46f4ac55d 100644--- a/htroot/interactivesearch.html+++ b/htroot/yacyinteractive.html@@ -35,34 +35,46 @@ function updatepage(str){var html = "<br>total results = " + totalResults;var item;html += "<table class=\"networkTable\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\">";- html += "<tr class=\"TableHeader\" valign=\"bottom\"><td>Name</td><td>Description</td><td>Link</td></tr>";+ html += "<tr class=\"TableHeader\" valign=\"bottom\">";+ html += "<td>Name</td>";+ //html += "<td>Description</td>";+ html += "<td>Link</td></tr>";for (var i = 0; i < firstChannel.items.length; i++) {item = firstChannel.items[i];html += "<tr class=\"TableCellLight\"><td>"+ item.title + "</td>";- html += "<td>" + item.description + "</td>";+ //html += "<td>" + item.description + "</td>";html += "<td><a href=\"" + item.link + "\">" + item.link + "</a></td></tr>";}html += "</table>";- document.getElementById("result").innerHTML = html;+ document.getElementById("searchresults").innerHTML = html;}</script></head><body>-#%env/templates/header.template%#-+#(display)#+ #%env/templates/simpleheader.template%#+ ::<div id="api"><a href="yacysearch.json?query=yacy"><img src="env/grafics/api.png"></a><span>This page uses the JSON search API to display search results as you type.Click the API icon to see an example call to the native API.To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de/wiki/index.php/Dev:API">API wiki page</a>.</span></div>+ #%env/templates/header.template%#+ ::+ #%env/templates/embeddedheader.template%#+#(/display)#+-<form name="searchform" onkeyup='xmlhttpPost(); return false;'>- <p>Query: <input name="query" type="text">- <!--<input value="Search" type="submit">--></p>--<div id="result"></div>+<form class="search small" name="searchform" onkeyup='xmlhttpPost(); return false;'>+ <h2>#[promoteSearchPageGreeting]#</h2>+ <div class="yacylogo">+ <a href="#[promoteSearchPageGreeting.homepage]#" class="yacylogo"><img src="#[promoteSearchPageGreeting.smallImage]#" alt="yacysearch" align="left"/></a></div>+ <fieldset class="yacys"><input name="query" type="text" size="50" maxlength="80" /></fieldset>+ <div id="searchresults"></div>+ </div><!--<pre>Raw JSON String: <div id="raw"></div></pre>--></form>+#%env/templates/footer.template%#</body></html>\ No newline at end of filediff --git a/htroot/interactivesearch.java b/htroot/yacyinteractive.javasimilarity index 51%rename from htroot/interactivesearch.javarename to htroot/yacyinteractive.javaindex e5c7192fe..f97b80991 100644--- a/htroot/interactivesearch.java+++ b/htroot/yacyinteractive.java@@ -25,17 +25,33 @@// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USAimport de.anomic.http.httpRequestHeader;+import de.anomic.plasma.plasmaSwitchboard;+import de.anomic.plasma.plasmaSwitchboardConstants;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;// this is a dummy class. Without it, the templates in interactivesearch.html do not load-public class interactivesearch {+public class yacyinteractive {public static serverObjects respond(final httpRequestHeader header, serverObjects post, final serverSwitch<?> env) {- //final plasmaSwitchboard sb = (plasmaSwitchboard) env;+ final plasmaSwitchboard sb = (plasmaSwitchboard) env;final serverObjects prop = new serverObjects();-+ final boolean authenticated = sb.adminAuthenticated(header) >= 2;+ int display = (post == null) ? 0 : post.getInt("display", 0);+ if ((display == 1) && (!authenticated)) display = 0;+ final boolean browserPopUpTrigger = sb.getConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_TRIGGER, "true").equals("true");+ if (browserPopUpTrigger) {+ final String browserPopUpPage = sb.getConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_PAGE, "ConfigBasic.html");+ if (browserPopUpPage.startsWith("yacyinteractive")) display = 2;+ }+ String promoteSearchPageGreeting = env.getConfig(plasmaSwitchboardConstants.GREETING, "");+ if (env.getConfigBool(plasmaSwitchboardConstants.GREETING_NETWORK_NAME, false)) promoteSearchPageGreeting = env.getConfig("network.unit.description", "");+ prop.put("promoteSearchPageGreeting", promoteSearchPageGreeting);+ prop.put("promoteSearchPageGreeting.homepage", sb.getConfig(plasmaSwitchboardConstants.GREETING_HOMEPAGE, ""));+ prop.put("promoteSearchPageGreeting.smallImage", sb.getConfig(plasmaSwitchboardConstants.GREETING_SMALL_IMAGE, ""));++ prop.put("display", display);return prop;}}\ No newline at end of filediff --git a/htroot/yacysearch.html b/htroot/yacysearch.htmlindex f26b2315c..4acb84359 100644--- a/htroot/yacysearch.html+++ b/htroot/yacysearch.html@@ -57,7 +57,7 @@ To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de::<form class="search small" action="yacysearch.html" method="get" accept-charset="UTF-8"><h2>#[promoteSearchPageGreeting]#</h2>- <div class="yacylogo"><a href="#[promoteSearchPageGreeting.homepage]#" class="yacylogo"><img src="#[promoteSearchPageGreeting.smallImage]#" alt="yacy" align="left"/></a></div>+ <div class="yacylogo"><a href="#[promoteSearchPageGreeting.homepage]#" class="yacylogo"><img src="#[promoteSearchPageGreeting.smallImage]#" alt="yacysearch" align="left"/></a></div><fieldset class="yacys"><input id="search" name="query" type="text" size="50" maxlength="80" value="#[former]#" onclick="document.getElementById('Enter').value = 'Search'" /><input id="Enter" type="submit" name="Enter" value="Search" />diff --git a/htroot/yacysearch.java b/htroot/yacysearch.javaindex c1abbb809..85fdd0537 100644--- a/htroot/yacysearch.java+++ b/htroot/yacysearch.java@@ -70,6 +70,11 @@ public class yacysearch {final boolean authenticated = sb.adminAuthenticated(header) >= 2;int display = (post == null) ? 0 : post.getInt("display", 0);if ((display == 1) && (!authenticated)) display = 0;+ final boolean browserPopUpTrigger = sb.getConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_TRIGGER, "true").equals("true");+ if (browserPopUpTrigger) {+ final String browserPopUpPage = sb.getConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_PAGE, "ConfigBasic.html");+ if (browserPopUpPage.startsWith("index") || browserPopUpPage.startsWith("yacysearch")) display = 2;+ }final int input = (post == null) ? 2 : post.getInt("input", 2);String promoteSearchPageGreeting = env.getConfig(plasmaSwitchboardConstants.GREETING, "");if (env.getConfigBool(plasmaSwitchboardConstants.GREETING_NETWORK_NAME, false)) promoteSearchPageGreeting = env.getConfig("network.unit.description", "");@@ -113,6 +118,10 @@ public class yacysearch {prop.put("results", "");prop.put("resultTable", "0");prop.put("num-results", searchAllowed ? "0" : "4");+ prop.put("num-results_totalcount", 0);+ prop.put("num-results_offset", 0);+ prop.put("num-results_itemsPerPage", 10);+ prop.put("rss_queryenc", "");return prop;}diff --git a/source/de/anomic/plasma/plasmaSwitchboardConstants.java b/source/de/anomic/plasma/plasmaSwitchboardConstants.javaindex f1ecabbde..a45f0f008 100644--- a/source/de/anomic/plasma/plasmaSwitchboardConstants.java+++ b/source/de/anomic/plasma/plasmaSwitchboardConstants.java@@ -534,4 +534,10 @@ public final class plasmaSwitchboardConstants {public static final String GREETING_LARGE_IMAGE = "promoteSearchPageGreeting.largeImage";public static final String GREETING_SMALL_IMAGE = "promoteSearchPageGreeting.smallImage";+ /**+ * browser pop up+ */+ public static final String BROWSER_POP_UP_TRIGGER = "browserPopUpTrigger";+ public static final String BROWSER_POP_UP_APPLICATION = "browserPopUpApplication";+ public static final String BROWSER_POP_UP_PAGE = "browserPopUpPage";}diff --git a/source/yacy.java b/source/yacy.javaindex cbce522c4..7f140b213 100644--- a/source/yacy.java+++ b/source/yacy.java@@ -341,12 +341,12 @@ public final class yacy {//server.start();// open the browser window- final boolean browserPopUpTrigger = sb.getConfig("browserPopUpTrigger", "true").equals("true");+ final boolean browserPopUpTrigger = sb.getConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_TRIGGER, "true").equals("true");if (browserPopUpTrigger) {- final String browserPopUpPage = sb.getConfig("browserPopUpPage", "ConfigBasic.html");+ final String browserPopUpPage = sb.getConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_PAGE, "ConfigBasic.html");//boolean properPW = (sb.getConfig("adminAccount", "").length() == 0) && (sb.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").length() > 0);//if (!properPW) browserPopUpPage = "ConfigBasic.html";- final String browserPopUpApplication = sb.getConfig("browserPopUpApplication", "firefox");+ final String browserPopUpApplication = sb.getConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_APPLICATION, "firefox");serverSystem.openBrowser((server.withSSL()?"https":"http") + "://localhost:" + serverCore.getPortNr(port) + "/" + browserPopUpPage, browserPopUpApplication);}