--- loncom/interface/loncommon.pm 2005/03/18 00:18:40 1.256
+++ loncom/interface/loncommon.pm 2006/03/04 21:32:30 1.305
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.256 2005/03/18 00:18:40 matthew Exp $
+# $Id: loncommon.pm,v 1.305 2006/03/04 21:32:30 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -55,7 +55,7 @@ redundancy from other modules and increa
package Apache::loncommon;
use strict;
-use Apache::lonnet();
+use Apache::lonnet;
use GDBM_File;
use POSIX qw(strftime mktime);
use Apache::Constants qw(:common :http :methods);
@@ -152,19 +152,20 @@ BEGIN {
my $designdir=$Apache::lonnet::perlvar{'lonTabDir'}.'/lonDomColors';
opendir(DIR,$designdir);
while ($filename=readdir(DIR)) {
+ if ($filename!~/\.tab$/) { next; }
my ($domain)=($filename=~/^(\w+)\./);
- {
- my $designfile = $designdir.'/'.$filename;
- if ( open (my $fh,"<$designfile") ) {
- while (<$fh>) {
- next if /^\#/;
- chomp;
- my ($key,$val)=(split(/\=/,$_));
- if ($val) { $designhash{$domain.'.'.$key}=$val; }
- }
- close($fh);
- }
- }
+ {
+ my $designfile = $designdir.'/'.$filename;
+ if ( open (my $fh,"<$designfile") ) {
+ while (<$fh>) {
+ next if /^\#/;
+ chomp;
+ my ($key,$val)=(split(/\=/,$_));
+ if ($val) { $designhash{$domain.'.'.$key}=$val; }
+ }
+ close($fh);
+ }
+ }
}
closedir(DIR);
@@ -311,8 +312,8 @@ END
}
sub lastresurl {
- if ($ENV{'environment.lastresurl'}) {
- return $ENV{'environment.lastresurl'}
+ if ($env{'environment.lastresurl'}) {
+ return $env{'environment.lastresurl'}
} else {
return '/res';
}
@@ -329,9 +330,12 @@ sub storeresurl {
sub studentbrowser_javascript {
unless (
- (($ENV{'request.course.id'}) &&
- (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})))
- || ($ENV{'request.role'}=~/^(au|dc|su)/)
+ (($env{'request.course.id'}) &&
+ (&Apache::lonnet::allowed('srm',$env{'request.course.id'})
+ || &Apache::lonnet::allowed('srm',$env{'request.course.id'}.
+ '/'.$env{'request.course.sec'})
+ ))
+ || ($env{'request.role'}=~/^(au|dc|su)/)
) { return ''; }
return (<<'ENDSTDBRW');
'."\n".
- ''."\n";
+ &Apache::lontexconvert::jsMath_reset();
+ if ($env{'environment.texengine'} eq 'jsMath') {
+ $bodytag.=&Apache::lontexconvert::jsMath_header();
}
my $upperleft='';
if ($bodyonly) {
return $bodytag;
- } elsif ($ENV{'browser.interface'} eq 'textual') {
+ } elsif ($env{'browser.interface'} eq 'textual') {
# Accessibility
return $bodytag.&Apache::lonmenu::menubuttons($forcereg,'web',
$forcereg).
'
LON-CAPA: '.$title.'
';
- } elsif ($ENV{'environment.remote'} eq 'off') {
+ } elsif ($env{'environment.remote'} eq 'off') {
# No Remote
my $roleinfo=(<
- $ENV{'environment.firstname'}
- $ENV{'environment.middlename'}
- $ENV{'environment.lastname'}
- $ENV{'environment.generation'}
+ $env{'environment.firstname'}
+ $env{'environment.middlename'}
+ $env{'environment.lastname'}
+ $env{'environment.generation'}
$role
@@ -2768,9 +2829,9 @@ ENDROLE
$titleinfo = $customtitle;
}
- if ($ENV{'request.state'} eq 'construct') {
+ if ($env{'request.state'} eq 'construct') {
my ($uname,$thisdisfn)=
- ($ENV{'request.filename'} =~ m|^/home/([^/]+)/public_html/(.*)|);
+ ($env{'request.filename'} =~ m|^/home/([^/]+)/public_html/(.*)|);
my $formaction='/priv/'.$uname.'/'.$thisdisfn;
$formaction=~s/\/+/\//g;
unless ($customtitle) { #this is for resources; directories have customtitle, and crumbs and select recent are created in lonpubdir.pm
@@ -2796,13 +2857,21 @@ ENDROLE
}
my $titletable = ''.
- ''.
+ ' |
'.
$titleinfo.' | '.$roleinfo.'
';
- if ($ENV{'request.state'} eq 'construct') {
- $bodytag .= &Apache::lonmenu::menubuttons($forcereg,'web',$forcereg,$titletable);
+ if ($env{'request.state'} eq 'construct') {
+ if ($notopbar) {
+ $bodytag .= $titletable;
+ } else {
+ $bodytag .= &Apache::lonmenu::menubuttons($forcereg,'web',$forcereg,$titletable);
+ }
} else {
- $bodytag .= &Apache::lonmenu::menubuttons($forcereg,'web',$forcereg).
+ if ($notopbar) {
+ $bodytag .= $titletable;
+ } else {
+ $bodytag .= &Apache::lonmenu::menubuttons($forcereg,'web',$forcereg).
$titletable;
+ }
}
return $bodytag;
}
@@ -2817,13 +2886,15 @@ ENDROLE
#
# Extra info if you are the DC
my $dc_info = '';
- if ($ENV{'user.adv'} && exists($ENV{'user.role.dc./'.
- $ENV{'course.'.$ENV{'request.course.id'}.
+ if ($env{'user.adv'} && exists($env{'user.role.dc./'.
+ $env{'course.'.$env{'request.course.id'}.
'.domain'}.'/'})) {
- my $cid = $ENV{'request.course.id'};
- $dc_info.= $cid.' '.$ENV{'course.'.$cid.'.internal.coursecode'};
+ my $cid = $env{'request.course.id'};
+ $dc_info.= $cid.' '.$env{'course.'.$cid.'.internal.coursecode'};
$dc_info = '('.$dc_info.')';
}
+ # Explicit link to get inline menu
+ my $menu='
'.&mt('Switch to Inline Menu Mode').'';
#
return(<
-$titleinfo $dc_info
- |
+$titleinfo $dc_info $menu
+ |
- $ENV{'environment.firstname'}
- $ENV{'environment.middlename'}
- $ENV{'environment.lastname'}
- $ENV{'environment.generation'}
+ $env{'environment.firstname'}
+ $env{'environment.middlename'}
+ $env{'environment.lastname'}
+ $env{'environment.generation'}
|
@@ -2880,10 +2951,7 @@ Returns: A uniform footer for LON-CAPA w
sub endbodytag {
my $endbodytag='