\n";
print "\n";
$outdir=$in{outdir}|| "";
$OutDir=$outdir;
$langSel=$in{langsel}|| "";
$URLBase=$in{urlbase}|| "";
$urlbase = $URLBase;
if ( $URLBase =~ /NO/ ) {
$URLBase="NONE";
} else {
if ( $langSel ne "" ) {
if ( $OutDir =~ /\/$langSel$/ ) {
$outdir=~ s/\/$langSel$//g;
} else {
$OutDir="$outdir/$langSel";
}
if ( $URLBase =~ /\/$langSel$/ ) {
$urlbase =~ s/\/$langSel$//g;
} else {
$URLBase="$URLBase/$langSel";
}
}
}
if ( $IMGBase =~ /NO/ ) { $IMGBase="NONE"; }
$IMGBase=$in{imgbasedir}|| "";
$packCmd=$in{packcmd}|| "";
$cp_images=$in{cpimages} || "";
if ( $OutDir ne "" ) {
$helpPath="$root_directory/$module_name/help";
if ( ! -d $OutDir ) { system("mkdir -p $OutDir") }
if ( ! -d $OutDir) {
print &text('dir_erraccess',$OutDir)."\n";
&footHere();
exit;
}
# set default form "webhelp" dataconf file ...
if ( $config{wbgimage} ) { $config{bgimage} = $config{wbgimage} } ;
if ( $config{wcs_page} ) { $config{cs_page} = $config{wcs_page} } ;
if ( $config{wcs_table} ) { $config{cs_table} = $config{wcs_table} } ;
if ( $config{wcs_header} ) { $config{cs_header} = $config{wcs_header} } ;
if ( $config{wcs_link} ) { $config{cs_link} = $config{wcs_link} } ;
if ( $config{wcs_text} ) { $config{cs_text} = $config{wcs_text} } ;
if ( $config{wcs_revtext} ) { $config{cs_revtext} = $config{wcs_revtext} } ;
# reset to form input values ...
if ( $in{bgimage} ) { $config{bgimage} = $in{bgimage} } ;
if ( $in{cs_page} ) { $config{cs_page} = $in{cs_page} } ;
if ( $in{cs_table} ) { $config{cs_table} = $in{cs_table} } ;
if ( $in{cs_header} ) { $config{cs_header} = $in{cs_header} } ;
if ( $in{cs_link} ) { $config{cs_link} = $in{cs_link} } ;
if ( $in{cs_text} ) { $config{cs_text} = $in{cs_text} } ;
if ( $in{cs_revtext} ) { $config{cs_revtext} = $in{cs_revtext} } ;
&set_interface_colors(); # Set as normal environment values !! (works as reset from here)
$module=$module_name;
$i=0;
opendir(DIR, "$helpPath");
foreach $f (readdir(DIR)) {
# read the help file
next if ($f eq "." || $f eq ".." );
next if ( -d "$helpPath/$f" );
if ( $f =~ /\.$langSel\./ ) {
$namef=$f;
$namef=~s/\.$langSel//;
} elsif ( $f =~ /\.html$/ ) {
$namef=$f;
} else { next };
$html="";
@st = stat("$helpPath/$f");
open(HELP, "$helpPath/$f") || &helperror(&text('help_efile', $f));
read(HELP, $help, $st[7]);
close(HELP);
$WebHelpOut="$OutDir/$namef";
open(WEBFILEOUT, ">$OutDir/$namef");
if ( $WebHelpOut ) { select(WEBFILEOUT)}
if ( $f =~ /\.html$/ ) { &make_help_html(); }
$help =~ s/href=\"\/stta\/gpl\//href=\"$URLBase\/gpl\//g;
$help =~ s/\/stta\/help\/images/$IMGBase\/images/g;
if ( $URLBase =~ /NONE/ ) {
$help =~ s/$URLBase\///g;
$help =~ s/$URLBase//g;
$help =~ s/href="\//href="/g;
$help =~ s/HREF="\//HREF="/g;
$help =~ s/http:\/\/www.eagora.info\/stta\/help\/$langSel\///g;
}
if ( $IMGBase =~ /NONE/ ) {
$help =~ s/$IMGBase\///g;
$help =~ s/$IMGBase//g;
$help =~ s/src="\//src="/g;
$help =~ s/SRC="\//SRC="/g;
}
print $help;
$outCSS=&out_css();
$outCSS =~ s/href='\/stta/href='../g;
print $outCSS;
if ( $WebHelpOut ) { $| =1; select(STDOUT);}
close(WEBFILEOUT);
print " | $text{user_made} ... $namef | $item_text | \n";
# $strCmd="cat $OutDir/$namef | sed 's,href=\"\/stta\/help.cgi\/stta,href=\"\/stta,g' | ".
# " sed 's,href=\"\/stta,href=\"$URLBase,g' | ".
# " sed 's,href=\"javascript:self.close(),href=\"$URLBase,g' | ".
# " sed 's,src=\"\/stta\/images,src=\"$IMGBase\/images,g' >$OutDir/$namef-new ";
# system ($strCmd );
# system ("mv $OutDir/$namef-new $OutDir/$namef" );
$i++;
}
closedir(DIR);
system ("mkdir $OutDir/config" );
opendir(DIR, "$helpPath/$langSel/config");
foreach $f (readdir(DIR)) {
# read the help file
next if ($f eq "." || $f eq ".." );
next if ( -d "$helpPath/$langSel/config/$f" );
if ( $f =~ /\.$langSel\./ ) {
$namef=$f;
$namef=~s/\.$langSel//;
} elsif ( $f =~ /\.html$/ ) {
$namef=$f;
} else { next };
$html="";
@st = stat("$helpPath/$langSel/config/$f");
open(HELP,"$helpPath/$langSel/config/$f") || &helperror(&text('help_efile', $f));
read(HELP,$help, $st[7]);
close(HELP);
$sec=$f;
$sec=~ s/\.html$//g;
$sectionCfg="";
if ($help =~ /]*)>/) { $sectionCfg=$1 }
$help =~ s///g;
$secLink=" ";
$head_path= "$root_directory/$module/help/cfg_head.html";
@st = stat($head_path);
open(HELP, $head_path) || &helperror(&text('help_efile', $head_path));
read(HELP, $head_help, $st[7]);
close(HELP);
$foot_path= "$root_directory/$module/help/cfg_foot.html";
@st = stat($foot_path);
open(HELP, $foot_path) || &helperror(&text('help_efile', $foot_path));
read(HELP, $foot_help, $st[7]);
close(HELP);
$help=$head_help.$help.$foot_help;
$help =~ s/%CFGSEC_LINK%/$secLink/g;
$help=~ s/%ITEM_CFG%/$sec/g;
$WebHelpOut="$OutDir/config/$namef";
open(WEBFILEOUT, ">$OutDir/config/$namef");
if ( $WebHelpOut ) { select(WEBFILEOUT)}
if ( $f =~ /\.html$/ ) { &make_help_html(); }
$help =~ s/href=\"\/stta\/gpl\//href=\"$URLBase\/gpl\//g;
$help =~ s/\/stta\/help\/images/$IMGBase\/images/g;
if ( $URLBase =~ /NONE/ ) {
$help =~ s/$URLBase\///g;
$help =~ s/$URLBase//g;
$help =~ s/href="\//href="/g;
$help =~ s/HREF="\//HREF="/g;
$help =~ s/http:\/\/www.eagora.info\/stta\/help\/$langSel\///g;
}
if ( $IMGBase =~ /NONE/ ) {
$help =~ s/$IMGBase\///g;
$help =~ s/$IMGBase//g;
$help =~ s/src="\//src="/g;
$help =~ s/SRC="\//SRC="/g;
}
print $help;
print &out_css();
if ( $WebHelpOut ) { $| =1; select(STDOUT);}
close(WEBFILEOUT);
print " $text{user_made} ... config/$namef | $item_text | \n";
$i++;
}
closedir(DIR);
print " ".&text('l_total',$i)." | $OutDir | \n";
# changes with "sed" as footer can have links
# copy images ...
if ( $cp_images eq "true" ) {
print "$text{'img_dircopy'} | \n";
system ( "mkdir $outdir/images ");
# print " $urlbase - $URLBase - $outdir - $OutDir - $langSel | ";
# print "cd $root_directory/$module_name ; find images -print -depth | cpio -pdumv $OutDir | ";
system ( "find images -print -depth | cpio -pdumv $outdir ");
}
system ( "cp $langSel/*.pdf $OutDir ");
system ( "mkdir $OutDir/gpl ");
# system ( "cd gpl | find gpl -print -depth | cpio -pdumv $OutDir ");
system ( "cp gpl/license*html $OutDir/gpl ");
system ( "cp gpl/lic*txt $OutDir/gpl ");
if ( $packCmd ne "" ) {
$str=$packCmd;
&run_cmd();
}
# saving values for next time
%webhtml=();
$webhtml{outdir}=$OutDir;
$webhtml{urlbase}=$URLBase;
$webhtml{imgbasedir}=$IMGBase;
$webhtml{packcmd}=$packCmd;
$webhtml{wbgimage}=$config{bgimage};
$webhtml{wcs_page}=$config{cs_page};
$webhtml{wcs_table}=$config{cs_table};
$webhtml{wcs_header}=$config{cs_header};
$webhtml{wcs_text}=$config{cs_text};
$webhtml{wcs_revtext}=$config{cs_revtext};
$webhtml{wcs_link}=$config{cs_link};
&write_file("$config_directory/$module_name/dataconf/webhtml", \%webhtml);
&webmin_log("Making web Help html ($i Files)","stta_webhtml","$OutDir ($i Files) ",\%webhtml);
} else {
&read_file("$config_directory/$module_name/dataconf/webhtml", \%config);
print "\n";
print "\n";
print "\n";
print "\n";
}
print " |