Bug 11734 - Use new DataTables include in batch modification templates
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / batchMod-edit.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Tools &rsaquo; Batch item modification</title>
3 [% INCLUDE 'doc-head-close.inc' %]
4 <script type="text/javascript" src="[% themelang %]/js/background-job-progressbar.js"></script>
5 <script type="text/javascript" src="[% themelang %]/js/cataloging.js"></script>
6 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
7 [% INCLUDE 'datatables.inc' %]
8 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
9 <script type="text/javascript" src="[% themelang %]/js/pages/batchMod.js"></script>
10 <script type="text/javascript">
11 //<![CDATA[
12
13 // Prepare array of all column headers, incrementing each index by
14 // two to accomodate control and title columns
15 var allColumns = new Array([% FOREACH item_header_loo IN item_header_loop %]'[% loop.count %]'[% UNLESS ( loop.last ) %],[% END %][% END %]);
16 for( x=0; x<allColumns.length; x++ ){
17   allColumns[x] = Number(allColumns[x]) + 2;
18 }
19 $(document).ready(function(){
20
21   $("input[name='disable_input']").click(function() {
22       var row = $(this).attr("id");
23       row = row.replace("row","hint");
24       var subfield = $(this).next();
25       if ($(this).is(":checked")){
26           $(this).val($(this).siblings("[name='subfield']").val());
27           $(subfield).attr('disabled',true);
28           $("#"+row).html(_("This subfield will be deleted"));
29       } else {
30           $(subfield).removeAttr('disabled');
31           $("#"+row).html("");
32       }
33   });
34
35 });
36 //]]>
37 </script>
38 <!--[if IE]>
39 <style type="text/css">#selections { display: none; }</style>
40 <![endif]-->
41 <style type="text/css">input[type=checkbox]{ margin : 0 .5em; }</style>
42 <link type="text/css" rel="stylesheet" href="[% themelang %]/css/addbiblio.css" />
43 </head>
44 <body id="tools_batchMod-edit" class="tools">
45 [% INCLUDE 'header.inc' %]
46 [% INCLUDE 'cat-search.inc' %]
47
48 <div id="breadcrumbs">
49   <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
50   <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
51   <a href="/cgi-bin/koha/tools/batchMod.pl">Batch item modification</a>
52 </div>
53
54 <div id="doc3" class="yui-t7">
55     <div id="bd">
56         <div id="yui-main">
57             [% IF ( show ) %]
58               <h1>Batch item modification</h1>
59             [% ELSE %]
60               <h1>Batch item modification results</h1>
61               <div class="dialog message">
62               [% modified_items %] item(s) modified (with [% modified_fields %] fields modified)
63               </div>
64             [% END %]
65 [% IF ( barcode_not_unique ) %]<div class="dialog alert"><strong>Error saving item</strong>: Barcode must be unique.</div>[% END %]
66 [% IF ( no_next_barcode ) %]<div class="dialog alert"><strong>Error saving items</strong>: Unable to automatically determine values for barcodes. No item has been inserted.</div>[% END %]
67 [% IF ( book_on_loan ) %]<div class="dialog alert"><strong>Cannot Delete</strong>: item is checked out.</div>[% END %]
68 [% IF ( book_reserved ) %]<div class="dialogalert"><strong>Cannot Delete</strong>: item has a waiting hold.</div>[% END %]
69
70     [% IF ( notfoundbarcodes ) %]
71       <div class="dialog alert"><p>Warning, the following barcodes were not found:</p></div>
72       <table style="margin:auto;">
73     <thead>
74         <tr><th>Barcodes not found</th></tr>
75     </thead>
76     <tbody>
77         [% FOREACH notfoundbarcode IN notfoundbarcodes %]
78       <tr><td>[% notfoundbarcode.barcode %]</td></td>
79         [% END %]
80     </tbody>
81       </table>
82       [% IF ( item_loop ) %]
83           [% UNLESS ( too_many_items ) %]
84           <h4>The following barcodes were found: </h4>
85           [% END %]
86       [% END %]
87   [% END %] <!-- /notfoundbarcodes -->
88
89 <form name="f" action="batchMod.pl" method="post">
90      <input type="hidden" name="op" value="[% op %]" />
91      <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
92      <input type="hidden" name="runinbackground" id="runinbackground" value="" />
93      <input type="hidden" name="completedJobID" id="completedJobID" value="" />
94      <input type="hidden" name="src" id="src" value="[% src %]" />
95      [% IF biblionumber %]
96         <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblionumber %]" />
97      [% END %]
98
99 [% IF ( item_loop ) %]
100   [% IF show %]
101     <div id="toolbar">
102       <a id="selectallbutton" href="#">Select all</a> | <a id="clearallbutton" href="#">Clear all</a> | <a id="clearonloanbutton" href="#">Clear on loan</a>
103     </div>
104   [% END %]
105 <div id="cataloguing_additem_itemlist">
106
107 <p id="selections"><strong>Show/hide columns:</strong> <span class="selected"><input type="checkbox" checked="checked" id="showall"/><label for="showall">Show all columns</label></span> <span><input type="checkbox" id="hideall"/><label for="hideall">Hide all columns</label></span> 
108         [% FOREACH item_header_loo IN item_header_loop %]
109         <span class="selected"><input id="checkheader[% loop.count %]" type="checkbox" checked="checked" /> <label for="checkheader[% loop.count %]">[% item_header_loo.header_value %]</label> </span>
110         [% END %]
111 </p>
112         <table id="itemst">
113       <thead>
114     <tr>
115         <th>&nbsp;</th>
116         <th class="anti-the">Title</th>
117         [% FOREACH item_header_loo IN item_header_loop %]
118         <th> [% item_header_loo.header_value %] </th>
119         [% END %] 
120     </tr>
121       </thead>
122       <tbody>
123             [% FOREACH item_loo IN item_loop %]
124               <tr>
125                 [% IF show %]
126                   [% IF item_loo.nomod %]
127                     <td class="error">Cannot edit</td>
128                   [% ELSE %]
129                     <td><input type="checkbox" name="itemnumber" value="[% item_loo.itemnumber %]" id="row[% item_loo.itemnumber %]" checked="checked" data-is-onloan="[% item_loo.onloan %]" /></td>
130                   [% END %]
131                 [% ELSE %]
132                   <td>&nbsp;</td>
133                 [% END %]
134                 <td><label for="row[% item_loo.itemnumber %]"><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item_loo.biblionumber %]">[% item_loo.title %]</a>[% IF ( item_loo.author ) %], by [% item_loo.author %][% END %]</label></td>
135                 [% FOREACH item_valu IN item_loo.item_value %] <td>[% item_valu.field |html %]</td> 
136         [% END %] </tr>
137             [% END %]
138       </tbody>
139         </table>
140 </div>
141 [% END %]<!-- /item_loop -->
142
143 [% IF ( simple_items_display ) %]
144     <p>The following items were modified:</p>
145     <ul>
146     [% FOREACH simple_items_displa IN simple_items_display %]
147   <li>
148       [% IF ( CAN_user_editcatalogue_edit_items ) %]<a href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&amp;biblionumber=[% simple_items_displa.biblionumber %]&amp;itemnumber=[% simple_items_displa.itemnumber %]">[% simple_items_displa.barcode %]</a>[% ELSE %][% simple_items_displa.barcode %][% END %]
149   </li>
150     [% END %]
151     </ul>
152 [% END %]<!-- /simple_items_display -->
153
154 [% IF ( show ) %]
155
156 [% IF ( too_many_items ) %]
157     <p>Too many items ([% too_many_items %]): not displaying each one individually.</p>
158     [% FOREACH itemnumber IN itemnumbers_array %]
159   <input type="hidden" name="itemnumber" value="[% itemnumber %]" />
160     [% END %]
161 [% END %]<!-- /too_many_items -->
162
163 [% IF ( item_loop ) %]
164 <div id="cataloguing_additem_newitem">
165         <h2>Edit Items</h2>
166         <div class="hint">Checking the box right next the subfield label will disable the entry and delete the subfield on all selected items. Leave fields blank to make no change.</div>
167   <fieldset class="rows">
168   <ol>
169         [% FOREACH ite IN item %]
170                <li><div class="subfield_line" style="[% ite.visibility %]" id="subfield[% ite.tag %][% ite.subfield %][% ite.random %]">
171               [% IF ( ite.mandatory ) %]
172               <label class="required" for="tag_[% ite.tag %]_subfield_[% ite.subfield %]_[% ite.random %]">
173               [% ELSE %]
174               <label for="tag_[% ite.tag %]_subfield_[% ite.subfield %]_[% ite.random %]">
175               [% END %]
176               [% ite.subfield %] -
177           [% ite.marc_lib %]
178          </label>
179                 [% UNLESS ( ite.mandatory ) %]<input type="checkbox" id="row[% ite.tag %][% ite.subfield %][% ite.random %]" title="Check to delete subfield [% ite.subfield %]" name="disable_input" value="[% ite.subfield %]" />[% ELSE %]<span class="required">Required</span>[% END %]
180                 [% ite.marc_value %]
181                 <input type="hidden" name="tag"       value="[% ite.tag %]" />
182                 <input type="hidden" name="subfield"       value="[% ite.subfield %]" />
183                 <input type="hidden" name="mandatory"       value="[% ite.mandatory %]" />
184                 [% IF ( ite.repeatable ) %]
185                     <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode); return false;">
186                         <img src="[% interface %]/[% theme %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
187                     </a>
188                 [% END %]
189                 <span class="hint" id="hint[% ite.tag %][% ite.subfield %][% ite.random %]"></span>
190             </div></li>
191         [% END %]
192     </ol>
193     </fieldset>
194     <fieldset class="action">    
195    <div id="jobpanel">
196        <div id="jobstatus">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
197        <div id="jobfailed"></div>
198    </div>
199    <input type="submit" name="mainformsubmit" value="Save" onclick="return submitBackgroundJob(this.form);" />
200          <a href="/cgi-bin/koha/tools/batchMod.pl" class="cancel" onclick="history.back();return false;">Cancel</a>
201     </fieldset>
202 </div>
203 [% ELSE %]
204     <p><a href="/cgi-bin/koha/tools/batchMod.pl">Return to batch item modification</a></p>
205 [% END %]
206 [% ELSE %] <!-- // show -->
207 <fieldset class="action">
208 [% IF src == 'CATALOGUING' # from catalogue/detail.pl > Edit items in a batch%]
209    <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber %]">Done</a>
210 [% ELSIF src %]
211    <a href="[% src %]">Done</a>
212 [% ELSE %]
213    <a href="/cgi-bin/koha/tools/batchMod.pl">Done</a>
214 [% END %]
215 </fieldset>
216          
217 [% END %]
218 </div>
219     </div>
220 [% INCLUDE 'intranet-bottom.inc' %]