#!/usr/bin/perl
# tta_ensrecreate.cgi
# Loading ENS from File ...  Servicios de Tarantella.
# STTA Rev. 1.3 Copyright (c) 2001-2002 Jesús Pérez Lorenzo  --- license GNU GPL 

require './stta-lib.pl';
do "ldap-lib.pl";
&foreign_require("proc", "proc-lib.pl");
&ReadParse();

&headerstta($text{'index_ttaensrecreate'}, "", "ensrecreate",undef,1,1,$text{headpage_rigth} );
#$debug=6;
# if ( $debug eq 6 ) { foreach $elem (@in) { print "<p>$elem  \n";  } };
print "<hr><p>\n"; 
print "<p>\n";
print "<table width=100% border>\n";
print "<tr $tb> <td><b>$text{'titidx_ttaensrecreate'}</b></td> </tr>\n";
print "<tr $cb> <td><table width=100%>\n";
print "<center>\n";
$dataFile = $in{dataFile};
$go_load = $in{go};
print "$go <BR>\n";
if (!$go_load) { 
           print "<tr></tr>\n";
           print "<tr><form METHOD=POST name=ensrecreate ACTION=\"tta_ensrecreate.cgi\" >\n"; 
           print "<td valign=top><h3>$config{tta_base}</h3></td></tr>\n";
           print "<td valign=top>",&hlink("<b>$text{'f_loaddirens'}</b>","floaddirens"),"&nbsp;\n";
           print "<td valign=top><input TYPE=\"text\" NAME=\"dataFile\" VALUE=\"\" cols=\"52\" size=\"52\" ALIGN=left ", &file_chooser_button("dataFile",0,0,$config{tta_ensdump_dir}),"</td></tr>\n";
           print "  <input TYPE=\"hidden\" NAME=\"go\" VALUE=\"go\">\n"; 
           print "        <tr><td valign=top><input TYPE=\"submit\" NAME=\"",$text{'f_sendreq'},"\" VALUE=\"",$text{'f_sendreq'},"\">\n";
           print "        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n";
           print "	</form>\n"; 
           print "<tr><tr></table>\n";
           print "<tr $tb><td><b>$text{'load_data'}</b></td></tr>\n";
           print "<tr $tb><td><b>$text{'msg_ttataskstop'}</b></td></tr>\n";
           print "</table><hr><p>\n";
} else {
	print "<tr><td>\n";
        $str=$config{'tta_ensrecreate'}." ".$config{tta_base};
        if ( $dataFile ) {
             $str.="; [ \"\$?\" -eq \"0\" ] && ";
             $str.=$config{'tta_ensload'}." ".$config{tta_ensdump_dir}."$dataFile ".$config{tta_ensload_dir};
        }
        if (&run_cmd($str)) {
               print "</pre><tr><center><b>-- oOo --</b></center></tr>\n";
        } else {
                       print "<b>$text{'index_cmderr'}</b>\n";
        }
        print "<tr>\n";
        print "<tr>\n";
        print "<tr>\n";
        print "</table></table><p>\n";
 }
 &footer($config{'back_return'},$text{'index'});
 do "footer.pl";
 exit;
