Owen Leonard
3e91d99a15
This patch is a reimplementation of the original from Indranil Das Gupta and the QA follow-up from Julian Maurice. Original test plan: Conformance rules for HTML5 is generating warnings for <script> element with type="text/javascript" attribute when the OPAC page is checked with W3C Validator. This patch removes the cause of these warnings. Test plan ========= 1/ Paste the URL to your OPAC page (if it is hosted) to W3C Validator and watch about 10+ warnings being generated by the validator. 2/ Apply patch and re-submit the page to the Validator. The warnings would be gone. Signed-off-by: Jon Knight <J.P.Knight@lboro.ac.uk> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
38 lines
1 KiB
PHP
38 lines
1 KiB
PHP
[% USE ColumnsSettings %]
|
|
|
|
<script>
|
|
function KohaTable(selector, dt_parameters, columns_settings) {
|
|
var id = 0;
|
|
var hidden_ids = [];
|
|
var included_ids = [];
|
|
$(columns_settings).each( function() {
|
|
var named_id = $( 'thead th[data-colname="' + this.columnname + '"]', selector ).index( selector+' th' );
|
|
|
|
var used_id = dt_parameters.bKohaColumnsUseNames ? named_id : id;
|
|
if ( used_id == -1 ) return;
|
|
|
|
if ( this['is_hidden'] == "1" ) {
|
|
hidden_ids.push( used_id );
|
|
}
|
|
if ( this['cannot_be_toggled'] == "0" ) {
|
|
included_ids.push( used_id );
|
|
}
|
|
id++;
|
|
});
|
|
dt_parameters[ "buttons" ] = [
|
|
{
|
|
extend: 'colvis',
|
|
columns: included_ids,
|
|
text: _("Column visibility"),
|
|
}
|
|
];
|
|
var table = $(selector).dataTable($.extend(true, {}, dataTablesDefaults, dt_parameters));
|
|
|
|
$(hidden_ids).each(function(index, value) {
|
|
table.fnSetColumnVis( value, false );
|
|
});
|
|
|
|
return table;
|
|
}
|
|
|
|
</script>
|