694 lines
26 KiB
Perl
Executable File
694 lines
26 KiB
Perl
Executable File
# STTA Rev. 1.3 Copyright (c) 2001-2004 Jesús Pérez Lorenzo --- license GNU GPL
|
|
# stta: (@#) 1.31051043346- [2004_01_29_102036]
|
|
# help-lib.pl
|
|
# changes to manage webminlog sid
|
|
|
|
sub write_helpfile
|
|
{
|
|
local $dir = $module ? "../$_[0]/help" : "$_[0]/help";
|
|
if ( $debug lt 4 ) {
|
|
&helperror(&text('help_efile', "$dir/$_[1]"));
|
|
return;
|
|
}
|
|
local $path = "$dir/$_[1].$current_lang.html";
|
|
open (FILE, ">$path");
|
|
print FILE "<include head>\n";
|
|
print FILE "<header>$_[1]</header>\n";
|
|
print FILE "<include foot>\n";
|
|
close (FILE);
|
|
}
|
|
|
|
sub open_help_file
|
|
{
|
|
# read the help file
|
|
if ($file =~ /\.html$/) { # it is a full path
|
|
$path = "$root_directory/$module/$file";
|
|
} else {
|
|
$path = &help_file($module, $file);
|
|
}
|
|
@st = stat($path);
|
|
# open(HELP, $path) || &write_helpfile($module,$file);
|
|
open(HELP, $path) || &helperror(&text('help_efile', $path));
|
|
read(HELP, $help, $st[7]);
|
|
close(HELP);
|
|
}
|
|
|
|
sub make_help_html
|
|
{
|
|
%infoCfg=();
|
|
# Use config.info to create config inputs
|
|
&read_file("$root_directory/stta/config.info", \%infoCfg);
|
|
foreach $o (@lang_order_list) {
|
|
&read_file("$root_directory/stta/config.info.$o", \%infoCfg);
|
|
}
|
|
&load_more_text('help'); # to make easy translations let us put a lang file
|
|
&load_more_text('cfg'); # load cfg helps
|
|
&load_more_text('feedback'); # load cfg helps
|
|
&read_file("$root_directory/$module/dataconf/form_vars", \%text); # Forms values
|
|
$headImg="";
|
|
$isBook=false; # this is to make a book, will avoid footlinks
|
|
$isSection=false; # this is to ouput other links in includes when in sections
|
|
$isHeadImg=false; # this is to close table if head image is in use
|
|
$sectionName=""; # this is to keep section name, in some cases change output
|
|
$isTocBody=false; # this is to know if index has to be made and adjust foot
|
|
$tableWidth="width=100%"; # this is the basic with that has tobe changes for STTA book
|
|
|
|
local $noHeaderTable=false; # this is to not have too many headers in recursive includes
|
|
|
|
if ( $WebHelpOut ) {
|
|
&set_interface_colors(); # just to be sure !!!
|
|
}
|
|
if ($help =~ /<book\s+(\S+)>/) { $isBook=true; $tableWidth="width=90%" }
|
|
if ($help =~ /<section\s+([^>]*)>/) { $isSection=true; $sectionName=$1 }
|
|
if ($help =~ /<include tocbody>/) { $isTocBody=true; }
|
|
$help =~ s/<section\s+(\S+)>//g;
|
|
|
|
$help =~ s/<sttaRulerTask\s+"([^>]*)">/makeRulerTask($1)/ge;
|
|
$help =~ s/<sttaRuler\s+task="([^>]*)"\s+item="([^>]*)">/setRulerLink($1,$2)/ge;
|
|
$help =~ s/<secTargets\s+"([^>]*)">/makeTargets($1)/ge;
|
|
|
|
# find and replace <exec> directives
|
|
$help =~ s/<exec\s+([^>]*)>/exechelp($1)/ge;
|
|
# find and replace %LANG% for lang directory
|
|
$help =~ s/%LANG%/$current_lang/g;
|
|
|
|
if ( $help =~ /<noheadertable>/) {
|
|
$help =~ s/<noheadertable>//g;
|
|
$noHeaderTable=true;
|
|
}
|
|
|
|
$help =~ s/<headimg>([^<]+)<\/headimg>/headimg($1)/ge;
|
|
|
|
# find and replace the <header> section
|
|
if ($help =~ /<header>([^<]+)<\/header>/) {
|
|
$headTitle=$1;
|
|
if ( $headTitle =~ /\$infoCfg/ ) {
|
|
$headTitle=~ s/\$infoCfg{(\S+)}/infoCfg($1,'noFont')/ge;
|
|
}
|
|
&header($headTitle);
|
|
if ( $help =~ /<headertitle>/) {
|
|
$help =~ s/<header>([^<]+)<\/header>/headtableHelp($1)/ge;
|
|
$help =~ s/<headertitle>(.*)<\/headertitle>/headtitleHelp($1)/eos;
|
|
} else {
|
|
$help =~ s/<header>([^<]+)<\/header>/headtableHelp($1,1)/ge;
|
|
}
|
|
} else {
|
|
&helperror($text{'help_eheader'});
|
|
}
|
|
|
|
if ($help =~ /<book\s+(\S+)>/) {
|
|
local $book=&inchelp($noHeaderTable,$1);
|
|
$book =~ s/<a\s+href="([^>]*)">([^>]*)<\/a><\/li>/setBookLine($1,$2)/ge;
|
|
$help =~ s/<book\s+(\S+)>/$book/g;
|
|
}
|
|
|
|
# find and replace <if><else> directives
|
|
$help =~ s/<if\s+([^>]*)>([\000-\177]*?)<else>([\000-\177]*?)<\/if>/ifhelp($1, $2, $3)/ge;
|
|
# find and replace <if> directives
|
|
$help =~ s/<if\s+([^>]*)>([\000-\177]*?)<\/if>/ifhelp($1, $2)/ge;
|
|
|
|
# find and replace <include> directives
|
|
$help =~ s/<lihelpinc\s+(\S+)\s+(\S+)>/lihelpinc($1,$2)/ge;
|
|
$help =~ s/<include\s+(\S+)>/inchelp($noHeaderTable,$1)/ge;
|
|
$help =~ s/%PREFIX%/ /g;
|
|
|
|
$help =~ s/<footlinks>(.*)<\/footlinks>/footlinksHelp($1)/eos;
|
|
$help =~ s/<\$out_table{(\S+)}>/infoTable($1)/ge;
|
|
$help =~ s/\$infoCfg{(\S+)}/infoCfg($1)/ge;
|
|
|
|
$help =~ s/%H%/<img src="\/stta\/images\/icons\/help.gif" border="0" alt="HELP" width="16" height="16">/g;
|
|
$help =~ s/%W%/<img src="\/stta\/images\/icons\/warning.gif" alt="ALERT!" width="16" height="16" border=0>/g;
|
|
$help =~ s/%I%/<img src="\/stta\/images\/icons\/tip.gif" alt="TIP" width="16" height="16"border=0>/g;
|
|
$help =~ s/%N%/<img src="\/stta\/images\/icons\/new.gif" alt="new" width="26" height="8" border=0>/g;
|
|
$help =~ s/%S%/<img src="\/stta\/images\/icons\/starred.gif" alt="starred" width="16" height="16"border=0>/g;
|
|
$help =~ s/%U%/<img src="\/stta\/images\/icons\/updated.gif" alt="updated" width="56" height="8" border=0>/g;
|
|
$help =~ s/%P%/<img src="\/stta\/images\/icons\/pencil.gif" alt="pencil" width="16" height="16" border=0>/g;
|
|
$help =~ s/%AR%/<img src="\/stta\/images\/icons\/arrowright.gif " alt="arrowright" width="16" height="16" border=0>/g;
|
|
$help =~ s/%OK%/<img src="\/stta\/images\/icons\/choice-yes.gif " alt="choice-yes" width="16" height="16" border=0>/g;
|
|
$help =~ s/%INFO%/<img src="\/stta\/images\/info.gif " alt="info" width="20" height="20" border=0>/g;
|
|
|
|
if ( $WebHelpOut ) {
|
|
$help =~ s/="bookstta.pdf"/="$text{bookpdf_url}"/g;
|
|
$help =~ s/href="(\S+)"/hrefchange($1)/ge;
|
|
$help =~ s/HREF="(\S+)"/hrefchange($1)/ge;
|
|
$help =~ s/src="(\S+)"/imgsrcchange($1)/ge;
|
|
$help =~ s/window\.open\("(\S+)"/winOpenUrl($1)/ge;
|
|
$help =~ s/background="(\S+)"/imgbkgchange($1)/ge;
|
|
$help =~ s/href="\/stta\/sttaconfig.cgi"/href="$URLBase\/sttaconfig.html"/g;
|
|
$help =~ s/\/stta\/images\//\/stta\/help\/images\//g;
|
|
} else {
|
|
if ( -r "$root_directory/$module/help/$current_lang/bookstta.pdf" ) {
|
|
$help =~ s/="bookstta.pdf"/="\/$module\/help\/$current_lang\/bookstta.pdf"/g;
|
|
} else { $help =~ s/="bookstta.pdf"/="$text{bookpdf_url}"/g; }
|
|
}
|
|
$help =~ s/href="(\S+)"/hrefplusquery($1)/ge;
|
|
$help =~ s/%HRTABLE%/hr_table()/ge;
|
|
|
|
# output the HTML
|
|
#print $help;
|
|
# &footer();
|
|
}
|
|
#makeRulerTask(task)
|
|
sub makeRulerTask
|
|
{
|
|
my $taskOps="<section $_[0]><ul>";
|
|
my %rules=();
|
|
|
|
if ( ! -r "$root_directory/stta/install/rules" ) { return "" }
|
|
&read_file("$root_directory/stta/install/rules", \%rules);
|
|
&read_file("$root_directory/stta/$_[0]/rules", \%rules);
|
|
my @ruleline = split(/,/,$rules{$_[0]},-1);
|
|
foreach $r (@ruleline) {
|
|
if ( $isBook eq true ) {
|
|
$taskOps .= " <li><a class='menu1' href='#".$_[0]."_".$r."'>".$text{$r}."</a></li>";
|
|
} else {
|
|
$taskOps .=" <li><sttaRuler task=\"$_[0]\" item=\"$r\"></li>";
|
|
}
|
|
}
|
|
$taskOps .="</ul><ul>";
|
|
if ( $isBook eq true ) {
|
|
foreach $r (@ruleline) {
|
|
if ( -r "$root_directory/stta/$_[0]/info/$r.html" ) {
|
|
$taskOps .=" <a name=\"$_[0]"."_".$r."\"><dd> <include /stta/$_[0]/info/$r.html> <br></dd>";
|
|
} elsif ( -r "$root_directory/stta/install/info/$_[1].html" ) {
|
|
$taskOps .=" <a name=\"$_[0]"."_".$r."\"><dd> <include /stta/install/info/$r.html> <br></dd>";
|
|
}
|
|
}
|
|
}
|
|
$taskOps .="</ul>";
|
|
return $taskOps;
|
|
}
|
|
#setRulerLink(task,item_file)
|
|
sub setRulerLink
|
|
{
|
|
if ( -r "$root_directory/stta/$_[0]/info/$_[1].html" ) {
|
|
return "<a class='menu1' href='$_[0]\/info\/$_[1].html'>".$text{$_[1]}."</a>";
|
|
} elsif ( -r "$root_directory/stta/install/info/$_[1].html" ) {
|
|
return "<a class='menu1' href='install\/info\/$_[1].html'>".$text{$_[1]}."</a>";
|
|
} else {
|
|
return "<a class='menu1'>".$text{$_[1]}."</a>";
|
|
}
|
|
}
|
|
#makeTargets (targetList)
|
|
sub makeTargets
|
|
{
|
|
my @targetList=split(/,/,$_[0], -1);
|
|
my $targetStr="<ul>";
|
|
my $itemTit="";
|
|
foreach $r (@targetList) {
|
|
$itemTit="index_".$r;
|
|
if ( $isBook eq true ) {
|
|
$targetStr .= " <li><a class='menu1' href='#".$r."'>".$text{$itemTit}."</a></li>";
|
|
} else {
|
|
$targetStr .= " <li>".&hlink($text{$itemTit},$r)."</li>";
|
|
}
|
|
}
|
|
$targetStr .="</ul><ul>";
|
|
if ( $isBook eq true ) {
|
|
foreach $r (@targetList) {
|
|
$targetStr .=" <a name=\"".$r."\"><dd> <include $r> <br></dd>";
|
|
}
|
|
}
|
|
$targetStr .="</ul>";
|
|
return $targetStr;
|
|
}
|
|
# inchelp(noHeaderTable,path)
|
|
sub inchelp
|
|
{
|
|
local $ipath = "";
|
|
local $baseInc = $_[2] || ""; # base help module dir path
|
|
|
|
if ($_[1] =~ /^\/(\S+)/) {
|
|
# including something from another module..
|
|
$baseInc="/".$_[1]; # inside modules path are relative so STTA change to absolutes
|
|
my @lin=split(/\//,$_[1], -1);
|
|
$baseInc=~ s/$lin[$#lin]//; # last arg should be the file to load
|
|
if ( $baseInc =~ /\/info\// ) {
|
|
$ipath = "$root_directory"."$baseInc".$lin[$#lin].".html";
|
|
} else {
|
|
$ipath = &help_file($lin[0], $lin[$#lin]); # first arg should be the module
|
|
}
|
|
} else {
|
|
if ( $baseInc ne "" ) { # including from another module
|
|
$baseInc=~ s/\/\///g;
|
|
my @lin=split(/\//,$baseInc, -1); # arg 1 should be the module
|
|
$ipath = &help_file($lin[1], $_[1]); # file to load should be $_[1]
|
|
} else {
|
|
# including file to load $_[1] plus module from help.cgi ( $module = $1 )
|
|
$ipath = &help_file($module, $_[1]);
|
|
}
|
|
}
|
|
my $inc="";
|
|
if ( ! -r $ipath ) { $ipath =~ s/.html$//g; }
|
|
local $noHeaderTable=$_[0]; # this is to avoid another header output ... too many headers
|
|
@st = stat($ipath);
|
|
open(INC, $ipath) ||
|
|
return "<i>".&text('help_einclude', "(".$ipath.")--".$_[1]."--".$baseInc)."</i><br>\n";
|
|
read(INC, $inc, $st[7]);
|
|
close(INC);
|
|
# find and replace <if><else> directives
|
|
$inc =~ s/<if\s+([^>]*)>([\000-\177]*?)<else>([\000-\177]*?)<\/if>/ifhelp($1, $2, $3)/ge;
|
|
# find and replace <if> directives
|
|
$inc =~ s/<if\s+([^>]*)>([\000-\177]*?)<\/if>/ifhelp($1, $2)/ge;
|
|
$inc =~ s/<sttaRulerTask\s+"([^>]*)">/makeRulerTask($1)/ge;
|
|
$inc =~ s/<sttaRuler\s+task="([^>]*)"\s+item="([^>]*)">/setRulerLink($1,$2)/ge;
|
|
$inc =~ s/<secTargets\s+"([^>]*)">/makeTargets($1)/ge;
|
|
|
|
$inc =~ s/<exec\s+([^>]*)>/exechelp($1)/ge;
|
|
$inc =~ s/%LANG%/$current_lang/g;
|
|
$inc =~ s/\$infoCfg{(\S+)}/infoCfg($1)/ge;
|
|
$inc =~ s/<\$out_table{(\S+)}>/infoTable($1)/ge;
|
|
if ($inc =~ /<section\s+([^>]*)>/) { $isSection=true; $sectionName=$1 }
|
|
if ( $noHeaderTable eq true ) {
|
|
$inc =~ s/<headimg>([^<]+)<\/headimg>//g;
|
|
$inc =~ s/<header>([^<]+)<\/header>/outItemText($1)/ge;
|
|
$inc =~ s/<headertitle>(.*)<\/headertitle>//os;
|
|
} else {
|
|
$inc =~ s/<headimg>([^<]+)<\/headimg>/headimg($1)/ge;
|
|
if ( $inc =~ /<headertitle>/) {
|
|
$inc =~ s/<header>([^<]+)<\/header>/headtableHelp($1)/ge;
|
|
$inc =~ s/<headertitle>(.*)<\/headertitle>/headtitleHelp($1)/eos;
|
|
} else {
|
|
$inc =~ s/<header>([^<]+)<\/header>/headtableHelp($1,1)/ge;
|
|
}
|
|
}
|
|
if ( $isSection ne "true" && $isTocBody ne "true" ) {
|
|
$inc =~ s/<footlinks>(.*)<\/footlinks>/footlinksHelp($1)/eos;
|
|
} else {
|
|
$inc =~ s/<footlinks>(.*)<\/footlinks>//os;
|
|
}
|
|
$inc =~ s/<section\s+(\S+)>//g;
|
|
$inc =~ s/<include foot>//g;
|
|
$inc =~ s/<include head>//g;
|
|
# Recursive find and replace <include> directives
|
|
# this is to avoid another header output ... too many headers
|
|
$inc =~ s/<include\s+(\S+)>/inchelp(true,$1,$baseInc)/ge;
|
|
if ( $baseInc ne "" ) {
|
|
$inc =~ s/ href=([^>]*)>/chgBaseRef($baseInc,$1)/ge;
|
|
}
|
|
$inc =~ s/<lihelpinc\s+(\S+)\s+(\S+)>/lihelpinc($1,$2)/ge;
|
|
return $inc;
|
|
}
|
|
|
|
# lihelpinc(nroli,npath)
|
|
sub lihelpinc
|
|
{
|
|
my $inc=&inchelp(true,$_[1]);
|
|
$inc =~ s/%PREFIX%/$_[0] /g;
|
|
return $inc;
|
|
}
|
|
|
|
# ifhelp(perl, text, [elsetext])
|
|
sub ifhelp
|
|
{
|
|
local $rv = eval $_[0];
|
|
if ($@) { return "<i>".&text('help_eif', $_[0], $@)."</i><br>\n"; }
|
|
elsif ($rv) { return $_[1]; }
|
|
else { return $_[2]; }
|
|
}
|
|
|
|
# exechelp(perl)
|
|
sub exechelp
|
|
{
|
|
my $rv = eval $_[0];
|
|
$rv =~ s/:$//;
|
|
$rv =~ s/^\*//;
|
|
$rv =~ s/:<\/a>$/<\/a>/;
|
|
$rv =~ s/>\*/>/;
|
|
if ($@) { return "<i>".&text('help_eexec', $_[0], $@)."</i><br>\n"; }
|
|
else { return $rv; }
|
|
}
|
|
|
|
sub helperror
|
|
{
|
|
if ( $WebHelpOut ) { return }
|
|
#print "<center><h2>$text{'error'}</h2></center>\n";
|
|
#print "<hr><p>\n";
|
|
&header($text{'index_warn'},,,undef,1,0,,,undef,,);
|
|
print "<table width=100% border>\n";
|
|
print "<tr $tb> <td><font color='$revtext'><b>";
|
|
print "<center><h1>$text{'error'}</h1></center>\n";
|
|
print "</b></td> </tr>\n";
|
|
print "<tr $cb> <td><table width=100%>\n";
|
|
print "<h1> <font color='#000099'>$text{'error'} ...</font></h1></center>";
|
|
print "<center>";
|
|
#print "<p><img SRC='/stta/images/duke_warn.gif' height=258 width=390></center>";
|
|
print "<p><img align=top SRC='/stta/images/duke_warn.gif'></center><hr>";
|
|
print "<tr><td><h2> <font color='#000099'><b>",@_,"</b></font></h2></td></tr><tr>\n";
|
|
print "</table></table>\n";
|
|
&footer($config{'back_return'},$text{'index'});
|
|
exit;
|
|
}
|
|
|
|
sub outItemText
|
|
{
|
|
$item_text=&getItemText($_[0]);
|
|
if ( $isSection eq true && $sectionName ne "" && $noHeaderTable eq true ) {
|
|
return "<table border $tableWidth><tr $cb><td><b><font size=+1>$item_text</font></b></td></tr></table>";
|
|
} else { return "" };
|
|
}
|
|
|
|
sub getItemText
|
|
{
|
|
my $item=$_[0];
|
|
my $item_text="";
|
|
if ( $item =~/^f/ ) { # It is a field ?
|
|
$item=~ s/^f/f_/g;
|
|
$item_text=$text{$item};
|
|
if ( $item_text eq "" ) {
|
|
$item = $_[0];
|
|
} else { $item_text =~ s/:$//g; }
|
|
}
|
|
if ( $item eq $_[0] ) { # It is title
|
|
$item="index_".$item;
|
|
$item_text=$text{$item};
|
|
if ( $item_text eq "" ) { $item = $_[0] }
|
|
}
|
|
if ( $item eq $_[0] ) { # It something as itself ?
|
|
$item_text=$text{$item} || $_[0];
|
|
}
|
|
$item_text =~ s/^\*//;
|
|
return "$item_text";
|
|
}
|
|
|
|
sub headtableHelp
|
|
{
|
|
$isHeadImg=false;
|
|
$item_text=&getItemText($_[0]);
|
|
if ( $_[1] ne 1 ) {
|
|
$isHeadImg=true;
|
|
return "<table $tb BORDER=1 $tableWidth >".
|
|
" <tr><td><table BORDER=1 width=100%><tr><th $tb>$headImg *".
|
|
" <font color=$revtext size=\"+2\">$item_text</font> *</th></tr>";
|
|
} else {
|
|
return "<table $tb BORDER=1 $tableWidth >".
|
|
" <tr><td><table BORDER=1 width=100%><tr><th $tb>$headImg * ".
|
|
"<font color=$revtext size=\"+2\">$item_text</font> *</th></tr>".
|
|
"<tr><td $cb > <br> </td></tr> </table> </td> </tr> </table>";
|
|
}
|
|
}
|
|
sub headtitleHelp
|
|
{
|
|
local $text=$_[0];
|
|
if ( $isHeadImg eq true ) {
|
|
$isHeadImg=false;
|
|
return "<tr><td $cb align=center> <b></b> </td></tr><tr><td $bgimage>$text</td></tr></table></td></tr></table>";
|
|
} else {
|
|
return "<tr><td $cb align=center> <b></b> </td></tr><tr><td $bgimage>$text</td></tr></table>";
|
|
}
|
|
if ( $text =~ /^OPEN / ) {
|
|
$text=~ s/^OPEN //g;
|
|
return "<tr><td $cb align=center> <b>$text</b> </td></tr><tr><td $bgimage>";
|
|
};
|
|
return "<tr><td $cb> $_[0] </td></tr> </table> </td> </tr> </table>";
|
|
}
|
|
sub footlinksHelp
|
|
{
|
|
local $htmltext;
|
|
if ( $sectionName =~ /toc_/ ) { return ""; }
|
|
if ( $isBook eq true ) { return ""; }
|
|
local @linelinks=split(/::/,$_[0], -1);
|
|
if ( $#linelinks lt 1 ) { return ""; }
|
|
$htmltext="<table $tb BORDER=1 $tableWidth><tr><td><table BORDER=1 $tableWidth><tr><td $cb><table><tr>";
|
|
|
|
foreach $l (@linelinks) {
|
|
$l =~ s/\r|\n//g;
|
|
if ( $l =~ /<a / ) {
|
|
$htmltext .="<td>$l </td>";
|
|
} else {
|
|
if ( $l =~/^f/ ) { # It is a field ?
|
|
$item_text=$l;
|
|
$item_text=~ s/^f/f_/g;
|
|
$item_text=$text{$item_text};
|
|
} else { $item_text=$text{$l} }
|
|
if ( $item_text eq "" ) { $item_text = $l}
|
|
$htmltext .="<td><a class='menu1' href=\"/stta/help.cgi/stta/".$l."\">".$item_text."</a> </td>";
|
|
}
|
|
}
|
|
$htmltext .="</tr></table></td></tr><tr><th $tb><center><font color=$revtext>$text{see_also}</font>".
|
|
"</th></tr></table> </td> </tr> </table>";
|
|
return $htmltext;
|
|
}
|
|
|
|
sub print_table_cfg
|
|
{
|
|
local %h_cfgsec=(), @cfgsec=();
|
|
local $item, $d;
|
|
local $htmltext="";
|
|
local $i=0;
|
|
local $inum="";
|
|
|
|
&read_file("$root_directory/$module/dataconf/base/$_[0]", \%h_cfgsec, \@cfgsec);
|
|
$htmltext .="<table border=0>\n";
|
|
$htmltext .="<ul>\n";
|
|
foreach $item (@cfgsec) {
|
|
$i++;
|
|
$htmltext .="<tr><td valign=center><a class='menu1' href=\"";
|
|
if ( $_[1] eq "#" ) {
|
|
$htmltext .= "#";
|
|
} elsif ( $WebHelpOut ) {
|
|
$htmltext .= "$URLBase/config_".$_[0].".html#";
|
|
} else {
|
|
$htmltext .="/stta/help.cgi/stta/config/";
|
|
}
|
|
$htmltext .="$item\">$item</a></td><td align=rigth> - <b>".&infoCfg($item)."</b> </td></tr>\n";
|
|
}
|
|
$htmltext .="</ul>\n";
|
|
$htmltext .="</table>\n";
|
|
return $htmltext;
|
|
}
|
|
|
|
sub include_cfgvalues
|
|
{
|
|
local %h_cfgsec=(), @cfgsec=();
|
|
local $item;
|
|
local $htmltext="";
|
|
local $i=0;
|
|
local $inum=$_[1];
|
|
|
|
&read_file("$root_directory/$module/dataconf/base/$_[0]", \%h_cfgsec, \@cfgsec);
|
|
$htmltext .="<ul>\n";
|
|
foreach $item (@cfgsec) {
|
|
$i++;
|
|
$htmltext .=" <li><b>".&infoCfg($item)."</b> (".$item.") <br> \n";
|
|
$htmltext .=" <include %LANG%/config/".$item."> </li> \n";
|
|
}
|
|
$htmltext .="</ul>\n";
|
|
return $htmltext;
|
|
}
|
|
|
|
sub print_table_ordercfgs
|
|
{
|
|
local %listfcfgs=(), @orderfcfgs=();
|
|
local $item_title, $item_help, $d;
|
|
local $htmltext="";
|
|
local $i=0;
|
|
|
|
&read_file("$root_directory/$module/dataconf/ordercfgs", \%listfcfgs, \@orderfcfgs);
|
|
push (@orderfcfgs,'others');
|
|
$listfcfgs{'others'}='sttaconfig#others';
|
|
if ( $_[0] ne "include" && $isBook ne true && $_[2] ne "ul" ) { $htmltext .="<table border=0>\n"; }
|
|
if ( $_[2] ne "ul" ) { $htmltext .="<ul>\n"; }
|
|
if ( $_[0] eq "all" ) {
|
|
foreach $d (@orderfcfgs) {
|
|
$i++;
|
|
$inum=$i;
|
|
$inum=$_[1].".".$inum;
|
|
$item_title=$d."_title";
|
|
$item_help=$listfcfgs{$d};
|
|
$item_help=~ s/^config_//g;
|
|
if ( $i < 10 ) { $inum=$_[1].".0".$i; }
|
|
if ( $_[2] ne "ul" ) { $htmltext .="<tr><td valign=center>"; }
|
|
$htmltext .= "<li> $inum.-<a class='menu1' HREF=\"#$d\">$text{$item_title}</a></td><td align=rigth> - <b>$item_help</b> </li>";
|
|
if ( $_[2] ne "ul" ) { $htmltext .="</td></tr>"; }
|
|
$htmltext .="\n";
|
|
}
|
|
if ( $_[2] ne "ul" ) { $htmltext .="</ul><tr> </tr>\n"; }
|
|
pop (@orderfcfgs);
|
|
}
|
|
$i=0;
|
|
foreach $d (@orderfcfgs) {
|
|
$i++;
|
|
$inum=$i;
|
|
$inum=$_[1].".".$inum;
|
|
$item_title=$d."_title";
|
|
$item_help=$listfcfgs{$d};
|
|
if ( $i < 10 ) { $inum=$_[1].".0".$i; }
|
|
if ( $_[0] ne "all" ) {
|
|
if ( $_[0] eq "include" || $isBook eq true ) {
|
|
if ( $_[2] ne "ul" ) {
|
|
$htmltext .="<li><table border=0><tr><td valign=center>$inum.- <font>$text{$item_title}</font></td><td align=rigth> - ( <b>$d</b> ) </td></tr></table></li>\n";
|
|
} else {
|
|
$htmltext .="<li>$inum.- <font>$text{$item_title}</font> - ( <b>$d</b> ) </li>\n";
|
|
}
|
|
if ( $d =~ /others/ ) {
|
|
$htmltext .= "<hr><p>".&inchelp(false,"config_others")."</p><hr>";
|
|
} else {
|
|
$htmltext .= "<hr><p>".&inchelp(false,$item_help)."</p><hr>";
|
|
}
|
|
} else {
|
|
if ( $_[2] ne "ul" ) {
|
|
$htmltext .="<tr><td valign=center><li> $inum.-<a class='menu1' href=\"/stta/help.cgi/stta/$item_help\">$text{$item_title}</a></td><td align=rigth> - <b>$d</b> </li></td></tr>\n";
|
|
} else {
|
|
$htmltext .="<li> $inum.-<a class='menu1' href=\"/stta/help.cgi/stta/$item_help\">$text{$item_title}</a> - <i>$d</i> </li>\n";
|
|
}
|
|
}
|
|
} else {
|
|
$htmltext .='<a name="'.$d.'"><table border><tr '.$tb.'><td valign=center><a class=\'menu2\' HREF="/stta/config.cgi?'.$d.'"> <img SRC="/stta/images/icon_pencil.gif" width=20 heigth=18 align=top border=0> <b><i>'.$inum.'-'.$text{$item_title}.' </i></b></a> <a onClick=\'window.open("/stta/help.cgi/stta/config_'.$d.'", "help", "toolbar=no,menubar=no,scrollbars=yes,width=$config{help_width},height=$config{help_height},resizable=yes"); return false\' class=\'menu2\' HREF="/stta/help.cgi/stta/config_'.$d.'"><img SRC="/stta/images/info.gif" width=20 heigth=20 align=top border=0><b><i> '.$d.' </i></b></a></td></tr>';
|
|
$htmltext .= '<tr background="/stta/images/bkg/help.jpg"><td background="/stta/images/bkg/help.jpg">';
|
|
$htmltext .=&print_table_cfg($d,$inum,$_[2]);
|
|
if ( $_[2] ne "ul" ) { $htmltext .='</td></tr></table><br>'; }
|
|
}
|
|
}
|
|
if ( $_[0] ne "include" && $isBook ne true && $_[2] ne "ul" ) { $htmltext .="</table>\n"; }
|
|
return $htmltext;
|
|
}
|
|
|
|
sub hrefplusquery
|
|
{
|
|
local $href_str=$_[0];
|
|
if ( $querySTR ne "" && $_[0] =~ /\/stta\/help.cgi\/stta/ ) {
|
|
if ( $href_str =~ /\?$querySTR/ ) { return "class='menu1' href=\"$href_str\""; }
|
|
return "class='menu1' href=\"$href_str?$querySTR\"";
|
|
} else {
|
|
return "class='menu1' href=\"$href_str\"";
|
|
}
|
|
}
|
|
|
|
sub chgBaseRef
|
|
{
|
|
my $href_base=$_[0];
|
|
my $href_page=$_[1];
|
|
$href_base=~ s/\/\///g;
|
|
$href_base=~ s/\/help//g;
|
|
if ( $href_page eq "" ) {
|
|
return "";
|
|
} elsif ( $href_page =~ /"/ ) {
|
|
return " class='menu1' href=".$href_page.">";
|
|
} else {
|
|
return " class='menu1' HREF=/stta/help.cgi".$href_base.$href_page.">";
|
|
return " class='menu1' href=\"".$href_page.">";
|
|
}
|
|
}
|
|
|
|
sub hrefchange
|
|
{
|
|
local $href_str=$_[0];
|
|
if ( $_[0] =~ /javascript:self.close/ ) {
|
|
$href_str=~ s/javascript:self.close\(\)/$URLBase\//g;
|
|
return "href=\"$href_str\"";
|
|
} elsif ( $_[0] =~ /\/stta\/help.cgi\/stta/ ) {
|
|
$href_str=~ s/\/stta\/help.cgi\/stta/$URLBase/g;
|
|
return "href=\"$href_str.html\"";
|
|
} elsif ( $_[0] =~ /\/webmin\// ) {
|
|
return "";
|
|
} else {
|
|
return "href=\"$href_str\"";
|
|
}
|
|
}
|
|
sub imgsrcchange
|
|
{
|
|
local $imgsrc_str=$_[0];
|
|
$imgsrc_str=~ s/\/stta\//$IMGBase\//g;
|
|
return "src=\"$imgsrc_str\"";
|
|
}
|
|
sub imgbkgchange
|
|
{
|
|
local $imgbkg_str=$_[0];
|
|
$imgbkg_str=~ s/\/stta\//$IMGBase\//g;
|
|
return "background=\"$imgbkg_str\"";
|
|
}
|
|
sub headimg
|
|
{
|
|
if ( $_[0] ne "flower.gif" ) {
|
|
local @lineimg=split(/ /,$_[0], -1);
|
|
$headImg="<a class='menu1' href=\"$lineimg[0]\"><img border=0 alt=\"$lineimg[1]\" src=\"$lineimg[2]\" ";
|
|
if ( $lineimg[3] gt 0 ) { $headImg .=" width=$lineimg[3]";}
|
|
if ( $lineimg[4] gt 0 ) { $headImg .=" heigth=$lineimg[4]"; }
|
|
$headImg .=" ></a>";
|
|
} else {
|
|
$headImg="<img src=\"/stta/images/flower.gif\" alt=\"Stta\" width=18 height=20 align=\"top\" border=0>";
|
|
}
|
|
return "";
|
|
}
|
|
sub infoCfg
|
|
{
|
|
local $textInfo = $infoCfg{$_[0]};
|
|
local @lineInfoCfg=split(/,/,$textInfo, -1);
|
|
if ( $_[1] eq "noFont" ) { return "$lineInfoCfg[0]"; };
|
|
return "<i>$lineInfoCfg[0]</i>";
|
|
}
|
|
sub infoTable
|
|
{
|
|
local $text= $_[0];
|
|
local %h_objs=&load_tabdef($text);
|
|
$text =~ s/_list//g;
|
|
local $textInfo = $text{'index_'.$text};
|
|
local $item,$descrip;
|
|
local $outstr="<table BORDER=1 ><tr><th $tb>";
|
|
if ( $sectionName ne "sttatables_def" ) {
|
|
$outstr.=&hlink("<img SRC='/stta/images/info.gif' width=20 heigth=20 align=top border=0>","tableformat");
|
|
}
|
|
$outstr .="* ".
|
|
" <font color=$revtext size=\"+2\">".&text("f_tabledef",$textInfo)."</font> *</th></tr>";
|
|
$outstr .="<tr><td><table border=0>\n";
|
|
local @listobjs=();
|
|
foreach $item (keys (%h_objs)) { push (@listobjs,$h_objs{$item}); }
|
|
@listobjs = sort {$a->{'pos'} cmp $b->{'pos'}} @listobjs;
|
|
if ( $#listobjs > 0 ) {
|
|
$outstr.="<tr>";
|
|
$outstr.="<td $bgimage align=center>$text{f_pos}</td>";
|
|
$outstr.="<td $bgimage align=center>$text{f_alias}</td>";
|
|
$outstr.="<td $bgimage align=center>$text{f_namehelp}</td>";
|
|
$outstr.="<td $bgimage align=center>$text{f_descrip}</td>";
|
|
$outstr.="<td $bgimage align=center>$text{f_range}</td>";
|
|
$outstr.="<td $bgimage align=center>$text{f_target}</td>";
|
|
$outstr.="<td $bgimage align=center>$text{f_madatory}</td>";
|
|
$outstr.="<td $bgimage align=center>$text{f_comments}</td>";
|
|
$outstr.="</tr>";
|
|
}
|
|
foreach $item (@listobjs) {
|
|
next if ( $item->{alias} eq "" ) ;
|
|
$outstr.="<tr>";
|
|
$outstr.="<td $cb align=center>".$item->{pos}."</td>";
|
|
$outstr.="<td $cb>".$item->{alias}."</td>";
|
|
$descrip=$text{$item->{name}};
|
|
$descrip =~ s/:$//;
|
|
$outstr.="<td $cb>".&hlink("<b>$descrip</b>",$item->{help})."</td>";
|
|
$outstr.="<td $cb>".$item->{descrip}."</td>";
|
|
$outstr.="<td $cb>".$item->{range}."</td>";
|
|
$outstr.="<td $cb>".$item->{target}."</td>";
|
|
$outstr.="<td $cb align=center>";
|
|
if ( $item->{mandatory} eq "1" ) { $outstr.=$text{yes}; } else { $outstr .= "-" }
|
|
$outstr.="<td $cb>".$item->{comments}."</td>";
|
|
$outstr.="</tr>\n";
|
|
}
|
|
$outstr.="</table></td></tr></table>\n";
|
|
$outstr=~ s/\$infoCfg{(\S+)}/infoCfg($1)/ge;
|
|
$outstr=~ s/\$(\S+){(\S+)}/text_subs($2,\%{$1})/ge;
|
|
return $outstr;
|
|
}
|
|
sub setBookLine
|
|
{
|
|
local @linelink=split(/\//,$_[0], -1);
|
|
# return "<li><font size=+2>$_[1]</font></li><hr>".&inchelp(false,$linelink[$#linelink])."<hr>";
|
|
return "<dd>".&inchelp(false,$linelink[$#linelink])."</dd><hr>";
|
|
}
|
|
|
|
sub winOpenUrl
|
|
{
|
|
local $href_str=$_[0];
|
|
if ( $_[0] =~ /\/stta\/help.cgi\/stta/ ) {
|
|
$href_str=~ s/\/stta\/help.cgi\/stta/$URLBase/g;
|
|
return "window.open(\"$href_str.html\"";
|
|
} else {
|
|
return "window.open(\"$href_str\"";
|
|
}
|
|
}
|
|
sub hr_table
|
|
{
|
|
return "<table $tableWidth align=left border0><tr $cb><td> </td></tr></table><br>";
|
|
}
|
|
1; # Return true
|
|
|