[21/30] Patron Card Creator image management interface and code
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / patroncards / image-manage.tmpl
1     <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
2     <title>Koha &rsaquo; Patron Card Creator &rsaquo; Manage Images</title>
3     <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
4     <script type="text/javascript">
5         //<![CDATA[
6             function DeleteConfirm() {
7                 var results = selected_images("delete");
8                 if (results.images != -1) {
9                     var msg = "Are you sure you want to delete image(s): " + results.image_ids + "?";
10                     var answer = confirm(msg);
11                     if (answer) {
12                         window.location = "/cgi-bin/koha/patroncards/image-manage.pl?op=delete&" + results.images;
13                     }
14                     else {
15                         return; // abort delete
16                     }
17                 }
18             };
19             function selected_images(op) {
20                 var selected = new Array;
21                 var image_ids = new Array;
22                 if (document.delete_images.action.length) {
23                     for (i=0;i<document.delete_images.action.length;i++){
24                         if (document.delete_images.action[i].checked){
25                             selected.push("image_id=" + document.delete_images.action[i].value);
26                             image_ids.push(document.delete_images.action[i].value);
27                         }
28                     };
29                     images = selected.join("&");
30                     return {images:images, image_ids:image_ids};
31                 }
32                 else if (document.delete_images.action.checked){
33                         return {images:"batch_id="+document.delete_images.action.value, image_ids:document.delete_images.action.value};
34                 };
35                 alert("Please select image(s) to " + op + ".");
36                 return (-1);
37             };
38
39     </script>
40     <script type="text/javascript">
41         //<![CDATA[
42         $(document).ready(function() {
43             $("#upload_cancel").empty();
44             $("#delete_cancel").empty();
45             $("#upload").empty();
46             $("#delete").empty();
47             buildButtons();
48          });
49
50         function buildButtons() {
51             new YAHOO.widget.Button({
52                 type: "link",
53                 label: _("Cancel"),
54                 id: "cancelul",
55                 href: "/cgi-bin/koha/patroncards/home.pl",
56                 container: "upload_cancel"
57             });
58
59             new YAHOO.widget.Button({
60                 type: "link",
61                 label: _("Cancel"),
62                 id: "canceldel",
63                 href: "/cgi-bin/koha/patroncards/home.pl",
64                 container: "delete_cancel"
65             });
66
67             new YAHOO.widget.Button({
68                 type: "submit",
69                 label: _("Upload"),
70                 id: "uploadsb",
71                 value: "upload",
72                 container: "upload"
73             });
74
75             var deleteButton = new YAHOO.widget.Button({
76                 type: "link",
77                 onclick: {fn: DeleteConfirm},
78                 label: _("Delete"),
79                 id: "deletesb",
80                 value: "delete",
81                 container: "delete",
82             });
83         }
84     </script>
85 </head>
86 <body>
87 <!-- TMPL_INCLUDE NAME="header.inc" -->
88 <!-- TMPL_INCLUDE NAME="cat-search.inc" -->
89 <div id="breadcrumbs">
90     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
91     <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
92     <a href="/cgi-bin/koha/patroncards/home.pl">Patroncards Home</a> &rsaquo;
93     Manage Images
94 </div>
95 <div id="doc3" class="yui-t2">
96     <div id="bd">
97         <div id="yui-main">
98             <div class="yui-b">
99                 <!-- TMPL_INCLUDE NAME="error-messages.inc" -->
100                 <div class="yui-g">
101                     <div class="yui-u first">
102                         <h1>Upload Images</h1>
103                         <!-- TMPL_IF name="IMPORT_SUCCESSFUL" -->
104                         <div class="dialog message">
105                             <li><h3>Image successfully uploaded.</h3></li>
106                             <li>File: <!-- TMPL_VAR name="SOURCE_FILE" --></li>
107                             <li>Image name: <!-- TMPL_VAR name="IMAGE_NAME" --></li>
108                         </div>
109                         <!-- /TMPL_IF -->
110                         <form name="upload_images" method="post" action="/cgi-bin/koha/patroncards/image-manage.pl" enctype="multipart/form-data">
111                             <fieldset class="brief">
112                                 <div class="hint">
113                                     <b>NOTE:</b> Only PNG, GIF, JPEG, XPM formats are supported. Images <b>must</b> be less than 500KB.
114                                 </div>
115                                 <li>
116                                     <label for="uploadfile">Select the file to upload: </label>
117                                     <input type="file" id="uploadfile" name="uploadfile" />
118                                     <input type="hidden" id="image" name="filetype" value="image" />
119                                 </li>
120                                 <li>
121                                     <label for="image_name">Image name: </label>
122                                     <div class="hint">
123                                         This will be the name by which you will refer to this image in the patron card layout editor.
124                                     </div>
125                                     <input type="text" id="image_name" name="image_name" size="20" />
126                                 </li>
127                             </fieldset>
128                             <fieldset class="action">
129                                 <input type="hidden" name="op" value="upload" />
130                                 <span id="upload"><input id="uploadsu" type="submit" value="upload" class="submit" /></span>
131                                 <span id="upload_cancel"><a id="cancelul" href="/cgi-bin/koha/patroncards/home.pl" class="cancel">Cancel</a></span>
132                             </fieldset>
133                         </form>
134                     </div>
135                     <div class="yui-u">
136                     <h1>Delete Images</h1>
137                         <!-- TMPL_IF name="DELETE_SUCCESSFULL" -->
138                         <div class="dialog message">
139                             <li><h3>Image(s) successfully deleted.</h3></li>
140                         </div>
141                         <!-- /TMPL_IF -->
142                         <!-- TMPL_IF NAME="TABLE" -->
143                         <form name="delete_images" method="post" action="/cgi-bin/koha/patroncards/image-manage.pl" enctype="multipart/form-data">
144                             <fieldset class="brief">
145                                 <div class="hint">
146                                     Select one or more images to delete.
147                                 </div>
148                            <li>
149                                <table>
150                                     <!-- TMPL_LOOP NAME="TABLE" -->
151                                     <!-- TMPL_IF NAME="header_fields" -->
152                                     <tr>
153                                     <!-- TMPL_LOOP NAME="header_fields" -->
154                                         <th><!-- TMPL_VAR NAME="field_label" --></th>
155                                     <!-- /TMPL_LOOP -->
156                                     </tr>
157                                     <!-- TMPL_ELSE -->
158                                     <tr>
159                                     <!-- TMPL_LOOP NAME="text_fields" -->
160                                     <!-- TMPL_IF NAME="select_field" -->
161                                         <td align="center"><input type="checkbox" name="action" value="<!-- TMPL_VAR NAME="field_value" -->" /></td>
162                                     <!-- TMPL_ELSIF NAME="field_value" -->
163                                         <td><!-- TMPL_VAR NAME="field_value" --></td>
164                                     <!-- TMPL_ELSE -->
165                                         <td>&nbsp;</td>
166                                     <!-- /TMPL_IF -->
167                                     <!-- /TMPL_LOOP -->
168                                     </tr>
169                                     <!-- /TMPL_IF -->
170                                     <!-- /TMPL_LOOP -->
171                                 </table>
172                             </li>
173                             </fieldset>
174                             <fieldset class="action">
175                                 <input type="hidden" name="op" value="delete" />
176                                 <span id="delete"><input id="deletesu" type="button" id="delete" onclick="DeleteConfirm()" value="Delete Image(s)" /></span>
177                                 <span id="delete_cancel"><a id="canceldel" href="/cgi-bin/koha/patroncards/home.pl" class="cancel">Cancel</a></span>
178                             </fieldset>
179                         </form>
180                         <!-- TMPL_ELSE -->
181                         <fieldset class="brief">
182                             <div class="hint">
183                                 No images are currently available.
184                             </div>
185                         </fieldset>
186                         <!-- /TMPL_IF -->
187                     </div>
188                 </div>
189             </div>
190         </div>
191         <div class="yui-b noprint">
192             <!-- TMPL_INCLUDE NAME="patroncards-menu.inc" -->
193         </div>
194     </div>
195     <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->