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"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › [% IF ( uploadimage ) %]<a href="/cgi-bin/koha/tools/upload-cover-image.pl">Upload local cover image</a> › Upload results[% ELSE %]Upload local cover image[% END %]</div>
18 <div class="main container-fluid">
20 <div class="col-sm-10 col-sm-push-2">
23 <h1>Upload local cover image</h1>
24 [% IF ( uploadimage ) %]
25 <p>Image upload results :</p>
27 <li>[% total | html %] images found</li>
29 <div class="dialog alert">
30 [% IF ( error == 'UZIPFAIL' ) %]<p><b>Failed to unzip archive.<br />Please ensure you are uploading a valid zip file and try again.</b></p>
31 [% ELSIF ( error == 'OPNLINK' ) %]<p><b>Cannot open folder index (idlink.txt or datalink.txt) to read.<br />Please verify that it exists.</b></p>
32 [% ELSIF ( error == 'OPNIMG' ) %]<p><b>Cannot process file as an image.<br />Please ensure you only upload GIF, JPEG, PNG, or XPM images.</b></p>
33 [% ELSIF ( error == 'DELERR' ) %]<p><b>Unrecognized or missing field delimiter.<br />Please verify that you are using either a single quote or a tab.</b></p>
34 [% ELSIF ( error == 'DBERR' ) %]<p><b>Unable to save image to database.</b></p>
35 [% ELSE %]<p><b>An unknown error has occurred.<br />Please review the error log for more details.</b></p>[% END %]
39 <li><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]">View final record</a></li>
40 <li><a href="/cgi-bin/koha/tools/tools-home.pl">Back</a></li>
45 <li>Select an image file or ZIP file to upload. The tool will accept images in GIF, JPEG, PNG, and XPM formats.</li>
47 <form method="post" action="/cgi-bin/koha/tools/upload-cover-image.pl" id="uploadfile" enctype="multipart/form-data">
48 <fieldset class="rows" >
49 <legend>Upload images</legend>
52 <div id="fileuploadform">
53 <label for="fileToUpload" class="required">Select the file to upload: </label>
54 <input type="file" id="fileToUpload" name="fileToUpload" required="required" class="required" />
55 <span class="required">Required</span>
58 <fieldset class="action"><button class="submit btn btn-default btn-sm">Upload file</button></fieldset>
61 <div id="uploadpanel">
62 <div id="fileuploadstatus" class="progress_panel">Upload progress:
63 <progress max="100" value="0" id="fileuploadprogress">
65 <span class="fileuploadpercent">0</span>%
67 <div id="fileuploadfailed"></div>
71 <form method="post" id="processfile" action="/cgi-bin/koha/tools/upload-cover-image.pl" enctype="multipart/form-data">
72 <fieldset class="rows">
73 <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
74 <input type="hidden" name="runinbackground" id="runinbackground" value="" />
75 <input type="hidden" name="completedJobID" id="completedJobID" value="" />
77 <fieldset class="rows">
78 <legend>File type</legend>
81 [% IF (filetype != 'image' ) %]<input type="radio" id="zipfile" name="filetype" value="zip" checked="checked" />[% ELSE %]<input type="radio" id="zipfile" name="filetype" value="zip" />[% END %]
82 <label for="zipfile">ZIP file</label>
85 [% IF (filetype == 'image' ) %]<input type="radio" id="image" name="filetype" value="image" checked="checked" />[% ELSE %]<input type="radio" id="image" name="filetype" value="image" />[% END %]
86 <label for="image">Image file</label>
89 [% IF ( filetype == 'image' ) %]<span id="bibnum">[% ELSE %]<span id="bibnum" style="display: none">[% END %]<label for="biblionumber">Enter cover biblionumber: </label><input type="text" id="biblionumber" name="biblionumber" value="[% biblionumber | html %]" size="15" /></span>
93 <fieldset class="rows">
94 <legend>Options</legend>
97 [% IF AllowMultipleCovers == 0 %]<input type="checkbox" id="replace" name="replace" checked="checked" disabled="disabled" value="1" />[% ELSE %]<input type="checkbox" id="replace" name="replace" value="1" />[% END %]
98 <label for="replace">Replace existing covers</label>
102 <fieldset class="action"><button type="submit" class="btn btn-default btn-sm">Process images</button></fieldset>
106 </div> <!-- /.col-sm-10.col-sm-push-2 -->
108 <div class="col-sm-2 col-sm-pull-10">
110 [% INCLUDE 'tools-menu.inc' %]
112 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
113 </div> <!-- /.row -->
115 [% MACRO jsinclude BLOCK %]
116 [% Asset.js("js/tools-menu.js") | $raw %]
117 [% Asset.js("js/background-job-progressbar.js") | $raw %]
118 [% Asset.js("js/file-upload.js") | $raw %]
120 function StartUpload() {
121 if( $('#fileToUpload').prop('files').length == 0 ) return;
122 $('#uploadform button.submit').prop('disabled',true);
123 $("#fileuploadstatus").show();
124 $("#uploadedfileid").val('');
125 xhr= AjaxUpload( $('#fileToUpload'), $('#fileuploadprogress'), 'temp=1', cbUpload );
127 function cbUpload( status, fileid, errors ) {
128 if( status=='done' ) {
129 $("#uploadedfileid").val( fileid );
130 $('#fileToUpload').prop('disabled',true);
131 $("#processfile").show();
133 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") ];
134 var errCode = errors[$('#fileToUpload').prop('files')[0].name].code;
135 $("#fileuploadstatus").hide();
136 $("#fileuploadfailed").show();
137 $("#fileuploadfailed").text( _("Upload status: ") +
138 ( status=='failed'? _("Failed") + " - (" + errCode + ") " + errMsgs[errCode]:
139 ( status=='denied'? _("Denied"): status ))
141 $("#processfile").hide();
144 $(document).ready(function(){
145 $("#processfile").hide();
146 $("#zipfile").click(function(){
149 $("#image").click(function(){
152 $("#uploadfile").validate({
153 submitHandler: function(form) {
162 [% INCLUDE 'intranet-bottom.inc' %]