Changeset 753 for branches/0.4/web/addons/job_monarch/index.php
- Timestamp:
- 03/26/13 21:38:02 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.4/web/addons/job_monarch/index.php
r738 r753 4 4 * This file is part of Jobmonarch 5 5 * 6 * Copyright (C) 2006 Ramon Bastiaans6 * Copyright (C) 2006-2013 Ramon Bastiaans 7 7 * 8 8 * Jobmonarch is free software; you can redistribute it and/or modify … … 29 29 30 30 include_once "./libtoga.php"; 31 include_once "./dwoo/dwooAutoload.php"; 31 32 32 33 $r = escapeshellcmd( rawurldecode( $_GET["r"] )); … … 34 35 if( !isset($range) or $range == '') $range= "job"; 35 36 37 global $context; 38 39 #$context = 'cluster'; 40 41 #chdir( $GANGLIA_PATH ); 42 43 #include "./ganglia.php"; 44 #include "./get_ganglia.php"; 45 46 #chdir( $my_dir ); 47 36 48 if ( !empty( $_GET ) ) 37 49 { … … 41 53 global $GANGLIA_PATH; 42 54 43 include_once "./class.TemplatePower.inc.php";55 //include_once "./class.TemplatePower.inc.php"; 44 56 45 57 $httpvars = new HTTPVariables( $HTTP_GET_VARS, $_GET ); … … 99 111 function makeHeader( $page_call, $title, $longtitle ) 100 112 { 101 102 global $tpl, $grid, $context, $initgrid; 113 global $dwoo, $grid, $context, $initgrid; 103 114 global $jobrange, $jobstart; 104 115 global $page, $gridwalk, $clustername; … … 109 120 global $JOB_ARCHIVE, $period_start, $period_stop, $h, $id; 110 121 global $job_start, $job_stop, $range, $r, $metricname; 122 global $conf; 123 try 124 { 125 //$dwoo = new Dwoo($conf['dwoo_compiled_dir'], $conf['dwoo_cache_dir']); 126 $dwoo = new Dwoo( 'dwoo/compiled', 'dwoo/cache' ); 127 } 128 catch (Exception $e) 129 { 130 print "<H4>There was an error initializing the Dwoo PHP Templating Engine: ". 131 $e->getMessage() . "<br><br>The compile directory should be owned and writable by the apache user.</H4>"; 132 exit; 133 } 134 111 135 112 136 if( isset($conf['default_metric']) and !isset($m) ) … … 157 181 list($parentgrid, $parentlink) = explode("@", $gridstack[count($gridstack)-2]); 158 182 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" ); 183 $tpl = new Dwoo_Template_File("templates/header.tpl"); 184 echo $tpl; 185 $tpl_data = new Dwoo_Data(); 170 186 171 187 if( $view != "search" ) 172 188 { 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 );189 $tpl_data->assign( "refresh", $default_refresh ); 190 } 191 192 $tpl_data->assign( "date", date("r") ); 193 $tpl_data->assign( "longpage_title", $longtitle ); 194 $tpl_data->assign( "page_title", $title ); 179 195 180 196 # The page to go to when "Get Fresh Data" is pressed. 181 $tpl ->assign("page","./");197 $tpl_data->assign("page","./"); 182 198 183 199 # Templated Logo image 184 $tpl ->assign("images","./templates/$template_name/images");200 $tpl_data->assign("images","./templates/$template_name/images"); 185 201 186 202 # … … 198 214 199 215 # Make some information available to templates. 200 $tpl ->assign("cluster_url", $cluster_url);216 $tpl_data->assign("cluster_url", $cluster_url); 201 217 # Build the node_menu 202 218 $node_menu = ""; … … 303 319 } 304 320 305 $tpl->gotoBlock( "_ROOT" ); 306 $tpl->assignGlobal("view", $view); 307 321 $tpl_data->assign("view", $view); 308 322 309 323 if( array_key_exists( "id", $filter ) or isset($hostname) ) … … 334 348 } 335 349 336 $tpl ->assign("metric_menu", $metric_menu );350 $tpl_data->assign("metric_menu", $metric_menu ); 337 351 338 352 if( $view == "search" or $view == "host" or $view == "overview-host" ) 339 353 { 340 $tpl ->newBlock("timeperiod");354 $tpl_data->assign("timeperiod", "yes" ); 341 355 if( is_numeric( $period_start ) ) 342 356 { … … 347 361 $period_stop = epochToDatetime( $period_stop ); 348 362 } 349 $tpl ->assign("period_start", $period_start );350 $tpl ->assign("period_stop", $period_stop );351 $tpl ->assign("hostname", $hostname );363 $tpl_data->assign("period_start", $period_start ); 364 $tpl_data->assign("period_stop", $period_stop ); 365 $tpl_data->assign("hostname", $hostname ); 352 366 353 367 if( $view == "host" or $view == "overview-host" ) 354 368 { 355 $tpl ->newBlock("hostview");356 $tpl ->assign("job_start", $job_start );357 $tpl ->assign("job_stop", $job_stop );369 $tpl_data->assign("hostview", "yes"); 370 $tpl_data->assign("job_start", $job_start ); 371 $tpl_data->assign("job_stop", $job_stop ); 358 372 } 359 373 } … … 381 395 $range_menu .= "</SELECT>\n"; 382 396 383 $tpl ->assign("range_menu", $range_menu);397 $tpl_data->assign("range_menu", $range_menu); 384 398 385 399 } … … 391 405 $node_menu .= "<B>Jobarchive</B> "; 392 406 $form_name = "archive_search_form"; 393 $tpl ->assignGlobal("form_name", $form_name );407 $tpl_data->assign("form_name", $form_name ); 394 408 395 409 } … … 397 411 { 398 412 $form_name = "toga_form"; 399 $tpl ->assignGlobal("form_name", $form_name );413 $tpl_data->assign("form_name", $form_name ); 400 414 } 401 415 402 416 if( $JOB_ARCHIVE && $page_call == 'overview' ) 403 417 { 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); 418 $tpl_data->assign( "search", "yes" ); 419 $tpl_data->assign( "cluster_url", rawurlencode($clustername) ); 420 $tpl_data->assign( "cluster", $clustername ); 421 } 422 $tpl_data->assign( "cluster", $clustername ); 423 $tpl_data->assign("node_menu", $node_menu); 411 424 412 425 # 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 426 //header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); # Date in the past 427 //header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); # always modified 428 //header ("Cache-Control: no-cache, must-revalidate"); # HTTP/1.1 429 //header ("Pragma: no-cache"); # HTTP/1.0 430 431 $dwoo->output($tpl, $tpl_data); 417 432 } 418 433 419 434 function makeFooter() 420 435 { 421 global $tpl, $version, $parsetime, $monarchversion; 422 423 $tpl->gotoBlock( "_ROOT" ); 424 $tpl->assign("webfrontend-version",$version["webfrontend"]); 425 $tpl->assign("monarch-version", $monarchversion); 436 global $dwoo, $version, $parsetime, $monarchversion; 437 438 $tpl = new Dwoo_Template_File("templates/footer.tpl"); 439 $tpl_data = new Dwoo_Data(); 440 441 $tpl_data->assign("webfrontendversion",$version["webfrontend"]); 442 $tpl_data->assign("monarchversion", $monarchversion); 426 443 427 444 if ($version["gmetad"]) 428 445 { 429 $tpl ->assign("webbackend-component", "gmetad");430 $tpl ->assign("webbackend-version",$version["gmetad"]);446 $tpl_data->assign("webbackendcomponent", "gmetad"); 447 $tpl_data->assign("webbackendversion",$version["gmetad"]); 431 448 } 432 449 else if ($version["gmond"]) 433 450 { 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" ); 462 } 463 464 $tpl = new TemplatePower( "templates/index.tpl" ); 465 466 $tpl->assignInclude( "header", "templates/header.tpl" ); 451 $tpl_data->assign("webbackendcomponent", "gmond"); 452 $tpl_data->assign("webbackendversion", $version["gmond"]); 453 } 454 455 $tpl_data->assign("parsetime", sprintf("%.4f", $parsetime) . "s"); 456 457 $dwoo->output($tpl, $tpl_data); 458 } 467 459 468 460 if( isset( $h ) and $h != '' ) … … 471 463 } 472 464 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 case "overview-host": 492 493 includeHostPage(); 494 break; 495 496 default: 497 498 includeOverview(); 499 break; 500 } 501 502 $tpl->assignInclude( "footer", "templates/footer.tpl" ); 503 $tpl->prepare(); 465 //$tpl_data->assign( "footer", template( "templates/footer.tpl" ) ); 504 466 505 467 $longtitle = "Batch Report :: Powered by Job Monarch!"; 506 468 $title = "Batch Report"; 507 $tpl->assign("cluster_url", rawurlencode($clustername) ); 508 $tpl->assign("cluster", $clustername ); 469 //$tpl_data->assign("cluster_url", rawurlencode($clustername) ); 470 //$tpl_data->assign("cluster", $clustername ); 471 472 #makeHeader(); 509 473 510 474 switch( $view ) … … 537 501 default: 538 502 503 include "./overview.php"; 539 504 makeOverview(); 540 505 break; … … 542 507 543 508 makeFooter(); 544 $tpl->printToScreen();545 509 ?>
Note: See TracChangeset
for help on using the changeset viewer.