Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
Remove some post parameters, if they are set to default values, as their values are already set by YaCy. Added some documentation.
bhoerdzn2214bf5396ef
diff --git a/htroot/CrawlStartExpert_p.html b/htroot/CrawlStartExpert_p.htmlindex 626ef9310..5aec5ed6e 100644--- a/htroot/CrawlStartExpert_p.html+++ b/htroot/CrawlStartExpert_p.html@@ -7,6 +7,10 @@<script type="text/javascript" src="/js/IndexCreate.js"></script><script type="text/javascript">//<![CDATA[+ /**+ * Set the state of all elements based on other elements state.+ * @param {String} cId id of the element that had changed it's state+ */function setStates(cId) {// order matters!// crawl start points@@ -90,32 +94,41 @@}}+ /**+ * Disable element if value matches val.+ * @param {String} id element id+ * @param {String} val value to comapre to elements value */+ function disableIf(id, val) {+ var e = $('#'+id);+ if (e.val() === val) {+ e.disable();+ }+ }+$(document).ready(function() {(function($) {+ /** Disable a form element. */$.fn.disable = function() {return this.each(function() {$(this).prop('disabled', true);});};- })(jQuery);- (function($) {+ /** Enable a form element. */$.fn.enable = function() {return this.each(function() {$(this).prop('disabled', false);});};- })(jQuery);- (function($) {+ /** Set checked state for checkoxes/radio buttons. */$.fn.check = function() {return this.each(function() {$(this).attr("checked", "checked").prop("checked", true);});};- })(jQuery);- (function($) {+ /** Unset checked state for checkoxes/radio buttons. */$.fn.uncheck = function() {return this.each(function() {$(this).removeAttr("checked").prop("checked", false);@@ -123,6 +136,37 @@};})(jQuery);+ /**+ * On form submission remove text fields with default values as they+ * are set to those by yacy values by yacy, if missing.+ * @param {eventObject} ev */+ $('#Crawler').on('submit', function(ev){+ var defaultMatchAll = "#[matchAllStr]#";+ var defaultMatchNone = "#[matchNoneStr]#";++ // remove empty textfields+ disableIf('crawlingDepthExtension', '');+ disableIf('intention', '');++ // remove if MATCH_NEVER_STRING+ disableIf('mustnotmatch', defaultMatchNone);+ disableIf('ipMustnotmatch', defaultMatchNone);+ disableIf('indexmustnotmatch', defaultMatchNone);+ disableIf('indexcontentmustnotmatch', defaultMatchNone);++ // remove if MATCH_ALL_STRING+ disableIf('mustmatch', defaultMatchAll);+ disableIf('ipMustmatch', defaultMatchAll);+ disableIf('indexmustmatch', defaultMatchAll);+ disableIf('indexcontentmustmatch', defaultMatchAll);++ // remove default collection name+ disableIf('collection', '#[defaultCollection]#');++ console.log("POST: "+$(this).serialize());+ return false;+ });+// add event handlers to all checkoxes & radio buttons$(document).on('change', 'input:checkbox,input:radio', function() {setStates($(this).attr("id"));diff --git a/htroot/CrawlStartExpert_p.java b/htroot/CrawlStartExpert_p.javaindex e4daf383d..cfc54a26e 100644--- a/htroot/CrawlStartExpert_p.java+++ b/htroot/CrawlStartExpert_p.java@@ -42,6 +42,12 @@ public class CrawlStartExpert_p {// return variable that accumulates replacementsfinal Switchboard sb = (Switchboard) env;final serverObjects prop = new serverObjects();+ final String defaultCollection = "user";++ // javascript values+ prop.put("matchAllStr", CrawlProfile.MATCH_ALL_STRING);+ prop.put("matchNoneStr", CrawlProfile.MATCH_NEVER_STRING);+ prop.put("defaultCollection", defaultCollection);// ---------- Start point// crawl start URL@@ -534,7 +540,7 @@ public class CrawlStartExpert_p {if (post != null && post.containsKey("collection")) {prop.put("collection", post.get("collection", ""));} else {- prop.put("collection", collectionEnabled ? "user" : "");+ prop.put("collection", collectionEnabled ? defaultCollection : "");}}