version 1.41, 2013/07/15 17:42:11
|
version 1.49, 2023/04/06 17:36:12
|
Line 57 sub processLabelName {
|
Line 57 sub processLabelName {
|
|
|
# Serve out the text |
# Serve out the text |
sub servetext { |
sub servetext { |
my ($r,$text,$is_mobile,$firstfile) = @_; |
my ($r,$uri,$text,$is_mobile,$firstfile) = @_; |
my $bugs=&Apache::loncommon::help_open_bug('Documentation',&mt('Report a documentation bug')); |
my $bugs; |
my $morehelp;#=&Apache::loncommon::help_open_menu(undef,undef,1,undef,undef,undef,undef,'Help and Assistance Menu'); |
my %helpconfig = &Apache::lonnet::get_dom('configuration',['helpsettings'], |
my $header=&mt('LON-CAPA Help'); |
$env{'request.role.domain'}); |
|
if (ref($helpconfig{'helpsettings'}) eq 'HASH') { |
|
if ($helpconfig{'helpsettings'}{'submitbugs'} eq '1') { |
|
$bugs = &Apache::loncommon::help_open_bug('Documentation',&mt('Report a documentation bug')); |
|
} |
|
} |
|
my %lt = &Apache::lonlocal::texthash( |
|
header => 'LON-CAPA Help', |
|
search => 'Search LON-CAPA help', |
|
query => 'Search', |
|
); |
|
my $goback; |
|
if ((($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) || |
|
(($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self'))) { |
|
my $backicon = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL').'/').'clickhere.gif'; |
|
$goback = '<a href="javascript:history.go(-1);" class="LC_menubuttons_link" title="Go Back">'. |
|
'<img src="'.$backicon.'" alt="'.&mt('Go Back').'" class="LC_icon" border="0" />'. |
|
'</a> '; |
|
} |
$r->print(<<HEADER); |
$r->print(<<HEADER); |
<h3 style="font: sans-serif"><img align="right" alt="help logo" |
<h3 style="font: sans-serif"><img align="right" alt="help logo" |
src="/adm/help/gif/lonhelpheader.gif"/>$header</h3><hr /> |
src="/adm/help/gif/lonhelpheader.gif" />$goback$lt{'header'}</h3><hr /> |
<!-- BEGIN --> |
<!-- BEGIN --> |
HEADER |
HEADER |
if ($is_mobile) { |
if ($is_mobile) { |
Line 83 HEADER
|
Line 101 HEADER
|
} |
} |
|
|
if (&Apache::lonnavmaps::advancedUser()) { |
if (&Apache::lonnavmaps::advancedUser()) { |
my $search=&mt('Search LON-CAPA help'); |
$r->print(<<FOOTER); |
my $query=&mt('Search'); |
<hr /><div class="LC_left_float"> |
my $uri = $r->uri; |
<form action="$uri" method="post"> |
$r->print(<<FOOTER); |
<fieldset><legend>$lt{'search'}</legend> |
<hr /><form action="$uri" method="post"> |
<input type="text" name="searchterm" size="40" /> |
<label>$search: <input type="text" name="searchterm" size="40" /></label><input type="submit" value="$query" /> |
<input type="submit" value="$lt{'query'}" /> |
</form> |
</fieldset> |
<br /> |
</form> |
|
</div> |
|
<div class="LC_left_float"> |
|
</div> |
|
<div style="padding:0;clear:both;margin:0;border:0"></div> |
$bugs |
$bugs |
$morehelp |
|
FOOTER |
FOOTER |
|
|
} |
} |
|
|
$r->print(<<ENDBODY); |
$r->print(<<ENDBODY); |
Line 138 sub render {
|
Line 158 sub render {
|
'\\begin{html}<a href="/adm/help/'. |
'\\begin{html}<a href="/adm/help/'. |
$label . |
$label . |
$ext . |
$ext . |
'"><img src="'.$icon.'" border="0" /></a>' . |
'"><img src="'.$icon.'" border="0" alt="'.&mt('Help').'" /></a>' . |
'\\end{html}' |
'\\end{html}' |
|gxe; |
|gxe; |
|
|
Line 160 sub render {
|
Line 180 sub render {
|
# Fix the pretty quotes |
# Fix the pretty quotes |
$tex =~ s/('')|(``)/"/g; #" to get emacs syntax highlighter happy |
$tex =~ s/('')|(``)/"/g; #" to get emacs syntax highlighter happy |
|
|
|
$tex =~ s/`/'/g; |
|
|
# For some reason all captions come out as "Figure 0:", so |
# For some reason all captions come out as "Figure 0:", so |
# just duck the issue... |
# just duck the issue... |
|
|
Line 216 sub handler {
|
Line 238 sub handler {
|
if ($env{'form.searchterm'}=~/\w/) { |
if ($env{'form.searchterm'}=~/\w/) { |
$caller = 'search'; |
$caller = 'search'; |
} |
} |
my $starthash = { |
|
only_body => 1, |
|
add_entries => { |
|
'onload' => "javascript:expand_div('$caller');", |
|
}, |
|
}; |
|
|
|
|
my $starthash; |
|
|
|
if ($env{'browser.mobile'}) { |
|
$starthash = { |
|
only_body => 1, |
|
add_entries => { |
|
'onload' => "javascript:expand_div('$caller');", |
|
}, |
|
}; |
|
} else { |
|
$starthash = { |
|
only_body => 1, |
|
}; |
|
} |
my $firstfile; |
my $firstfile; |
|
$env{'form.texengine'} = 'tth'; |
my $start_page= |
my $start_page= |
&Apache::loncommon::start_page('LON-CAPA Help',undef,$starthash); |
&Apache::loncommon::start_page('LON-CAPA Help',undef,$starthash); |
|
delete($env{'form.texengine'}); |
my $text=''; |
my $text=''; |
|
my $uri = $r->uri; |
if ($env{'form.searchterm'}=~/\w/) { |
if ($env{'form.searchterm'}=~/\w/) { |
($text,my $matches)=&listmatches($docroot,$env{'form.searchterm'},&Apache::lonlocal::current_language().'/'); |
($text,my $matches)=&listmatches($docroot,$env{'form.searchterm'},&Apache::lonlocal::current_language().'/'); |
if ($matches) { |
if ($matches) { |
Line 238 sub handler {
|
Line 271 sub handler {
|
$text=&listmatches($docroot,$env{'form.searchterm'}); |
$text=&listmatches($docroot,$env{'form.searchterm'}); |
} |
} |
} else { |
} else { |
my $filenames = &unescape(substr($ENV{'REQUEST_URI'} , |
my $filenames = &unescape(substr($uri,rindex($uri,'/')+1,-4)); |
rindex($ENV{'REQUEST_URI'}, '/') + 1, -4)); |
|
|
|
# Security check on the file; the whole filename must consist |
# Security check on the file; the whole filename must consist |
# of nothing but alphanums, ' ,, or ., or the file |
# of nothing but alphanums, ' ,, or ., or the file |
Line 256 sub handler {
|
Line 288 sub handler {
|
$filenames =~ s/:/,/g; |
$filenames =~ s/:/,/g; |
my @files = split(/,/, $filenames); |
my @files = split(/,/, $filenames); |
$firstfile = '/adm/help/'.$files[0].'.hlp'; |
$firstfile = '/adm/help/'.$files[0].'.hlp'; |
|
my $count = 0; |
|
|
for my $filename (@files) { |
for my $filename (@files) { |
if (-e $docroot.'/adm/help/tex/'. |
if (-e $docroot.'/adm/help/tex/'. |
Line 267 sub handler {
|
Line 300 sub handler {
|
. '/adm/help/tex/'.$filename.'.tex')) |
. '/adm/help/tex/'.$filename.'.tex')) |
or return HTTP_NOT_FOUND; |
or return HTTP_NOT_FOUND; |
$tex .= join('', <$file>); |
$tex .= join('', <$file>); |
|
$count ++; |
|
if (scalar(@files) > $count) { |
|
$tex .= '\hrulefill'; |
|
} |
} |
} |
|
|
$text = &render($tex, $docroot); |
$text = &render($tex, $docroot); |
Line 274 sub handler {
|
Line 311 sub handler {
|
|
|
$r->send_http_header; |
$r->send_http_header; |
$r->print($start_page); |
$r->print($start_page); |
&servetext($r,$text,$env{'browser.mobile'},$firstfile); |
&servetext($r,$uri,$text,$env{'browser.mobile'},$firstfile); |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
|
|
return OK; |
return OK; |