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