Bug 27846: offline_circ, patroncards, patron_lists, plugins and pos
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / patroncards / image-manage.tt
1 [% SET footerjs = 1 %]
2     [% INCLUDE 'doc-head-open.inc' %]
3     <title>Koha &rsaquo; Tools &rsaquo; Patron card creator &rsaquo; Images</title>
4     [% INCLUDE 'doc-head-close.inc' %]
5 </head>
6
7 <body id="pcard_image-manage" class="tools pcard">
8 [% INCLUDE 'header.inc' %]
9 [% INCLUDE 'cat-search.inc' %]
10 <nav aria-label="Breadcrumb" class="breadcrumb">
11     <ol>
12         <li>
13             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
14         </li>
15         <li>
16             <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
17         </li>
18         <li>
19             <a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a>
20         </li>
21         <li>
22             <a href="#" aria-current="page">
23                 Images
24             </a>
25         </li>
26     </ol>
27 </nav>
28
29 <div class="main container-fluid">
30     <div class="row">
31         <div class="col-sm-10 col-sm-push-2">
32             <main>
33
34                 [% INCLUDE 'patroncards-toolbar.inc' %]
35                 [% INCLUDE 'patroncards-errors.inc' %]
36                 <div class="row">
37                     <div class="col-sm-6">
38                         <h1>Upload additional images for patron cards</h1>
39                         <p>Manage additional images to use as logo, decoration or background on a patron card layout.</p>
40                         <form name="upload_images" method="post" action="/cgi-bin/koha/patroncards/image-manage.pl" enctype="multipart/form-data">
41                             <fieldset class="brief">
42                                 <div class="hint">Only PNG, GIF, JPEG, XPM formats are supported. Maximum image size is 500KB.</div>
43                                 <ol>
44                                 <li>
45                                     <label for="uploadfile">Select the file to upload: </label>
46                                     <input type="file" id="uploadfile" name="uploadfile" />
47                                     <input type="hidden" id="image" name="filetype" value="image" />
48                                 </li>
49                                 <li>
50                                     <label for="image_name">Image name: </label>
51                                     <div class="hint">
52                                         This will be the name by which you will refer to this image in the patron card layout editor.
53                                     </div>
54                                     <div class="hint">
55                                         To replace an image, delete it, upload a new file and give it the same image name.
56                                     </div>
57
58                                     <input type="text" id="image_name" name="image_name" size="20" />
59                                 </li>
60                                 </ol>
61                                 <div class="action">
62                                     <input type="hidden" name="op" value="upload" />
63                                     <input class="btn btn-default btn-default" id="uploadsu" type="submit" value="Upload" />
64                                 </div>
65                                 [% IF ( IMPORT_SUCCESSFUL ) %]
66                                     <div class="dialog message">
67                                     <h3>Image successfully uploaded</h3>
68                                     <ul><li>File: [% SOURCE_FILE | html %]</li>
69                                     <li>Image name: [% IMAGE_NAME | html %]</li></ul>
70                                     </div>
71                                 [% END %]
72                             </fieldset>
73
74                         </form>
75                     </div>
76                     <div class="col-sm-6">
77                     <h1>Delete Images</h1>
78                         [% IF ( TABLE ) %]
79                         <form name="delete_images" method="post" action="/cgi-bin/koha/patroncards/image-manage.pl" enctype="multipart/form-data">
80                             <fieldset class="brief">
81                                 <div class="hint">
82                                     Select one or more images to delete.
83                                 </div>
84                                <table>
85                                     [% FOREACH TABL IN TABLE %]
86
87                                     [% IF ( TABL.header_fields ) %]
88
89                                     <tr>
90                                     [% FOREACH header_field IN TABL.header_fields %]
91                                     [% SWITCH header_field.field_label -%]
92                                         [% CASE "ID" %]
93                                             <th>Image ID</th>
94                                         [% CASE "Name" %]
95                                             <th>Name</th>
96                                         [% CASE " " %]
97                                             <th>Delete</th>
98                                         [% CASE %]
99                                            <th>[% header_field.field_label | html %]</th>
100                                     [% END %]
101                                     [% END %]
102                                     </tr>
103                                     [% ELSE %]
104                                     <tr>
105                                     [% FOREACH text_field IN TABL.text_fields %]
106                                     [% IF ( text_field.select_field ) %]
107                                         <td>
108                                             <a class="delete_image btn btn-default btn-xs" href="/cgi-bin/koha/patroncards/image-manage.pl?op=delete&image_id=[% text_field.field_value | html %]"><i class="fa fa-trash"></i> Delete</a>
109                                         </td>
110                                         <td align="center"><input type="checkbox" name="action" value="[% text_field.field_value | html %]" /></td>
111                                     [% ELSIF ( text_field.field_value ) %]
112                                         <td>[% text_field.field_value | html %]</td>
113                                     [% ELSE %]
114                                         <td>&nbsp;</td>
115                                     [% END %]
116                                     [% END %]
117                                     </tr>
118                                     [% END %]
119                                     [% END %]
120                                 </table>
121                                 <div class="action">
122                                     <input type="hidden" name="op" value="delete" />
123                                     <input class="btn btn-default btn-default" type="button" id="delete" value="Delete selected" />
124                                 </div>
125                                 [% IF ( DELETE_SUCCESSFULL ) %]
126                                 <div id="dialog" class="dialog message">
127                                     <h3>Image(s) successfully deleted</h3>
128                                 </div>
129                                 [% END %]
130                             </fieldset>
131                         </form>
132                         [% ELSE %]
133                         <fieldset class="brief">
134                             <div class="hint">
135                                 No images are currently available.
136                             </div>
137                             [% IF ( DELETE_SUCCESSFULL ) %]
138                                 <div id="dialog" class="dialog message">
139                                     <h3>Image(s) successfully deleted</h3>
140                                 </div>
141                             [% END %]
142                         </fieldset>
143                         [% END %]
144                     </div>
145                 </div>
146
147             </main>
148         </div> <!-- /.col-sm-10.col-sm-push-2 -->
149
150         <div class="col-sm-2 col-sm-pull-10">
151             <aside>
152                 [% INCLUDE 'tools-menu.inc' %]
153             </aside>
154         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
155      </div> <!-- /.row -->
156
157 [% MACRO jsinclude BLOCK %]
158     <script>
159         function DeleteConfirm() {
160             var results = selected_images("delete");
161             if (results.images) {
162                 var msg = _("Are you sure you want to delete image(s): %s?").format(results.image_ids);
163                 var answer = confirm(msg);
164                 if (answer) {
165                     window.location = "/cgi-bin/koha/patroncards/image-manage.pl?op=delete&" + results.images;
166                 } else {
167                     return; // abort delete
168                 }
169             } else {
170                 alert(_("Please select image(s) to delete."));
171             }
172         }
173
174         function selected_images(op) {
175             var selected = new Array;
176             var image_ids = new Array;
177             if (document.delete_images.action.length) {
178                 for (i=0;i<document.delete_images.action.length;i++){
179                     if (document.delete_images.action[i].checked){
180                         selected.push("image_id=" + document.delete_images.action[i].value);
181                         image_ids.push(document.delete_images.action[i].value);
182                     }
183                 }
184                 images = selected.join("&");
185                 return {images:images, image_ids:image_ids};
186             }
187             else if (document.delete_images.action.checked){
188                     return {images:"image_id="+document.delete_images.action.value, image_ids:document.delete_images.action.value};
189             }
190             return (-1);
191         }
192         $(document).ready(function() {
193             $("#delete").click(function(){
194                 return DeleteConfirm();
195             });
196             $(".delete_image").on("click", function(){
197                 return confirmDelete( _("Are you sure you want to delete this image?") );
198             });
199         });
200     </script>
201 [% END %]
202
203 [% INCLUDE 'intranet-bottom.inc' %]