<?php
-/* $Id: page_segments.phpi,v 1.20 2007-01-26 18:50:11 quinn Exp $
+/* $Id: page_segments.phpi,v 1.21 2007-03-20 05:34:00 quinn Exp $
* ---------------------------------------------------
* Page segments
*/
<div class="search">
<div>
- <form name="search" onsubmit="start_search(); return false;">
+ <form name="search" onsubmit="clear_filter(); start_search(); return false;">
<input id="query" type="text" class="search" tabindex="1"
maxlength="255" value="" />
<input type="submit" class="button" value="Search" />
Narrow your search by using the keywords below:<br />
<br />
+ <a id="facet_xtargets" class="unselected"
+ onclick="toggle_facet(this)">Targets</a>
+ <span id="facet_xtargets_terms" class="facet"
+ style="display: block;"></span>
+
+ <br/>
+
+
<a id="facet_subject" class="unselected"
onclick="toggle_facet(this)">Subject</a>
<span id="facet_subject_terms" class="facet"
<br />
- <a id="facet_author" class="unselected"
+ <a id="facet_author" class="selected"
onclick="toggle_facet(this)">Author</a>
<span id="facet_author_terms" class="facet"
- style="display: block;"></span>
+ style="display: none;"></span>
<br />
<span id="facet_date_terms" class="facet"
style="display: none;"></span>
- <br />
-
- <a id="facet_xtargets" class="selected"
- onclick="toggle_facet(this)">Targets</a>
- <span id="facet_xtargets_terms" class="facet"
- style="display: none;"></span>
-
</div>
<div class="content" id="body">
-/* $Id: search.js,v 1.50 2007-03-20 05:23:06 quinn Exp $
+/* $Id: search.js,v 1.51 2007-03-20 05:34:00 quinn Exp $
* ---------------------------------------------------
* Javascript container
*/
var searched = 0;
var cur_id = -1;
var cur_rec = 0;
+var filter = '';
function initialize ()
{
facet_list = get_available_facets();
start_session();
- //session_check();
+ session_check();
set_sort();
}
var term = obj.getAttribute('term');
var cur_termlist = obj.getAttribute('facet');
var query_cell = document.getElementById('query');
+ var id = obj.getAttribute('target_id');
term = term.replace(/[\(\)]/g, '');
query_cell.value += ' and au="' + term + '"';
else if (cur_termlist == 'date')
query_cell.value += ' and date="' + term + '"';
+ else if (cur_termlist == 'xtargets')
+ filter ='id=' + id;
start_search();
}
{
var namen = terms[t].getElementsByTagName("name");
var freqn = terms[t].getElementsByTagName("frequency");
+ var idn = terms[t].getElementsByTagName("id");
if (namen[0])
{
var term = namen[0].childNodes[0].nodeValue;
var freq = freqn[0].childNodes[0].nodeValue;
- var refine_cell;
- if (listname != 'xtargets')
- {
- refine_cell = create_element('a', term + ' (' + freq + ')');
- refine_cell.setAttribute('href', '#');
- refine_cell.setAttribute('term', term);
- refine_cell.setAttribute('facet', listname);
- refine_cell.onclick = function () {
- refine_query(this);
- return false;
- };
- }
- else
- refine_cell = create_element('div', term + ' (' + freq + ')');
- body.appendChild(refine_cell);
+ var id;
+ if (idn[0])
+ id = idn[0].childNodes[0].nodeValue;
+ var refine_cell = create_element('a', term + ' (' + freq + ')');
+ refine_cell.setAttribute('href', '#');
+ refine_cell.setAttribute('term', term);
+ refine_cell.setAttribute('facet', listname);
+ refine_cell.setAttribute('target_id', id);
+ refine_cell.onclick = function () {
+ refine_query(this);
+ return false;
+ };
+ body.appendChild(refine_cell);
}
}
}
stattimer = setTimeout(check_stat, 1000);
}
+function clear_filter()
+{
+ filter = '';
+}
+
function start_search()
{
clearTimeout(termtimer);
var url = "search.pz2?" +
"command=search" +
"&session=" + session +
- "&query=" + query;
+ "&query=" + query +
+ "&filter=" + escape(filter);
xsearch = GetXmlHttpObject();
xsearch.onreadystatechange=search_started;
xsearch.open("GET", url);