[110] | 1 | <?php |
---|
[225] | 2 | /* |
---|
| 3 | * |
---|
| 4 | * This file is part of Jobmonarch |
---|
| 5 | * |
---|
| 6 | * Copyright (C) 2006 Ramon Bastiaans |
---|
| 7 | * |
---|
| 8 | * Jobmonarch is free software; you can redistribute it and/or modify |
---|
| 9 | * it under the terms of the GNU General Public License as published by |
---|
| 10 | * the Free Software Foundation; either version 2 of the License, or |
---|
| 11 | * (at your option) any later version. |
---|
| 12 | * |
---|
| 13 | * Jobmonarch is distributed in the hope that it will be useful, |
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | * GNU General Public License for more details. |
---|
| 17 | * |
---|
| 18 | * You should have received a copy of the GNU General Public License |
---|
| 19 | * along with this program; if not, write to the Free Software |
---|
| 20 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
| 21 | * |
---|
[231] | 22 | * SVN $Id: image.php 298 2007-03-30 13:21:17Z bastiaans $ |
---|
[225] | 23 | */ |
---|
| 24 | |
---|
[110] | 25 | include_once "./libtoga.php"; |
---|
| 26 | |
---|
[122] | 27 | if ( !empty( $_GET ) ) { |
---|
| 28 | extract( $_GET ); |
---|
| 29 | } |
---|
| 30 | |
---|
[117] | 31 | $httpvars = new HTTPVariables( $HTTP_GET_VARS, $_GET ); |
---|
[110] | 32 | $view = $httpvars->getHttpVar( "view" ); |
---|
[111] | 33 | $clustername = $httpvars->getClusterName(); |
---|
[110] | 34 | |
---|
[163] | 35 | //printf("clustername = %s\n", $clustername ); |
---|
[124] | 36 | if( isset($id) && ($id!='')) $filter[id]=$id; |
---|
| 37 | if( isset($state) && ($state!='')) $filter[state]=$state; |
---|
| 38 | if( isset($user) && ($user!='')) $filter[user]=$user; |
---|
| 39 | if( isset($queue) && ($queue!='')) $filter[queue]=$queue; |
---|
[122] | 40 | |
---|
[110] | 41 | function drawSmallClusterImage() { |
---|
| 42 | |
---|
[164] | 43 | global $clustername; |
---|
| 44 | |
---|
[298] | 45 | $data_gatherer = new DataGatherer( $clustername ); |
---|
| 46 | $data_gatherer->parseXML(); |
---|
| 47 | |
---|
| 48 | if( $data_gatherer->isJobmonRunning() ) |
---|
| 49 | $ic = new ClusterImage( $clustername ); |
---|
| 50 | else |
---|
| 51 | $ic = new EmptyImage(); |
---|
| 52 | |
---|
[110] | 53 | $ic->draw(); |
---|
| 54 | } |
---|
| 55 | |
---|
| 56 | function drawBigClusterImage() { |
---|
| 57 | |
---|
[163] | 58 | global $filter, $clustername; |
---|
[122] | 59 | |
---|
| 60 | $ic = new ClusterImage( $clustername ); |
---|
[124] | 61 | foreach( $filter as $filtername=>$filtervalue ) { |
---|
| 62 | //printf("filter %s,%s\n", $filtername, $filtervalue); |
---|
| 63 | switch( $filtername ) { |
---|
[122] | 64 | |
---|
[124] | 65 | case "id": |
---|
| 66 | $ic->setFilter( 'jobid', $filtervalue ); |
---|
| 67 | break; |
---|
| 68 | case "user": |
---|
| 69 | $ic->setFilter( 'owner', $filtervalue); |
---|
| 70 | break; |
---|
| 71 | case "queue": |
---|
| 72 | $ic->setFilter( 'queue', $filtervalue); |
---|
| 73 | break; |
---|
| 74 | case "state": |
---|
| 75 | $ic->setFilter( 'status', $filtervalue); |
---|
| 76 | break; |
---|
| 77 | default: |
---|
| 78 | break; |
---|
| 79 | } |
---|
[122] | 80 | } |
---|
[114] | 81 | $ic->draw(); |
---|
[110] | 82 | } |
---|
| 83 | |
---|
| 84 | switch( $view ) { |
---|
| 85 | |
---|
| 86 | case "small-clusterimage": |
---|
| 87 | |
---|
| 88 | drawSmallClusterImage(); |
---|
| 89 | |
---|
| 90 | break; |
---|
| 91 | |
---|
| 92 | case "big-clusterimage": |
---|
| 93 | |
---|
| 94 | drawBigClusterImage(); |
---|
| 95 | |
---|
| 96 | break; |
---|
| 97 | |
---|
| 98 | default: |
---|
| 99 | |
---|
| 100 | break; |
---|
| 101 | } |
---|
| 102 | |
---|
| 103 | ?> |
---|