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