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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/popup-bottom.inc (+4 lines)
Lines 1-2 Link Here
1
    [% IF ( footerjs ) %]
2
        [% INCLUDE js_includes.inc %]
3
        [% jsinclude # Parse the page template's JavaScript block if necessary %]
4
    [% END %]
1
</body>
5
</body>
2
</html>
6
</html>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/clone-rules.tt (+2 lines)
Lines 1-4 Link Here
1
[% USE Branches %]
1
[% USE Branches %]
2
[% SET footerjs = 1 %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Administration &rsaquo; Circulation and fine rules &rsaquo; Clone circulation and fine rules</title>
4
<title>Koha &rsaquo; Administration &rsaquo; Circulation and fine rules &rsaquo; Clone circulation and fine rules</title>
4
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'doc-head-close.inc' %]
Lines 64-67 Link Here
64
[% INCLUDE 'admin-menu.inc' %]
65
[% INCLUDE 'admin-menu.inc' %]
65
</div>
66
</div>
66
</div>
67
</div>
68
67
[% INCLUDE 'intranet-bottom.inc' %]
69
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt (-39 / +42 lines)
Lines 1-6 Link Here
1
[% USE KohaDates %]
1
[% USE KohaDates %]
2
[% USE ColumnsSettings %]
2
[% USE ColumnsSettings %]
3
[% USE HtmlTags %]
3
[% USE HtmlTags %]
4
[% SET footerjs = 1 %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
[% INCLUDE 'doc-head-open.inc' %]
5
<title>Koha &rsaquo; Administration &rsaquo; Currencies &amp; Exchange rates &rsaquo;
6
<title>Koha &rsaquo; Administration &rsaquo; Currencies &amp; Exchange rates &rsaquo;
6
[% IF op == 'add_form' %][% IF currency %]Modify currency '[% currency.currency %]'[% ELSE %]New currency[% END %][% END %]
7
[% IF op == 'add_form' %][% IF currency %]Modify currency '[% currency.currency %]'[% ELSE %]New currency[% END %][% END %]
Lines 8-57 Link Here
8
[% IF op == 'list' %]Currencies[% END %]</title>
9
[% IF op == 'list' %]Currencies[% END %]</title>
9
[% INCLUDE 'doc-head-close.inc' %]
10
[% INCLUDE 'doc-head-close.inc' %]
10
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
11
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
11
[% INCLUDE 'datatables.inc' %]
12
[% INCLUDE 'columns_settings.inc' %]
13
<script type="text/javascript">
14
//<![CDATA[
15
16
    function check_currency(val) {
17
        if ( val == 1.0 ) {
18
            $("#active").prop('disabled', false);
19
            $("#hint").html("");
20
        } else {
21
            $("#active").prop('checked', false);
22
            $("#active").prop('disabled', true);
23
            $("#hint").html(_("The active currency must have a rate of 1.0"));
24
        }
25
    }
26
27
    $(document).ready(function() {
28
        columns_settings = [% ColumnsSettings.GetColumns( 'admin', 'currency', 'currencies-table', 'json' ) %]
29
        var issuest = KohaTable("#currencies-table", {
30
            dom: 'B<"clearfix">t',
31
            "columnDefs": [
32
                { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
33
                { "sType": "title-string", "aTargets" : [ "title-string" ] }
34
                ],
35
        }, columns_settings );
36
37
        // prevents users to check active with a currency != 1
38
        $("#rate").keyup(function() {
39
            check_currency( $(this).val() );
40
        });
41
        check_currency( $("#rate").val() );
42
        $("#currency_code").on("blur",function(){
43
            toUC(this);
44
        });
45
    });
46
//]]>
47
</script>
48
</head>
12
</head>
13
49
<body id="admin_currency" class="admin">
14
<body id="admin_currency" class="admin">
50
[% INCLUDE 'header.inc' %]
15
[% INCLUDE 'header.inc' %]
51
[% INCLUDE 'currencies-admin-search.inc' %]
16
[% INCLUDE 'currencies-admin-search.inc' %]
52
17
53
54
55
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo;  <a href="/cgi-bin/koha/admin/currency.pl">Currencies &amp; Exchange rates</a> &rsaquo; [% IF op == 'add_form' %][% IF currency %]Modify currency '[% currency.currency %]'[% ELSE %]New currency[% END %][% END %]
18
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo;  <a href="/cgi-bin/koha/admin/currency.pl">Currencies &amp; Exchange rates</a> &rsaquo; [% IF op == 'add_form' %][% IF currency %]Modify currency '[% currency.currency %]'[% ELSE %]New currency[% END %][% END %]
56
[% IF op == 'delete_confirm' %]Confirm deletion of currency [% currency.currency | $HtmlTags tag='span' attributes=>'class="ex"' %]
19
[% IF op == 'delete_confirm' %]Confirm deletion of currency [% currency.currency | $HtmlTags tag='span' attributes=>'class="ex"' %]
57
[% ELSIF op == 'list' %]Currencies
20
[% ELSIF op == 'list' %]Currencies
Lines 252-255 Link Here
252
[% INCLUDE 'admin-menu.inc' %]
215
[% INCLUDE 'admin-menu.inc' %]
253
</div>
216
</div>
254
</div>
217
</div>
218
219
[% MACRO jsinclude BLOCK %]
220
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/admin-menu.js"></script>
221
    [% INCLUDE 'datatables.inc' %]
222
    [% INCLUDE 'columns_settings.inc' %]
223
    <script type="text/javascript">
224
225
        function check_currency(val) {
226
            if ( val == 1.0 ) {
227
                $("#active").prop('disabled', false);
228
                $("#hint").html("");
229
            } else {
230
                $("#active").prop('checked', false);
231
                $("#active").prop('disabled', true);
232
                $("#hint").html(_("The active currency must have a rate of 1.0"));
233
            }
234
        }
235
236
        $(document).ready(function() {
237
            columns_settings = [% ColumnsSettings.GetColumns( 'admin', 'currency', 'currencies-table', 'json' ) %]
238
            var issuest = KohaTable("#currencies-table", {
239
                dom: 'B<"clearfix">t',
240
                "columnDefs": [
241
                    { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
242
                    { "sType": "title-string", "aTargets" : [ "title-string" ] }
243
                    ],
244
            }, columns_settings );
245
246
            // prevents users to check active with a currency != 1
247
            $("#rate").keyup(function() {
248
                check_currency( $(this).val() );
249
            });
250
            check_currency( $("#rate").val() );
251
            $("#currency_code").on("blur",function(){
252
                toUC(this);
253
            });
254
        });
255
256
    </script>
257
[% END %]
255
[% INCLUDE 'intranet-bottom.inc' %]
258
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/edi_accounts.tt (+5 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; Administration &rsaquo; EDI accounts
3
<title>Koha &rsaquo; Administration &rsaquo; EDI accounts
3
[% IF acct_form %]
4
[% IF acct_form %]
Lines 322-325 Link Here
322
    [% INCLUDE 'admin-menu.inc' %]
323
    [% INCLUDE 'admin-menu.inc' %]
323
</div>
324
</div>
324
</div>
325
</div>
326
327
[% MACRO jsinclude BLOCK %]
328
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/admin-menu.js"></script>
329
[% END %]
325
[% INCLUDE 'intranet-bottom.inc' %]
330
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/edi_ean_accounts.tt (+5 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; Administration &rsaquo; Library EANs
3
<title>Koha &rsaquo; Administration &rsaquo; Library EANs
3
[% IF ean_form %]
4
[% IF ean_form %]
Lines 168-171 Link Here
168
    [% INCLUDE 'admin-menu.inc' %]
169
    [% INCLUDE 'admin-menu.inc' %]
169
</div>
170
</div>
170
</div>
171
</div>
172
173
[% MACRO jsinclude BLOCK %]
174
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/admin-menu.js"></script>
175
[% END %]
171
[% INCLUDE 'intranet-bottom.inc' %]
176
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt (+1 lines)
Lines 422-425 Item types administration Link Here
422
         });
422
         });
423
    </script>
423
    </script>
424
[% END %]
424
[% END %]
425
425
[% INCLUDE 'intranet-bottom.inc' %]
426
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/localization.tt (-187 / +188 lines)
Lines 1-193 Link Here
1
[% SET footerjs = 1 %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Localization</title>
3
<title>Koha &rsaquo; Localization</title>
3
[% INCLUDE 'doc-head-close.inc' popup => 1 %]
4
[% INCLUDE 'doc-head-close.inc' popup => 1 %]
4
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
5
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
5
[% INCLUDE 'greybox.inc' %]
6
[% INCLUDE 'datatables.inc' %]
7
<script type="text/javascript">
8
//<![CDATA[
9
10
    function show_message( params ) {
11
        var type = params.type;
12
        var data = params.data;
13
        var messages = $("#messages");
14
        var message;
15
        if ( type == 'success_on_update' ) {
16
            message = $('<div class="dialog message"></div>');
17
            message.text("Entity %s (code %s) for lang %s has correctly been updated with '%s'".format(data.entity, data.code, data.lang, data.translation));
18
        } else if ( type == 'error_on_update' ) {
19
            message = $('<div class="dialog alert"></div>');
20
            if ( data.error_code == 'already_exists' ) {
21
                message.text("A translation already exists for this language.");
22
            } else {
23
                message.text("An error occurred when updating this translation.");
24
            }
25
        } else if ( type == 'success_on_delete' ) {
26
            message = $('<div class="dialog message"></div>');
27
            message.text("The translation (id %s) has been removed successfully".format(data.id));
28
        } else if ( type == 'error_on_delete' ) {
29
            message = $('<div class="dialog alert"></div>');
30
            message.text("An error occurred when deleting this translation");
31
        } else if ( type == 'success_on_insert' ) {
32
            message = $('<div class="dialog message"></div>');
33
            message.text("Translation (id %s) has been added successfully".format(data.id));
34
        } else if ( type == 'error_on_insert' ) {
35
            message = $('<div class="dialog alert"></div>');
36
            if ( data.error_code == 'already_exists' ) {
37
                message.text("A translation already exists for this language.");
38
            } else {
39
                message.text("An error occurred when adding this translation");
40
            }
41
        }
42
43
        $(messages).append(message);
44
45
        setTimeout(function(){
46
            message.hide()
47
        }, 3000);
48
    }
49
50
    function send_update_request( data, cell ) {
51
        $.ajax({
52
            data: data,
53
            type: 'PUT',
54
            url: '/cgi-bin/koha/svc/localization',
55
            success: function (data) {
56
                if ( data.error ) {
57
                    $(cell).css('background-color', '#FF0000');
58
                    show_message({ type: 'error_on_update', data: data });
59
                } else if ( data.is_changed == 1 ) {
60
                    $(cell).css('background-color', '#00FF00');
61
                    show_message({ type: 'success_on_update', data: data });
62
                }
63
64
                if ( $(cell).hasClass('lang') ) {
65
                    $(cell).text(data.lang)
66
                } else if ( $(cell).hasClass('translation') ) {
67
                    $(cell).text(data.translation)
68
                }
69
            },
70
            error: function (data) {
71
                $(cell).css('background-color', '#FF0000');
72
                if ( $(cell).hasClass('lang') ) {
73
                    $(cell).text(data.lang)
74
                } else if ( $(cell).hasClass('translation') ) {
75
                    $(cell).text(data.translation)
76
                }
77
                show_message({ type: 'error_on_update', data: data });
78
            },
79
        });
80
    }
81
82
    function send_delete_request( id, cell ) {
83
        $.ajax({
84
            type: 'DELETE',
85
            url: '/cgi-bin/koha/svc/localization/?id='+id,
86
            success: function (data) {
87
                $("#localization").DataTable().row( '#row_id_' + id ).remove().draw();
88
                show_message({ type: 'success_on_delete', data: data });
89
            },
90
            error: function (data) {
91
                $(cell).css('background-color', '#FF0000');
92
                show_message({ type: 'error_on_delete', data: data });
93
            },
94
        });
95
    }
96
97
    $(document).ready(function() {
98
        $(".dialog").hide();
99
100
        var table = $("#localization").DataTable($.extend(true, {}, dataTablesDefaults, {
101
            'bPaginate': false,
102
        }));
103
104
        var languages_select = $('<select name="lang"></select>');
105
        [% FOR language IN languages %]
106
            [% FOR sublanguage IN language.sublanguages_loop %]
107
                var option;
108
                [% IF language.plural %]
109
                    option = $('<option value="[% sublanguage.rfc4646_subtag %]">[% sublanguage.native_description %] [% sublanguage.region_description %] ([% sublanguage.rfc4646_subtag %])</option>');
110
                    $(languages_select).append(option);
111
                [% ELSE %]
112
                    option = $('<option value="[% sublanguage.rfc4646_subtag %]">[% sublanguage.native_description %] ([% sublanguage.rfc4646_subtag %])</option>');
113
                [% END %]
114
                $(languages_select).append(option);
115
            [% END %]
116
        [% END %]
117
118
        $("td.translation").on('focus', function(){
119
            $(this).css('background-color', '');
120
        });
121
        $("td.lang").on('click', function(){
122
            var td = this;
123
            var lang = $(td).text();
124
            $(td).css('background-color', '');
125
            var my_select = $(languages_select).clone();
126
            $(my_select).find('option[value="' + lang + '"]').attr('selected', 'selected');
127
            $(my_select).on('click', function(e){
128
                e.stopPropagation();
129
            });
130
            $(my_select).on('change', function(){
131
                var tr = $(this).parent().parent();
132
                var id = $(tr).data('id');
133
                var lang = $(this).find('option:selected').val();
134
                var data = "id=" + encodeURIComponent(id) + "&lang=" + encodeURIComponent(lang);
135
                send_update_request( data, td );
136
            });
137
            $(my_select).on('blur', function(){
138
                $(td).html(lang);
139
            });
140
            $(this).html(my_select);
141
        });
142
143
        $("td.translation").on('blur', function(){
144
            var tr = $(this).parent();
145
            var id = $(tr).data('id');
146
            var translation = $(this).text();
147
            var data = "id=" + encodeURIComponent(id) + "&translation=" + encodeURIComponent(translation);
148
            send_update_request( data, this );
149
        });
150
151
        $("a.delete").on('click', function(e){
152
            e.preventDefault();
153
            if ( confirm(_("Are you sure you want to delete this translation?")) ) {
154
                var td = $(this).parent();
155
                var tr = $(td).parent();
156
                var id = $(tr).data('id');
157
                send_delete_request( id, td );
158
            }
159
        });
160
161
        $("#add_translation").on('submit', function(e){
162
            e.preventDefault();
163
            var entity = $(this).find('input[name="entity"]').val();
164
            var code = $(this).find('input[name="code"]').val();
165
            var lang = $(this).find('select[name="lang"] option:selected').val();
166
            var translation = $(this).find('input[name="translation"]').val();
167
            var data = "entity=" + encodeURIComponent(entity) + "&code=" + encodeURIComponent(code) + "&lang=" + encodeURIComponent(lang) + "&translation=" + encodeURIComponent(translation);
168
            $.ajax({
169
                data: data,
170
                type: 'POST',
171
                url: '/cgi-bin/koha/svc/localization',
172
                success: function (data) {
173
                    if ( data.error ) {
174
                        show_message({ type: 'error_on_insert', data: data });
175
                    } else {
176
                        // FIXME Should append the delete link
177
                        table.row.add( [ data.id, data.entity, data.code, data.lang, data.translation, "" ] ).draw();
178
                        show_message({ type: 'success_on_insert', data: data });
179
                    }
180
                },
181
                error: function (data) {
182
                    show_message({ type: 'error_on_insert', data: data });
183
                },
184
            });
185
        });
186
187
     });
188
//]]>
189
</script>
190
</head>
6
</head>
7
191
<body id="admin_localization" class="admin">
8
<body id="admin_localization" class="admin">
192
<div id="main">
9
<div id="main">
193
<form id="add_translation" method="post">
10
<form id="add_translation" method="post">
Lines 233-237 Link Here
233
    </tbody>
50
    </tbody>
234
</table>
51
</table>
235
</div>
52
</div>
236
</body>
53
237
</html>
54
[% MACRO jsinclude BLOCK %]
55
    [% INCLUDE 'datatables.inc' %]
56
    <script type="text/javascript">
57
58
        function show_message( params ) {
59
            var type = params.type;
60
            var data = params.data;
61
            var messages = $("#messages");
62
            var message;
63
            if ( type == 'success_on_update' ) {
64
                message = $('<div class="dialog message"></div>');
65
                message.text("Entity %s (code %s) for lang %s has correctly been updated with '%s'".format(data.entity, data.code, data.lang, data.translation));
66
            } else if ( type == 'error_on_update' ) {
67
                message = $('<div class="dialog alert"></div>');
68
                if ( data.error_code == 'already_exists' ) {
69
                    message.text("A translation already exists for this language.");
70
                } else {
71
                    message.text("An error occurred when updating this translation.");
72
                }
73
            } else if ( type == 'success_on_delete' ) {
74
                message = $('<div class="dialog message"></div>');
75
                message.text("The translation (id %s) has been removed successfully".format(data.id));
76
            } else if ( type == 'error_on_delete' ) {
77
                message = $('<div class="dialog alert"></div>');
78
                message.text("An error occurred when deleting this translation");
79
            } else if ( type == 'success_on_insert' ) {
80
                message = $('<div class="dialog message"></div>');
81
                message.text("Translation (id %s) has been added successfully".format(data.id));
82
            } else if ( type == 'error_on_insert' ) {
83
                message = $('<div class="dialog alert"></div>');
84
                if ( data.error_code == 'already_exists' ) {
85
                    message.text("A translation already exists for this language.");
86
                } else {
87
                    message.text("An error occurred when adding this translation");
88
                }
89
            }
90
91
            $(messages).append(message);
92
93
            setTimeout(function(){
94
                message.hide()
95
            }, 3000);
96
        }
97
98
        function send_update_request( data, cell ) {
99
            $.ajax({
100
                data: data,
101
                type: 'PUT',
102
                url: '/cgi-bin/koha/svc/localization',
103
                success: function (data) {
104
                    if ( data.error ) {
105
                        $(cell).css('background-color', '#FF0000');
106
                        show_message({ type: 'error_on_update', data: data });
107
                    } else if ( data.is_changed == 1 ) {
108
                        $(cell).css('background-color', '#00FF00');
109
                        show_message({ type: 'success_on_update', data: data });
110
                    }
111
112
                    if ( $(cell).hasClass('lang') ) {
113
                        $(cell).text(data.lang)
114
                    } else if ( $(cell).hasClass('translation') ) {
115
                        $(cell).text(data.translation)
116
                    }
117
                },
118
                error: function (data) {
119
                    $(cell).css('background-color', '#FF0000');
120
                    if ( $(cell).hasClass('lang') ) {
121
                        $(cell).text(data.lang)
122
                    } else if ( $(cell).hasClass('translation') ) {
123
                        $(cell).text(data.translation)
124
                    }
125
                    show_message({ type: 'error_on_update', data: data });
126
                },
127
            });
128
        }
129
130
        function send_delete_request( id, cell ) {
131
            $.ajax({
132
                type: 'DELETE',
133
                url: '/cgi-bin/koha/svc/localization/?id='+id,
134
                success: function (data) {
135
                    $("#localization").DataTable().row( '#row_id_' + id ).remove().draw();
136
                    show_message({ type: 'success_on_delete', data: data });
137
                },
138
                error: function (data) {
139
                    $(cell).css('background-color', '#FF0000');
140
                    show_message({ type: 'error_on_delete', data: data });
141
                },
142
            });
143
        }
144
145
        $(document).ready(function() {
146
            $(".dialog").hide();
147
148
            var table = $("#localization").DataTable($.extend(true, {}, dataTablesDefaults, {
149
                'bPaginate': false,
150
            }));
151
152
            var languages_select = $('<select name="lang"></select>');
153
            [% FOR language IN languages %]
154
                [% FOR sublanguage IN language.sublanguages_loop %]
155
                    var option;
156
                    [% IF language.plural %]
157
                        option = $('<option value="[% sublanguage.rfc4646_subtag %]">[% sublanguage.native_description %] [% sublanguage.region_description %] ([% sublanguage.rfc4646_subtag %])</option>');
158
                        $(languages_select).append(option);
159
                    [% ELSE %]
160
                        option = $('<option value="[% sublanguage.rfc4646_subtag %]">[% sublanguage.native_description %] ([% sublanguage.rfc4646_subtag %])</option>');
161
                    [% END %]
162
                    $(languages_select).append(option);
163
                [% END %]
164
            [% END %]
165
166
            $("td.translation").on('focus', function(){
167
                $(this).css('background-color', '');
168
            });
169
            $("td.lang").on('click', function(){
170
                var td = this;
171
                var lang = $(td).text();
172
                $(td).css('background-color', '');
173
                var my_select = $(languages_select).clone();
174
                $(my_select).find('option[value="' + lang + '"]').attr('selected', 'selected');
175
                $(my_select).on('click', function(e){
176
                    e.stopPropagation();
177
                });
178
                $(my_select).on('change', function(){
179
                    var tr = $(this).parent().parent();
180
                    var id = $(tr).data('id');
181
                    var lang = $(this).find('option:selected').val();
182
                    var data = "id=" + encodeURIComponent(id) + "&lang=" + encodeURIComponent(lang);
183
                    send_update_request( data, td );
184
                });
185
                $(my_select).on('blur', function(){
186
                    $(td).html(lang);
187
                });
188
                $(this).html(my_select);
189
            });
190
191
            $("td.translation").on('blur', function(){
192
                var tr = $(this).parent();
193
                var id = $(tr).data('id');
194
                var translation = $(this).text();
195
                var data = "id=" + encodeURIComponent(id) + "&translation=" + encodeURIComponent(translation);
196
                send_update_request( data, this );
197
            });
198
199
            $("a.delete").on('click', function(e){
200
                e.preventDefault();
201
                if ( confirm(_("Are you sure you want to delete this translation?")) ) {
202
                    var td = $(this).parent();
203
                    var tr = $(td).parent();
204
                    var id = $(tr).data('id');
205
                    send_delete_request( id, td );
206
                }
207
            });
208
209
            $("#add_translation").on('submit', function(e){
210
                e.preventDefault();
211
                var entity = $(this).find('input[name="entity"]').val();
212
                var code = $(this).find('input[name="code"]').val();
213
                var lang = $(this).find('select[name="lang"] option:selected').val();
214
                var translation = $(this).find('input[name="translation"]').val();
215
                var data = "entity=" + encodeURIComponent(entity) + "&code=" + encodeURIComponent(code) + "&lang=" + encodeURIComponent(lang) + "&translation=" + encodeURIComponent(translation);
216
                $.ajax({
217
                    data: data,
218
                    type: 'POST',
219
                    url: '/cgi-bin/koha/svc/localization',
220
                    success: function (data) {
221
                        if ( data.error ) {
222
                            show_message({ type: 'error_on_insert', data: data });
223
                        } else {
224
                            // FIXME Should append the delete link
225
                            table.row.add( [ data.id, data.entity, data.code, data.lang, data.translation, "" ] ).draw();
226
                            show_message({ type: 'success_on_insert', data: data });
227
                        }
228
                    },
229
                    error: function (data) {
230
                        show_message({ type: 'error_on_insert', data: data });
231
                    },
232
                });
233
            });
234
235
         });
236
    </script>
237
[% END %]
238
[% INCLUDE 'popup-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/sru_modmapping.tt (-28 / +29 lines)
Lines 1-32 Link Here
1
[% SET footerjs = 1 %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; SRU search fields mapping</title>
3
<title>Koha &rsaquo; SRU search fields mapping</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
4
5
<script type="text/javascript">
6
//<![CDATA[
7
    $(document).ready(function() {
8
        $("#form01").submit(function(event) {
9
            if(window.opener) {
10
                var newmap=allInputs();
11
                window.opener.$('#show_sru_fields').val(newmap);
12
                window.close();
13
            } else {
14
                // In this case not called as a popup. Just do nothing.
15
                event.preventDefault();
16
            }
17
        });
18
    });
19
    function allInputs () {
20
        var aInput= new Array();
21
        $("form :input").each(function() {
22
            if( this.id && $(this).val() ) {
23
                aInput.push(this.id+'='+$(this).val());
24
            }
25
        });
26
        return aInput.join(',');
27
    }
28
//]]>
29
</script>
30
</head>
5
</head>
31
6
32
<body id="admin_sru_modmapping" class="admin">
7
<body id="admin_sru_modmapping" class="admin">
Lines 95-98 Link Here
95
        </form>
70
        </form>
96
    </div>
71
    </div>
97
72
98
[% INCLUDE 'intranet-bottom.inc' %]
73
[% MACRO jsinclude BLOCK %]
74
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/admin-menu.js"></script>
75
    <script type="text/javascript">
76
        $(document).ready(function() {
77
            $("#form01").submit(function(event) {
78
                if(window.opener) {
79
                    var newmap=allInputs();
80
                    window.opener.$('#show_sru_fields').val(newmap);
81
                    window.close();
82
                } else {
83
                    // In this case not called as a popup. Just do nothing.
84
                    event.preventDefault();
85
                }
86
            });
87
        });
88
        function allInputs () {
89
            var aInput= new Array();
90
            $("form :input").each(function() {
91
                if( this.id && $(this).val() ) {
92
                    aInput.push(this.id+'='+$(this).val());
93
                }
94
            });
95
            return aInput.join(',');
96
        }
97
    </script>
98
[% END %]
99
100
[% INCLUDE 'popup-bottom.inc' %]
99
- 

Return to bug 19608