[% IF ( delete_confirmed ) %]Category deleted[% END %]</title>
[% INCLUDE 'doc-head-close.inc' %]
[% INCLUDE 'calendar.inc' %]
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.pager.js"></script>
-<script type="text/javascript" id="js">$(document).ready(function() {
- $("#table_categorie").tablesorter({
- sortList: [[0,0]],
- widgets: ['zebra'],
- headers: { 11: { sorter: false}}
- }).tablesorterPager({container: $("#pagertable_categorie"),positionFixed: false,size: 20});
- $( "#enrolmentperioddate" ).datepicker({ minDate: 1 }); // Require that "until date" be in the future
-}); </script>
-<script type="text/javascript">
+<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
+<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
+[% INCLUDE 'datatables-strings.inc' %]
+<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
+<script type="text/javascript" id="js">
//<![CDATA[
- //
+ $(document).ready(function() {
+ $("#table_categorie").dataTable($.extend(true, {}, dataTablesDefaults, {
+ "aoColumnDefs": [
+ { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
+ { "aTargets": [ 3,4,5 ], "sType": "natural" },
+ ],
+ "aaSorting": [[ 1, "asc" ]],
+ "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
+ "iDisplayLength": 20,
+ "sPaginationType": "four_button"
+ }));
+
+ $( "#enrolmentperioddate" ).datepicker({ minDate: 1 }); // Require that "until date" be in the future
+
+ if ( $("#branches option:selected").length < 1 ) {
+ $("#branches option:first").attr("selected", "selected");
+ }
+});
function isNotNull(f,noalert) {
if (f.value.length ==0) {
return false;
var ok=0;
var _alertString=_("Form not submitted because of the following problem(s)");
_alertString +="\n-------------------------------------------------------------------\n\n";
- if (ff.categorycode.value.length==0) {
- ok=1;
- _alertString += _("- categorycode missing") + "\n";
- }
+ ff.categorycode.value = ff.categorycode.value.trim();
+ if (ff.categorycode.value.length==0) {
+ ok=1;
+ _alertString += _("- categorycode missing") + "\n";
+ }
+ else{
+ var patt=/^[a-zA-Z0-9\-_]+$/g;
+ if ( !patt.test(ff.categorycode.value) ) {
+ ok=1;
+ _alertString += _("- category code can only contain the following characters: letters, numbers, - and _") + "\n";
+ }
+ }
if (!(ff.category_type.value)){
ok=1;
_alertString += _("- category type missing") + "\n";
[% END %]
<fieldset class="rows">
<ol>[% IF ( categorycode ) %]
- <li><span class="label">Category code</span>[% categorycode |html %]
+ <li><span class="label">Category code: </span>[% categorycode |html %]
<input type="hidden" name="categorycode" value="[% categorycode |html %]" /><input type="hidden" name="is_a_modif" value="1" /></li>
[% ELSE %]
- <li><label for="categorycode">Category code: </label> <input type="text" name="categorycode" id="categorycode" size="10" maxlength="10" onblur="toUC(this)" /></li>
+ <li><label for="categorycode">Category code: </label> <input type="text" name="categorycode" id="categorycode" size="10" maxlength="10" onblur="toUC(this)" /></li>
[% END %]
<li><label for="description">Description: </label> <input type="text" name="description" id="description" size="40" maxlength="80" value="[% description |html %]" /></li>
<li><label for="enrolmentperiod">Enrollment period: </label>
<option value="1">Yes</option>
[% END %]
</select></li>
- <li><label for="hidelostitems">Lost items in staff client</label> <select name="hidelostitems" id="hidelostitems">
+ <li><label for="hidelostitems">Lost items in staff client: </label> <select name="hidelostitems" id="hidelostitems">
[% IF ( hidelostitems ) %]
<option value="0">Shown</option>
<option value="1" selected="selected">Hidden by default</option>
[% IF ( type_P ) %]<option value="P" selected="selected">Professional</option>[% ELSE %]<option value="P">Professional</option>[% END %]
[% IF ( type_X ) %]<option value="X" selected="selected">Statistical</option>[% ELSE %]<option value="X">Statistical</option>[% END %]
</select>
- </li></ol>
+ </li>
+ <li><label for="branches">Branches limitation: </label>
+ <select id="branches" name="branches" multiple size="10">
+ <option value="">All branches</option>
+ [% FOREACH branch IN branches_loop %]
+ [% IF ( branch.selected ) %]
+ <option selected="selected" value="[% branch.branchcode %]">[% branch.branchname %]</option>
+ [% ELSE %]
+ <option value="[% branch.branchcode %]">[% branch.branchname %]</option>
+ [% END %]
+ [% END %]
+ </select>
+ <span>Select All if this category type must to be displayed all the time. Otherwise select librairies you want to associate with this value.
+ </span>
+ </li>
+ </ol>
</fieldset>
[% IF ( EnhancedMessagingPreferences ) %]
[% IF ( else ) %]
-<div id="toolbar">
- <script type="text/javascript">
- //<![CDATA[
-
- // prepare DOM for YUI Toolbar
-
- $(document).ready(function() {
- yuiToolbar();
- });
-
- // YUI Toolbar Functions
-
- function yuiToolbar() {
- new YAHOO.widget.Button("newcategory");
- }
-
- //]]>
- </script>
- <ul class="toolbar">
- <li><a id="newcategory" href="/cgi-bin/koha/admin/categorie.pl?op=add_form">New category</a></li>
-</ul></div>
+<div id="toolbar" class="btn-toolbar">
+ <a class="btn btn-small" id="newcategory" href="/cgi-bin/koha/admin/categorie.pl?op=add_form"><i class="icon-plus"></i> New category</a>
+</div>
<h2>Patron category administration</h2>
[% IF ( searchfield ) %]
[% END %]
[% IF ( loop ) %]
<div id="pagertable_categorie">
-[% INCLUDE 'table-pager.inc' perpage='20' %]
</div>
<table id="table_categorie">
<thead>
+ <tr>
<th scope="col">Code</th>
<th scope="col">Category name</th>
<th scope="col">Type</th>
[% IF ( EnhancedMessagingPreferences ) %]
<th scope="col">Messaging</th>
[% END %]
- <th scope="col" colspan="2"> </th>
+ <th scope="col">Branches limitations</th>
+ <th scope="col"> </th>
+ <th scope="col"> </th>
+ </tr>
</thead>
+ <tbody>
[% FOREACH loo IN loop %]
<tr>
<td>[% loo.categorycode |html %]</td>
<td>
- <a href="[% loo.script_name %]?op=add_form&categorycode=[% loo.categorycode |url %]">[% loo.description |html %]</a>
+ <a href="[% loo.script_name %]?op=add_form&categorycode=[% loo.categorycode |uri %]">[% loo.description |html %]</a>
</td>
<td>
[% IF ( loo.type_A ) %]Adult[% END %]
[% END %]
</td>
[% END %]
- <td><a href="[% loo.script_name %]?op=add_form&categorycode=[% loo.categorycode |url %]">Edit</a></td>
- <td><a href="[% loo.script_name %]?op=delete_confirm&categorycode=[% loo.categorycode |url %]">Delete</a></td>
+ <td>
+ [% IF loo.branches.size > 0 %]
+ [% branches_str = "" %]
+ [% FOREACH branch IN loo.branches %]
+ [% branches_str = branches_str _ " " _ branch.branchname _ "(" _ branch.branchcode _ ")" %]
+ [% END %]
+ <span title="[% branches_str %]">
+ [% IF loo.branches.size > 1 %]
+ [% loo.branches.size %] branches limitations
+ [% ELSE %]
+ [% loo.branches.size %] branch limitation
+ [% END %]
+ </span>
+ [% ELSE %]
+ No limitation
+ [% END %]
+ </td>
+ <td><a href="[% loo.script_name %]?op=add_form&categorycode=[% loo.categorycode |uri %]">Edit</a></td>
+ <td><a href="[% loo.script_name %]?op=delete_confirm&categorycode=[% loo.categorycode |uri %]">Delete</a></td>
</tr>
[% END %]
+ </tbody>
</table>
[% ELSE %]
<div class="dialog alert">No categories have been defined. <a href="/cgi-bin/koha/admin/categorie.pl?op=add_form">Create a new category</a>.</div>