From dd8c3e58366905388837e528e48197db81bfa30d Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Wed, 7 Feb 2024 16:45:48 +0000 Subject: [PATCH] Bug 32693: Proof of concept This is a PoC for discussion. Now, only the tab being viewed is processed and loaded. --- about.pl | 62 ++++++++++++----- .../prog/en/includes/html_helpers.inc | 12 ++++ .../intranet-tmpl/prog/en/modules/about.tt | 67 ++++++++++--------- 3 files changed, 90 insertions(+), 51 deletions(-) diff --git a/about.pl b/about.pl index 218c384b389..62df3d93bbb 100755 --- a/about.pl +++ b/about.pl @@ -61,6 +61,8 @@ use Koha::Filter::MARC::ViewPolicy; use C4::Members::Statistics; my $query = CGI->new; +my $params = $query->Vars(); + my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { template_name => "about.tt", @@ -70,6 +72,26 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); +my $tab = $params->{tab} || 'about'; + +$template->param( + tab => $tab, +); + +my $docdir; +if ( defined C4::Context->config('docdir') ) { + $docdir = C4::Context->config('docdir'); +} else { + + # if no is defined in koha-conf.xml, use the default location + # this is a work-around to stop breakage on upgraded Kohas, bug 8911 + $docdir = C4::Context->config('intranetdir') . '/docs'; +} + +my %versions = C4::Context::get_versions(); + +if ( $tab eq 'about' ) { + my $config_timezone = C4::Context->config('timezone') // ''; my $config_invalid = !DateTime::TimeZone->is_valid_name( $config_timezone ); my $env_timezone = $ENV{TZ} // ''; @@ -162,9 +184,21 @@ $template->param( memcached_namespace => $memcached_namespace, is_memcached_still_active => $is_memcached_still_active, where_is_memcached_config => $where_is_memcached_config, + perlPath => $perl_path, + zebraVersion => $zebraVersion, + kohaVersion => $versions{'kohaVersion'}, + osVersion => $versions{'osVersion'}, + perlVersion => $versions{'perlVersion'}, + perlIncPath => [ map { perlinc => $_ }, @INC ], + mysqlVersion => $versions{'mysqlVersion'}, + apacheVersion => $versions{'apacheVersion'}, memcached_running => Koha::Caches->get_instance->memcached_cache, ); +} + +if($tab eq 'sysinfo') { + # Additional system information for warnings my $warnStatisticsFieldsError; @@ -654,17 +688,7 @@ $template->param( 'bad_yaml_prefs' => \@bad_yaml_prefs ) if @bad_yaml_prefs; $template->param( warnDbRowFormat => C4::Installer->has_non_dynamic_row_format ); } -my %versions = C4::Context::get_versions(); - $template->param( - kohaVersion => $versions{'kohaVersion'}, - osVersion => $versions{'osVersion'}, - perlPath => $perl_path, - perlVersion => $versions{'perlVersion'}, - perlIncPath => [ map { perlinc => $_ }, @INC ], - mysqlVersion => $versions{'mysqlVersion'}, - apacheVersion => $versions{'apacheVersion'}, - zebraVersion => $zebraVersion, prefRequireChoosingExistingAuthority => $prefRequireChoosingExistingAuthority, prefAutoCreateAuthorities => $prefAutoCreateAuthorities, warnPrefRequireChoosingExistingAuthority => $warnPrefRequireChoosingExistingAuthority, @@ -682,6 +706,9 @@ $template->param( xml_config_warnings => \@xml_config_warnings, warnStatisticsFieldsError => $warnStatisticsFieldsError, ); +} + +if ( $tab eq 'perl' ) { my @components = (); @@ -734,17 +761,12 @@ if (scalar(@$row) > 0) { $template->param( table => $table ); +} + +if ( $tab eq 'team' ) { ## ------------------------------------------ ## Koha contributions -my $docdir; -if ( defined C4::Context->config('docdir') ) { - $docdir = C4::Context->config('docdir'); -} else { - # if no is defined in koha-conf.xml, use the default location - # this is a work-around to stop breakage on upgraded Kohas, bug 8911 - $docdir = C4::Context->config('intranetdir') . '/docs'; -} ## Release teams my $teams = @@ -840,6 +862,9 @@ $template->param( contributors => \@people ); $template->param( maintenance_team => $teams->{team}->{$dev_team} ); $template->param( release_team => $teams->{team}->{$short_version} ); +} +if ( $tab eq 'history' ) { + ## Timeline if ( open( my $file, "<:encoding(UTF-8)", "$docdir" . "/history.txt" ) ) { @@ -879,5 +904,6 @@ if ( open( my $file, "<:encoding(UTF-8)", "$docdir" . "/history.txt" ) ) { } else { $template->param( timeline_read_error => 1 ); } +} output_html_with_http_headers $query, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc index 535cbca2c91..f1a1d69e55c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc @@ -387,6 +387,18 @@ [% END %] +[% BLOCK tab_item_link %] + [% IF ( bt_active ) %] +
  • + [% END %] + + [% content | $raw %] + +
  • +[% END %] + [% BLOCK tab_item %] [% IF ( bt_active ) %]