Bug 10558: (follow-up) styling improvements
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / manage-marc-import.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Tools &rsaquo; Manage staged MARC records
3 [% IF ( import_batch_id ) %]
4  &rsaquo; Batch [% import_batch_id %]
5 [% END %]
6 </title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 <script type="text/javascript" src="[% themelang %]/js/background-job-progressbar.js"></script>
9 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
10 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
11 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.columnFilter.js"></script>
12 [% INCLUDE 'datatables-strings.inc' %]
13 <script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
14 <script type="text/JavaScript" language="JavaScript">
15 //<![CDATA[
16 var MSG_CONFIRM_CLEAN = _("Clear all reservoir records staged in this batch?  This cannot be undone.");
17
18 $(document).ready(function(){
19   $("#staged-record-matching-rules select").change(function(){
20       var str = $(this).attr("id");
21       $("#reset_"+str).parent().show();
22   });
23   $("a.reset").click(function(){
24       var str = $(this).attr("id");
25       str = str.replace("reset_","")
26       $("#"+str+" option[selected='selected']").attr("selected","selected");
27       $(this).parent().hide();
28   });
29
30   $("#records-table").dataTable({
31       "aLengthMenu": [[10, 15, 20, 25, 50, 100], [10, 15, 20, 25, 50, 100]],
32       "iDisplayLength" : 20,
33       "bAutoWidth": false,
34       "bFilter": false,
35       "bProcessing": true,
36       "bServerSide": true,
37       "sAjaxSource": 'batch_records_ajax.pl',
38       "sPaginationType": "full_numbers",
39       "sDom": '<"top pager"iflp>rt<"bottom pager"flp><"clear">',
40       "aoColumns": [
41           { "mDataProp": "import_record_id" },
42           { "mDataProp": "citation" },
43           { "mDataProp": "status" },
44           { "mDataProp": "overlay_status" },
45           { "mDataProp": "match_citation" },
46           { "mDataProp": "matched" },
47       ],
48       "fnServerData": function ( sSource, aoData, fnCallback ) {
49           aoData.push( { "name": "import_batch_id", "value": [% import_batch_id %] } );
50
51           $.getJSON( sSource, aoData, function (json) {
52               fnCallback(json)
53           } );
54       },
55       "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
56         $('td:eq(1)', nRow).html(
57             '<a href="javascript:void()" onclick="show_marc('
58             + aData['import_record_id']
59             + ')">' + aData['citation'] + '</a>'
60         );
61
62         if ( aData['match_id'] ) {
63             $('td:eq(4)', nRow).html(
64                 _("Matches biblio ")
65                 + aData['match_id']
66                 + " (" + _("score") + "="
67                 + aData['score']
68                 + '):' + '<a target="_blank" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber='
69                 + aData['match_id'] + '">' + aData['match_citation'] + '</a>'
70             );
71         }
72
73         $('td:eq(5)', nRow).html(
74             '<a target="_blank" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber='
75             + aData['matched'] + '">' + aData['matched'] + '</a>'
76         );
77       },
78   });
79 });
80
81 function show_marc( id ) {
82     var page = "/cgi-bin/koha/catalogue/showmarc.pl?importid=" + id;
83
84     var $dialog = $('<div></div>')
85         .html('<iframe style="border: 0px; " src="' + page + '" width="100%" height="100%"></iframe>')
86         .dialog({
87             autoOpen: false,
88             modal: true,
89             height: 625,
90             width: 500,
91             title: _("MARC Preview")
92         });
93
94     $dialog.dialog('open');
95 }
96 //]]>
97 </script>
98 <style type="text/css">
99         #jobpanel,#jobstatus,#jobfailed { display : none; }
100         #jobstatus { margin:.4em; }
101     #jobprogress{ width:200px;height:10px;border:1px solid #666;background:url('[% interface %]/[% theme %]/img/progress.png') -300px 0px no-repeat; } span.change-status { font-style:italic; color:#666; display:none; }</style>
102 </head>
103 <body id="tools_manage-marc-import" class="tools">
104 [% INCLUDE 'header.inc' %]
105 [% INCLUDE 'cat-search.inc' %]
106
107 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> 
108 [% IF ( import_batch_id ) %]
109  &rsaquo;
110  <a href="[% script_name %]">Manage staged MARC records</a>
111  &rsaquo; Batch [% import_batch_id %]
112 [% ELSE %]
113  &rsaquo; Manage staged MARC records
114 [% END %]
115 </div>
116
117 <div id="doc3" class="yui-t2">
118    
119    <div id="bd">
120         <div id="yui-main">
121         <div class="yui-b">
122
123 <h1>Manage staged MARC records
124 [% IF ( import_batch_id ) %]
125  &rsaquo; Batch [% import_batch_id %]
126 [% END %]
127 </h1>
128 [% IF ( label_batch_msg ) %]
129 [% IF ( alert ) %]
130 <div class="alert">
131 [% ELSE %]
132 <div class="dialog">
133 [% END %]
134 <b><p>[% label_batch_msg %]</p></b>
135 </div>
136 [% END %]
137
138 [% IF ( did_clean ) %]
139   <div class="dialog message">Cleaned import batch #[% import_batch_id %]</div>
140 [% END %]
141
142 [% UNLESS ( batch_list ) %]
143    [% UNLESS ( batch_info ) %]
144    <div class="dialog message">
145      <p>No records have been staged.</p>
146      <p><a href="/cgi-bin/koha/tools/stage-marc-import.pl">Stage MARC records for import</a>.</p>
147    </div>
148    [% END %]
149 [% END %]
150
151 [% IF ( batch_info ) %]
152
153 [% IF ( can_commit ) %]
154 <form action="[% script_name %]" method="post">
155 <input type="hidden" name="op" value="redo-matching" />
156 <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
157 <input type="hidden" name="current_matcher_id" value="[% current_matcher_id %]" />
158 [% END %]
159
160   [% IF ( rematch_attempted ) %]
161     [% IF ( rematch_failed ) %]
162       <div class="dialog alert">Failed to apply different matching rule</div>
163     [% ELSE %]
164       <div class="dialog message">Applied different matching rule.  Number of records matched now
165        [% num_with_matches %]
166       </div>
167     [% END %]
168   [% END %]
169   [% IF ( changed_overlay_action ) %]
170       <div class="dialog message">Changed action if matching record found</div>
171   [% END %]
172   [% IF ( changed_nomatch_action ) %]
173       <div class="dialog message">Changed action if no match found</div>
174   [% END %]
175   [% IF ( changed_item_action ) %]
176       <div class="dialog message">Changed item processing option</div>
177   [% END %]
178
179 <fieldset class="rows" id="staged-record-matching-rules">
180   <ol>
181     <li><span class="label">File name:</span> [% file_name %]</li>
182     <li><span class="label">Comments:</span> [% IF ( comments ) %][% comments %][% ELSE %](none)[% END %]</li>
183     <li><span class="label">Type:</span> [% IF ( record_type == 'auth' ) %]Authority records[% ELSE %]Bibliographic records[% END %]</li>
184     <li><span class="label">Staged:</span> [% upload_timestamp %]</li>
185     <li><span class="label">Status:</span>
186       [% IF ( import_status == 'cleaned' ) %]
187          Cleaned
188       [% ELSIF ( import_status == 'imported' ) %]
189         Imported
190       [% ELSIF ( import_status == 'importing' ) %]
191         Importing
192       [% ELSIF ( import_status == 'reverted' ) %]
193          Reverted
194       [% ELSIF ( import_status == 'reverting' ) %]
195          Reverting
196       [% ELSIF ( import_status == 'staged' ) %]
197           Staged
198       [% ELSE %]
199           [% import_status %]
200       [% END %]
201       </li>
202     <li>
203 [% IF ( can_commit ) %]<label for="new_matcher_id">Matching rule applied:</label><select name="new_matcher_id" id="new_matcher_id">
204        <option value="">Do not look for matching records</option> 
205        [% FOREACH available_matcher IN available_matchers %]
206           [% IF ( available_matcher.selected ) %]
207           <option value="[% available_matcher.matcher_id %]" selected="selected">
208              [% available_matcher.code %] ([% available_matcher.description %])
209           </option>
210           [% ELSE %]
211           <option value="[% available_matcher.matcher_id %]">
212             [% available_matcher.code %] ([% available_matcher.description %])
213           </option>
214           [% END %]
215        [% END %]
216     </select> <span class="change-status">Changed. <a href="#" class="reset" id="reset_new_matcher_id">Reset</a></span>[% ELSE %]<span class="label">Matching rule applied</span>[% IF ( current_matcher_id ) %]
217   [% current_matcher_code %] ([% current_matcher_description %])
218 [% ELSE %]
219   No matching rule in effect
220 [% END %][% END %]
221     </li>
222     <li>
223         [% IF ( can_commit ) %]
224             <label for="overlay_action">Action if matching record found:</label>
225             [% INCLUDE 'tools-overlay-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_overlay_action">Reset</a></span>
226         [% ELSE %]
227             <span class="label">Action if matching record found:</span>
228             [% IF ( overlay_action == 'replace' ) %]
229                 Replace existing record with incoming record
230             [% ELSIF ( overlay_action == 'create_new' ) %]
231                 Add incoming record
232             [% ELSIF ( overlay_action == 'ignore' ) %]
233                 Ignore incoming record (its items may still be processed)
234             [% ELSE %]
235                 [% overlay_action %]
236             [% END %]
237         [% END %]</li>
238      
239     <li>
240         [% IF ( can_commit ) %]
241             <label for="nomatch_action">Action if no match found:</label>
242             [% INCLUDE 'tools-nomatch-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_nomatch_action">Reset</a></span>
243         [% ELSE %]
244             <span class="label">Action if no match found:</span>
245             [% IF ( nomatch_action == 'create_new' ) %]
246                 Add incoming record
247             [% ELSIF ( nomatch_action == 'ignore' ) %]
248                 Ignore incoming record (its items may still be processed)
249             [% ELSE %]
250                 [% nomatch_action %]
251             [% END %]
252         [% END %]
253     </li>
254     
255     <li>
256         [% IF ( can_commit ) %]
257             <label for="item_action">Item processing:</label>
258             [% INCLUDE 'tools-item-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_item_action">Reset</a></span>
259         [% ELSE %]
260             <span class="label">Item processing:</span>
261             [% IF ( item_action == 'always_add' ) %]
262                 Always add items
263             [% ELSIF ( item_action == 'add_only_for_matches' ) %]
264                 Add items only if matching bib was found
265             [% ELSIF ( item_action == 'add_only_for_new' ) %]
266                 Add items only if no matching bib was found
267             [% ELSIF ( item_action == 'ignore' ) %]
268                 Ignore items
269             [% ELSE %]
270                 [% item_action %]
271             [% END %]
272         [% END %]
273     </li>
274   </ol>
275 [% IF ( can_commit ) %]<fieldset class="action"><input type="submit" value="Apply different matching rules" class="button" /></fieldset></form>[% END %]
276 </fieldset>
277
278
279 <div>
280   [% IF ( can_commit ) %]
281   <form action="[% script_name %]" method="post">
282     <input type="hidden" name="op" value="commit-batch" />
283     <input type="hidden" name="runinbackground" value="" />
284     <input type="hidden" name="completedJobID" value="" />
285     <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
286     <fieldset class="action">
287     <input type="submit" class="button" name="mainformsubmit" value="Import this batch into the catalog" onclick="return submitBackgroundJob(this.form);" />
288     <br/>
289     [% IF ( record_type != 'auth' ) %]
290     Add new bibliographic records into this framework:
291     <select name="framework" id="frameworks">
292       <option value="">Default</option>
293       [% FOREACH framework IN frameworks %]
294           <option value="[% framework.value %]">[% framework.label %]</option>
295       [% END %]
296     </select>
297     [% END %]
298     </fieldset>
299   </form>
300   <div id="jobpanel"><div id="jobstatus">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
301      <div id="jobfailed"></div></div>
302   [% END %]
303   [% IF ( can_revert ) %]
304   <form action="[% script_name %]" method="post">
305     <input type="hidden" name="op" value="revert-batch" />
306     <input type="hidden" name="runinbackground" value="" />
307     <input type="hidden" name="completedJobID" value="" />
308     <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
309     <fieldset class="action"><input type="submit" class="button" name="mainformsubmit" value="Undo import into catalog" onclick="return submitBackgroundJob(this.form);" /></fieldset>
310   </form>
311   <div id="jobpanel"><div id="jobstatus">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
312      <div id="jobfailed"></div></div>
313   [% END %]
314 </div>
315   [% IF ( did_commit ) %]
316   <div class="dialog message">Completed import of records</div>
317   <table>
318   <tr><td>Number of records added</td><td>[% num_added %]</td></tr>
319   <tr><td>Number of records updated</td><td>[% num_updated %]</td></tr>
320   <tr><td>Number of records ignored</td><td>[% num_ignored %]</td></tr>
321   <tr><td>Number of items added</td><td>[% num_items_added %]</td></tr>
322   <tr><td>Number of items replaced</td><td>[% num_items_replaced %]</td></tr>
323   <tr><td>Number of items ignored because of duplicate barcode</td><td>[% num_items_errored %]</td></tr>
324   </table>
325   [% END %]
326   [% IF ( did_revert ) %]
327   <div class="dialog message">Success: Import reversed</div>
328   <table>
329   <tr><td>Number of records deleted</td><td>[% num_deleted %]</td></tr>
330   <tr><td>Number of items deleted</td><td>[% num_items_deleted %]</td></tr>
331   <tr><td>Number of records not deleted due to items on loan</td><td>[% num_errors %]</td></tr>
332   <tr><td>Number of records changed back</td><td>[% num_reverted %]</td></tr>
333   <tr><td>Number of records ignored</td><td>[% num_ignored %]</td></tr>
334   </table>
335   [% END %]
336 [% END %]
337 <br style="clear:both;" />
338
339 [% IF ( batch_list ) %]
340   [% IF ( pages ) %]
341 <div class="pages">
342 Page 
343     [% FOREACH page IN pages %]
344       [% IF ( page.current_page ) %]
345       <span class="current">[% page.page_number %]</span>
346       [% ELSE %]
347       <a class="nav" href="[% page.script_name %]?offset=[% page.offset %]">[% page.page_number %]</a>
348       [% END %]
349     [% END %]
350 </div>
351   [% END %]
352 <table>
353   <tr>
354     <th>#</th>
355     <th>File name</th>
356     <th>Comments</th>
357     <th>Type</th>
358     <th>Status</th>
359     <th>Staged</th>
360     <th># Records</th>
361     <th># Items</th>
362     <th>Action</th>
363   </tr>
364   [% FOREACH batch_lis IN batch_list %]
365   [% UNLESS ( loop.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
366     <td>[% batch_lis.import_batch_id %]</td>
367     <td><a href="[% batch_lis.script_name %]?import_batch_id=[% batch_lis.import_batch_id %]">[% batch_lis.file_name %]</a></td>
368     <td>[% batch_lis.comments %]</td>
369     <td>[% IF ( batch_lis.record_type == 'auth' ) %]Authority[% ELSE %]Bibliographic[% END %]</td>
370     <td>
371       [% IF ( batch_lis.import_status == 'cleaned' ) %]
372          Cleaned
373       [% ELSIF ( batch_lis.import_status == 'imported' ) %]
374         Imported
375       [% ELSIF ( batch_lis.import_status == 'importing' ) %]
376         Importing
377       [% ELSIF ( batch_lis.import_status == 'reverted' ) %]
378          Reverted
379       [% ELSIF ( batch_lis.import_status == 'reverting' ) %]
380          Reverting
381       [% ELSIF ( batch_lis.import_status == 'staged' ) %]
382           Staged
383       [% ELSE %]
384           [% batch_lis.import_status %]
385       [% END %]
386     </td>
387     <td>[% batch_lis.upload_timestamp %]</td>
388     <td>[% batch_lis.num_records %]</td>
389     <td>[% batch_lis.num_items %][% IF ( batch_lis.num_items ) %] <a href="[% batch_lis.script_name %]?import_batch_id=[% batch_lis.import_batch_id %]&amp;op=create_labels">(Create label batch)</a>[% END %]</td>
390     <td>[% IF ( batch_lis.can_clean ) %]
391           <form method="post" action="[% batch_lis.script_name %]" name="clean_batch_[% batch_lis.import_batch_id %]" id="clean_batch_[% batch_lis.import_batch_id %]" >
392             <input type="hidden" name="import_batch_id" value="[% batch_lis.import_batch_id %]" />
393             <input type="hidden" name="op" value="clean-batch" />
394             <input type="submit" class="button" value="Clean" onclick="return confirm(MSG_CONFIRM_CLEAN);" />
395           </form>
396         [% END %]
397     </td>
398   </tr>
399   [% END %]
400 </table>
401   [% IF ( pages ) %]
402 <div class="pages">
403 Page 
404     [% FOREACH page IN pages %]
405       [% IF ( page.current_page ) %]
406       <span class="current">[% page.page_number %]</span>
407       [% ELSE %]
408       <a class="nav" href="[% page.script_name %]?offset=[% page.offset %]">[% page.page_number %]</a>
409       [% END %]
410     [% END %]
411 </div>
412   [% END %]
413 [% END %]
414
415 <table id="records-table">
416     <thead>
417         <tr>
418             <th>#</th>
419             <th>Citation</th>
420             <th>Status</th>
421             <th>Match type</th>
422             <th>Match details</th>
423             <th>Record</th>
424         </tr>
425     </thead>
426 </table>
427
428 </div>
429 </div>
430 <div class="yui-b">
431 [% INCLUDE 'tools-menu.inc' %]
432 </div>
433 </div>
434 [% INCLUDE 'intranet-bottom.inc' %]