Changeset 715
- Timestamp:
- 03/21/13 21:32:32 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.4/web/addons/job_monarch/index.php
r714 r715 33 33 include_once "./libtoga.php"; 34 34 35 if ( !empty( $_GET ) ) { 36 extract( $_GET ); 35 if ( !empty( $_GET ) ) 36 { 37 extract( $_GET ); 37 38 } 38 39 … … 52 53 if( !isset($sortby) ) $sortby = "id"; 53 54 54 if( isset( $filterorder ) && ($filterorder!='') ) { 55 $myfilter_fields = explode( ",", $filterorder ); 56 } else { 57 if( isset($queue) && ($queue!='')) $filter['queue']=$queue; 58 if( isset($state) && ($state!='')) $filter['state']=$state; 59 if( isset($owner) && ($owner!='')) $filter['owner']=$owner; 60 if( isset($id) && ($id!='')) $filter['id']=$id; 55 if( isset( $filterorder ) && ($filterorder!='') ) 56 { 57 $myfilter_fields = explode( ",", $filterorder ); 58 } 59 else 60 { 61 if( isset($queue) && ($queue!='')) $filter['queue']=$queue; 62 if( isset($state) && ($state!='')) $filter['state']=$state; 63 if( isset($owner) && ($owner!='')) $filter['owner']=$owner; 64 if( isset($id) && ($id!='')) $filter['id']=$id; 61 65 } 62 66 63 67 // Fill filter array in order they were picked by user 64 if( isset($myfilter_fields) ) { 65 66 foreach( $myfilter_fields as $myfilter ) { 67 68 switch( $myfilter ) { 69 70 case "queue": 71 $filter['queue']=$queue; 72 break; 73 case "state": 74 $filter['state']=$state; 75 break; 76 case "owner": 77 $filter['owner']=$owner; 78 break; 79 case "id": 80 $filter['id']=$id; 81 break; 82 } 83 } 84 } 85 86 function epochToDatetime( $epoch ) { 68 if( isset($myfilter_fields) ) 69 { 70 71 foreach( $myfilter_fields as $myfilter ) 72 { 73 74 switch( $myfilter ) 75 { 76 77 case "queue": 78 $filter['queue']=$queue; 79 break; 80 case "state": 81 $filter['state']=$state; 82 break; 83 case "owner": 84 $filter['owner']=$owner; 85 break; 86 case "id": 87 $filter['id']=$id; 88 break; 89 } 90 } 91 } 92 93 function epochToDatetime( $epoch ) 94 { 87 95 88 96 return strftime( "%d-%m-%Y %H:%M:%S", $epoch ); 89 97 } 90 98 91 function makeHeader( $page_call, $title, $longtitle ) { 92 93 global $tpl, $grid, $context, $initgrid; 94 global $jobrange, $jobstart; 95 global $page, $gridwalk, $clustername; 96 global $parentgrid, $physical, $hostname; 97 global $self, $filter, $cluster_url, $get_metric_string; 98 global $metrics, $reports, $m, $default_metric; 99 global $default_refresh, $filterorder, $view; 100 global $JOB_ARCHIVE, $period_start, $period_stop, $h, $id; 101 global $job_start, $job_stop, $range, $r, $metricname; 102 103 if( isset($default_metric) and !isset($m) ) 104 $metricname = $default_metric; 105 else 106 if( isset( $m ) ) 107 $metricname = $m; 108 else 109 $metricname = "load_one"; 110 111 $header = "header"; 112 113 # Maintain our path through the grid tree. 114 $me = $self . "@" . $grid[$self][AUTHORITY]; 115 116 $gridstack = array(); 117 $gridstack[] = $me; 118 119 if ($gridwalk=="fwd") { 120 # push our info on gridstack, format is "name@url>name2@url". 121 if (end($gridstack) != $me) { 122 $gridstack[] = $me; 123 } 124 } else if ($gridwalk=="back") { 125 # pop a single grid off stack. 126 if (end($gridstack) != $me) { 127 array_pop($gridstack); 128 } 129 } 130 131 $gridstack_str = join(">", $gridstack); 132 $gridstack_url = rawurlencode($gridstack_str); 133 134 if ($initgrid or $gridwalk) { 135 # Use cookie so we dont have to pass gridstack around within this site. 136 # Cookie values are automatically urlencoded. Expires in a day. 137 setcookie("gs", $gridstack_str, time() + 86400); 138 } 139 140 # Invariant: back pointer is second-to-last element of gridstack. Grid stack never 141 # has duplicate entries. 142 list($parentgrid, $parentlink) = explode("@", $gridstack[count($gridstack)-2]); 143 144 # Setup a redirect to a remote server if you choose a grid from pulldown menu. Tell 145 # destination server that we're walking foward in the grid tree. 146 if (strstr($clustername, "http://")) { 147 $tpl->assign("refresh", "0"); 148 $tpl->assign("redirect", ";URL=$clustername?gw=fwd&gs=$gridstack_url"); 149 echo "<h2>Redirecting, please wait...</h2>"; 150 $tpl->printToScreen(); 151 exit; 152 } 153 $tpl->gotoBlock( "_ROOT" ); 154 155 if( $view != "search" ) 156 $tpl->assign( "refresh", $default_refresh ); 157 158 $tpl->assign( "date", date("r") ); 159 $tpl->assign( "longpage_title", $longtitle ); 160 $tpl->assign( "page_title", $title ); 161 162 # The page to go to when "Get Fresh Data" is pressed. 163 $tpl->assign("page","./"); 164 165 # Templated Logo image 166 $tpl->assign("images","./templates/$template_name/images"); 167 168 # 169 # Used when making graphs via graph.php. Included in most URLs 170 # 171 $sort_url=rawurlencode($sort); 172 $get_metric_string = "m=$metric&r=$range&s=$sort_url&hc=$hostcols"; 173 174 if ($jobrange and $jobstart) 175 $get_metric_string .= "&jr=$jobrange&js=$jobstart"; 176 177 # Set the Alternate view link. 178 $cluster_url=rawurlencode($clustername); 179 $node_url=rawurlencode($hostname); 180 181 # Make some information available to templates. 182 $tpl->assign("cluster_url", $cluster_url); 183 # Build the node_menu 184 $node_menu = ""; 185 186 if ($parentgrid) { 187 $node_menu .= "<B>$parentgrid $meta_designator</B> "; 188 $node_menu .= "<B>></B>\n"; 189 } 190 191 # Show grid. 192 $mygrid = ($self == "unspecified") ? "" : $self; 193 $node_menu .= "<B><A HREF=\"../..\">$mygrid $meta_designator</A></B> "; 194 $node_menu .= "<B>></B>\n"; 195 196 if ($physical) 197 $node_menu .= hiddenvar("p", $physical); 198 199 if ( $clustername ) { 200 $url = rawurlencode($clustername); 201 $node_menu .= "<B><A HREF=\"../../?c=".rawurlencode($clustername)."\">$clustername</A></B> "; 202 $node_menu .= "<B>></B>\n"; 203 $node_menu .= hiddenvar("c", $clustername); 204 } 205 206 if (!count($metrics)) { 207 echo "<h4>Cannot find any metrics for selected cluster \"$clustername\", exiting.</h4>\n"; 208 echo "Check ganglia XML tree (telnet $ganglia_ip $ganglia_port)\n"; 209 exit; 210 } 211 reset($metrics); 212 $firsthost = key($metrics); 213 214 $mmfh = array(); 215 216 $mmfh = $metrics[$firsthost]; 217 218 $context_metrics = array(); 219 220 foreach( $mmfh as $mm => $bla ) 221 { 222 $context_metrics[] = $mm; 223 } 224 225 foreach ($reports as $mr => $mfoo) 226 $context_metrics[] = $mr; 227 228 $node_menu .= "<B><A HREF=\"./?c=".rawurlencode($clustername)."\">Joblist</A></B> "; 229 230 if( isset( $hostname ) && ( $view != 'host' ) ) { 231 232 $node_menu .= "<B>></B>\n"; 233 $href = "<A HREF=\"./?c=".rawurlencode($clustername)."&h=".$hostname."\">"; 234 $node_menu .= "<B>$href"; 235 $node_menu .= "host: $hostname</A></B> "; 236 } 237 238 if( count( $filter ) > 0 && $view != "search" ) { 239 240 $my_ct = 1; 241 $filter_nr = count( $filter ); 242 243 foreach( $filter as $filtername=>$filterval ) { 244 245 $node_menu .= "<B>></B>\n"; 246 247 $href = "<A HREF=\"./?c=".rawurlencode($clustername); 248 $temp_ct = 0; 249 $n_filter = $filter; 250 $my_filterorder = ""; 251 $my_filters = array_keys( $filter ); 252 253 foreach( $n_filter as $n_filtername=>$n_filterval ) { 254 255 if( $temp_ct < $my_ct ) { 256 $href .= "&". $n_filtername . "=" . $n_filterval; 257 258 if( $my_filterorder == "" ) 259 $my_filterorder = $my_filters[$temp_ct]; 260 else 261 $my_filterorder .= "," . $my_filters[$temp_ct]; 262 } 263 264 $temp_ct++; 265 } 266 $href .= "&filterorder=$my_filterorder\">"; 267 268 if( $my_ct < $filter_nr ) 269 $node_menu .= "<B>$href$filtername: $filterval</A></B> "; 270 else 271 $node_menu .= "<B>$filtername: $filterval</B> "; 272 273 $my_ct++; 274 } 275 } 276 277 $tpl->gotoBlock( "_ROOT" ); 278 $tpl->assignGlobal("view", $view); 279 280 281 if( array_key_exists( "id", $filter ) or isset($hostname) ) { 282 283 $range = "job"; 284 285 if( $page_call != "host_view" ) 286 { 287 288 if (is_array($context_metrics) ) { 289 $metric_menu = "<B>Metric</B> " 290 ."<SELECT NAME=\"m\" OnChange=\"toga_form.submit();\">\n"; 291 292 sort($context_metrics); 293 foreach( $context_metrics as $k ) { 294 $url = rawurlencode($k); 295 $metric_menu .= "<OPTION VALUE=\"$url\" "; 296 if ($k == $metricname ) 297 $metric_menu .= "SELECTED"; 298 $metric_menu .= ">$k\n"; 299 } 300 $metric_menu .= "</SELECT>\n"; 301 } 302 303 } 304 305 $tpl->assign("metric_menu", $metric_menu ); 306 307 if( $view == "search" or $view == "host" ) { 308 $tpl->newBlock("timeperiod"); 309 if( is_numeric( $period_start ) ) { 310 $period_start = epochToDatetime( $period_start ); 311 } 312 if( is_numeric( $period_stop ) ) { 313 $period_stop = epochToDatetime( $period_stop ); 314 } 315 $tpl->assign("period_start", $period_start ); 316 $tpl->assign("period_stop", $period_stop ); 317 $tpl->assign("hostname", $hostname ); 318 319 if( $view == "host" ) { 320 $tpl->newBlock("hostview"); 321 $tpl->assign("job_start", $job_start ); 322 $tpl->assign("job_stop", $job_stop ); 323 } 324 } 325 326 } 327 328 if( $view != "search" ) 329 { 330 $context_ranges[]="hour"; 331 $context_ranges[]="day"; 332 $context_ranges[]="week"; 333 $context_ranges[]="month"; 334 $context_ranges[]="year"; 335 $context_ranges[]="job"; 336 337 $range_menu = "<B>Last</B> " ."<SELECT NAME=\"r\" OnChange=\"toga_form.submit();\">\n"; 338 foreach ($context_ranges as $v) { 339 $url=rawurlencode($v); 340 $range_menu .= "<OPTION VALUE=\"$url\" "; 341 if ($v == $range) 342 $range_menu .= "SELECTED"; 343 $range_menu .= ">$v\n"; 344 } 345 $range_menu .= "</SELECT>\n"; 346 347 $tpl->assign("range_menu", $range_menu); 348 349 } 350 351 if( $view == "search" or $view == "host" ) { 352 353 $node_menu .= "<B>></B>\n"; 354 $node_menu .= "<B>Jobarchive</B> "; 355 $form_name = "archive_search_form"; 356 $tpl->assignGlobal("form_name", $form_name ); 357 358 } else { 359 $form_name = "toga_form"; 360 $tpl->assignGlobal("form_name", $form_name ); 361 } 362 363 if( $JOB_ARCHIVE && $page_call == 'overview' ) { 364 $tpl->newBlock( "search" ); 365 $tpl->assignGlobal( "cluster_url", rawurlencode($clustername) ); 366 $tpl->assignGlobal( "cluster", $clustername ); 367 } 368 $tpl->gotoBlock( "_ROOT" ); 369 $tpl->assignGlobal( "cluster", $clustername ); 370 $tpl->assign("node_menu", $node_menu); 371 372 # Make sure that no data is cached.. 373 header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); # Date in the past 374 header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); # always modified 375 header ("Cache-Control: no-cache, must-revalidate"); # HTTP/1.1 376 header ("Pragma: no-cache"); # HTTP/1.0 377 } 378 379 function makeFooter() { 380 global $tpl, $version, $parsetime, $monarchversion; 381 382 $tpl->gotoBlock( "_ROOT" ); 383 $tpl->assign("webfrontend-version",$version["webfrontend"]); 384 $tpl->assign("monarch-version", $monarchversion); 385 386 if ($version["gmetad"]) { 387 $tpl->assign("webbackend-component", "gmetad"); 388 $tpl->assign("webbackend-version",$version["gmetad"]); 389 } else if ($version["gmond"]) { 390 $tpl->assign("webbackend-component", "gmond"); 391 $tpl->assign("webbackend-version", $version["gmond"]); 392 } 393 394 $tpl->assign("parsetime", sprintf("%.4f", $parsetime) . "s"); 395 } 396 397 function includeSearchpage() { 398 global $tpl; 399 400 $tpl->assignInclude( "main", "templates/search.tpl" ); 401 402 } 403 404 function includeOverview() { 405 global $tpl; 406 407 $tpl->assignInclude( "main", "templates/overview.tpl" ); 408 } 409 410 function includeHostPage() { 411 412 global $tpl; 413 414 $tpl->assignInclude( "main", "templates/host_view.tpl" ); 99 function makeHeader( $page_call, $title, $longtitle ) 100 { 101 102 global $tpl, $grid, $context, $initgrid; 103 global $jobrange, $jobstart; 104 global $page, $gridwalk, $clustername; 105 global $parentgrid, $physical, $hostname; 106 global $self, $filter, $cluster_url, $get_metric_string; 107 global $metrics, $reports, $m, $default_metric; 108 global $default_refresh, $filterorder, $view; 109 global $JOB_ARCHIVE, $period_start, $period_stop, $h, $id; 110 global $job_start, $job_stop, $range, $r, $metricname; 111 112 if( isset($default_metric) and !isset($m) ) 113 $metricname = $default_metric; 114 else 115 if( isset( $m ) ) 116 $metricname = $m; 117 else 118 $metricname = "load_one"; 119 120 $header = "header"; 121 122 # Maintain our path through the grid tree. 123 $me = $self . "@" . $grid[$self][AUTHORITY]; 124 125 $gridstack = array(); 126 $gridstack[] = $me; 127 128 if ($gridwalk=="fwd") 129 { 130 # push our info on gridstack, format is "name@url>name2@url". 131 if (end($gridstack) != $me) 132 { 133 $gridstack[] = $me; 134 } 135 } 136 else if ($gridwalk=="back") 137 { 138 # pop a single grid off stack. 139 if (end($gridstack) != $me) 140 { 141 array_pop($gridstack); 142 } 143 } 144 145 $gridstack_str = join(">", $gridstack); 146 $gridstack_url = rawurlencode($gridstack_str); 147 148 if ($initgrid or $gridwalk) 149 { 150 # Use cookie so we dont have to pass gridstack around within this site. 151 # Cookie values are automatically urlencoded. Expires in a day. 152 setcookie("gs", $gridstack_str, time() + 86400); 153 } 154 155 # Invariant: back pointer is second-to-last element of gridstack. Grid stack never 156 # has duplicate entries. 157 list($parentgrid, $parentlink) = explode("@", $gridstack[count($gridstack)-2]); 158 159 # Setup a redirect to a remote server if you choose a grid from pulldown menu. Tell 160 # destination server that we're walking foward in the grid tree. 161 if (strstr($clustername, "http://")) 162 { 163 $tpl->assign("refresh", "0"); 164 $tpl->assign("redirect", ";URL=$clustername?gw=fwd&gs=$gridstack_url"); 165 echo "<h2>Redirecting, please wait...</h2>"; 166 $tpl->printToScreen(); 167 exit; 168 } 169 $tpl->gotoBlock( "_ROOT" ); 170 171 if( $view != "search" ) 172 { 173 $tpl->assign( "refresh", $default_refresh ); 174 } 175 176 $tpl->assign( "date", date("r") ); 177 $tpl->assign( "longpage_title", $longtitle ); 178 $tpl->assign( "page_title", $title ); 179 180 # The page to go to when "Get Fresh Data" is pressed. 181 $tpl->assign("page","./"); 182 183 # Templated Logo image 184 $tpl->assign("images","./templates/$template_name/images"); 185 186 # 187 # Used when making graphs via graph.php. Included in most URLs 188 # 189 $sort_url=rawurlencode($sort); 190 $get_metric_string = "m=$metric&r=$range&s=$sort_url&hc=$hostcols"; 191 192 if ($jobrange and $jobstart) 193 $get_metric_string .= "&jr=$jobrange&js=$jobstart"; 194 195 # Set the Alternate view link. 196 $cluster_url=rawurlencode($clustername); 197 $node_url=rawurlencode($hostname); 198 199 # Make some information available to templates. 200 $tpl->assign("cluster_url", $cluster_url); 201 # Build the node_menu 202 $node_menu = ""; 203 204 if ($parentgrid) 205 { 206 $node_menu .= "<B>$parentgrid $meta_designator</B> "; 207 $node_menu .= "<B>></B>\n"; 208 } 209 210 # Show grid. 211 $mygrid = ($self == "unspecified") ? "" : $self; 212 $node_menu .= "<B><A HREF=\"../..\">$mygrid $meta_designator</A></B> "; 213 $node_menu .= "<B>></B>\n"; 214 215 if ($physical) 216 { 217 $node_menu .= hiddenvar("p", $physical); 218 } 219 220 if ( $clustername ) 221 { 222 $url = rawurlencode($clustername); 223 $node_menu .= "<B><A HREF=\"../../?c=".rawurlencode($clustername)."\">$clustername</A></B> "; 224 $node_menu .= "<B>></B>\n"; 225 $node_menu .= hiddenvar("c", $clustername); 226 } 227 228 if (!count($metrics)) 229 { 230 echo "<h4>Cannot find any metrics for selected cluster \"$clustername\", exiting.</h4>\n"; 231 echo "Check ganglia XML tree (telnet $ganglia_ip $ganglia_port)\n"; 232 exit; 233 } 234 reset($metrics); 235 $firsthost = key($metrics); 236 237 $mmfh = array(); 238 239 $mmfh = $metrics[$firsthost]; 240 241 $context_metrics = array(); 242 243 foreach( $mmfh as $mm => $bla ) 244 { 245 $context_metrics[] = $mm; 246 } 247 248 foreach ($reports as $mr => $mfoo) 249 $context_metrics[] = $mr; 250 251 $node_menu .= "<B><A HREF=\"./?c=".rawurlencode($clustername)."\">Joblist</A></B> "; 252 253 if( isset( $hostname ) && ( $view != 'host' ) ) 254 { 255 256 $node_menu .= "<B>></B>\n"; 257 $href = "<A HREF=\"./?c=".rawurlencode($clustername)."&h=".$hostname."\">"; 258 $node_menu .= "<B>$href"; 259 $node_menu .= "host: $hostname</A></B> "; 260 } 261 262 if( count( $filter ) > 0 && $view != "search" ) 263 { 264 265 $my_ct = 1; 266 $filter_nr = count( $filter ); 267 268 foreach( $filter as $filtername=>$filterval ) 269 { 270 271 $node_menu .= "<B>></B>\n"; 272 273 $href = "<A HREF=\"./?c=".rawurlencode($clustername); 274 $temp_ct = 0; 275 $n_filter = $filter; 276 $my_filterorder = ""; 277 $my_filters = array_keys( $filter ); 278 279 foreach( $n_filter as $n_filtername=>$n_filterval ) 280 { 281 282 if( $temp_ct < $my_ct ) 283 { 284 $href .= "&". $n_filtername . "=" . $n_filterval; 285 286 if( $my_filterorder == "" ) 287 $my_filterorder = $my_filters[$temp_ct]; 288 else 289 $my_filterorder .= "," . $my_filters[$temp_ct]; 290 } 291 292 $temp_ct++; 293 } 294 $href .= "&filterorder=$my_filterorder\">"; 295 296 if( $my_ct < $filter_nr ) 297 $node_menu .= "<B>$href$filtername: $filterval</A></B> "; 298 else 299 $node_menu .= "<B>$filtername: $filterval</B> "; 300 301 $my_ct++; 302 } 303 } 304 305 $tpl->gotoBlock( "_ROOT" ); 306 $tpl->assignGlobal("view", $view); 307 308 309 if( array_key_exists( "id", $filter ) or isset($hostname) ) 310 { 311 312 $range = "job"; 313 314 if( $page_call != "host_view" ) 315 { 316 317 if (is_array($context_metrics) ) 318 { 319 $metric_menu = "<B>Metric</B> " 320 ."<SELECT NAME=\"m\" OnChange=\"toga_form.submit();\">\n"; 321 322 sort($context_metrics); 323 foreach( $context_metrics as $k ) 324 { 325 $url = rawurlencode($k); 326 $metric_menu .= "<OPTION VALUE=\"$url\" "; 327 if ($k == $metricname ) 328 $metric_menu .= "SELECTED"; 329 $metric_menu .= ">$k\n"; 330 } 331 $metric_menu .= "</SELECT>\n"; 332 } 333 334 } 335 336 $tpl->assign("metric_menu", $metric_menu ); 337 338 if( $view == "search" or $view == "host" ) 339 { 340 $tpl->newBlock("timeperiod"); 341 if( is_numeric( $period_start ) ) 342 { 343 $period_start = epochToDatetime( $period_start ); 344 } 345 if( is_numeric( $period_stop ) ) 346 { 347 $period_stop = epochToDatetime( $period_stop ); 348 } 349 $tpl->assign("period_start", $period_start ); 350 $tpl->assign("period_stop", $period_stop ); 351 $tpl->assign("hostname", $hostname ); 352 353 if( $view == "host" ) 354 { 355 $tpl->newBlock("hostview"); 356 $tpl->assign("job_start", $job_start ); 357 $tpl->assign("job_stop", $job_stop ); 358 } 359 } 360 361 } 362 363 if( $view != "search" ) 364 { 365 $context_ranges[]="hour"; 366 $context_ranges[]="day"; 367 $context_ranges[]="week"; 368 $context_ranges[]="month"; 369 $context_ranges[]="year"; 370 $context_ranges[]="job"; 371 372 $range_menu = "<B>Last</B> " ."<SELECT NAME=\"r\" OnChange=\"toga_form.submit();\">\n"; 373 foreach ($context_ranges as $v) 374 { 375 $url=rawurlencode($v); 376 $range_menu .= "<OPTION VALUE=\"$url\" "; 377 if ($v == $range) 378 $range_menu .= "SELECTED"; 379 $range_menu .= ">$v\n"; 380 } 381 $range_menu .= "</SELECT>\n"; 382 383 $tpl->assign("range_menu", $range_menu); 384 385 } 386 387 if( $view == "search" or $view == "host" ) 388 { 389 390 $node_menu .= "<B>></B>\n"; 391 $node_menu .= "<B>Jobarchive</B> "; 392 $form_name = "archive_search_form"; 393 $tpl->assignGlobal("form_name", $form_name ); 394 395 } 396 else 397 { 398 $form_name = "toga_form"; 399 $tpl->assignGlobal("form_name", $form_name ); 400 } 401 402 if( $JOB_ARCHIVE && $page_call == 'overview' ) 403 { 404 $tpl->newBlock( "search" ); 405 $tpl->assignGlobal( "cluster_url", rawurlencode($clustername) ); 406 $tpl->assignGlobal( "cluster", $clustername ); 407 } 408 $tpl->gotoBlock( "_ROOT" ); 409 $tpl->assignGlobal( "cluster", $clustername ); 410 $tpl->assign("node_menu", $node_menu); 411 412 # Make sure that no data is cached.. 413 header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); # Date in the past 414 header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); # always modified 415 header ("Cache-Control: no-cache, must-revalidate"); # HTTP/1.1 416 header ("Pragma: no-cache"); # HTTP/1.0 417 } 418 419 function makeFooter() 420 { 421 global $tpl, $version, $parsetime, $monarchversion; 422 423 $tpl->gotoBlock( "_ROOT" ); 424 $tpl->assign("webfrontend-version",$version["webfrontend"]); 425 $tpl->assign("monarch-version", $monarchversion); 426 427 if ($version["gmetad"]) 428 { 429 $tpl->assign("webbackend-component", "gmetad"); 430 $tpl->assign("webbackend-version",$version["gmetad"]); 431 } 432 else if ($version["gmond"]) 433 { 434 $tpl->assign("webbackend-component", "gmond"); 435 $tpl->assign("webbackend-version", $version["gmond"]); 436 } 437 438 $tpl->assign("parsetime", sprintf("%.4f", $parsetime) . "s"); 439 } 440 441 function includeSearchpage() 442 { 443 global $tpl; 444 445 $tpl->assignInclude( "main", "templates/search.tpl" ); 446 447 } 448 449 function includeOverview() 450 { 451 global $tpl; 452 453 $tpl->assignInclude( "main", "templates/overview.tpl" ); 454 } 455 456 function includeHostPage() 457 { 458 459 global $tpl; 460 461 $tpl->assignInclude( "main", "templates/host_view.tpl" ); 415 462 } 416 463 … … 419 466 $tpl->assignInclude( "header", "templates/header.tpl" ); 420 467 421 if( isset( $h ) and $h != '' ) { 422 $hostname = $h; 423 } 424 425 switch( $view ) { 426 427 case "overview": 428 429 includeOverview(); 430 break; 431 432 case "search": 433 434 includeSearchPage(); 435 break; 436 437 case "host": 438 439 includeHostPage(); 440 break; 441 442 default: 443 444 includeOverview(); 445 break; 468 if( isset( $h ) and $h != '' ) 469 { 470 $hostname = $h; 471 } 472 473 switch( $view ) 474 { 475 476 case "overview": 477 478 includeOverview(); 479 break; 480 481 case "search": 482 483 includeSearchPage(); 484 break; 485 486 case "host": 487 488 includeHostPage(); 489 break; 490 491 default: 492 493 includeOverview(); 494 break; 446 495 } 447 496 … … 454 503 $tpl->assign("cluster", $clustername ); 455 504 456 switch( $view ) { 457 458 case "overview": 459 460 include "./overview.php"; 461 makeOverview(); 462 break; 463 464 case "search": 465 466 include "./search.php"; 467 makeSearchPage(); 468 break; 469 470 case "host": 471 472 include "./host_view.php"; 473 makeHostView(); 474 break; 475 476 default: 477 478 makeOverview(); 479 break; 505 switch( $view ) 506 { 507 508 case "overview": 509 510 include "./overview.php"; 511 makeOverview(); 512 break; 513 514 case "search": 515 516 include "./search.php"; 517 makeSearchPage(); 518 break; 519 520 case "host": 521 522 include "./host_view.php"; 523 makeHostView(); 524 break; 525 526 default: 527 528 makeOverview(); 529 break; 480 530 } 481 531
Note: See TracChangeset
for help on using the changeset viewer.