Bug 13618: Add html filters to all the variables
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / cities.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% SET footerjs = 1 %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha &rsaquo; Administration &rsaquo; [% IF op =='add_form' %]Cities &rsaquo; [% IF city.cityid %] Modify city[% ELSE %] New city[% END %][% ELSE %][% IF op == 'delete_confirm' %]Cities &rsaquo; Confirm deletion of city[% ELSE %] Cities[% END %][% END %]</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 [% Asset.css("css/datatables.css") | $raw %]
8 </head>
9
10 <body id="admin_cities" class="admin">
11 [% INCLUDE 'header.inc' %]
12 [% INCLUDE 'cities-admin-search.inc' %]
13
14 <div id="breadcrumbs">
15     <a href="/cgi-bin/koha/mainpage.pl">Home</a>
16     &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
17     &rsaquo; <a href="/cgi-bin/koha/admin/cities.pl">Cities</a>
18     [% IF op == 'add_form' %]
19     &rsaquo; [% IF city.cityid %]Modify[% ELSE %]New[% END %] City
20     [% ELSIF op == 'delete_confirm' %]
21     &rsaquo; Confirm deletion of city
22     [% END %]
23 </div>
24
25 <div id="doc3" class="yui-t2">
26
27    <div id="bd">
28     <div id="yui-main">
29     <div class="yui-b">
30
31 [% FOR m IN messages %]
32     <div class="dialog [% m.type | html %]">
33         [% SWITCH m.code %]
34         [% CASE 'error_on_update' %]
35             An error occurred when updating this city. Perhaps it already exists.
36         [% CASE 'error_on_insert' %]
37             An error occurred when adding this city. The city id might already exist.
38         [% CASE 'error_on_delete' %]
39             An error occurred when deleting this city. Check the logs.
40         [% CASE 'success_on_update' %]
41             City updated successfully.
42         [% CASE 'success_on_insert' %]
43             City added successfully.
44         [% CASE 'success_on_delete' %]
45             City deleted successfully.
46         [% CASE 'already_exists' %]
47             This city already exists.
48         [% CASE %]
49             [% m.code | html %]
50         [% END %]
51     </div>
52 [% END %]
53
54 [% IF op == 'add_form' %]
55     [% IF city %]
56         <h1>Modify a city</h1>
57     [% ELSE %]
58         <h1>New city</h1>
59     [% END %]
60
61     <form action="/cgi-bin/koha/admin/cities.pl" name="Aform" method="post" class="validated">
62         <input type="hidden" name="op" value="add_validate" />
63         <input type="hidden" name="cityid" value="[% city.cityid | html %]" />
64
65         <fieldset class="rows">
66             <ol>
67                 [% IF city %]
68                     <li><span class="label">City ID: </span>[% city.cityid | html %]</li>
69                 [% END %]
70                 <li>
71                     <label for="city_name" class="required">City: </label>
72                     <input type="text" name="city_name" id="city_name" size="80" maxlength="100" value="[% city.city_name | html %]" required="required" class="required" /> <span class="required">Required</span>
73                 </li>
74                 <li>
75                     <label for="city_state">State: </label>
76                     <input type="text" name="city_state" id="city_state" size="80" maxlength="100" value="[% city.city_state | html %]" />
77                 </li>
78                 <li>
79                     <label for="city_zipcode" class="required">ZIP/Postal code: </label>
80                     <input type="text" name="city_zipcode" id="city_zipcode" size="20" maxlength="20" value="[% city.city_zipcode | html %]" required="required" class="required" /> <span class="required">Required</span>
81                 </li>
82                 <li>
83                     <label for="city_country">Country: </label>
84                     <input type="text" name="city_country" id="city_country" size="80" maxlength="100" value="[% city.city_country | html %]" />
85                 </li>
86             </ol>
87         </fieldset>
88
89         <fieldset class="action">
90             <input type="submit" value="Submit" />
91             <a class="cancel" href="/cgi-bin/koha/admin/cities.pl">Cancel</a>
92         </fieldset>
93     </form>
94 [% END %]
95
96 [% IF op == 'delete_confirm' %]
97     <div class="dialog alert">
98         <h3>Delete city "[% city.city_name | html %]?"</h3>
99         <table>
100             <tr><th>City id</th>
101                 <td>[% city.cityid | html %]</td>
102             </tr>
103             <tr><th>City</th>
104                 <td>[% city.city_name | html %]</td>
105             </tr>
106             <tr><th>State</th>
107                 <td>[% city.city_state | html %]</td>
108             </tr>
109             <tr><th>ZIP/Postal code</th>
110                 <td>[% city.city_zipcode | html %]</td>
111             </tr>
112             <tr><th>Country</th>
113                 <td>[% city.city_country | html %]</td>
114             </tr>
115         </table>
116         <form action="/cgi-bin/koha/admin/cities.pl" method="post">
117             <input type="hidden" name="op" value="delete_confirmed" />
118             <input type="hidden" name="cityid" value="[% city.cityid | html %]" />
119             <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
120         </form>
121         <form action="/cgi-bin/koha/admin/cities.pl" method="get">
122             <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
123         </form>
124     </div>
125 [% END %]
126
127 [% IF op == 'list' %]
128
129     <div id="toolbar" class="btn-toolbar">
130         <a class="btn btn-default btn-sm" id="newcity" href="/cgi-bin/koha/admin/cities.pl?op=add_form"><i class="fa fa-plus"></i> New city</a>
131     </div>
132
133     <h2>Cities</h2>
134     [% IF searchfield %]
135         Searching: [% searchfield | html %]
136     [% END %]
137
138     [% IF cities.count %]
139         <table id="table_cities">
140             <thead>
141                 <th>City ID</th>
142                 <th>City</th>
143                 <th>State</th>
144                 <th>ZIP/Postal code</th>
145                 <th>Country</th>
146                 <th>Actions</th>
147             </thead>
148             <tbody>
149                 [% FOREACH city IN cities %]
150                 <tr>
151                     <td>[% city.cityid | html %]</td>
152                     <td>[% city.city_name | html %]</td>
153                     <td>[% city.city_state | html %]</td>
154                     <td>[% city.city_zipcode | html %]</td>
155                     <td>[% city.city_country | html %]</td>
156                     <td class="actions">
157                         <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/cities.pl?op=add_form&amp;cityid=[% city.cityid | html %]"><i class="fa fa-pencil"></i> Edit</a>
158                         <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/cities.pl?op=delete_confirm&amp;cityid=[% city.cityid | html %]"><i class="fa fa-trash"></i> Delete</a>
159                     </td>
160                 </tr>
161                 [% END %]
162             </tbody>
163         </table>
164     [% ELSE %]
165         <div class="dialog message">
166             There are no cities defined. <a href="/cgi-bin/koha/admin/cities.pl?op=add_form">Create a new city</a>.
167         </div>
168     [% END %]
169 [% END %]
170
171 </div>
172 </div>
173 <div class="yui-b">
174 [% INCLUDE 'admin-menu.inc' %]
175 </div>
176 </div>
177
178 [% MACRO jsinclude BLOCK %]
179     [% Asset.js("js/admin-menu.js") | $raw %]
180     [% INCLUDE 'datatables.inc' %]
181     <script type="text/javascript">
182         $(document).ready(function() {
183             $("#table_cities").dataTable($.extend(true, {}, dataTablesDefaults, {
184                 "aoColumnDefs": [
185                     { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
186                 ],
187                 "aaSorting": [[ 1, "asc" ]],
188                 "iDisplayLength": 10,
189                 "sPaginationType": "full_numbers"
190             }));
191         });
192     </script>
193 [% END %]
194 [% INCLUDE 'intranet-bottom.inc' %]