]> git.sur5r.net Git - bacula/bacula/blobdiff - gui/bacula-web/jobs.php
bacula-web: Added / updated GPL copyright header in php scripts
[bacula/bacula] / gui / bacula-web / jobs.php
index 4a74a3246958806c594f069e39036d2df7b9fb59..27e829d23e60bfe2d45a2b39648bc3e64bb4c285 100644 (file)
@@ -1,35 +1,34 @@
 <?php
+/* 
++-------------------------------------------------------------------------+
+| Copyright 2010-2011, Davide Franco                                             |
+|                                                                         |
+| This program is free software; you can redistribute it and/or           |
+| modify it under the terms of the GNU General Public License             |
+| as published by the Free Software Foundation; either version 2          |
+| of the License, or (at your option) any later version.                  |
+|                                                                         |
+| This program is distributed in the hope that it will be useful,         |
+| but WITHOUT ANY WARRANTY; without even the implied warranty of          |
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           |
+| GNU General Public License for more details.                            |
++-------------------------------------------------------------------------+ 
+*/
   session_start();
-  require_once ("paths.php");
-  require_once ($smarty_path."Smarty.class.php");
-  require_once ("bweb.inc.php");
-  require_once ("config.inc.php");  
+  include_once( 'config.inc.php' );
 
-  $smarty = new Smarty();     
   $dbSql = new Bweb();
-
-  require("lang.php");
-
-  // Smarty configuration
-  $smarty->compile_check = true;
-  $smarty->debugging = false;
-  $smarty->force_compile = true;
-
-  $smarty->template_dir = "./templates";
-  $smarty->compile_dir = "./templates_c";
-  $smarty->config_dir     = "./configs";
-  
   // Jobs list
   $query          = "";
   $last_jobs = array();
   
   // Job Status list
   $job_status = array( 'Any', 'Waiting', 'Running', 'Completed', 'Failed', 'Canceled' );
-  $smarty->assign( 'job_status', $job_status );
+  $dbSql->tpl->assign( 'job_status', $job_status );
   
   // Jobs per page
   $jobs_per_page = array( 25,50,75,100,150 );
-  $smarty->assign( 'jobs_per_page', $jobs_per_page );
+  $dbSql->tpl->assign( 'jobs_per_page', $jobs_per_page );
 
   // Global variables
   $job_level = array( 'D' => 'Diff', 'I' => 'Incr', 'F' => 'Full' );
                        $query .= "WHERE Job.JobStatus = 'R' ";
                break;
                case 'waiting':
-                       $query .= "WHERE Job.JobStatus IN ('F','S','M','m','s','j','c','d','t','C','R') ";
+                       $query .= "WHERE Job.JobStatus IN ('F','S','M','m','s','j','c','d','t','p','C') ";
                break;
                case 'completed':
-                       $query .= "WHERE Job.JobStatus = 'T' ";
+                       $query .= "WHERE Job.JobStatus IN ('T', 'E') ";
                break;
                case 'failed':
                        $query .= "WHERE Job.JobStatus = 'f' ";
                
                // Determine icon for job status
                switch( $job['JobStatus'] ) {
-                       case 'R':
+                       case J_RUNNING:
                                $job['Job_icon'] = "running.png";
                        break;
-                       case 'T':
-                               $job['Job_icon'] = "s_ok.png";
+                       case J_COMPLETED:
+                               $job['Job_icon'] = "ok.png";
+                       break;
+                       case J_CANCELED:
+                               $job['Job_icon'] = "canceled.png";
+                       break;
+                       case J_COMPLETED_ERROR:
+                               $job['Job_icon'] = "warning.png";
                        break;
-                       case 'A':
-                       case 'f':
-                       case 'E':
-                               $job['Job_icon'] = "s_error.gif";
+                       case J_FATAL:
+                               $job['Job_icon'] = "error.png";
                        break;
-                       case 'F':
-                       case 'S':
-                       case 'M':
-                       case 'm':
-                       case 's':
-                       case 'j':
-                       case 'c':
-                       case 'd':
-                       case 't':
-                       case 'C':
+                       case J_WAITING_CLIENT:
+                       case J_WAITING_SD:
+                       case J_WAITING_MOUNT_MEDIA:
+                       case J_WAITING_NEW_MEDIA:
+                       case J_WAITING_STORAGE_RES:
+                       case J_WAITING_JOB_RES:
+                       case J_WAITING_CLIENT_RES:
+                       case J_WAITING_MAX_JOBS:
+                       case J_WAITING_START_TIME:
+                       case J_NOT_RUNNING:
                                $job['Job_icon'] = "waiting.png";
                        break;
                } // end switch
                array_push( $last_jobs, $job);
          }
   }
-  $smarty->assign( 'last_jobs', $last_jobs );
+  $dbSql->tpl->assign( 'last_jobs', $last_jobs );
   
   // Count jobs
   if( isset( $_POST['status'] ) )
   else
        $total_jobs = $dbSql->CountJobs( ALL );
   
-  $smarty->assign( 'total_jobs', $total_jobs );
+  $dbSql->tpl->assign( 'total_jobs', $total_jobs );
   
   // Process and display the template 
-  $smarty->display('jobs.tpl');
+  $dbSql->tpl->display('jobs.tpl');
 ?>