View | Details | Raw Unified | Return to bug 19786
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/auth-finder-search.inc (-105 lines)
Lines 1-109 Link Here
1
[% PROCESS 'form-blocks.inc' %]
1
[% PROCESS 'form-blocks.inc' %]
2
<script type="text/javascript">
3
//<![CDATA[
4
5
$(document).ready(function(){
6
    $("#clear").on("click",function(e){
7
        e.preventDefault();
8
        finderjumpfull('blinddetail-biblio-search.pl?authid=0&index=[% index %]');
9
    });
10
    $("#createnew").on("click",function(e){
11
        e.preventDefault();
12
        finderjumpfull('authorities.pl?index=[% index %]&authtypecode=[% authtypecode %]');
13
    });
14
    // marclist
15
    $( "#value_any" ).autocomplete({
16
        source: function(request, response) {
17
            $.ajax({
18
                url: "/cgi-bin/koha/authorities/ysearch.pl",
19
                dataType: "json",
20
                data: {
21
                    authtypecode : "[% authtypecode %]",
22
                    term: request.term,
23
                    op: "do_search",
24
                    type: "intranet",
25
                    and_or: "and",
26
                    operator: "contains",
27
                    orderby: "HeadingAsc",
28
                    querytype: "marclist"
29
                },
30
                success: function(data) {
31
                    response( $.map( data, function( item ) {
32
                            return {
33
                                label: item.summary,
34
                                value: item.summary
35
                            }
36
                        }));
37
                }
38
            });
39
        },
40
        minLength: 3,
41
    });
42
    // mainentry
43
    $( "#value_main" ).autocomplete({
44
        source: function(request, response) {
45
            $.ajax({
46
                url: "/cgi-bin/koha/authorities/ysearch.pl",
47
                dataType: "json",
48
                data: {
49
                    authtypecode : "[% authtypecode %]",
50
                    term: request.term,
51
                    op: "do_search",
52
                    type: "intranet",
53
                    and_or: "and",
54
                    operator: "contains",
55
                    orderby: "HeadingAsc",
56
                    querytype: "mainentry"
57
                },
58
                success: function(data) {
59
                    response( $.map( data, function( item ) {
60
                            return {
61
                                label: item.summary,
62
                                value: item.summary
63
                            }
64
                        }));
65
                }
66
            });
67
        },
68
        minLength: 3,
69
    });
70
    // mainmainentry
71
    $( "#value_mainstr" ).autocomplete({
72
        source: function(request, response) {
73
            $.ajax({
74
                url: "/cgi-bin/koha/authorities/ysearch.pl",
75
                dataType: "json",
76
                data: {
77
                    authtypecode : "[% authtypecode %]",
78
                    term: request.term,
79
                    op: "do_search",
80
                    type: "intranet",
81
                    and_or: "and",
82
                    operator: "contains",
83
                    orderby: "HeadingAsc",
84
                    querytype: "mainmainentry"
85
                },
86
                success: function(data) {
87
                    response( $.map( data, function( item ) {
88
                            return {
89
                                label: item.summary,
90
                                value: item.summary
91
                            }
92
                        }));
93
                }
94
            });
95
        },
96
        minLength: 3,
97
    });
98
});
99
100
function finderjumpfull(page)
101
{
102
    window.open(page,'','fullscreen,scrollbars');
103
}
104
105
//]]>
106
</script>
107
2
108
<div id="toolbar" class="btn-toolbar">
3
<div id="toolbar" class="btn-toolbar">
109
    <div class="btn-group"><a href="#" id="clear" class="btn btn-default btn-sm"><i class="fa fa-trash"></i> Clear field</a></div>
4
    <div class="btn-group"><a href="#" id="clear" class="btn btn-default btn-sm"><i class="fa fa-trash"></i> Clear field</a></div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/auth_finder.tt (-1 / +11 lines)
Lines 1-3 Link Here
1
[% SET footerjs = 1 %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Cataloging authority plugin</title>
3
<title>Koha &rsaquo; Cataloging authority plugin</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
Lines 21-24 Link Here
21
   </div>
22
   </div>
22
</div>
23
</div>
23
</div>
24
</div>
24
[% INCLUDE 'popup-bottom.inc' %]
25
26
[% MACRO jsinclude BLOCK %]
27
    <script type="text/javascript">
28
        var index = "[% index %]";
29
        var authtypecode = "[% authtypecode %]";
30
    </script>
31
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/auth-finder-search.js"></script>
32
[% END %]
33
34
[% INCLUDE 'intranet-bottom.inc' popup_window = 1 %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt (-114 / +116 lines)
Lines 1-129 Link Here
1
[% SET footerjs = 1 %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Authority details</title>
3
<title>Koha &rsaquo; Authority details</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
4
<script type="text/javascript">
5
//<![CDATA[
6
    $(document).ready(function(){
7
        var index_start = "[% index %]";
8
        var whichfield;
9
        try {
10
            whichfield = opener.opener.document.getElementById(index_start);
11
        } catch(e) {
12
            return;
13
        }
14
15
        var field_start = whichfield.parentNode.parentNode;
16
17
        // Sets the good number of form fields for the specified subfield
18
        // Returns false if the cloning failed
19
        function SetSubfieldNumber(subfield_name, nb) {
20
            // Nothing to do if we only have one value
21
            if(nb <= 1) {
22
                return true;
23
            }
24
            
25
            // Find the subfield we want to clone
26
            var re = new RegExp('^subfield' + subfield_name,'g');
27
            var subfields = $(field_start).children('div').filter( function() {
28
                return this.id.match(re);
29
            });
30
31
            // Try to add as many clones as needed
32
            try {
33
                for(var i=0; i<nb-subfields.length; i++) {
34
                    window.opener.opener.CloneSubfield(subfields[0].getAttribute('id'),'[% advancedMARCEditor %]');
35
                }
36
            }
37
            catch(err) {
38
                return false;
39
            }
40
            return true;
41
        }
42
43
        // Fills the subfield with the values entered in argument
44
        function SetSubfieldValues() {
45
            // Get the arguments
46
            var subfield_name = arguments[0];
47
            var values = new Array();
48
            for(var i=1; i<arguments.length; i++) {
49
                values.push(arguments[i]);
50
            }
51
52
            // Create the correct number of form fields for all values
53
            // If the field cloning failed, only the first value will be added to the form.
54
            SetSubfieldNumber(subfield_name, values.length);
55
            
56
            // Find the subfields where we will add the new values
57
            var re = new RegExp('^subfield' + subfield_name,'g');
58
            var subfields = $(field_start).children('div').filter( function() {
59
                return this.id.match(re);
60
            });
61
62
            // Add the new values to those subfields, empty the additional fields
63
            var i=0;
64
            subfields.each(function() {
65
                if(i in values) {
66
                    this.getElementsByTagName('input')[1].value = values[i];
67
                }
68
                else {
69
                    this.getElementsByTagName('input')[1].value = "";
70
                }
71
                i++;
72
            });
73
        }
74
75
        [% UNLESS ( clear ) %]
76
        [% FOREACH SUBFIELD_LOO IN SUBFIELD_LOOP %]
77
            SetSubfieldValues(
78
                "[% tag_number |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %][% SUBFIELD_LOO.marc_subfield |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]"
79
            [% FOREACH marc_value IN SUBFIELD_LOO.marc_values %]
80
                ,"[% marc_value |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]"
81
            [% END %]
82
            );
83
        [% END %]
84
            var indicators = field_start.getElementsByClassName('indicator flat');
85
            indicators[0].value="[% indicator1 %]";
86
            indicators[1].value="[% indicator2 %]";
87
        [% END %]
88
89
        // browse all its subfields (clear and $9)
90
        var subfields = field_start.getElementsByTagName('input');
91
        var re = /^tag_\d*_code_/;
92
        for(var i=0, len = subfields.length ; i< len ; i++) { // browse all subfields
93
            if(subfields[i].hasAttribute('name') == 0 ) {continue; }  // div elements specific to Select2
94
            if(subfields[i].getAttribute('name').match(re)){ // it s a subfield
95
                var code     = subfields[i];   // code is the first input
96
                var subfield = subfields[i+1]; // subfield the second
97
98
            [% IF ( clear ) %]
99
                if (subfield){subfield.value="" ;}
100
            [% ELSE %]
101
                if(code.value=='9'){
102
                    subfield.value = "[% authid |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]";
103
                    break;
104
                }
105
            [% END %]
106
            }
107
        }
108
109
      	opener.close();
110
       	window.close();
111
            
112
       	return false;
113
    });
114
//]]>
115
</script>
116
</head>
5
</head>
6
117
<body id="auth_blinddetail-biblio-search" class="auth">
7
<body id="auth_blinddetail-biblio-search" class="auth">
118
8
119
<div id="doc" class="yui-t7">
9
<div id="doc" class="yui-t7">
120
   <div id="bd">
10
   <div id="bd">
121
	<div class="yui-g">
11
	<div class="yui-g">
122
12
123
13
        <div id="loading"> <img src="[% interface %]/[% theme %]/img/spinner-small.gif" alt="" /> Loading </div>
124
14
125
</div>
15
</div>
126
</div>
16
</div>
127
</div>
17
</div>
128
18
129
[% INCLUDE 'popup-bottom.inc' %]
19
[% MACRO jsinclude BLOCK %]
20
    <script type="text/javascript">
21
        $(document).ready(function(){
22
            var index_start = "[% index %]";
23
            var whichfield;
24
            try {
25
                whichfield = opener.opener.document.getElementById(index_start);
26
            } catch(e) {
27
                return;
28
            }
29
30
            var field_start = whichfield.parentNode.parentNode;
31
32
            // Sets the good number of form fields for the specified subfield
33
            // Returns false if the cloning failed
34
            function SetSubfieldNumber(subfield_name, nb) {
35
                // Nothing to do if we only have one value
36
                if(nb <= 1) {
37
                    return true;
38
                }
39
40
                // Find the subfield we want to clone
41
                var re = new RegExp('^subfield' + subfield_name,'g');
42
                var subfields = $(field_start).children('div').filter( function() {
43
                    return this.id.match(re);
44
                });
45
46
                // Try to add as many clones as needed
47
                try {
48
                    for(var i=0; i<nb-subfields.length; i++) {
49
                        window.opener.opener.CloneSubfield(subfields[0].getAttribute('id'),'[% advancedMARCEditor %]');
50
                    }
51
                }
52
                catch(err) {
53
                    return false;
54
                }
55
                return true;
56
            }
57
58
            // Fills the subfield with the values entered in argument
59
            function SetSubfieldValues() {
60
                // Get the arguments
61
                var subfield_name = arguments[0];
62
                var values = new Array();
63
                for(var i=1; i<arguments.length; i++) {
64
                    values.push(arguments[i]);
65
                }
66
67
                // Create the correct number of form fields for all values
68
                // If the field cloning failed, only the first value will be added to the form.
69
                SetSubfieldNumber(subfield_name, values.length);
70
71
                // Find the subfields where we will add the new values
72
                var re = new RegExp('^subfield' + subfield_name,'g');
73
                var subfields = $(field_start).children('div').filter( function() {
74
                    return this.id.match(re);
75
                });
76
77
                // Add the new values to those subfields, empty the additional fields
78
                var i=0;
79
                subfields.each(function() {
80
                    if(i in values) {
81
                        this.getElementsByTagName('input')[1].value = values[i];
82
                    }
83
                    else {
84
                        this.getElementsByTagName('input')[1].value = "";
85
                    }
86
                    i++;
87
                });
88
            }
89
90
            [% UNLESS ( clear ) %]
91
            [% FOREACH SUBFIELD_LOO IN SUBFIELD_LOOP %]
92
                SetSubfieldValues(
93
                    "[% tag_number |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %][% SUBFIELD_LOO.marc_subfield |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]"
94
                [% FOREACH marc_value IN SUBFIELD_LOO.marc_values %]
95
                    ,"[% marc_value |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]"
96
                [% END %]
97
                );
98
            [% END %]
99
                var indicators = field_start.getElementsByClassName('indicator flat');
100
                indicators[0].value="[% indicator1 %]";
101
                indicators[1].value="[% indicator2 %]";
102
            [% END %]
103
104
            // browse all its subfields (clear and $9)
105
            var subfields = field_start.getElementsByTagName('input');
106
            var re = /^tag_\d*_code_/;
107
            for(var i=0, len = subfields.length ; i< len ; i++) { // browse all subfields
108
                if(subfields[i].hasAttribute('name') == 0 ) {continue; }  // div elements specific to Select2
109
                if(subfields[i].getAttribute('name').match(re)){ // it s a subfield
110
                    var code     = subfields[i];   // code is the first input
111
                    var subfield = subfields[i+1]; // subfield the second
112
113
                [% IF ( clear ) %]
114
                    if (subfield){subfield.value="" ;}
115
                [% ELSE %]
116
                    if(code.value=='9'){
117
                        subfield.value = "[% authid |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]";
118
                        break;
119
                    }
120
                [% END %]
121
                }
122
            }
123
124
            opener.close();
125
            window.close();
126
            return false;
127
        });
128
    </script>
129
[% END %]
130
131
[% INCLUDE 'intranet-bottom.inc' popup_window = 1 %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt (-20 / +29 lines)
Lines 1-3 Link Here
1
[% SET footerjs = 1 %]
1
[% PROCESS 'authorities-search-results.inc' %]
2
[% PROCESS 'authorities-search-results.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Cataloging authority plugin</title>
4
<title>Koha &rsaquo; Cataloging authority plugin</title>
Lines 5-30 Link Here
5
<style type="text/css">
6
<style type="text/css">
6
#custom-doc { width:51.46em;*width:50.17em;min-width:675px; margin:auto; text-align:left; } 
7
#custom-doc { width:51.46em;*width:50.17em;min-width:675px; margin:auto; text-align:left; } 
7
</style>
8
</style>
8
<script type="text/javascript">
9
10
function jumpfull(page)
11
{	
12
    window.open(page,'','fullscreen,scrollbars');
13
}
14
15
function doauth(authid, index, repet)
16
{
17
[% IF source == 'auth' %]
18
    var e = document.getElementById("relationship");
19
    var relationship = e.options[e.selectedIndex].value;
20
21
    jumpfull('blinddetail-biblio-search.pl?authid=' + authid + '&index=' + index + '&repet=' + repet + '&relationship=' + relationship);
22
[% ELSE %]
23
    jumpfull('blinddetail-biblio-search.pl?authid=' + authid + '&index=' + index + '&repet=' + repet);
24
[% END %]
25
}
26
</script>
27
</head>
9
</head>
10
28
<body id="auth_searchresultlist_auth" class="auth">
11
<body id="auth_searchresultlist_auth" class="auth">
29
<div id="custom-doc" class="yui-t7">
12
<div id="custom-doc" class="yui-t7">
30
13
Lines 111-114 function doauth(authid, index, repet) Link Here
111
</div>
94
</div>
112
</div>
95
</div>
113
</div>
96
</div>
114
[% INCLUDE 'popup-bottom.inc' %]
97
98
[% MACRO jsinclude BLOCK %]
99
    <script type="text/javascript">
100
        var index = "[% index %]";
101
        var authtypecode = "[% authtypecode %]";
102
    </script>
103
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/auth-finder-search.js"></script>
104
    <script type="text/javascript">
105
106
        function jumpfull(page){
107
            window.open(page,'','width=100,height=100,resizable=yes,toolbar=false,scrollbars=yes,top');
108
        }
109
110
        function doauth(authid, index, repet){
111
            [% IF source == 'auth' %]
112
                var e = document.getElementById("relationship");
113
                var relationship = e.options[e.selectedIndex].value;
114
115
                jumpfull('blinddetail-biblio-search.pl?authid=' + authid + '&index=' + index + '&repet=' + repet + '&relationship=' + relationship);
116
            [% ELSE %]
117
                jumpfull('blinddetail-biblio-search.pl?authid=' + authid + '&index=' + index + '&repet=' + repet);
118
            [% END %]
119
        }
120
    </script>
121
[% END %]
122
123
[% INCLUDE 'intranet-bottom.inc' popup_window = 1 %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/auth-finder-search.js (-1 / +100 lines)
Line 0 Link Here
0
- 
1
/* global index authtypecode */
2
3
$(document).ready(function(){
4
    $("#clear").on("click",function(e){
5
        e.preventDefault();
6
        finderjumpfull('blinddetail-biblio-search.pl?authid=0&index=' + index );
7
    });
8
    $("#createnew").on("click",function(e){
9
        e.preventDefault();
10
        finderjumpfull('authorities.pl?index=' + index + '&authtypecode=' + authtypecode );
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: "contains",
25
                    orderby: "HeadingAsc",
26
                    querytype: "marclist"
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: "contains",
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: "contains",
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 finderjumpfull(page){
99
    window.open(page,'','width=100,height=100,resizable=yes,toolbar=false,scrollbars=yes,top');
100
}

Return to bug 19786