1 | <?php |
---|
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 | * |
---|
22 | */ |
---|
23 | |
---|
24 | include_once "./libtoga.php"; |
---|
25 | |
---|
26 | if ( !empty( $_GET ) ) { |
---|
27 | extract( $_GET ); |
---|
28 | } |
---|
29 | |
---|
30 | $httpvars = new HTTPVariables( $HTTP_GET_VARS, $_GET ); |
---|
31 | $view = $httpvars->getHttpVar( "view" ); |
---|
32 | $clustername = $httpvars->getClusterName(); |
---|
33 | |
---|
34 | //printf("clustername = %s\n", $clustername ); |
---|
35 | if( isset($id) && ($id!='')) $filter[id]=$id; |
---|
36 | if( isset($state) && ($state!='')) $filter[state]=$state; |
---|
37 | if( isset($user) && ($user!='')) $filter[user]=$user; |
---|
38 | if( isset($queue) && ($queue!='')) $filter[queue]=$queue; |
---|
39 | |
---|
40 | function drawSmallClusterImage() { |
---|
41 | |
---|
42 | global $clustername; |
---|
43 | |
---|
44 | $ic = new ClusterImage( $clustername ); |
---|
45 | $ic->draw(); |
---|
46 | } |
---|
47 | |
---|
48 | function drawBigClusterImage() { |
---|
49 | |
---|
50 | global $filter, $clustername; |
---|
51 | |
---|
52 | $ic = new ClusterImage( $clustername ); |
---|
53 | foreach( $filter as $filtername=>$filtervalue ) { |
---|
54 | //printf("filter %s,%s\n", $filtername, $filtervalue); |
---|
55 | switch( $filtername ) { |
---|
56 | |
---|
57 | case "id": |
---|
58 | $ic->setFilter( 'jobid', $filtervalue ); |
---|
59 | break; |
---|
60 | case "user": |
---|
61 | $ic->setFilter( 'owner', $filtervalue); |
---|
62 | break; |
---|
63 | case "queue": |
---|
64 | $ic->setFilter( 'queue', $filtervalue); |
---|
65 | break; |
---|
66 | case "state": |
---|
67 | $ic->setFilter( 'status', $filtervalue); |
---|
68 | break; |
---|
69 | default: |
---|
70 | break; |
---|
71 | } |
---|
72 | } |
---|
73 | $ic->draw(); |
---|
74 | } |
---|
75 | |
---|
76 | switch( $view ) { |
---|
77 | |
---|
78 | case "small-clusterimage": |
---|
79 | |
---|
80 | drawSmallClusterImage(); |
---|
81 | |
---|
82 | break; |
---|
83 | |
---|
84 | case "big-clusterimage": |
---|
85 | |
---|
86 | drawBigClusterImage(); |
---|
87 | |
---|
88 | break; |
---|
89 | |
---|
90 | default: |
---|
91 | |
---|
92 | break; |
---|
93 | } |
---|
94 | |
---|
95 | ?> |
---|