--- loncom/interface/lonmenu.pm 2003/02/14 21:22:04 1.39 +++ loncom/interface/lonmenu.pm 2003/02/17 17:34:16 1.40 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.39 2003/02/14 21:22:04 www Exp $ +# $Id: lonmenu.pm,v 1.40 2003/02/17 17:34:16 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -41,18 +41,19 @@ use Apache::loncommon; use Apache::File; use vars qw(@desklines $readdesk); -# ======================================================= Make the menu buttons +# ============================= This gets called at the top of the body section sub menubuttons { my $forcereg=shift; my $target =shift; + my $registration=shift; unless ($ENV{'browser.interface'} eq 'textual') { return ''; } my $output='Main Menu
'; + if ($registration) { $output.=&innerregister($forcereg,$target); } return $output."
"; } -# ============================================== Register a URL with the remote - +# ====================================== This gets called in the header section sub registerurl { my $forcereg=shift; @@ -73,35 +74,52 @@ sub registerurl { ''; } if ($Apache::lonxml::registered && !$forcereg) { return ''; } + $result.=&innerregister($forcereg,$target); + return $result; +} + +# =========== This gets called in order to register a URL, both with the Remote +# =========== and in the body of the document + +sub innerregister { + my $forcereg=shift; + my $target = shift; + my $result = ''; + $Apache::lonxml::registered=1; + + my $textual=($ENV{'browser.interface'} eq 'textual'); my $reopen=&Apache::lonmenu::reopenmenu(); + my $newmail=''; if (&Apache::lonmsg::newmail()) { - $newmail='swmenu.setstatus("you have","messages");'; + $newmail=($textual?'You have messages
': + 'swmenu.setstatus("you have","messages");'); } - my $timesync='swmenu.syncclock(1000*'.time.');'; + my $timesync=($textual?'':'swmenu.syncclock(1000*'.time.');'); +# -- This is for URLs that actually can be registered if (($ENV{'REQUEST_URI'}!~/^\/(res\/)*adm\//) || ($forcereg)) { +# -- This applies to homework problems for users with grading privileges my $hwkadd=''; - if ($ENV{'request.filename'}=~/\.(problem|exam|quiz|assess|survey|form)$/) { + if + ($ENV{'request.filename'}=~/\.(problem|exam|quiz|assess|survey|form)$/) { if (&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'})) { - $hwkadd.=(<'.$text.' '.$desc; + return ($nobreak?'':'
'). + ''.$text.' '.$desc; } }