fdffa64f08e077d0e945e27b5e2d574947657ce1
[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
20   my $locale = Locale->new($::lx_office_conf{system}->{language}, "installationcheck");
21
22   print(qq|content-type: text/html
23
24 <html>
25  <head>
26   <link rel="stylesheet" href="css/lx-office-erp.css" type="text/css"
27         title="kivitendo stylesheet">
28   <title>| . $locale->text("One or more Perl modules missing") . qq|</title>
29  </head>
30  <body>
31
32   <h1>| . $locale->text("One or more Perl modules missing") . qq|</h1>
33
34   <p>| . $locale->text("At least one Perl module that kivitendo ERP " .
35                        "requires for running is not installed on your " .
36                        "system.") .
37         " " .
38         $locale->text("Please install the below listed modules or ask your " .
39                       "system administrator to.") .
40         " " .
41         $locale->text("You cannot continue before all required modules are " .
42                       "installed.") . qq|</p>
43
44   <p>
45    <table>
46     <tr>
47      <th class="listheading">| . $locale->text("Module name") . qq|</th>
48      <th class="listheading">| . $locale->text("Module home page") . qq|</th>
49     </tr>
50
51 |);
52
53   my $odd = 1;
54   foreach my $module (@missing_modules) {
55     print(qq|
56      <tr class="listrow${odd}">
57       <td><code>$module->{name}</code></td>
58       <td><a href="$module->{url}">$module->{url}</a></td>
59      </tr>|);
60     $odd = 1 - $odd;
61   }
62
63   print(qq|
64    </table>
65   </p>
66
67   <p>| . $locale->text("There are usually three ways to install " .
68                        "Perl modules.") .
69         " " .
70         $locale->text("The preferred one is to install packages provided by " .
71                       "your operating system distribution (e.g. Debian or " .
72                       "RPM packages).") . qq|</p>
73
74   <p>| . $locale->text("The second way is to use Perl's CPAN module and let " .
75                        "it download and install the module for you.") .
76         " " .
77         $locale->text("Here's an example command line:") . qq|</p>
78
79   <p><code>perl -MCPAN -e &quot;install Config::Std&quot;</code></p>
80
81   <p>| . $locale->text("The third way is to download the module from the " .
82                        "above mentioned URL and to install the module " .
83                        "manually following the installations instructions " .
84                        "contained in the source archive.") . qq|</p>
85
86  </body>
87 </html>
88 |);
89
90   ::end_of_request();
91 }
92
93 1;