package WebGUI::Operation::Help; #------------------------------------------------------------------- # WebGUI is Copyright 2001 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::Session; use WebGUI::SQL; use WebGUI::Utility; our @ISA = qw(Exporter); our @EXPORT = qw(&www_viewHelp &www_viewHelpIndex); #------------------------------------------------------------------- sub www_viewHelp { my ($output, %help, @data, $sth); tie %help, 'Tie::CPHash'; %help = WebGUI::SQL->quickHash("select * from help where helpId=$session{form}{hid}",$session{dbh}); $output = '

Help: '.$help{action}.' '.$help{object}.'

'; $help{body} =~ s/\n/\/g; $output .= $help{body}; $output .= '

See Also:'; $sth = WebGUI::SQL->read("select helpId, action, object from help where object='$help{object}' and action<>'$help{action}' order by action",$session{dbh}); while (@data = $sth->array) { $output .= ' '.$data[1].' '.$data[2].' ·'; } $sth->finish; $sth = WebGUI::SQL->read("select helpId, action, object from help where helpId in ($help{seeAlso}) order by action",$session{dbh}); while (@data = $sth->array) { $output .= ' '.$data[1].' '.$data[2].' ·'; } $sth->finish; $output .= ' Help Index'; return $output; } #------------------------------------------------------------------- sub www_viewHelpIndex { my ($sth, @data, $output, $previous); $output = '

Help Index

'; $output .= '
Sorted By Action

'; $sth = WebGUI::SQL->read("select helpId, action, object from help order by action,object",$session{dbh}); while (@data = $sth->array) { if ($data[1] ne $previous) { $output .= '

'.$data[1].'
'; $previous = $data[1]; } $output .= '

  • '.$data[2].'
    '; } $sth->finish; $output .= '
  • Sorted By Object

    '; $sth = WebGUI::SQL->read("select helpId, object, action from help order by object,action",$session{dbh}); while (@data = $sth->array) { if ($data[1] ne $previous) { $output .= '

    '.$data[1].'
    '; $previous = $data[1]; } $output .= '

  • '.$data[2].'
    '; } $sth->finish; $output .= '
  • '; return $output; } 1;