Lines 67-72
Link Here
|
67 |
[% total | html %] result(s) found [% IF ( query_desc ) %]for <span class="results_query_desc">'[% query_desc | html %]'</span>[% END %][% IF limit_desc %] with limit(s): <span class="results_limit_desc">'[% limit_desc | html %]'</span>[% END %][% IF ( LibraryName ) %] in [% LibraryName | html %] Catalog[% END %]. |
67 |
[% total | html %] result(s) found [% IF ( query_desc ) %]for <span class="results_query_desc">'[% query_desc | html %]'</span>[% END %][% IF limit_desc %] with limit(s): <span class="results_limit_desc">'[% limit_desc | html %]'</span>[% END %][% IF ( LibraryName ) %] in [% LibraryName | html %] Catalog[% END %]. |
68 |
</h3> |
68 |
</h3> |
69 |
<a href="/cgi-bin/koha/catalogue/search.pl?advsearch=1&edit_search=1&[% query_cgi | $raw %]&[% limit_cgi | $raw %]&sort_by=[% sort_by | $raw %]">Edit this search</a> |
69 |
<a href="/cgi-bin/koha/catalogue/search.pl?advsearch=1&edit_search=1&[% query_cgi | $raw %]&[% limit_cgi | $raw %]&sort_by=[% sort_by | $raw %]">Edit this search</a> |
|
|
70 |
[% IF ( Koha.Preference('SavedSearchFilters') && CAN_user_parameters_manage_search_filters ) %] |
71 |
| <a href="#" id="save_search_filter">Save search as filter</a> |
72 |
[% END %] |
70 |
|
73 |
|
71 |
<div class="searchheader" id="searchheader"> |
74 |
<div class="searchheader" id="searchheader"> |
72 |
<div id="selection_ops"> |
75 |
<div id="selection_ops"> |
Lines 323-328
Link Here
|
323 |
<p><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% searchtoorder_basketno | uri %]">View basket<a></p> |
326 |
<p><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% searchtoorder_basketno | uri %]">View basket<a></p> |
324 |
[% END %] |
327 |
[% END %] |
325 |
<a href="/cgi-bin/koha/catalogue/search.pl?advsearch=1&edit_search=1&[% query_cgi | $raw %]&[% limit_cgi | $raw %]&sort_by=[% sort_by | $raw %]">Edit this search</a> |
328 |
<a href="/cgi-bin/koha/catalogue/search.pl?advsearch=1&edit_search=1&[% query_cgi | $raw %]&[% limit_cgi | $raw %]&sort_by=[% sort_by | $raw %]">Edit this search</a> |
|
|
329 |
[% IF ( Koha.Preference('SavedSearchFilters') &&CAN_user_parameters_manage_search_filters ) %] |
330 |
| <a href="#" id="save_search_filter">Save search as filter</a> |
331 |
[% END %] |
326 |
[% ELSE %] |
332 |
[% ELSE %] |
327 |
<p>You did not specify any search criteria.</p> |
333 |
<p>You did not specify any search criteria.</p> |
328 |
[% END %] |
334 |
[% END %] |
Lines 679-684
Link Here
|
679 |
</div> |
685 |
</div> |
680 |
[% END #/IF outer_sup_results_loop %] |
686 |
[% END #/IF outer_sup_results_loop %] |
681 |
|
687 |
|
|
|
688 |
[% IF ( Koha.Preference('SavedSearchFilters') && CAN_user_parameters_manage_search_filters ) %] |
689 |
<div id="search_filters_modal" class="modal" role="dialog" aria-hidden="true"> |
690 |
<div class="modal-dialog"> |
691 |
<div class="modal-content"> |
692 |
<div class="modal-header"> |
693 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
694 |
<h3 id="search_filters_label">Save: '[% query_desc | html %]' with limits '[% limit_desc | html %]' as filter</h3> |
695 |
</div> |
696 |
<div class="modal-body"> |
697 |
<h6>Visibility:</h6> |
698 |
<label for="show_filter_opac">Show in OPAC?</label> |
699 |
<input type="checkbox" id="show_filter_opac" name="show_filter_opac"> |
700 |
<label for="show_filter_staff_client">Show in Staff client?</label> |
701 |
<input type="checkbox" id="show_filter_staff_client" name="show_filter_staff_client"> |
702 |
<hr> |
703 |
<h6>Save as new search filter:</h6> |
704 |
<label for="new_filter">Name:</label> |
705 |
<input id="new_filter" name="new_filter" type="text"> |
706 |
<a id="save_new_filter" class="btn btn-default btn-xs" href="#">Save</a> |
707 |
</br>OR</br> |
708 |
<h6>Replace existing search filter:</h6> |
709 |
<label for="existing_filters">Choose</label> |
710 |
<select id="existing_filters" name="existing_filters" class="search_filters_list"></select> |
711 |
<a id="replace_existing_filter" class="btn btn-default btn-xs" href="#">Replace</a> |
712 |
</div> |
713 |
<div class="modal-footer"> |
714 |
<a href="#" data-dismiss="modal" aria-hidden="true" class="cancel">Cancel</a> |
715 |
</div> |
716 |
</div> |
717 |
</div> |
718 |
</div> |
719 |
[% END %] |
720 |
|
682 |
<form id="hold_form" method="get" action="/cgi-bin/koha/reserve/request.pl"> |
721 |
<form id="hold_form" method="get" action="/cgi-bin/koha/reserve/request.pl"> |
683 |
<!-- Value will be set here by placeHold() --> |
722 |
<!-- Value will be set here by placeHold() --> |
684 |
<input type="hidden" name="findborrower" id="holdFor" value="" /> |
723 |
<input type="hidden" name="findborrower" id="holdFor" value="" /> |
Lines 704-709
Link Here
|
704 |
[% Asset.js("js/browser.js") | $raw %] |
743 |
[% Asset.js("js/browser.js") | $raw %] |
705 |
[% Asset.js("lib/hc-sticky.js") | $raw %] |
744 |
[% Asset.js("lib/hc-sticky.js") | $raw %] |
706 |
[% Asset.js("js/coce.js") | $raw %] |
745 |
[% Asset.js("js/coce.js") | $raw %] |
|
|
746 |
[% Asset.css("css/humanmsg.css") | $raw %] |
747 |
[% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %] |
748 |
[% INCLUDE 'select2.inc' %] |
707 |
<script> |
749 |
<script> |
708 |
var PREF_AmazonCoverImages = parseInt( "[% Koha.Preference('AmazonCoverImages') | html %]", 10); |
750 |
var PREF_AmazonCoverImages = parseInt( "[% Koha.Preference('AmazonCoverImages') | html %]", 10); |
709 |
var q_array = new Array(); // will hold search terms, if present |
751 |
var q_array = new Array(); // will hold search terms, if present |
Lines 737-742
Link Here
|
737 |
query_desc: "[% To.json( query_desc ) | html %]", |
779 |
query_desc: "[% To.json( query_desc ) | html %]", |
738 |
query_cgi: "[% query_cgi | html %]", |
780 |
query_cgi: "[% query_cgi | html %]", |
739 |
limit_cgi: "[% limit_cgi | html %]", |
781 |
limit_cgi: "[% limit_cgi | html %]", |
|
|
782 |
query_json: [% query_json | $raw %], |
783 |
limit_json: [% limit_json | $raw %], |
740 |
sort_by: "[% sort_by | html %]", |
784 |
sort_by: "[% sort_by | html %]", |
741 |
gotoPage: "[% gotoPage | html %]", |
785 |
gotoPage: "[% gotoPage | html %]", |
742 |
gotoNumber: "[% gotoNumber | html %]", |
786 |
gotoNumber: "[% gotoNumber | html %]", |
Lines 746-751
Link Here
|
746 |
first_biblionumber: "[% SEARCH_RESULTS.first.biblionumber | html %]", |
790 |
first_biblionumber: "[% SEARCH_RESULTS.first.biblionumber | html %]", |
747 |
last_biblionumber: "[% SEARCH_RESULTS.last.biblionumber | html %]", |
791 |
last_biblionumber: "[% SEARCH_RESULTS.last.biblionumber | html %]", |
748 |
} |
792 |
} |
|
|
793 |
[% IF ( CAN_user_parameters_manage_search_filters ) %] |
794 |
function getFilters(id) { |
795 |
const select = $("#existing_filters"); |
796 |
$("option[value!='']", select).remove(); |
797 |
return new Promise(function(resolve, reject) { |
798 |
$.ajax("/api/v1/search_filters") |
799 |
.then(resolve, reject); |
800 |
}) |
801 |
.then(function(filters) { |
802 |
filters.forEach(function(filter) { |
803 |
const opt = $("<option/>"); |
804 |
select.append(opt); |
805 |
if(id && filter.search_filter_id == id) { |
806 |
opt.prop('selected', true); |
807 |
} |
808 |
opt.attr("value", filter.search_filter_id); |
809 |
opt.attr("title", "Query:" + filter.filter_query + " Limit:"+filter.filter_limits); |
810 |
opt.text(filter.name); |
811 |
opt.data("filter", filter); |
812 |
}); |
813 |
}) |
814 |
.then(function(){ |
815 |
select.change(); |
816 |
}); |
817 |
} |
818 |
$("#save_search_filter").click(function(){ |
819 |
getFilters(); |
820 |
$("#search_filters_modal").modal('show'); |
821 |
}); |
822 |
$("#save_new_filter").click(function(){ |
823 |
let name = $("#new_filter").val().trim(); |
824 |
if(!name){ |
825 |
humanMsg.displayAlert( _("You must provide a name for the new filter"), { className: 'human Error' } ); |
826 |
return; |
827 |
} |
828 |
let opac = $("#show_filter_opac").prop('checked'); |
829 |
let staff = $("#show_filter_staff_client").prop('checked'); |
830 |
save_search_filter(name,null,opac,staff); |
831 |
}); |
832 |
$("#replace_existing_filter").click(function(){ |
833 |
let id = $("#existing_filters").val(); |
834 |
let name = $("#existing_filters option[value="+id+"]").text(); |
835 |
console.log(id,name); |
836 |
save_search_filter(name,id); |
837 |
}); |
838 |
function save_search_filter(name,id,opac,staff){ |
839 |
let options = { |
840 |
url: '/api/v1/search_filters', |
841 |
contentType: "application/json", |
842 |
data: JSON.stringify({ |
843 |
name: name, |
844 |
filter_query: JSON.stringify(search_result.query_json), |
845 |
filter_limits: JSON.stringify(search_result.limit_json), |
846 |
opac: opac, |
847 |
staff_client: staff, |
848 |
}) |
849 |
}; |
850 |
if (id){ |
851 |
options.method = "PUT"; |
852 |
options.url = options.url+"/"+id |
853 |
} else { |
854 |
options.method = "POST"; |
855 |
} |
856 |
$.ajax(options) |
857 |
.then(function(result) { |
858 |
$("#search_filters_modal").modal('hide'); |
859 |
humanMsg.displayAlert( _("Saved filter: ") + name , { className: 'human Success' } ); |
860 |
getFilters(); |
861 |
}) |
862 |
.fail(function(err) { |
863 |
console.log(err); |
864 |
humanMsg.displayAlert( _("There was an error during saving:") + err.responseText, { className: 'humanError' } ); |
865 |
}); |
866 |
} |
867 |
|
868 |
[% END %] |
749 |
</script> |
869 |
</script> |
750 |
[% Asset.js("js/pages/results.js") | $raw %] |
870 |
[% Asset.js("js/pages/results.js") | $raw %] |
751 |
[% END %] |
871 |
[% END %] |