Ignore:
Timestamp:
03/26/13 21:38:02 (10 years ago)
Author:
ramonb
Message:

index.php, overview.php:

header.php:

  • removed: was not used
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/0.4/web/addons/job_monarch/index.php

    r738 r753  
    44 * This file is part of Jobmonarch
    55 *
    6  * Copyright (C) 2006  Ramon Bastiaans
     6 * Copyright (C) 2006-2013  Ramon Bastiaans
    77 *
    88 * Jobmonarch is free software; you can redistribute it and/or modify
     
    2929
    3030include_once "./libtoga.php";
     31include_once "./dwoo/dwooAutoload.php";
    3132
    3233$r = escapeshellcmd( rawurldecode( $_GET["r"] ));
     
    3435if( !isset($range) or $range == '') $range= "job";
    3536
     37global $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
    3648if ( !empty( $_GET ) )
    3749{
     
    4153global $GANGLIA_PATH;
    4254
    43 include_once "./class.TemplatePower.inc.php";
     55//include_once "./class.TemplatePower.inc.php";
    4456
    4557$httpvars = new HTTPVariables( $HTTP_GET_VARS, $_GET );
     
    99111function makeHeader( $page_call, $title, $longtitle )
    100112{
    101 
    102     global $tpl, $grid, $context, $initgrid;
     113    global $dwoo, $grid, $context, $initgrid;
    103114    global $jobrange, $jobstart;
    104115    global $page, $gridwalk, $clustername;
     
    109120    global $JOB_ARCHIVE, $period_start, $period_stop, $h, $id;
    110121    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
    111135   
    112136    if( isset($conf['default_metric']) and !isset($m) )
     
    157181    list($parentgrid, $parentlink) = explode("@", $gridstack[count($gridstack)-2]);
    158182
    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();
    170186
    171187    if( $view != "search" )
    172188    {
    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 );
    179195
    180196    # The page to go to when "Get Fresh Data" is pressed.
    181     $tpl->assign("page","./");
     197    $tpl_data->assign("page","./");
    182198
    183199    # Templated Logo image
    184     $tpl->assign("images","./templates/$template_name/images");
     200    $tpl_data->assign("images","./templates/$template_name/images");
    185201
    186202    #
     
    198214
    199215    # Make some information available to templates.
    200     $tpl->assign("cluster_url", $cluster_url);
     216    $tpl_data->assign("cluster_url", $cluster_url);
    201217    # Build the node_menu
    202218    $node_menu = "";
     
    303319    }
    304320
    305     $tpl->gotoBlock( "_ROOT" );
    306     $tpl->assignGlobal("view", $view);
    307 
     321    $tpl_data->assign("view", $view);
    308322
    309323    if( array_key_exists( "id", $filter ) or isset($hostname) )
     
    334348        }
    335349
    336         $tpl->assign("metric_menu", $metric_menu );
     350        $tpl_data->assign("metric_menu", $metric_menu );
    337351
    338352        if( $view == "search" or $view == "host" or $view == "overview-host" )
    339353        {
    340             $tpl->newBlock("timeperiod");
     354            $tpl_data->assign("timeperiod", "yes" );
    341355            if( is_numeric( $period_start ) )
    342356            {
     
    347361                $period_stop = epochToDatetime( $period_stop );
    348362            }
    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 );
    352366
    353367            if( $view == "host" or $view == "overview-host" )
    354368            {
    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 );
    358372            }
    359373        }
     
    381395        $range_menu .= "</SELECT>\n";
    382396
    383         $tpl->assign("range_menu", $range_menu);
     397        $tpl_data->assign("range_menu", $range_menu);
    384398
    385399    }
     
    391405        $node_menu .= "<B>Jobarchive</B> ";
    392406        $form_name = "archive_search_form";
    393         $tpl->assignGlobal("form_name", $form_name );
     407        $tpl_data->assign("form_name", $form_name );
    394408
    395409    }
     
    397411    {
    398412        $form_name = "toga_form";
    399         $tpl->assignGlobal("form_name", $form_name );
     413        $tpl_data->assign("form_name", $form_name );
    400414    }
    401415
    402416    if( $JOB_ARCHIVE && $page_call == 'overview' )
    403417    {
    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);
    411424
    412425    # 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);
    417432}
    418433
    419434function makeFooter()
    420435{
    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);
    426443
    427444    if ($version["gmetad"])
    428445    {
    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"]);
    431448    }
    432449    else if ($version["gmond"])
    433450    {
    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}
    467459
    468460if( isset( $h ) and $h != '' )
     
    471463}
    472464
    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" ) );
    504466
    505467$longtitle = "Batch Report :: Powered by Job Monarch!";
    506468$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();
    509473
    510474switch( $view )
     
    537501    default:
    538502
     503        include "./overview.php";
    539504        makeOverview();
    540505        break;
     
    542507
    543508makeFooter();
    544 $tpl->printToScreen();
    545509?>
Note: See TracChangeset for help on using the changeset viewer.