Koha/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt
Owen Leonard 2b74492d7d Bug 8181 [REVISED] Replace DynArch calendar widget with jQueryUI version
All instances of the old DynArch calendar have been replaced with
jQueryUI versions and the old library files have been removed.

calendar.inc has been modified to include jQueryUI localization
strings and global configuration options. Just add a "datepicker"
class to an input field to trigger a datepicker prompt.

If you would like two fields in one from to limit each other (one
is date from, one is date to), add these classes to each:
"datepickerfrom" and "datepickerto." This will prevent an invalid
entry, e.g. a date in the latter which falls before the former.

jQueryUI is now upgraded to the latest verision, 1.8.21.

Edit: Now with proper translatability, date formatting, first day
of the week handling, and RTL support.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Ian Walls <koha.sekjal@gmail.com>
QA Comment:  rebased on current master; minor merge conflicts with other patches pushed

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-06-25 18:26:26 +02:00

356 lines
16 KiB
Text

[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Administration &rsaquo; Patron categories &rsaquo; [% IF ( add_form ) %][% IF ( categorycode ) %]Modify category '[% categorycode |html %]'[% ELSE %]New category[% END %][% END %]
[% IF ( add_validate ) %]Data recorded[% END %]
[% IF ( delete_confirm ) %][% IF ( totalgtzero ) %]Cannot delete: category [% categorycode |html %] in use[% ELSE %]Confirm deletion of category '[% categorycode |html %]'[% END %][% END %]
[% 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">
//<![CDATA[
//
function isNotNull(f,noalert) {
if (f.value.length ==0) {
return false;
}
return true;
}
//
function toUC(f) {
var x=f.value.toUpperCase();
f.value=x;
return true;
}
//
function isNum(v,maybenull) {
var n = new Number(v.value);
if (isNaN(n)) {
return false;
}
if (maybenull==0 && v.value=='') {
return false;
}
return true;
}
//
function isDate(f) {
var t = Date.parse(f.value);
if (isNaN(t)) {
return false;
}
}
// to check if the data are correctly entered.
function Check(ff) {
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";
}
if (!(ff.category_type.value)){
ok=1;
_alertString += _("- category type missing") + "\n";
}
if (!(isNotNull(ff.description,1))) {
ok=1;
_alertString += _("- description missing") + "\n";
}
if (!isNum(ff.upperagelimit,0) && ff.category_type.value=='C') {
ok=1;
_alertString += _("- upperagelimit is not a number") + "\n";
}
if(!(ff.enrolmentperioddate.value || ff.enrolmentperiod.value)) {
ok=1;
_alertString += _("- either Enrollment period or Until date must be provided") + "\n";
}
if(ff.enrolmentperioddate.value && ff.enrolmentperiod.value){
document.getElementById('enrolmentmessage').className = "error";
return false;
}
if (ok) { // if there is a problem
alert(_alertString);
return false;
}
// if all is good
ff.submit();
}
//]]>
</script>
<style type="text/css">#enrolmentmessage.hint { display : none; }</style>
</head>
<body id="admin_categorie" class="admin">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'patrons-admin-search.inc' %]
<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; [% IF ( add_form ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> &rsaquo; [% IF ( categorycode ) %]Modify category '[% categorycode |html %]'[% ELSE %]New category[% END %][% END %]
[% IF ( add_validate ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> &rsaquo; Data recorded[% END %]
[% IF ( delete_confirm ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> &rsaquo; [% IF ( totalgtzero ) %]Cannot delete: Category [% categorycode |html %] in use[% ELSE %]Confirm deletion of category '[% categorycode |html %]'[% END %][% END %]
[% IF ( delete_confirmed ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> &rsaquo; Category deleted[% END %]
[% IF ( else ) %]Patron categories[% END %]</div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
[% IF ( add_form ) %]
<form name="Aform" action="[% script_name %]" method="post">
<input type="hidden" name="op" value="add_validate" />
<input type="hidden" name="checked" value="0" />
[% IF ( categorycode ) %]
<h1>Modify category [% categorycode |html %]</h1>
[% ELSE %]
<h1>New category</h1>
[% END %]
<fieldset class="rows">
<ol>[% IF ( categorycode ) %]
<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>
[% 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>
<fieldset>
<legend>Choose one</legend>
<ol>
<li><label for="enrolmentperiod" style="width:6em;">In months: </label>
<input type="text" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="[% IF ( enrolmentperiod ) %][% enrolmentperiod %][% END %]" /> months</li>
<li><label for="enrolmentperioddate" style="width:6em;">Until date: </label>
<input type="text" name="enrolmentperioddate" id="enrolmentperioddate" value="[% enrolmentperioddate %]" />
<div id="enrolmentmessage" class="hint" style="margin-left:0;">Cannot have "months" and "until date" at the same time</div>
</li>
</ol>
</fieldset>
</li>
<li><label for="dateofbirthrequired">Age required: </label> <input type="text" name="dateofbirthrequired" id="dateofbirthrequired" value="[% dateofbirthrequired %]" size="3" maxlength="3" /> years</li>
<li><label for="upperagelimit">Upperage limit: </label> <input type="text" name="upperagelimit" id="upperagelimit" size="3" maxlength="3" value="[% upperagelimit %]" /> years</li>
<li><label for="enrolmentfee">Enrollment fee: </label><input type="text" name="enrolmentfee" id="enrolmentfee" size="6" value="[% enrolmentfee %]" /></li>
<li><label for="overduenoticerequired">Overdue notice required: </label> <select name="overduenoticerequired" id="overduenoticerequired">
[% IF ( overduenoticerequired ) %]
<option value="0">No</option>
<option value="1" selected="selected">Yes</option>
[% ELSE %]
<option value="0" selected="selected">No</option>
<option value="1">Yes</option>
[% END %]
</select></li>
<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>
[% ELSE %]
<option value="0" selected="selected">Shown</option>
<option value="1">Hidden by default</option>
[% END %]
</select></li>
<li><label for="reservefee">Hold fee: </label><input type="text" name="reservefee" id="reservefee" size="6" value="[% reservefee %]" /></li>
<li><label for="category_type">Category type: </label> <select name="category_type" id="category_type">
[% IF ( type_n ) %]<option value="" selected="selected">Select a category type</option>[% ELSE %]<option value="">Select a category type</option>[% END %]
[% IF ( type_A ) %]<option value="A" selected="selected">Adult</option>[% ELSE %]<option value="A">Adult</option>[% END %]
[% IF ( type_C ) %]<option value="C" selected="selected">Child</option>[% ELSE %]<option value="C">Child</option>[% END %]
[% IF ( type_S ) %]<option value="S" selected="selected">Staff</option>[% ELSE %]<option value="S">Staff</option>[% END %]
[% IF ( type_I ) %]<option value="I" selected="selected">Organization</option>[% ELSE %]<option value="I">Organization</option>[% END %]
[% 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>
</fieldset>
[% IF ( EnhancedMessagingPreferences ) %]
<fieldset class="rows">
<h4>Default messaging preferences for this patron category</h4>
[% INCLUDE 'messaging-preference-form.inc' %]
</fieldset>
[% END %]
<fieldset class="action"><input type="button" value="Save" onclick="Check(this.form);" /> </fieldset>
</form>
[% END %]
[% IF ( add_validate ) %]
<h3>Data recorded</h3>
<form action="[% script_name %]" method="post">
<input type="submit" value="OK" />
</form>
[% END %]
[% IF ( delete_confirm ) %]
<form action="[% script_name %]" method="post">
<fieldset><legend>
[% IF ( totalgtzero ) %]
Category [% categorycode |html %] is in use. Deletion not possible![% ELSE %]
Confirm deletion of category [% categorycode |html %][% END %]</legend>
[% IF ( totalgtzero ) %]<div class="dialog alert"><strong>This category is used [% total %] times</strong>. Deletion not possible</div>[% END %]
<table>
<tr><th scope="row">Category code: </th><td>[% categorycode |html %]</td></tr>
<tr><th scope="row">Description: </th><td>[% description |html %]</td></tr>
<tr><th scope="row">Enrollment period: </th>
<td>
[% IF ( enrolmentperiod ) %]
[% enrolmentperiod %] months
[% ELSE %]
until [% enrolmentperioddate %]
[% END %]
</td>
</tr>
<tr><th scope="row">Age required: </th><td>[% dateofbirthrequired %] years</td></tr>
<tr><th scope="row">Upperage limit: </th><td>[% upperagelimit %] years</td></tr>
<tr><th scope="row">Enrollment fee: </th><td>[% enrolmentfee %]</td></tr>
<tr><th scope="row">Receives overdue notices: </th><td>[% IF ( overduenoticerequired ) %]Yes[% ELSE %]No[% END %]</td></tr>
<tr><th scope="row">Lost items in staff client</th><td>[% IF ( hidelostitems ) %]Hidden by default[% ELSE %]Shown[% END %]</td></tr>
<tr><th scope="row">Hold fee: </th><td>[% reservefee %]</td></tr>
</table>
<fieldset class="action">[% IF ( totalgtzero ) %]
<input type="submit" value="OK" /></form>
[% ELSE %]
<input type="hidden" name="op" value="delete_confirmed" />
<input type="hidden" name="categorycode" value="[% categorycode |html %]" /> <input type="submit" value="Delete this category" /> <a class="cancel" href="/cgi-bin/koha/admin/categorie.pl">Cancel</a>
[% END %]</fieldset></fieldset></form>
[% END %]
[% IF ( delete_confirmed ) %]
<h3>Category deleted</h3>
<form action="[% script_name %]" method="post">
<input type="submit" value="OK" />
</form>
[% END %]
[% 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>
<h2>Patron category administration</h2>
[% IF ( searchfield ) %]
You Searched for [% searchfield %]</span>
[% END %]
[% IF ( loop ) %]
<div id="pagertable_categorie">
[% INCLUDE 'table-pager.inc' perpage='20' %]
</div>
<table id="table_categorie">
<thead>
<th scope="col">Code</th>
<th scope="col">Category name</th>
<th scope="col">Type</th>
<th scope="col">Enrollment period</th>
<th scope="col">Age required</th>
<th scope="col">Upper age limit</th>
<th scope="col">Enrollment fee</th>
<th scope="col">Overdue</th>
<th scope="col">Lost items</th>
<th scope="col">Hold fee</th>
[% IF ( EnhancedMessagingPreferences ) %]
<th scope="col">Messaging</th>
[% END %]
<th scope="col" colspan="2">&nbsp; </th>
</thead>
[% FOREACH loo IN loop %]
<tr>
<td>[% loo.categorycode |html %]</td>
<td>
<a href="[% loo.script_name %]?op=add_form&amp;categorycode=[% loo.categorycode |url %]">[% loo.description |html %]</a>
</td>
<td>
[% IF ( loo.type_A ) %]Adult[% END %]
[% IF ( loo.type_C ) %]Child[% END %]
[% IF ( loo.type_P ) %]Prof.[% END %]
[% IF ( loo.type_I ) %]Org.[% END %]
[% IF ( loo.type_S ) %]Staff[% END %]
[% IF ( loo.type_X ) %]Statistical[% END %]
</td>
<td>
[% IF ( loo.enrolmentperiod ) %]
[% loo.enrolmentperiod %] months
[% ELSE %]
until [% loo.enrolmentperioddate %]
[% END %]
</td>
<td>[% loo.dateofbirthrequired %] years</td>
<td>[% loo.upperagelimit %] years</td>
<td>[% loo.enrolmentfee %]</td>
<td>[% IF ( loo.overduenoticerequired ) %]Yes[% ELSE %]No[% END %]</td>
<td>[% IF ( loo.hidelostitems ) %]Hidden[% ELSE %]Shown[% END %]</td>
<td>[% loo.reservefee %]</td>
[% IF ( EnhancedMessagingPreferences ) %]
<td style="white-space: nowrap; font-size:80%;">
[% IF ( loo.messaging_prefs ) %]
[% FOREACH prefs IN loo.messaging_prefs %]
[% FOREACH transport IN prefs.transports %]
[% IF ( transport.transport ) %]
[% IF ( prefs.Item_Due ) %]Item due
[% ELSIF ( prefs.Advance_Notice ) %]Advance notice
[% ELSIF ( prefs.Upcoming_Events ) %]Upcoming events
[% ELSIF ( prefs.Hold_Filled ) %]Hold filled
[% ELSIF ( prefs.Item_Check_in ) %]Item check-in
[% ELSIF ( prefs.Item_Checkout ) %]Item checkout
[% ELSE %]Unknown
[% END %]:
<strong>[% transport.transport %]</strong><br />
[% ELSE %]None<br />[% END %]
[% END %]
[% END %]
[% ELSE %]
None
[% END %]
</td>
[% END %]
<td><a href="[% loo.script_name %]?op=add_form&amp;categorycode=[% loo.categorycode |url %]">Edit</a></td>
<td><a href="[% loo.script_name %]?op=delete_confirm&amp;categorycode=[% loo.categorycode |url %]">Delete</a></td>
</tr>
[% END %]
</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>
[% END %]
[% END %]
</div>
</div>
<div class="yui-b">
[% INCLUDE 'admin-menu.inc' %]
</div>
</div>
[% INCLUDE 'intranet-bottom.inc' %]