Bug 20100: Introduce preference ProtectSuperlibPrivs
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / labels / label-manage.tt
1 [% USE Asset %]
2 [% BLOCK translate_label_element %]
3 [%-  SWITCH element -%]
4 [%-  CASE 'layout'    -%]layout
5 [%-  CASE 'Layouts'   -%]Layouts
6 [%-  CASE 'template'  -%]template
7 [%-  CASE 'Templates' -%]Templates
8 [%-  CASE 'profile'   -%]profile
9 [%-  CASE 'Profiles'  -%]Profiles
10 [%-  CASE 'batch'     -%]batch
11 [%-  CASE 'Batches'   -%]Batches
12 [%-  END -%]
13 [% END %]
14     [% INCLUDE 'doc-head-open.inc' %]
15     <title>Koha &rsaquo; Tools &rsaquo; Label creator &rsaquo; [% PROCESS translate_label_element element=label_element_title %]</title>
16     [% INCLUDE 'doc-head-close.inc' %]
17     [% INCLUDE 'greybox.inc' %]
18     <script type="text/javascript">
19         //<![CDATA[
20             function Xport() {
21                 batches= new Array;
22                 if(document.layouts.action.length > 0) {
23                     for (var i=0; i < document.layouts.action.length; i++) {
24                         if (document.layouts.action[i].checked) {
25                             batches.push("batch_id=" +  document.layouts.action[i].value);
26                         }
27                     }
28                     if (batches.length < 1) {
29                         alert(_("Please select at least one batch to export."));
30                         return;     // no batch selected
31                     }
32                     getstr = batches.join("&");
33                 }
34                 else if (document.layouts.action.checked) {
35                     getstr = "batch_id="+document.layouts.action.value;
36                 }
37                 else {
38                     alert(_("Please select at least one batch to export."));
39                     return;     // no batch selected
40                 }
41                 return GB_showCenter(_("Export Labels"), "/cgi-bin/koha/labels/label-print.pl?" + getstr, 400, 800);
42             };
43             function selected_layout(op) {
44                 var selected = new Array;
45                 if (document.layouts.action.length) {
46                     for (i=0;i<document.layouts.action.length;i++){
47                         if (document.layouts.action[i].checked){
48                             selected.push(i);
49                         }
50                     };
51                     if (selected.length == 1) {
52                         return(document.layouts.action[selected[0]].value);
53                     }
54                     else {
55                         alert(_("Please select only one %s to %s.").format("[% label_element %]", op));
56                         return (-1);
57                     }
58                 }
59                 else {
60                     if (document.layouts.action.checked){
61                         return(document.layouts.action.value);
62                     }
63                 };
64                 alert(_("Please select a %s.").format("[% label_element %]"));
65                 return (-1);
66             };
67             $(document).ready(function(){
68                 $("#print").click(function(e){
69                     e.preventDefault();
70                     Xport();
71                 });
72                 $(".delete").on("click", function(){
73                     return confirmDelete( _("Are you sure you want to delete this?") );
74                 });
75             });
76         //]]>
77     </script>
78
79 [% Asset.css("css/datatables.css") %]
80 [% INCLUDE 'datatables.inc' %]
81 <script type="text/javascript" id="js">
82  $(document).ready(function() {
83     $("#labels-table").dataTable($.extend(true, {}, dataTablesDefaults, {
84         "sPaginationType": "four_button",
85         "aaSorting": [[ 1, "asc" ]],
86         "aoColumnDefs": [
87             { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
88         ]
89     }));
90  });
91 </script>
92
93 </head>
94 <body id="labels_label-manage" class="tools labels">
95     [% INCLUDE 'header.inc' %]
96     [% INCLUDE 'cat-search.inc' %]
97     <div id="breadcrumbs">
98         <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
99         <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
100         <a href="/cgi-bin/koha/labels/label-home.pl">Label creator</a> &rsaquo;
101         [% PROCESS translate_label_element element=label_element_title %]
102     </div>
103     <div id="doc3" class="yui-t2">
104         <div id="bd">
105             <div id="yui-main">
106                 <div class="yui-b">
107                     [% INCLUDE 'labels-toolbar.inc' %]
108                     <div class="yui-gc">
109                         <div class="yui-u first" id="manage-label-layouts">
110                             <div class="hint">Current library: [% LoginBranchname %]</div>
111                             [% IF ( table_loop ) %]
112                             <form name="layouts" action="/cgi-bin/koha/label-manage.pl?label_element=[% label_element %]">
113                             [% IF    ( label_element == 'layout' ) %]
114                             <h2>Currently available layouts</h2>
115                             [% ELSIF ( label_element == 'template' ) %]
116                             <h2>Currently available templates</h2>
117                             [% ELSIF ( label_element == 'profile' ) %]
118                             <h2>Currently available profiles</h2>
119                             [% ELSIF ( label_element == 'batch' ) %]
120                             <h2>Currently available batches</h2>
121                             [% END %]
122                             <table id="labels-table">
123                                 [% FOREACH table_loo IN table_loop %]
124                                     [% IF ( table_loo.header_fields ) %]
125                                         <thead>
126                                         <tr>
127                                             [% FOREACH header_field IN table_loo.header_fields %]
128                                                 [% SWITCH header_field.field_label %]
129                                                     [% CASE 'Layout ID'       %]<th>Layout ID</th>
130                                                     [% CASE 'Layout'          %]<th>Layout</th>
131                                                     [% CASE 'Barcode Type'    %]<th>Barcode type</th>
132                                                     [% CASE 'Print Type'      %]<th>Print type</th>
133                                                     [% CASE 'Template ID'     %]<th>Template ID</th>
134                                                     [% CASE 'Template Name'   %]<th>Template name</th>
135                                                     [% CASE 'Description'     %]<th>Description</th>
136                                                     [% CASE 'Actions'         %]<th>Actions</th>
137                                                     [% CASE 'Profile ID'      %]<th>Profile ID</th>
138                                                     [% CASE 'Printer Name'    %]<th>Printer name</th>
139                                                     [% CASE 'Paper Bin'       %]<th>Paper bin</th>
140                                                     [% CASE 'Batch ID'        %]<th>Batch ID</th>
141                                                     [% CASE 'Item Count'      %]<th>Item count</th>
142                                                     [% CASE 'Fields to Print' %]<th>Fields to print</th>
143                                                     [% CASE                   %]<th>[% header_field.field_label %]</th>
144                                                 [% END %]
145                                             [% END %]
146                                         </tr>
147                                         </thead>
148                                     [% ELSE %]
149                                         <tr>
150                                         [% FOREACH text_field IN table_loo.text_fields %]
151                                             [% IF ( text_field.select_field ) %]
152                                                 <td class="actions">
153                                                     <a class="btn btn-default btn-xs" href="/cgi-bin/koha/labels/label-edit-[% label_element |url %].pl?op=edit&amp;element_id=[% text_field.field_value |url %]"><i class="fa fa-edit"></i> Edit</a>
154                                                     <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/labels/label-manage.pl?op=delete&amp;label_element=[% label_element %]&amp;element_id=[% text_field.field_value |url %]"><i class="fa fa-trash"></i> Delete</a>
155                                                 </td>
156                                                 [% IF label_element == 'batch' %] <td><input type="checkbox" name="action" value="[% text_field.field_value %]" /></td>[% END %]
157                                             [% ELSIF ( text_field.field_value ) %]
158                                                 <td>[% text_field.field_value %]</td>
159                                             [% ELSE %]
160                                                 <td>&nbsp;</td>
161                                             [% END %]
162                                         [% END %]
163                                         </tr>
164                                     [% END %]
165                                 [% END %]
166                             </table>
167                             [% IF ( print ) %]<button type="button" class="btn btn-default btn-sm" id="print">Export selected</button>[% END %]
168                             </fieldset>
169                             </form>
170                             [% ELSE %]
171                                                         <div class="dialog message">
172                             <h4>There are no
173                             [% PROCESS translate_label_element element=label_element_title %]
174                             currently available.</h4>
175                             <p>Use the toolbar above to create a new
176                             [% PROCESS translate_label_element element=label_element %].</p></div>
177                             [% END %]
178                         </div>
179                         [% IF ( error ) %]
180                         <div class="yui-u">
181                             <div class="dialog alert">
182                                 <strong>WARNING:</strong> An error was encountered and the [% op %] operation for [% label_element %] [% element_id %] was not completed. Please have your system administrator check the error log for details.
183                             </div>
184                         </div>
185                         [% END %]
186                     </div>
187                 </div>
188             </div>
189         <div class="yui-b">
190           [% INCLUDE 'tools-menu.inc' %]
191         </div>
192         </div>
193     [% INCLUDE 'intranet-bottom.inc' %]