Bug 27109: Remove Replay action - not implemented
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / background_jobs.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% SET footerjs = 1 %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha &rsaquo; Administration &rsaquo; [% IF op =='add_form' %]Background jobs&rsaquo; [% IF job %] View background job[% ELSE %] Background jobs[% END %][% END %]</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 </head>
8
9 <body id="admin_background_jobs" class="admin">
10 [% INCLUDE 'header.inc' %]
11
12 <div id="breadcrumbs">
13     <a href="/cgi-bin/koha/mainpage.pl">Home</a>
14     &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
15     [% IF CAN_user_parameters_manage_background_jobs %]&rsaquo; <a href="/cgi-bin/koha/admin/background_jobs.pl">Background jobs</a>[% END %]
16 </div>
17
18 <div class="main container-fluid">
19     <div class="row">
20         <div class="col-sm-10 col-sm-push-2">
21             <main>
22
23 [% FOR m IN messages %]
24     <div class="dialog message">
25         [% SWITCH m.code %]
26         [% CASE 'cannot_view_job' %]
27             <div><i class="fa fa-exclamation error"></i>Insufficient permission to see this job.</div>
28         [% CASE %]
29             [% m.code | html %]
30         [% END %]
31     </div>
32 [% END %]
33
34 [% IF op == 'view' %]
35     <h1>Detail of job #[% job.id | html %]</h1>
36
37     <fieldset class="rows">
38         <ol>
39             <li><span class="label">Job ID: </span>[% job.id | html %]</li>
40             <li><label for="job_status">Status: </label>[% job.status | html %]</li>
41             <li><label for="job_progress">Progress: </label>[% job.progress || 0 | html %] / [% job.size | html %]</li>
42             <li><label for="job_type">Type: </label>[% job.type | html %]</li>
43             <li><label for="job_enqueued_on">enqueued_on: </label>[% job.enqueued_on | html %]</li>
44             <li><label for="job_started_on">started_on: </label>[% job.started_on | html %]</li>
45             <li><label for="job_ended_on">ended_on: </label>[% job.ended_on | html %]</li>
46             <li><label for="job_data">Report: </label>
47                 [% SWITCH job.type %]
48                 [% CASE 'batch_biblio_record_modification' %]
49                     [% SET report = job.report %]
50                     [% IF report %]
51                         [% IF report.total_records == report.total_success %]
52                             <div class="dialog message">
53                                 All records have successfully been modified! <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>
54                                 [% IF lists.count %]
55                                     <br />
56                                     Add modified records to the following list:
57                                     <select name="add_bibs_to_list" id="add_bibs_to_list">
58                                         <option value="">Select a list</option>
59                                         [% FOREACH list IN lists %]
60                                             <option class="shelf" value="[% list.shelfnumber | html %]">[% list.shelfname | html %]</option>
61                                         [% END %]
62                                     </select>
63                                 [% END %]
64                             </div>
65                         [% ELSE %]
66                             <div class="dialog message">
67                                 [% report.total_success | html %] / [% report.total_records | html %] records have successfully been modified. Some errors occurred.
68                                 [% IF job.status == 'cancelled' %]The job has been cancelled before it finished.[% END %]
69                                 <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>
70                             </div>
71                         [% END %]
72                     [% END %]
73                 [% CASE 'batch_authority_record_modification' %]
74                     [% SET report = job.report %]
75                     [% IF report %]
76                         [% IF report.total_records == report.total_success %]
77                             <div class="dialog message">
78                                 All records have successfully been modified! <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>
79                             </div>
80                         [% ELSE %]
81                             <div class="dialog message">
82                                 [% report.total_success | html %] / [% report.total_records | html %] records have successfully been modified. Some errors occurred.
83                                 [% IF job.status == 'cancelled' %]The job has been cancelled before it finished.[% END %]
84                                 <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>
85                             </div>
86                         [% END %]
87                     [% END %]
88                 [% CASE %]Job type "[% job.type | html %]" not handled in the template
89                 [% END %]
90             </li>
91             <li><label for="job_data">Detailed messages: </label>
92                 [% SWITCH job.type %]
93                 [% CASE 'batch_biblio_record_modification' %]
94                     [% FOR m IN job.messages %]
95                         <div class="dialog message">
96                             [% IF m.type == 'success' %]
97                                 <i class="fa fa-check success"></i>
98                             [% ELSIF m.type == 'warning' %]
99                                 <i class="fa fa-warning warn"></i>
100                             [% ELSIF m.type == 'error' %]
101                                 <i class="fa fa-exclamation error"></i>
102                             [% END %]
103                             [% SWITCH m.code %]
104                             [% CASE 'biblio_not_modified' %]
105                                 Bibliographic record <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% m.biblionumber | uri %]">[% m.biblionumber | html %]</a> has not been modified. An error occurred on modifying it.[% IF m.error %] ([% m.error | html %])[% END %].
106                             [% CASE 'biblio_modified' %]
107                                 Bibliographic record <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% m.biblionumber | uri %]">[% m.biblionumber | html %]</a> has successfully been modified.
108                             [% END %]
109                         </div>
110                     [% END %]
111                 [% CASE 'batch_authority_record_modification' %]
112                     [% FOR m IN job.messages %]
113                         <div class="dialog message">
114                             [% IF m.type == 'success' %]
115                                 <i class="fa fa-check success"></i>
116                             [% ELSIF m.type == 'warning' %]
117                                 <i class="fa fa-warning warn"></i>
118                             [% ELSIF m.type == 'error' %]
119                                 <i class="fa fa-exclamation error"></i>
120                             [% END %]
121                             [% SWITCH m.code %]
122                             [% CASE 'authority_not_modified' %]
123                                 Authority record <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% m.authid | uri %]">[% m.authid | html %]</a> has not been modified. An error occurred on modifying it[% IF m.error %] ([% m.error | html %])[% END %].
124                             [% CASE 'authority_modified' %]
125                                 Authority record <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% m.authid | uri %]">[% m.authid | html %]</a> has successfully been modified..
126                             [% END %]
127                         </div>
128                     [% END %]
129                 [% CASE %]Job type "[% job.type | html %]" not handled in the template
130                 [% END %]
131             </li>
132         </ol>
133     </fieldset>
134
135     [% IF CAN_user_parameters_manage_background_jobs %]
136         <a href="/cgi-bin/koha/admin/background_jobs.pl">Return to the job list</a>
137     [% END %]
138 [% END %]
139
140 [% IF op == 'list' %]
141
142     <h2>Background jobs</h2>
143
144     [% IF jobs.count %]
145         <table id="table_background_jobs">
146             <thead>
147                 <tr>
148                     <th>Job ID</th>
149                     <th>Status</th>
150                     <th>Progress</th>
151                     <th>Type</th>
152                     <th>Enqueued on</th>
153                     <th>Started on</th>
154                     <th>Ended on</th>
155                     <th>Actions</th>
156                 </tr>
157             </thead>
158             <tbody>
159                 [% FOREACH job IN jobs %]
160                 <tr>
161                     <td>[% job.id | html %]</td>
162                     <td>[% job.status | html %]</td>
163                     <td>[% job.progress || 0 | html %] / [% job.size | html %]</td>
164                     <td>
165                         [% SWITCH job.type %]
166                         [% CASE 'batch_biblio_record_modification' %]Batch bibliographic record modification
167                         [% CASE 'batch_authority_record_modification' %]Batch authority record modification
168                         [% CASE %][% job.type | html %]
169                         [% END %]
170                     </td>
171                     <td>[% job.enqueued_on | html %]</td>
172                     <td>[% job.started_on| html %]</td>
173                     <td>[% job.ended_on| html %]</td>
174                     <td class="actions">
175                         <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/background_jobs.pl?op=view&amp;id=[% job.id | html %]"><i class="fa fa-eye"></i> View</a>
176                         [% IF job.status == 'new' || job.status == 'started' %]
177                             <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/background_jobs.pl?op=cancel&amp;id=[% job.id | html %]"><i class="fa fa-trash"></i> Cancel</a>
178                         [% END %]
179                     </td>
180                 </tr>
181                 [% END %]
182             </tbody>
183         </table>
184     [% ELSE %]
185         <div class="dialog message">
186             There are no background jobs yet.
187         </div>
188     [% END %]
189 [% END %]
190
191             </main>
192         </div> <!-- /.col-sm-10.col-sm-push-2 -->
193
194         <div class="col-sm-2 col-sm-pull-10">
195             <aside>
196                 [% INCLUDE 'admin-menu.inc' %]
197             </aside>
198         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
199      </div> <!-- /.row -->
200
201 [% MACRO jsinclude BLOCK %]
202     [% Asset.js("js/admin-menu.js") | $raw %]
203     [% INCLUDE 'datatables.inc' %]
204     <script>
205         $(document).ready(function() {
206             $("#table_background_jobs").dataTable($.extend(true, {}, dataTablesDefaults, {
207                 "aoColumnDefs": [
208                     { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
209                 ],
210                 "aaSorting": [[ 0, "desc" ]],
211                 "iDisplayLength": 10,
212                 "sPaginationType": "full_numbers"
213             }));
214
215             $("#add_bibs_to_list").change(function(){
216                 var selected = $("#add_bibs_to_list").find("option:selected");
217                 if ( selected.attr("class") == "shelf" ){
218                     var shelfnumber = selected.attr("value");
219                     var bibs = new Array();
220                     [% FOREACH message IN job.messages %]
221                         [% IF message.code == 'biblio_modified' %]
222                             bibs.push("biblionumber="+[% message.biblionumber | html %]);
223                         [% END %]
224                     [% END %]
225                     var bibstring = bibs.join("&");
226                     window.open('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?shelfnumber='+shelfnumber+'&confirm=1&'+bibstring, 'popup', 'width=500,height=500,toolbar=false,scrollbars=yes,resizable=yes');
227                     return false;
228                 }
229             });
230         });
231     </script>
232 [% END %]
233 [% INCLUDE 'intranet-bottom.inc' %]