package WebGUI::Operation::Help; #------------------------------------------------------------------- # WebGUI is Copyright 2001-2002 Plain Black Software. #------------------------------------------------------------------- # Please read the legal notices (docs/legal.txt) and the license # (docs/license.txt) that came with this distribution before using # this software. #------------------------------------------------------------------- # http://www.plainblack.com info@plainblack.com #------------------------------------------------------------------- use Exporter; use strict; use Tie::CPHash; use WebGUI::International; use WebGUI::Session; use WebGUI::SQL; use WebGUI::URL; our @ISA = qw(Exporter); our @EXPORT = qw(&www_viewHelp &www_viewHelpIndex); #------------------------------------------------------------------- sub www_viewHelp { my ($output, %help, @data, $sth, %seeAlso, $namespace); $namespace = $session{form}{namespace} || "WebGUI"; tie %help, 'Tie::CPHash'; %help = WebGUI::SQL->quickHash("select * from help where helpId=$session{form}{hid} and namespace='$namespace' and language='$session{user}{language}'"); if ($help{action} eq "") { %help = WebGUI::SQL->quickHash("select * from help where helpId=$session{form}{hid} and namespace='$namespace' and language='English'"); } $output = '
'.WebGUI::International::get(94).':';
$sth = WebGUI::SQL->read("select helpId, action, object, namespace from help where object='$help{object}'
and action<>'$help{action}' and language='$session{user}{language}' order by action");
unless ($sth->rows) {
$sth->finish;
$sth = WebGUI::SQL->read("select helpId, action, object, namespace from help where object='$help{object}'
and action<>'$help{action}' and language='English' order by action");
}
while (@data = $sth->array) {
$output .= ' '.$data[1].' '.$data[2].',';
}
$sth->finish;
$sth = WebGUI::SQL->read("select helpId, namespace from helpSeeAlso where seeAlsoId in ($help{seeAlso})");
while (@data = $sth->array) {
%seeAlso = WebGUI::SQL->quickHash("select helpId,namespace,action,object from help where helpId='$data[0]'
and namespace='$data[1]' and language='$session{user}{language}'");
if ($seeAlso{helpId} eq "") {
%seeAlso = WebGUI::SQL->quickHash("select helpId,namespace,action,object from help where helpId='$data[0]'
and namespace='$data[1]' and language='English'");
}
$output .= ' '.$seeAlso{action}.' '.$seeAlso{object}.',';
}
$sth->finish;
$output .= ' '.WebGUI::International::get(95).'';
return $output;
}
#-------------------------------------------------------------------
sub www_viewHelpIndex {
my ($sth, @data, $output, $previous);
$output = ' ';
$sth = WebGUI::SQL->read("select helpId, action, object, namespace from help where language='$session{user}{language}' order by action,object");
unless ($sth->rows) {
$sth->finish;
$sth = WebGUI::SQL->read("select helpId, action, object, namespace from help where language='English' order by action,object");
}
while (@data = $sth->array) {
if ($data[1] ne $previous) {
$output .= ' '.$data[1].' ';
$sth = WebGUI::SQL->read("select helpId, object, action, namespace from help where language='$session{user}{language}' order by object,action");
unless ($sth->rows) {
$sth->finish;
$sth = WebGUI::SQL->read("select helpId, object, action, namespace from help where language='English' order by object,action");
}
while (@data = $sth->array) {
if ($data[1] ne $previous) {
$output .= ' '.$data[1].''.WebGUI::International::get(95).'
';
$output .= '
';
return $output;
}
1;
'.WebGUI::International::get(96).'
';
$previous = $data[1];
}
$output .= '
';
}
$sth->finish;
$output .= ''.WebGUI::International::get(97).'
';
$previous = $data[1];
}
$output .= '
';
}
$sth->finish;
$output .= '