#!/usr/bin/perl
# tta_delgrpapps.cgi
# Delete OrgUnits from Services with Tarantella
# STTA Rev. 1.3 Copyright (c) 2001-2004 Jesús Pérez Lorenzo  --- license GNU GPL 
# stta: (@#) 1.31051043346- [2004_01_29_102036]

require './stta-lib.pl';
if ( $config{'is_ldapcache'} eq "true" ) {
     do "ldap-lib.pl"
}

&headerstta($text{'index_delgrpapps'}, "", "delgrpapps",undef,1,0,"$text{'headpage_right'}"."$text{'head_logout'}",undef,undef,"$text{head_below}" ); 
print "<hr><p>\n";
#if ( $config{'is_ldapcache'} ne "true" ) { &footCacheHere; exit }
&foreign_require("proc", "proc-lib.pl");
&ReadParse();

 $aliasgrpapps=$in{aliasgrpapps};

    if ($aliasgrpapps ) {
        $descrip="";
        $ensgrpapps="";
        $dnsgrpapps="";
        $obj_name="";
        %h_grpapps=&list_grpapps();
        if ( $h_grpapps{$aliasgrpapps}->{'alias'} ne $aliasgrpapps) {
             $err_msg=$aliasgrpapps.":".$text{'list_errno'};
             &footHere;
             exit;
        }
        $ensgrpapps=$h_grpapps{$aliasgrpapps}->{ens};
        $dngrpapps=$h_grpapps{$aliasgrpapps}->{obj};
        $descrip=$h_grpapps{$aliasgrpapps}->{descrip};
        $obj_name=$h_grpapps{$aliasgrpapps}->{name};
    }
    print "<table width=100% border>\n";
    print "<tr $tb> <td><font color='$revtext'><b>$text{'titidx_delgrpapps'} $aliasgrpapps - $obj_name</b></td> </tr>\n";
    print "<tr $cb> <td><table width=100%>\n";
    print "<center>\n";
    print "<tr></tr><tr></tr>\n";
    print "<tr><td><pre>\n";
    if (!$ensgrpapps ) { &footHere; exit }  ;
    $ens_obj = "--name \"".$config{tta_base}."/$ensgrpapps\" --children";
    $type_cmd="delete";
    if (&run_tta_cmd("delete",$ens_obj)) { 
             print "</pre><tr><p><b>$text{'user_delete'}... Tarantella </b></tr>\n";
    } else { &html_errshow("tta")};
    if ( $config{'is_ldapcache'} eq "true" && $dngrpapps ) {
         $ldapcache_server=1;
         &connect_cache ();
         $dn = "$dngrpapps,".$config{ldapcache_base};
         if ( &del_ldap_obj($dn) eq 0 ) {   
              print "<tr><b>".$text{'user_delete'}."... LDAP CACHE ... </b></tr>\n"; 
         } else { &html_errshow("ldap")};
    }
    &out_objslist( "delete", "delgrpapps.cgi", "grpapps", "grpapps_list", $aliasgrpapps, "", \%h_grpapps );
 print "</tr></td></pre>\n";
 print "<tr><tr></table></table><hr><p>\n";
 &footer($config{'back_return'},$text{'index'});
 print "<p><p><p>\n";
 do "footer.pl";
 exit;
