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