use OpenILS::Utils::Fieldmapper;
use OpenILS::Application::AppUtils;
use OpenSRF::Utils::JSON;
+use Data::Dumper;
+$Data::Dumper::Indent = 0;
my $U = 'OpenILS::Application::AppUtils';
my $query = [];
for (my $i = 0; $i < scalar @tags; $i++) {
+ next if ($tags[$i] eq "" || $subfields[$i] eq "" || $terms[$i] eq "");
push @$query, {
"term" => $terms[$i],
"restrict" => [{"tag" => $tags[$i], "subfield" => $subfields[$i]}]
};
}
+ $logger->info("query for expert search: " . Dumper($query));
# loc, limit and offset
my $page = $self->cgi->param("page") || 0;
my $limit = $self->_get_search_limit;
function unHideMe(node) { removeClass(node, "hide_me"); }
function hideMe(node) { addClass(node, "hide_me"); }
-var _search_row_template;
+var _search_row_template, _expert_row_template;
function addSearchRow() {
if (!_search_row_template) {
t = $("adv_global_row").cloneNode(true);
$("adv_global_addrow")
);
}
+function addExpertRow() {
+ if (!_expert_row_template) {
+ t = $("adv_expert_row").cloneNode(true);
+ t.id = null;
+ _expert_row_template = t;
+ }
+
+ $("adv_expert_rows_here").appendChild(
+ _expert_row_template.cloneNode(true)
+ );
+}
+function killRowIfAtLeast(min, link) {
+ var row = link.parentNode.parentNode;
+ if (row.parentNode.getElementsByTagName("tr").length > min)
+ row.parentNode.removeChild(row);
+ return false;
+}
function print_node(node_id) {
var iframe = document.createElement("iframe");
var source_node = document.getElementById(node_id);
* hurt FF/Chrome. */
iwin.document.open();
iwin.document.write( /* XXX make better/customizable? */
- "<html><head><title>Recipt</title></head><body></body></html>"
+ "<html><head><title>Receipt</title></head><body></body></html>"
);
iwin.document.close();
<div class="header_middle">[% l("Expert Search") %]</div>
<input type="hidden" name="_special" value="1" />
<table class="expert-search">
- <tbody id="rows_here">
- <tr id="clone_this">
+ <tbody id="adv_expert_rows_here">
+ <tr id="adv_expert_row">
<th>[% l("Tag:") %]</th>
<td><input type="text" name="tag" size="3" /></td>
<th>[% l("Subfield:") %]</th>
<td><input type="text" name="subfield" size="1" /></td>
<th>[% l("Value:") %]</th>
<td><input type="text" name="term" size="16" /></td>
+ <td>
+ <a href="javascript:;" class="row-remover"
+ title="[% l('Remove row') %]" alt="[% l('Remove row') %]"
+ onclick='return killRowIfAtLeast(1, this);'><img src="[% ctx.media_prefix %]/images/adv_row_close_btn.png" /></a>
+ </td>
</tr>
</tbody>
<tfoot>
<tr>
- <td colspan="2"><a href="javascript:alert('XXX coming soon');">[ [% l("Add row") %] ]</a></td>
+ <td colspan="2"><a href="javascript:addExpertRow();">[ [% l("Add row") %] ]</a></td>
<td colspan="4">
<input type="image" src="[% ctx.media_prefix %]/images/search_btn.gif" alt="[% l('Search') %]" title="[% l('Search') %]" />
</td>
<input type='text' size='18' name='query' value="[% q | html %]" />
<a href="javascript:;" class="row-remover"
title="[% l('Remove row') %]" alt="[% l('Remove row') %]"
- onclick='var row = this.parentNode.parentNode;var tbody = row.parentNode; if( tbody.getElementsByTagName("tr").length > 2 ) row.parentNode.removeChild(row);'><img src="[% ctx.media_prefix %]/images/adv_row_close_btn.png" /></a>
+ onclick='return killRowIfAtLeast(2, this);'><img src="[% ctx.media_prefix %]/images/adv_row_close_btn.png" /></a>
</td>
</tr>
[% i = i + 1;
<div id="zero_search_hits">
<div>
<p>[% l('Sorry, no entries were found for') %]
- [% IF is_advanced; l('your search'); ELSE %]
+ [% IF is_advanced OR is_special; l('your search'); ELSE %]
<q>[% CGI.param('query') | html %]</q>
[% END %]
<br />