Bug 18040: Updating buttons in Tools -> Upload local cover image
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / upload-images.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Tools &rsaquo; Upload images</title>
3 [% INCLUDE 'doc-head-close.inc' %]
4
5 <script type="text/javascript" src="[% interface %]/[% theme %]/js/background-job-progressbar.js"></script>
6 <script type="text/javascript" src="[% interface %]/[% theme %]/js/file-upload.js"></script>
7
8 <style type="text/css">
9     #fileuploadstatus,#fileuploadfailed,#jobpanel,#jobstatus,#jobfailed { display : none; }
10 </style>
11
12 <script type="text/javascript">
13 //<![CDATA[
14 function StartUpload() {
15     if( $('#fileToUpload').prop('files').length == 0 ) return;
16     $('#uploadform button.submit').prop('disabled',true);
17     $("#fileuploadstatus").show();
18     $("#uploadedfileid").val('');
19     xhr= AjaxUpload( $('#fileToUpload'), $('#fileuploadprogress'), 'temp=1', cbUpload );
20 }
21 function cbUpload( status, fileid ) {
22     if( status=='done' ) {
23         $("#uploadedfileid").val( fileid );
24         $('#fileToUpload').prop('disabled',true);
25         $("#processfile").show();
26     } else {
27         $("#fileuploadstatus").hide();
28         $("#fileuploadfailed").show();
29         $("#fileuploadfailed").text( _("Upload status: ") +
30             ( status=='failed'? _("Failed"):
31             ( status=='denied'? _("Denied"): status ))
32         );
33         $("#processfile").hide();
34     }
35 }
36 $(document).ready(function(){
37         $("#processfile").hide();
38         $("#zipfile").click(function(){
39                 $("#bibnum").hide();
40         });
41         $("#image").click(function(){
42                 $("#bibnum").show();
43         });
44     $("#uploadfile").validate({
45         submitHandler: function(form) {
46             StartUpload();
47             return false;
48         }
49     });
50 });
51 //]]>
52 </script>
53 </head>
54 <body id="tools_upload-images" class="tools">
55 [% INCLUDE 'header.inc' %]
56 [% INCLUDE 'cat-search.inc' %]
57
58 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; [% IF ( uploadimage ) %]<a href="/cgi-bin/koha/tools/upload-cover-image.pl">Upload local cover image</a> &rsaquo; Upload results[% ELSE %]Upload local cover image[% END %]</div>
59
60 <div id="doc3" class="yui-t2">
61
62    <div id="bd">
63         <div id="yui-main">
64         <div class="yui-b">
65
66 <h1>Upload local cover image</h1>
67 [% IF ( uploadimage ) %]
68 <p>Image upload results :</p>
69 <ul>
70     <li>[% total %] images found</li>
71     [% IF ( error ) %]
72     <div class="dialog alert">
73     [% IF ( error == 'UZIPFAIL' ) %]<p><b>Failed to unzip archive.<br />Please ensure you are uploading a valid zip file and try again.</b></p>
74     [% ELSIF ( error == 'OPNLINK' ) %]<p><b>Cannot open folder index (idlink.txt or datalink.txt) to read.<br />Please verify that it exists.</b></p>
75     [% 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>
76     [% 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>
77     [% ELSIF ( error == 'DBERR' ) %]<p><b>Unable to save image to database.</b></p>
78     [% ELSE %]<p><b>An unknown error has occurred.<br />Please review the error log for more details.</b></p>[% END %]
79     </div>
80     </li>
81     [% END %]
82     <li><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber %]">View final record</a></li>
83         <li><a href="/cgi-bin/koha/tools/tools-home.pl">Back</a></li>
84 </ul>
85 <hr />
86 [% END %]
87 <ul>
88         <li>Select an image file or ZIP file to upload. The tool will accept images in GIF, JPEG, PNG, and XPM formats.</li>
89 </ul>
90 <form method="post" action="/cgi-bin/koha/tools/upload-cover-image.pl" id="uploadfile" enctype="multipart/form-data">
91 <fieldset class="rows" id="uploadform">
92 <legend>Upload images</legend>
93 <ol>
94         <li>
95         <div id="fileuploadform">
96         <label for="fileToUpload" class="required">Select the file to upload: </label>
97         <input type="file" id="fileToUpload" name="fileToUpload" required="required" class="required" />
98     <span class="required">Required</span>
99         </div>  </li>
100 </ol>
101     <fieldset class="action"><button class="submit btn btn-default btn-sm">Upload file</button></fieldset>
102 </fieldset>
103
104     <div id="uploadpanel">
105         <div id="fileuploadstatus" class="progress_panel">Upload progress:
106             <progress max="100" value="0" id="fileuploadprogress">
107             </progress>
108             <span class="fileuploadpercent">0</span>%
109         </div>
110         <div id="fileuploadfailed"></div>
111     </div>
112 </form>
113
114     <form method="post" id="processfile" action="/cgi-bin/koha/tools/upload-cover-image.pl" enctype="multipart/form-data">
115 <fieldset class="rows">
116         <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
117         <input type="hidden" name="runinbackground" id="runinbackground" value="" />
118         <input type="hidden" name="completedJobID" id="completedJobID" value="" />
119         </fieldset>
120   <fieldset class="rows">
121     <legend>File type</legend>
122     <ol>
123       <li class="radio">
124         [% 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 %]
125         <label for="zipfile">ZIP file</label>
126       </li>
127       <li class="radio">
128         [% 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 %]
129         <label for="image">Image file</label>
130       </li>
131       <li class="radio">
132         [% 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 %]" size="15" /></span>
133       </li>
134     </ol>
135   </fieldset>
136   <fieldset class="rows">
137     <legend>Options</legend>
138     <ol>
139       <li class="checkbox">
140         [% 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 %]
141         <label for="replace">Replace existing covers</label>
142       </li>
143     </ol>
144   </fieldset>
145   <fieldset class="action"><button type="submit" class="btn btn-default btn-sm">Process images</button></fieldset>
146 </form>
147
148 </div>
149 </div>
150 <div class="yui-b">
151 [% INCLUDE 'tools-menu.inc' %]
152 </div>
153 </div>
154 [% INCLUDE 'intranet-bottom.inc' %]