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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/automatic_item_modification_by_age.tt (-17 / +23 lines)
Lines 1-24 Link Here
1
[% SET footerjs = 1 %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Tools &rsaquo; Automatic item modifications by age</title>
3
<title>Koha &rsaquo; Tools &rsaquo; Automatic item modifications by age</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
4
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
5
<script type="text/javascript" src="[% interface %]/[% theme %]/js/automatic_item_modification_by_age.js"></script>
6
[% IF op == 'edit_form' %]
7
    <script type="text/javascript">//<![CDATA[
8
      $(document).ready(function() {
9
            [% IF ( op == 'edit_form' ) %]
10
                $('#toolbar').fixFloat();
11
            [% END %]
12
          [% IF rules.size > 0 %]
13
            $("#norules").hide();
14
          [% ELSE %]
15
            $("#rules").show();
16
          [% END %]
17
      });
18
    //]]>
19
    </script>
20
[% END %]
21
</head>
5
</head>
6
22
<body id="tools_automatic_item_modification_by_age" class="tools">
7
<body id="tools_automatic_item_modification_by_age" class="tools">
23
[% INCLUDE 'header.inc' %]
8
[% INCLUDE 'header.inc' %]
24
[% INCLUDE 'cat-search.inc' %]
9
[% INCLUDE 'cat-search.inc' %]
Lines 236-239 Link Here
236
    [% INCLUDE 'tools-menu.inc' %]
221
    [% INCLUDE 'tools-menu.inc' %]
237
  </div>
222
  </div>
238
</div>
223
</div>
224
225
[% MACRO jsinclude BLOCK %]
226
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script>
227
    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
228
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/automatic_item_modification_by_age.js"></script>
229
    [% IF op == 'edit_form' %]
230
        <script type="text/javascript">
231
            $(document).ready(function() {
232
                  [% IF ( op == 'edit_form' ) %]
233
                      $('#toolbar').fixFloat();
234
                  [% END %]
235
                  [% IF rules.size > 0 %]
236
                      $("#norules").hide();
237
                  [% ELSE %]
238
                      $("#rules").show();
239
                  [% END %]
240
            });
241
        </script>
242
    [% END %]
243
[% END %]
244
239
[% INCLUDE 'intranet-bottom.inc' %]
245
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt (-127 / +130 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; Tools &rsaquo; Manage staged MARC records
3
<title>Koha &rsaquo; Tools &rsaquo; Manage staged MARC records
3
[% IF ( import_batch_id ) %]
4
[% IF ( import_batch_id ) %]
Lines 5-138 Link Here
5
[% END %]
6
[% END %]
6
</title>
7
</title>
7
[% INCLUDE 'doc-head-close.inc' %]
8
[% INCLUDE 'doc-head-close.inc' %]
8
<script type="text/javascript" src="[% interface %]/[% theme %]/js/background-job-progressbar.js"></script>
9
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
9
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
10
[% INCLUDE 'datatables.inc' %]
11
<script type="text/javascript">
12
//<![CDATA[
13
$(document).ready(function(){
14
  $("#staged-record-matching-rules select").change(function(){
15
      var str = $(this).attr("id");
16
      $("#reset_"+str).parent().show();
17
  });
18
  $("a.reset").click(function(){
19
      var str = $(this).attr("id");
20
      str = str.replace("reset_","")
21
      $("#"+str+" option[selected='selected']").attr("selected","selected");
22
      $(this).parent().hide();
23
  });
24
25
  [% IF import_batch_id %]
26
      $("#records-table").dataTable($.extend(true, {}, dataTablesDefaults, {
27
          "bAutoWidth": false,
28
          "bFilter": false,
29
          "bProcessing": true,
30
          "bServerSide": true,
31
          "sAjaxSource": 'batch_records_ajax.pl',
32
          "sPaginationType": "full_numbers",
33
          "sDom": '<"top pager"iflp>rt<"bottom pager"flp><"clear">',
34
          "aoColumns": [
35
              { "mDataProp": "import_record_id" },
36
              { "mDataProp": "citation" },
37
              { "mDataProp": "status" },
38
              { "mDataProp": "overlay_status" },
39
              { "mDataProp": "match_citation" },
40
              { "mDataProp": "diff_url" },
41
              { "mDataProp": "matched" }
42
          ],
43
          "fnServerData": function ( sSource, aoData, fnCallback ) {
44
              aoData.push( { "name": "import_batch_id", "value": [% import_batch_id %] } );
45
46
              $.ajax({
47
                  'dataType': 'json',
48
                  'type': 'POST',
49
                  'url': sSource,
50
                  'data': aoData,
51
                  'success': function(json){
52
                      fnCallback(json);
53
                  }
54
              });
55
          },
56
          "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
57
            [% IF ( record_type == 'auth' ) %]
58
                var record_details_url = "/cgi-bin/koha/authorities/detail.pl?authid=";
59
            [% ELSE %]
60
                var record_details_url = "/cgi-bin/koha/catalogue/detail.pl?biblionumber=";
61
            [% END %]
62
63
            $('td:eq(1)', nRow).html(
64
                '<a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=' + aData['import_record_id'] + '&viewas=html" class="previewMARC">' + aData['citation'] + '</a>'
65
            );
66
67
            $('td:eq(2)', nRow).html(
68
                aData['status'] == 'imported' ? _("Imported") :
69
                aData['status'] == 'ignored'  ? _("Ignored")  :
70
                aData['status'] == 'reverted' ? _("Reverted") :
71
                aData['status'] == 'staged'   ? _("Staged")   :
72
                aData['status'] == 'error'    ? _("Error")    :
73
                aData['status']
74
            );
75
76
            $('td:eq(3)', nRow).html(
77
                aData['overlay_status'] == 'no_match'      ? _("No match")       :
78
                aData['overlay_status'] == 'match_applied' ? _("Match applied")  :
79
                aData['overlay_status'] == 'auto_match'    ? _("Match found")    :
80
                aData['overlay_status']
81
            );
82
83
            if ( aData['match_id'] ) {
84
                [% IF ( record_type == 'auth' ) -%]
85
                var matching_msg = _("Matches authority %s (score=%s):%s");
86
                [%- ELSE -%]
87
                var matching_msg = _("Matches biblio %s (score=%s):%s");
88
                [%- END %]
89
                $('td:eq(4)', nRow).html(
90
                    matching_msg.format(aData['match_id'], aData['score'],
91
                    '<a target="_blank" href="' + record_details_url
92
                    + aData['match_id'] + '">' + aData['match_citation'] + '</a>')
93
                );
94
            }
95
            if (aData['diff_url']){
96
                $('td:eq(5)', nRow).html(
97
                    '<a href="'+aData['diff_url']+'">View</a>'
98
                );
99
            }
100
            $('td:eq(6)', nRow).html(
101
                '<a target="_blank" href="' + record_details_url
102
                    + aData['matched'] + '">' + aData['matched'] + '</a>'
103
            );
104
          },
105
      }));
106
        $("#import_batch_form").on("submit",function(){
107
            return submitBackgroundJob( document.getElementById("import_batch_form") );
108
        });
109
        $("#revert_batch_form").on("submit",function(){
110
            return confirm( _("Are you sure you want to undo the import of this batch into the catalog?") ) &&   submitBackgroundJob( document.getElementById("revert_batch_form") );
111
        });
112
    [% END %]
113
    $("body").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 + " table");
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
    $(".batch_form").on("submit",function(){
126
        if( $(this).hasClass("batch_delete") ){
127
            return confirm( _("Are you sure you want to permanently delete this batch?") );
128
        } else {
129
            return confirm( _("Clear all reservoir records staged in this batch?  This cannot be undone.") );
130
        }
131
    });
132
});
133
134
//]]>
135
</script>
136
<style type="text/css">
10
<style type="text/css">
137
    #jobpanel,#jobstatus,#jobfailed { display : none; }
11
    #jobpanel,#jobstatus,#jobfailed { display : none; }
138
</style>
12
</style>
Lines 505-508 Page Link Here
505
[% INCLUDE 'tools-menu.inc' %]
379
[% INCLUDE 'tools-menu.inc' %]
506
</div>
380
</div>
507
</div>
381
</div>
382
383
[% MACRO jsinclude BLOCK %]
384
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script>
385
<script type="text/javascript" src="[% interface %]/[% theme %]/js/background-job-progressbar.js"></script>
386
    [% INCLUDE 'datatables.inc' %]
387
    <script type="text/javascript">
388
        $(document).ready(function(){
389
            $("#staged-record-matching-rules select").change(function(){
390
                var str = $(this).attr("id");
391
                $("#reset_"+str).parent().show();
392
            });
393
            $("a.reset").click(function(){
394
                var str = $(this).attr("id");
395
                str = str.replace("reset_","")
396
                $("#"+str+" option[selected='selected']").attr("selected","selected");
397
                $(this).parent().hide();
398
            });
399
400
            [% IF import_batch_id %]
401
                $("#records-table").dataTable($.extend(true, {}, dataTablesDefaults, {
402
                    "bAutoWidth": false,
403
                    "bFilter": false,
404
                    "bProcessing": true,
405
                    "bServerSide": true,
406
                    "sAjaxSource": 'batch_records_ajax.pl',
407
                    "sPaginationType": "full_numbers",
408
                    "sDom": '<"top pager"iflp>rt<"bottom pager"flp><"clear">',
409
                    "aoColumns": [
410
                        { "mDataProp": "import_record_id" },
411
                        { "mDataProp": "citation" },
412
                        { "mDataProp": "status" },
413
                        { "mDataProp": "overlay_status" },
414
                        { "mDataProp": "match_citation" },
415
                        { "mDataProp": "diff_url" },
416
                        { "mDataProp": "matched" }
417
                    ],
418
                    "fnServerData": function ( sSource, aoData, fnCallback ) {
419
                        aoData.push( { "name": "import_batch_id", "value": [% import_batch_id %] } );
420
421
                        $.ajax({
422
                            'dataType': 'json',
423
                            'type': 'POST',
424
                            'url': sSource,
425
                            'data': aoData,
426
                            'success': function(json){
427
                                fnCallback(json);
428
                            }
429
                        });
430
                    },
431
                    "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
432
                      [% IF ( record_type == 'auth' ) %]
433
                          var record_details_url = "/cgi-bin/koha/authorities/detail.pl?authid=";
434
                      [% ELSE %]
435
                          var record_details_url = "/cgi-bin/koha/catalogue/detail.pl?biblionumber=";
436
                      [% END %]
437
438
                      $('td:eq(1)', nRow).html(
439
                          '<a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=' + aData['import_record_id'] + '&viewas=html" class="previewMARC">' + aData['citation'] + '</a>'
440
                      );
441
442
                      $('td:eq(2)', nRow).html(
443
                          aData['status'] == 'imported' ? _("Imported") :
444
                          aData['status'] == 'ignored'  ? _("Ignored")  :
445
                          aData['status'] == 'reverted' ? _("Reverted") :
446
                          aData['status'] == 'staged'   ? _("Staged")   :
447
                          aData['status'] == 'error'    ? _("Error")    :
448
                          aData['status']
449
                      );
450
451
                      $('td:eq(3)', nRow).html(
452
                          aData['overlay_status'] == 'no_match'      ? _("No match")       :
453
                          aData['overlay_status'] == 'match_applied' ? _("Match applied")  :
454
                          aData['overlay_status'] == 'auto_match'    ? _("Match found")    :
455
                          aData['overlay_status']
456
                      );
457
458
                      if ( aData['match_id'] ) {
459
                          [% IF ( record_type == 'auth' ) -%]
460
                          var matching_msg = _("Matches authority %s (score=%s):%s");
461
                          [%- ELSE -%]
462
                          var matching_msg = _("Matches biblio %s (score=%s):%s");
463
                          [%- END %]
464
                          $('td:eq(4)', nRow).html(
465
                              matching_msg.format(aData['match_id'], aData['score'],
466
                              '<a target="_blank" href="' + record_details_url
467
                              + aData['match_id'] + '">' + aData['match_citation'] + '</a>')
468
                          );
469
                      }
470
                      if (aData['diff_url']){
471
                          $('td:eq(5)', nRow).html(
472
                              '<a href="'+aData['diff_url']+'">View</a>'
473
                          );
474
                      }
475
                      $('td:eq(6)', nRow).html(
476
                          '<a target="_blank" href="' + record_details_url
477
                              + aData['matched'] + '">' + aData['matched'] + '</a>'
478
                      );
479
                    },
480
                }));
481
                $("#import_batch_form").on("submit",function(){
482
                    return submitBackgroundJob( document.getElementById("import_batch_form") );
483
                });
484
                $("#revert_batch_form").on("submit",function(){
485
                    return confirm( _("Are you sure you want to undo the import of this batch into the catalog?") ) &&   submitBackgroundJob( document.getElementById("revert_batch_form") );
486
                });
487
            [% END %]
488
            $("body").on("click",".previewMARC", function(e){
489
                e.preventDefault();
490
                var ltitle = $(this).text();
491
                var page = $(this).attr("href");
492
                $("#marcPreviewLabel").text(ltitle);
493
                $("#marcPreview .modal-body").load(page + " table");
494
                $('#marcPreview').modal({show:true});
495
            });
496
            $("#marcPreview").on("hidden", function(){
497
                $("#marcPreviewLabel").html("");
498
                $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
499
            });
500
            $(".batch_form").on("submit",function(){
501
                if( $(this).hasClass("batch_delete") ){
502
                    return confirm( _("Are you sure you want to permanently delete this batch?") );
503
                } else {
504
                    return confirm( _("Clear all reservoir records staged in this batch?  This cannot be undone.") );
505
                }
506
            });
507
        });
508
    </script>
509
[% END %]
510
508
[% INCLUDE 'intranet-bottom.inc' %]
511
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt (-17 / +20 lines)
Lines 1-23 Link Here
1
[% SET footerjs = 1 %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Tools &rsaquo; MARC modification templates</title>
3
<title>Koha &rsaquo; Tools &rsaquo; MARC modification templates</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
4
<script type="text/javascript">
5
    //<![CDATA[
6
    var MSG_MMT_SUBFIELDS_MATCH = _("Both subfield values should be filled or empty.");
7
    var MSG_MMT_DESTINATION_REQUIRED = _("The destination should be filled.");
8
    var MSG_MMT_CONTROL_FIELD_EMPTY = _("If the field is a control field, the subfield should be empty");
9
    var MSG_MMT_CONTROL_FIELD = _("A control field cannot be used with a regular field.");
10
    var MSG_MMT_SOURCE_SUBFIELD = _("The source subfield should be filled for update.");
11
    var MSG_MMT_SOURCE_FIELD = _("The source field should be filled.");
12
    var MSG_MMT_EVERY = _("Every");
13
    var MSG_MMT_ALL = _("All");
14
    var MSG_MMT_CONFIRM_DEL_TEMPLATE = _("Are you sure you wish to delete this template?");
15
    var MSG_MMT_CONFIRM_DEL_TEMPLATE_ACTION = _("Are you sure you wish to delete this template action?");
16
    var MSG_MMT_EDIT_ACTION = _("Edit action %s");
17
    var MSG_MMT_UPDATE_ACTION = _("Update action");
18
    //]]>
19
</script>
20
<script type="text/javascript" src="[% interface %]/[% theme %]/js/marc_modification_templates.js"></script>
21
<style type="text/css">
5
<style type="text/css">
22
    #add_action { display: none; }
6
    #add_action { display: none; }
23
</style>
7
</style>
Lines 350-353 Link Here
350
    </div>
334
    </div>
351
  </div>
335
  </div>
352
336
337
[% MACRO jsinclude BLOCK %]
338
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script>
339
    <script type="text/javascript">
340
        var MSG_MMT_SUBFIELDS_MATCH = _("Both subfield values should be filled or empty.");
341
        var MSG_MMT_DESTINATION_REQUIRED = _("The destination should be filled.");
342
        var MSG_MMT_CONTROL_FIELD_EMPTY = _("If the field is a control field, the subfield should be empty");
343
        var MSG_MMT_CONTROL_FIELD = _("A control field cannot be used with a regular field.");
344
        var MSG_MMT_SOURCE_SUBFIELD = _("The source subfield should be filled for update.");
345
        var MSG_MMT_SOURCE_FIELD = _("The source field should be filled.");
346
        var MSG_MMT_EVERY = _("Every");
347
        var MSG_MMT_ALL = _("All");
348
        var MSG_MMT_CONFIRM_DEL_TEMPLATE = _("Are you sure you wish to delete this template?");
349
        var MSG_MMT_CONFIRM_DEL_TEMPLATE_ACTION = _("Are you sure you wish to delete this template action?");
350
        var MSG_MMT_EDIT_ACTION = _("Edit action %s");
351
        var MSG_MMT_UPDATE_ACTION = _("Update action");
352
    </script>
353
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/marc_modification_templates.js"></script>
354
[% END %]
355
353
[% INCLUDE 'intranet-bottom.inc' %]
356
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/showdiffmarc.tt (-9 / +16 lines)
Lines 1-15 Link Here
1
[% SET footerjs = 1 %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Tools &rsaquo; Manage staged MARC records &rsaquo; Compare matched records</title>
3
<title>Koha &rsaquo; Tools &rsaquo; Manage staged MARC records &rsaquo; Compare matched records</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
4
<script type="text/javascript" src="[% interface %]/lib/jsdiff/jsdiff.min.js"></script>
5
<script type="text/javascript">
6
    $(document).ready(function(){
7
      var diff1 = $("#col1 pre").text();
8
      var diff2 = $("#col2 pre").text();
9
      var diffs = diffString(diff1,diff2);
10
      $("#col1 pre,#col2 pre").html(diffs);
11
    });
12
</script>
13
<style type="text/css">
5
<style type="text/css">
14
    ins { background-color: #e6ffe6; }
6
    ins { background-color: #e6ffe6; }
15
    del { background-color: #ffe6e6; }
7
    del { background-color: #ffe6e6; }
Lines 17-22 Link Here
17
    pre { padding: 10px; overflow: scroll; }
9
    pre { padding: 10px; overflow: scroll; }
18
</style>
10
</style>
19
</head>
11
</head>
12
20
<body id="tools_compare-marc-import" class="tools">
13
<body id="tools_compare-marc-import" class="tools">
21
14
22
[% INCLUDE 'header.inc' %]
15
[% INCLUDE 'header.inc' %]
Lines 52-55 Link Here
52
    </div>
45
    </div>
53
46
54
<p><a href="/cgi-bin/koha/tools/manage-marc-import.pl?import_batch_id=[% batchid %]">Return to staged MARC batch [% batchid %]</a></p>
47
<p><a href="/cgi-bin/koha/tools/manage-marc-import.pl?import_batch_id=[% batchid %]">Return to staged MARC batch [% batchid %]</a></p>
48
49
[% MACRO jsinclude BLOCK %]
50
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script>
51
    <script type="text/javascript" src="[% interface %]/lib/jsdiff/jsdiff.min.js"></script>
52
    <script type="text/javascript">
53
        $(document).ready(function(){
54
          var diff1 = $("#col1 pre").text();
55
          var diff2 = $("#col2 pre").text();
56
          var diffs = diffString(diff1,diff2);
57
          $("#col1 pre,#col2 pre").html(diffs);
58
        });
59
    </script>
60
[% END %]
61
55
[% INCLUDE 'intranet-bottom.inc' %]
62
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tt (-82 / +83 lines)
Lines 1-91 Link Here
1
[% SET footerjs = 1 %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Tools &rsaquo; Stage MARC records for import</title>
3
<title>Koha &rsaquo; Tools &rsaquo; Stage MARC records for import</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,#fileuploadcancel,#jobpanel,#jobstatus,#jobfailed { display : none; }
6
    #fileuploadstatus,#fileuploadfailed,#fileuploadcancel,#jobpanel,#jobstatus,#jobfailed { display : none; }
10
</style>
7
</style>
11
8
12
<script type="text/javascript">
13
//<![CDATA[
14
var xhr;
15
$(document).ready(function(){
16
	$("#processfile").hide();
17
    $("#record_type").change(function() {
18
        if ($(this).val() == 'auth') {
19
            $('#items').hide();
20
        } else {
21
            $('#items').show();
22
        }
23
    });
24
    $("#fileuploadbutton").on("click",function(e){
25
        e.preventDefault();
26
        StartUpload();
27
    });
28
    $("#fileuploadcancel").on("click",function(e){
29
        e.preventDefault();
30
        CancelUpload();
31
    });
32
    $("#mainformsubmit").on("click",function(){
33
        return CheckForm( document.getElementById("processfile"));
34
    });
35
});
36
function CheckForm(f) {
37
    if ($("#fileToUpload").value == '') {
38
        alert(_("Please upload a file first."));
39
    } else {
40
        return submitBackgroundJob(f);
41
    }
42
    return false;
43
}
44
function StartUpload() {
45
    if( $('#fileToUpload').prop('files').length == 0 ) return;
46
    $('#fileuploadbutton').hide();
47
    $("#fileuploadfailed").hide();
48
    $("#processfile").hide();
49
    $("#fileuploadstatus").show();
50
    $("#uploadedfileid").val('');
51
    xhr= AjaxUpload( $('#fileToUpload'), $('#fileuploadprogress'), 'temp=1', cbUpload );
52
    $("#fileuploadcancel").show();
53
}
54
function CancelUpload() {
55
    if( xhr ) xhr.abort();
56
    $("#fileuploadstatus").hide();
57
    $('#fileuploadbutton').show();
58
    $("#fileuploadcancel").hide();
59
    $("#fileuploadfailed").show();
60
    $("#fileuploadfailed").text( _("Upload status: Cancelled ") );
61
}
62
function cbUpload( status, fileid, errors ) {
63
    if( status=='done' ) {
64
        $("#uploadedfileid").val( fileid );
65
        $('#fileToUpload').prop('disabled',true);
66
        $('#fileuploadbutton').prop('disabled',true);
67
        $('#fileuploadbutton').show();
68
        $("#fileuploadcancel").hide();
69
        var filename=$('#fileToUpload').prop('files')[0].name;
70
        if( filename.match( new RegExp(/\.[^.]+xml$/) ) ) {
71
            $('#format').val('MARCXML');
72
        }
73
        $("#processfile").show();
74
    } else {
75
        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") ];
76
        var errCode = errors[$('#fileToUpload').prop('files')[0].name].code;
77
        $('#fileuploadbutton').show();
78
        $("#fileuploadcancel").hide();
79
        $("#fileuploadstatus").hide();
80
        $("#fileuploadfailed").show();
81
        $("#fileuploadfailed").text( _("Upload status: ") +
82
            ( status=='failed'? _("Failed") + " - (" + errCode + ") " + errMsgs[errCode]:
83
            ( status=='denied'? _("Denied"): status ))
84
        );
85
    }
86
}
87
//]]>
88
</script>
89
</head>
9
</head>
90
<body id="tools_stage-marc-import" class="tools">
10
<body id="tools_stage-marc-import" class="tools">
91
[% INCLUDE 'header.inc' %]
11
[% INCLUDE 'header.inc' %]
Lines 275-278 function cbUpload( status, fileid, errors ) { Link Here
275
[% INCLUDE 'tools-menu.inc' %]
195
[% INCLUDE 'tools-menu.inc' %]
276
</div>
196
</div>
277
</div>
197
</div>
198
199
[% MACRO jsinclude BLOCK %]
200
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script>
201
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/background-job-progressbar.js"></script>
202
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/file-upload.js"></script>
203
    <script type="text/javascript">
204
        var xhr;
205
        $(document).ready(function(){
206
            $("#processfile").hide();
207
            $("#record_type").change(function() {
208
                if ($(this).val() == 'auth') {
209
                    $('#items').hide();
210
                } else {
211
                    $('#items').show();
212
                }
213
            });
214
            $("#fileuploadbutton").on("click",function(e){
215
                e.preventDefault();
216
                StartUpload();
217
            });
218
            $("#fileuploadcancel").on("click",function(e){
219
                e.preventDefault();
220
                CancelUpload();
221
            });
222
            $("#mainformsubmit").on("click",function(){
223
                return CheckForm( document.getElementById("processfile"));
224
            });
225
        });
226
        function CheckForm(f) {
227
            if ($("#fileToUpload").value == '') {
228
                alert(_("Please upload a file first."));
229
            } else {
230
                return submitBackgroundJob(f);
231
            }
232
            return false;
233
        }
234
        function StartUpload() {
235
            if( $('#fileToUpload').prop('files').length == 0 ) return;
236
            $('#fileuploadbutton').hide();
237
            $("#fileuploadfailed").hide();
238
            $("#processfile").hide();
239
            $("#fileuploadstatus").show();
240
            $("#uploadedfileid").val('');
241
            xhr= AjaxUpload( $('#fileToUpload'), $('#fileuploadprogress'), 'temp=1', cbUpload );
242
            $("#fileuploadcancel").show();
243
        }
244
        function CancelUpload() {
245
            if( xhr ) xhr.abort();
246
            $("#fileuploadstatus").hide();
247
            $('#fileuploadbutton').show();
248
            $("#fileuploadcancel").hide();
249
            $("#fileuploadfailed").show();
250
            $("#fileuploadfailed").text( _("Upload status: Cancelled ") );
251
        }
252
        function cbUpload( status, fileid, errors ) {
253
            if( status=='done' ) {
254
                $("#uploadedfileid").val( fileid );
255
                $('#fileToUpload').prop('disabled',true);
256
                $('#fileuploadbutton').prop('disabled',true);
257
                $('#fileuploadbutton').show();
258
                $("#fileuploadcancel").hide();
259
                var filename=$('#fileToUpload').prop('files')[0].name;
260
                if( filename.match( new RegExp(/\.[^.]+xml$/) ) ) {
261
                    $('#format').val('MARCXML');
262
                }
263
                $("#processfile").show();
264
            } else {
265
                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") ];
266
                var errCode = errors[$('#fileToUpload').prop('files')[0].name].code;
267
                $('#fileuploadbutton').show();
268
                $("#fileuploadcancel").hide();
269
                $("#fileuploadstatus").hide();
270
                $("#fileuploadfailed").show();
271
                $("#fileuploadfailed").text( _("Upload status: ") +
272
                    ( status=='failed'? _("Failed") + " - (" + errCode + ") " + errMsgs[errCode]:
273
                    ( status=='denied'? _("Denied"): status ))
274
                );
275
            }
276
        }
277
    </script>
278
[% END %]
279
278
[% INCLUDE 'intranet-bottom.inc' %]
280
[% INCLUDE 'intranet-bottom.inc' %]
279
- 

Return to bug 19672