Bug 11395: Fix path for the checkboxes jQuery plugin
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / batch_record_modification.tt
1 [% PROCESS 'authorities-search-results.inc' %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha &rsaquo; Tools &rsaquo; Batch record modification</title>
4 [% INCLUDE 'doc-head-close.inc' %]
5 [% INCLUDE 'greybox.inc' %]
6 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
7 [% INCLUDE 'datatables.inc' %]
8 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
9 <script type="text/javascript" src="[% themelang %]/js/background-job-progressbar.js"></script>
10 <script type="text/javascript">
11 //<![CDATA[
12 $(document).ready(function() {
13   $("#selectall").click(function(e){
14     e.preventDefault();
15     $(".records").checkCheckboxes();
16   });
17   $("#clearall").click(function(e){
18     e.preventDefault();
19     $(".records").unCheckCheckboxes();
20   });
21   $("#selectall").click();
22
23   $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
24     "aoColumnDefs": [
25       { "aTargets": [ 0, 3 ], "bSortable": false, "bSearchable": false },
26       { "aTargets": [ 1 ], "sType": "num-html" }
27     ],
28     "sDom": 't',
29     "aaSorting": [],
30     "bPaginate": false
31   }));
32
33   $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
34     "aoColumnDefs": [
35       { "aTargets": [ 0, 3 ], "bSortable": false, "bSearchable": false },
36       { "aTargets": [ 1 ], "sType": "num-html" }
37     ],
38     "sDom": 't',
39     "aaSorting": [],
40     "bPaginate": false
41   }));
42
43   $("#mainformsubmit").click(function(){
44     if ( $("#marc_modification_template_id").val() > 0 ) {
45       return submitBackgroundJob(document.getElementById("process"));
46     }
47     alert(_("Please select a modification template."));
48     return false;
49   });
50
51   $("#marc_modification_template_id").change(function(){
52     var url = "/cgi-bin/koha/svc/records/preview?"
53     var mmtid = $(this).val();
54     $("a.preview").each(function(){
55       $(this).attr("href", url + "record_type=" + $(this).attr("data-record_type") + "&record_id=" + $(this).attr("data-record_id") + "&mmtid=" + mmtid);
56     });
57   });
58
59   $("a.preview").click(function(){
60     // Equivalent to rel="gb_page_center[600,500]"
61     return GB_showCenter(_("Preview MARC"), this.href , 600, 500);
62   });
63
64 });
65 //]]>
66 </script>
67 </head>
68 <body id="tools_batch_record_modification" class="tools">
69 [% INCLUDE 'header.inc' %]
70 [% INCLUDE 'cat-search.inc' %]
71
72 <div id="breadcrumbs">
73     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
74     <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
75     <a href="/cgi-bin/koha/tools/batch_record_modification.pl">Batch record modification</a>
76 </div>
77
78 <div id="doc3" class="yui-t2">
79 <div id="bd">
80 <div id="yui-main">
81 <div class="yui-b">
82   <h1>Batch record modification</h1>
83   [% FOREACH message IN messages %]
84     [% IF message.type == 'success' %]
85       <div class="dialog message">
86     [% ELSIF message.type == 'warning' %]
87       <div class="dialog alert">
88     [% ELSIF message.type == 'error' %]
89       <div class="dialog error" style="margin:auto;">
90     [% END %]
91                   <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber %]">[% biblio.title %]</a></td>
92     [% IF message.code == 'no_action_defined_for_the_template' %]
93       The selected template (id=[% message.mmtid%]) does not exist or no action is defined.
94     [% ELSIF message.code == 'biblio_not_exists' %]
95       The biblionumber [% message.biblionumber %] does not exist in the database.
96     [% ELSIF message.code == 'authority_not_exists' %]
97       The authority id [% message.authid %] does not exist in the database.
98     [% ELSIF message.code == 'biblio_not_modified' %]
99       The biblio <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% message.biblionumber %]">[% message.biblionumber %]</a> has not been modified. An error occurred on modifying it.
100     [% ELSIF message.code == 'authority_not_modified' %]
101       The authority <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% message.authid %]">[% message.authid %]</a> has not been modified. An error occurred on modifying it.
102     [% ELSIF message.code == 'biblio_modified' %]
103       The biblio <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% message.biblionumber %]">[% message.biblionumber %]</a> has successfully been modified.
104     [% ELSIF message.code == 'authority_modified' %]
105       The authority <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% message.authid %]">[% message.authid %]</a> has successfully been modified.
106     [% END %]
107     [% IF message.error %]
108       (The error was: [% message.error%], see the Koha logfile for more information).
109     [% END %]
110     </div>
111   [% END %]
112   [% IF view == 'form' %]
113     <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_record_modification.pl">
114       <fieldset class="rows">
115         <legend>Record type</legend>
116         <ol>
117           <li><label for="biblio_type">Biblios: </label><input type="radio" name="recordtype" value="biblio" id="biblio_type" checked="checked" /></li>
118           <li><label for="authority_type">Authorities: </label><input type="radio" name="recordtype" value="authority" id="authority_type" /></li>
119         </ol>
120       </fieldset>
121       <fieldset class="rows">
122         <legend>Use a file</legend>
123         <ol>
124           <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
125         </ol>
126       </fieldset>
127       <fieldset class="rows">
128         <legend>Or enter a list of record numbers</legend>
129         <ol>
130           <li>
131             <label for="recordnumber_list">Record number list (one per line): </label>
132             <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
133           </li>
134         </ol>
135       </fieldset>
136       <fieldset class="rows">
137         <legend>Use MARC Modification Template:</legend>
138         <ol>
139           <li>
140             <label for="marc_modification_template_id" class="required">Modify record using the following template: </label>
141             <select name="marc_modification_template_id" id="marc_modification_template_id" required="required">
142               <option value="">Select a template</option>
143                 [% FOREACH mmt IN MarcModificationTemplatesLoop %]
144                   <option value="[% mmt.template_id %]">[% mmt.name %]</option>
145                 [% END %]
146             </select>
147           </li>
148         </ol>
149       </fieldset>
150       <fieldset class="action">
151         <input type="hidden" name="op" value="list" />
152         <input type="submit" value="Continue" class="button" />
153         <a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
154       </fieldset>
155     </form>
156   [% ELSIF view == 'list' %]
157     [% IF records %]
158       <form action="/cgi-bin/koha/tools/batch_record_modification.pl" method="post" id="process">
159         <label for="marc_modification_template_id" class="required">Modify record using the following template: </label>
160         <select name="marc_modification_template_id" id="marc_modification_template_id" required="required">
161           <option value="">Select a template</option>
162           [% FOREACH mmt IN MarcModificationTemplatesLoop %]
163             [% IF mmt.selected %]
164               <option value="[% mmt.template_id %]" selected="selected">[% mmt.name %]</option>
165             [% ELSE %]
166               <option value="[% mmt.template_id %]">[% mmt.name %]</option>
167             [% END %]
168           [% END %]
169         </select>
170         [% IF recordtype == 'biblio' %]
171           <div id="toolbar">
172             <a id="selectall" href="#">Select all</a>
173             | <a id="clearall" href="#">Clear all</a>
174           </div>
175           <table id="biblios" class="records">
176             <thead>
177               <tr>
178                 <th></th>
179                 <th>Biblionumber</th>
180                 <th>Title</th>
181                 <th>Preview</th>
182               </tr>
183             </thead>
184             <tbody>
185               [% FOR biblio IN records %]
186                 <tr>
187                   <td><input type="checkbox" name="record_id" value="[% biblio.biblionumber %]" data-items="[% biblio.itemnumbers.size %]" data-issues="[% biblio.issues_count %]" data-reserves="[% biblio.reserves.size %]" /></td>
188                   <td>[% biblio.biblionumber %]</td>
189                   <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber %]">[% biblio.title %]</a></td>
190                   <td><a href="/cgi-bin/koha/svc/records/preview?record_type=biblio&record_id=[% biblio.biblionumber %]&mmtid=[% mmtid %]" class="preview" data-record_type="biblio" data-record_id="[% biblio.biblionumber %]" data-mmtid="[% mmtid %]" title="Preview MARC" >Preview MARC</a>
191                 </tr>
192               [% END %]
193             </tbody>
194           </table>
195           <div class="note">Reminder: this action will modify all selected biblios!</div>
196         [% ELSE %]
197           <div id="toolbar">
198             <a id="selectall" href="#">Select all</a>
199             | <a id="clearall" href="#">Clear all</a>
200           </div>
201           <table id="authorities" class="records">
202             <thead>
203               <tr>
204                 <th></th>
205                 <th>Authid</th>
206                 <th>Summary</th>
207                 <th>Preview</th>
208               </tr>
209             </thead>
210             <tbody>
211               [% FOR authority IN records %]
212                 <tr>
213                   <td><input type="checkbox" name="record_id" value="[% authority.authid %]" data-usage="[% authority.count_usage %]" /></td>
214                   <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid %]">[% authority.authid %]</a></td>
215                   <td>[% PROCESS authresult summary=authority.summary %]</td>
216                   <td><a href="/cgi-bin/koha/svc/records/preview?record_type=authority&record_id=[% authority.authid %]&mmtid=[% mmtid %]" class="preview" data-record_type="authority" data-record_id="[% authority.authid %]" data-mmtid="[% mmtid %]" title="Preview MARC" rel="gb_page_center[600,500]">Preview MARC</a>
217                 </tr>
218               [% END %]
219             </tbody>
220           </table>
221           <div class="note">Reminder: this action will modify all selected authorities!</div>
222         [% END %]
223         <fieldset class="action">
224           <input type="hidden" name="op" value="modify" />
225           <input type="hidden" name="recordtype" value="[% recordtype %]" />
226           <input type="button" id="mainformsubmit" value="Modify selected records" class="button" />
227           <input type="hidden" name="runinbackground" id="runinbackground" value="" />
228           <input type="hidden" name="completedJobID" id="completedJobID" value="" />
229           <a class="cancel" href="/cgi-bin/koha/tools/batch_record_modification.pl">Cancel</a>
230         </fieldset>
231         <div id="jobpanel">
232           <div id="jobstatus">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
233           <div id="jobfailed"></div>
234         </div>
235       </form>
236     [% ELSE %]
237       There is no record ids defined.
238     [% END %]
239   [% ELSIF view == 'report' %]
240     [% IF report.total_records == report.total_success %]
241       All records have successfully been modified!
242     [% ELSE %]
243       [% report.total_success %] / [% report.total_records %] records have successfully been modified.
244       Some errors occurred.
245     [% END %]
246     <p><a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a></p>
247   [% ELSIF view == 'errors' %]
248     [% FOR error IN errors %]
249       [% IF error == 'no_template_defined' %]
250         No MARC modification template is defined. You have <a href="/cgi-bin/koha/tools/marc_modification_templates.pl">to create</a> at least one template for using this tool.
251       [% END %]
252     [% END %]
253   [% ELSE %]
254     No action defined for the template.
255   [% END %]
256 </div>
257 </div>
258 <div class="yui-b">
259   [% INCLUDE 'tools-menu.inc' %]
260 </div>
261 </div>
262 [% INCLUDE 'intranet-bottom.inc' %]