Bug 26060: Compiled CSS
[koha.git] / admin / columns_settings.pl
blob51d1d56d7547605b56fdd385a3c1ab2b82ae6583
1 #!/usr/bin/perl
3 use Modern::Perl;
4 use CGI;
5 use YAML qw( LoadFile );
6 use C4::Auth;
7 use C4::Context;
8 use C4::Output;
9 use C4::Utils::DataTables::TablesSettings qw( get_modules );
10 my $input = new CGI;
12 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
14 template_name => "admin/columns_settings.tt",
15 query => $input,
16 type => "intranet",
17 authnotrequired => 0,
18 flagsrequired => { parameters => 'manage_column_config' },
19 debug => 1,
23 my $action = $input->param('action') // 'list';
25 if ( $action eq 'save' ) {
26 my $module = $input->param('module');
27 my @columnids = $input->multi_param("columnid");
28 my @columns;
29 for my $columnid (@columnids) {
30 next unless $columnid =~ m|^([^#]*)#([^#]*)#(.*)$|;
31 my $is_hidden = $input->param( $columnid . '_hidden' ) // 0;
32 my $cannot_be_toggled =
33 $input->param( $columnid . '_cannot_be_toggled' ) // 0;
34 push @columns,
36 module => $module,
37 page => $1,
38 tablename => $2,
39 columnname => $3,
40 is_hidden => $is_hidden,
41 cannot_be_toggled => $cannot_be_toggled,
45 C4::Utils::DataTables::TablesSettings::update_columns(
47 columns => \@columns,
51 my @table_ids = $input->multi_param('table_id');
52 for my $table_id (@table_ids) {
53 next unless $table_id =~ m|^([^#]*)#(.*)$|;
54 my $default_display_length = $input->param( $table_id . '_default_display_length' );
55 my $default_sort_order = $input->param( $table_id . '_default_sort_order' );
56 if ( defined $default_display_length && $default_display_length ne ""
57 && defined $default_sort_order && $default_sort_order ne "" ) {
58 C4::Utils::DataTables::TablesSettings::update_table_settings(
60 module => $module,
61 page => $1,
62 tablename => $2,
63 default_display_length => $default_display_length,
64 default_sort_order => $default_sort_order,
70 $action = 'list';
73 if ( $action eq 'list' ) {
74 my $modules = C4::Utils::DataTables::TablesSettings::get_modules;
75 $template->param(
76 panel => ( $input->param('panel') || 0 ),
77 modules => $modules,
81 output_html_with_http_headers $input, $cookie, $template->output;