Aufrufe von 'exit' durch eigene Funktion '::end_of_request()' ersetzt.
[kivitendo-erp.git] / bin / mozilla / installationcheck.pl
1 use SL::InstallationCheck;
2
3 use strict;
4
5 sub verify_installation {
6   my $script = $0;
7   $script =~ s|.*/||;
8
9   my $form     = $main::form;
10
11   return unless ($form->{"action"} && ($script eq "login.pl"));
12
13   SL::InstallationCheck::check_for_conditional_dependencies();
14
15   my @missing_modules = SL::InstallationCheck::test_all_modules();
16   return if (scalar(@missing_modules) == 0);
17
18   use SL::Locale;
19   my $locale = new Locale($main::language, "installationcheck");
20
21   print(qq|content-type: text/html
22
23 <html>
24  <head>
25   <link rel="stylesheet" href="css/lx-office-erp.css" type="text/css"
26         title="Lx-Office stylesheet">
27   <title>| . $locale->text("One or more Perl modules missing") . qq|</title>
28  </head>
29  <body>
30
31   <h1>| . $locale->text("One or more Perl modules missing") . qq|</h1>
32
33   <p>| . $locale->text("At least one Perl module that Lx-Office ERP " .
34                        "requires for running is not installed on your " .
35                        "system.") .
36         " " .
37         $locale->text("Please install the below listed modules or ask your " .
38                       "system administrator to.") .
39         " " .
40         $locale->text("You cannot continue before all required modules are " .
41                       "installed.") . qq|</p>
42
43   <p>
44    <table>
45     <tr>
46      <th class="listheading">| . $locale->text("Module name") . qq|</th>
47      <th class="listheading">| . $locale->text("Module home page") . qq|</th>
48     </tr>
49
50 |);
51
52   my $odd = 1;
53   foreach my $module (@missing_modules) {
54     print(qq|
55      <tr class="listrow${odd}">
56       <td><code>$module->{name}</code></td>
57       <td><a href="$module->{url}">$module->{url}</a></td>
58      </tr>|);
59     $odd = 1 - $odd;
60   }
61
62   print(qq|
63    </table>
64   </p>
65
66   <p>| . $locale->text("There are usually three ways to install " .
67                        "Perl modules.") .
68         " " .
69         $locale->text("The preferred one is to install packages provided by " .
70                       "your operating system distribution (e.g. Debian or " .
71                       "RPM packages).") . qq|</p>
72
73   <p>| . $locale->text("The second way is to use Perl's CPAN module and let " .
74                        "it download and install the module for you.") .
75         " " .
76         $locale->text("Here's an example command line:") . qq|</p>
77
78   <p><code>perl -MCPAN -e &quot;install CGI::Ajax&quot;</code></p>
79
80   <p>| . $locale->text("The third way is to download the module from the " .
81                        "above mentioned URL and to install the module " .
82                        "manually following the installations instructions " .
83                        "contained in the source archive.") . qq|</p>
84
85  </body>
86 </html>
87 |);
88
89   ::end_of_request();
90 }
91
92 1;