[LON-CAPA-cvs] cvs: loncom /interface lonhelp.pm
www
lon-capa-cvs@mail.lon-capa.org
Wed, 15 Mar 2006 21:55:58 -0000
www Wed Mar 15 16:55:58 2006 EDT
Modified files:
/loncom/interface lonhelp.pm
Log:
WIP on searching help
Index: loncom/interface/lonhelp.pm
diff -u loncom/interface/lonhelp.pm:1.19 loncom/interface/lonhelp.pm:1.20
--- loncom/interface/lonhelp.pm:1.19 Tue Jul 12 11:53:48 2005
+++ loncom/interface/lonhelp.pm Wed Mar 15 16:55:58 2006
@@ -43,21 +43,20 @@
# This sub takes the name of a label in, and converts it to something
# that is a valid anchor name.
-sub processLabelName
-{
+
+sub processLabelName {
my ($name) = @_;
$name =~ tr/a-zA-Z0-9/_/cs;
return $name;
}
-# Serve out the Tex
-sub serveTex
-{
- my ($tex, $r) = @_;
+# Serve out the text
+sub servetext {
+ my ($r,$text) = @_;
my $html=&Apache::lonxml::xmlbegin();
+ my $htmlend=&Apache::lonxml::xmlend();
my $bugs=&Apache::loncommon::help_open_bug('Documentation');
my $header=&mt('LON-CAPA Help');
- my $footer=&mt('About LON-CAPA help and More Help');
$r->print(<<HEADER);
$html
<head>
@@ -69,29 +68,30 @@
<!-- BEGIN -->
HEADER
- $r->print($tex);
+ $r->print($text);
if (&Apache::lonnavmaps::advancedUser()) {
-$r->print(<<FOOTER);
+ my $search=&mt('Search LON-CAPA help');
+ my $about=&mt('About LON-CAPA help and More Help');
+ $r->print(<<FOOTER);
<!-- END -->
- <hr />
- <center><font size="-1"><a href="/adm/help/abouthelp.html">$footer</a></font></center>
+ <hr /><form method="post">
+$search: <input type="text" name="searchterm" size="40" /><br />
+<a href="/adm/help/abouthelp.html">$about</a>
</body>
-</html>
+$htmlend
FOOTER
- } else {
- $r->print(<<FOOTER);
+ }
+ $r->print(<<ENDBODY);
<!-- END -->
</body>
-</html>
-FOOTER
- }
+$htmlend
+ENDBODY
}
# Render takes a tex fragment, transforms it for TtH, and returns the
# HTML equivalent
-sub render
-{
+sub render {
my ($tex, $docroot, $serverroot) = @_;
tie (my %fragmentLabels, 'GDBM_File', $docroot . '/adm/help/fragmentLabels.gdbm', 0, 0);
@@ -109,7 +109,7 @@
};
'\\begin{html}<a href="http://' . $serverroot ."/adm/help/".
substr($fragmentLabels{$1}, 0, -4) .
- '.hlp#' . processLabelName($1) .
+ '.hlp#' . &processLabelName($1) .
'"><img src="http://' . $serverroot . '/adm/help/gif/smallHelp.gif" border="0" /></a>' .
'\\end{html}'
|gxe;
@@ -142,8 +142,7 @@
return $tex;
}
-sub handler
-{
+sub handler {
my $r = shift;
my $docroot = $r->dir_config('lonDocRoot');
@@ -200,9 +199,8 @@
}
$r->send_http_header;
- $tex = render($tex, $docroot, $serverroot);
- serveTex($tex, $r);
-
+ my $text = &render($tex, $docroot, $serverroot);
+ &servetext($r,$text);
return OK;
}