Bug 6539 - When searching the catalogue, if I get no results then hit the Z39.50...
[koha.git] / about.pl
1 #!/usr/bin/perl
2
3 # This file is part of Koha.
4 #
5 # Koha is free software; you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation; either version 2 of the License, or (at your option) any later
8 # version.
9 #
10 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License along with
15 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
16 # Suite 330, Boston, MA  02111-1307 USA
17
18 use strict;
19 use warnings;
20
21 use CGI;
22 use LWP::Simple;
23 use XML::Simple;
24 use Config;
25
26 use C4::Output;
27 use C4::Auth;
28 use C4::Context;
29 use C4::Installer;
30
31 #use Smart::Comments '####';
32
33 my $query = new CGI;
34 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
35     {
36         template_name   => "about.tmpl",
37         query           => $query,
38         type            => "intranet",
39         authnotrequired => 0,
40         flagsrequired   => { catalogue => 1 },
41         debug           => 1,
42     }
43 );
44
45 my $kohaVersion   = C4::Context::KOHAVERSION;
46 my $osVersion     = `uname -a`;
47 my $perl_path = $^X;
48 if ($^O ne 'VMS') {
49     $perl_path .= $Config{_exe} unless $perl_path =~ m/$Config{_exe}$/i;
50 }
51 my $perlVersion   = $];
52 my $mysqlVersion  = `mysql -V`;
53 my $apacheVersion = `httpd -v`;
54 $apacheVersion = `httpd2 -v` unless $apacheVersion;
55 $apacheVersion = (`/usr/sbin/apache2 -V`)[0] unless $apacheVersion;
56 my $zebraVersion = `zebraidx -V`;
57
58 $template->param(
59     kohaVersion   => $kohaVersion,
60     osVersion     => $osVersion,
61     perlPath      => $perl_path,
62     perlVersion   => $perlVersion,
63     perlIncPath   => [ map { perlinc => $_ }, @INC ],
64     mysqlVersion  => $mysqlVersion,
65     apacheVersion => $apacheVersion,
66     zebraVersion  => $zebraVersion,
67 );
68
69 my @components = ();
70
71 my $perl_modules = C4::Installer::PerlModules->new;
72 $perl_modules->version_info;
73
74 my @pm_types = qw(missing_pm upgrade_pm current_pm);
75
76 foreach my $pm_type(@pm_types) {
77     my $modules = $perl_modules->get_attr($pm_type);
78     foreach (@$modules) {
79         my ($module, $stats) = each %$_;
80         push(
81             @components,
82             {
83                 name    => $module,
84                 version => $stats->{'cur_ver'},
85                 missing => ($pm_type eq 'missing_pm' ? 1 : 0),
86                 upgrade => ($pm_type eq 'upgrade_pm' ? 1 : 0),
87                 current => ($pm_type eq 'current_pm' ? 1 : 0),
88                 require => $stats->{'required'},
89             }
90         );
91     }
92 }
93
94 @components = sort {$a->{'name'} cmp $b->{'name'}} @components;
95
96 my $counter=0;
97 my $row = [];
98 my $table = [];
99 foreach (@components) {
100     push (@$row, $_);
101     unless (++$counter % 4) {
102         push (@$table, {row => $row});
103         $row = [];
104     }
105 }
106 ## ## $table
107
108 $template->param( table => $table );
109
110
111 ## ------------------------------------------
112 ## Koha time line code
113
114 #get file location
115 my $dir = C4::Context->config('intranetdir');
116 open( my $file, "<", "$dir" . "/docs/history.txt" );
117 my $i = 0;
118
119 my @rows2 = ();
120 my $row2  = [];
121
122 my @lines = <$file>;
123 close($file);
124
125 shift @lines; #remove header row
126
127 foreach (@lines) {
128     my ( $date, $desc, $tag ) = split(/\t/);
129     push(
130         @rows2,
131         {
132             date => $date,
133             desc => $desc,
134         }
135     );
136 }
137
138 my $table2 = [];
139 #foreach my $row2 (@rows2) {
140 foreach  (@rows2) {
141     push (@$row2, $_);
142     push( @$table2, { row2 => $row2 } );
143     $row2 = [];
144 }
145
146 $template->param( table2 => $table2 );
147
148 output_html_with_http_headers $query, $cookie, $template->output;