Lines 41-60
require.config( {
Link Here
|
41 |
|
41 |
|
42 |
<script> |
42 |
<script> |
43 |
require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'preferences', 'resources', 'text-marc', 'widget' ], function( KohaBackend, Search, Macros, MARCEditor, MARC, Preferences, Resources, TextMARC, Widget ) { |
43 |
require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'preferences', 'resources', 'text-marc', 'widget' ], function( KohaBackend, Search, Macros, MARCEditor, MARC, Preferences, Resources, TextMARC, Widget ) { |
44 |
var z3950Servers = { |
44 |
var z3950Servers = [ |
45 |
'koha:biblioserver': { |
45 |
{ |
|
|
46 |
server_id: 'koha:biblioserver', |
46 |
name: _("Local catalog"), |
47 |
name: _("Local catalog"), |
47 |
recordtype: 'biblio', |
48 |
recordtype: 'biblio', |
48 |
checked: false, |
49 |
checked: false, |
49 |
}, |
50 |
}, |
50 |
[%- FOREACH server = z3950_servers -%] |
51 |
[%- FOREACH server = z3950_servers -%] |
51 |
[% server.id | html %]: { |
52 |
{ |
|
|
53 |
server_id: [% server.id | html %], |
52 |
name: '[% server.servername | html %]', |
54 |
name: '[% server.servername | html %]', |
53 |
recordtype: '[% server.recordtype | html %]', |
55 |
recordtype: '[% server.recordtype | html %]', |
54 |
checked: [% server.checked ? 'true' : 'false' | html %], |
56 |
checked: [% server.checked ? 'true' : 'false' | html %], |
55 |
}, |
57 |
}, |
56 |
[%- END -%] |
58 |
[%- END -%] |
57 |
}; |
59 |
]; |
58 |
|
60 |
|
59 |
// The columns that should show up in a search, in order, and keyed by the corresponding <metadata> tag in the XSL and Pazpar2 config |
61 |
// The columns that should show up in a search, in order, and keyed by the corresponding <metadata> tag in the XSL and Pazpar2 config |
60 |
var z3950Labels = [ |
62 |
var z3950Labels = [ |
Lines 405-412
require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr
Link Here
|
405 |
// Search functions |
407 |
// Search functions |
406 |
function showAdvancedSearch() { |
408 |
function showAdvancedSearch() { |
407 |
$('#advanced-search-servers').empty(); |
409 |
$('#advanced-search-servers').empty(); |
408 |
$.each( z3950Servers, function( server_id, server ) { |
410 |
$.each( z3950Servers, function( index, server ) { |
409 |
$('#advanced-search-servers').append( '<li data-server-id="' + server_id + '"><label><input class="search-toggle-server" type="checkbox"' + ( server.checked ? ' checked="checked">' : '>' ) + server.name + '</label></li>' ); |
411 |
$('#advanced-search-servers').append( '<li data-server-id="' + index + '"><label><input class="search-toggle-server" type="checkbox"' + ( server.checked ? ' checked="checked">' : '>' ) + server.name + '</label></li>' ); |
410 |
} ); |
412 |
} ); |
411 |
$('#advanced-search-ui').modal('show'); |
413 |
$('#advanced-search-ui').modal('show'); |
412 |
} |
414 |
} |
Lines 457-474
require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr
Link Here
|
457 |
$('#searchresults tbody').empty(); |
459 |
$('#searchresults tbody').empty(); |
458 |
$('#search-serversinfo').empty(); |
460 |
$('#search-serversinfo').empty(); |
459 |
|
461 |
|
460 |
$.each( z3950Servers, function( server_id, server ) { |
462 |
$.each( z3950Servers, function( index, server ) { |
461 |
var num_fetched = data.num_fetched[server_id]; |
463 |
var num_fetched = data.num_fetched[server.server_id]; |
462 |
|
464 |
|
463 |
if ( data.errors[server_id] ) { |
465 |
if ( data.errors[server.server_id] ) { |
464 |
num_fetched = data.errors[server_id]; |
466 |
num_fetched = data.errors[server.server_id]; |
465 |
} else if ( num_fetched == null ) { |
467 |
} else if ( num_fetched == null ) { |
466 |
num_fetched = '-'; |
468 |
num_fetched = '-'; |
467 |
} else if ( num_fetched < data.num_hits[server_id] ) { |
469 |
} else if ( num_fetched < data.num_hits[server.server_id] ) { |
468 |
num_fetched += '+'; |
470 |
num_fetched += '+'; |
469 |
} |
471 |
} |
470 |
|
472 |
|
471 |
$('#search-serversinfo').append( '<li data-server-id="' + server_id + '"><label><input class="search-toggle-server" type="checkbox"' + ( server.checked ? ' checked="checked">' : '>' ) + server.name + ' (' + num_fetched + ')' + '</label></li>' ); |
473 |
$('#search-serversinfo').append( '<li data-server-id="' + index + '"><label><input class="search-toggle-server" type="checkbox"' + ( server.checked ? ' checked="checked">' : '>' ) + server.name + ' (' + num_fetched + ')' + '</label></li>' ); |
472 |
} ); |
474 |
} ); |
473 |
|
475 |
|
474 |
var seenColumns = {}; |
476 |
var seenColumns = {}; |
Lines 511-517
require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr
Link Here
|
511 |
} |
513 |
} |
512 |
|
514 |
|
513 |
var result = '<tr>'; |
515 |
var result = '<tr>'; |
514 |
result += '<td class="sourcecol">' + z3950Servers[ hit.server ].name + '</td>'; |
516 |
var server_name = hit.servername == 'koha:biblioserver' ? _("Local catalog") : hit.servername; |
|
|
517 |
result += '<td class="sourcecol">' + server_name + '</td>'; |
515 |
|
518 |
|
516 |
$.each( z3950Labels, function( undef, label ) { |
519 |
$.each( z3950Labels, function( undef, label ) { |
517 |
if ( !seenColumns[ label[0] ] ) return; |
520 |
if ( !seenColumns[ label[0] ] ) return; |
Lines 641-648
require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr
Link Here
|
641 |
// Macros loaded on first show of modal |
644 |
// Macros loaded on first show of modal |
642 |
break; |
645 |
break; |
643 |
case 'selected_search_targets': |
646 |
case 'selected_search_targets': |
644 |
$.each( z3950Servers, function( server_id, server ) { |
647 |
$.each( z3950Servers, function( index, server ) { |
645 |
var saved_val = Preferences.user.selected_search_targets[server_id]; |
648 |
var saved_val = Preferences.user.selected_search_targets[server.server_id]; |
646 |
|
649 |
|
647 |
if ( saved_val != null ) server.checked = saved_val; |
650 |
if ( saved_val != null ) server.checked = saved_val; |
648 |
} ); |
651 |
} ); |