Beim Login wird jetzt ein Check durchgeführt, ob alle benötigten Perl-Module installi...
[kivitendo-erp.git] / bin / mozilla / installationcheck.pl
diff --git a/bin/mozilla/installationcheck.pl b/bin/mozilla/installationcheck.pl
new file mode 100644 (file)
index 0000000..6e1dfc6
--- /dev/null
@@ -0,0 +1,85 @@
+use SL::InstallationCheck;
+
+sub verify_installation {
+  my $script = $0;
+  $script =~ s|.*/||;
+
+  return unless ($form{"action"} && ($script eq "login.pl"));
+
+  my @missing_modules = SL::InstallationCheck::test_all_modules();
+  return if (scalar(@missing_modules) == 0);
+
+  use SL::Locale;
+  my $locale = new Locale($language, "installationcheck");
+
+  print(qq|content-type: text/html
+
+<html>
+ <head>
+  <link rel="stylesheet" href="css/lx-office-erp.css" type="text/css"
+        title="Lx-Office stylesheet">
+  <title>| . $locale->text("One or more Perl modules missing") . qq|</title>
+ </head>
+ <body>
+
+  <h1>| . $locale->text("One or more Perl modules missing") . qq|</h1>
+
+  <p>| . $locale->text("At least one Perl module that Lx-Office ERP " .
+                       "requires for running is not installed on your " .
+                       "system.") .
+        " " .
+        $locale->text("Please install the below listed modules or ask your " .
+                      "system administrator to.") .
+        " " .
+        $locale->text("You cannot continue before all required modules are " .
+                      "installed.") . qq|</p>
+
+  <p>
+   <table>
+    <tr>
+     <th class="listheading">| . $locale->text("Module name") . qq|</th>
+     <th class="listheading">| . $locale->text("Module home page") . qq|</th>
+    </tr>
+
+|);
+
+  my $odd = 1;
+  foreach my $module (@missing_modules) {
+    print(qq|
+     <tr class="listrow${odd}">
+      <td><code>$module->{name}</code></td>
+      <td><a href="$module->{url}">$module->{url}</a></td>
+     </tr>|);
+    $odd = 1 - $odd;
+  }
+
+  print(qq|
+   </table>
+  </p>
+
+  <p>| . $locale->text("There are usually three ways to install " .
+                       "Perl modules.") .
+        " " .
+        $locale->text("The preferred one is to install packages provided by " .
+                      "your operating system distribution (e.g. Debian or " .
+                      "RPM packages).") . qq|</p>
+
+  <p>| . $locale->text("The second way is to use Perl's CPAN module and let " .
+                       "it download and install the module for you.") .
+        " " .
+        $locale->text("Here's an example command line:") . qq|</p>
+
+  <p><code>perl -MCPAN -e &quot;install CGI::Ajax&quot;</code></p>
+
+  <p>| . $locale->text("The third way is to download the module from the " .
+                       "above mentioned URL and to install the module " .
+                       "manually following the installations instructions " .
+                       "contained in the source archive.") . qq|</p>
+
+ </body>
+</html>
+|);
+  exit(0);
+}
+
+1;