From 421aa6a8bb4b59ff4bdb6f15e4117a8ffa0e5aa1 Mon Sep 17 00:00:00 2001 From: mikeworks Date: Wed, 29 Sep 2010 20:06:39 +0000 Subject: [PATCH] ConfigLiveSearch.html: Fixed some HTML problems to validate at least XHTML 1.0 Transitional - strict is not possible because iframes are used. Replacing iframes with embedded object tag does not work in IE ConfigPortal.html: Fixed some HTML problems to validate at least XHTML 1.0 Transitional - for strict the target attribute of the a link has to be removed yacyinteractive.html: Moved all JS code to an external yacyinteractive.js file in JS folder yacysearch.html: Removed embedded scripts from in between the body tags - now everything is loaded in the header de.lng: Just in case JS files will be parsed at some point added translation for yacyinteractive.html result counter git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7208 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/ConfigLiveSearch.html | 14 ++++--- htroot/ConfigPortal.html | 55 +++++++++++++------------- htroot/js/yacyinteractive.js | 71 +++++++++++++++++++++++++++++++++ htroot/yacyinteractive.html | 76 +----------------------------------- htroot/yacysearch.html | 16 +++----- locales/de.lng | 7 +++- 6 files changed, 119 insertions(+), 120 deletions(-) create mode 100644 htroot/js/yacyinteractive.js diff --git a/htroot/ConfigLiveSearch.html b/htroot/ConfigLiveSearch.html index 6bc86d5fa..a833e2b81 100644 --- a/htroot/ConfigLiveSearch.html +++ b/htroot/ConfigLiveSearch.html @@ -1,4 +1,5 @@ - + + YaCy '#[clientname]#': Integration of a Search Field for Live Search @@ -50,7 +51,7 @@

Configuration options and defaults for 'yconf':

Defaults
-
+
url
is a mandatory property - no default
global
false
theme
'start'
@@ -73,11 +74,13 @@ Specifies where the dialog should be displayed. Possible values for position: 'c The effect to be used. Possible values: 'blind', 'clip', 'drop', 'explode', 'fold', 'puff', 'slide', 'scale', 'size', 'pulsate'.
Interaction (modal | resizable)
If modal is set to true, the dialog will have modal behavior; other items on the page will be disabled (i.e. cannot be interacted with). Modal dialogs create an overlay below the dialog but above other page elements. -

+

If resizable is set to true, the dialog will be resizeable. +

Load JavaScript load_js (true | false)

If load_js is set to false, you have to manually load the needed JavaScript on your portal page. This can help to avoid timing problems or double loading. +

 <script src="/yacy/ui/js/jquery-1.3.2.min.js" type="text/javascript"></script>    
 <script src="/yacy/ui/js/jquery-ui-1.7.2.min.js" type="text/javascript"></script>
@@ -86,16 +89,15 @@ If load_js is set to false, you have to manually load the needed JavaScript on y
 <script src="/yacy/ui/js/jquery.form.js"></script>
 <script src="/yacy/ui/js/jquery.field.min.js"></script>
 
-

Load Stylesheets load_css (true | false)

If load_css is set to false, you have to manually load the needed CSS on your portal page. This can help to avoid timing problems or double loading. +

 <link media="screen" type="text/css" href="/yacy/ui/css/themes/start/ui.base.css" rel="stylesheet" />	
 <link media="screen" type="text/css" href="/yacy/ui/css/themes/start/ui.theme.css" rel="stylesheet" />
 <link media="screen" type="text/css" href="/yacy/ui/css/yacyui-portalsearch.css" rel="stylesheet" />
-
-

+
Themes

You can download ready made themes or create diff --git a/htroot/ConfigPortal.html b/htroot/ConfigPortal.html index ace22336b..976fd78ac 100644 --- a/htroot/ConfigPortal.html +++ b/htroot/ConfigPortal.html @@ -1,4 +1,5 @@ - + + YaCy '#[clientname]#': Integration of a Search Portal @@ -49,20 +50,20 @@ The search page can be integrated in your own web pages with an iframe. Simply use the following code:

-      <iframe name="target"
-       src="http://#[myaddress]#/index.html?display=2&resource=local"
-       width="100%"
-       height="560"
-       frameborder="0"
-       scrolling="auto"
-       id="target"> 
+      <iframe name="target"
+       src="http://#[myaddress]#/index.html?display=2&resource=local"
+       width="100%"
+       height="410"
+       frameborder="0"
+       scrolling="auto"
+       id="target"> 
       </iframe>  
     
This would look like:

A third option is the interactive search. Use this code:

-      <iframe name="target"
-       src="http://#[myaddress]#/yacyinteractive.html?display=2"
-       width="100%"
-       height="560"
-       frameborder="0"
-       scrolling="auto"
-       id="target"> 
+      <iframe name="target3"
+       src="http://#[myaddress]#/yacyinteractive.html?display=2"
+       width="100%"
+       height="180"
+       frameborder="0"
+       scrolling="auto"
+       id="target3"> 
       </iframe>  
     
This would look like: - #%env/templates/footer.template%# diff --git a/htroot/js/yacyinteractive.js b/htroot/js/yacyinteractive.js new file mode 100644 index 000000000..6faab7818 --- /dev/null +++ b/htroot/js/yacyinteractive.js @@ -0,0 +1,71 @@ +function xmlhttpPost() { + var searchform = document.forms['searchform']; + search(searchform.query.value); +} + +function search(query) { +// var xmlHttpReq = false; + var self = this; + if (window.XMLHttpRequest) { // Mozilla/Safari + self.xmlHttpReq = new XMLHttpRequest(); + } + else if (window.ActiveXObject) { // IE + self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); + } + self.xmlHttpReq.open('GET', "yacysearch.json?verify=false&resource=local&maximumRecords=100&nav=topics&query=" + query, true); + self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + self.xmlHttpReq.onreadystatechange = function() { + if (self.xmlHttpReq.readyState == 4) { + updatepage(self.xmlHttpReq.responseText); + } + } + self.xmlHttpReq.send(null); +} + +function navget(list, name) { + for (var i = 0; i < list.length; i++) { + if (list[i].facetname == name) return list[i]; + } +} + +function updatepage(str) { + var raw = document.getElementById("raw"); + if (raw != null) raw.innerHTML = str; + var rsp = eval("("+str+")"); + var firstChannel = rsp.channels[0]; + var totalResults = firstChannel.totalResults.replace(/[,.]/,""); +// var startIndex = firstChannel.startIndex; +// var itemsPerPage = firstChannel.itemsPerPage; + var navigation = firstChannel.navigation; + var topics = navget(navigation, "topics"); + + var html = "total results = " + totalResults; + if (topics.length > 0) { + var topwords = ""; + for (var i = 0; i < topics.elements.length; i++) { + topwords += "" + topics.elements[i].name + " "; + if (i > 10) break; + } + html += "   topwords: " + topwords; + } + html += "
"; + + if (totalResults > 0) { + var item; + html += ""; + html += ""; + html += ""; + html += ""; + //html += ""; + html += ""; + for (var i = 0; i < firstChannel.items.length; i++) { + item = firstChannel.items[i]; + html += ""; + html += ""; + //html += ""; + html += ""; + } + html += "
NameSizeDescriptionDate
" + item.title + "" + item.sizename + "" + item.description + "" + item.pubDate + "
"; + } + document.getElementById("searchresults").innerHTML = html; +} \ No newline at end of file diff --git a/htroot/yacyinteractive.html b/htroot/yacyinteractive.html index 000a7b4d0..f003dc5b0 100644 --- a/htroot/yacyinteractive.html +++ b/htroot/yacyinteractive.html @@ -3,81 +3,7 @@ YaCy Interactive Search #%env/templates/metas.template%# - + diff --git a/htroot/yacysearch.html b/htroot/yacysearch.html index aa8a52062..3789678fa 100644 --- a/htroot/yacysearch.html +++ b/htroot/yacysearch.html @@ -11,13 +11,11 @@ - #(display)# - - - - - :: - #(/display)# + + + + + - - - #(/display)#