# STTA Rev. 1.3 Copyright (c) 2001-2004 Jesús Pérez Lorenzo  --- license GNU GPL 
# stta: (@#) 1.31051043346- [2004_01_29_102036]
# tta.pl for STTA 
 
if ($access{'global'}) {
	if ($access{'global'} == 1) {
	        if ($out_titles eq 1 ) {
                     print "<td align=center>\n";
                     print "<h3>$text{'index_globaltta'}</h3>\n";
                }
	        if ($access{'sessions'} == 1) {
	   	    $ses_icon = { "icon" => "images/ttasess.gif",
		   	          "name" => $text{'ttasess_title'},
			          "link" => "tta_sess.cgi" };
	   	    $sescount_icon = { "icon" => "images/ttasesscount.gif",
		   	          "name" => $text{'ttasesscount_title'},
			          "link" => "tta_sesscount.cgi" };
	   	    $sestotal_icon = { "icon" => "images/ttasesscount.gif",
		   	          "name" => $text{'ttasesstotal_title'},
			          "link" => "tta_sesstotal.cgi" };
	   	    $sesbill_icon = { "icon" => "images/ttasesscount.gif",
		   	          "name" => $text{'ttasessbill_title'},
			          "link" => "tta_sessbilling.cgi" };
                }
		$df_icon = { "icon" => "images/ttastatus.gif",
			     "name" => $text{'ttastatus_title'},
			     "link" => "tta_status.cgi" };
                @line=split(/\//, $config{'tta_daemon'}, -1);
                $daemonStr=$line[$#line];
		$pstta_icon = { "icon" => "images/psicon.gif",
			     "name" => $text{'ttaps_title'},
			     "link" => "/proc/index_search.cgi?user=&mode=1&match=$daemonStr&cpu=&fs=%2F&files=" };
	        if ($access{'sessions'} == 1) {
                    if ($interface eq "tabs" ) {   
               	            &outconfig_icons("global", "tta_global.cgi?",
	                              $ses_icon,$sescount_icon, $sestotal_icon, $sesbill_icon, $df_icon, $pstta_icon );
                    } else {
               	            &config_icons("global", "tta_global.cgi?",
	                              $ses_icon,$sescount_icon,$sestotal_icon, $sesbill_icon, $df_icon, $pstta_icon );
                    }
                } else {
                    if ($interface eq "tabs" ) {   
	                    &outconfig_icons("global", "tta_global.cgi?",
	                                   $df_icon, $pstta_icon );
                    } else {
	                    &config_icons("global", "tta_global.cgi?",
	                                   $df_icon, $pstta_icon );
                    }
                }
	        if ($out_titles eq 1 ) { print "</td>\n"; };
	}
	else {
              if ($interface eq "tabs" ) {
                   @olinks=("tta-info.cgi");
                   @oicons=($text{'ttainfo_title'});
                   @otitles=("images/ttastatus.gif");
                   &outicons_table();
              } else {
                   &icons_table([ "tta-info.cgi" ],
                             [ $text{'ttainfo_title'} ],
                             [ "images/ttastatus.gif" ]);
              }
	}
     if ($access{'backup'} == 1) {
	        if ($out_titles eq 1 ) {
	           print "<td align=center>\n";
	           print "<h3>$text{'index_ttabackup'}</h3>\n";
                }
		$ttaensbk_icon = { "icon" => "images/tta_ensbk.gif",
			     "name" => $text{'tta_ensbk'},
			     "link" => "tta_ensbk.cgi" };
		$ttabk_icon = { "icon" => "images/tta_backup.gif",
			     "name" => $text{'tta_backup'},
			     "link" => "tta_backup.cgi" };
		$ttaar_icon = { "icon" => "images/tta_archive.gif",
			     "name" => $text{'tta_archive'},
			     "link" => "tta_archive.cgi" };
		$ttaensload_icon = { "icon" => "images/tta_ensload.gif",
			     "name" => $text{'tta_ensload'},
			     "link" => "tta_ensload.cgi" };
		$ttaensdump_icon = { "icon" => "images/tta_ensdump.gif",
			     "name" => $text{'tta_ensdump'},
			     "link" => "tta_ensdump.cgi" };
		$ttaensrestore_icon = { "icon" => "images/tta_ensrestore.gif",
			     "name" => $text{'tta_ensrestore'},
			     "link" => "tta_ensrestore.cgi" };
		$ttaensrecreate_icon = { "icon" => "images/tta_ensrecreate.gif",
			     "name" => $text{'tta_ensrecreate'},
			     "link" => "tta_ensrecreate.cgi" };
                if ($interface eq "tabs" ) {   
		      &outconfig_icons("backup", "backup.cgi?",
		                    $ttaensbk_icon, $ttabk_icon, $ttaar_icon ,
		                    $ttaensrestore_icon, $ttaensdump_icon, $ttaensload_icon, $ttaensrecreate_icon );
                } else {
		      &config_icons("backup", "backup.cgi?",
		                    $ttaensbk_icon, $ttabk_icon, $ttaar_icon ,
		                    $ttaensrestore_icon, $ttaensdump_icon, $ttaensload_icon, $ttaensrecreate_icon );
                }
	        if ($out_titles eq 1 ) { print "</td>\n"; };
    }
}
