--- loncom/interface/loncommon.pm 2003/02/13 23:02:42 1.81 +++ loncom/interface/loncommon.pm 2003/03/03 13:03:58 1.86 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.81 2003/02/13 23:02:42 albertel Exp $ +# $Id: loncommon.pm,v 1.86 2003/03/03 13:03:58 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -81,6 +81,7 @@ use GDBM_File; use POSIX qw(strftime mktime); use Apache::Constants qw(:common); use Apache::lonmsg(); +use Apache::lonmenu(); my $readit; =pod @@ -1481,8 +1482,10 @@ sub domainlogo { my $domain = &determinedomain(shift); # See if there is a logo if (-e '/home/httpd/html/adm/lonDomLogos/'.$domain.'.gif') { - return ''; + my $lonhttpdPort=$Apache::lonnet::perlvar{'lonhttpdPort'}; + if (!defined($lonhttpdPort)) { $lonhttpdPort='8080'; } + return ''; } elsif(exists($Apache::lonnet::domaindescription{$domain})) { return $Apache::lonnet::domaindescription{$domain}; } else { @@ -1527,6 +1530,8 @@ Inputs: $addentries, extra parameters for the tag. $bodyonly, if defined, only return the tag. $domain, if defined, force a given domain. + $forcereg, if page should register as content page (relevant for + text interface only) Returns: A uniform header for LON-CAPA web pages. If $bodyonly is nonzero, a string containing a tag will be returned. @@ -1540,7 +1545,7 @@ other decorations will be returned. ############################################### sub bodytag { - my ($title,$function,$addentries,$bodyonly,$domain)=@_; + my ($title,$function,$addentries,$bodyonly,$domain,$forcereg)=@_; unless ($function) { $function='student'; if ($ENV{'request.role'}=~/^(cc|in|ta|ep)/) { @@ -1575,6 +1580,8 @@ sub bodytag { # Set messages my $messages=&domainlogo($domain); # Output + my $lonhttpdPort=$Apache::lonnet::perlvar{'lonhttpdPort'}; + if (!defined($lonhttpdPort)) { $lonhttpdPort='8080'; } my $bodytag = < @@ -1582,14 +1589,15 @@ END if ($bodyonly) { return $bodytag; } elsif ($ENV{'browser.interface'} eq 'textual') { - return $bodytag.'

LON-CAPA: '.$title. - '

Main Menu
'; + return $bodytag.&Apache::lonmenu::menubuttons($forcereg,'web', + $forcereg). + '

LON-CAPA: '.$title.'

'; } else { return(< - + $messages @@ -1915,6 +1923,37 @@ sub csv_samples_select_table { $i--; return($i); } + +=pod + +=item check_if_partid_hidden($id,$symb,$udom,$uname) + +Returns either 1 or undef + +1 if the part is to be hidden, undef if it is to be shown + +Arguments are: + +$id the id of the part to be checked +$symb, optional the symb of the resource to check +$udom, optional the domain of the user to check for +$uname, optional the username of the user to check for + +=cut + +sub check_if_partid_hidden { + my ($id,$symb,$udom,$uname) = @_; + my $hiddenparts=&Apache::lonnet::EXT('resource.0.parameter_hiddenparts', + $symb,$udom,$uname); + my @hiddenlist=split(/,/,$hiddenparts); + foreach my $checkid (@hiddenlist) { + if ($checkid =~ /^\s*\Q$id\E\s*$/) { return 1; } + } + return undef; +} + + + 1; __END__;