Lines 79-84
Link Here
|
79 |
<input type="submit" id="refine" value="Search"> |
79 |
<input type="submit" id="refine" value="Search"> |
80 |
</form> |
80 |
</form> |
81 |
</div> |
81 |
</div> |
|
|
82 |
[% IF ( Koha.Preference('SavedSearchFilters') && CAN_user_parameters_manage_search_filters ) %] |
83 |
| <a href="#" id="save_search_filter">Save search as filter</a> |
84 |
[% END %] |
82 |
|
85 |
|
83 |
<div class="searchheader" id="searchheader"> |
86 |
<div class="searchheader" id="searchheader"> |
84 |
<div id="selection_ops"> |
87 |
<div id="selection_ops"> |
Lines 341-346
Link Here
|
341 |
<p><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% searchtoorder_basketno | uri %]">View basket<a></p> |
344 |
<p><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% searchtoorder_basketno | uri %]">View basket<a></p> |
342 |
[% END %] |
345 |
[% END %] |
343 |
<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> |
346 |
<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> |
|
|
347 |
[% IF ( Koha.Preference('SavedSearchFilters') &&CAN_user_parameters_manage_search_filters ) %] |
348 |
| <a href="#" id="save_search_filter">Save search as filter</a> |
349 |
[% END %] |
344 |
[% ELSE %] |
350 |
[% ELSE %] |
345 |
<p>You did not specify any search criteria.</p> |
351 |
<p>You did not specify any search criteria.</p> |
346 |
[% END %] |
352 |
[% END %] |
Lines 703-708
Link Here
|
703 |
</div> |
709 |
</div> |
704 |
[% END #/IF outer_sup_results_loop %] |
710 |
[% END #/IF outer_sup_results_loop %] |
705 |
|
711 |
|
|
|
712 |
[% IF ( Koha.Preference('SavedSearchFilters') && CAN_user_parameters_manage_search_filters ) %] |
713 |
<div id="search_filters_modal" class="modal" role="dialog" aria-hidden="true"> |
714 |
<div class="modal-dialog"> |
715 |
<div class="modal-content"> |
716 |
<div class="modal-header"> |
717 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
718 |
<h3 id="search_filters_label">Save: '[% query_desc | html %]' with limits '[% limit_desc | html %]' as filter</h3> |
719 |
</div> |
720 |
<div class="modal-body"> |
721 |
<h6>Visibility:</h6> |
722 |
<label for="show_filter_opac">Show in OPAC?</label> |
723 |
<input type="checkbox" id="show_filter_opac" name="show_filter_opac"> |
724 |
<label for="show_filter_staff_client">Show in Staff client?</label> |
725 |
<input type="checkbox" id="show_filter_staff_client" name="show_filter_staff_client"> |
726 |
<hr> |
727 |
<h6>Save as new search filter:</h6> |
728 |
<label for="new_filter">Name:</label> |
729 |
<input id="new_filter" name="new_filter" type="text"> |
730 |
<a id="save_new_filter" class="btn btn-default btn-xs" href="#">Save</a> |
731 |
</br>OR</br> |
732 |
<h6>Replace existing search filter:</h6> |
733 |
<label for="existing_filters">Choose</label> |
734 |
<select id="existing_filters" name="existing_filters" class="search_filters_list"></select> |
735 |
<a id="replace_existing_filter" class="btn btn-default btn-xs" href="#">Replace</a> |
736 |
</div> |
737 |
<div class="modal-footer"> |
738 |
<a href="#" data-dismiss="modal" aria-hidden="true" class="cancel">Cancel</a> |
739 |
</div> |
740 |
</div> |
741 |
</div> |
742 |
</div> |
743 |
[% END %] |
744 |
|
706 |
<form id="hold_form" method="get" action="/cgi-bin/koha/reserve/request.pl"> |
745 |
<form id="hold_form" method="get" action="/cgi-bin/koha/reserve/request.pl"> |
707 |
<!-- Value will be set here by placeHold() --> |
746 |
<!-- Value will be set here by placeHold() --> |
708 |
<input type="hidden" name="findborrower" id="holdFor" value="" /> |
747 |
<input type="hidden" name="findborrower" id="holdFor" value="" /> |
Lines 728-733
Link Here
|
728 |
[% Asset.js("js/browser.js") | $raw %] |
767 |
[% Asset.js("js/browser.js") | $raw %] |
729 |
[% Asset.js("lib/hc-sticky.js") | $raw %] |
768 |
[% Asset.js("lib/hc-sticky.js") | $raw %] |
730 |
[% Asset.js("js/coce.js") | $raw %] |
769 |
[% Asset.js("js/coce.js") | $raw %] |
|
|
770 |
[% Asset.css("css/humanmsg.css") | $raw %] |
771 |
[% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %] |
772 |
[% INCLUDE 'select2.inc' %] |
731 |
<script> |
773 |
<script> |
732 |
var PREF_AmazonCoverImages = parseInt( "[% Koha.Preference('AmazonCoverImages') | html %]", 10); |
774 |
var PREF_AmazonCoverImages = parseInt( "[% Koha.Preference('AmazonCoverImages') | html %]", 10); |
733 |
var q_array = new Array(); // will hold search terms, if present |
775 |
var q_array = new Array(); // will hold search terms, if present |
Lines 761-766
Link Here
|
761 |
query_desc: "[% To.json( query_desc ) | html %]", |
803 |
query_desc: "[% To.json( query_desc ) | html %]", |
762 |
query_cgi: "[% query_cgi | html %]", |
804 |
query_cgi: "[% query_cgi | html %]", |
763 |
limit_cgi: "[% limit_cgi | html %]", |
805 |
limit_cgi: "[% limit_cgi | html %]", |
|
|
806 |
query_json: [% query_json | $raw %], |
807 |
limit_json: [% limit_json | $raw %], |
764 |
sort_by: "[% sort_by | html %]", |
808 |
sort_by: "[% sort_by | html %]", |
765 |
gotoPage: "[% gotoPage | html %]", |
809 |
gotoPage: "[% gotoPage | html %]", |
766 |
gotoNumber: "[% gotoNumber | html %]", |
810 |
gotoNumber: "[% gotoNumber | html %]", |
Lines 777-782
Link Here
|
777 |
if( index){index += ":";} |
821 |
if( index){index += ":";} |
778 |
window.location.href = "/cgi-bin/koha/catalogue/search.pl?[% query_cgi | $raw %]&[% limit_cgi | $raw %]&[% sort_cgi | $raw %]&limit="+index+escape_str( $("#refiner").val() ); |
822 |
window.location.href = "/cgi-bin/koha/catalogue/search.pl?[% query_cgi | $raw %]&[% limit_cgi | $raw %]&[% sort_cgi | $raw %]&limit="+index+escape_str( $("#refiner").val() ); |
779 |
}); |
823 |
}); |
|
|
824 |
|
825 |
[% IF ( CAN_user_parameters_manage_search_filters ) %] |
826 |
function getFilters(id) { |
827 |
const select = $("#existing_filters"); |
828 |
$("option[value!='']", select).remove(); |
829 |
return new Promise(function(resolve, reject) { |
830 |
$.ajax("/api/v1/search_filters") |
831 |
.then(resolve, reject); |
832 |
}) |
833 |
.then(function(filters) { |
834 |
filters.forEach(function(filter) { |
835 |
const opt = $("<option/>"); |
836 |
select.append(opt); |
837 |
if(id && filter.search_filter_id == id) { |
838 |
opt.prop('selected', true); |
839 |
} |
840 |
opt.attr("value", filter.search_filter_id); |
841 |
opt.attr("title", "Query:" + filter.filter_query + " Limit:"+filter.filter_limits); |
842 |
opt.text(filter.name); |
843 |
opt.data("filter", filter); |
844 |
}); |
845 |
}) |
846 |
.then(function(){ |
847 |
select.change(); |
848 |
}); |
849 |
} |
850 |
$("#save_search_filter").click(function(){ |
851 |
getFilters(); |
852 |
$("#search_filters_modal").modal('show'); |
853 |
}); |
854 |
$("#save_new_filter").click(function(){ |
855 |
let name = $("#new_filter").val().trim(); |
856 |
if(!name){ |
857 |
humanMsg.displayAlert( _("You must provide a name for the new filter"), { className: 'human Error' } ); |
858 |
return; |
859 |
} |
860 |
let opac = $("#show_filter_opac").prop('checked'); |
861 |
let staff = $("#show_filter_staff_client").prop('checked'); |
862 |
save_search_filter(name,null,opac,staff); |
863 |
}); |
864 |
$("#replace_existing_filter").click(function(){ |
865 |
let id = $("#existing_filters").val(); |
866 |
let name = $("#existing_filters option[value="+id+"]").text(); |
867 |
console.log(id,name); |
868 |
save_search_filter(name,id); |
869 |
}); |
870 |
function save_search_filter(name,id,opac,staff){ |
871 |
let options = { |
872 |
url: '/api/v1/search_filters', |
873 |
contentType: "application/json", |
874 |
data: JSON.stringify({ |
875 |
name: name, |
876 |
filter_query: JSON.stringify(search_result.query_json), |
877 |
filter_limits: JSON.stringify(search_result.limit_json), |
878 |
opac: opac, |
879 |
staff_client: staff, |
880 |
}) |
881 |
}; |
882 |
if (id){ |
883 |
options.method = "PUT"; |
884 |
options.url = options.url+"/"+id |
885 |
} else { |
886 |
options.method = "POST"; |
887 |
} |
888 |
$.ajax(options) |
889 |
.then(function(result) { |
890 |
$("#search_filters_modal").modal('hide'); |
891 |
humanMsg.displayAlert( _("Saved filter: ") + name , { className: 'human Success' } ); |
892 |
getFilters(); |
893 |
}) |
894 |
.fail(function(err) { |
895 |
console.log(err); |
896 |
humanMsg.displayAlert( _("There was an error during saving:") + err.responseText, { className: 'humanError' } ); |
897 |
}); |
898 |
} |
899 |
|
900 |
[% END %] |
780 |
</script> |
901 |
</script> |
781 |
[% Asset.js("js/pages/results.js") | $raw %] |
902 |
[% Asset.js("js/pages/results.js") | $raw %] |
782 |
[% END %] |
903 |
[% END %] |