Bug 30952: Staff interface redesign (header)
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / picture-upload.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% SET footerjs = 1 %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Upload patron images &rsaquo; Tools &rsaquo; Koha</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 </head>
8
9 <body id="tools_picture-upload" class="tools">
10
11 [% WRAPPER 'header.inc' %]
12     [% INCLUDE 'patron-search-header.inc' %]
13 [% END %]
14
15 [% WRAPPER 'sub-header.inc' %]
16 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
17     <ol>
18         <li>
19             <a href="/cgi-bin/koha/mainpage.pl"><i class="fa fa-home"></i></a>
20         </li>
21         <li>
22             <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
23         </li>
24         [% IF ( TOTAL ) %]
25             <li>
26                 <a href="/cgi-bin/koha/tools/picture-upload.pl">Upload patron images</a>
27             </li>
28             <li>
29                 <a href="#" aria-current="page">
30                     Results
31                 </a>
32             </li>
33         [% ELSE %]
34             <li>
35                 <a href="#" aria-current="page">
36                     Upload patron images
37                 </a>
38             </li>
39         [% END %]
40     </ol>
41 </nav>
42 [% END %]
43
44 [% INCLUDE 'blocking_errors.inc' %]
45 <div class="main container-fluid">
46     <div class="row">
47         <div class="col-sm-10 col-sm-push-2">
48             <main>
49
50 [% IF ( TOTAL ) %]
51             [% IF ( ERRORS ) %]
52                                 [% IF ( TCOUNTS ) %]
53                                         <div class="dialog alert">
54                     <h1>Patron image(s) uploaded with some errors</h1>
55                     </div>
56                                 [% ELSE %]
57                                         <div class="dialog alert">
58                     <h1>Patron image failed to upload</h1>
59                     </div>
60                                 [% END %]
61             [% ELSE %]
62                 <div class="dialog message">
63                 <h1>Patron image(s) successfully uploaded</h1>
64                 </div>
65             [% END %]
66                 <ul class="data">
67                     <li>Unpacking completed</li>
68                   <li>[% TOTAL | html %] directories scanned.</li>
69                     <li>[% HANDLED | html %] directories processed.</li>
70                 </ul>
71
72                 [% FOREACH COUNT IN COUNTS %]
73                 <div class="container">
74                     <table>
75                         <caption>Results</caption>
76                         <thead>
77                             <tr><th>File name</th><th>Card number</th><th>Result</th></tr>
78                         </thead>
79                         <tbody>
80                         [% IF ( COUNT.TCOUNTS ) %]<li>[% COUNT.TCOUNTS | html %] image(s) moved into the database:</li>[% END %]
81                             [% FOREACH filename IN COUNT.filenames %]
82                                 <tr>
83                                 <td>[% filename.source | html %]</td>
84                                 <td><a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% filename.cardnumber | url %]">[% filename.cardnumber | html %]</a></td>
85                                 <td>
86                                     [% IF ( filename.filerrors ) %]
87                                     [% FOREACH filerror IN filename.filerrors %]
88                                         [% IF ( filerror.DBERR ) %]<strong>ERROR:</strong> Image not imported because the database returned an error. Please refer to the error log for more details.
89                                         [% ELSIF ( filerror.IMGEXISTS ) %]<strong>ERROR:</strong> Image not imported because this patron does not exist in the database.
90                                         [% ELSIF ( filerror.MIMERR ) %]<strong>ERROR:</strong> Image not imported because the image format is unrecognized.
91                                         [% ELSIF ( filerror.CORERR ) %]<strong>ERROR:</strong> Image not imported because the image file is corrupted.
92                                         [% ELSIF ( filerror.OPNERR ) %]<strong>ERROR:</strong> Image not imported because Koha was unable to open the image for reading.
93                                         [% ELSIF ( filerror.OVRSIZ ) %]<strong>ERROR:</strong> Image not imported because the image file is too big (see online help for maximum size).
94                                         [% ELSIF ( filerror.CRDFIL ) %]<strong>ERROR:</strong> Image not imported ([% filerror.CRDFIL | html %] missing).
95                                         [% ELSIF ( filerror.CARDNUMBER_DOES_NOT_EXIST ) %]<strong>ERROR:</strong> Image not imported because this patron does not exist in the database.
96                                         [% ELSE %]<strong>ERROR:</strong> Image not imported because of an unknown error. Please refer to the error log for more details.
97                                         [% END %]
98                                     [% END %]
99                                 [% ELSE %] imported successfully.
100                                     [% END %]</td>
101                                 </tr>
102                         [% END %]
103                         </tbody>
104                     </table>
105                     </div>
106                 [% END %]
107 <ul>
108                 [% IF ( borrowernumber ) %]
109                     <li><a id="member" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber | html %]">Return to patron detail</a></li>
110                 [% ELSE %]
111                     <li><a id="uploadmore" href="/cgi-bin/koha/tools/picture-upload.pl">Upload more images</a></li>
112                     <li><a id="doneupload" href="/cgi-bin/koha/tools/tools-home.pl">Return to tools</a></li>
113                 [% END %]</ul>
114 [% ELSE %]
115                 <h1>Upload patron images</h1>
116                 [% IF ( ERRORS ) %]
117                 <div class="dialog alert">
118                     [% FOREACH ERROR IN ERRORS %]
119                         [% IF ( ERROR.NOTZIP ) %]<li><strong>The upload file does not appear to be a zip file.  The extension is not '.zip'.</strong></li>
120                         [% ELSIF ( ERROR.NOWRITETEMP ) %]<li><strong>This script is not able to create/write to the necessary temporary directory.</strong></li>
121                         [% ELSIF ( ERROR.EMPTYUPLOAD ) %]<li><strong>The upload file appears to be empty.</strong></li>
122                         [% ELSIF ( ERROR.OPNLINK ) %]<li><strong>Cannot open [% ERROR.OPNLINK | html %] to read.<br />Please verify that it exists.</strong></li>
123                         [% ELSIF ( ERROR.OPNIMG ) %]<li><strong>Cannot open [% ERROR.OPNIMG | html %] to read.<br />Please verify that it exists.</strong></li>
124                         [% ELSIF ( ERROR.DELERR ) %]<li><strong>Unrecognized or missing field delimiter.<br />Please verify that you are using either a single quote or a tab.</strong></li>
125                         [% ELSIF ( ERROR.UZIPFAIL ) %]<li><strong>[% ERROR.UZIPFAIL | html %] failed to unpack.<br />Please verify the integrity of the ZIP file and retry.</strong></li>
126                         [% ELSE %]<li><strong>[% ERROR.CORERR | html %] An unknown error has occurred.<br />Please review the error log for more details.</strong></li>[% END %]
127                     [% END %]
128                 </div>
129                 [% END %]
130             <form method="post" action="/cgi-bin/koha/tools/picture-upload.pl" enctype="multipart/form-data" id="upload_form">
131                 <fieldset class="rows">
132                     <p><strong>NOTE:</strong> Only PNG, GIF, JPEG, XPM formats are supported. Maximum image size is 2MB.</p>
133                         <ol class="radio">
134                             <li>
135                                 <label for="zipfile"><input type="radio" id="zipfile" name="filetype" value="zip" checked="checked" /> Zip file</label></li>
136                             <li>
137                                 <label for="image">
138                                 [% 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 %] Image file</label>
139                             </li>
140                             [% IF ( filetype == 'image' ) %]
141                                 <li id="cardnum">
142                             [% ELSE %]
143                                 <li id="cardnum" style="display: none">
144                             [% END %]
145                                 <label for="cardnumber">Enter patron card number: </label>
146                                 <input type="text" id="cardnumber" name="cardnumber" value="[% cardnumber | html %]" size="15" />
147                                 <span class="required">Required</span>
148                             </li>
149                             <li class="required">
150                                 <label for="uploadfile">Select the file to upload: </label>
151                                 <input type="file" id="uploadfile" name="uploadfile" class="required" required="required" />
152                                 <span class="required">Required</span>
153                             </li>
154                         </ol>
155                     </fieldset>
156                     <fieldset class="action">
157                         <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
158                         <input type="hidden" name="op" value="Upload" />
159                         <input type="submit" value="Upload" class="submit" />
160                                                 <a href="/cgi-bin/koha/tools/tools-home.pl" class="cancel">Cancel</a>
161                     </fieldset>
162                 </form>
163 [% END %]
164
165             </main>
166         </div> <!-- /.col-sm-10.col-sm-push-2 -->
167
168         <div class="col-sm-2 col-sm-pull-10">
169             <aside>
170                 [% INCLUDE 'tools-menu.inc' %]
171             </aside>
172         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
173      </div> <!-- /.row -->
174
175 [% MACRO jsinclude BLOCK %]
176     [% Asset.js("js/tools-menu.js") | $raw %]
177     [% INCLUDE 'str/members-menu.inc' %]
178     [% Asset.js("js/members-menu.js") | $raw %]
179     <script>
180         $(document).ready(function() {
181             $("#zipfile").click(function(){
182                 $("#cardnum").hide();
183             });
184             $("#image").click(function(){
185                 $("#cardnum").show();
186             });
187             $( "#upload_form" ).validate({
188                 rules: {
189                     cardnumber: {
190                         required: {
191                             depends: function(element) {
192                                 return $("#image").is(":checked");
193                             }
194                         }
195                     }
196                 }
197             });
198         });
199     </script>
200 [% END %]
201
202 [% INCLUDE 'intranet-bottom.inc' %]