Merge remote-tracking branch 'origin/new/bug_5347'
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / branches.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Administration &rsaquo; Libraries and groups
3 [% IF ( editcategory ) %]
4     &rsaquo;[% IF ( categorycode ) %]Edit group [% categorycode %][% ELSE %]New group[% END %]
5 [% ELSIF ( delete_category ) %]
6     &rsaquo; Confirm deletion of group [% categorycode %]
7 [% ELSIF ( add ) %]
8     &rsaquo;[% IF ( heading_branches_add_branch_p ) %]New library[% ELSE %]Modify library [% branchcode %][% END %]
9 [% ELSIF ( delete_confirm ) %]
10     &rsaquo; Confirm deletion of library '[% branchcode %]'
11 [% END %]
12 </title>
13 [% INCLUDE 'doc-head-close.inc' %]
14 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
15 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.pager.js"></script>
16 <script type="text/javascript" src="[% themelang %]/js/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
17 <script language="javascript" type="text/javascript">
18 tinyMCE.init({
19     mode : "textareas",
20     theme : "advanced",
21     content_css : "[% themelang %]/css/tinymce.css",
22     plugins : "table,save,advhr,advlink,iespell,contextmenu",
23     theme_advanced_buttons1 : "save,|,bold,italic,|,cut,copy,paste,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,|,link,unlink,anchor,cleanup,help,code,advhr,",
24     theme_advanced_buttons2 : "tablecontrols,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,removeformat,|,visualaid,|,sub,sup,|,charmap",
25     theme_advanced_buttons3 : "",
26     theme_advanced_toolbar_location : "top",
27     theme_advanced_toolbar_align : "left",
28     theme_advanced_path_location : "bottom",
29     theme_advanced_resizing : true,
30     apply_source_formatting : true,
31     height : "300",
32     width : "700"
33 });
34 </script>
35 </head>
36 <body id="admin_branches" class="admin">
37 [% INCLUDE 'header.inc' %]
38 [% INCLUDE 'cat-search.inc' %]
39
40 <div id="breadcrumbs">
41     <a href="/cgi-bin/koha/mainpage.pl">Home</a>
42 &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
43 &rsaquo; <a href="/cgi-bin/koha/admin/branches.pl">Libraries and groups</a>
44 [% IF ( editcategory ) %]
45 &rsaquo; [% IF ( categorycode ) %]Edit group [% categorycode %][% ELSE %]New group[% END %]
46 [% ELSIF ( delete_category ) %]
47 &rsaquo; Confirm deletion of group [% categorycode %]
48 [% ELSIF ( add ) %]
49 &rsaquo; [% IF ( heading_branches_add_branch_p ) %]New library[% ELSE %]Modify library [% branchcode %][% END %]
50 [% ELSIF ( delete_confirm ) %]
51 &rsaquo; Confirm deletion of library '[% branchcode %]'
52 [% END %]
53 </div>
54
55 <div id="doc3" class="yui-t2">
56    
57    <div id="bd">
58         <div id="yui-main">
59         <div class="yui-b">
60         [% IF ( else ) %]
61         <div id="toolbar">
62         <script type="text/javascript">
63         //<![CDATA[
64
65         // prepare DOM for YUI Toolbar
66
67          $(document).ready(function() {
68             yuiToolbar();
69                 $.tablesorter.defaults.widgets = ['zebra']; 
70                 $("#branchest").tablesorter({
71                         sortList: [[0,0]],
72                         headers: { 3:{sorter:false},4:{sorter:false},5:{sorter:false},6:{sorter:false}}
73                 }).tablesorterPager({container: $("#pagerbranchest"),positionFixed: false,size: 10}); 
74                 }); 
75         // YUI Toolbar Functions
76
77         function yuiToolbar() {
78             new YAHOO.widget.Button("newbranch");
79                 new YAHOO.widget.Button("newcategory");
80         }
81
82         //]]>
83         </script>
84         <ul class="toolbar">
85     <li><a id="newbranch" href="/cgi-bin/koha/admin/branches.pl?op=add">New library</a></li>
86     <li><a id="newcategory" href="/cgi-bin/koha/admin/branches.pl?op=editcategory">New group</a></li>
87 </ul></div>
88 [% END %]
89
90 [% IF ( add ) %]
91     [% IF ( ERROR1 ) %]<div class="dialog message">Library with that code already exists &mdash; Please enter a unique code</div>[% END %]
92   <h3>[% IF ( heading_branches_add_branch_p ) %]New library[% ELSE %]Modify library[% END %]</h3>
93     <form action="[% action %]" name="Aform" method="post">
94         <fieldset class="rows">
95         <input type="hidden" name="op" value="add_validate" />
96         [% IF ( heading_branches_add_branch_p ) %]
97             <input type="hidden" name="add" value="1" />
98         [% ELSE %]
99             <input type="hidden" name="add" value="0" />
100         [% END %]
101         <ol><li>
102             [% IF ( heading_branches_add_branch_p ) %]
103             <label for="branchcode">Library code</label>
104                 <input type="text" name="branchcode" id="branchcode" size="10" maxlength="10" value="[% branchcode |html %]" />
105             [% ELSE %]
106                         <label for="branchcode">Library code</label>
107                 <input type="hidden" name="branchcode" value="[% branchcode |html %]" />
108                 [% branchcode %]
109             [% END %]
110         </li>
111         <li>
112             <label for="branchname">Name</label>
113             <input type="text" name="branchname" id="branchname" size="80" value="[% branch_name |html %]" />&nbsp;
114         </li>
115         </ol>
116         </fieldset>
117         [% IF ( categoryloop ) %]<fieldset class="rows"><legend>Group(s):</legend>
118         <ol>
119                 [% FOREACH categoryloo IN categoryloop %]
120             <li><label for="[% categoryloo.categorycode %]">[% categoryloo.categoryname %]</label>
121                 [% IF ( categoryloo.checked ) %]
122                     <input type="checkbox" id="[% categoryloo.categorycode %]" name="[% categoryloo.categorycode %]" checked="checked" />
123                 [% ELSE %]
124                     <input type="checkbox" id="[% categoryloo.categorycode %]" name="[% categoryloo.categorycode %]" />
125                 [% END %]
126                 <span class="hint">[% categoryloo.codedescription %]</span>
127             </li>
128         [% END %]
129                 </ol>
130 </fieldset>[% END %]
131         <fieldset class="rows">
132         <ol>
133         <li><label for="branchaddress1">Address line 1</label><input type="text" name="branchaddress1" id="branchaddress1" value="[% branchaddress1 |html %]" /></li>
134         <li><label for="branchaddress2">Address line 2</label><input type="text" name="branchaddress2" id="branchaddress2" value="[% branchaddress2 |html %]" /></li>
135         <li><label for="branchaddress3">Address line 3</label><input type="text" name="branchaddress3" id="branchaddress3" value="[% branchaddress3 |html %]" /></li>
136         <li><label for="branchcity">City</label><input type="text" name="branchcity" id="branchcity" value="[% branchcity |html %]" /></li>
137         <li><label for="branchstate">State</label><input type="text" name="branchstate" id="branchstate" value="[% branchstate |html %]" /></li>
138         <li><label for="branchzip">Zip/Postal code</label><input type="text" name="branchzip" id="branchzip" value="[% branchzip |html %]" /></li>
139         <li><label for="branchcountry">Country</label><input type="text" name="branchcountry" id="branchcountry" value="[% branchcountry |html %]" /></li>
140         <li><label for="branchphone">Phone</label><input type="text" name="branchphone" id="branchphone" value="[% branchphone |html %]" /></li>
141         <li><label for="branchfax">Fax</label><input type="text" name="branchfax" id="branchfax" value="[% branchfax |html %]" /></li>
142         <li><label for="branchemail">Email</label><input type="text" name="branchemail" id="branchemail" value="[% branchemail |html %]" /></li>
143         <li><label for="branchurl">URL</label><input type="text" name="branchurl" id="branchurl" value="[% branchurl |html %]" /></li>
144         <li><label for="opac_info">OPAC info</label><textarea name="opac_info" id="opac_info">[% opac_info |html %]</textarea></li>
145         <li><label for="branchip">IP</label><input type="text" name="branchip" id="branchip" value="[% branchip |html %]" /> <span class="hint">Can be entered as a single IP, or a subnet such as 192.168.1.*</span></li>
146                 <!--
147         <li><label for="branchprinter">Library Printer</label>
148             <select id="branchprinter" name="branchprinter">
149                 <option value="">None</option>
150             [% FOREACH printerloo IN printerloop %]
151                 [% IF ( printerloo.selected ) %]
152                                 <option value="[% printerloo.value %]" selected="selected">[% printerloo.branchprinter %]</option>
153                                 [% ELSE %]
154                                 <option value="[% printerloo.value %]">[% printerloo.branchprinter %]</option>
155                                 [% END %]
156                 [% END %]
157             </select></li>
158                         -->
159         <li><label for="branchnotes">Notes</label><input type="text" name="branchnotes" id="branchnotes" value="[% branchnotes |html %]" /></li>
160         </ol>
161         </fieldset>
162         <fieldset class="action"><input type="submit" value="Submit" /> <a class="cancel" href="/cgi-bin/koha/admin/branches.pl">Cancel</a></fieldset>
163     </form>
164 [% END %]
165
166 [% IF ( delete_confirm ) %]
167     <form action="[% action %]" method="post">
168 <fieldset><legend>Confirm deletion of [% branchname %] ([% branchcode %])?</legend><input type="hidden" name="op" value="delete_confirmed" />
169         <input type="hidden" name="branchcode" value="[% branchcode |html %]" />
170         <input type="hidden" name="branchname" value="[% branchname |html %]">
171         <fieldset class="action"><input type="submit" value="Delete Library" /> <a class="cancel" href="/cgi-bin/koha/admin/branches.pl">Cancel</a></fieldset>
172 </fieldset></form>
173 [% END %]
174
175 [% IF ( else ) %]
176     <h3>Libraries</h3>
177     [% IF ( message ) %]<div class="dialog message">
178         [% message %]</div>[% END %]
179     [% IF ( MESSAGE1 ) %]<div class="dialog message">Library not saved &mdash; code and/or name missing</div>[% END %]
180     [% IF ( MESSAGE2 ) %]<div class="dialog message">Library saved</div>[% END %]
181     [% IF ( MESSAGE3 ) %]<div class="dialog message">Library deleted</div>[% END %]
182     [% IF ( MESSAGE4 ) %]<div class="dialog message">Library category added</div>[% END %]
183     [% IF ( MESSAGE5 ) %]<div class="dialog message">Library category modified</div>[% END %]
184     [% IF ( MESSAGE6 ) %]<div class="dialog message">Library category deleted</div>[% END %]
185     [% IF ( MESSAGE7 ) %]<div class="dialog message">Library cannot be deleted because there are patrons and items using that library</div>[% END %]
186     [% IF ( MESSAGE8 ) %]<div class="dialog message">Category cannot be deleted because there are libraries using that category</div>[% END %]
187     [% IF ( MESSAGE9 ) %]<div class="dialog message">Category cannot be added, categorycode already exists</div>[% END %]
188     [% IF ( MESSAGE10 ) %]<div class="dialog message">Library cannot be deleted because there are items held by that library</div>[% END %]
189     [% IF ( MESSAGE11 ) %]<div class="dialog message">Library cannot be deleted because there are patrons registered at that library</div>[% END %]
190 [% IF ( branches ) %]
191 <div id="pagerbranchest">
192 [% INCLUDE 'table-pager.inc' perpage='10' %]
193 </div>
194     <table id="branchest">
195 <thead><tr>
196                         <th>Name</th>
197             <th>Code</th>
198             <th>Address</th>
199             <th>Properties</th>
200             <th>IP</th>
201             <!-- <th>Printer</th> -->
202             <th colspan="2">&nbsp;</th>
203         </tr></thead><tbody>
204         [% FOREACH branche IN branches %]
205         [% IF ( loop.odd ) %]
206         <tr>
207         [% ELSE %]
208                 <tr class="highlight">
209         [% END %]
210                 <td>[% branche.branch_name |html %]</td>
211                 <td>[% branche.branch_code |html %]</td>
212                 <td>
213                     [% IF ( branche.address_empty_p ) %]
214                         (nothing entered)
215                     [% ELSE %]
216                         [% IF ( branche.branchaddress1 ) %]
217                             [% branche.branchaddress1 |html %][% END %]
218                         [% IF ( branche.branchaddress2 ) %]
219                             <br />[% branche.branchaddress2 |html %][% END %]
220                         [% IF ( branche.branchaddress3 ) %]
221                             <br />[% branche.branchaddress3 |html %][% END %]
222                         [% IF ( branche.branchcity ) %]
223                             <br />[% branche.branchcity |html %][% END %][% IF ( branche.branchstate ) %],
224                             [% branche.branchstate |html %][% END %]
225                         [% IF ( branche.branchzip ) %]
226                             [% branche.branchzip |html %][% END %]
227                         [% IF ( branche.branchcountry ) %]
228                             <br />[% branche.branchcountry |html %][% END %]
229                         [% IF ( branche.branchphone ) %]
230                             <br />Ph: [% branche.branchphone |html %][% END %]
231                         [% IF ( branche.branchfax ) %]
232                             <br />Fax: [% branche.branchfax |html %][% END %]
233                         [% IF ( branche.branchemail ) %]
234                             <br /><a href="mailto:[% branche.branchemail %]">[% branche.branchemail |html %]</a>[% END %]
235                         [% IF ( branche.branchurl ) %]
236                             <br /><a href="[% branche.branchurl %]">[% branche.branchurl |html %]</a>[% END %]
237                         [% IF ( branche.opac_info ) %]
238                             <br />OPAC Info: <div>[% branche.opac_info %]</div>[% END %]
239                         [% IF ( branche.branchnotes ) %]
240                             <br />Notes: [% branche.branchnotes |html %][% END %]
241                     [% END %]
242                 </td>
243                 <td>
244                     [% UNLESS ( branche.no_categories_p ) %]
245                         [% FOREACH category_lis IN branche.category_list %]
246                             [% category_lis.categoryname %]<br />
247                         [% END %]
248                     [% END %]
249                 </td>
250                 <td>
251                     [% branche.branchip %]
252                 </td>
253                 <!-- <td>
254                     [% branche.branchprinter %]
255                 </td> -->
256                 <td>
257                     <a href="[% branche.action %]?op=edit&amp;branchcode=[% branche.value |url %]">Edit</a>
258                 </td>
259                 <td>
260                     <a href="[% branche.action %]?branchcode=[% branche.value |url %]&amp;branchname=[% branche.branch_name |url %]&amp;op=delete">Delete</a>
261                 </td>
262             </tr>
263         [% END %]</tbody>
264     </table>
265         [% ELSE %]
266         <div class="dialog message">There are no libraries defined. <a href="/cgi-bin/koha/admin/branches.pl?op=add">Start defining libraries</a>.</div>
267         [% END %]
268     
269    [% IF ( branchcategories ) %]
270    [% FOREACH branchcategorie IN branchcategories %]
271     <h3>Group(s):  [% IF ( branchcategorie.properties ) %]Properties[% ELSE %][% IF ( branchcategorie.searchdomain ) %]Search domain[% END %][% END %]</h3>
272         <table>
273     <tr>
274         <th>Name</th>
275         <th>Code</th>
276         <th>Description</th>
277         <th>&nbsp;</th>
278         <th>&nbsp;</th>
279     </tr>
280 [% IF ( branchcategorie.catloop ) %][% FOREACH catloo IN branchcategorie.catloop %]
281         <tr>
282         <td>[% catloo.categoryname %]</td>
283         <td>[% catloo.categorycode %]</td>
284         <td>[% catloo.codedescription %]</td>
285         <td><a href="[% catloo.action %]?op=editcategory&amp;categorycode=[% catloo.categorycode |url %]">Edit</a>
286         </td>
287         <td><a href="[% catloo.action %]?op=delete_category&amp;categorycode=[% catloo.categorycode |url %]">Delete</a>
288         </td>
289         </tr>
290     [% END %][% ELSE %]<tr><td colspan="5">No [% IF ( branchcategorie.properties ) %]properties[% ELSIF ( branchcategorie.searchdomain ) %]search domain[% END %] defined</td></tr>[% END %]
291     </table>
292     [% END %]
293     [% ELSE %]
294         <p>No groups defined.</p>
295     [% END %] <!-- NAME="branchcategories" -->
296 [% END %]
297
298 [% IF ( editcategory ) %]
299     <h3>[% IF ( categorycode ) %]Edit group [% categorycode %][% ELSE %]Add group[% END %]</h3>
300     <form action="[% action %]" name="Aform" method="post">
301     <input type="hidden" name="op" value="addcategory_validate" />
302         [% IF ( categorycode ) %]
303         <input type="hidden" name="add" value="0">
304         [% ELSE %]
305         <input type="hidden" name="add" value="1">
306         [% END %]
307     <fieldset class="rows">
308         
309         <ol><li>
310                 [% IF ( categorycode ) %]
311                                 <span class="label">Category code: </span>
312                     <input type="hidden" name="categorycode" id="categorycode" value="[% categorycode |html %]" />
313                     [% categorycode %]
314                 [% ELSE %]
315                 <label for="categorycode">Category code:</label>
316                     <input type="text" name="categorycode" id="categorycode" size="10" maxlength="10" value="[% categorycode |html %]" />
317                 [% END %]
318             </li>
319         <li>
320             <label for="categoryname">Name: </label>
321             <input type="text" name="categoryname" id="categoryname" size="32" maxlength="32" value="[% categoryname |html %]" />
322         </li>
323         <li>
324             <label for="codedescription">Description: </label>
325             <input type="text" name="codedescription" id="codedescription" size="70" value="[% codedescription |html %]" />
326         </li>
327                 <li>
328         <label for="categorytype">Category type: </label>
329             <select id="categorytype" name="categorytype">
330             [% FOREACH categorytyp IN categorytype %]
331                 [% IF ( categorytyp.selected ) %]
332                     <option value="[% categorytyp.type %]" selected="selected">
333                 [% ELSE %]
334                     <option value="[% categorytyp.type %]">
335                 [% END %] [% categorytyp.type %]</option>
336             [% END %]
337             </select>
338                 </li>
339                 </ol>
340     </fieldset>
341         <fieldset class="action"><input type="submit" value="Update" /></fieldset>
342     </form>
343 [% END %]
344
345 [% IF ( delete_category ) %]
346     [% UNLESS ( MESSAGE8 ) %]
347     <div class="dialog message"> 
348     Confirm delete:
349     <form action="[% action %]" method="post">
350         <input type="hidden" name="op" value="categorydelete_confirmed" />
351         <input type="hidden" name="categorycode" value="[% categorycode |html %]" />
352         <input type="submit" value="YES" />
353     </form>
354     <form action="[% action %]" method="post"><input type="hidden" name="op" value="">
355         <input type="submit" value="NO" />
356     </form>
357     </div>
358     [% END %]
359 [% END %]
360
361 </div>
362 </div>
363 <div class="yui-b">
364 [% INCLUDE 'admin-menu.inc' %]
365 </div>
366 </div>
367 [% INCLUDE 'intranet-bottom.inc' %]