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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt (-10 / +6 lines)
Lines 8-16 Link Here
8
[% USE Koha %]
8
[% USE Koha %]
9
9
10
<style>
10
<style>
11
.linktools { background-color:#FFF;border-top:1px solid #DDD; border-left: 1px solid #DDD; border-right: 1px solid #666; border-bottom:1px solid #666;display: none; white-space: nowrap;}
12
.linktools a { font-size : 85%; text-decoration:none; padding:.3em;background-color:#FFF; display:block;float:left;border-right:1px solid #DDD;}
13
.linktools a:hover { background-color:#EEE;color:#CC3300;border-right:1px solid #CCC;}
14
tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : transparent !important; } #dataPreview { width : 80%; } @media (max-width: 767px) { #dataPreview { margin: 0; width : auto; } }
11
tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : transparent !important; } #dataPreview { width : 80%; } @media (max-width: 767px) { #dataPreview { margin: 0; width : auto; } }
15
</style>
12
</style>
16
</head>
13
</head>
Lines 113-126 tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : Link Here
113
        [% IF ( Koha.Preference('AdditionalFieldsInZ3950ResultSearch') != '' ) %]
110
        [% IF ( Koha.Preference('AdditionalFieldsInZ3950ResultSearch') != '' ) %]
114
            <th>Additional fields</th>
111
            <th>Additional fields</th>
115
        [% END %]
112
        [% END %]
116
        <th>Preview</th>
113
        <th>Actions</th>
117
        <th>&nbsp;</th>
118
    </tr></thead>
114
    </tr></thead>
119
    <tbody>[% FOREACH breeding_loo IN breeding_loop %]
115
    <tbody>[% FOREACH breeding_loo IN breeding_loop %]
120
        [% IF ( breeding_loo.breedingid ) %]
116
        [% IF ( breeding_loo.breedingid ) %]
121
117
122
        <tr>
118
        <tr>
123
            <td>[% breeding_loo.server | html %] <div class="linktools"><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% breeding_loo.breedingid | uri %]" class="previewData">Preview MARC</a> <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=[% breeding_loo.breedingid | html %]" class="previewData">Preview card</a> <a href="/cgi-bin/koha/acqui/neworderempty.pl?frameworkcode=[% frameworkcode | uri %]&amp;breedingid=[% breeding_loo.breedingid | html %]&amp;booksellerid=[% booksellerid | uri %]&amp;basketno=[% basketno | uri %]">[% tp('verb', 'Order') | html %]</a> <a href="#" id="closemenu" title="Close this menu"> X </a></div></td>
119
            <td>[% breeding_loo.server | html %]</td>
124
            <td>[% breeding_loo.title | html %]</td>
120
            <td>[% breeding_loo.title | html %]</td>
125
            <td>[% breeding_loo.author | html %]</td>
121
            <td>[% breeding_loo.author | html %]</td>
126
            <td>[% breeding_loo.date | html %]</td>
122
            <td>[% breeding_loo.date | html %]</td>
Lines 141-156 tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : Link Here
141
            [% END %]
137
            [% END %]
142
            <td class="actions">
138
            <td class="actions">
143
                <div class="btn-group dropup">
139
                <div class="btn-group dropup">
144
                    <a class="btn btn-default btn-xs dropdown-toggle" id="z3950preview[% breeding_loo.breedingid | uri %]" role="button" data-toggle="dropdown" href="#">
140
                    <a class="btn btn-default btn-xs z3950actions" href="#">MARC</a><button data-toggle="dropdown" class="btn-xs dropdown-toggle"><span class="caret"></span></button>
145
                        Preview <b class="caret"></b>
146
                    </a>
147
                    <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="z3950preview[% breeding_loo.breedingid | html %]">
141
                    <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="z3950preview[% breeding_loo.breedingid | html %]">
148
                        <li><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% breeding_loo.breedingid | uri %]" title="MARC" class="previewData"><i class="fa fa-eye"></i> MARC</a></li>
142
                        <li><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% breeding_loo.breedingid | uri %]" title="MARC" class="previewData"><i class="fa fa-eye"></i> MARC</a></li>
149
                        <li><a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=[% breeding_loo.breedingid | uri %]" title="Card" class="previewData"><i class="fa fa-eye"></i> Card</a></li>
143
                        <li><a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=[% breeding_loo.breedingid | uri %]" title="Card" class="previewData"><i class="fa fa-eye"></i> Card</a></li>
144
                        <li><a href="/cgi-bin/koha/acqui/neworderempty.pl?frameworkcode=[% frameworkcode | uri %]&amp;breedingid=[% breeding_loo.breedingid | uri %]&amp;booksellerid=[% booksellerid | uri %]&amp;basketno=[% basketno | uri %]" class="chosen" title="Order"><i class="fa fa-plus"></i> [% tp('verb', 'Order') | html %]</a></li>
150
                    </ul>
145
                    </ul>
151
                </div>
146
                </div>
152
            </td>
147
            </td>
153
            <td class="actions"><a href="/cgi-bin/koha/acqui/neworderempty.pl?frameworkcode=[% frameworkcode | uri %]&amp;breedingid=[% breeding_loo.breedingid | uri %]&amp;booksellerid=[% booksellerid | uri %]&amp;basketno=[% basketno | uri %]" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> [% tp('verb', 'Order') | html %]</a></td>
154
        </tr>
148
        </tr>
155
        [% END %]
149
        [% END %]
156
    [% END %]</tbody>
150
    [% END %]</tbody>
Lines 232-237 tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : Link Here
232
    [% INCLUDE 'datatables.inc' %]
226
    [% INCLUDE 'datatables.inc' %]
233
    [% INCLUDE 'z3950_search.inc' %]
227
    [% INCLUDE 'z3950_search.inc' %]
234
    [% Asset.js("js/z3950_search.js") | $raw %]
228
    [% Asset.js("js/z3950_search.js") | $raw %]
229
    [% INCLUDE 'z3950_search.inc' %]
235
    <script>
230
    <script>
236
        $(document).ready(function(){
231
        $(document).ready(function(){
237
            var resultst = $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
232
            var resultst = $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
Lines 242-247 tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : Link Here
242
                "aaSorting": [[ 1, "asc" ]],
237
                "aaSorting": [[ 1, "asc" ]],
243
                "bPaginate": false
238
                "bPaginate": false
244
            }));
239
            }));
240
            InitLastAction();
245
        });
241
        });
246
    </script>
242
    </script>
247
[% END %]
243
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_auth_search.tt (-7 / +7 lines)
Lines 90-101 Link Here
90
            <td>[% breeding_loo.heading_code | html %]</td>
90
            <td>[% breeding_loo.heading_code | html %]</td>
91
            <td class="actions">
91
            <td class="actions">
92
                <div class="btn-group dropup">
92
                <div class="btn-group dropup">
93
                    <a class="btn btn-default btn-xs dropdown-toggle" id="cataloguesearchactions[% breeding_loo.breedingid | html %]" role="button" data-toggle="dropdown" href="#">
93
                    <a class="btn btn-default btn-xs z3950actions" href="#">MARC</a><button class="btn-xs dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>
94
                      Actions <b class="caret"></b>
95
                    </a>
96
                    <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="cataloguesearchactions[% breeding_loo.breedingid | html %]">
94
                    <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="cataloguesearchactions[% breeding_loo.breedingid | html %]">
97
                        <li><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% breeding_loo.breedingid | uri %]" class="previewMARC"><i class="fa fa-eye"></i> MARC preview</a></li>
95
                        <li><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% breeding_loo.breedingid | uri %]" title="MARC" class="previewData"><i class="fa fa-eye"></i> MARC preview</a></li>
98
                        <li><a href="#" class="import_record" data-breedingid="[% breeding_loo.breedingid | html %]" data-heading_code="[% breeding_loo.heading_code | html %]" data-authid="[% breeding_loo.authid | html %]" data-index="[% index | html %]" ><i class="fa fa-download"></i> Import</a></li>
96
                        <li><a href="/cgi-bin/koha/authorities/authorities.pl?breedingid=[% breeding_loo.breedingid | html %]&authtypecode=[% breeding_loo.heading_code | html %]&index=[% index | html %]" class="chosen" title="Import"><i class="fa fa-download"></i> Import</a></li>
99
                    </ul>
97
                    </ul>
100
                </div>
98
                </div>
101
            </td>
99
            </td>
Lines 104-115 Link Here
104
    [% END %]</tbody>
102
    [% END %]</tbody>
105
</table>
103
</table>
106
104
107
    <div id="marcPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
105
    <div id="dataPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
108
        <div class="modal-dialog">
106
        <div class="modal-dialog">
109
        <div class="modal-content">
107
        <div class="modal-content">
110
        <div class="modal-header">
108
        <div class="modal-header">
111
            <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
109
            <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
112
            <h3 id="marcPreviewLabel">MARC preview</h3>
110
            <h3 id="dataPreviewLabel">MARC preview</h3>
113
        </div>
111
        </div>
114
        <div class="modal-body">
112
        <div class="modal-body">
115
            <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
113
            <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
Lines 172-177 Link Here
172
    [% INCLUDE 'datatables.inc' %]
170
    [% INCLUDE 'datatables.inc' %]
173
    [% INCLUDE 'z3950_search.inc' %]
171
    [% INCLUDE 'z3950_search.inc' %]
174
    [% Asset.js("js/z3950_search.js") | $raw %]
172
    [% Asset.js("js/z3950_search.js") | $raw %]
173
    [% INCLUDE 'z3950_search.inc' %]
175
    <script>
174
    <script>
176
        $(document).ready(function(){
175
        $(document).ready(function(){
177
            $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
176
            $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
Lines 182-187 Link Here
182
                "aaSorting": [[ 1, "asc" ]],
181
                "aaSorting": [[ 1, "asc" ]],
183
                "bPaginate": false
182
                "bPaginate": false
184
            }));
183
            }));
184
            InitLastAction();
185
        });
185
        });
186
    </script>
186
    </script>
187
[% END %]
187
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tt (-4 / +3 lines)
Lines 156-168 Link Here
156
                                            [% END %]
156
                                            [% END %]
157
                                            <td class="actions">
157
                                            <td class="actions">
158
                                                <div class="btn-group dropup">
158
                                                <div class="btn-group dropup">
159
                                                    <a class="btn btn-default btn-xs dropdown-toggle" id="cataloguesearchactions[% breeding_loo.breedingid | html %]" role="button" data-toggle="dropdown" href="#">
159
                                                    <a class="btn btn-default btn-xs z3950actions" href="#">MARC</a><button class="btn-xs dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>
160
                                                      Actions <b class="caret"></b>
161
                                                    </a>
162
                                                    <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="cataloguesearchactions[% breeding_loo.breedingid | html %]">
160
                                                    <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="cataloguesearchactions[% breeding_loo.breedingid | html %]">
163
                                                        <li><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% breeding_loo.breedingid | uri %]" title="MARC" class="previewData"><i class="fa fa-eye"></i> MARC preview</a></li>
161
                                                        <li><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% breeding_loo.breedingid | uri %]" title="MARC" class="previewData"><i class="fa fa-eye"></i> MARC preview</a></li>
164
                                                        <li><a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=[% breeding_loo.breedingid | uri %]" title="Card" class="previewData"><i class="fa fa-eye"></i> Card preview</a></li>
162
                                                        <li><a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=[% breeding_loo.breedingid | uri %]" title="Card" class="previewData"><i class="fa fa-eye"></i> Card preview</a></li>
165
                                                        <li><a href="#" class="import_record" data-breedingid="[% breeding_loo.breedingid | html %]" data-biblionumber="[% breeding_loo.biblionumber | html %]" data-frameworkcode="[% frameworkcode | uri %]"><i class="fa fa-download"></i> Import</a></li>
163
                                                        <li><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% breeding_loo.biblionumber | html %]&z3950=1&frameworkcode=[% frameworkcode | uri %]&breedingid=[% breeding_loo.breedingid | html %]" class="chosen" title="Import"><i class="fa fa-download"></i> Import</a></li>
166
                                                    </ul>
164
                                                    </ul>
167
                                                </div>
165
                                                </div>
168
                                            </td>
166
                                            </td>
Lines 250-255 Link Here
250
                "aaSorting": [[ 1, "asc" ]],
248
                "aaSorting": [[ 1, "asc" ]],
251
                "bPaginate": false
249
                "bPaginate": false
252
            }, columns_settings );
250
            }, columns_settings );
251
            InitLastAction();
253
        });
252
        });
254
253
255
        function columnsInit(){
254
        function columnsInit(){
(-)a/koha-tmpl/intranet-tmpl/prog/js/z3950_search.js (-39 / +40 lines)
Lines 1-16 Link Here
1
/* global __ total_pages */
1
/* global __ total_pages */
2
//z3950_search.js for Authorities, Bib records and Acquisitions module
2
//z3950_search.js for Authorities, Bib records and Acquisitions module
3
function Import(Breeding, recordid, AuthType, FrameworkCode, index) {
4
3
5
    if ( AuthType == false ) {
4
var last_action, previewed = 0;
6
        opener.document.location="../cataloguing/addbiblio.pl?biblionumber="+recordid+"&z3950=1&frameworkcode="+FrameworkCode+"&breedingid="+Breeding;
7
    } else {
8
        opener.document.location="../authorities/authorities.pl?breedingid="+Breeding+"&authtypecode="+AuthType+"&authid="+recordid+"&index="+index;
9
    }
10
    window.close();
11
    return false;
12
13
}
14
5
15
function validate_goto_page() {
6
function validate_goto_page() {
16
    var page = $('#goto_page').val();
7
    var page = $('#goto_page').val();
Lines 70-85 $( document ).ready( function() { Link Here
70
    /* Note: The templates where this is included must have a search results
61
    /* Note: The templates where this is included must have a search results
71
       table with the id "resultst" and "action" table cells with the class "actions" */
62
       table with the id "resultst" and "action" table cells with the class "actions" */
72
    $("#resultst").on("click", "td", function(event){
63
    $("#resultst").on("click", "td", function(event){
64
        event.preventDefault();
73
        var tgt = $(event.target);
65
        var tgt = $(event.target);
74
        var row = $(this).parent();
66
        var row = $(this).closest('tr');
75
        /* Remove highlight from all rows and add to the clicked row */
67
        /* Remove highlight from all rows and add to the clicked row */
76
        $("tr").removeClass("highlighted-row");
68
        $("tr").removeClass("highlighted-row");
77
        row.addClass("highlighted-row");
69
        row.addClass("highlighted-row");
78
        /* Remove any menus created on the fly for other rows */
70
        /* Remove any menus created on the fly for other rows */
79
        $(".btn-wrapper").remove();
71
        $(".btn-wrapper").remove();
80
72
81
        if( tgt.is("a") || tgt.hasClass("actions") ){
73
        if( tgt.hasClass("z3950actions")  ) { // direct button click
82
            /* Don't show inline links for cells containing links of their own. */
74
            var link = $( "a[title='" + tgt.text() + "']", row );
75
            if( link.length == 1) link.click();
76
            row.find('ul.dropdown-menu').hide();
83
        } else {
77
        } else {
84
            event.stopPropagation();
78
            event.stopPropagation();
85
            /* Remove the "open" class from all dropup menus in case one is open */
79
            /* Remove the "open" class from all dropup menus in case one is open */
Lines 100-105 $( document ).ready( function() { Link Here
100
                The menu must first be wrapped in a block-level div to clear
94
                The menu must first be wrapped in a block-level div to clear
101
                the table cell's text contents and then a relative-positioned
95
                the table cell's text contents and then a relative-positioned
102
                div to allow the menu to be positioned correctly */
96
                div to allow the menu to be positioned correctly */
97
            if( tgt.prop('nodeName') != 'TD' ) {
98
                // handling click on caret to improve menu position
99
                tgt = tgt.closest('td');
100
            }
103
            tgt.append(
101
            tgt.append(
104
                $('<div/>', {'class': 'btn-wrapper'}).append(
102
                $('<div/>', {'class': 'btn-wrapper'}).append(
105
                    $('<div/>', {'class': 'btn-group'}).append(
103
                    $('<div/>', {'class': 'btn-group'}).append(
Lines 110-153 $( document ).ready( function() { Link Here
110
        }
108
        }
111
    });
109
    });
112
110
113
    $( "#resultst" ).on("click", ".previewMARC", function(e) {
114
        e.preventDefault();
115
        var ltitle = $( this ).text();
116
        var page = $( this ).attr( "href" );
117
        $( "#marcPreviewLabel" ).text( ltitle );
118
        $( "#marcPreview .modal-body" ).load( page + " pre" );
119
        $( '#marcPreview' ).modal( {show:true} );
120
    });
121
    $( "#marcPreview" ).on( "hidden", function() {
122
        $( "#marcPreviewLabel" ).html( "" );
123
        $( "#marcPreview .modal-body" ).html( "<div id='loading'><img src='" + interface + "/" + theme + "/img/spinner-small.gif' alt='' /> " + __("Loading") + "</div>" );
124
    });
125
    $( "#resultst" ).on("click", ".previewData", function(e) {
111
    $( "#resultst" ).on("click", ".previewData", function(e) {
126
        e.preventDefault();
112
        e.preventDefault();
113
        previewed = 1;
114
        ChangeLastAction( $(this).attr('title'), 1 );
127
        var ltitle = $( this ).text();
115
        var ltitle = $( this ).text();
128
        var page = $( this ).attr( "href" );
116
        var page = $( this ).attr( "href" );
129
        $( "#dataPreviewLabel" ).text( ltitle );
117
        $( "#dataPreviewLabel" ).text( ltitle );
130
        $( "#dataPreview .modal-body" ).load( page + " div" );
118
        $( "#dataPreview .modal-body" ).load( page + " div" );
131
        $( '#dataPreview' ).modal( {show:true} );
119
        $( '#dataPreview' ).modal( {show:true} );
132
    });
120
    });
121
133
    $( "#dataPreview" ).on( "hidden", function() {
122
    $( "#dataPreview" ).on( "hidden", function() {
134
        $( "#dataPreviewLabel" ).html( "" );
123
        $( "#dataPreviewLabel" ).html( "" );
135
        $( "#dataPreview .modal-body" ).html( "<div id='loading'><img src='" + interface + "/" + theme + "/img/spinner-small.gif' alt='' /> " + __("Loading") + "</div>" );
124
        $( "#dataPreview .modal-body" ).html( "<div id='loading'><img src='" + interface + "/" + theme + "/img/spinner-small.gif' alt='' /> " + __("Loading") + "</div>" );
136
    });
125
    });
137
    $( "#resultst" ).on("click", ".import_record", function(e) {
126
127
    $( "#resultst" ).on("click", ".chosen", function(e) {
138
        e.preventDefault();
128
        e.preventDefault();
139
        var data_breedingid = $( this ).data( "breedingid" );
129
        var title = $(this).attr('title');
140
        var data_headingcode = $( this ).data( "heading_code" );
130
        ChangeLastAction( title, 0 );
141
        var data_authid = $( this ).data( "authid" );
131
        if( title == 'Order' ) window.location = $(this).attr('href');
142
        var data_biblionumber = $( this ).data( "biblionumber" );
132
        else {
143
        var data_frameworkcode = $( this ).data( "frameworkcode" );
133
            opener.document.location = $(this).attr('href');
144
        var data_index = $( this ).data( "index" );
134
            window.close();
145
        if ( data_headingcode == undefined ) {
146
            Import( data_breedingid, data_biblionumber, false , data_frameworkcode );
147
        } else {
148
            Import( data_breedingid, data_authid, data_headingcode, "", data_index );
149
        }
135
        }
150
        return false;
151
    });
136
    });
152
153
});
137
});
154
- 
138
139
function InitLastAction() {
140
    if( $("#resultst").length == 0 ) return;
141
    try { last_action = localStorage.getItem('z3950search_last_action'); } catch (err) {}
142
    if( last_action ) {
143
        var linkcount = $(".z3950actions:eq(0)").siblings(".dropdown-menu").find("a[title='"+last_action+"']").length;
144
        if( linkcount == 0 ) return;
145
        if( last_action != 'MARC' ) $( ".z3950actions" ).text( last_action );
146
    }
147
}
148
149
function ChangeLastAction(title, change_text) {
150
    if( last_action && last_action == title ) return;
151
    last_action = title;
152
    if( change_text ) $( ".z3950actions" ).text( last_action );
153
    if( previewed == 0 || change_text == 1 )
154
        try { localStorage.setItem('z3950search_last_action', last_action); } catch(err) {}
155
}

Return to bug 23302