--- loncom/interface/lonmenu.pm 2002/06/14 20:02:43 1.23 +++ loncom/interface/lonmenu.pm 2002/08/19 21:14:08 1.26 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.23 2002/06/14 20:02:43 www Exp $ +# $Id: lonmenu.pm,v 1.26 2002/08/19 21:14:08 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -79,6 +79,8 @@ sub clear { return qq(swmenu.clearbut($row,$col);); } +# Switch acts on the javascript that is executed when a button is clicked. +# The javascript is usually similar to "go('/adm/roles')" or "cstrgo(..)". sub switch { my ($uname,$udom,$row,$col,$img,$top,$bot,$act)=@_; $act=~s/\$uname/$uname/g; @@ -127,11 +129,13 @@ sub rawconfig { my $pub=($ENV{'request.state'} eq 'published'); my $con=($ENV{'request.state'} eq 'construct'); my $rol=$ENV{'request.role'}; + my $requested_domain = $ENV{'request.role.domain'}; foreach (@desklines) { my ($row,$col,$pro,$prt,$img,$top,$bot,$act)=split(/\:/,$_); $prt=~s/\$uname/$uname/g; $prt=~s/\$udom/$udom/g; $prt=~s/\$crs/$crs/g; + $prt=~s/\$requested_domain/$requested_domain/g; if ($pro eq 'clear') { $output.=&clear($row,$col); } elsif ($pro eq 'any') { @@ -151,6 +155,10 @@ sub rawconfig { if (&Apache::lonnet::allowed($1,$prt)) { $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act); } + } elsif ($pro eq 'course') { + if ($ENV{'request.course.fn'}) { + $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act); + } } elsif ($pro eq 'author') { if ($author) { if (($prt eq 'rca') && ($ENV{'request.role'}=~/^ca/)) { @@ -174,7 +182,7 @@ sub rawconfig { } } } - $output.="swmenu.clock.setTime(1000*".time.");"; + $output.="swmenu.syncclock(1000*".time.");"; return $output; }