Bug 2780 - Capitalize strings consistently (patron cards)
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / patroncards / manage.tt
1     [% INCLUDE 'doc-head-open.inc' %]
2     <title>Koha &rsaquo; Tools &rsaquo; Patron cards &rsaquo; Manage patron card elements</title>
3     [% INCLUDE 'doc-head-close.inc' %]
4     [% INCLUDE 'greybox.inc' %]
5     <script type="text/javascript">
6         //<![CDATA[
7             function DeleteConfirm() {
8                 var element_id = selected_layout("delete");
9                 if (element_id>-1) {
10                     var msg = "Are you sure you want to delete [% card_element %] " + element_id + "?"
11                     var answer = confirm(msg);
12                     if (answer) {
13                         window.location = "/cgi-bin/koha/patroncards/manage.pl?op=delete&card_element=[% card_element %]&element_id=" + element_id;
14                     }
15                     else {
16                         return; // abort delete
17                     }
18                 }
19                 else {
20                     return;     // no layout selected
21                 };
22             };
23             function Edit() {
24                 var element_id = selected_layout("edit");
25                 if (element_id>-1) {
26                     window.location = "/cgi-bin/koha/patroncards/edit-[% card_element %].pl?op=edit&element_id=" + element_id;
27                 }
28                 else {
29                     return;     // no layout selected
30                 };
31             };
32             function Xport() {
33                 batches= new Array;
34                 if(document.layouts.action.length > 0) {
35                     for (var i=0; i < document.layouts.action.length; i++) {
36                         if (document.layouts.action[i].checked) {
37                             batches.push("batch_id=" +  document.layouts.action[i].value);
38                         }
39                     }
40                     if (batches.length < 1) {
41                         alert(_('Please select at least one batch to export.'));
42                         return;     // no batch selected
43                     }
44                     getstr = batches.join("&");
45                 }
46                 else if (document.layouts.action.checked) {
47                     getstr = "batch_id="+document.layouts.action.value;
48                 }
49                 else {
50                     alert(_('Please select at least one batch to export.'));
51                     return;     // no batch selected
52                 }
53                 return GB_showCenter('Export Patron Cards', "/cgi-bin/koha/patroncards/print.pl?" + getstr, 700, 800);
54             };
55             function selected_layout(op) {
56                 var selected = new Array;
57                 if (document.layouts.action.length) {
58                     for (i=0;i<document.layouts.action.length;i++){
59                         if (document.layouts.action[i].checked){
60                             selected.push(i);
61                         }
62                     };
63                     if (selected.length == 1) {
64                         return(document.layouts.action[selected[0]].value);
65                     }
66                     else {
67                         alert(_('Please select only one ')+'[% card_element %]'+_(' to ') + op + '.');
68                         return (-1);
69                     }
70                 }
71                 else {
72                     if (document.layouts.action.checked){
73                         return(document.layouts.action.value);
74                     }
75                 };
76                 alert(_('Please select a ')+'[% card_element %].');
77                 return (-1);
78             };
79         //]]>
80     </script>
81     <script type="text/javascript">
82         //<![CDATA[
83         $(document).ready(function() {
84             $("#edit").empty();
85             $("#delete").empty();
86             [% IF ( print ) %]
87             $("#xport").empty();
88             [% END %]
89             buildButtons();
90          });
91
92         function buildButtons() {
93             var editButton = new YAHOO.widget.Button({
94                 type: "link",
95                 onclick: {fn: Edit},
96                 label: _("Edit"),
97                 id: "edit",
98                 container: "edit"
99             });
100             var deleteButton = new YAHOO.widget.Button({
101                 type: "link",
102                 onclick: {fn: DeleteConfirm},
103                 label: _("Delete"),
104                 id: "delete",
105                 container: "delete",
106             });
107             [% IF ( print ) %]
108             var xportButton = new YAHOO.widget.Button({
109                 type: "link",
110                 onclick: {fn: Xport},
111                 label: _("Export"),
112                 id: "xport",
113                 container: "xport",
114             });
115             [% END %]
116         };
117     </script>
118 </head>
119 <body id="pcard_manage" class="tools pcard">
120     [% INCLUDE 'header.inc' %]
121     [% INCLUDE 'cat-search.inc' %]
122     <div id="breadcrumbs">
123         <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
124         <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
125         <a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a> &rsaquo;
126         Manage card [% card_element_title %]
127     </div>
128     <div id="doc3" class="yui-t2">
129         <div id="bd">
130             <div id="yui-main">
131                 <div class="yui-b">
132                     [% INCLUDE 'patroncards-toolbar.inc' %]
133                     [% INCLUDE 'error-messages.inc' %]
134                     <div class="yui-gc">
135                         <div class="yui-u first" id="manage-patroncards-layouts">
136                             <div class="hint">Current library: [% LoginBranchname %]</div>
137                             [% IF ( table_loop ) %]
138                             <form name="layouts" action="/cgi-bin/koha/manage.pl?card_element=[% card_element %]">
139                             <h2>Currently Available [% card_element_title %]</h2>
140                             <table>
141                                 [% FOREACH table_loo IN table_loop %]
142                                 [% IF ( table_loo.header_fields ) %]
143                                 <tr>
144                                 [% FOREACH header_field IN table_loo.header_fields %]
145                                     <th>[% header_field.field_label %]</th>
146                                 [% END %]
147                                 </tr>
148                                 [% ELSE %]
149                                 <tr>
150                                 [% FOREACH text_field IN table_loo.text_fields %]
151                                 [% IF ( text_field.select_field ) %]
152                                     <td align="center"><input type="checkbox" name="action" value="[% text_field.field_value %]" /></td>
153                                 [% ELSIF ( text_field.field_value ) %]
154                                     <td>[% text_field.field_value %]</td>
155                                 [% ELSE %]
156                                     <td>&nbsp;</td>
157                                 [% END %]
158                                 [% END %]
159                                 </tr>
160                                 [% END %]
161                                 [% END %]
162                             </table>
163                             <fieldset class="action">
164                                 <span id="edit"><input type="button" id="edit" onclick="Edit()" value="Edit" /></span>
165                                 <span id="delete"><input type="button" id="delete" onclick="DeleteConfirm()" value="Delete" /></span>
166                                 [% IF ( print ) %]<span id="xport"><input type="button" id="print" onclick="Xport()" value="Export" /></span>[% END %]
167                             </fieldset>
168                             </form>
169                             [% ELSE %]
170                         <div class="dialog message">
171                             <h4>There are no [% card_element_title %] currently available.</h4>
172                             <p>Use the toolbar above to create a new [% card_element %].</p></div>
173                             [% END %]
174                         </div>
175                     </div>
176                 </div>
177             </div>
178             <div class="yui-b">
179                 [% INCLUDE 'patroncards-menu.inc' %]
180             </div>
181         </div>
182     [% INCLUDE 'intranet-bottom.inc' %]