Bug 13618: Add html filters to all the variables
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / item_circulation_alerts.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Branches %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Administration &rsaquo; Item circulation alerts</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 <style type="text/css">
9 table.grid thead th {
10   vertical-align: bottom;
11 }
12
13 table.grid tbody th {
14   text-align: right;
15 }
16
17 table.grid tbody td {
18   font-size: xx-small;
19 }
20
21 table.grid tbody td.info {
22   background: #fff;
23 }
24
25 table.grid.active tbody td {
26   width: 10%;
27   cursor: pointer;
28 }
29
30 table.grid tbody td {
31   background: #cfc;
32   color: #111;
33 }
34
35 table.grid td.disabled {
36   background: #fcc;
37 }
38
39 table.grid td.default {
40   background: #f88;
41 }
42 </style>
43 </head>
44
45 <body id="admin_item_circulation_alerts" class="admin">
46 [% INCLUDE 'header.inc' %]
47 [% INCLUDE 'prefs-admin-search.inc' %]
48 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; Item circulation alerts </div>
49
50 <div id="doc3" class="yui-t1">
51
52 <div id="bd">
53
54 <div id="yui-main" class="circulation-alert">
55 <div class="yui-b">
56
57 <div class="yui-g">
58 <div class="yui-u first">
59 <h1>Item circulation alerts</h1>
60 <h2>Select a library:</h2>
61 <form id="branch_selector" method="get" action="/cgi-bin/koha/admin/item_circulation_alerts.pl">
62 <select id="branch" name="branch">
63     <option value="*">Default</option>
64     [% PROCESS options_for_libraries libraries => Branches.all( selected => branch, unfiltered => 1 ) %]
65 </select>
66 <input type="submit" name="pick" value="Pick" />
67 </form>
68 </div>
69 <div class="yui-u">
70 <table class="grid">
71 <caption>Legend</caption>
72 <thead>
73 <tr>
74   <th>Color</th>
75   <th>Meaning</th>
76 </tr>
77 </thead>
78 <tbody>
79   <tr>
80     <td width="100" class="default">&nbsp;</td>
81     <td class="info">These are disabled for ALL libraries.  To change these settings, choose the "Default" library.</td>
82   </tr>
83   <tr>
84     <td class="disabled">&nbsp;</td>
85     <td class="info">These are disabled for the current library.</td>
86   </tr>
87   <tr>
88     <td>&nbsp;</td>
89     <td class="info">These are enabled.</td>
90   </tr>
91 </tbody>
92 </table>
93 </div>
94 </div>
95
96 <h2>Circulation alerts for [% Branches.GetName( branch ) || 'Default' | html %]</h2>
97 <p>Click on the grid to toggle the settings.</p>
98
99 <div id="alerttabs" class="toptabs">
100 <ul>
101 <li><a href="#checkout">Checkout</a></li>
102 <li><a href="#checkin">Check-in</a></li>
103 </ul>
104
105 <div id="checkout">
106 <h3>Checkout</h3>
107 <table class="grid active" width="100%">
108 <thead>
109 <tr>
110   <th>&nbsp;</th>
111   [% FOREACH item_type IN item_types %]
112   <th>[% item_type.description | html %]</th>
113   [% END %]
114 </tr>
115 </thead>
116 <tbody>
117 [% FOREACH grid_checkou IN grid_checkout %]
118 <tr>
119   <th>[% grid_checkou.description | html %]</th>
120   [% FOREACH item IN grid_checkou.items %]
121   <td class="[% item.class | html %]" id="[% item.id | html %]">[% item.text | html %]</td>
122   [% END %]
123 </tr>
124 [% END %]
125 </tbody>
126 </table>
127 </div>
128
129 <div id="checkin">
130 <h3>Check-in</h3>
131 <table class="grid active" width="100%">
132 <thead>
133 <tr>
134   <th>&nbsp;</th>
135   [% FOREACH item_type IN item_types %]
136   <th>[% item_type.description | html %]</th>
137   [% END %]
138 </tr>
139 </thead>
140 <tbody>
141 [% FOREACH grid_checki IN grid_checkin %]
142 <tr>
143   <th>[% grid_checki.description | html %]</th>
144   [% FOREACH item IN grid_checki.items %]
145   <td class="[% item.class | html %]" id="[% item.id | html %]">[% item.text | html %]</td>
146   [% END %]
147 </tr>
148 [% END %]
149 </tbody>
150 </table>
151 </div>
152 </div>
153
154 </div>
155 </div>
156
157 <div class="yui-b">
158 [% INCLUDE 'admin-menu.inc' %]
159 </div>
160 </div>
161
162 [% MACRO jsinclude BLOCK %]
163     [% Asset.js("js/admin-menu.js") | $raw %]
164     <script type="text/javascript">
165         var $branch = "[% branch | html %]";
166         $(function(){
167             $('#alerttabs').tabs();
168
169             var blocked            = _("Blocked!");
170             var saving             = _("Saving...");
171             var disabledForAll     = _("Disabled for all");
172             var disabledForCurrent = _("Disabled for %s").format($branch);
173
174             $('#branch_selector input:submit').hide();
175             $('#branch').change(function(){
176                 $('#branch_selector').submit();
177             });
178
179             $('table.grid.active tbody td').click(function(ev){
180                 var id = this.id;
181                 var td = $(this);
182                 if (td.hasClass('default') && $branch != '*') {
183                     td.html(blocked);
184                     window.setTimeout(
185                       function(){ td.html(disabledForAll) },
186                       3000
187                     );
188                 } else {
189                     td.html(saving);
190                     $.ajax({
191                         url      : '/cgi-bin/koha/admin/item_circulation_alerts.pl',
192                         type     : 'POST',
193                         dataType : 'json',
194                         data     : { action: 'toggle', id: id, branch: $branch },
195                         success  : function(response){
196                             if ($branch == '*' && response.classes.match(/default/)) {
197                                 td.html(disabledForAll);
198                             } else if (response.classes.match(/disabled/)) {
199                                 td.html(disabledForCurrent);
200                             } else {
201                                 td.html(' ');
202                             }
203                             td.attr('class', response.classes);
204                         }
205                     });
206                 }
207             });
208
209         });
210     </script>
211 [% END %]
212 [% INCLUDE 'intranet-bottom.inc' %]