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