4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Upload images › Tools › Koha</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 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
19 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
22 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
25 [% IF ( uploadimage ) %]
27 <a href="/cgi-bin/koha/tools/upload-cover-image.pl">Upload local cover image</a>
30 <a href="#" aria-current="page">
34 [% ELSIF itemnumber %]
36 <a href="/cgi-bin/koha/tools/upload-cover-image.pl">Upload local cover image</a>
39 <a href="#" aria-current="page">
40 Upload cover for itemnumber: [% itemnumber | html %]
43 [% ELSIF biblionumber %]
45 <a href="/cgi-bin/koha/tools/upload-cover-image.pl">Upload local cover image</a>
48 <a href="#" aria-current="page">
49 Upload cover for biblionumber: [% biblionumber | html %]
54 <a href="#" aria-current="page">
55 Upload local cover image
62 <div class="main container-fluid">
64 <div class="col-sm-10 col-sm-push-2">
67 [% IF ( uploadimage ) %]
68 <h1>Image upload results :</h1>
70 <li>[% total | html %] images found</li>
73 <div class="dialog alert">
74 [% IF ( error == 'UZIPFAIL' ) %]
75 <p><strong>Failed to unzip archive.<br />Please ensure you are uploading a valid zip file and try again.</strong></p>
76 [% ELSIF ( error == 'OPNLINK' ) %]
77 <p><strong>Cannot open folder index (idlink.txt or datalink.txt) to read.<br />Please verify that it exists.</strong></p>
78 [% ELSIF ( error == 'OPNIMG' ) %]
79 <p><strong>Cannot process file as an image.<br />Please ensure you only upload GIF, JPEG, PNG, or XPM images.</strong></p>
80 [% ELSIF ( error == 'DELERR' ) %]
81 <p><strong>Unrecognized or missing field delimiter.<br />Please verify that you are using either a single quote or a tab.</strong></p>
82 [% ELSIF ( error == 'DBERR' ) %]
83 <p><strong>Unable to save image to database.</strong></p>
85 <p><strong>An unknown error has occurred.<br />Please review the error log for more details.</strong></p>
90 <li><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]">View final record</a></li>
91 <li><a href="/cgi-bin/koha/tools/tools-home.pl">Back</a></li>
94 [% END # /IF uploadimage %]
96 [% UNLESS itemnumber || biblionumber %]
97 <h1>Upload local cover image</h1>
98 [% ELSIF itemnumber %]
99 <h1>Upload local cover image for itemnumber: [% itemnumber | html %]</h1>
100 [% ELSIF biblionumber %]
101 <h1>Upload local cover image for biblionumber: [% biblionumber | html %]</h1>
105 [% UNLESS itemnumber || biblionumber %]
106 <li>Select an image file or ZIP file to upload. The tool will accept images in GIF, JPEG, PNG, and XPM formats.</li>
108 <li>Select an image file to upload. The tool will accept images in GIF, JPEG, PNG, and XPM formats.</li>
112 <form method="post" action="/cgi-bin/koha/tools/upload-cover-image.pl" id="uploadfile" enctype="multipart/form-data">
113 <fieldset class="rows" >
114 <legend>Upload images</legend>
117 <div id="fileuploadform">
118 <label for="fileToUpload" class="required">Select the file to upload: </label>
119 <input type="file" id="fileToUpload" name="fileToUpload" required="required" class="required" />
120 <span class="required">Required</span>
124 <fieldset class="action"><button class="submit btn btn-default">Upload file</button></fieldset>
127 <div id="uploadpanel">
128 <div id="fileuploadstatus" class="progress_panel">Upload progress:
129 <progress max="100" value="0" id="fileuploadprogress">
131 <span class="fileuploadpercent">0</span>%
133 <div id="fileuploadfailed"></div>
135 </form> <!-- /#uploadfile -->
137 <form method="post" id="processfile" action="/cgi-bin/koha/tools/upload-cover-image.pl" enctype="multipart/form-data">
138 <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
139 <input type="hidden" name="runinbackground" id="runinbackground" value="" />
140 <input type="hidden" name="completedJobID" id="completedJobID" value="" />
141 [% UNLESS itemnumber || biblionumber %]
142 <fieldset class="rows">
143 <legend>File type</legend>
146 [% IF (filetype != 'image' ) %]
147 <input type="radio" id="zipfile" name="filetype" value="zip" checked="checked" />
149 <input type="radio" id="zipfile" name="filetype" value="zip" />
151 <label for="zipfile">ZIP file</label>
154 [% IF (filetype == 'image' ) %]
155 <input type="radio" id="image" name="filetype" value="image" checked="checked" />
157 <input type="radio" id="image" name="filetype" value="image" />
159 <label for="image">Image file</label>
162 [% IF ( filetype == 'image' ) %]
165 <span id="bibnum" style="display: none">
167 <label for="biblionumber">Enter cover biblionumber: </label>
168 <input type="text" id="biblionumber" name="biblionumber" value="[% biblionumber | html %]" size="15" /></span>
172 [% ELSIF itemnumber %]
173 <input type="hidden" id="itemnumber" name="itemnumber" value="[% itemnumber | html %]" />
174 <input type="hidden" name="filetype" value="image" />
175 [% ELSIF biblionumber %]
176 <input type="hidden" id="biblionumber" name="biblionumber" value="[% biblionumber | html %]" />
177 <input type="hidden" name="filetype" value="image" />
179 <fieldset class="rows">
180 <legend>Options</legend>
182 <li class="checkbox">
183 [% IF AllowMultipleCovers == 0 %]
184 <input type="checkbox" id="replace" name="replace" checked="checked" disabled="disabled" value="1" />
186 <input type="checkbox" id="replace" name="replace" value="1" />
188 <label for="replace">Replace existing covers</label>
192 <fieldset class="action">
193 <button type="submit" class="btn btn-default btn-sm">Process images</button>
195 </form> <!-- /#processfile -->
198 </div> <!-- /.col-sm-10.col-sm-push-2 -->
200 <div class="col-sm-2 col-sm-pull-10">
202 [% INCLUDE 'tools-menu.inc' %]
204 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
205 </div> <!-- /.row -->
207 [% MACRO jsinclude BLOCK %]
208 [% Asset.js("js/tools-menu.js") | $raw %]
209 [% Asset.js("js/file-upload.js") | $raw %]
211 function StartUpload() {
212 if( $('#fileToUpload').prop('files').length == 0 ) return;
213 $('#uploadform button.submit').prop('disabled',true);
214 $("#fileuploadstatus").show();
215 $("#uploadedfileid").val('');
216 xhr= AjaxUpload( $('#fileToUpload'), $('#fileuploadprogress'), 'temp=1', cbUpload );
218 function cbUpload( status, fileid, errors ) {
219 if( status=='done' ) {
220 $("#uploadedfileid").val( fileid );
221 $('#fileToUpload').prop('disabled',true);
222 $("#processfile").show();
224 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") ];
225 var errCode = errors[$('#fileToUpload').prop('files')[0].name].code;
226 $("#fileuploadstatus").hide();
227 $("#fileuploadfailed").show();
228 $("#fileuploadfailed").text( _("Upload status: ") +
229 ( status=='failed'? _("Failed") + " - (" + errCode + ") " + errMsgs[errCode]:
230 ( status=='denied'? _("Denied"): status ))
232 $("#processfile").hide();
235 $(document).ready(function(){
236 $("#processfile").hide();
237 $("#zipfile").click(function(){
240 $("#image").click(function(){
243 $("#uploadfile").validate({
244 submitHandler: function(form) {
253 [% INCLUDE 'intranet-bottom.inc' %]