Bug 13618: Add html filters to all the variables
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / branches.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% SET footerjs = 1 %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha &rsaquo; Administration &rsaquo; Libraries
6 [% IF op == 'add_form' %]
7     &rsaquo;[% IF library %]Modify library[% ELSE %]New library [% library.branchcode | html %][% END %]
8 [% ELSIF op == 'delete_confirm' %]
9     &rsaquo; Confirm deletion of library '[% library.branchcode | html %]'
10 [% END %]
11 </title>
12 [% INCLUDE 'doc-head-close.inc' %]
13 [% Asset.css("css/datatables.css") | $raw %]
14 </head>
15
16 <body id="admin_branches" class="admin">
17 [% INCLUDE 'header.inc' %]
18 [% INCLUDE 'prefs-admin-search.inc' %]
19
20 <div id="breadcrumbs">
21     <a href="/cgi-bin/koha/mainpage.pl">Home</a>
22 &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
23 &rsaquo; <a href="/cgi-bin/koha/admin/branches.pl">Libraries</a>
24 [% IF op == 'add_form'  %]
25 &rsaquo; [% IF library %]Modify library[% ELSE %]New library [% library.branchcode | html %][% END %]
26 [% ELSIF op == 'delete_confirm' %]
27 &rsaquo; Confirm deletion of library '[% library.branchcode | html %]'
28 [% END %]
29 </div>
30
31 <div id="doc3" class="yui-t2">
32
33    <div id="bd">
34     <div id="yui-main">
35     <div class="yui-b">
36
37 [% FOREACH m IN messages %]
38     <div class="dialog [% m.type | html %]">
39         [% SWITCH m.code %]
40         [% CASE 'error_on_update' %]
41             An error occurred when updating this library. Perhaps it already exists.
42         [% CASE 'error_on_insert' %]
43             An error occurred when adding this library. The branchcode might already exist.
44         [% CASE 'error_on_delete' %]
45             An error occurred when deleting this library. Check the logs.
46         [% CASE 'success_on_update' %]
47             Library updated successfully.
48         [% CASE 'success_on_insert' %]
49             Library added successfully.
50         [% CASE 'success_on_delete' %]
51             Library deleted successfully.
52         [% CASE 'cannot_delete_library' %]
53             This library cannot be deleted. Patrons or items are still using it
54             [% IF m.data.patrons_count and m.data.items_count %]
55                 ([% m.data.patrons_count | html %] patrons and [% m.data.items_count | html %] items).
56             [% ELSIF m.data.patrons_count %]
57                 ([% m.data.patrons_count | html %] patrons).
58             [% ELSIF m.data.items_count %]
59                 ([% m.data.items_count | html %] items).
60             [% END %]
61         [% CASE 'error_on_update_category' %]
62             An error occurred when updating this library category. Perhaps it already exists.
63         [% CASE 'error_on_insert_category' %]
64             An error occurred when adding this library category. The categorycode might already exist.
65         [% CASE 'error_on_delete_category' %]
66             An error occurred when deleting this library category. Check the logs.
67         [% CASE 'success_on_update_category' %]
68             Library category updated successfully.
69         [% CASE 'success_on_insert_category' %]
70             Library category added successfully.
71         [% CASE 'success_on_delete_category' %]
72             Library category deleted successfully.
73         [% CASE 'cannot_delete_category' %]
74             This library category cannot be deleted. [% m.data.libraries_count | html %] libraries are still using it.
75         [% CASE %]
76             [% m.code | html %]
77         [% END %]
78     </div>
79 [% END %]
80
81 [% IF op == 'list' %]
82     <div id="toolbar" class="btn-toolbar">
83         <a class="btn btn-default btn-sm" id="newbranch" href="/cgi-bin/koha/admin/branches.pl?op=add_form"><i class="fa fa-plus"></i> New library</a>
84     </div>
85 [% END %]
86
87 [% IF op == 'add_form' %]
88     <h3>[% IF library %]Modify library[% ELSE %]New library[% END %]</h3>
89     <form action="/cgi-bin/koha/admin/branches.pl" id="Aform" name="Aform" class="validated" method="post">
90         <fieldset class="rows">
91             <input type="hidden" name="op" value="add_validate" />
92             [% IF library %]
93                 <input type="hidden" name="is_a_modif" value="1" />
94             [% END %]
95             <ol>
96                 <li>
97                     [% IF library %]
98                         <span class="label">Library code: </span>
99                         <input type="hidden" name="branchcode" value="[% library.branchcode | html %]" />
100                         [% library.branchcode | html %]
101                     [% ELSE %]
102                         <label for="branchcode" class="required">Library code: </label>
103                         <input type="text" name="branchcode" id="branchcode" size="10" maxlength="10" value="[% library.branchcode | html %]" class="required" required="required" />
104                         <span class="required">Required</span>
105                     [% END %]
106                 </li>
107                 <li>
108                     <label for="branchname" class="required">Name: </label>
109                     <input type="text" name="branchname" id="branchname" size="80" value="[% library.branchname | html %]" class="required" required="required" />
110                     <span class="required">Required</span>
111                 </li>
112             </ol>
113         </fieldset>
114         [% IF categories %]
115             <fieldset class="rows"><legend>Group(s):</legend>
116                 <ol>
117                     [% FOREACH category IN categories %]
118                         <li>
119                             <label for="[% category.categorycode | html %]">[% category.categoryname | html %]: </label>
120                             [% IF category and selected_categorycodes.grep(category.categorycode).size %]
121                                 <input type="checkbox" id="[% category.categorycode | html %]" name="selected_categorycode_[% category.categorycode | html %]" checked="checked" />
122                             [% ELSE %]
123                                 <input type="checkbox" id="[% category.categorycode | html %]" name="selected_categorycode_[% category.categorycode | html %]" />
124                             [% END %]
125                             <span class="hint">[% category.codedescription | html %]</span>
126                         </li>
127                     [% END %]
128                 </ol>
129             </fieldset>
130         [% END %]
131         <fieldset class="rows">
132             <ol>
133                 <li><label for="branchaddress1">Address line 1: </label><input type="text" name="branchaddress1" id="branchaddress1" size="60" value="[% library.branchaddress1 | html %]" /></li>
134                 <li><label for="branchaddress2">Address line 2: </label><input type="text" name="branchaddress2" id="branchaddress2" size="60" value="[% library.branchaddress2 | html %]" /></li>
135                 <li><label for="branchaddress3">Address line 3: </label><input type="text" name="branchaddress3" id="branchaddress3" size="60" value="[% library.branchaddress3 | html %]" /></li>
136                 <li><label for="branchcity">City: </label><input type="text" name="branchcity" id="branchcity" size="60" value="[% library.branchcity | html %]" /></li>
137                 <li><label for="branchstate">State: </label><input type="text" name="branchstate" id="branchstate" size="60" value="[% library.branchstate | html %]" /></li>
138                 <li><label for="branchzip">ZIP/Postal code: </label><input type="text" name="branchzip" id="branchzip"  size="25" maxlength="25" value="[% library.branchzip | html %]" /></li>
139                 <li><label for="branchcountry">Country: </label><input type="text" name="branchcountry" id="branchcountry" size="60" value="[% library.branchcountry | html %]" /></li>
140                 <li><label for="branchphone">Phone: </label><input type="text" name="branchphone" id="branchphone" size="60" value="[% library.branchphone | html %]" /></li>
141                 <li><label for="branchfax">Fax: </label><input type="text" name="branchfax" id="branchfax" size="60" value="[% library.branchfax | html %]" /></li>
142                 <li><label for="branchemail">Email: </label><input type="text" name="branchemail" id="branchemail" class="email"  size="80" value="[% library.branchemail | html %]" /></li>
143                 <li><label for="branchreplyto">Reply-To: </label> <input type="text" name="branchreplyto" id="branchreplyto" class="email"  size="80" value="[% library.branchreplyto | html %]" /><br /><span class="hint">Default: ReplyToDefault system preference</span></li>
144                 <li><label for="branchreturnpath">Return-Path: </label> <input type="text" name="branchreturnpath" id="branchreturnpath" class="email"  size="80" value="[% library.branchreturnpath | html %]" /><br /><span class="hint">Default: ReturnpathDefault system preference</span></li>
145                 <li><label for="branchurl">URL: </label><input type="text" name="branchurl" id="branchurl"  size="80" value="[% library.branchurl | html %]" class="url" /></li>
146                 <li><label for="opac_info">OPAC info: </label><textarea name="opac_info" id="opac_info">[% library.opac_info | $raw %]</textarea></li>
147                 <li><label for="branchip">IP: </label><input type="text" name="branchip" id="branchip"  size="15" maxlength="15" value="[% library.branchip | html %]" /> <span class="hint">Can be entered as a single IP, or a subnet such as 192.168.1.*</span></li>
148                 <li><label for="marcorgccode">MARC organization code</label> <input type="text" name="marcorgcode" id="marcorgcode" size="16" value="[% library.marcorgcode | html %]" /> <span class="hint">If not filled in defaults to system preference MARCOrgCode. You can obtain your code from <a href="http://www.loc.gov/marc/organizations/orgshome.html" target="_blank">Library of Congress</a>.</span>
149                 <li><label for="branchnotes">Notes: </label><input type="text" name="branchnotes" id="branchnotes" size="80" value="[% library.branchnotes | html %]" /></li>
150             </ol>
151         </fieldset>
152         <fieldset class="action">
153             <input type="submit" value="Submit" />
154             <a class="cancel" href="/cgi-bin/koha/admin/branches.pl">Cancel</a>
155         </fieldset>
156     </form>
157 [% END %]
158
159 [% IF op == 'delete_confirm' and not ( items_count or patrons_count )%]
160     <div class="dialog alert">
161         <form action="/cgi-bin/koha/admin/branches.pl" method="post">
162             <h3>Are you sure you want to delete [% library.branchname | html %] ([% library.branchcode | html %])?</h3>
163             <input type="hidden" name="op" value="delete_confirmed" />
164             <input type="hidden" name="branchcode" value="[% library.branchcode | html %]" />
165             <input type="hidden" name="branchname" value="[% library.branchname | html %]">
166             <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
167         </form>
168         <form action="/cgi-bin/koha/admin/branches.pl" method="get">
169             <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
170         </form>
171     </div>
172 [% END %]
173
174 [% IF op == 'list' %]
175     <h3>Libraries</h3>
176     [% IF libraries.count %]
177         <table id="branchest">
178             <thead>
179                 <tr>
180                     <th>Name</th>
181                     <th>Code</th>
182                     <th>Address</th>
183                     <th>MARC organization code</th>
184                     <th>IP</th>
185                     <th>Actions</th>
186                 </tr>
187             </thead>
188             <tbody>
189                 [% FOREACH library IN libraries %]
190                     <tr>
191                         <td>[% library.branchname | html %]</td>
192                         <td>[% library.branchcode | html %]</td>
193                         <td>
194                             [% IF library.branchaddress1 %]
195                                 [% library.branchaddress1 | html %][% END %]
196                             [% IF library.branchaddress2 %]
197                                 <br />[% library.branchaddress2 | html %][% END %]
198                             [% IF library.branchaddress3 %]
199                                 <br />[% library.branchaddress3 | html %][% END %]
200                             [% IF library.branchcity %]
201                                 <br />[% library.branchcity | html %][% END %][% IF ( library.branchstate ) %],
202                                 [% library.branchstate | html %][% END %]
203                             [% IF library.branchzip %]
204                                 [% library.branchzip | html %][% END %]
205                             [% IF library.branchcountry %]
206                                 <br />[% library.branchcountry | html %][% END %]
207                             [% IF library.branchphone %]
208                                 <br />Ph: [% library.branchphone | html %][% END %]
209                             [% IF library.branchfax %]
210                                 <br />Fax: [% library.branchfax | html %][% END %]
211                             [% IF library.branchemail %]
212                                 <br /><a href="mailto:[% library.branchemail | html %]">[% library.branchemail | html %]</a>[% END %]
213                             [% IF library.branchurl %]
214                                 <br /><a href="[% library.branchurl | html %]">[% library.branchurl | html %]</a>[% END %]
215                             [% IF library.opac_info %]
216                                 <br />OPAC Info: <div>[% library.opac_info | $raw %]</div>[% END %]
217                             [% IF library.branchnotes %]
218                                 <br />Notes: [% library.branchnotes | html %][% END %]
219                         </td>
220                         <td>[% library.marcorgcode | html %]</td>
221                         <td>[% library.branchip | html %]</td>
222                         <td class="actions">
223                             <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/branches.pl?op=add_form&amp;branchcode=[% library.branchcode |uri %]"><i class="fa fa-pencil"></i> Edit</a>
224                             <form action="/cgi-bin/koha/admin/branches.pl" method="post">
225                                 <input type="hidden" name="branchcode" value="[% library.branchcode | html %]" />
226                                 <input type="hidden" name="op" value="delete_confirm" />
227                                 <button type="submit" id="delete_library_[% library.branchcode | html %]" class="btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</button>
228                             </form>
229                         </td>
230                     </tr>
231                 [% END %]
232             </tbody>
233         </table>
234     [% ELSE %]
235         <div class="dialog message">There are no libraries defined. <a href="/cgi-bin/koha/admin/branches.pl?op=add_form">Start defining libraries</a>.</div>
236     [% END %]
237 [% END %]
238
239 </div>
240 </div>
241 <div class="yui-b">
242 [% INCLUDE 'admin-menu.inc' %]
243 </div>
244 </div>
245
246 [% MACRO jsinclude BLOCK %]
247     [% Asset.js("js/admin-menu.js") | $raw %]
248     [% INCLUDE 'datatables.inc' %]
249     [% Asset.js("lib/tiny_mce/tiny_mce.js") | $raw %]
250     <script type="text/javascript">
251         $(document).ready(function() {
252             $("#branchest").dataTable($.extend(true, {}, dataTablesDefaults, {
253                 "aoColumnDefs": [
254                     { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
255                 ],
256                 "iDisplayLength": 10,
257                 "sPaginationType": "four_button"
258             }));
259
260             [% UNLESS library %]
261                 $("#Aform").on("submit", function( event ) {
262                     if ( $("#branchcode").val().match(/\s/) ) {
263                         event.preventDefault();
264                         alert(_("The library code entered contains whitespace characters. Please remove any whitespace characters from the library code"));
265                         return false;
266                     } else {
267                         return true;
268                     }
269                 });
270             [% END %]
271         });
272         tinyMCE.baseURL = "[% interface | html %]/lib/tiny_mce";
273         tinyMCE.init({
274             mode : "textareas",
275             theme : "advanced",
276             content_css : "[% interface | html %]/[% theme | html %]/css/tinymce.css",
277             plugins : "table,save,advhr,advlink,contextmenu",
278             theme_advanced_buttons1 : "save,|,bold,italic,|,cut,copy,paste,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,|,link,unlink,anchor,cleanup,help,code,advhr,",
279             theme_advanced_buttons2 : "tablecontrols,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,removeformat,|,visualaid,|,sub,sup,|,charmap",
280             // theme_advanced_buttons3 : "",
281             theme_advanced_toolbar_location : "top",
282             theme_advanced_toolbar_align : "left",
283             theme_advanced_path_location : "bottom",
284             theme_advanced_resizing : true,
285             apply_source_formatting : true
286         });
287     </script>
288 [% END %]
289
290 [% INCLUDE 'intranet-bottom.inc' %]