--- loncom/interface/loncommon.pm 2003/01/10 20:02:15 1.75 +++ loncom/interface/loncommon.pm 2003/08/13 20:40:31 1.111 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.75 2003/01/10 20:02:15 www Exp $ +# $Id: loncommon.pm,v 1.111 2003/08/13 20:40:31 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -27,9 +27,7 @@ # # YEAR=2001 # 2/13-12/7 Guy Albertelli -# 12/11,12/12,12/17 Scott Harrison # 12/21 Gerd Kortemeyer -# 12/21 Scott Harrison # 12/25,12/28 Gerd Kortemeyer # YEAR=2002 # 1/4 Gerd Kortemeyer @@ -81,8 +79,9 @@ use strict; use Apache::lonnet(); use GDBM_File; use POSIX qw(strftime mktime); -use Apache::Constants qw(:common); +use Apache::Constants qw(:common :http :methods); use Apache::lonmsg(); +use Apache::lonmenu(); my $readit; =pod @@ -152,8 +151,8 @@ BEGIN { while (<$fh>) { next if /^\#/; chomp; - my ($key,$val)=(split(/\s+/,$_,2)); - $language{$key}=$val; + my ($key,$two,$country,$three,$enc,$val)=(split(/\t/,$_)); + $language{$key}=$val.' - '.$enc; } } } @@ -312,14 +311,15 @@ END } sub studentbrowser_javascript { - unless ($ENV{'request.course.id'}) { return ''; } - unless (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) { - return ''; - } + unless ( + (($ENV{'request.course.id'}) && + (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) + || ($ENV{'request.role'}=~/^(au|dc|su)/) + ) { return ''; } return (<<'ENDSTDBRW'); +ENDSTDBRW +} + +sub selectcourse_link { + my ($form,$unameele,$udomele)=@_; + return "Select Course"; } ############################################################### @@ -520,6 +557,10 @@ sub help_open_topic { my ($topic, $text, $stayOnPage, $width, $height) = @_; $text = "" if (not defined $text); $stayOnPage = 0 if (not defined $stayOnPage); + if ($ENV{'browser.interface'} eq 'textual' || + $ENV{'environment.remote'} eq 'off' ) { + $stayOnPage=1; + } $width = 350 if (not defined $width); $height = 400 if (not defined $height); my $filename = $topic; @@ -540,18 +581,40 @@ sub help_open_topic { # Add the text if ($text ne "") { - $template .= "$text "; + $template .= + "". + "
$text"; } # Add the graphic $template .= <<"ENDTEMPLATE"; -(Help: $topic) + (Help: $topic) ENDTEMPLATE - + if ($text ne '') { $template.='
' }; return $template; } +# This is a quicky function for Latex cheatsheet editing, since it +# appears in at least four places +sub helpLatexCheatsheet { + my $other = shift; + my $addOther = ''; + if ($other) { + $addOther = Apache::loncommon::help_open_topic($other, shift, + undef, undef, 600) . + ''; + } + return '
'. + $addOther . + &Apache::loncommon::help_open_topic("Greek_Symbols",'Greek Symbols', + undef,undef,600) + .''. + &Apache::loncommon::help_open_topic("Other_Symbols",'Other Symbols', + undef,undef,600) + .'
'; +} + =pod =item csv_translate($text) @@ -597,18 +660,48 @@ sub get_domains { =pod -=item select_dom_form($defdom,$name) +=item select_form($defdom,$name,%hash) + +Returns a string containing a \n"; + foreach (sort keys %hash) { + $selectform.="\n"; + } + $selectform.=""; + return $selectform; +} + + +#------------------------------------------- + +=pod + +=item select_dom_form($defdom,$name,$includeempty) Returns a string containing a \n"; foreach (@domains) { $selectdomain.="