Bug 14321: Integrate Upload.pm into Koha
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / cataloguing / value_builder / upload.tt
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5     <title>Upload plugin</title>
6     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7     <script type="text/javascript" src="[% interface %]/lib/jquery/jquery.js"></script>
8     <link rel="stylesheet" type="text/css" href="[% themelang %]/css/staff-global.css" />
9     <script type="text/javascript">
10         function ValidateForm() {
11             var filename = document.forms["UploadForm"]["uploaded_file"].value;
12             if (!filename) {
13                 alert("Please select a file to upload.");
14                 return false;
15             }
16             return true;
17         }
18     </script>
19
20 </head>
21 <body id="cat_upload" class="cat">
22
23 <div id="doc3" class="yui-t2"><div id="bd"><div id="yui-main">
24
25 [% IF ( success ) %]
26
27     <script type="text/javascript">
28         function report() {
29             var doc   = opener.document;
30             var field = doc.getElementById("[% index %]");
31             field.value =  "[% return %]";
32         }
33         $(document).ready(function() {
34             report();
35         });
36     </script>
37
38
39     The file [% uploaded_file | html %] has been successfully uploaded.
40     <p><input type="button" value="close" onclick="window.close();" /></p>
41
42 [% ELSE %]
43
44     [% IF ( MissingURL ) %]
45         <p>Error: The OPAC system preference OPACBaseURL is not configured.</p>
46         <p><input type="button" value="close" onclick="window.close();" /></p>
47     [% ELSIF ( error ) %]
48         <p>Error: Failed to upload file. See logs for details.</p>
49         <p><input type="button" value="close" onclick="window.close();" /></p>
50     [% ELSE %]
51         [% IF (error_upload_path_not_configured) %]
52           <h2>Configuration error</h2>
53           <p>Configuration variable 'upload_path' is not configured.</p>
54           <p>Please configure it in your koha-conf.xml</p>
55         [% ELSE %]
56           [% IF (error_nothing_selected) %]
57               <p class="error">Error: You have to choose the file to upload and select where to upload the file.</p>
58           [% END %]
59           [% IF (error_no_file_selected) %]
60               <p class="error">Error: You have to choose the file to upload.</p>
61           [% END %]
62           [% IF (error_no_dir_selected) %]
63               <p class="error">Error: You have to select where to upload the file.</p>
64           [% END %]
65           [% IF (dangling) %]
66               <p class="error">Error: The URL has no file to retrieve.</p>
67           [% END %]
68
69           <h2>Please select the file to upload:</h2>
70           <form name="UploadForm" method="post" enctype="multipart/form-data" action="/cgi-bin/koha/cataloguing/plugin_launcher.pl" onsubmit="return ValidateForm()">
71               <input type="hidden" name="from_popup" value="1" />
72               <input type="hidden" name="plugin_name" value="upload.pl" />
73               <input type="hidden" name="index" value="[% index %]" />
74
75               <div>[% filefield %]</div>
76               <p/>
77               <div>
78                   <label for="uploadcategory">Category: </label>
79                   [% IF uploadcategories %]
80                       <select id="uploadcategory" name="uploadcategory">
81                       [% FOREACH cat IN uploadcategories %]
82                           <option value="[% cat.code %]">[% cat.name %]</option>
83                       [% END %]
84                       </select>
85                   [% ELSE %]
86                       <input type="hidden" name="uploadcategory" value="CATALOGUING" />
87                   [% END %]
88               </div>
89               <p/>
90               <fieldset class="action">
91                   <input type="submit" value="Upload">
92                   <input type="button" value="Cancel" onclick="window.close();" />
93               </fieldset>
94           </form>
95         [% END %]
96     [% END %]
97
98 [% END %]
99
100 </div></div></div>
101
102 </body>
103 </html>