# STTA Rev. 1.3 Copyright (c) 2001-2004 Jesús Pérez Lorenzo  --- license GNU GPL 
# stta: (@#) 1.31051043346- [2004_01_29_102036]
# ldap.pl for STTA 
 
if ($access{'global'}) {
        if ($access{'global'} == 1) {
                if ($out_titles eq 1 ) {  
	             print "<td align=center>\n";
	             print "<h3>$text{'index_globalldap'}</h3>\n";
                }
                @line=split(/\//, $config{'ldap_daemon'}, -1);
                $daemonStr=$line[$#line];
		$psldap_icon = { "icon" => "images/psldap.gif",
			     "name" => $text{'ldapps_title'},
			     "link" => "/proc/index_search.cgi?user=&mode=1&match=$daemonStr&cpu=&fs=%2F&files=" };
                if ( $config{ldap2_server}.length gt 0 ) {
	         	$ldapreplica_icon = { "icon" => "images/replica.gif",
		                	      "name" => $text{'replica_title'},
			                      "link" => "ldap_replica.cgi" };
                }
#		$ldapbrw_icon = { "icon" => "images/ldapbrowser.gif",
#			     "name" => $text{'ldapbrw_title'},
#			     "link" => "/ldap_browser/index.cgi?level=$config{'ldap_base'}" };
                if ( $config{'is_ldapcache'} eq "true" ) {
#		   $ldapbrw2_icon = { "icon" => "images/ldapbrowser.gif",
#		        "name" => $text{'ldapcachebrw_title'},
#		     	"link" => "/ldap_browser2/index.cgi?level=$config{'ldapcache_base'}" };
                   if ($interface eq "tabs" ) {
                       if ( $config{ldap2_server}.length gt 0 ) {
	                    &outconfig_icons("global", "tta_global.cgi?",
	                        $psldap_icon, $ldapbrw_icon, $ldapreplica_icon, $ldapbrw2_icon );
                       } else {
	                    &outconfig_icons("global", "tta_global.cgi?",
	                        $psldap_icon, $ldapbrw_icon, $ldapbrw2_icon );
                       }
                   } else {
                       if ( $config{ldap2_server}.length gt 0 ) {
	                    &config_icons("global", "tta_global.cgi?",
	                        $psldap_icon, $ldapbrw_icon, $ldapreplica_icon, $ldapbrw2_icon );
                       } else {
	                    &config_icons("global", "tta_global.cgi?",
	                        $psldap_icon, $ldapbrw_icon, $ldapbrw2_icon );
                       }
                   }
                } else {
                   if ($interface eq "tabs" ) {
                       if ( $config{ldap2_server}.length gt 0 ) {
	                    &outconfig_icons("global", "tta_global.cgi?",
	                        $psldap_icon, $ldapbrw_icon, $ldapreplica_icon );
                       } else {
	                    &outconfig_icons("global", "tta_global.cgi?",
	                        $psldap_icon, $ldapbrw_icon );
                       }
                   } else {
                       if ( $config{ldap2_server}.length gt 0 ) {
	                   &config_icons("global", "tta_global.cgi?",
	                        $psldap_icon, $ldapbrw_icon, $ldapreplica_icon );
                       } else {
	                   &config_icons("global", "tta_global.cgi?",
	                        $psldap_icon, $ldapbrw_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{'global'} == 1) {
                if ($out_titles eq 1 ) {  
	             print "<td align=center>\n";
	             print "<h3>$text{'index_ldap'}</h3>\n";
                }
		$ldapbk_icon = { "icon" => "images/ldap_backup.gif",
			     "name" => $text{'ldap_backup'},
			     "link" => "ldap_backup.cgi" };
		$ldapldif_icon = { "icon" => "images/ldap_ldif.gif",
			     "name" => $text{'ldap_ldif'},
			     "link" => "ldap_ldif.cgi" };
		$ldaploglist_icon = undef;
                if ( $config{'ldap_log_name'} ne "" ) {
		     $ldaploglist_icon = { "icon" => "images/ldap_loglist.gif",
			     "name" => $text{'ldap_loglist'},
			     "link" => "ldap_loglist.cgi" };
                }
		$ldapload_icon = { "icon" => "images/ldap_load.gif",
			     "name" => $text{'ldap_load'},
			     "link" => "ldap_load.cgi" };
                if ($interface eq "tabs" ) {
		    &outconfig_icons("backup", "backup.cgi?", $ldapbk_icon,$ldapldif_icon,$ldapload_icon, $ldaploglist_icon );
                } else {           
		    &config_icons("backup", "backup.cgi?", $ldapbk_icon,$ldapldif_icon ,$ldapload_icon);
                }
                if ( $config{'is_ldapcache'} eq "true" ) {
                     if ($out_titles eq 1 ) {  
                          print "</td>\n";
	                  print "<td align=center>\n";
	                  print "<h3>$text{'index_ldapcache'}</h3>\n";
                     }
		     $ldapbk_icon = { "icon" => "images/ldapcache_backup.gif",
			          "name" => $text{'ldapcache_backup'},
			          "link" => "ldapcache_backup.cgi" };
		     $ldapldif_icon = { "icon" => "images/ldapcache_ldif.gif",
			          "name" => $text{'ldapcache_ldif'},
			          "link" => "ldapcache_ldif.cgi" };
		     $ldapload_icon = { "icon" => "images/ldapcache_load.gif",
			          "name" => $text{'ldapcache_load'},
			          "link" => "ldapcache_load.cgi" };
                     if ($interface eq "tabs" ) {
		         &outconfig_icons("backupcache", "backupcache.cgi?", $ldapbk_icon,$ldapldif_icon, $ldapload_icon );
                     } else {
		         &config_icons("backupcache", "backupcache.cgi?", $ldapbk_icon,$ldapldif_icon, $ldapload_icon);
                     }
               }
 }
