X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=www%2Fdemo%2Fsearch.js;h=054558c8470123609732d505702f08ed1530255a;hb=b3a18c85a3e60600d77ad6053211da7acce91149;hp=41b19b521ec787726309b98b72a80e78e924661a;hpb=015261c103f2b4f8e4d06220605a2053e52a1249;p=pazpar2-moved-to-github.git diff --git a/www/demo/search.js b/www/demo/search.js index 41b19b5..054558c 100644 --- a/www/demo/search.js +++ b/www/demo/search.js @@ -1,4 +1,4 @@ -/* $Id: search.js,v 1.7 2007-01-08 11:13:07 sondberg Exp $ +/* $Id: search.js,v 1.10 2007-01-10 09:19:05 sondberg Exp $ * --------------------------------------------------- * Javascript container */ @@ -21,6 +21,7 @@ var session_cells = Array('query', 'startrec', 'action_type'); var old_session = session_read(); var url_surveillence; var recstoshow = 15; +var page_window = 5; // Number of pages prior to and after the current page var facet_list; var cur_facet = 0; @@ -72,8 +73,6 @@ function start_session() xinitSession.onreadystatechange=session_started; xinitSession.open("GET", url); xinitSession.send(null); - - //url_surveillence = setInterval(session_check, 200); } function ping_session() @@ -146,7 +145,37 @@ function update_action (new_action) { function make_pager (hits, offset, max) { - return '1 Next'; + var html = ''; + var off; + + for (off = offset - page_window * max; + off < hits && off < (offset + page_window * max); + off += max) { + + var class = ''; + + if (off < 0) + off = 0; + + var p = off / max + 1; + + if ((offset >= off) && (offset < (off + max))) + class = ' class="select"'; + + html += '' + p + '\n'; + } + + return html; +} + + +function update_offset (offset) { + document.search.startrec.value = offset; + update_action('page'); + check_search(); + update_history(); + return false; } @@ -172,7 +201,7 @@ function show_records() var num = Number(xml.getElementsByTagName('num')[0].childNodes[0].nodeValue); var clients = Number(xml.getElementsByTagName("activeclients")[0].childNodes[0].nodeValue); body.innerHTML = '