X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=www%2Fdemo%2Fsearch.js;h=517f59757c748ea7ad8627795b080c9edc7d0202;hb=1e101aa1bfddbdbad0024f743ff71447cc432a11;hp=feed8f83d45416b523c0320c8e9b346df3362f6a;hpb=d5691695e6a22fc0db9c9bffc9ed6f85e908d8c1;p=pazpar2-moved-to-github.git diff --git a/www/demo/search.js b/www/demo/search.js index feed8f8..517f597 100644 --- a/www/demo/search.js +++ b/www/demo/search.js @@ -1,4 +1,4 @@ -/* $Id: search.js,v 1.32 2007-01-16 19:42:20 quinn Exp $ +/* $Id: search.js,v 1.36 2007-01-17 14:21:29 quinn Exp $ * --------------------------------------------------- * Javascript container */ @@ -222,6 +222,8 @@ function displayname(name) return 'ISBN'; else if (name == 'md-publisher') return 'Publisher'; + else if (name == 'md-url') + return 'URL'; else return name; } @@ -232,6 +234,8 @@ function hyperlink_field(name) return 'au'; else if (name == 'md-subject') return 'su'; + else if (name == 'md-url') + return 'URL'; else return 0; } @@ -290,10 +294,18 @@ function paint_details(body, xml) if (hyl) { nv = create_element('a', value); - nv.setAttribute('href', '#'); - nv.setAttribute('term', value); - nv.setAttribute('searchfield', hyl); - nv.onclick = function() { hyperlink_search(this); return false; }; + if (hyl == 'URL') + { + nv.setAttribute('href', value); + nv.setAttribute('target', '_blank'); + } + else + { + nv.setAttribute('href', '#'); + nv.setAttribute('term', value); + nv.setAttribute('searchfield', hyl); + nv.onclick = function() { hyperlink_search(this); return false; }; + } } else nv = document.createTextNode(value); @@ -329,6 +341,15 @@ function show_details() cur_id = id; cur_rec = xml; + var nodes = document.getElementsByName('listrecord'); + var i; + for (i = 0; i < nodes.length; i++) + { + var dets = nodes[i].getElementsByTagName('div'); + if (dets[0]) + dets[0].style.display = 'none'; + } + var body = document.getElementById('rec_' + id); if (!body) return; @@ -347,14 +368,6 @@ function hyperlink_search(obj) function fetch_details(id) { cur_id = -1; - var nodes = document.getElementsByName('listrecord'); - var i; - for (i = 0; i < nodes.length; i++) - { - var dets = nodes[i].getElementsByTagName('div'); - if (dets[0]) - dets[0].style.display = 'none'; - } if (id == cur_id) { cur_id = -1; @@ -435,7 +448,7 @@ function show_records() record_div.setAttribute('name', 'listrecord'); var record_cell = create_element('a', title); - record_cell.setAttribute('href', '#'); + record_cell.setAttribute('href', '#' + id); record_cell.setAttribute('onclick', 'fetch_details(' + id + '); return false'); record_div.appendChild(record_cell); if (author) @@ -503,6 +516,8 @@ function refine_query (obj) { query_cell.value += ' and su=(' + term + ')'; else if (cur_termlist == 'author') query_cell.value += ' and au=(' + term + ')'; + else if (cur_termlist == 'date') + query_cell.value += ' and date=' + term; start_search(); } @@ -564,7 +579,8 @@ function check_termlist() var url = "search.pz2?" + "command=termlist" + "&session=" + session + - "&name=" + facet_name; + "&name=" + facet_name + + "&num=12"; xtermlist = GetXmlHttpObject(); xtermlist.onreadystatechange=show_termlist; xtermlist.open("GET", url);