[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 305 2007-04-16 15:32:56Z 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 | |
---|
[303] | 41 | function drawHostImage() { |
---|
| 42 | |
---|
| 43 | global $clustername, $hostname; |
---|
| 44 | |
---|
| 45 | $data_gatherer = new DataGatherer( $clustername ); |
---|
| 46 | $data_gatherer->parseXML(); |
---|
| 47 | |
---|
| 48 | if( $data_gatherer->isJobmonRunning() ) |
---|
| 49 | $ic = new HostImage( $data_gatherer, $clustername, $hostname ); |
---|
| 50 | else |
---|
| 51 | $ic = new EmptyImage(); |
---|
| 52 | |
---|
| 53 | $ic->draw(); |
---|
| 54 | } |
---|
| 55 | |
---|
[110] | 56 | function drawSmallClusterImage() { |
---|
| 57 | |
---|
[164] | 58 | global $clustername; |
---|
| 59 | |
---|
[298] | 60 | $data_gatherer = new DataGatherer( $clustername ); |
---|
| 61 | $data_gatherer->parseXML(); |
---|
| 62 | |
---|
[305] | 63 | if( $data_gatherer->isJobmonRunning() ) { |
---|
[298] | 64 | $ic = new ClusterImage( $clustername ); |
---|
[305] | 65 | $ic->setSmall(); |
---|
| 66 | } else { |
---|
[298] | 67 | $ic = new EmptyImage(); |
---|
[305] | 68 | } |
---|
[298] | 69 | |
---|
[110] | 70 | $ic->draw(); |
---|
| 71 | } |
---|
| 72 | |
---|
| 73 | function drawBigClusterImage() { |
---|
| 74 | |
---|
[163] | 75 | global $filter, $clustername; |
---|
[122] | 76 | |
---|
| 77 | $ic = new ClusterImage( $clustername ); |
---|
[305] | 78 | $ic->setBig(); |
---|
[122] | 79 | |
---|
[300] | 80 | if( isset( $filter ) ) { |
---|
| 81 | foreach( $filter as $filtername=>$filtervalue ) { |
---|
| 82 | //printf("filter %s,%s\n", $filtername, $filtervalue); |
---|
| 83 | switch( $filtername ) { |
---|
| 84 | |
---|
| 85 | case "id": |
---|
| 86 | $ic->setFilter( 'jobid', $filtervalue ); |
---|
| 87 | break; |
---|
| 88 | case "user": |
---|
| 89 | $ic->setFilter( 'owner', $filtervalue); |
---|
| 90 | break; |
---|
| 91 | case "queue": |
---|
| 92 | $ic->setFilter( 'queue', $filtervalue); |
---|
| 93 | break; |
---|
| 94 | case "state": |
---|
| 95 | $ic->setFilter( 'status', $filtervalue); |
---|
| 96 | break; |
---|
| 97 | default: |
---|
| 98 | break; |
---|
| 99 | } |
---|
[124] | 100 | } |
---|
[122] | 101 | } |
---|
[114] | 102 | $ic->draw(); |
---|
[110] | 103 | } |
---|
| 104 | |
---|
| 105 | switch( $view ) { |
---|
| 106 | |
---|
| 107 | case "small-clusterimage": |
---|
| 108 | |
---|
| 109 | drawSmallClusterImage(); |
---|
| 110 | |
---|
| 111 | break; |
---|
| 112 | |
---|
| 113 | case "big-clusterimage": |
---|
| 114 | |
---|
| 115 | drawBigClusterImage(); |
---|
| 116 | |
---|
| 117 | break; |
---|
| 118 | |
---|
[303] | 119 | case "hostimage": |
---|
| 120 | |
---|
| 121 | drawHostImage(); |
---|
| 122 | |
---|
| 123 | break; |
---|
| 124 | |
---|
[110] | 125 | default: |
---|
| 126 | |
---|
| 127 | break; |
---|
| 128 | } |
---|
| 129 | |
---|
| 130 | ?> |
---|