4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha › Tools › Upload images</title>
6 [% INCLUDE 'doc-head-close.inc' %]
8 #fileuploadstatus,#fileuploadfailed,#jobpanel,#jobstatus,#jobfailed { display : none; }
12 <body id="tools_upload-images" class="tools">
13 [% INCLUDE 'header.inc' %]
14 [% INCLUDE 'cat-search.inc' %]
16 <div id="breadcrumbs">
17 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
18 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
19 <a href="/cgi-bin/koha/tools/upload-cover-image.pl">Upload local cover image</a>
20 [% IF ( uploadimage ) %] › Upload results
21 [% ELSIF itemnumber %] › Upload cover for itemnumber: [% itemnumber | html %]
22 [% ELSIF biblionumber %] › Upload cover for biblionumber: [% biblionumber | html %]
26 <div class="main container-fluid">
28 <div class="col-sm-10 col-sm-push-2">
31 [% IF ( uploadimage ) %]
32 <h1>Image upload results :</h1>
34 <li>[% total | html %] images found</li>
37 <div class="dialog alert">
38 [% IF ( error == 'UZIPFAIL' ) %]
39 <p><strong>Failed to unzip archive.<br />Please ensure you are uploading a valid zip file and try again.</strong></p>
40 [% ELSIF ( error == 'OPNLINK' ) %]
41 <p><strong>Cannot open folder index (idlink.txt or datalink.txt) to read.<br />Please verify that it exists.</strong></p>
42 [% ELSIF ( error == 'OPNIMG' ) %]
43 <p><strong>Cannot process file as an image.<br />Please ensure you only upload GIF, JPEG, PNG, or XPM images.</strong></p>
44 [% ELSIF ( error == 'DELERR' ) %]
45 <p><strong>Unrecognized or missing field delimiter.<br />Please verify that you are using either a single quote or a tab.</strong></p>
46 [% ELSIF ( error == 'DBERR' ) %]
47 <p><strong>Unable to save image to database.</strong></p>
49 <p><strong>An unknown error has occurred.<br />Please review the error log for more details.</strong></p>
54 <li><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]">View final record</a></li>
55 <li><a href="/cgi-bin/koha/tools/tools-home.pl">Back</a></li>
58 [% END # /IF uploadimage %]
60 [% UNLESS itemnumber || biblionumber %]
61 <h1>Upload local cover image</h1>
62 [% ELSIF itemnumber %]
63 <h1>Upload local cover image for itemnumber: [% itemnumber | html %]</h1>
64 [% ELSIF biblionumber %]
65 <h1>Upload local cover image for biblionumber: [% biblionumber | html %]</h1>
69 [% UNLESS itemnumber || biblionumber %]
70 <li>Select an image file or ZIP file to upload. The tool will accept images in GIF, JPEG, PNG, and XPM formats.</li>
72 <li>Select an image file to upload. The tool will accept images in GIF, JPEG, PNG, and XPM formats.</li>
76 <form method="post" action="/cgi-bin/koha/tools/upload-cover-image.pl" id="uploadfile" enctype="multipart/form-data">
77 <fieldset class="rows" >
78 <legend>Upload images</legend>
81 <div id="fileuploadform">
82 <label for="fileToUpload" class="required">Select the file to upload: </label>
83 <input type="file" id="fileToUpload" name="fileToUpload" required="required" class="required" />
84 <span class="required">Required</span>
88 <fieldset class="action"><button class="submit btn btn-default">Upload file</button></fieldset>
91 <div id="uploadpanel">
92 <div id="fileuploadstatus" class="progress_panel">Upload progress:
93 <progress max="100" value="0" id="fileuploadprogress">
95 <span class="fileuploadpercent">0</span>%
97 <div id="fileuploadfailed"></div>
99 </form> <!-- /#uploadfile -->
101 <form method="post" id="processfile" action="/cgi-bin/koha/tools/upload-cover-image.pl" enctype="multipart/form-data">
102 <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
103 <input type="hidden" name="runinbackground" id="runinbackground" value="" />
104 <input type="hidden" name="completedJobID" id="completedJobID" value="" />
105 [% UNLESS itemnumber || biblionumber %]
106 <fieldset class="rows">
107 <legend>File type</legend>
110 [% IF (filetype != 'image' ) %]
111 <input type="radio" id="zipfile" name="filetype" value="zip" checked="checked" />
113 <input type="radio" id="zipfile" name="filetype" value="zip" />
115 <label for="zipfile">ZIP file</label>
118 [% IF (filetype == 'image' ) %]
119 <input type="radio" id="image" name="filetype" value="image" checked="checked" />
121 <input type="radio" id="image" name="filetype" value="image" />
123 <label for="image">Image file</label>
126 [% IF ( filetype == 'image' ) %]
129 <span id="bibnum" style="display: none">
131 <label for="biblionumber">Enter cover biblionumber: </label>
132 <input type="text" id="biblionumber" name="biblionumber" value="[% biblionumber | html %]" size="15" /></span>
136 [% ELSIF itemnumber %]
137 <input type="hidden" id="itemnumber" name="itemnumber" value="[% itemnumber | html %]" />
138 <input type="hidden" name="filetype" value="image" />
139 [% ELSIF biblionumber %]
140 <input type="hidden" id="biblionumber" name="biblionumber" value="[% biblionumber | html %]" />
141 <input type="hidden" name="filetype" value="image" />
143 <fieldset class="rows">
144 <legend>Options</legend>
146 <li class="checkbox">
147 [% IF AllowMultipleCovers == 0 %]
148 <input type="checkbox" id="replace" name="replace" checked="checked" disabled="disabled" value="1" />
150 <input type="checkbox" id="replace" name="replace" value="1" />
152 <label for="replace">Replace existing covers</label>
156 <fieldset class="action">
157 <button type="submit" class="btn btn-default btn-sm">Process images</button>
159 </form> <!-- /#processfile -->
162 </div> <!-- /.col-sm-10.col-sm-push-2 -->
164 <div class="col-sm-2 col-sm-pull-10">
166 [% INCLUDE 'tools-menu.inc' %]
168 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
169 </div> <!-- /.row -->
171 [% MACRO jsinclude BLOCK %]
172 [% Asset.js("js/tools-menu.js") | $raw %]
173 [% Asset.js("js/file-upload.js") | $raw %]
175 function StartUpload() {
176 if( $('#fileToUpload').prop('files').length == 0 ) return;
177 $('#uploadform button.submit').prop('disabled',true);
178 $("#fileuploadstatus").show();
179 $("#uploadedfileid").val('');
180 xhr= AjaxUpload( $('#fileToUpload'), $('#fileuploadprogress'), 'temp=1', cbUpload );
182 function cbUpload( status, fileid, errors ) {
183 if( status=='done' ) {
184 $("#uploadedfileid").val( fileid );
185 $('#fileToUpload').prop('disabled',true);
186 $("#processfile").show();
188 var errMsgs = [ _("Error code 0 not used"), _("File already exists"), _("Directory is not writeable"), _("Root directory for uploads not defined"), _("Temporary directory for uploads not defined") ];
189 var errCode = errors[$('#fileToUpload').prop('files')[0].name].code;
190 $("#fileuploadstatus").hide();
191 $("#fileuploadfailed").show();
192 $("#fileuploadfailed").text( _("Upload status: ") +
193 ( status=='failed'? _("Failed") + " - (" + errCode + ") " + errMsgs[errCode]:
194 ( status=='denied'? _("Denied"): status ))
196 $("#processfile").hide();
199 $(document).ready(function(){
200 $("#processfile").hide();
201 $("#zipfile").click(function(){
204 $("#image").click(function(){
207 $("#uploadfile").validate({
208 submitHandler: function(form) {
217 [% INCLUDE 'intranet-bottom.inc' %]