[% INCLUDE 'doc-head-open.inc' %]
-<title>Koha › Administration › Authorized Values [% IF ( add_form ) %] › [% IF ( action_modify ) %]Modify authorized value[% END %]
- [% IF ( action_add_value ) %] › New authorized value[% END %]
- [% IF ( action_add_category ) %] › New category[% END %][% END %]
-[% IF ( delete_confirm ) %] › Confirm Deletion[% END %]
-[% IF ( else ) %]Authorized values[% END %]</title>
+<title>Koha › Administration › Authorized values
+[% IF op == 'add_form' %]
+ [% IF ( action_modify ) %] › Modify authorized value[% END %]
+ [% IF ( action_add_value ) %] › New authorized value[% END %]
+ [% IF ( action_add_category ) %] › New category[% END %]
+[% END %]
+</title>
[% INCLUDE 'doc-head-close.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() {
- // call the tablesorter plugin
- $("#table_authorized_values").tablesorter({
- sortList: [[1,0]],
- headers: { 4: { sorter: false}, 5: { sorter: false}}
- }).tablesorterPager({container: $("#pagertable_authorized_values"),positionFixed: false,size: 50});
-
-}); </script>
-<script type="text/JavaScript" language="JavaScript">
+<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
+[% INCLUDE 'datatables.inc' %]
+<script type="text/javascript">
+//<![CDATA[
+ $(document).ready(function() {
+ $("#table_authorized_values").dataTable($.extend(true, {}, dataTablesDefaults, {
+ "aoColumnDefs": [
+ { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
+ ],
+ "aaSorting": [[ 1, "asc" ]],
+ "sPaginationType": "four_button"
+ }));
+
+ if ( $("#branches option:selected").length < 1 ) {
+ $("#branches option:first").attr("selected", "selected");
+ }
+ $('#icons').tabs();
+
+ $("a.delete").click(function(){
+ return confirm(_("Are you sure you want to delete this authorized value?"));
+ });
+});
+//]]>
+</script>
+
+[% IF op == 'list' %]
+<script type="text/javascript">
//<![CDATA[
- $(document).ready(function() {
- $('#icons > ul').tabs();
- });
+$(document).ready(function() {
+ $('#category').find("input:submit").hide();
+ $('#searchfield').change(function() {
+ $('#category').submit();
+ });
+});
//]]>
</script>
+[% END %]
+
<style type="text/css">
fieldset.rows div.toptabs li { clear:none;margin-right:.5em;padding-bottom:0;width:auto; }
- fieldset.rows div.toptabs .ui-tabs-nav li.ui-tabs-selected {background-color : transparent; }
+ fieldset.rows div.toptabs .ui-tabs-nav li.ui-tabs-active {background-color : #F4F8F9; }
fieldset.rows .ui-tabs-panel { margin-right : 10px; margin-left : 10px;margin-bottom:10px;}
+ fieldset.rows .ui-tabs-nav { margin-left : 10px; }
</style>
</head>
-<body>
+<body id="admin_authorised_values" class="admin">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> › [% IF ( add_form ) %] <a href="/cgi-bin/koha/admin/authorised_values.pl">Authorized Values</a> › [% IF ( action_modify ) %]Modify authorized value[% END %]
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> › [% IF op == 'add_form' %] <a href="/cgi-bin/koha/admin/authorised_values.pl">Authorized values</a> › [% IF ( action_modify ) %]Modify authorized value[% END %]
[% IF ( action_add_value ) %]New authorized value[% END %]
[% IF ( action_add_category ) %]New category[% END %][% END %]
-[% IF ( delete_confirm ) %] <a href="/cgi-bin/koha/admin/authorised_values.pl">Authorized Values</a> › Confirm Deletion[% END %]
-[% IF ( else ) %]Authorized values[% END %]</div>
+[% IF op == 'list' %]Authorized values[% END %]</div>
<div id="doc3" class="yui-t2">
<div id="yui-main">
<div class="yui-b">
-[% IF ( add_form ) %]
+[% IF op == 'add_form' %]
<h1>
[% IF ( action_modify ) %]Modify authorized value[% END %]
[% IF ( action_add_value ) %]New authorized value[% END %]
[% IF ( action_add_category ) %]New category[% END %]
</h1>
- [% IF ( action_modify ) %]<div class="note"><strong>NOTE:</strong> If you change an authorized value, existing records using it won't be updated.</div>[% END %]
+ [% IF ( action_modify ) %]<div class="note"><i class="fa fa-exclamation"></i> <strong>NOTE:</strong> If you change an authorized value code, existing records using it won't be updated. Changes to value descriptions will show immediately.</div>[% END %]
- <form action="[% script_name %]" name="Aform" method="post">
- <input type="hidden" name="op" value="add_validate" />
- <input type="hidden" name="offset" value="[% offset %]" />
+ <form action="/cgi-bin/koha/admin/authorised_values.pl" name="Aform" method="post" class="validated">
+ <input type="hidden" name="op" value="add" />
<fieldset class="rows"><ol>
<li>
- [% IF ( action_add_category ) %]<label for="category">Category</label>
- <input type="text" name="category" id="category" size="10" maxlength="10" />
+ [% IF ( action_add_category ) %]
+ <label for="category" class="required">Category: </label>
+ <input type="text" name="category" id="category" size="32" maxlength="32" class="focus required" />
+ <span class="required">Required</span>
[% ELSE %]<span class="label">Category</span>
<input type="hidden" name="category" value="[% category %]" /> [% category %]
[% END %]
</li>
<li>
- <label for="authorised_value">Authorized value</label>
+ <label for="authorised_value">Authorized value: </label>
[% IF ( action_modify ) %]<input type="hidden" id="id" name="id" value="[% id %]" />[% END %]
+ [% IF ( action_add_category ) %]
<input type="text" id="authorised_value" name="authorised_value" value="[% authorised_value %]" maxlength="80" />
+ [% ELSE %]
+ <input type="text" id="authorised_value" name="authorised_value" value="[% authorised_value %]" maxlength="80" class="focus" />
+ [% END %]
</li>
<li>
- <label for="lib">Description</label>
- <input type="text" name="lib" id="lib" value="[% lib %]" maxlength="80" />
+ <label for="lib">Description: </label>
+ <input type="text" name="lib" id="lib" value="[% lib %]" maxlength="200" />
</li>
<li>
- <label for="lib_opac">Description (OPAC)</label>
- <input type="text" name="lib_opac" id="lib_opac" value="[% lib_opac %]" maxlength="80" />
+ <label for="lib_opac">Description (OPAC): </label>
+ <input type="text" name="lib_opac" id="lib_opac" value="[% lib_opac %]" maxlength="200" />
+ </li>
+ <li><label for="branches">Libraries limitation: </label>
+ <select id="branches" name="branches" multiple size="10">
+ <option value="">All libraries</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 libraries' if this authorized value must be displayed all the time. Otherwise select libraries you want to associate with this value.</span>
</li>
+
</ol>
- <div id="icons" class="toptabs">
- <h5 style="margin-left:10px;">Choose an Icon:</h5>
+ <div id="icons" class="toptabs" style="clear:both">
+ <h5 style="margin-left:10px;">Choose an icon:</h5>
<ul>
- <li><a href="/cgi-bin/koha/admin/authorised_values.pl?op=add_form&category=[% category %]#none">None</a></li>
+ <li><a href="#none">None</a></li>
[% FOREACH imageset IN imagesets %]
- [% IF ( imageset.imagesetactive ) %]<li class="ui-tabs-selected">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/admin/authorised_values.pl?op=add_form&category=[% imageset.category %]#[% imageset.imagesetname %]">[% imageset.imagesetname %]</a></li>
+ [% IF ( imageset.imagesetactive ) %]<li class="ui-tabs-active">[% ELSE %]<li>[% END %]<a href="#[% imageset.imagesetname %]">[% imageset.imagesetname %]</a></li>
[% END %]
</ul>
- </div>
<div id="none"><ul>
<li><label for="noimage">No image: </label><input type="radio" name="imageurl" id="noimage" value="removeImage" /></li>
</ul>
[% FOREACH imageset IN imagesets %]
<div id="[% imageset.imagesetname %]"><ul>
[% FOREACH image IN imageset.images %]
- <li style="float: none; display: inline; clear : none; width: auto;">
+ <li style="float: none; display: inline-block; clear : none; width: auto;">
<label> [% IF ( image.StaffImageUrl ) %]
<img src="[% image.StaffImageUrl %]" alt="[% image.StaffImageUrl %]" title="[% image.StaffImageUrl %]" />
[% ELSE %]
<br class="clear" />
</div>
[% END %]
-
+ </div>
</fieldset>
<fieldset class="action"> <input type="hidden" name="id" value="[% id %]" />
<input type="submit" value="Save" /> <a class="cancel" href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=[% category %]">Cancel</a></fieldset>
[% END %]
-[% IF ( delete_confirm ) %]
- <div class="dialog alert">
-<h3>Confirm Deletion</h3>
-<table>
- <tr>
- <th>Category</th>
- <th>Value</th>
- <th>Description</th>
- <th>Description (OPAC)</th>
- </tr>
- <tr>
- <td>[% searchfield %]</td>
- <td>[% Tvalue %]</td>
- <td>[% Tlib %]</td>
- <td>[% Tlib_opac %]</td>
- </tr>
- </table>
- <form action="[% script_name %]" method="post">
- <input type="hidden" name="op" value="delete_confirmed" />
- <input type="hidden" name="id" value="[% id %]" />
- <input type="hidden" name="searchfield" value="[% searchfield %]" /><fieldset class="action"><input type="submit" value="Yes, Delete" class="approve" /></form>
-<form action="[% script_name %]" method="get"><input type="hidden" name="searchfield" value="[% searchfield %]" /><input type="submit" value="No, Do Not Delete" class="deny" /></form>
-</div>
-[% END %]
+[% IF op == 'list' %]
-[% IF ( else ) %]
-
-<div id="toolbar">
- <script type="text/javascript">
- //<![CDATA[
-
- // prepare DOM for YUI Toolbar
-
- $(document).ready(function() {
- yuiToolbar();
- $('#category').find("input:submit").hide();
- $('#searchfield').change(function() {
- $('#category').submit();
- });
- });
-
- // YUI Toolbar Functions
-
- function yuiToolbar() {
- new YAHOO.widget.Button("addauth");
- new YAHOO.widget.Button("addcat");
- }
-
- //]]>
- </script>
- <ul class="toolbar">
- <li><a id="addauth" href= "/cgi-bin/koha/admin/authorised_values.pl?op=add_form&category=[% category %]">New Authorized value for [% category %]</a></li>
- <li><a id="addcat" href= "/cgi-bin/koha/admin/authorised_values.pl?op=add_form">New Category</a></li>
-</ul></div>
+<div id="toolbar" class="btn-toolbar">
+ <a id="addauth" class="btn btn-small" href= "/cgi-bin/koha/admin/authorised_values.pl?op=add_form&category=[% category %]"><i class="fa fa-plus"> </i> New authorized value for [% category %]</a>
+ <a id="addcat" class="btn btn-small" href= "/cgi-bin/koha/admin/authorised_values.pl?op=add_form"><i class="fa fa-plus"> </i> New category</a>
+</div>
<h1>Authorized values</h1>
-<div class="note"><strong>NOTE:</strong> If you change an authorized value, existing records using it won't be updated.</div>
+<div class="note"><i class="fa fa-exclamation"></i> <strong>NOTE:</strong> If you change an authorized value code, existing records using it won't be updated. Changes to value descriptions will show immediately.</div>
-[% IF ( duplicate_category ) %]
-<div class="dialog alert">Could not add value "[% duplicate_value %]" for category "[% duplicate_category %]" — value already present.
-</div>
+[% FOR m IN messages %]
+ <div class="dialog [% m.type %]">
+ [% SWITCH m.code %]
+ [% CASE 'error_on_update' %]
+ An error occurred when updating this authorized value. Perhaps the value already exists.
+ [% CASE 'error_on_insert' %]
+ An error occurred when inserting this authorized value. Perhaps the value or the category already exists.
+ [% CASE 'error_on_delete' %]
+ An error occurred when deleting this authorized value. Check the logs.
+ [% CASE 'success_on_update' %]
+ Authorized value updated successfully.
+ [% CASE 'success_on_insert' %]
+ Authorized value added successfully.
+ [% CASE 'success_on_delete' %]
+ Authorized value deleted successfully.
+ [% CASE 'already_exists' %]
+ This authorized value already exists.
+ [% CASE %]
+ [% m.code %]
+ [% END %]
+ </div>
[% END %]
-<form action="/cgi-bin/koha/admin/authorised_values.pl" method="post" id="category"><label for="searchfield">Show Category: </label>[% tab_list %] <input type="submit" value="Submit" /></form>
+
+<form action="/cgi-bin/koha/admin/authorised_values.pl" method="post" id="category">
+ <label for="searchfield">Show category: </label>
+ <select name="searchfield" id="searchfield" size="1">
+ [% FOR c IN categories %]
+ [% IF c == searchfield %]
+ <option value="[% c %]" selected="selected">[% c %]</option>
+ [% ELSE %]
+ <option value="[% c %]">[% c %]</option>
+ [% END %]
+ [% END %]
+ <input type="submit" value="Submit" />
+</form>
[% IF ( category == 'Bsort1' ) %]
<p>An authorized value attached to patrons, that can be used for stats purposes</p>
[% END %]
<h3>Authorized values for category [% category %]:</h3>
[% IF ( loop ) %]<div id="pagertable_authorized_values">
-[% INCLUDE 'table-pager.inc' perpage='50' %]
</div>[% END %]
-[% IF ( loop ) %]<table id="table_authorized_values" class="tablesorter">
+[% IF ( loop ) %]<table id="table_authorized_values">
<thead><tr>
<th>Authorized value</th>
<th>Description</th>
<th>Description (OPAC)</th>
<th>Icon</th>
- <th>Edit</th>
- <th>Delete</th>
+ <th>Branches limitations</th>
+ <th>Actions</th>
</tr>
</thead><tbody>
[% FOREACH loo IN loop %]
<td>[% loo.lib %]</td>
<td>[% loo.lib_opac %]</td>
<td>[% IF ( loo.imageurl ) %]<img src="[% loo.imageurl %]" alt=""/>[% ELSE %] [% END %]</td>
- <td><a href="[% loo.edit %]">Edit</a></td>
- <td><a href="[% loo.delete %]">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 href="#" title="[% branches_str %]">
+ [% IF loo.branches.size > 1 %]
+ [% loo.branches.size %] branches limitations
+ [% ELSE %]
+ [% loo.branches.size %] branch limitation
+ [% END %]
+ [% ELSE %]
+ No limitation
+ [% END %]
+ </td>
+ <td class="actions"><a href="/cgi-bin/koha/admin/authorised_values.pl?op=add_form&id=[% loo.id %]" class="btn btn-mini"><i class="fa fa-pencil"></i> Edit</a>
+ <a class="delete btn btn-mini" href="/cgi-bin/koha/admin/authorised_values.pl?op=delete&searchfield=[% searchfield %]&id=[% loo.id %]"><i class="fa fa-trash"></i> Delete</a></td>
</tr>
[% END %]
</tbody></table>[% ELSE %]
[% END %]
[% IF ( isprevpage ) %]
-<form class="inline" action="[% script_name %]" method="post">
-<input type="hidden" name="offset" value="[% prevpage %]" /><input type="hidden" name="searchfield" value="[% searchfield %]" />
+<form class="inline" action="/cgi-bin/koha/admin/authorised_values.pl" method="post">
+<input type="hidden" name="searchfield" value="[% searchfield %]" />
<input type="submit" value="<< Previous" /></form>
[% END %]