Bug 29867: Reindent authorized values administration template

This patch performs general template cleanup to authorized values
administration: Make indentation consistent, replace tabs with spaces,
and trim trailing whitespace.

To test, apply the patch and go to Administration -> Authorized values.
Test that all functionality works correctly:

 - Adding or deleting categories
 - Adding, editing, and deleting authorized values.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Owen Leonard 2022-01-12 18:44:28 +00:00 committed by Fridolin Somers
parent 4eec446302
commit fb1213a396

View file

@ -3,20 +3,19 @@
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>
[% IF op == 'add_form' %]
[% IF ( action_modify ) %]Modify authorized value &rsaquo; [% END %]
[% IF ( action_add_value ) %]New authorized value &rsaquo; [% END %]
[% IF ( action_add_category ) %]New category &rsaquo; [% END %]
[% END %]
Authorized values &rsaquo; Administration &rsaquo; Koha
[% IF op == 'add_form' %]
[% IF ( action_modify ) %]Modify authorized value &rsaquo; [% END %]
[% IF ( action_add_value ) %]New authorized value &rsaquo; [% END %]
[% IF ( action_add_category ) %]New category &rsaquo; [% END %]
[% END %]
Authorized values &rsaquo; Administration &rsaquo; Koha
</title>
[% INCLUDE 'doc-head-close.inc' %]
<style>
fieldset.rows div.toptabs li { clear:none;margin-right:.5em;padding-bottom:0;width:auto; }
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-panel { margin-right : 10px; margin-left : 10px;margin-bottom:10px;}
fieldset.rows .ui-tabs-nav { margin-left : 10px; }
#lib, #lib_opac { width: 75% }
</style>
@ -86,259 +85,284 @@ Authorized values &rsaquo; Administration &rsaquo; Koha
<div class="col-sm-10 col-sm-push-2">
<main>
[% 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 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_name | html %]" /> [% category_name | html %]
</li>
<li>
<label for="authorised_value">Authorized value: </label>
[% IF ( action_modify ) %]<input type="hidden" id="id" name="id" value="[% id | html %]" />[% 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 | html %]" maxlength="200" />
</li>
<li>
<label for="lib_opac">Description (OPAC): </label>
<input type="text" name="lib_opac" id="lib_opac" value="[% lib_opac | html %]" maxlength="200" />
</li>
<li><label for="branches">Library limitations: </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 | html %]">[% branch.branchname | html %]</option>
[% ELSE %]
<option value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
[% END %]
[% END %]
</select>
<div class="hint">Select 'All libraries' if this authorized value must be displayed all the time. Otherwise select libraries you want to associate with this value.</div>
</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 | uri %]">[% imageset.imagesetname | html %]</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 | html %]"><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 | html %]" alt="[% image.StaffImageUrl | html %]" title="[% image.StaffImageUrl | html %]" />
[% ELSE %]
[% END %]
[% IF ( image.checked ) %]
<input type="radio" name="imageurl" value="[% image.KohaImage | html %]" 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 | html %]" />
[% END %]
[% END %]
</label>
</li>
[% END %]</ul>
<br class="clear" />
</div>
[% END %]
</div>
[% END %]
</fieldset>
<fieldset class="action"> <input type="hidden" name="id" value="[% id | html %]" />
<input type="submit" value="Save" /> <a class="cancel" href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=[% category_name | url %]">Cancel</a></fieldset>
</form>
[% END %]
[% IF op == 'list' %]
<div id="toolbar" class="btn-toolbar">
<a id="addcat" class="btn btn-default" href= "/cgi-bin/koha/admin/authorised_values.pl?op=add_form"><i class="fa fa-plus"> </i> New category</a>
[% IF ( searchfield ) %]
<a id="addauth" class="btn btn-default" href= "/cgi-bin/koha/admin/authorised_values.pl?op=add_form&amp;category=[% category.category_name | url %]"><i class="fa fa-plus"> </i> New authorized value for [% category.category_name | html %]</a>
[% END %]
</div>
[% IF ( searchfield ) %]
<h1>Authorized values for category [% category.category_name | html %]</h1>
[% PROCESS category_descriptions code_category = category.category_name %]
[% ELSE %]
<h1>Authorized values</h1>
[% END %]
[% IF ( searchfield ) %]
<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 %]
[% FOR m IN messages %]
<div class="dialog [% m.type | html %]">
[% 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 'error_on_delete_category' %]
An error occurred when deleting this authorized value category. 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 'success_on_delete_category' %]
Authorized value category deleted successfully.
[% 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 | html %]
[% END %]
</div>
[% END %]
[% IF ( searchfield ) %]
<form action="/cgi-bin/koha/admin/authorised_values.pl" method="get" id="category">
<p>
<label for="category_search">Show category: </label>
<select name="searchfield" id="category_search">
[% FOR c IN category_names %]
[% IF c == searchfield %]
<option value="[% c | html %]" selected="selected">[% c | html %]</option>
[% ELSE %]
<option value="[% c | html %]">[% c | html %]</option>
[% 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">
[% IF action_add_category %]
<ol>
<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>
</ol>
[% ELSE %]
<ol>
<li>
<span class="label">Category</span>
<input type="hidden" name="op" value="add" />
<input type="hidden" name="category" value="[% category_name | html %]" /> [% category_name | html %]
</li>
<li>
<label for="authorised_value">Authorized value: </label>
[% IF ( action_modify ) %]
<input type="hidden" id="id" name="id" value="[% id | html %]" />
[% 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 | html %]" maxlength="200" />
</li>
<li>
<label for="lib_opac">Description (OPAC): </label>
<input type="text" name="lib_opac" id="lib_opac" value="[% lib_opac | html %]" maxlength="200" />
</li>
<li><label for="branches">Library limitations: </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 | html %]">[% branch.branchname | html %]</option>
[% ELSE %]
<option value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
[% END %]
[% END %]
</select>
<div class="hint">Select 'All libraries' if this authorized value must be displayed all the time. Otherwise select libraries you want to associate with this value.</div>
</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 | uri %]">[% imageset.imagesetname | html %]</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 | html %]">
<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 | html %]" alt="[% image.StaffImageUrl | html %]" title="[% image.StaffImageUrl | html %]" />
[% ELSE %]
[% END %]
[% IF ( image.checked ) %]
<input type="radio" name="imageurl" value="[% image.KohaImage | html %]" 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 | html %]" />
[% END %]
[% END %]
</label>
</li>
[% END %]
</ul>
<br class="clear" />
</div>
[% END %]
</div>
[% END %]
</fieldset>
<fieldset class="action">
<input type="hidden" name="id" value="[% id | html %]" />
<input type="submit" value="Save" />
<a class="cancel" href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=[% category_name | url %]">Cancel</a>
</fieldset>
</form>
[% END %]
</select>
</p>
</form>
[% IF loop %]
[% IF op == 'list' %]
<div id="toolbar" class="btn-toolbar">
<a id="addcat" class="btn btn-default" href= "/cgi-bin/koha/admin/authorised_values.pl?op=add_form"><i class="fa fa-plus"> </i> New category</a>
[% IF ( searchfield ) %]
<a id="addauth" class="btn btn-default" href= "/cgi-bin/koha/admin/authorised_values.pl?op=add_form&amp;category=[% category.category_name | url %]"><i class="fa fa-plus"> </i> New authorized value for [% category.category_name | html %]</a>
[% END %]
</div>
<table id="categoriest" class="authorized_values_table">
<thead><tr>
<th>Authorized value</th>
<th>Description</th>
<th>Description (OPAC)</th>
<th>Icon</th>
<th>Library limitations</th>
<th class="noExport NoSort">Actions</th>
</tr>
</thead><tbody>
[% FOREACH loo IN loop %]
<tr>
<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 | url %]" alt=""/>[% ELSE %]&nbsp;[% END %]</td>
<td>
[% IF loo.branches.size > 0 %]
[% branches_str = "" %]
[% FOREACH branch IN loo.branches %]
[%- IF loop.first -%]
[% branches_str = branch.branchname _ " (" _ branch.branchcode _ ")" %]
[% IF ( searchfield ) %]
<h1>Authorized values for category [% category.category_name | html %]</h1>
[% PROCESS category_descriptions code_category = category.category_name %]
[% ELSE %]
[% branches_str = branches_str _ "\n" _ branch.branchname _ " (" _ branch.branchcode _ ")" %]
<h1>Authorized values</h1>
[% END %]
[% END %]
<span class="library_limitation" title="[% branches_str | html %]">
[% IF loo.branches.size > 1 %]
[% loo.branches.size | html %] library limitations
[% ELSE %]
[% loo.branches.size | html %] library limitation
[% IF ( searchfield ) %]
<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 %]
[% ELSE %]
No limitation
[% END %]
</td>
<td class="actions"><a href="/cgi-bin/koha/admin/authorised_values.pl?op=add_form&amp;id=[% loo.id | uri %]" 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&amp;searchfield=[% searchfield | uri %]&amp;id=[% loo.id | uri %]"><i class="fa fa-trash"></i> Delete</a></td>
</tr>
[% END # /FOREACH loop %]
</tbody></table>
[% ELSE %]
<div class="dialog message">
<p>There are no authorized values defined for [% category.category_name | html %]</p>
<form action="/cgi-bin/koha/admin/authorised_values.pl" method="get">
<input type="hidden" name="op" value="add_form" />
<input type="hidden" name="category" value="[% category.category_name | html %]" />
<button type="submit"><i class="fa fa-plus"></i> Add a new authorized value</button>
</form>
[% UNLESS category.is_system %]
<form id="delete_category" action="/cgi-bin/koha/admin/authorised_values.pl" method="post">
<input type="hidden" name="op" value="delete_category" />
<input type="hidden" name="category_name" value="[% category.category_name | html %]" />
<button type="submit"><i class="fa fa-plus"></i> Delete category '[% category.category_name | html %]' </button>
</form>
[% END %]
</div>
[% END %]
[% ELSE # category was selected %]
[% FOR m IN messages %]
<div class="dialog [% m.type | html %]">
[% 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 'error_on_delete_category' %]
An error occurred when deleting this authorized value category. 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 'success_on_delete_category' %]
Authorized value category deleted successfully.
[% 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 | html %]
[% END %]
</div>
[% END %]
<table id="categoriest" class="authorized_values_table">
<thead>
<tr>
<th>Category</th>
<th>Description</th>
<th class="noExport">&nbsp;</th>
</tr>
</thead>
<tbody>
[% FOR c IN category_names %]
<tr>
<td><a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=[% c | uri %]">[% c | html %]</a></td>
<td>
[% PROCESS category_descriptions code_category = c %]
</td>
<td>
<a id="addauth" class="btn btn-default btn-xs" href= "/cgi-bin/koha/admin/authorised_values.pl?op=add_form&amp;category=[% c | uri %]"><i class="fa fa-plus"> </i> Add</a>
</td>
</tr>
[% END %]
</tbody>
</table>
[% END # /IF ( searchfield )%]
[% IF ( searchfield ) %]
[% END # /IF op == 'list' %]
<form action="/cgi-bin/koha/admin/authorised_values.pl" method="get" id="category">
<p>
<label for="category_search">Show category: </label>
<select name="searchfield" id="category_search">
[% FOR c IN category_names %]
[% IF c == searchfield %]
<option value="[% c | html %]" selected="selected">[% c | html %]</option>
[% ELSE %]
<option value="[% c | html %]">[% c | html %]</option>
[% END %]
[% END %]
</select>
</p>
</form>
[% IF loop %]
<table id="categoriest" class="authorized_values_table">
<thead>
<tr>
<th>Authorized value</th>
<th>Description</th>
<th>Description (OPAC)</th>
<th>Icon</th>
<th>Library limitations</th>
<th class="noExport NoSort">Actions</th>
</tr>
</thead>
<tbody>
[% FOREACH loo IN loop %]
<tr>
<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 | url %]" alt=""/>[% ELSE %]&nbsp;[% END %]</td>
<td>
[% IF loo.branches.size > 0 %]
[% branches_str = "" %]
[% FOREACH branch IN loo.branches %]
[%- IF loop.first -%]
[% branches_str = branch.branchname _ " (" _ branch.branchcode _ ")" %]
[% ELSE %]
[% branches_str = branches_str _ "\n" _ branch.branchname _ " (" _ branch.branchcode _ ")" %]
[% END %]
[% END %]
<span class="library_limitation" title="[% branches_str | html %]">
[% IF loo.branches.size > 1 %]
[% loo.branches.size | html %] library limitations
[% ELSE %]
[% loo.branches.size | html %] library limitation
[% END %]
[% ELSE %]
No limitation
[% END %]
</td>
<td class="actions"><a href="/cgi-bin/koha/admin/authorised_values.pl?op=add_form&amp;id=[% loo.id | uri %]" 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&amp;searchfield=[% searchfield | uri %]&amp;id=[% loo.id | uri %]"><i class="fa fa-trash"></i> Delete</a></td>
</tr>
[% END # /FOREACH loop %]
</tbody>
</table>
[% ELSE %]
<div class="dialog message">
<p>There are no authorized values defined for [% category.category_name | html %]</p>
<form action="/cgi-bin/koha/admin/authorised_values.pl" method="get">
<input type="hidden" name="op" value="add_form" />
<input type="hidden" name="category" value="[% category.category_name | html %]" />
<button type="submit"><i class="fa fa-plus"></i> Add a new authorized value</button>
</form>
[% UNLESS category.is_system %]
<form id="delete_category" action="/cgi-bin/koha/admin/authorised_values.pl" method="post">
<input type="hidden" name="op" value="delete_category" />
<input type="hidden" name="category_name" value="[% category.category_name | html %]" />
<button type="submit"><i class="fa fa-plus"></i> Delete category '[% category.category_name | html %]' </button>
</form>
[% END %]
</div>
[% END %]
[% ELSE # category was selected %]
<table id="categoriest" class="authorized_values_table">
<thead>
<tr>
<th>Category</th>
<th>Description</th>
<th class="noExport">&nbsp;</th>
</tr>
</thead>
<tbody>
[% FOR c IN category_names %]
<tr>
<td><a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=[% c | uri %]">[% c | html %]</a></td>
<td>
[% PROCESS category_descriptions code_category = c %]
</td>
<td>
<a id="addauth" class="btn btn-default btn-xs" href= "/cgi-bin/koha/admin/authorised_values.pl?op=add_form&amp;category=[% c | uri %]"><i class="fa fa-plus"> </i> Add</a>
</td>
</tr>
[% END %]
</tbody>
</table>
[% END # /IF ( searchfield )%]
[% END # /IF op == 'list' %]
</main>
</div> <!-- /.col-sm-10.col-sm-push-2 -->