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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt (-27 / +32 lines)
Lines 1-40 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; Tools &rsaquo; Export data</title>
4
<title>Koha &rsaquo; Tools &rsaquo; Export data</title>
4
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'calendar.inc' %]
6
<script type="text/javascript">
7
//<![CDATA[
8
$(document).ready(function() {
9
    $('#exporttype').tabs();
10
11
    $("li.csv_profiles").hide();
12
13
    $("#bibs select[name='output_format']").on('change', function(){
14
        var format = $(this).val();
15
        if ( format == 'csv' ) {
16
            $("#bibs li.csv_profiles").show();
17
        } else {
18
            $("#bibs li.csv_profiles").hide();
19
        }
20
    });
21
    $("#checkall").on("click",function(e){
22
        e.preventDefault();
23
        $(".branch_select").prop("checked",1);
24
    });
25
    $("#checknone").on("click",function(e){
26
        e.preventDefault();
27
        $(".branch_select").prop("checked",0);
28
    });
29
});
30
//]]>
31
</script>
32
<style type="text/css">
6
<style type="text/css">
33
    fieldset.rows fieldset.rows {
7
    fieldset.rows fieldset.rows {
34
        width: 90%;
8
        width: 90%;
35
    }
9
    }
36
</style>
10
</style>
37
</head>
11
</head>
12
38
<body id="tools_export" class="tools">
13
<body id="tools_export" class="tools">
39
[% INCLUDE 'header.inc' %]
14
[% INCLUDE 'header.inc' %]
40
[% INCLUDE 'cat-search.inc' %]
15
[% INCLUDE 'cat-search.inc' %]
Lines 311-314 $(document).ready(function() { Link Here
311
[% INCLUDE 'tools-menu.inc' %]
286
[% INCLUDE 'tools-menu.inc' %]
312
</div>
287
</div>
313
</div>
288
</div>
289
290
[% MACRO jsinclude BLOCK %]
291
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script>
292
    [% INCLUDE 'calendar.inc' %]
293
    <script type="text/javascript">
294
        $(document).ready(function() {
295
            $('#exporttype').tabs();
296
297
            $("li.csv_profiles").hide();
298
299
            $("#bibs select[name='output_format']").on('change', function(){
300
                var format = $(this).val();
301
                if ( format == 'csv' ) {
302
                    $("#bibs li.csv_profiles").show();
303
                } else {
304
                    $("#bibs li.csv_profiles").hide();
305
                }
306
            });
307
            $("#checkall").on("click",function(e){
308
                e.preventDefault();
309
                $(".branch_select").prop("checked",1);
310
            });
311
            $("#checknone").on("click",function(e){
312
                e.preventDefault();
313
                $(".branch_select").prop("checked",0);
314
            });
315
        });
316
    </script>
317
[% END %]
318
314
[% INCLUDE 'intranet-bottom.inc' %]
319
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt (-123 / +128 lines)
Lines 1-133 Link Here
1
[% USE KohaDates %]
1
[% USE KohaDates %]
2
[% USE Branches %]
2
[% USE Branches %]
3
[% SET footerjs = 1 %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
4
<title>Koha &rsaquo; Tools &rsaquo; Inventory</title>
5
<title>Koha &rsaquo; Tools &rsaquo; Inventory</title>
5
[% INCLUDE 'doc-head-close.inc' %]
6
[% INCLUDE 'doc-head-close.inc' %]
6
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
7
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
7
[% INCLUDE 'datatables.inc' %]
8
[% INCLUDE 'calendar.inc' %]
9
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
10
<script type="text/javascript">
11
//<![CDATA[
12
function checkForm() {
13
    if ( $('#uploadbarcodes').val() ) {
14
        if ( !(
15
            $('#branchloop').val()   ||
16
            $('#locationloop').val() ||
17
            $('#minlocation').val()  ||
18
            $('#maxlocation').val()  ||
19
            $('#statuses input:checked').length
20
        ) ) {
21
            return confirm(
22
                _("You have not selected any catalog filters and are about to compare a file of barcodes to your entire catalog.") + "\n\n" +
23
                _("For large catalogs this can result in unexpected behavior") + "\n\n" +
24
                _("Are you sure you want to do this?")
25
            );
26
        }
27
    }
28
29
    return true;
30
}
31
32
$(document).ready(function(){
33
        inventorydt = $('#inventoryt').dataTable($.extend(true, {}, dataTablesDefaults, {
34
            'sPaginationType': 'full_numbers',
35
            [% IF compareinv2barcd %]
36
                // sort on callnumber
37
                "aaSorting": [[ 1, "asc" ]],
38
            [% ELSE %]
39
                // first column contains checkboxes
40
                "aoColumnDefs": [
41
                    { "bSortable": false, "bSearchable": false, "aTargets": [ 0 ] },
42
                ],
43
                // 3rd column is callnumber
44
                "aaSorting": [[ 2, "asc" ]],
45
            [% END %]
46
            'fnDrawCallback': function() {
47
                //bind the click handler script to the newly created elements held in the table
48
                $('.openWin').bind('click',function(e){
49
                    e.preventDefault();
50
                    openWindow(this.href,'marcview',800,600);
51
                });
52
            }
53
        } ));
54
55
56
        $("#continuewithoutmarkingbutton").click(function(){
57
            inventorydt.fnPageChange( 'next' );
58
            return false;
59
        });
60
61
        $("#markseenandcontinuebutton").click(function(){
62
            var param = '';
63
            $("input:checked").each(function() {
64
                param += "|" + $(this).attr('name');
65
            });
66
            $.post('/cgi-bin/koha/tools/ajax-inventory.pl', { seen: param });
67
            inventorydt.fnPageChange( 'next' );
68
            return false;
69
        });
70
71
        $("#markseenandquit").click(function(){
72
            var param = '';
73
            $("input:checked").each(function() {
74
                param += "|" + $(this).attr('name');
75
            });
76
            $.ajax({
77
              type: 'POST',
78
              url: '/cgi-bin/koha/tools/ajax-inventory.pl',
79
              data: { seen: param},
80
              async: false
81
            });
82
            document.location.href = '/cgi-bin/koha/tools/inventory.pl';
83
            return false;
84
        });
85
86
87
    $(".checkall").click(function(){
88
            $(".checkboxed").checkCheckboxes();
89
            return false;
90
        });
91
    $(".clearall").click(function(){
92
            $(".checkboxed").unCheckCheckboxes();
93
            return false;
94
        });
95
    $("#inventory_form").on("submit",function(){
96
        return checkForm();
97
    });
98
99
    // #uploadbarcodes and #compareinv2barcd determine the behavior of
100
    // the controls within the barcode fieldset and the optional filters
101
    $("#uploadbarcodes").change(function() {
102
        if( $("#uploadbarcodes").val() ) {
103
            $("#setdate").prop('disabled',false);
104
            $("#compareinv2barcd").prop('disabled',false);
105
            $("#dont_checkin").prop('disabled',false);
106
            if( $("#compareinv2barcd").attr('checked') ) {
107
                $("fieldset#optionalfilters").show();
108
            } else {
109
                $("fieldset#optionalfilters").hide();
110
            }
111
        } else {
112
            $("#setdate").prop('disabled',true);
113
            $("#compareinv2barcd").prop('disabled',true);
114
            $("#compareinv2barcd").attr('checked',false);
115
            $("#dont_checkin").prop('disabled',true);
116
            $("#dont_checkin").attr('checked',false);
117
            $("fieldset#optionalfilters").show();
118
        }
119
    });
120
    $("#compareinv2barcd").click(function() {
121
        if( $("#compareinv2barcd").attr('checked') ) {
122
            $("fieldset#optionalfilters").show();
123
        } else {
124
            $("fieldset#optionalfilters").hide();
125
        }
126
    });
127
});
128
//]]>
129
</script>
130
</head>
8
</head>
9
131
<body id="tools_inventory" class="tools">
10
<body id="tools_inventory" class="tools">
132
[% INCLUDE 'header.inc' %]
11
[% INCLUDE 'header.inc' %]
133
[% INCLUDE 'cat-search.inc' %]
12
[% INCLUDE 'cat-search.inc' %]
Lines 368-371 $(document).ready(function(){ Link Here
368
[% INCLUDE 'tools-menu.inc' %]
247
[% INCLUDE 'tools-menu.inc' %]
369
</div>
248
</div>
370
</div>
249
</div>
250
251
[% MACRO jsinclude BLOCK %]
252
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script>
253
    [% INCLUDE 'datatables.inc' %]
254
    [% INCLUDE 'calendar.inc' %]
255
    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
256
    <script type="text/javascript">
257
        function checkForm() {
258
            if ( $('#uploadbarcodes').val() ) {
259
                if ( !(
260
                    $('#branchloop').val()   ||
261
                    $('#locationloop').val() ||
262
                    $('#minlocation').val()  ||
263
                    $('#maxlocation').val()  ||
264
                    $('#statuses input:checked').length
265
                ) ) {
266
                    return confirm(
267
                        _("You have not selected any catalog filters and are about to compare a file of barcodes to your entire catalog.") + "\n\n" +
268
                        _("For large catalogs this can result in unexpected behavior") + "\n\n" +
269
                        _("Are you sure you want to do this?")
270
                    );
271
                }
272
            }
273
274
            return true;
275
        }
276
277
        $(document).ready(function(){
278
            inventorydt = $('#inventoryt').dataTable($.extend(true, {}, dataTablesDefaults, {
279
                'sPaginationType': 'full_numbers',
280
                [% IF compareinv2barcd %]
281
                    // sort on callnumber
282
                    "aaSorting": [[ 1, "asc" ]],
283
                [% ELSE %]
284
                    // first column contains checkboxes
285
                    "aoColumnDefs": [
286
                        { "bSortable": false, "bSearchable": false, "aTargets": [ 0 ] },
287
                    ],
288
                    // 3rd column is callnumber
289
                    "aaSorting": [[ 2, "asc" ]],
290
                [% END %]
291
                'fnDrawCallback': function() {
292
                    //bind the click handler script to the newly created elements held in the table
293
                    $('.openWin').bind('click',function(e){
294
                        e.preventDefault();
295
                        openWindow(this.href,'marcview',800,600);
296
                    });
297
                }
298
            } ));
299
300
301
            $("#continuewithoutmarkingbutton").click(function(){
302
                inventorydt.fnPageChange( 'next' );
303
                return false;
304
            });
305
306
            $("#markseenandcontinuebutton").click(function(){
307
                var param = '';
308
                $("input:checked").each(function() {
309
                    param += "|" + $(this).attr('name');
310
                });
311
                $.post('/cgi-bin/koha/tools/ajax-inventory.pl', { seen: param });
312
                inventorydt.fnPageChange( 'next' );
313
                return false;
314
            });
315
316
            $("#markseenandquit").click(function(){
317
                var param = '';
318
                $("input:checked").each(function() {
319
                    param += "|" + $(this).attr('name');
320
                });
321
                $.ajax({
322
                  type: 'POST',
323
                  url: '/cgi-bin/koha/tools/ajax-inventory.pl',
324
                  data: { seen: param},
325
                  async: false
326
                });
327
                document.location.href = '/cgi-bin/koha/tools/inventory.pl';
328
                return false;
329
            });
330
331
332
            $(".checkall").click(function(){
333
                    $(".checkboxed").checkCheckboxes();
334
                    return false;
335
                });
336
            $(".clearall").click(function(){
337
                    $(".checkboxed").unCheckCheckboxes();
338
                    return false;
339
                });
340
            $("#inventory_form").on("submit",function(){
341
                return checkForm();
342
            });
343
344
            // #uploadbarcodes and #compareinv2barcd determine the behavior of
345
            // the controls within the barcode fieldset and the optional filters
346
            $("#uploadbarcodes").change(function() {
347
                if( $("#uploadbarcodes").val() ) {
348
                    $("#setdate").prop('disabled',false);
349
                    $("#compareinv2barcd").prop('disabled',false);
350
                    $("#dont_checkin").prop('disabled',false);
351
                    if( $("#compareinv2barcd").attr('checked') ) {
352
                        $("fieldset#optionalfilters").show();
353
                    } else {
354
                        $("fieldset#optionalfilters").hide();
355
                    }
356
                } else {
357
                    $("#setdate").prop('disabled',true);
358
                    $("#compareinv2barcd").prop('disabled',true);
359
                    $("#compareinv2barcd").attr('checked',false);
360
                    $("#dont_checkin").prop('disabled',true);
361
                    $("#dont_checkin").attr('checked',false);
362
                    $("fieldset#optionalfilters").show();
363
                }
364
            });
365
            $("#compareinv2barcd").click(function() {
366
                if( $("#compareinv2barcd").attr('checked') ) {
367
                    $("fieldset#optionalfilters").show();
368
                } else {
369
                    $("fieldset#optionalfilters").hide();
370
                }
371
            });
372
        });
373
    </script>
374
[% END %]
375
371
[% INCLUDE 'intranet-bottom.inc' %]
376
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt (-161 / +165 lines)
Lines 1-171 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE Branches %]
2
[% USE Branches %]
3
[% SET footerjs = 1 %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
4
<title>Koha &rsaquo; Tools &rsaquo; Notices[% IF ( add_form or copy_form ) %][% IF ( modify ) %] &rsaquo; Modify notice[% ELSE %] &rsaquo; Add notice[% END %][% END %][% IF ( add_validate or copy_validate) %] &rsaquo; Notice added[% END %][% IF ( delete_confirm ) %] &rsaquo; Confirm deletion[% END %]</title>
5
<title>Koha &rsaquo; Tools &rsaquo; Notices[% IF ( add_form or copy_form ) %][% IF ( modify ) %] &rsaquo; Modify notice[% ELSE %] &rsaquo; Add notice[% END %][% END %][% IF ( add_validate or copy_validate) %] &rsaquo; Notice added[% END %][% IF ( delete_confirm ) %] &rsaquo; Confirm deletion[% END %]</title>
5
[% INCLUDE 'doc-head-close.inc' %]
6
[% INCLUDE 'doc-head-close.inc' %]
6
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
7
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
7
[% INCLUDE 'datatables.inc' %]
8
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
9
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.insertatcaret.js"></script>
10
<script type="text/javascript">
11
//<![CDATA[
12
$(document).ready(function() {
13
    [% IF add_form or copy_form %]
14
        $('#toolbar').fixFloat();
15
    [% END %]
16
    $("#lettert:has(tbody tr)").dataTable($.extend(true, {}, dataTablesDefaults, {
17
        "sDom": 't',
18
        "aoColumnDefs": [
19
            { "bSortable": false, "bSearchable": false, 'aTargets': [ 'nosort' ] }
20
        ],
21
        "bPaginate": false
22
    }));
23
    [% IF no_op_set %]
24
      $('#branch').change(function() {
25
            $('#op').val("");
26
            $('#selectlibrary').submit();
27
      });
28
      $('#newnotice').click(function() {
29
            $('#op').val("add_form");
30
            return true;
31
      });
32
    [% END %]
33
34
    $("#newmodule").on("change",function(){
35
        if( $("#branch").val() == ""){
36
            var branchcode = "*";
37
        } else {
38
            var branchcode = $("#branch").val();
39
        }
40
        window.location.href = "/cgi-bin/koha/tools/letter.pl?op=add_form&module=" + $(this).val() + "&branchcode=" + branchcode;
41
    });
42
43
    $("#submit_form").click( function(event) {
44
        event.preventDefault();
45
        var at_least_one_exists = 0;
46
        var are_valid = 1;
47
        $("fieldset.mtt").each( function(){
48
            var title = $(this).find('input[name="title"]').val();
49
            var content = $(this).find('textarea[name="content"]').val();
50
            if (
51
                    ( title.length == 0 && content.length > 0 )
52
                 || ( title.length > 0 && content.length == 0 )
53
            ) {
54
                var mtt = $(this).find('input[name="message_transport_type"]').val();
55
                var msg = _("Please specify title and content for %s");
56
                msg = msg.replace( "%s", mtt );
57
                at_least_one_exists = 1;
58
                alert(msg);
59
                return are_valid = false;
60
            } else if ( title.length > 0 && content.length > 0 ) {
61
                at_least_one_exists = 1;
62
            }
63
        } );
64
        if ( ! at_least_one_exists ) {
65
            alert( _("Please fill at least one template.") );
66
            return false;
67
        }
68
        if ( ! are_valid ) {
69
            return false;
70
        }
71
72
        // Test if code already exists in DB
73
        var new_lettercode = $("#code").val();
74
        var new_branchcode = $("#branch").val();
75
        [% IF ( add_form and code ) # IF edit %]
76
          if ( new_lettercode != '[% code %]' ) {
77
        [% END %]
78
          $.ajax({
79
            data: { code: new_lettercode, branchcode: new_branchcode },
80
            type: 'GET',
81
            url: '/cgi-bin/koha/svc/letters/',
82
            success: function (data) {
83
              if ( data.letters.length > 0 ) {
84
                if( new_branchcode == '' ) {
85
                    alert( _("A default letter with the code '%s' already exists.").format(new_lettercode) );
86
                } else {
87
                    alert( _("A letter with the code '%s' already exists for '%s'.").format(new_lettercode, new_branchcode) );
88
                }
89
                return false;
90
              } else {
91
                $("#add_notice").submit();
92
              }
93
            },
94
          });
95
        [% IF ( add_form and code ) %]
96
          } else {
97
            $("#add_notice").submit();
98
          }
99
        [% END %]
100
    });
101
102
    var sms_limit = 160;
103
    $("#content_sms").on("keyup", function(){
104
        var length = $(this).val().length;
105
        $("#sms_counter").html(length + "/" + sms_limit + _(" characters"));
106
        if ( length  > sms_limit ) {
107
            $("#sms_counter").css("color", "red");
108
        } else {
109
            $("#sms_counter").css("color", "black");
110
        }
111
    });
112
    $( ".transport-types" ).accordion({ collapsible: true, active:false, animate: 200 });
113
    $(".insert").on("click",function(){
114
        var containerid = $(this).data("containerid");
115
        insertValueQuery( containerid );
116
    })
117
118
    $("#tabs").tabs();
119
120
    $("#saveandcontinue").on("click",function(e){
121
        e.preventDefault();
122
        $("#redirect").val("just_save");
123
        $("#submit_form").click();
124
    });
125
126
});
127
[% IF add_form or copy_form %]
128
	
129
    function cancel(f) {
130
        $('#op').val("");
131
        f.method = "get";
132
        f.submit();
133
    }
134
135
		function isNotNull(f,noalert) {
136
			if (f.value.length ==0) {
137
	return false;
138
			}
139
			return true;
140
		}
141
142
		function isNum(v,maybenull) {
143
		var n = new Number(v.value);
144
		if (isNaN(n)) {
145
			return false;
146
			}
147
		if (maybenull==0 && v.value=='') {
148
			return false;
149
		}
150
		return true;
151
		}
152
        function insertValueQuery(containerid) {
153
            var fieldset = $("#" + containerid);
154
            var myQuery = $(fieldset).find('textarea[name="content"]');
155
            var myListBox = $(fieldset).find('select[name="SQLfieldname"]');
156
157
            if($(myListBox).find('option').length > 0) {
158
                $(myListBox).find('option').each( function (){
159
                    if ( $(this).attr('selected') && $(this).val().length > 0 ) {
160
                        $(myQuery).insertAtCaret("<<" + $(this).val() + ">>");
161
                    }
162
                });
163
            }
164
        }
165
	[% END %]
166
		//]]>
167
		</script>
168
</head>
8
</head>
9
169
<body id="tools_letter" class="tools">
10
<body id="tools_letter" class="tools">
170
[% INCLUDE 'header.inc' %]
11
[% INCLUDE 'header.inc' %]
171
[% INCLUDE 'letters-search.inc' %]
12
[% INCLUDE 'letters-search.inc' %]
Lines 555-558 $(document).ready(function() { Link Here
555
    </div>
396
    </div>
556
[% END %]
397
[% END %]
557
</div>
398
</div>
399
400
[% MACRO jsinclude BLOCK %]
401
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script>
402
    [% INCLUDE 'datatables.inc' %]
403
    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
404
    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.insertatcaret.js"></script>
405
    <script type="text/javascript">
406
        $(document).ready(function() {
407
            [% IF add_form or copy_form %]
408
                $('#toolbar').fixFloat();
409
            [% END %]
410
            $("#lettert:has(tbody tr)").dataTable($.extend(true, {}, dataTablesDefaults, {
411
                "sDom": 't',
412
                "aoColumnDefs": [
413
                    { "bSortable": false, "bSearchable": false, 'aTargets': [ 'nosort' ] }
414
                ],
415
                "bPaginate": false
416
            }));
417
            [% IF no_op_set %]
418
                $('#branch').change(function() {
419
                    $('#op').val("");
420
                    $('#selectlibrary').submit();
421
                });
422
                $('#newnotice').click(function() {
423
                    $('#op').val("add_form");
424
                    return true;
425
                });
426
            [% END %]
427
428
            $("#newmodule").on("change",function(){
429
                if( $("#branch").val() == ""){
430
                    var branchcode = "*";
431
                } else {
432
                    var branchcode = $("#branch").val();
433
                }
434
                window.location.href = "/cgi-bin/koha/tools/letter.pl?op=add_form&module=" + $(this).val() + "&branchcode=" + branchcode;
435
            });
436
437
            $("#submit_form").click( function(event) {
438
                event.preventDefault();
439
                var at_least_one_exists = 0;
440
                var are_valid = 1;
441
                $("fieldset.mtt").each( function(){
442
                    var title = $(this).find('input[name="title"]').val();
443
                    var content = $(this).find('textarea[name="content"]').val();
444
                    if (
445
                            ( title.length == 0 && content.length > 0 )
446
                         || ( title.length > 0 && content.length == 0 )
447
                    ) {
448
                        var mtt = $(this).find('input[name="message_transport_type"]').val();
449
                        var msg = _("Please specify title and content for %s");
450
                        msg = msg.replace( "%s", mtt );
451
                        at_least_one_exists = 1;
452
                        alert(msg);
453
                        return are_valid = false;
454
                    } else if ( title.length > 0 && content.length > 0 ) {
455
                        at_least_one_exists = 1;
456
                    }
457
                } );
458
                if ( ! at_least_one_exists ) {
459
                    alert( _("Please fill at least one template.") );
460
                    return false;
461
                }
462
                if ( ! are_valid ) {
463
                    return false;
464
                }
465
466
                // Test if code already exists in DB
467
                var new_lettercode = $("#code").val();
468
                var new_branchcode = $("#branch").val();
469
                [% IF ( add_form and code ) # IF edit %]
470
                    if ( new_lettercode != '[% code %]' ) {
471
                [% END %]
472
                    $.ajax({
473
                        data: { code: new_lettercode, branchcode: new_branchcode },
474
                        type: 'GET',
475
                        url: '/cgi-bin/koha/svc/letters/',
476
                        success: function (data) {
477
                             if ( data.letters.length > 0 ) {
478
                                 if( new_branchcode == '' ) {
479
                                     alert( _("A default letter with the code '%s' already exists.").format(new_lettercode) );
480
                                 } else {
481
                                     alert( _("A letter with the code '%s' already exists for '%s'.").format(new_lettercode, new_branchcode) );
482
                                 }
483
                                 return false;
484
                             } else {
485
                                 $("#add_notice").submit();
486
                             }
487
                        },
488
                    });
489
                [% IF ( add_form and code ) %]
490
                    } else {
491
                        $("#add_notice").submit();
492
                    }
493
                [% END %]
494
            });
495
496
            var sms_limit = 160;
497
            $("#content_sms").on("keyup", function(){
498
                var length = $(this).val().length;
499
                $("#sms_counter").html(length + "/" + sms_limit + _(" characters"));
500
                if ( length  > sms_limit ) {
501
                    $("#sms_counter").css("color", "red");
502
                } else {
503
                    $("#sms_counter").css("color", "black");
504
                }
505
            });
506
            $( ".transport-types" ).accordion({ collapsible: true, active:false, animate: 200 });
507
            $(".insert").on("click",function(){
508
                var containerid = $(this).data("containerid");
509
                insertValueQuery( containerid );
510
            })
511
512
            $("#tabs").tabs();
513
514
            $("#saveandcontinue").on("click",function(e){
515
                e.preventDefault();
516
                $("#redirect").val("just_save");
517
                $("#submit_form").click();
518
            });
519
520
        });
521
        [% IF add_form or copy_form %]
522
            function cancel(f) {
523
                $('#op').val("");
524
                f.method = "get";
525
                f.submit();
526
            }
527
528
            function isNotNull(f,noalert) {
529
              if (f.value.length ==0) {
530
                  return false;
531
              }
532
              return true;
533
            }
534
535
            function isNum(v,maybenull) {
536
                var n = new Number(v.value);
537
                if (isNaN(n)) {
538
                    return false;
539
                }
540
                if (maybenull==0 && v.value==''){
541
                  return false;
542
                }
543
                return true;
544
            }
545
            function insertValueQuery(containerid) {
546
                var fieldset = $("#" + containerid);
547
                var myQuery = $(fieldset).find('textarea[name="content"]');
548
                var myListBox = $(fieldset).find('select[name="SQLfieldname"]');
549
550
                if($(myListBox).find('option').length > 0) {
551
                    $(myListBox).find('option').each( function (){
552
                        if ( $(this).attr('selected') && $(this).val().length > 0 ) {
553
                            $(myQuery).insertAtCaret("<<" + $(this).val() + ">>");
554
                        }
555
                    });
556
                }
557
            }
558
        [% END %]
559
    </script>
560
[% END %]
561
558
[% INCLUDE 'intranet-bottom.inc' %]
562
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload-images.tt (-49 / +50 lines)
Lines 1-58 Link Here
1
[% SET footerjs = 1 %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Tools &rsaquo; Upload images</title>
3
<title>Koha &rsaquo; Tools &rsaquo; Upload images</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
4
5
<script type="text/javascript" src="[% interface %]/[% theme %]/js/background-job-progressbar.js"></script>
6
<script type="text/javascript" src="[% interface %]/[% theme %]/js/file-upload.js"></script>
7
8
<style type="text/css">
5
<style type="text/css">
9
    #fileuploadstatus,#fileuploadfailed,#jobpanel,#jobstatus,#jobfailed { display : none; }
6
    #fileuploadstatus,#fileuploadfailed,#jobpanel,#jobstatus,#jobfailed { display : none; }
10
</style>
7
</style>
11
12
<script type="text/javascript">
13
//<![CDATA[
14
function StartUpload() {
15
    if( $('#fileToUpload').prop('files').length == 0 ) return;
16
    $('#uploadform button.submit').prop('disabled',true);
17
    $("#fileuploadstatus").show();
18
    $("#uploadedfileid").val('');
19
    xhr= AjaxUpload( $('#fileToUpload'), $('#fileuploadprogress'), 'temp=1', cbUpload );
20
}
21
function cbUpload( status, fileid, errors ) {
22
    if( status=='done' ) {
23
        $("#uploadedfileid").val( fileid );
24
        $('#fileToUpload').prop('disabled',true);
25
        $("#processfile").show();
26
    } else {
27
        var errMsgs = [ _("Error code 0 not used"), _("File already exists"), _("Directory is not writeable"), _("Root directory for uploads not defined"), _("Temporary directory for uploads not defined") ];
28
        var errCode = errors[$('#fileToUpload').prop('files')[0].name].code;
29
        $("#fileuploadstatus").hide();
30
        $("#fileuploadfailed").show();
31
        $("#fileuploadfailed").text( _("Upload status: ") +
32
            ( status=='failed'? _("Failed") + " - (" + errCode + ") " + errMsgs[errCode]:
33
            ( status=='denied'? _("Denied"): status ))
34
        );
35
        $("#processfile").hide();
36
    }
37
}
38
$(document).ready(function(){
39
	$("#processfile").hide();
40
	$("#zipfile").click(function(){
41
		$("#bibnum").hide();
42
	});
43
	$("#image").click(function(){
44
		$("#bibnum").show();
45
	});
46
    $("#uploadfile").validate({
47
        submitHandler: function(form) {
48
            StartUpload();
49
            return false;
50
        }
51
    });
52
});
53
//]]>
54
</script>
55
</head>
8
</head>
9
56
<body id="tools_upload-images" class="tools">
10
<body id="tools_upload-images" class="tools">
57
[% INCLUDE 'header.inc' %]
11
[% INCLUDE 'header.inc' %]
58
[% INCLUDE 'cat-search.inc' %]
12
[% INCLUDE 'cat-search.inc' %]
Lines 153-156 $(document).ready(function(){ Link Here
153
[% INCLUDE 'tools-menu.inc' %]
107
[% INCLUDE 'tools-menu.inc' %]
154
</div>
108
</div>
155
</div>
109
</div>
110
111
[% MACRO jsinclude BLOCK %]
112
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script>
113
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/background-job-progressbar.js"></script>
114
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/file-upload.js"></script>
115
    <script type="text/javascript">
116
        function StartUpload() {
117
            if( $('#fileToUpload').prop('files').length == 0 ) return;
118
            $('#uploadform button.submit').prop('disabled',true);
119
            $("#fileuploadstatus").show();
120
            $("#uploadedfileid").val('');
121
            xhr= AjaxUpload( $('#fileToUpload'), $('#fileuploadprogress'), 'temp=1', cbUpload );
122
        }
123
        function cbUpload( status, fileid, errors ) {
124
            if( status=='done' ) {
125
                $("#uploadedfileid").val( fileid );
126
                $('#fileToUpload').prop('disabled',true);
127
                $("#processfile").show();
128
            } else {
129
                var errMsgs = [ _("Error code 0 not used"), _("File already exists"), _("Directory is not writeable"), _("Root directory for uploads not defined"), _("Temporary directory for uploads not defined") ];
130
                var errCode = errors[$('#fileToUpload').prop('files')[0].name].code;
131
                $("#fileuploadstatus").hide();
132
                $("#fileuploadfailed").show();
133
                $("#fileuploadfailed").text( _("Upload status: ") +
134
                    ( status=='failed'? _("Failed") + " - (" + errCode + ") " + errMsgs[errCode]:
135
                    ( status=='denied'? _("Denied"): status ))
136
                );
137
                $("#processfile").hide();
138
            }
139
        }
140
        $(document).ready(function(){
141
            $("#processfile").hide();
142
            $("#zipfile").click(function(){
143
                $("#bibnum").hide();
144
            });
145
            $("#image").click(function(){
146
                $("#bibnum").show();
147
            });
148
            $("#uploadfile").validate({
149
                submitHandler: function(form) {
150
                    StartUpload();
151
                    return false;
152
                }
153
            });
154
        });
155
    </script>
156
[% END %]
157
156
[% INCLUDE 'intranet-bottom.inc' %]
158
[% INCLUDE 'intranet-bottom.inc' %]
157
- 

Return to bug 19679