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