# The LearningOnline Network with CAPA
# generate frame-based help system
#
# Copyright Michigan State University Board of Trustees
#
# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
#
# LON-CAPA is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# LON-CAPA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LON-CAPA; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# /home/httpd/html/adm/gpl.txt
#
# http://www.lon-capa.org/
#
package Apache::lonhelpmenu;
use strict;
use lib qw(/home/httpd/lib/perl);
use Apache::Constants qw(:common);
use Apache::loncommon();
use Apache::lonlocal;
use Apache::lonnet;
sub handler {
my ($r) = @_;
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['page','color','function','faq','bug','topic','component_help','origurl','stayonpage']);
&Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
if ($r->header_only) {
return OK;
}
my $color = $env{'form.color'};
my $faq = $env{'form.faq'};
my $bug = $env{'form.bug'};
my $topic = $env{'form.topic'};
my $function = $env{'form.function'};
my $component_help = $env{'form.component_help'};
my $origurl = $env{'form.origurl'};
my $stayOnPage = $env{'form.stayonpage'};
my $component_url = $component_help;
if ($component_url) {
$component_url = '/adm/help/'.$component_url.'.hlp';
}
my $bugurl = $Apache::lonnet::perlvar{'BugzillaHost'};
$bugurl .= 'enter_bug.cgi?product=LON-CAPA&bug_file_loc='.$origurl;
if ($bug) {
$bugurl .= '&component='.$bug;
}
my $faqbaseurl = $Apache::lonnet::perlvar{'FAQHost'};
my $requestmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
if ($env{'form.page'} eq 'banner') {
&display_help_banner($r,$color,$function,$faq,$bug,$topic,$component_url,$origurl,$bugurl,$faqbaseurl,$requestmail,$stayOnPage);
} elsif ($env{'form.page'} eq 'body') {
&display_help_mainpage($r,$color,$function,$faq,$bug,$topic,$component_url,$origurl,$bugurl,$faqbaseurl,$requestmail);
}
return OK;
}
sub display_help_banner {
my ($r,$color,$function,$faq,$bug,$topic,$component_url,$origurl,$bugurl,$faqbaseurl,$requestmail,$stayOnPage) = @_;
my $bodytag = &Apache::loncommon::bodytag('',$function,'rightmargin="0" leftmargin="0" marginwidth="0" topmargin="1" marginheight="1"',1);
$bodytag=~s/[\n\r]/ /g;
my $fontcolor = &Apache::loncommon::designparm($function.'.font');
my $alinkcolor = &Apache::loncommon::designparm($function.'.alink');
my $vlinkcolor = &Apache::loncommon::designparm($function.'.vlink');
my $pagecolor = &Apache::loncommon::designparm($function.'.pgbg');
my $tablecolor = &Apache::loncommon::designparm($function.'.tabbg');
my $location=&Apache::loncommon::lonhttpdurl("/adm");
if (($tablecolor eq '') || ($tablecolor eq '#FFFFFF')) {
$tablecolor = '#EEEE99';
}
my $scripttag = '';
if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) {
my $displayurl = &Apache::lonnet::escape($origurl);
$scripttag = (<<"SCRIPT_ONE");
SCRIPT_TWO
}
my $html=&Apache::lonxml::xmlbegin();
$r->print(<Help Banner
$scripttag
$bodytag
END
if ($stayOnPage) {
$r->print('