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