]> git.sur5r.net Git - bacula/bacula/commitdiff
bacula-web: Improved test page
authorDavide Franco <bacula-dev@dflc.ch>
Fri, 22 Oct 2010 16:22:37 +0000 (18:22 +0200)
committerEric Bollengier <eric@eb.homelinux.org>
Tue, 2 Nov 2010 07:20:31 +0000 (08:20 +0100)
 - Added smarty cache directory test
 - Added new simplegraph.php script
 - Improved php code
 - Improved lisibility of test page

gui/bacula-web/simplegraph.php [new file with mode: 0644]
gui/bacula-web/test.php

diff --git a/gui/bacula-web/simplegraph.php b/gui/bacula-web/simplegraph.php
new file mode 100644 (file)
index 0000000..9dcfa26
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+require_once 'external_packages/phplot/phplot.php';
+
+$plot = new PHPlot(400, 300);
+
+$data = array(
+  array('', 100, 100, 200, 100),
+  array('', 150, 100, 150, 100),
+);
+$plot->SetImageBorderType('plain');
+$plot->SetDataType('text-data');
+$plot->SetDataValues($data);
+$plot->SetPlotType('pie');
+//$plot->SetShading( '5' )
+
+$plot->DrawGraph();
+
+?>
\ No newline at end of file
index 688f109b1e825cdd5083ac7755d01c467390dcea..cba418ea83e5a5a33317eb358255337d4e759840 100644 (file)
 <?php
-
-function Check($function,$text,$description="") {
+       require_once "DB.php";
        
-       if  (!function_exists($function) )
-               echo "<font color=red>NO</font></td> <td> ".$text." disabled</td><td>&nbsp;".$description;
-       else
-               echo "<font color=green>YES</font></td>  <td> ".$text." enabled<td>&nbsp;";
-}
-
+       function Checkold($function,$text,$description="") 
+       {
+               if  (!function_exists($function) )
+                       echo "<td> ".$text." disabled</td><td>&nbsp;" . $description;
+               else
+                       echo "<td> " . $text . " enabled<td>&nbsp;";
+       }
+       
+       function Check( $support, $description, $error_message )
+       {
+               $result  = "Checking " . $description . " </td>";
+               $ok      = false;
+               
+               switch( $support )
+               {
+                       case 'php-gettext':
+                               if( function_exists( 'gettext') )
+                                       $ok = true;
+                       break;
+                       case 'php-gd':
+                               if( function_exists( 'gd_info') )
+                                       $ok = true;
+                       break;
+                       case 'pear-db':
+                               if ( class_exists('DB') )
+                                       $ok = true;
+                       break;
+                       case 'smarty-cache':
+                               if ( is_writable( "./templates_c" ) )
+                                       $ok = true;
+                       break;
+               } 
+               if( $ok )
+                       $result .= "<td width='300'>&nbsp;</td> <td> <img width='30' src='images/s_ok.gif' />";
+               else
+                       $result .= "<td width='300'>$error_message</td> <td width='35'> <img width='30' src='images/s_error.gif' />";
+               
+               echo $result;
+       }
 ?>
 
-<html>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
+  "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
 <head>
-       <title>Testing page</title>
+       <title>Bacula-web - Test page</title>
+       
+       <style type="text/css">
+               body{
+                       font-family: arial, verdana, helvetica;
+                       font-size: 10pt;
+                       padding-left: 100px;
+               }
+               table{
+                       
+                       margin: 20px 0px 0px 100px;
+                       border: thin solid black;
+                       border-collapse: collapse;
+               }
+               td{
+                       margin: 0px;
+                       padding: 1em;
+                       border-top: thin solid black;
+               }
+               img{
+                       margin-top: 1em;
+               }
+               
+       </style>
 </head>
 <body>
 
-Checking system for dependencies...<br><br><br>
-<table width=100% border=0>
+<table>
 <tr>
-       <td width=20%>
-               Checking gettext:
-               <? Check("gettext","Language support", "If you want view Bacula-web in your language, please compile PHP with Gettext");?>
+       <td width="300">
+               <?php 
+                       Check( "php-gettext", "PHP Gettext support", "If you want Bacula-web in your language, please compile PHP with Gettext support" );
+               ?>
        </td>
 </tr>
 <tr>
-       <td width=20%>
-               Checking Pear(DB):
-               <? 
-                       if (@include_once("DB.php") )
-                               echo "<font color=green>YES</font></td>  <td> Pear DB enabled</td><td>&nbsp;";
-                       else
-                               echo "<font color=red>NO</font></td> <td> Pear DB NOT FOUND</td><td>This is required. Please download from <a href=\"http://pear.php.net/package/DB/download\">http://pear.php.net/package/DB/download</a> .";
+       <td>
+               <?php 
+                       Check("pear-db", "PEAR DB support", "PEAR DB support not found, please read the Bacula-web installation document");
                ?>
        </td>
 </tr>
 <tr>
        <td>
-               Checking GD:
-               <?Check("gd_info","GD support", "This is required. Please, compile php with GD support");?>
+               <?php
+                       Check( "php-gd", "PHP GD support", "This is required by phplot, please compile php with GD support" );
+               ?>
+       </td>
+</tr>
+<tr>
+       <td>
+               <?php
+                       Check( "smarty-cache", "Smarty cache folder write permission", "Smarty template engine need write permissions to templates_c folder" );
+               ?>
        </td>
 </tr>
-</table>
-<br><br>
 
-Please, click the link below to test your graph system capabilities (Bacula-web only use PNG): <br>
+<tr>
+       <td colspan="3">
+               <center>
+                       Testing your graph system capabilities (Bacula-web only use PNG) <br />
+                       <img src="simplegraph.php" /> 
+               </center>
+       </td>
+</tr>
+</table>
 
-<a href="external_packages/phplot/examples/test_setup.php" target="_blank">Test</a>
 </body>
+
 </html>
\ No newline at end of file