Bug 9565: (follow-up) Deleting a biblio should alert/fail if there are existent subsc...
[koha.git] / koha-tmpl / intranet-tmpl / prog / js / auth-finder-search.js
1 /* global index authtypecode */
2
3 $(document).ready(function(){
4     $("#clear").on("click",function(e){
5         e.preventDefault();
6         finderjump('blinddetail-biblio-search.pl?authid=0&index=' + index );
7     });
8     $("#createnew").on("click",function(e){
9         e.preventDefault();
10         finderjump('authorities.pl?index=' + index + '&authtypecode=' + authtypecode, 'full' );
11     });
12     // marclist
13     $( "#value_any" ).autocomplete({
14         source: function(request, response) {
15             $.ajax({
16                 url: "/cgi-bin/koha/authorities/ysearch.pl",
17                 dataType: "json",
18                 data: {
19                     authtypecode : authtypecode,
20                     term: request.term,
21                     op: "do_search",
22                     type: "intranet",
23                     and_or: "and",
24                     operator: "start",
25                     orderby: "HeadingAsc",
26                     querytype: "all"
27                 },
28                 success: function(data) {
29                     response( $.map( data, function( item ) {
30                         return {
31                             label: item.summary,
32                             value: item.summary
33                         };
34                     }));
35                 }
36             });
37         },
38         minLength: 3,
39     });
40     // mainentry
41     $( "#value_main" ).autocomplete({
42         source: function(request, response) {
43             $.ajax({
44                 url: "/cgi-bin/koha/authorities/ysearch.pl",
45                 dataType: "json",
46                 data: {
47                     authtypecode : authtypecode,
48                     term: request.term,
49                     op: "do_search",
50                     type: "intranet",
51                     and_or: "and",
52                     operator: "start",
53                     orderby: "HeadingAsc",
54                     querytype: "mainentry"
55                 },
56                 success: function(data) {
57                     response( $.map( data, function( item ) {
58                         return {
59                             label: item.summary,
60                             value: item.summary
61                         };
62                     }));
63                 }
64             });
65         },
66         minLength: 3,
67     });
68     // mainmainentry
69     $( "#value_mainstr" ).autocomplete({
70         source: function(request, response) {
71             $.ajax({
72                 url: "/cgi-bin/koha/authorities/ysearch.pl",
73                 dataType: "json",
74                 data: {
75                     authtypecode : authtypecode,
76                     term: request.term,
77                     op: "do_search",
78                     type: "intranet",
79                     and_or: "and",
80                     operator: "start",
81                     orderby: "HeadingAsc",
82                     querytype: "mainmainentry"
83                 },
84                 success: function(data) {
85                     response( $.map( data, function( item ) {
86                         return {
87                             label: item.summary,
88                             value: item.summary
89                         };
90                     }));
91                 }
92             });
93         },
94         minLength: 3,
95     });
96 });
97
98 function finderjump(page, full){
99     var window_size = '';
100     if( full != "full"){
101         window_size = 'width=100,height=100,';
102     }
103     window.open(page,'', window_size + 'resizable=yes,toolbar=false,scrollbars=yes,top');
104 }