Owen Leonard
247dca3064
This patch upgrades DataTables and makes some style changes to the default DataTables toolbar style. DataTables assets are now combined and minified using their download customizer, bundling together these elements: - JSZip 2.5.0 - pdfmake 0.1.36 - DataTables 1.10.18 - Buttons 1.5.6 - Column visibility 1.5.6 - HTML5 export 1.5.6 - Print view 1.5.6 - FixedHeader 3.1.4 DataTables assets have been moved from lib/jquery/plugins to lib/datatables. The global header and footer include files are updated correspondingly. This patch removes the custom "four_button" pagination configuration and updates pages which used it to use the built-in "full" type instead. This is done for the sake of consistency and upgradability. This change touches a lot of files. Table-specific CSS has been moved from staff-global.scss to a new include, _tables.scss. A second common include, _mixins.scss has some variable definitions used in both files. Many images have been made obsolete by this change and have been removed. To test, apply the patch and regenerate the staff client CSS. View various pages in the staff client with tables: - Not formatted by DataTables: - Reports -> Most circulated items - Catalog -> Search results - Formatted by DataTables without column configuration - Acquisitions -> Vendor search - Lists - Formatted by DataTables with column configuration - Administration -> Libraries - Administration -> Item types - Reports -> Saved SQL reports - Non-standard DataTables configurations: - Circulation -> Checkouts - Administration -> System preferences - Reports -> Lost items Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
215 lines
9.3 KiB
Text
Executable file
215 lines
9.3 KiB
Text
Executable file
[% USE AuthorisedValues %]
|
|
[% SET footerjs = 1 %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Administration ›
|
|
[% SWITCH op %]
|
|
[% CASE 'add_form' %][% IF field %]Modify additional field '[% field.name | html %]'[% ELSE %]Add additional field[% END %]
|
|
[% CASE %]Manage additional fields
|
|
[% END %]
|
|
</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
</head>
|
|
|
|
[% marcfield_tables = ['subscription'] %]
|
|
[% show_marcfield = marcfield_tables.grep('^' _ tablename _ '$').size ? 1 : 0 %]
|
|
|
|
<body id="ser_add_fields" class="ser">
|
|
[% 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> ›
|
|
[% SWITCH op %]
|
|
[% CASE 'add_form' %]<a href="/cgi-bin/koha/admin/additional-fields.pl">Manage additional fields</a> › [% IF field %]Modify field '[% field.name | html %]'[% ELSE %]Add field[% END %]
|
|
[% CASE 'list' %]<a href="/cgi-bin/koha/admin/additional-fields.pl">Manage additional fields</a> › Modify fields for '[% tablename | html %]'
|
|
[% CASE %]Manage additional fields
|
|
[% END %]
|
|
</div>
|
|
|
|
<div class="main container-fluid">
|
|
<div class="row">
|
|
<div class="col-sm-10 col-sm-push-2">
|
|
<main>
|
|
|
|
[% IF op == 'list' %]
|
|
<div id="toolbar" class="btn-toolbar">
|
|
<a class="btn btn-default" id="newfields" href="?op=add_form&tablename=[% tablename | uri %]"><i class="fa fa-plus"></i> Create field</a>
|
|
</div>
|
|
[% END %]
|
|
|
|
[% IF messages %]
|
|
[% FOR message IN messages %]
|
|
[% IF message.code == 'insert' %]
|
|
[% IF message.number > 0 %]
|
|
<div class="dialog message">The field has been inserted</div>
|
|
[% ELSE %]
|
|
<div class="dialog alert">The field could not be inserted. Perhaps the name already exists?</div>
|
|
[% END %]
|
|
[% ELSIF message.code == 'update' %]
|
|
[% IF message.number > 0 %]
|
|
<div class="dialog message">The field has been updated</div>
|
|
[% ELSE %]
|
|
<div class="dialog alert">The field could not be updated. Perhaps the name already exists?</div>
|
|
[% END %]
|
|
[% ELSIF message.code == 'delete' %]
|
|
[% IF message.number > 0 %]
|
|
<div class="dialog message">The field has been deleted</div>
|
|
[% ELSE %]
|
|
<div class="dialog alert">The field could not be deleted. Check the log for errors.</div>
|
|
[% END %]
|
|
[% END %]
|
|
[% END %]
|
|
[% END %]
|
|
|
|
[% IF op == 'list_tables' %]
|
|
[% IF CAN_user_acquisitions_order_manage || CAN_user_serials_edit_subscription %]
|
|
<h3>Additional fields</h3>
|
|
<p>Select a table:</p>
|
|
[% BLOCK table_option %]
|
|
<li><a href="?tablename=[% value | uri %]">[% content | html %] (<span class="ex">[% value | html %]</span>)</a></li>
|
|
[% END %]
|
|
<ul>
|
|
[% IF CAN_user_acquisition_order_manage %]
|
|
[% WRAPPER table_option value="aqbasket" %]Order baskets[% END %]
|
|
[% END %]
|
|
[% IF CAN_user_serials_edit_subscription %]
|
|
[% WRAPPER table_option value="subscription" %]Subscriptions[% END %]
|
|
[% END %]
|
|
</ul>
|
|
[% ELSE %]
|
|
Additional permissions in the acquisitions or serials modules are required for editing additional fields
|
|
[% END %]
|
|
[% ELSIF op == 'list' %]
|
|
<h3>Additional fields for '[% tablename | html %]'</h3>
|
|
[% IF fields %]
|
|
<table id="fieldst">
|
|
<thead>
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>Authorised value category</th>
|
|
[% IF show_marcfield %]
|
|
<th>MARC field</th>
|
|
[% END %]
|
|
<th>Searchable</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
[% FOR field IN fields %]
|
|
<tr>
|
|
<td>[% field.name | html %]</td>
|
|
<td>[% field.authorised_value_category | html %]</td>
|
|
[% IF show_marcfield %]
|
|
<td>[% field.marcfield | html %]</td>
|
|
[% END %]
|
|
<td>
|
|
[% IF field.searchable %]Yes[% ELSE %]No[% END %]
|
|
</td>
|
|
<td class="actions">
|
|
<a class="btn btn-default btn-xs" href="?op=add_form&field_id=[% field.id | html %]"><i class="fa fa-pencil"></i> Edit</a>
|
|
<a class="confirmdelete btn btn-default btn-xs" href="?op=delete&field_id=[% field.id | uri %]&tablename=[% tablename | uri %]"><i class="fa fa-trash"></i> Delete</a>
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
</tbody>
|
|
</table>
|
|
[% ELSE %]
|
|
[% IF tablename %]There are no additional fields defined for this table.[% END %]
|
|
[% END %]
|
|
[% ELSIF op == 'add_form' %]
|
|
[% IF field %]
|
|
<h3>Modify field</h3>
|
|
[% ELSE %]
|
|
<h3>Add field</h3>
|
|
[% END %]
|
|
<form action="" name="add_form" id="add_field" method="post">
|
|
<fieldset class="rows">
|
|
<ol>
|
|
<li>
|
|
<label for="name" class="required">Name: </label>
|
|
<input type="text" name="name" id="name" value="[% field.name | html %]" class="required" required="required" />
|
|
<span class="required">Required</span>
|
|
</li>
|
|
<li>
|
|
<label for="av">Authorised value category: </label>
|
|
<select name="authorised_value_category">
|
|
<option value="">None</option>
|
|
[% PROCESS options_for_authorised_value_categories authorised_value_categories = AuthorisedValues.GetCategories({selected => field.authorised_value_category}) %]
|
|
</select>
|
|
</li>
|
|
[% IF show_marcfield %]
|
|
<li>
|
|
<label for="marcfield">MARC field: </label>
|
|
<input type="text" name="marcfield" id="marcfield" value="[% field.marcfield | html %]" />
|
|
</li>
|
|
[% END %]
|
|
<li>
|
|
<label for="searchable">Searchable: </label>
|
|
[% IF field.searchable %]
|
|
<input type="checkbox" name="searchable" id="searchable" checked="checked" />
|
|
[% ELSE %]
|
|
<input type="checkbox" name="searchable" id="searchable" />
|
|
[% END %]
|
|
</li>
|
|
</ol>
|
|
</fieldset>
|
|
<fieldset class="action">
|
|
[% IF field %]
|
|
<input type="hidden" name="field_id" value="[% field.id | html %]" />
|
|
[% END %]
|
|
<input type="hidden" name="tablename" value="[% tablename | html %]" />
|
|
<input type="hidden" name="op" value="add" />
|
|
<input type="submit" value="Save" />
|
|
<a href="?tablename=[% tablename | uri %]" class="cancel">Cancel</a>
|
|
</fieldset>
|
|
</form>
|
|
[% END %]
|
|
|
|
</main>
|
|
</div> <!-- /.col-sm-10.col-sm-push-2 -->
|
|
|
|
<div class="col-sm-2 col-sm-pull-10">
|
|
<aside>
|
|
[% INCLUDE 'admin-menu.inc' %]
|
|
</aside>
|
|
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
|
|
</div> <!-- /.row -->
|
|
|
|
|
|
[% MACRO jsinclude BLOCK %]
|
|
[% INCLUDE "datatables.inc" %]
|
|
<script>
|
|
$(document).ready(function(){
|
|
$('#selecttable').find(":submit").hide();
|
|
$('#selecttable select').change(function() {
|
|
$('#selecttable').submit();
|
|
});
|
|
|
|
$("#fieldst").dataTable($.extend(true, {}, dataTablesDefaults, {
|
|
'bAutoWidth': false,
|
|
'sDom': 't<"bottom pager"ilpf>',
|
|
'sPaginationType': 'full',
|
|
'aLengthMenu': [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
|
|
'iDisplayLength': 20,
|
|
'aaSorting': [[ 0, "asc" ]],
|
|
}));
|
|
|
|
$(".confirmdelete").click(function(){
|
|
return confirm(_("Are you sure you want to delete this field?"));
|
|
});
|
|
|
|
$("#add_field").on('submit', function() {
|
|
if ( $("#marcfield").length && $("select[name='authorised_value_category']").length ) {
|
|
if ( $("#marcfield").val().length > 0
|
|
&& $("select[name='authorised_value_category']" ).val().length > 0 ) {
|
|
alert(_("You cannot select an authorised value category and a MARC field") );
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
});
|
|
});
|
|
</script>
|
|
[% END %]
|
|
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|