ed7543287b
Having to write [% KOHA_VERSION %] for each url is bad because: - It's easily forgettable when adding new <script> or <link> - It prevents grep'ing for the full filename - It violates the DRY principle - If at some point we want to change the "force js and css reload" mechanism, it will be tedious This patch: - adds a Template::Toolkit plugin that generates <script> and <link> tags for JS and CSS files, and inserts automatically the Koha version in the filename - use the new plugin to remove all occurences of [% KOHA_VERSION %] - remove the code that was adding KOHA_VERSION as a template variable Test plan: 1. Apply patch 2. Go to several different pages in Koha (opac and intranet) while checking your browser's dev tools (there should be no 404 for JS and CSS files, and the Koha version should appear in filenames) and the server logs (there should be no "File not found") 3. `git grep KOHA_VERSION` should return nothing 4. prove t/db_dependent/Koha/Template/Plugin/Asset.t Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
315 lines
13 KiB
Text
315 lines
13 KiB
Text
[% USE Asset %]
|
|
[% SET footerjs = 1 %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<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' %]
|
|
|
|
[% Asset.css("css/datatables.css") %]
|
|
|
|
<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-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 id="admin_authorised_values" class="admin">
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'prefs-admin-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 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 op == 'list' %]Authorized values[% END %]</div>
|
|
|
|
<div id="doc3" class="yui-t2">
|
|
|
|
<div id="bd">
|
|
<div id="yui-main">
|
|
<div class="yui-b">
|
|
|
|
[% 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"><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="/cgi-bin/koha/admin/authorised_values.pl" name="Aform" method="post" class="validated">
|
|
<fieldset class="rows"><ol>
|
|
[% IF action_add_category %]
|
|
<li>
|
|
<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>
|
|
<input type="hidden" name="op" value="add_category" />
|
|
</li>
|
|
[% ELSE %]
|
|
<li>
|
|
<span class="label">Category</span>
|
|
<input type="hidden" name="op" value="add" />
|
|
<input type="hidden" name="category" value="[% category | html %]" /> [% category | html %]
|
|
</li>
|
|
<li>
|
|
<label for="authorised_value">Authorized value: </label>
|
|
[% IF ( action_modify ) %]<input type="hidden" id="id" name="id" value="[% id %]" />[% END %]
|
|
<input type="text" id="authorised_value" name="authorised_value" value="[% authorised_value | html %]" maxlength="80" class="focus" />
|
|
</li>
|
|
<li>
|
|
<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="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 |html %]</option>
|
|
[% ELSE %]
|
|
<option value="[% branch.branchcode %]">[% branch.branchname |html %]</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" style="clear:both">
|
|
<h5 style="margin-left:10px;">Choose an icon:</h5>
|
|
<ul>
|
|
<li><a href="#none">None</a></li>
|
|
[% FOREACH imageset IN imagesets %]
|
|
[% IF ( imageset.imagesetactive ) %]<li class="ui-tabs-active">[% ELSE %]<li>[% END %]<a href="#[% imageset.imagesetname %]">[% imageset.imagesetname %]</a></li>
|
|
[% END %]
|
|
</ul>
|
|
<div id="none"><ul>
|
|
<li><label for="noimage">No image: </label><input type="radio" name="imageurl" id="noimage" value="removeImage" /></li>
|
|
</ul>
|
|
<br class="clear" /></div>
|
|
[% FOREACH imageset IN imagesets %]
|
|
<div id="[% imageset.imagesetname %]"><ul>
|
|
[% FOREACH image IN imageset.images %]
|
|
<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 %]
|
|
[% END %]
|
|
[% IF ( image.checked ) %]
|
|
<input type="radio" name="imageurl" value="[% image.KohaImage %]" checked="checked" />
|
|
[% ELSE %]
|
|
[% IF ( image.KohaImage ) %] <!-- to delete the radio button if there is no image after -->
|
|
<input type="radio" name="imageurl" value="[% image.KohaImage %]" />
|
|
[% END %]
|
|
[% END %]
|
|
</label>
|
|
</li>
|
|
[% END %]</ul>
|
|
<br class="clear" />
|
|
</div>
|
|
[% END %]
|
|
</div>
|
|
[% END %]
|
|
</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 | url %]">Cancel</a></fieldset>
|
|
</form>
|
|
[% END %]
|
|
|
|
|
|
[% IF op == 'list' %]
|
|
|
|
<div id="toolbar" class="btn-toolbar">
|
|
<a id="addauth" class="btn btn-default btn-sm" href= "/cgi-bin/koha/admin/authorised_values.pl?op=add_form&category=[% category | url %]"><i class="fa fa-plus"> </i> New authorized value for [% category |html %]</a>
|
|
<a id="addcat" class="btn btn-default btn-sm" 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"><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>
|
|
|
|
[% 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_insert_cat' %]
|
|
An error occurred when inserting this authorized value category. Perhaps the category name 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_insert_cat' %]
|
|
Authorized value category added successfully.
|
|
[% CASE 'success_on_delete' %]
|
|
Authorized value deleted successfully.
|
|
[% CASE 'already_exists' %]
|
|
This authorized value already exists.
|
|
[% CASE 'cat_already_exists' %]
|
|
This authorized value category already exists.
|
|
[% CASE 'invalid_category_name' %]
|
|
The authorized value category 'branches', 'itemtypes' and 'cn_source' are used internally by Koha and are not valid.
|
|
[% 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>
|
|
<select name="searchfield" id="searchfield" size="1">
|
|
[% FOR c IN categories %]
|
|
[% IF c == searchfield %]
|
|
<option value="[% c %]" selected="selected">[% c |html %]</option>
|
|
[% ELSE %]
|
|
<option value="[% c %]">[% c |html %]</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 %]
|
|
[% IF ( category == 'Bsort2' ) %]
|
|
<p>An authorized value attached to patrons, that can be used for stats purposes</p>
|
|
[% END %]
|
|
[% IF ( category == 'Asort1' ) %]
|
|
<p>An authorized value attached to acquisitions, that can be used for stats purposes</p>
|
|
[% END %]
|
|
[% IF ( category == 'Asort2' ) %]
|
|
<p>An authorized value attached to acquisitions, that can be used for stats purposes</p>
|
|
[% END %]
|
|
[% IF ( category == 'SUGGEST' ) %]
|
|
<p>Reasons to reject or accept patron suggestions</p>
|
|
[% END %]
|
|
[% IF ( category == 'DAMAGED' ) %]
|
|
<p>Statuses to describe a damaged item</p>
|
|
[% END %]
|
|
[% IF ( category == 'LOST' ) %]
|
|
<p>Statuses to describe a lost item</p>
|
|
[% END %]
|
|
[% IF ( category == 'MANUAL_INV' ) %]
|
|
<p>Additional values for manual invoice types</p>
|
|
[% END %]
|
|
[% IF ( category == 'BOR_NOTES' ) %]
|
|
<p>Values for custom patron notes</p>
|
|
[% END %]
|
|
[% IF ( category == 'LOC' ) %]
|
|
<p>Values for shelving locations</p>
|
|
[% END %]
|
|
[% IF ( category == 'CCODE' ) %]
|
|
<p>Values for collection codes</p>
|
|
[% END %]
|
|
[% IF ( category == 'NOT_LOAN' ) %]
|
|
<p>Statuses to describe why an item is not for loan</p>
|
|
[% END %]
|
|
<h3>Authorized values for category [% category |html %]:</h3>
|
|
|
|
[% IF ( loop ) %]<div id="pagertable_authorized_values">
|
|
</div>[% END %]
|
|
|
|
[% IF ( loop ) %]<table id="table_authorized_values">
|
|
<thead><tr>
|
|
<th>Authorized value</th>
|
|
<th>Description</th>
|
|
<th>Description (OPAC)</th>
|
|
<th>Icon</th>
|
|
<th>Branches limitations</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead><tbody>
|
|
[% FOREACH loo IN loop %]
|
|
[% UNLESS ( loop.odd ) %]
|
|
<tr>
|
|
[% ELSE %]
|
|
<tr>
|
|
[% END %]
|
|
<td>[% loo.authorised_value | html %]</td>
|
|
<td>[% loo.lib |html %]</td>
|
|
<td>[% loo.lib_opac |html %]</td>
|
|
<td>[% IF ( loo.imageurl ) %]<img src="[% loo.imageurl %]" alt=""/>[% ELSE %] [% END %]</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-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
|
|
<a class="delete btn btn-default btn-xs" href="/cgi-bin/koha/admin/authorised_values.pl?op=delete&searchfield=[% searchfield | url %]&id=[% loo.id %]"><i class="fa fa-trash"></i> Delete</a></td>
|
|
</tr>
|
|
[% END %]
|
|
</tbody></table>[% ELSE %]
|
|
<div class="dialog message">There are no authorized values defined for [% category |html %]</div>
|
|
[% END %]
|
|
|
|
[% IF ( isprevpage ) %]
|
|
<form class="inline" action="/cgi-bin/koha/admin/authorised_values.pl" method="post">
|
|
<input type="hidden" name="searchfield" value="[% searchfield | html %]" />
|
|
<input type="submit" value="<< Previous" /></form>
|
|
[% END %]
|
|
|
|
[% END %]
|
|
|
|
</div>
|
|
</div>
|
|
<div class="yui-b">
|
|
[% INCLUDE 'admin-menu.inc' %]
|
|
</div>
|
|
</div>
|
|
|
|
[% MACRO jsinclude BLOCK %]
|
|
[% Asset.js("js/admin-menu.js") %]
|
|
[% INCLUDE 'datatables.inc' %]
|
|
<script type="text/javascript">
|
|
$(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?"));
|
|
});
|
|
[% IF op == 'list' %]
|
|
$('#category').find("input:submit").hide();
|
|
$('#searchfield').change(function() {
|
|
$('#category').submit();
|
|
});
|
|
[% END %]
|
|
});
|
|
</script>
|
|
|
|
[% END %]
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|