# 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; use lib '/home/httpd/lib/perl/'; use LONCAPA; sub handler { my ($r) = @_; &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['page','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 $faq = $env{'form.faq'}; my $bug = $env{'form.bug'}; my $topic = $env{'form.topic'}; 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,$faq,$bug,$topic,$component_url,$origurl,$bugurl,$faqbaseurl,$requestmail,$stayOnPage); } elsif ($env{'form.page'} eq 'body') { &display_help_mainpage($r,$faq,$bug,$topic,$component_url,$origurl,$bugurl,$faqbaseurl,$requestmail); } return OK; } sub display_help_banner { my ($r,$faq,$bug,$topic,$component_url,$origurl,$bugurl,$faqbaseurl,$requestmail,$stayOnPage) = @_; my $location=&Apache::loncommon::lonhttpdurl("/adm"); my $scripttag = ''; if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) { my $displayurl = &escape($origurl); $scripttag = (<<"SCRIPT_ONE"); SCRIPT_TWO } my %body_layout = ('rightmargin' => "0", 'leftmargin' => "0", 'marginwidth' => "0", 'topmargin' => "1", 'marginheight' => "1"); my $start_page = &Apache::loncommon::start_page('',$scripttag, {'add_entries' => \%body_layout, 'only_body' => 1,}); $r->print($start_page); my $width = ($stayOnPage) ? '95%' : '600'; $r->print('
$lt{'disp'}
"); } } } if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) { $r->print("$lt{'suhr'}");
unless ($env{'user.adv'}) {
$r->print('
'.&mt('Note').': '.$lt{'stuq'}.'. '.&mt('This can be done using the').' '.&mt('COM').' '.&mt('button, or the FDBK button when viewing a content page.'));
}
$r->print("
$lt{'tfaq'}
"); } if ($bugurl && $env{'user.adv'}) { $bugurl .= '?'.$bug; $r->print("$lt{'crea'} $lt{'suim'}
"); } $r->print(&Apache::loncommon::end_page()); } 1;