Bug 34773: (follow-up) Missed templates
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / upload-images.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% PROCESS 'i18n.inc' %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>[% FILTER collapse %]
7     [% IF ( biblio ) %]
8         [% t("Upload local cover image for ") | html %] [% INCLUDE 'biblio-title-head.inc' %] &rsaquo;
9     [% END %]
10     [% t("Upload local cover image") | html %] &rsaquo;
11     [% t("Cataloging") | html %] &rsaquo;
12     [% t("Koha") | html %]
13 [% END %]</title>
14 [% INCLUDE 'doc-head-close.inc' %]
15 [% FILTER collapse %]
16     <style>
17         #fileuploadstatus,
18         #fileuploadfailed,
19         #jobpanel,
20         #jobstatus,
21         #jobfailed,
22         #fileuploadform,
23         #upload_file_type,
24         #upload_options,
25         #process_images {
26             display: none;
27         }
28         #uploadpanel {
29             clear:both;
30             margin-top: .9em;
31         }
32         #filedrag {
33             background-color: #FFF;
34             outline: 2px dashed #92b0b3;
35             outline-offset: -10px;
36             font-weight: bold;
37             font-size: 130%;
38             text-align: center;
39             position: relative;
40             padding: 50px 20px;
41             margin: 1em;
42
43             cursor: default;
44         }
45
46         #click_to_select:hover {
47             color: #538200;
48             cursor: pointer;
49         }
50
51         #filedrag.hover {
52             outline-offset: -20px;
53             outline-color: #c8dadf;
54             background-color: #fff;
55         }
56
57         #messages {
58             font-weight: normal;
59         }
60         .cover_preview {
61             margin:1em;
62             max-height:200px;
63             max-width:200px;
64         }
65         .progress_panel {
66             border: 0;
67             border-radius: 0;
68             margin: .9em;
69             background-color: #FFF;
70         }
71         .fa-file-zipper {
72             color: #777;
73             font-size: 300%
74         }
75     </style>
76 [% END %]
77 </head>
78
79 <body id="tools_upload-images" class="tools">
80 [% WRAPPER 'header.inc' %]
81     [% INCLUDE 'cat-search.inc' %]
82 [% END %]
83
84 [% WRAPPER 'sub-header.inc' %]
85     [% WRAPPER breadcrumbs %]
86         [% WRAPPER breadcrumb_item %]
87             <a href="/cgi-bin/koha/cataloguing/cataloging-home.pl">Cataloging</a>
88         [% END %]
89         [% IF uploadimage || biblio || itemnumber || biblionumber %]
90             [% WRAPPER breadcrumb_item %]
91                 <a href="/cgi-bin/koha/tools/upload-cover-image.pl">Upload local cover image</a>
92             [% END %]
93         [% END %]
94
95         [% IF ( uploadimage ) %]
96             [% WRAPPER breadcrumb_item bc_active= 1 %]
97                 <span>Upload results</span>
98             [% END %]
99             [% IF ( biblionumber ) %]
100                 [% WRAPPER breadcrumb_item bc_active= 1 %]
101                     <em>[% INCLUDE 'biblio-title.inc' %]</em>
102                 [% END %]
103             [% END %]
104         [% ELSIF biblio %]
105             [% WRAPPER breadcrumb_item bc_active= 1 %]
106                 <span>Upload cover for <em>[% INCLUDE 'biblio-title.inc' %]</em></span>
107             [% END %]
108         [% ELSIF itemnumber %]
109             [% WRAPPER breadcrumb_item bc_active= 1 %]
110                 <span>Upload cover for itemnumber: [% itemnumber | html %]</span>
111             [% END %]
112         [% ELSIF biblionumber %]
113             [% WRAPPER breadcrumb_item bc_active= 1 %]
114                 <span>Upload cover for biblionumber: [% biblionumber | html %]</span>
115             [% END %]
116         [% ELSE %]
117             [% WRAPPER breadcrumb_item bc_active= 1 %]
118                 <span>Upload local cover image</span>
119             [% END %]
120         [% END %]
121     [% END #/ WRAPPER breadcrumbs %]
122 [% END #/ WRAPPER sub-header.inc %]
123
124 <div class="main container-fluid">
125     <div class="row">
126         <div class="col-sm-10 col-sm-push-2">
127             <main>
128
129                 [% UNLESS itemnumber || biblionumber %]
130                     <h1>Upload local cover image</h1>
131                 [% ELSIF biblio %]
132                     <h1>
133                         Upload local cover image for <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]"><em>[% INCLUDE 'biblio-title.inc' %]</em></a>
134                         [% IF ( itemnumber ) %],  Item number: [% itemnumber | html %][% END %]
135                     </h1>
136                 [% ELSIF itemnumber %]
137                     <h1>Upload local cover image for item number: [% itemnumber | html %]</h1>
138                 [% END %]
139
140                 [% IF ( uploadimage ) %]
141                     <h2>Image upload results :</h2>
142                     <div id="upload_results">
143                         [% IF ( error ) %]
144                             <div class="dialog alert">
145                                 [% IF ( error == 'UZIPFAIL' ) %]
146                                     <p><strong>Failed to unzip archive.<br />Please ensure you are uploading a valid zip file and try again.</strong></p>
147                                 [% ELSIF ( error == 'OPNLINK' ) %]
148                                     <p><strong>Cannot open folder index (idlink.txt or datalink.txt) to read.<br />Please verify that it exists.</strong></p>
149                                 [% ELSIF ( error == 'OPNIMG' ) %]
150                                     <p><strong>Cannot process file as an image.<br />Please ensure you only upload GIF, JPEG, PNG, or XPM images.</strong></p>
151                                 [% ELSIF ( error == 'DELERR' ) %]
152                                     <p><strong>Unrecognized or missing field delimiter.<br />Please verify that you are using either a single quote or a tab.</strong></p>
153                                 [% ELSIF ( error == 'DBERR' ) %]
154                                     <p><strong>Unable to save image to database.</strong></p>
155                                 [% ELSE %]
156                                     <p><strong>An unknown error has occurred.<br />Please review the error log for more details.</strong></p>
157                                 [% END %]
158                             </div>
159                         [% END # /IF error  %]
160                         <h3>[% total | html %] images found</h3>
161                         <ul>
162                             [% FOREACH result IN results %]
163                                 <li><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% result.biblionumber | uri %]">[% result.title | html %]</a></li>
164                             [% END %]
165                         </ul>
166                         <hr />
167                     </div> <!-- /#upload_results -->
168                 [% END # /IF uploadimage %]
169
170                 <ul>
171                     [% UNLESS itemnumber || biblionumber %]
172                         <li>Select an image file or ZIP file to upload. The tool will accept images in GIF, JPEG, PNG, and XPM formats.</li>
173                     [% ELSE %]
174                         <li>Select an image file to upload. The tool will accept images in GIF, JPEG, PNG, and XPM formats.</li>
175                     [% END %]
176                 </ul>
177
178                 <div class="row">
179                     [% IF ( cover_images ) %]
180                         <div class="col-sm-9">
181                     [% ELSE %]
182                         <div class="col-sm-12">
183                     [% END %]
184
185                         <form method="post" action="/cgi-bin/koha/tools/upload-cover-image.pl" id="uploadfile" enctype="multipart/form-data">
186                             <fieldset class="rows" >
187                                 <div id="fileuploadform">
188                                     <label for="fileToUpload">Select the file to upload: </label>
189                                     <input type="file" id="fileToUpload" name="fileToUpload" />
190                                 </div>
191
192                                 <div id="filedrag">
193                                     <a id="click_to_select" href="#">Drop files here or click to select a file</a>
194                                     <div id="messages"></div>
195                                 </div>
196
197                                 <div id="uploadpanel">
198                                     <div id="fileuploadstatus" class="progress_panel">Upload progress:
199                                         <progress max="100" value="0" id="fileuploadprogress">
200                                         </progress>
201                                         <span class="fileuploadpercent">0</span>%
202                                     </div>
203                                     <div id="fileuploadfailed"></div>
204                                 </div>
205                             </fieldset>
206                         </form> <!-- /#uploadfile -->
207
208                         <form method="post" id="processfile" action="/cgi-bin/koha/tools/upload-cover-image.pl" enctype="multipart/form-data">
209                             <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
210
211                             [% IF itemnumber %]
212                                 <input type="hidden" id="itemnumber" name="itemnumber" value="[% itemnumber | html %]" />
213                                 <input type="hidden" name="filetype" value="image" />
214                             [% ELSIF biblionumber %]
215                                 <input type="hidden" id="biblionumber" name="biblionumber" value="[% biblionumber | html %]" />
216                                 <input type="hidden" name="filetype" value="image" />
217                             [% END %]
218
219
220                             <fieldset id="upload_options" class="rows">
221                                 <ol>
222                                     [% UNLESS itemnumber || biblionumber %]
223                                         <li class="radio">
224                                             [% IF (filetype != 'image' ) %]
225                                                 <input type="radio" id="zipfile" name="filetype" value="zip" checked="checked" />
226                                             [% ELSE %]
227                                                 <input type="radio" id="zipfile" name="filetype" value="zip" />
228                                             [% END %]
229                                             <label for="zipfile">ZIP file</label>
230                                         </li>
231                                         <li class="radio">
232                                             [% IF (filetype == 'image' ) %]
233                                                 <input type="radio" id="image" name="filetype" value="image" checked="checked" />
234                                             [% ELSE %]
235                                                 <input type="radio" id="image" name="filetype" value="image" />
236                                             [% END %]
237                                             <label for="image">Image file</label>
238                                         </li>
239                                         <li id="biblionumber_entry">
240                                             <label for="biblionumber">Bibliographic record number: </label>
241                                             <input type="text" id="biblionumber" name="biblionumber" value="[% biblionumber | html %]" size="15" />
242                                         </li>
243                                     [% END %]
244                                     <li class="radio">
245                                         <label for="replace">
246                                         [% IF AllowMultipleCovers == 0 %]
247                                             <input type="checkbox" id="replace" name="replace" value="" disabled="disabled" checked="checked" />
248                                             Existing covers will be replaced
249                                         [% ELSE %]
250                                             <input type="checkbox" id="replace" name="replace" value="1" />
251                                             Replace existing covers
252                                         [% END %]
253                                     </li>
254                                 </ol>
255                             </fieldset>
256
257                             <fieldset id="process_images" class="action">
258                                 <button type="submit" class="btn btn-primary btn-sm save_image">Process images</button>
259                                 [% IF ( biblionumber ) %]
260                                     <a class="cancel cancel_image" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]">Cancel</a>
261                                 [% ELSE %]
262                                     <a class="cancel cancel_image" href="/cgi-bin/koha/tools/upload-cover-image.pl">Cancel</a>
263                                 [% END %]
264                             </fieldset>
265                         </form> <!-- /#processfile -->
266                     </div> <!-- /.col-sm-9/.col-sm-12 -->
267
268                     [% IF ( cover_images.size ) %]
269                         <div class="col-sm-3">
270                             <h3>Existing images</h3>
271                             <ul class="thumbnails">
272                                 [% FOREACH img IN cover_images %]
273                                     [% IF img %]
274                                         <li id="imagenumber-[% img.imagenumber | html %]" class="thumbnail">
275                                             <a class="show_cover" data-coverimg="[% img.imagenumber | html %]" href="/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=[% biblionumber | html %]&amp;imagenumber=[% img.imagenumber | html %]">
276                                                 [% IF ( imagenumber == img.imagenumber ) %]
277                                                     <img class="selected" id="thumbnail_[% img.imagenumber | html %]" src="/cgi-bin/koha/catalogue/image.pl?imagenumber=[% img.imagenumber | html %]&amp;thumbnail=1" alt="Thumbnail" />
278                                                 [% ELSE %]
279                                                     <img id="thumbnail_[% img.imagenumber | html %]" src="/cgi-bin/koha/catalogue/image.pl?imagenumber=[% img.imagenumber | html %]&amp;thumbnail=1" alt="Thumbnail" />
280                                                 [% END %]
281                                             </a>
282                                             <a href="#" class="remove" data-coverimg="[% img.imagenumber | html %]"><i class="fa fa-trash-can"></i> Delete image</a>
283                                         </li>
284                                     [% END # /IF img %]
285                                 [% END # /FOREACH img %]
286                             </ul> <!-- /ul.thumbnails -->
287                         </div> <!-- /.col-sm-3 -->
288                     [% END # /IF images.size %]
289
290                 </div> <!-- /.row -->
291             </main>
292         </div> <!-- /.col-sm-10.col-sm-push-2 -->
293
294         <div class="col-sm-2 col-sm-pull-10">
295             <aside>
296                 [% INCLUDE 'cat-menu.inc' %]
297             </aside>
298         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
299      </div> <!-- /.row -->
300
301 [% MACRO jsinclude BLOCK %]
302     <script>
303         var interface = "[% interface | html %]";
304         var theme = "[% theme | html %]";
305         var biblionumber = "[% biblionumber | html %]";
306     </script>
307     [% Asset.js("js/upload-images.js") | $raw %]
308
309     </script>
310 [% END %]
311
312 [% INCLUDE 'intranet-bottom.inc' %]