]+)(codebase\=[^\S\>]+)*([^\>]*)\>/$1.($2?$2:' codebase="'.$thisdir.'"').$3.'>'/gei;
+ return $output;
+}
+
+=pod
+
+=item * &get_student_view()
+
+show a snapshot of what student was looking at
+
+=cut
+
sub get_student_view {
- my ($symb,$username,$domain,$courseid,$target) = @_;
- my ($map,$id,$feedurl) = split(/___/,$symb);
- my (%old,%moreenv);
+ my ($symb,$username,$domain,$courseid,$target,$moreenv) = @_;
+ my ($map,$id,$feedurl) = &Apache::lonnet::decode_symb($symb);
+ my (%form);
my @elements=('symb','courseid','domain','username');
foreach my $element (@elements) {
- $old{$element}=$ENV{'form.grade_'.$element};
- $moreenv{'form.grade_'.$element}=eval '$'.$element #'
+ $form{'grade_'.$element}=eval '$'.$element #'
}
- if ($target eq 'tex') {$moreenv{'form.grade_target'} = 'tex';}
- &Apache::lonnet::appenv(%moreenv);
- my $userview=&Apache::lonnet::ssi('/res/'.$feedurl);
- &Apache::lonnet::delenv('form.grade_');
- foreach my $element (@elements) {
- $ENV{'form.grade_'.$element}=$old{$element};
+ if (defined($moreenv)) {
+ %form=(%form,%{$moreenv});
}
+ if (defined($target)) { $form{'grade_target'} = $target; }
+ $feedurl=&Apache::lonnet::clutter($feedurl);
+ my ($userview,$response)=&Apache::lonnet::ssi_body($feedurl,%form);
$userview=~s/\]*\>//gi;
$userview=~s/\<\/body\>//gi;
$userview=~s/\//gi;
@@ -1176,77 +3461,579 @@ sub get_student_view {
$userview=~s/\//gi;
$userview=~s/\<\/head\>//gi;
$userview=~s/action\s*\=/would_be_action\=/gi;
- return $userview;
+ $userview=&relative_to_absolute($feedurl,$userview);
+ if (wantarray) {
+ return ($userview,$response);
+ } else {
+ return $userview;
+ }
}
+sub get_student_view_with_retries {
+ my ($symb,$retries,$username,$domain,$courseid,$target,$moreenv) = @_;
+
+ my $ok = 0; # True if we got a good response.
+ my $content;
+ my $response;
+
+ # Try to get the student_view done. within the retries count:
+
+ do {
+ ($content, $response) = &get_student_view($symb,$username,$domain,$courseid,$target,$moreenv);
+ $ok = $response->is_success;
+ if (!$ok) {
+ &Apache::lonnet::logthis("Failed get_student_view_with_retries on $symb: ".$response->is_success.', '.$response->code.', '.$response->message);
+ }
+ $retries--;
+ } while (!$ok && ($retries > 0));
+
+ if (!$ok) {
+ $content = ''; # On error return an empty content.
+ }
+ if (wantarray) {
+ return ($content, $response);
+ } else {
+ return $content;
+ }
+}
+
+=pod
+
+=item * &get_student_answers()
+
+show a snapshot of how student was answering problem
+
+=cut
+
sub get_student_answers {
- my ($symb,$username,$domain,$courseid) = @_;
- my ($map,$id,$feedurl) = split(/___/,$symb);
- my (%old,%moreenv);
+ my ($symb,$username,$domain,$courseid,%form) = @_;
+ my ($map,$id,$feedurl) = &Apache::lonnet::decode_symb($symb);
+ my (%moreenv);
my @elements=('symb','courseid','domain','username');
foreach my $element (@elements) {
- $old{$element}=$ENV{'form.grade_'.$element};
- $moreenv{'form.grade_'.$element}=eval '$'.$element #'
- }
- $moreenv{'form.grade_target'}='answer';
- &Apache::lonnet::appenv(%moreenv);
- my $userview=&Apache::lonnet::ssi('/res/'.$feedurl);
- &Apache::lonnet::delenv('form.grade_');
- foreach my $element (@elements) {
- $ENV{'form.grade_'.$element}=$old{$element};
+ $moreenv{'grade_'.$element}=eval '$'.$element #'
}
+ $moreenv{'grade_target'}='answer';
+ %moreenv=(%form,%moreenv);
+ $feedurl = &Apache::lonnet::clutter($feedurl);
+ my $userview=&Apache::lonnet::ssi($feedurl,%moreenv);
return $userview;
}
+=pod
+
+=item * &submlink()
+
+Inputs: $text $uname $udom $symb $target
+
+Returns: A link to grades.pm such as to see the SUBM view of a student
+
+=cut
+
+###############################################
+sub submlink {
+ my ($text,$uname,$udom,$symb,$target)=@_;
+ if (!($uname && $udom)) {
+ (my $cursymb, my $courseid,$udom,$uname)=
+ &Apache::lonnet::whichuser($symb);
+ if (!$symb) { $symb=$cursymb; }
+ }
+ if (!$symb) { $symb=&Apache::lonnet::symbread(); }
+ $symb=&escape($symb);
+ if ($target) { $target="target=\"$target\""; }
+ return ''.$text.' ';
+}
+##############################################
+
+=pod
+
+=item * &pgrdlink()
+
+Inputs: $text $uname $udom $symb $target
+
+Returns: A link to grades.pm such as to see the PGRD view of a student
+
+=cut
+
+###############################################
+sub pgrdlink {
+ my $link=&submlink(@_);
+ $link=~s/(&command=submission)/$1&showgrading=yes/;
+ return $link;
+}
+##############################################
+
+=pod
+
+=item * &pprmlink()
+
+Inputs: $text $uname $udom $symb $target
+
+Returns: A link to parmset.pm such as to see the PPRM view of a
+student and a specific resource
+
+=cut
+
+###############################################
+sub pprmlink {
+ my ($text,$uname,$udom,$symb,$target)=@_;
+ if (!($uname && $udom)) {
+ (my $cursymb, my $courseid,$udom,$uname)=
+ &Apache::lonnet::whichuser($symb);
+ if (!$symb) { $symb=$cursymb; }
+ }
+ if (!$symb) { $symb=&Apache::lonnet::symbread(); }
+ $symb=&escape($symb);
+ if ($target) { $target="target=\"$target\""; }
+ return ''.$text.' ';
+}
+##############################################
+
+=pod
+
+=back
+
+=cut
+
###############################################
sub timehash {
- my @ltime=localtime(shift);
- return ( 'seconds' => $ltime[0],
- 'minutes' => $ltime[1],
- 'hours' => $ltime[2],
- 'day' => $ltime[3],
- 'month' => $ltime[4]+1,
- 'year' => $ltime[5]+1900,
- 'weekday' => $ltime[6],
- 'dayyear' => $ltime[7]+1,
- 'dlsav' => $ltime[8] );
+ my ($thistime) = @_;
+ my $timezone = &Apache::lonlocal::gettimezone();
+ my $dt = DateTime->from_epoch(epoch => $thistime)
+ ->set_time_zone($timezone);
+ my $wday = $dt->day_of_week();
+ if ($wday == 7) { $wday = 0; }
+ return ( 'second' => $dt->second(),
+ 'minute' => $dt->minute(),
+ 'hour' => $dt->hour(),
+ 'day' => $dt->day_of_month(),
+ 'month' => $dt->month(),
+ 'year' => $dt->year(),
+ 'weekday' => $wday,
+ 'dayyear' => $dt->day_of_year(),
+ 'dlsav' => $dt->is_dst() );
+}
+
+sub utc_string {
+ my ($date)=@_;
+ return strftime("%Y%m%dT%H%M%SZ",gmtime($date));
}
sub maketime {
my %th=@_;
+ my ($epoch_time,$timezone,$dt);
+ $timezone = &Apache::lonlocal::gettimezone();
+ eval {
+ $dt = DateTime->new( year => $th{'year'},
+ month => $th{'month'},
+ day => $th{'day'},
+ hour => $th{'hour'},
+ minute => $th{'minute'},
+ second => $th{'second'},
+ time_zone => $timezone,
+ );
+ };
+ if (!$@) {
+ $epoch_time = $dt->epoch;
+ if ($epoch_time) {
+ return $epoch_time;
+ }
+ }
return POSIX::mktime(
($th{'seconds'},$th{'minutes'},$th{'hours'},
- $th{'day'},$th{'month'}-1,$th{'year'}-1900,0,0,$th{'dlsav'}));
+ $th{'day'},$th{'month'}-1,$th{'year'}-1900,0,0,-1));
}
+#########################################
sub findallcourses {
- my %courses=();
+ my ($roles,$uname,$udom) = @_;
+ my %roles;
+ if (ref($roles)) { %roles = map { $_ => 1 } @{$roles}; }
+ my %courses;
my $now=time;
- foreach (keys %ENV) {
- if ($_=~/^user\.role\.\w+\.\/(\w+)\/(\w+)/) {
- my ($starttime,$endtime)=$ENV{$_};
- my $active=1;
- if ($starttime) {
- if ($now<$starttime) { $active=0; }
+ if (!defined($uname)) {
+ $uname = $env{'user.name'};
+ }
+ if (!defined($udom)) {
+ $udom = $env{'user.domain'};
+ }
+ if (($uname ne $env{'user.name'}) || ($udom ne $env{'user.domain'})) {
+ my %roleshash = &Apache::lonnet::dump('roles',$udom,$uname);
+ if (!%roles) {
+ %roles = (
+ cc => 1,
+ in => 1,
+ ep => 1,
+ ta => 1,
+ cr => 1,
+ st => 1,
+ );
+ }
+ foreach my $entry (keys(%roleshash)) {
+ my ($trole,$tend,$tstart) = split(/_/,$roleshash{$entry});
+ if ($trole =~ /^cr/) {
+ next if (!exists($roles{$trole}) && !exists($roles{'cr'}));
+ } else {
+ next if (!exists($roles{$trole}));
+ }
+ if ($tend) {
+ next if ($tend < $now);
+ }
+ if ($tstart) {
+ next if ($tstart > $now);
+ }
+ my ($cdom,$cnum,$sec,$cnumpart,$secpart,$role,$realsec);
+ (undef,$cdom,$cnumpart,$secpart) = split(/\//,$entry);
+ if ($secpart eq '') {
+ ($cnum,$role) = split(/_/,$cnumpart);
+ $sec = 'none';
+ $realsec = '';
+ } else {
+ $cnum = $cnumpart;
+ ($sec,$role) = split(/_/,$secpart);
+ $realsec = $sec;
+ }
+ $courses{$cdom.'_'.$cnum}{$sec} = $trole.'/'.$cdom.'/'.$cnum.'/'.$realsec;
+ }
+ } else {
+ foreach my $key (keys(%env)) {
+ if ( $key=~m{^user\.role\.(\w+)\./($match_domain)/($match_courseid)/?(\w*)$} ||
+ $key=~m{^user\.role\.(cr/$match_domain/$match_username/\w+)\./($match_domain)/($match_courseid)/?(\w*)$}) {
+ my ($role,$cdom,$cnum,$sec) = ($1,$2,$3,$4);
+ next if ($role eq 'ca' || $role eq 'aa');
+ next if (%roles && !exists($roles{$role}));
+ my ($starttime,$endtime)=split(/\./,$env{$key});
+ my $active=1;
+ if ($starttime) {
+ if ($now<$starttime) { $active=0; }
+ }
+ if ($endtime) {
+ if ($now>$endtime) { $active=0; }
+ }
+ if ($active) {
+ if ($sec eq '') {
+ $sec = 'none';
+ }
+ $courses{$cdom.'_'.$cnum}{$sec} =
+ $role.'/'.$cdom.'/'.$cnum.'/'.$sec;
+ }
+ }
+ }
+ }
+ return %courses;
+}
+
+###############################################
+
+sub blockcheck {
+ my ($setters,$activity,$uname,$udom) = @_;
+
+ if (!defined($udom)) {
+ $udom = $env{'user.domain'};
+ }
+ if (!defined($uname)) {
+ $uname = $env{'user.name'};
+ }
+
+ # If uname and udom are for a course, check for blocks in the course.
+
+ if (&Apache::lonnet::is_course($udom,$uname)) {
+ my %records = &Apache::lonnet::dump('comm_block',$udom,$uname);
+ my ($startblock,$endblock)=&get_blocks($setters,$activity,$udom,$uname);
+ return ($startblock,$endblock);
+ }
+
+ my $startblock = 0;
+ my $endblock = 0;
+ my %live_courses = &findallcourses(undef,$uname,$udom);
+
+ # If uname is for a user, and activity is course-specific, i.e.,
+ # boards, chat or groups, check for blocking in current course only.
+
+ if (($activity eq 'boards' || $activity eq 'chat' ||
+ $activity eq 'groups') && ($env{'request.course.id'})) {
+ foreach my $key (keys(%live_courses)) {
+ if ($key ne $env{'request.course.id'}) {
+ delete($live_courses{$key});
}
- if ($endtime) {
- if ($now>$endtime) { $active=0; }
+ }
+ }
+
+ my $otheruser = 0;
+ my %own_courses;
+ if ((($uname ne $env{'user.name'})) || ($udom ne $env{'user.domain'})) {
+ # Resource belongs to user other than current user.
+ $otheruser = 1;
+ # Gather courses for current user
+ %own_courses =
+ &findallcourses(undef,$env{'user.name'},$env{'user.domain'});
+ }
+
+ # Gather active course roles - course coordinator, instructor,
+ # exam proctor, ta, student, or custom role.
+
+ foreach my $course (keys(%live_courses)) {
+ my ($cdom,$cnum);
+ if ((defined($env{'course.'.$course.'.domain'})) && (defined($env{'course.'.$course.'.num'}))) {
+ $cdom = $env{'course.'.$course.'.domain'};
+ $cnum = $env{'course.'.$course.'.num'};
+ } else {
+ ($cdom,$cnum) = split(/_/,$course);
+ }
+ my $no_ownblock = 0;
+ my $no_userblock = 0;
+ if ($otheruser && $activity ne 'com') {
+ # Check if current user has 'evb' priv for this
+ if (defined($own_courses{$course})) {
+ foreach my $sec (keys(%{$own_courses{$course}})) {
+ my $checkrole = 'cm./'.$cdom.'/'.$cnum;
+ if ($sec ne 'none') {
+ $checkrole .= '/'.$sec;
+ }
+ if (&Apache::lonnet::allowed('evb',undef,undef,$checkrole)) {
+ $no_ownblock = 1;
+ last;
+ }
+ }
}
- if ($active) { $courses{$1.'_'.$2}=1; }
+ # if they have 'evb' priv and are currently not playing student
+ next if (($no_ownblock) &&
+ ($env{'request.role'} !~ m{^st\./$cdom/$cnum}));
+ }
+ foreach my $sec (keys(%{$live_courses{$course}})) {
+ my $checkrole = 'cm./'.$cdom.'/'.$cnum;
+ if ($sec ne 'none') {
+ $checkrole .= '/'.$sec;
+ }
+ if ($otheruser) {
+ # Resource belongs to user other than current user.
+ # Assemble privs for that user, and check for 'evb' priv.
+ my ($trole,$tdom,$tnum,$tsec);
+ my $entry = $live_courses{$course}{$sec};
+ if ($entry =~ /^cr/) {
+ ($trole,$tdom,$tnum,$tsec) =
+ ($entry =~ m|^(cr/$match_domain/$match_username/\w+)\./($match_domain)/($match_username)/?(\w*)$|);
+ } else {
+ ($trole,$tdom,$tnum,$tsec) = split(/\//,$entry);
+ }
+ my ($spec,$area,$trest,%allroles,%userroles);
+ $area = '/'.$tdom.'/'.$tnum;
+ $trest = $tnum;
+ if ($tsec ne '') {
+ $area .= '/'.$tsec;
+ $trest .= '/'.$tsec;
+ }
+ $spec = $trole.'.'.$area;
+ if ($trole =~ /^cr/) {
+ &Apache::lonnet::custom_roleprivs(\%allroles,$trole,
+ $tdom,$spec,$trest,$area);
+ } else {
+ &Apache::lonnet::standard_roleprivs(\%allroles,$trole,
+ $tdom,$spec,$trest,$area);
+ }
+ my ($author,$adv) = &Apache::lonnet::set_userprivs(\%userroles,\%allroles);
+ if ($userroles{'user.priv.'.$checkrole} =~ /evb\&([^\:]*)/) {
+ if ($1) {
+ $no_userblock = 1;
+ last;
+ }
+ }
+ } else {
+ # Resource belongs to current user
+ # Check for 'evb' priv via lonnet::allowed().
+ if (&Apache::lonnet::allowed('evb',undef,undef,$checkrole)) {
+ $no_ownblock = 1;
+ last;
+ }
+ }
+ }
+ # if they have the evb priv and are currently not playing student
+ next if (($no_ownblock) &&
+ ($env{'request.role'} !~ m{^st\./\Q$cdom\E/\Q$cnum\E}));
+ next if ($no_userblock);
+
+ # Retrieve blocking times and identity of locker for course
+ # of specified user, unless user has 'evb' privilege.
+
+ my ($start,$end)=&get_blocks($setters,$activity,$cdom,$cnum);
+ if (($start != 0) &&
+ (($startblock == 0) || ($startblock > $start))) {
+ $startblock = $start;
+ }
+ if (($end != 0) &&
+ (($endblock == 0) || ($endblock < $end))) {
+ $endblock = $end;
}
}
- return keys %courses;
+ return ($startblock,$endblock);
+}
+
+sub get_blocks {
+ my ($setters,$activity,$cdom,$cnum) = @_;
+ my $startblock = 0;
+ my $endblock = 0;
+ my $course = $cdom.'_'.$cnum;
+ $setters->{$course} = {};
+ $setters->{$course}{'staff'} = [];
+ $setters->{$course}{'times'} = [];
+ my %records = &Apache::lonnet::dump('comm_block',$cdom,$cnum);
+ foreach my $record (keys(%records)) {
+ my ($start,$end) = ($record =~ m/^(\d+)____(\d+)$/);
+ if ($start <= time && $end >= time) {
+ my ($staff_name,$staff_dom,$title,$blocks) =
+ &parse_block_record($records{$record});
+ if ($blocks->{$activity} eq 'on') {
+ push(@{$$setters{$course}{'staff'}},[$staff_name,$staff_dom]);
+ push(@{$$setters{$course}{'times'}}, [$start,$end]);
+ if ( ($startblock == 0) || ($startblock > $start) ) {
+ $startblock = $start;
+ }
+ if ( ($endblock == 0) || ($endblock < $end) ) {
+ $endblock = $end;
+ }
+ }
+ }
+ }
+ return ($startblock,$endblock);
+}
+
+sub parse_block_record {
+ my ($record) = @_;
+ my ($setuname,$setudom,$title,$blocks);
+ if (ref($record) eq 'HASH') {
+ ($setuname,$setudom) = split(/:/,$record->{'setter'});
+ $title = &unescape($record->{'event'});
+ $blocks = $record->{'blocks'};
+ } else {
+ my @data = split(/:/,$record,3);
+ if (scalar(@data) eq 2) {
+ $title = $data[1];
+ ($setuname,$setudom) = split(/@/,$data[0]);
+ } else {
+ ($setuname,$setudom,$title) = @data;
+ }
+ $blocks = { 'com' => 'on' };
+ }
+ return ($setuname,$setudom,$title,$blocks);
+}
+
+sub blocking_status {
+ my ($activity,$uname,$udom) = @_;
+ my %setters;
+
+ # check for active blocking
+ my ($startblock,$endblock)=&blockcheck(\%setters,$activity,$uname,$udom);
+
+ my $blocked = $startblock && $endblock ? 1 : 0;
+
+ # caller just wants to know whether a block is active
+ if (!wantarray) { return $blocked; }
+
+ # build a link to a popup window containing the details
+ my $querystring = "?activity=$activity";
+ # $uname and $udom decide whose portfolio the user is trying to look at
+ $querystring .= "&udom=$udom" if $udom;
+ $querystring .= "&uname=$uname" if $uname;
+
+ my $output .= <<'END_MYBLOCK';
+ function openWindow(url, wdwName, w, h, toolbar,scrollbar) {
+ var options = "width=" + w + ",height=" + h + ",";
+ options += "resizable=yes,scrollbars="+scrollbar+",status=no,";
+ options += "menubar=no,toolbar="+toolbar+",location=no,directories=no";
+ var newWin = window.open(url, wdwName, options);
+ newWin.focus();
+ }
+END_MYBLOCK
+
+ $output = Apache::lonhtmlcommon::scripttag($output);
+
+ my $popupUrl = "/adm/blockingstatus/$querystring";
+ my $text = mt('Communication Blocked');
+
+ $output .= <<"END_BLOCK";
+
+
+END_BLOCK
+
+ return ($blocked, $output);
}
###############################################
+
+sub check_ip_acc {
+ my ($acc)=@_;
+ &Apache::lonxml::debug("acc is $acc");
+ if (!defined($acc) || $acc =~ /^\s*$/ || $acc =~/^\s*no\s*$/i) {
+ return 1;
+ }
+ my $allowed=0;
+ my $ip=$env{'request.host'} || $ENV{'REMOTE_ADDR'};
+
+ my $name;
+ foreach my $pattern (split(',',$acc)) {
+ $pattern =~ s/^\s*//;
+ $pattern =~ s/\s*$//;
+ if ($pattern =~ /\*$/) {
+ #35.8.*
+ $pattern=~s/\*//;
+ if ($ip =~ /^\Q$pattern\E/) { $allowed=1; }
+ } elsif ($pattern =~ /(\d+\.\d+\.\d+)\.\[(\d+)-(\d+)\]$/) {
+ #35.8.3.[34-56]
+ my $low=$2;
+ my $high=$3;
+ $pattern=$1;
+ if ($ip =~ /^\Q$pattern\E/) {
+ my $last=(split(/\./,$ip))[3];
+ if ($last <=$high && $last >=$low) { $allowed=1; }
+ }
+ } elsif ($pattern =~ /^\*/) {
+ #*.msu.edu
+ $pattern=~s/\*//;
+ if (!defined($name)) {
+ use Socket;
+ my $netaddr=inet_aton($ip);
+ ($name)=gethostbyaddr($netaddr,AF_INET);
+ }
+ if ($name =~ /\Q$pattern\E$/i) { $allowed=1; }
+ } elsif ($pattern =~ /\d+\.\d+\.\d+\.\d+/) {
+ #127.0.0.1
+ if ($ip =~ /^\Q$pattern\E/) { $allowed=1; }
+ } else {
+ #some.name.com
+ if (!defined($name)) {
+ use Socket;
+ my $netaddr=inet_aton($ip);
+ ($name)=gethostbyaddr($netaddr,AF_INET);
+ }
+ if ($name =~ /\Q$pattern\E$/i) { $allowed=1; }
+ }
+ if ($allowed) { last; }
+ }
+ return $allowed;
+}
+
###############################################
=pod
-=item &determinedomain()
+=head1 Domain Template Functions
+
+=over 4
+
+=item * &determinedomain()
Inputs: $domain (usually will be undef)
@@ -1257,20 +4044,114 @@ Returns: Determines which domain should
###############################################
sub determinedomain {
my $domain=shift;
- if (! $domain) {
+ if (! $domain) {
# Determine domain if we have not been given one
- $domain = $Apache::lonnet::perlvar{'lonDefDomain'};
- if ($ENV{'user.domain'}) { $domain=$ENV{'user.domain'}; }
- if ($ENV{'request.role.domain'}) {
- $domain=$ENV{'request.role.domain'};
+ $domain = &Apache::lonnet::default_login_domain();
+ if ($env{'user.domain'}) { $domain=$env{'user.domain'}; }
+ if ($env{'request.role.domain'}) {
+ $domain=$env{'request.role.domain'};
}
}
return $domain;
}
###############################################
+
+sub devalidate_domconfig_cache {
+ my ($udom)=@_;
+ &Apache::lonnet::devalidate_cache_new('domainconfig',$udom);
+}
+
+# ---------------------- Get domain configuration for a domain
+sub get_domainconf {
+ my ($udom) = @_;
+ my $cachetime=1800;
+ my ($result,$cached)=&Apache::lonnet::is_cached_new('domainconfig',$udom);
+ if (defined($cached)) { return %{$result}; }
+
+ my %domconfig = &Apache::lonnet::get_dom('configuration',
+ ['login','rolecolors'],$udom);
+ my (%designhash,%legacy);
+ if (keys(%domconfig) > 0) {
+ if (ref($domconfig{'login'}) eq 'HASH') {
+ if (keys(%{$domconfig{'login'}})) {
+ foreach my $key (keys(%{$domconfig{'login'}})) {
+ if (ref($domconfig{'login'}{$key}) eq 'HASH') {
+ foreach my $img (keys(%{$domconfig{'login'}{$key}})) {
+ $designhash{$udom.'.login.'.$key.'_'.$img} =
+ $domconfig{'login'}{$key}{$img};
+ }
+ } else {
+ $designhash{$udom.'.login.'.$key}=$domconfig{'login'}{$key};
+ }
+ }
+ } else {
+ $legacy{'login'} = 1;
+ }
+ } else {
+ $legacy{'login'} = 1;
+ }
+ if (ref($domconfig{'rolecolors'}) eq 'HASH') {
+ if (keys(%{$domconfig{'rolecolors'}})) {
+ foreach my $role (keys(%{$domconfig{'rolecolors'}})) {
+ if (ref($domconfig{'rolecolors'}{$role}) eq 'HASH') {
+ foreach my $item (keys(%{$domconfig{'rolecolors'}{$role}})) {
+ $designhash{$udom.'.'.$role.'.'.$item}=$domconfig{'rolecolors'}{$role}{$item};
+ }
+ }
+ }
+ } else {
+ $legacy{'rolecolors'} = 1;
+ }
+ } else {
+ $legacy{'rolecolors'} = 1;
+ }
+ if (keys(%legacy) > 0) {
+ my %legacyhash = &get_legacy_domconf($udom);
+ foreach my $item (keys(%legacyhash)) {
+ if ($item =~ /^\Q$udom\E\.login/) {
+ if ($legacy{'login'}) {
+ $designhash{$item} = $legacyhash{$item};
+ }
+ } else {
+ if ($legacy{'rolecolors'}) {
+ $designhash{$item} = $legacyhash{$item};
+ }
+ }
+ }
+ }
+ } else {
+ %designhash = &get_legacy_domconf($udom);
+ }
+ &Apache::lonnet::do_cache_new('domainconfig',$udom,\%designhash,
+ $cachetime);
+ return %designhash;
+}
+
+sub get_legacy_domconf {
+ my ($udom) = @_;
+ my %legacyhash;
+ my $designdir=$Apache::lonnet::perlvar{'lonTabDir'}.'/lonDomColors';
+ my $designfile = $designdir.'/'.$udom.'.tab';
+ if (-e $designfile) {
+ if ( open (my $fh,"<$designfile") ) {
+ while (my $line = <$fh>) {
+ next if ($line =~ /^\#/);
+ chomp($line);
+ my ($key,$val)=(split(/\=/,$line));
+ if ($val) { $legacyhash{$udom.'.'.$key}=$val; }
+ }
+ close($fh);
+ }
+ }
+ if (-e '/home/httpd/html/adm/lonDomLogos/'.$udom.'.gif') {
+ $legacyhash{$udom.'.login.domlogo'} = "/adm/lonDomLogos/$udom.gif";
+ }
+ return %legacyhash;
+}
+
=pod
-=item &domainlogo()
+=item * &domainlogo()
Inputs: $domain (usually will be undef)
@@ -1278,14 +4159,24 @@ Returns: A link to a domain logo, if the
If the domain logo does not exist, a description of the domain.
=cut
+
###############################################
sub domainlogo {
- my $domain = &determinedomain(shift);
- # See if there is a logo
- if (-e '/home/httpd/html/adm/lonDomLogos/'.$domain.'.gif') {
- return ' ';
- } elsif(exists($Apache::lonnet::domaindescription{$domain})) {
- return $Apache::lonnet::domaindescription{$domain};
+ my $domain = &determinedomain(shift);
+ my %designhash = &get_domainconf($domain);
+ # See if there is a logo
+ if ($designhash{$domain.'.login.domlogo'} ne '') {
+ my $imgsrc = $designhash{$domain.'.login.domlogo'};
+ if ($imgsrc =~ m{^/(adm|res)/}) {
+ if ($imgsrc =~ m{^/res/}) {
+ my $local_name = &Apache::lonnet::filelocation('',$imgsrc);
+ &Apache::lonnet::repcopy($local_name);
+ }
+ $imgsrc = &lonhttpdurl($imgsrc);
+ }
+ return ' ';
+ } elsif (defined(&Apache::lonnet::domain($domain,'description'))) {
+ return &Apache::lonnet::domain($domain,'description');
} else {
return '';
}
@@ -1294,22 +4185,130 @@ sub domainlogo {
=pod
-=item &designparm()
+=item * &designparm()
Inputs: $which parameter; $domain (usually will be undef)
Returns: value of designparamter $which
=cut
+
+
##############################################
sub designparm {
my ($which,$domain)=@_;
+ if (exists($env{'environment.color.'.$which})) {
+ return $env{'environment.color.'.$which};
+ }
$domain=&determinedomain($domain);
- if ($designhash{$domain.'.'.$which}) {
- return $designhash{$domain.'.'.$which};
+ my %domdesign = &get_domainconf($domain);
+ my $output;
+ if ($domdesign{$domain.'.'.$which} ne '') {
+ $output = $domdesign{$domain.'.'.$which};
+ } else {
+ $output = $defaultdesign{$which};
+ }
+ if (($which =~ /^(student|coordinator|author|admin)\.img$/) ||
+ ($which =~ /login\.(img|logo|domlogo|login)/)) {
+ if ($output =~ m{^/(adm|res)/}) {
+ if ($output =~ m{^/res/}) {
+ my $local_name = &Apache::lonnet::filelocation('',$output);
+ &Apache::lonnet::repcopy($local_name);
+ }
+ $output = &lonhttpdurl($output);
+ }
+ }
+ return $output;
+}
+
+##############################################
+=pod
+
+=item * &authorspace()
+
+Inputs: ./.
+
+Returns: Path to the Construction Space of the current user's
+ accessed author space
+ The author space will be that of the current user
+ when accessing the own author space
+ and that of the co-author/assistent co-author
+ when accessing the co-author's/assistent co-author's
+ space
+
+=cut
+
+sub authorspace {
+ my $caname = '';
+ if ($env{'request.role'} =~ /^ca|^aa/) {
+ (undef,$caname) =
+ ($env{'request.role'}=~/($match_domain)\/($match_username)$/);
} else {
- return $designhash{'default.'.$which};
+ $caname = $env{'user.name'};
}
+ return '/priv/'.$caname.'/';
+}
+
+##############################################
+=pod
+
+=item * &head_subbox()
+
+Inputs: $content (contains HTML code with page functions, etc.)
+
+Returns: HTML div with $content
+ To be included in page header
+
+=cut
+
+sub head_subbox {
+ my ($content)=@_;
+ my $output =
+ ''
+ .$content
+ .'
'
+}
+
+##############################################
+=pod
+
+=item * &CSTR_pageheader()
+
+Inputs: ./.
+
+Returns: HTML div with CSTR path and recent box
+ To be included on Construction Space pages
+
+=cut
+
+sub CSTR_pageheader {
+ # this is for resources; directories have customtitle, and crumbs
+ # and select recent are created in lonpubdir.pm
+ my ($uname,$thisdisfn)=
+ ($env{'request.filename'} =~ m|^/home/([^/]+)/public_html/(.*)|);
+ my $formaction='/priv/'.$uname.'/'.$thisdisfn;
+ $formaction=~s/\/+/\//g;
+
+ my $parentpath = '';
+ my $lastitem = '';
+ if ($thisdisfn =~ m-(.+/)([^/]*)$-) {
+ $parentpath = $1;
+ $lastitem = $2;
+ } else {
+ $lastitem = $thisdisfn;
+ }
+ return
+ ''
+ .&Apache::loncommon::help_open_menu('','',3,'Authoring') #FIXME: Broken? Where is it?
+ .''.&mt('Construction Space:').' '
+ .''
+ .&Apache::lonmenu::constspaceform()
+ .'
';
}
###############################################
@@ -1317,17 +4316,48 @@ sub designparm {
=pod
-=item &bodytag()
+=back
+
+=head1 HTML Helpers
+
+=over 4
+
+=item * &bodytag()
Returns a uniform header for LON-CAPA web pages.
Inputs:
- $title, A title to be displayed on the page.
- $function, the current role (can be undef).
- $addentries, extra parameters for the tag.
- $bodyonly, if defined, only return the tag.
- $domain, if defined, force a given domain.
+=over 4
+
+=item * $title, A title to be displayed on the page.
+
+=item * $function, the current role (can be undef).
+
+=item * $addentries, extra parameters for the tag.
+
+=item * $bodyonly, if defined, only return the tag.
+
+=item * $domain, if defined, force a given domain.
+
+=item * $forcereg, if page should register as content page (relevant for
+ text interface only)
+
+=item * $no_nav_bar, if true, keep the 'what is this' info but remove the
+ navigational links
+
+=item * $bgcolor, used to override the bgcolor on a webpage to a specific value
+
+=item * $no_inline_link, if true and in remote mode, don't show the
+ 'Switch To Inline Menu' link
+
+=item * $args, optional argument valid values are
+ no_auto_mt_title -> prevents &mt()ing the title arg
+ inherit_jsmath -> when creating popup window in a page,
+ should it have jsmath forced on by the
+ current page
+
+=back
Returns: A uniform header for LON-CAPA web pages.
If $bodyonly is nonzero, a string containing a tag will be returned.
@@ -1336,173 +4366,4065 @@ other decorations will be returned.
=cut
-###############################################
+sub bodytag {
+ my ($title,$function,$addentries,$bodyonly,$domain,$forcereg,
+ $no_nav_bar,$bgcolor,$no_inline_link,$args)=@_;
+ if (!$args->{'no_auto_mt_title'}) { $title = &mt($title); }
-###############################################
-sub bodytag {
- my ($title,$function,$addentries,$bodyonly,$domain)=@_;
- unless ($function) {
- $function='student';
- if ($ENV{'request.role'}=~/^(cc|in|ta|ep)/) {
- $function='coordinator';
- }
- if ($ENV{'request.role'}=~/^(su|dc|ad|li)/) {
- $function='admin';
- }
- if (($ENV{'request.role'}=~/^(au|ca)/) ||
- ($ENV{'REQUEST_URI'}=~/^(\/priv|\~)/)) {
- $function='author';
- }
- }
- my $img=&designparm($function.'.img',$domain);
- my $pgbg=&designparm($function.'.pgbg',$domain);
- my $tabbg=&designparm($function.'.tabbg',$domain);
- my $font=&designparm($function.'.font',$domain);
- my $link=&designparm($function.'.link',$domain);
- my $alink=&designparm($function.'.alink',$domain);
- my $vlink=&designparm($function.'.vlink',$domain);
- my $sidebg=&designparm($function.'.sidebg',$domain);
+ $function = &get_users_function() if (!$function);
+ my $img = &designparm($function.'.img',$domain);
+ my $font = &designparm($function.'.font',$domain);
+ my $pgbg = $bgcolor || &designparm($function.'.pgbg',$domain);
+
+ my %design = ( 'style' => 'margin-top: 0',
+ 'bgcolor' => $pgbg,
+ 'text' => $font,
+ 'alink' => &designparm($function.'.alink',$domain),
+ 'vlink' => &designparm($function.'.vlink',$domain),
+ 'link' => &designparm($function.'.link',$domain),);
+ @design{keys(%$addentries)} = @$addentries{keys(%$addentries)};
# role and realm
- my ($role,$realm)
- =&Apache::lonnet::plaintext((split(/\./,$ENV{'request.role'}))[0]);
+ my ($role,$realm) = split(/\./,$env{'request.role'},2);
+ if ($role eq 'ca') {
+ my ($rdom,$rname) = ($realm =~ m{^/($match_domain)/($match_username)$});
+ $realm = &plainname($rname,$rdom);
+ }
# realm
- if ($ENV{'request.course.id'}) {
- $realm=
- $ENV{'course.'.$ENV{'request.course.id'}.'.description'};
+ if ($env{'request.course.id'}) {
+ if ($env{'request.role'} !~ /^cr/) {
+ $role = &Apache::lonnet::plaintext($role,&course_type());
+ }
+ $realm = $env{'course.'.$env{'request.course.id'}.'.description'};
+ } else {
+ $role = &Apache::lonnet::plaintext($role);
}
- unless ($realm) { $realm=' '; }
+
+ if (!$realm) { $realm=' '; }
# Set messages
my $messages=&domainlogo($domain);
-# Output
- my $bodytag = <
-END
+
+ my $extra_body_attr = &make_attr_string($forcereg,\%design);
+
+# construct main body tag
+ my $bodytag = "".
+ &Apache::lontexconvert::init_math_support($args->{'inherit_jsmath'});
+
if ($bodyonly) {
return $bodytag;
+ }
+
+ my $name = &plainname($env{'user.name'},$env{'user.domain'});
+ if ($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public') {
+ undef($role);
} else {
- return(<'.$title.'';
+ #
+ # 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'}.
+ '.domain'}.'/'})) {
+ my $cid = $env{'request.course.id'};
+ $dc_info.= $cid.' '.$env{'course.'.$cid.'.internal.coursecode'};
+ $dc_info =~ s/\s+$//;
+ $dc_info = '('.$dc_info.')';
+ }
+
+ $role = "($role)" if $role;
+ &get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['inhibitmenu']);
+
+ if ($env{'environment.remote'} eq 'off') {
+ # No Remote
+ if ($env{'request.state'} eq 'construct') {
+ $forcereg=1;
+ }
+
+ # if ($env{'request.state'} eq 'construct') {
+ # $titleinfo = &CSTR_pageheader(); #FIXME: Will be removed once all scripts have their own calls
+ # }
+
+ my $titletable = ''
+ ." $titleinfo $dc_info "
+ .'
';
+
+ if ($no_nav_bar) {
+ $bodytag .= $titletable;
+ } else {
+ $bodytag .= qq|$name $role
+ $realm $dc_info
| unless $env{'form.inhibitmenu'};
+
+#SD $titletable is obsolete
+#SD if ($env{'request.state'} eq 'construct') {
+#SD $bodytag .= &Apache::lonmenu::menubuttons($forcereg,$titletable);
+#SD } else {
+#SD $bodytag .= &Apache::lonmenu::menubuttons($forcereg).$titletable;
+#SD }
+ if ( $env{'form.inhibitmenu'} eq 'yes'
+ || $ENV{'REQUEST_URI'} eq '/adm/logout'
+ || $env{'request.noversionuri'} =~ m{^/res/adm/pages/}) {
+
+ return $bodytag;
+ }
+
+ $bodytag .= Apache::lonhtmlcommon::scripttag(
+ Apache::lonmenu::utilityfunctions(),
+ 'start');
+ $bodytag .= Apache::lonmenu::primary_menu();
+ $bodytag .= Apache::lonmenu::secondary_menu();
+ #SD remove next line
+ #$bodytag .= Apache::lonmenu::menubuttons($forcereg);
+ $bodytag .= Apache::lonmenu::serverform();
+ $bodytag .= Apache::lonhtmlcommon::scripttag('', 'end');
+ $bodytag .= Apache::lonmenu::innerregister($forcereg) if $forcereg;
+ }
+ return $bodytag;
+ }
+
+#
+# Top frame rendering, Remote is up
+#
+
+ my $imgsrc = $img;
+ if ($img =~ /^\/adm/) {
+ $imgsrc = &lonhttpdurl($img);
+ }
+ my $upperleft=' ';
+
+ # Explicit link to get inline menu
+ my $menu= ($no_inline_link?''
+ :''.&mt('Switch to Inline Menu Mode').' ');
+ $bodytag .= qq|$name $role
+ $realm $dc_info
+ | unless $env{'form.inhibitmenu'};
+ #
+ return(<
-
-
-$messages
+
+$upperleft
+ $messages
-
-
- $title
-
-
- $ENV{'environment.firstname'}
- $ENV{'environment.middlename'}
- $ENV{'environment.lastname'}
- $ENV{'environment.generation'}
-
-
+ $titleinfo $dc_info $menu
-
-$role
-
-
-$realm
-
+
ENDBODY
+}
+
+sub make_attr_string {
+ my ($register,$attr_ref) = @_;
+
+ if ($attr_ref && !ref($attr_ref)) {
+ die("addentries Must be a hash ref ".
+ join(':',caller(1))." ".
+ join(':',caller(0))." ");
+ }
+
+ if ($register) {
+ my ($on_load,$on_unload);
+ foreach my $key (keys(%{$attr_ref})) {
+ if (lc($key) eq 'onload') {
+ $on_load.=$attr_ref->{$key}.';';
+ delete($attr_ref->{$key});
+
+ } elsif (lc($key) eq 'onunload') {
+ $on_unload.=$attr_ref->{$key}.';';
+ delete($attr_ref->{$key});
+ }
+ }
+ $attr_ref->{'onload'} =
+ &Apache::lonmenu::loadevents(). $on_load;
+ $attr_ref->{'onunload'}=
+ &Apache::lonmenu::unloadevents().$on_unload;
+ }
+
+# Accessibility font enhance
+ if ($env{'browser.fontenhance'} eq 'on') {
+ my $style;
+ foreach my $key (keys(%{$attr_ref})) {
+ if (lc($key) eq 'style') {
+ $style.=$attr_ref->{$key}.';';
+ delete($attr_ref->{$key});
+ }
+ }
+ $attr_ref->{'style'}=$style.'; font-size: x-large;';
+ }
+
+ my $attr_string;
+ foreach my $attr (keys(%$attr_ref)) {
+ $attr_string .= " $attr=\"".$attr_ref->{$attr}.'" ';
+ }
+ return $attr_string;
+}
+
+
+###############################################
+###############################################
+
+=pod
+
+=item * &endbodytag()
+
+Returns a uniform footer for LON-CAPA web pages.
+
+Inputs: 1 - optional reference to an args hash
+If in the hash, key for noredirectlink has a value which evaluates to true,
+a 'Continue' link is not displayed if the page contains an
+internal redirect in the section,
+i.e., $env{'internal.head.redirect'} exists
+
+=cut
+
+sub endbodytag {
+ my ($args) = @_;
+ my $endbodytag='';
+ $endbodytag=&Apache::lontexconvert::jsMath_process()."\n".$endbodytag;
+ if ( exists( $env{'internal.head.redirect'} ) ) {
+ if (!(ref($args) eq 'HASH' && $args->{'noredirectlink'})) {
+ $endbodytag=
+ "".
+ &mt('Continue').' '.
+ $endbodytag;
+ }
+ }
+ return $endbodytag;
+}
+
+=pod
+
+=item * &standard_css()
+
+Returns a style sheet
+
+Inputs: (all optional)
+ domain -> force to color decorate a page for a specific
+ domain
+ function -> force usage of a specific rolish color scheme
+ bgcolor -> override the default page bgcolor
+
+=cut
+
+sub standard_css {
+ my ($function,$domain,$bgcolor) = @_;
+ $function = &get_users_function() if (!$function);
+ my $img = &designparm($function.'.img', $domain);
+ my $tabbg = &designparm($function.'.tabbg', $domain);
+ my $font = &designparm($function.'.font', $domain);
+ my $fontmenu = &designparm($function.'.fontmenu', $domain);
+#second colour for later usage
+ my $sidebg = &designparm($function.'.sidebg',$domain);
+ my $pgbg_or_bgcolor =
+ $bgcolor ||
+ &designparm($function.'.pgbg', $domain);
+ my $pgbg = &designparm($function.'.pgbg', $domain);
+ my $alink = &designparm($function.'.alink', $domain);
+ my $vlink = &designparm($function.'.vlink', $domain);
+ my $link = &designparm($function.'.link', $domain);
+
+ my $loginbg = &designparm('login.sidebg',$domain);
+ my $bgcol = &designparm('login.bgcol',$domain);
+ my $textcol = &designparm('login.textcol',$domain);
+
+ my $sans = 'Verdana,Arial,Helvetica,sans-serif';
+ my $mono = 'monospace';
+ my $data_table_head = $sidebg;
+ my $data_table_light = '#FAFAFA';
+ my $data_table_dark = '#F0F0F0';
+ my $data_table_darker = '#CCCCCC';
+ my $data_table_highlight = '#FFFF00';
+ my $mail_new = '#FFBB77';
+ my $mail_new_hover = '#DD9955';
+ my $mail_read = '#BBBB77';
+ my $mail_read_hover = '#999944';
+ my $mail_replied = '#AAAA88';
+ my $mail_replied_hover = '#888855';
+ my $mail_other = '#99BBBB';
+ my $mail_other_hover = '#669999';
+ my $table_header = '#DDDDDD';
+ my $feedback_link_bg = '#BBBBBB';
+ my $lg_border_color = '#C8C8C8';
+
+ my $border = ($env{'browser.type'} eq 'explorer' ||
+ $env{'browser.type'} eq 'safari' ) ? '0 2px 0 2px'
+ : '0 3px 0 4px';
+
+
+ return < td {
+ background-color: #CCCCCC;
+ font-weight: bold;
+ text-align: left;
+}
+
+table.LC_data_table tr.LC_odd_row > td,
+table.LC_pick_box tr > td.LC_odd_row {
+ background-color: $data_table_light;
+ padding: 2px;
+}
+
+table.LC_data_table tr.LC_even_row > td,
+table.LC_pick_box tr > td.LC_even_row {
+ background-color: $data_table_dark;
+ padding: 2px;
+}
+
+table.LC_data_table tr.LC_data_table_highlight td {
+ background-color: $data_table_darker;
+}
+
+table.LC_data_table tr td.LC_leftcol_header {
+ background-color: $data_table_head;
+ font-weight: bold;
+}
+
+table.LC_data_table tr.LC_empty_row td,
+table.LC_nested tr.LC_empty_row td {
+ background-color: #FFFFFF;
+ font-weight: bold;
+ font-style: italic;
+ text-align: center;
+ padding: 8px;
+}
+
+table.LC_caption {
+}
+
+table.LC_nested tr.LC_empty_row td {
+ padding: 4ex
+}
+
+table.LC_nested_outer tr th {
+ font-weight: bold;
+ color:$fontmenu;
+ background-color: $data_table_head;
+ font-size: small;
+ border-bottom: 1px solid #000000;
+}
+
+table.LC_nested_outer tr td.LC_subheader {
+ background-color: $data_table_head;
+ font-weight: bold;
+ font-size: small;
+ border-bottom: 1px solid #000000;
+ text-align: right;
+}
+
+table.LC_nested tr.LC_info_row td {
+ background-color: #CCCCCC;
+ font-weight: bold;
+ font-size: small;
+ text-align: center;
+}
+
+table.LC_nested tr.LC_info_row td.LC_left_item,
+table.LC_nested_outer tr th.LC_left_item {
+ text-align: left;
+}
+
+table.LC_nested td {
+ background-color: #FFFFFF;
+ font-size: small;
+}
+
+table.LC_nested_outer tr th.LC_right_item,
+table.LC_nested tr.LC_info_row td.LC_right_item,
+table.LC_nested tr.LC_odd_row td.LC_right_item,
+table.LC_nested tr td.LC_right_item {
+ text-align: right;
+}
+
+table.LC_nested tr.LC_odd_row td {
+ background-color: #EEEEEE;
+}
+
+table.LC_createuser {
+}
+
+table.LC_createuser tr.LC_section_row td {
+ font-size: small;
+}
+
+table.LC_createuser tr.LC_info_row td {
+ background-color: #CCCCCC;
+ font-weight: bold;
+ text-align: center;
+}
+
+table.LC_calendar {
+ border: 1px solid #000000;
+ border-collapse: collapse;
+}
+
+table.LC_calendar_pickdate {
+ font-size: xx-small;
+}
+
+table.LC_calendar tr td {
+ border: 1px solid #000000;
+ vertical-align: top;
+}
+
+table.LC_calendar tr td.LC_calendar_day_empty {
+ background-color: $data_table_dark;
+}
+
+table.LC_calendar tr td.LC_calendar_day_current {
+ background-color: $data_table_highlight;
+}
+
+table.LC_mail_list tr.LC_mail_new {
+ background-color: $mail_new;
+}
+
+table.LC_mail_list tr.LC_mail_new:hover {
+ background-color: $mail_new_hover;
+}
+
+table.LC_mail_list tr.LC_mail_even {
+}
+
+table.LC_mail_list tr.LC_mail_odd {
+}
+
+table.LC_mail_list tr.LC_mail_read {
+ background-color: $mail_read;
+}
+
+table.LC_mail_list tr.LC_mail_read:hover {
+ background-color: $mail_read_hover;
+}
+
+table.LC_mail_list tr.LC_mail_replied {
+ background-color: $mail_replied;
+}
+
+table.LC_mail_list tr.LC_mail_replied:hover {
+ background-color: $mail_replied_hover;
+}
+
+table.LC_mail_list tr.LC_mail_other {
+ background-color: $mail_other;
+}
+
+table.LC_mail_list tr.LC_mail_other:hover {
+ background-color: $mail_other_hover;
+}
+
+table.LC_data_table tr > td.LC_browser_file,
+table.LC_data_table tr > td.LC_browser_file_published {
+ background: #CCFF88;
+}
+
+table.LC_data_table tr > td.LC_browser_file_locked,
+table.LC_data_table tr > td.LC_browser_file_unpublished {
+ background: #FFAA99;
+}
+
+table.LC_data_table tr > td.LC_browser_file_obsolete {
+ background: #AAAAAA;
+}
+
+table.LC_data_table tr > td.LC_browser_file_modified,
+table.LC_data_table tr > td.LC_browser_file_metamodified {
+ background: #FFFF77;
+}
+
+table.LC_data_table tr.LC_browser_folder > td {
+ background: #CCCCFF;
+}
+
+table.LC_data_table tr > td.LC_roles_is {
+/* background: #77FF77; */
+}
+
+table.LC_data_table tr > td.LC_roles_future {
+ background: #FFFF77;
+}
+
+table.LC_data_table tr > td.LC_roles_will {
+ background: #FFAA77;
+}
+
+table.LC_data_table tr > td.LC_roles_expired {
+ background: #FF7777;
+}
+
+table.LC_data_table tr > td.LC_roles_will_not {
+ background: #AAFF77;
+}
+
+table.LC_data_table tr > td.LC_roles_selected {
+ background: #11CC55;
+}
+
+span.LC_current_location {
+ font-size:larger;
+ background: $pgbg;
+}
+
+span.LC_parm_menu_item {
+ font-size: larger;
+}
+
+span.LC_parm_scope_all {
+ color: red;
+}
+
+span.LC_parm_scope_folder {
+ color: green;
+}
+
+span.LC_parm_scope_resource {
+ color: orange;
+}
+
+span.LC_parm_part {
+ color: blue;
+}
+
+span.LC_parm_folder, span.LC_parm_symb {
+ font-size: x-small;
+ font-family: $mono;
+ color: #AAAAAA;
+}
+
+td.LC_parm_overview_level_menu,
+td.LC_parm_overview_map_menu,
+td.LC_parm_overview_parm_selectors,
+td.LC_parm_overview_restrictions {
+ border: 1px solid black;
+ border-collapse: collapse;
+}
+
+table.LC_parm_overview_restrictions td {
+ border-width: 1px 4px 1px 4px;
+ border-style: solid;
+ border-color: $pgbg;
+ text-align: center;
+}
+
+table.LC_parm_overview_restrictions th {
+ background: $tabbg;
+ border-width: 1px 4px 1px 4px;
+ border-style: solid;
+ border-color: $pgbg;
+}
+
+table#LC_helpmenu {
+ border: none;
+ height: 55px;
+ border-spacing: 0;
+}
+
+table#LC_helpmenu fieldset legend {
+ font-size: larger;
+}
+
+table#LC_helpmenu_links {
+ width: 100%;
+ border: 1px solid black;
+ background: $pgbg;
+ padding: 0;
+ border-spacing: 1px;
+}
+
+table#LC_helpmenu_links tr td {
+ padding: 1px;
+ background: $tabbg;
+ text-align: center;
+ font-weight: bold;
+}
+
+table#LC_helpmenu_links a:link,
+table#LC_helpmenu_links a:visited,
+table#LC_helpmenu_links a:active {
+ text-decoration: none;
+ color: $font;
+}
+
+table#LC_helpmenu_links a:hover {
+ text-decoration: underline;
+ color: $vlink;
+}
+
+.LC_chrt_popup_exists {
+ border: 1px solid #339933;
+ margin: -1px;
+}
+
+.LC_chrt_popup_up {
+ border: 1px solid yellow;
+ margin: -1px;
+}
+
+.LC_chrt_popup {
+ border: 1px solid #8888FF;
+ background: #CCCCFF;
+}
+
+table.LC_pick_box {
+ border-collapse: separate;
+ background: white;
+ border: 1px solid black;
+ border-spacing: 1px;
+}
+
+table.LC_pick_box td.LC_pick_box_title {
+ background: $sidebg;
+ font-weight: bold;
+ text-align: right;
+ vertical-align: top;
+ width: 184px;
+ padding: 8px;
+}
+
+table.LC_pick_box td.LC_pick_box_value {
+ text-align: left;
+ padding: 8px;
+}
+
+table.LC_pick_box td.LC_pick_box_select {
+ text-align: left;
+ padding: 8px;
+}
+
+table.LC_pick_box td.LC_pick_box_separator {
+ padding: 0;
+ height: 1px;
+ background: black;
+}
+
+table.LC_pick_box td.LC_pick_box_submit {
+ text-align: right;
+}
+
+table.LC_pick_box td.LC_evenrow_value {
+ text-align: left;
+ padding: 8px;
+ background-color: $data_table_light;
+}
+
+table.LC_pick_box td.LC_oddrow_value {
+ text-align: left;
+ padding: 8px;
+ background-color: $data_table_light;
+}
+
+table.LC_helpform_receipt {
+ width: 620px;
+ border-collapse: separate;
+ background: white;
+ border: 1px solid black;
+ border-spacing: 1px;
+}
+
+table.LC_helpform_receipt td.LC_pick_box_title {
+ background: $tabbg;
+ font-weight: bold;
+ text-align: right;
+ width: 184px;
+ padding: 8px;
+}
+
+table.LC_helpform_receipt td.LC_evenrow_value {
+ text-align: left;
+ padding: 8px;
+ background-color: $data_table_light;
+}
+
+table.LC_helpform_receipt td.LC_oddrow_value {
+ text-align: left;
+ padding: 8px;
+ background-color: $data_table_light;
+}
+
+table.LC_helpform_receipt td.LC_pick_box_separator {
+ padding: 0;
+ height: 1px;
+ background: black;
+}
+
+span.LC_helpform_receipt_cat {
+ font-weight: bold;
+}
+
+table.LC_group_priv_box {
+ background: white;
+ border: 1px solid black;
+ border-spacing: 1px;
+}
+
+table.LC_group_priv_box td.LC_pick_box_title {
+ background: $tabbg;
+ font-weight: bold;
+ text-align: right;
+ width: 184px;
+}
+
+table.LC_group_priv_box td.LC_groups_fixed {
+ background: $data_table_light;
+ text-align: center;
+}
+
+table.LC_group_priv_box td.LC_groups_optional {
+ background: $data_table_dark;
+ text-align: center;
+}
+
+table.LC_group_priv_box td.LC_groups_functionality {
+ background: $data_table_darker;
+ text-align: center;
+ font-weight: bold;
+}
+
+table.LC_group_priv td {
+ text-align: left;
+ padding: 0;
+}
+
+table.LC_notify_front_page {
+ background: white;
+ border: 1px solid black;
+ padding: 8px;
+}
+
+table.LC_notify_front_page td {
+ padding: 8px;
+}
+
+.LC_navbuttons {
+ margin: 2ex 0ex 2ex 0ex;
+}
+
+.LC_topic_bar {
+ font-weight: bold;
+ width: 100%;
+ background: $tabbg;
+ vertical-align: middle;
+ margin: 2ex 0ex 2ex 0ex;
+ padding: 3px;
+}
+
+.LC_topic_bar span {
+ vertical-align: middle;
+}
+
+.LC_topic_bar img {
+ vertical-align: bottom;
+}
+
+table.LC_course_group_status {
+ margin: 20px;
+}
+
+table.LC_status_selector td {
+ vertical-align: top;
+ text-align: center;
+ padding: 4px;
+}
+
+div.LC_feedback_link {
+ clear: both;
+ background: $sidebg;
+ width: 100%;
+ padding-bottom: 10px;
+ border: 1px $tabbg solid;
+ height: 22px;
+ line-height: 22px;
+ padding-top: 5px;
+}
+
+div.LC_feedback_link img {
+ height: 22px;
+ vertical-align:middle;
+}
+
+div.LC_feedback_link a{
+ text-decoration: none;
+}
+
+div.LC_comblock {
+ display:inline;
+ color:$font;
+ font-size:90%;
+}
+
+div.LC_feedback_link div.LC_comblock {
+ padding-left:5px;
+}
+
+div.LC_feedback_link div.LC_comblock a {
+ color:$font;
+}
+
+span.LC_feedback_link {
+ /* background: $feedback_link_bg; */
+ font-size: larger;
+}
+
+span.LC_message_link {
+ /* background: $feedback_link_bg; */
+ font-size: larger;
+ position: absolute;
+ right: 1em;
+}
+
+table.LC_prior_tries {
+ border: 1px solid #000000;
+ border-collapse: separate;
+ border-spacing: 1px;
+}
+
+table.LC_prior_tries td {
+ padding: 2px;
+}
+
+.LC_answer_correct {
+ background: lightgreen;
+ color: darkgreen;
+ padding: 6px;
+}
+
+.LC_answer_charged_try {
+ background: #FFAAAA;
+ color: darkred;
+ padding: 6px;
+}
+
+.LC_answer_not_charged_try,
+.LC_answer_no_grade,
+.LC_answer_late {
+ background: lightyellow;
+ color: black;
+ padding: 6px;
+}
+
+.LC_answer_previous {
+ background: lightblue;
+ color: darkblue;
+ padding: 6px;
+}
+
+.LC_answer_no_message {
+ background: #FFFFFF;
+ color: black;
+ padding: 6px;
+}
+
+.LC_answer_unknown {
+ background: orange;
+ color: black;
+ padding: 6px;
+}
+
+span.LC_prior_numerical,
+span.LC_prior_string,
+span.LC_prior_custom,
+span.LC_prior_reaction,
+span.LC_prior_math {
+ font-family: monospace;
+ white-space: pre;
+}
+
+span.LC_prior_string {
+ font-family: monospace;
+ white-space: pre;
+}
+
+table.LC_prior_option {
+ width: 100%;
+ border-collapse: collapse;
+}
+
+table.LC_prior_rank,
+table.LC_prior_match {
+ border-collapse: collapse;
+}
+
+table.LC_prior_option tr td,
+table.LC_prior_rank tr td,
+table.LC_prior_match tr td {
+ border: 1px solid #000000;
+}
+
+.LC_nobreak {
+ white-space: nowrap;
+}
+
+span.LC_cusr_emph {
+ font-style: italic;
+}
+
+span.LC_cusr_subheading {
+ font-weight: normal;
+ font-size: 85%;
+}
+
+table.LC_docs_documents {
+ background: #BBBBBB;
+ border-width: 0;
+ border-collapse: collapse;
+}
+
+table.LC_docs_documents td.LC_docs_document {
+ border: 2px solid black;
+ padding: 4px;
+}
+
+div.LC_docs_entry_move {
+ border: 1px solid #BBBBBB;
+ background: #DDDDDD;
+ width: 22px;
+ padding: 1px;
+ margin: 0;
+}
+
+table.LC_data_table tr > td.LC_docs_entry_commands,
+table.LC_data_table tr > td.LC_docs_entry_parameter {
+ background: #DDDDDD;
+ font-size: x-small;
+}
+
+.LC_docs_entry_parameter {
+ white-space: nowrap;
+}
+
+.LC_docs_copy {
+ color: #000099;
+}
+
+.LC_docs_cut {
+ color: #550044;
+}
+
+.LC_docs_rename {
+ color: #009900;
+}
+
+.LC_docs_remove {
+ color: #990000;
+}
+
+.LC_docs_reinit_warn,
+.LC_docs_ext_edit {
+ font-size: x-small;
+}
+
+table.LC_docs_adddocs td,
+table.LC_docs_adddocs th {
+ border: 1px solid #BBBBBB;
+ padding: 4px;
+ background: #DDDDDD;
+}
+
+table.LC_sty_begin {
+ background: #BBFFBB;
+}
+
+table.LC_sty_end {
+ background: #FFBBBB;
+}
+
+table.LC_double_column {
+ border-width: 0;
+ border-collapse: collapse;
+ width: 100%;
+ padding: 2px;
+}
+
+table.LC_double_column tr td.LC_left_col {
+ top: 2px;
+ left: 2px;
+ width: 47%;
+ vertical-align: top;
+}
+
+table.LC_double_column tr td.LC_right_col {
+ top: 2px;
+ right: 2px;
+ width: 47%;
+ vertical-align: top;
+}
+
+div.LC_left_float {
+ float: left;
+ padding-right: 5%;
+ padding-bottom: 4px;
+}
+
+div.LC_clear_float_header {
+ padding-bottom: 2px;
+}
+
+div.LC_clear_float_footer {
+ padding-top: 10px;
+ clear: both;
+}
+
+div.LC_grade_show_user {
+ margin-top: 20px;
+ border: 1px solid black;
+}
+
+div.LC_grade_user_name {
+ background: #DDDDEE;
+ border-bottom: 1px solid black;
+ font-weight: bold;
+ font-size: large;
+}
+
+div.LC_grade_show_user_odd_row div.LC_grade_user_name {
+ background: #DDEEDD;
+}
+
+div.LC_grade_show_problem,
+div.LC_grade_submissions,
+div.LC_grade_message_center,
+div.LC_grade_info_links,
+div.LC_grade_assign {
+ margin: 5px;
+ width: 99%;
+ background: #FFFFFF;
+}
+
+div.LC_grade_show_problem_header,
+div.LC_grade_submissions_header,
+div.LC_grade_message_center_header,
+div.LC_grade_assign_header {
+ font-weight: bold;
+ font-size: large;
+}
+
+div.LC_grade_show_problem_problem,
+div.LC_grade_submissions_body,
+div.LC_grade_message_center_body,
+div.LC_grade_assign_body {
+ border: 1px solid black;
+ width: 99%;
+ background: #FFFFFF;
+}
+
+span.LC_grade_check_note {
+ font-weight: normal;
+ font-size: medium;
+ display: inline;
+ position: absolute;
+ right: 1em;
+}
+
+table.LC_scantron_action {
+ width: 100%;
+}
+
+table.LC_scantron_action tr th {
+ font-weight:bold;
+ font-style:normal;
+}
+
+.LC_edit_problem_header,
+div.LC_edit_problem_footer {
+ font-weight: normal;
+ font-size: medium;
+ margin: 2px;
+}
+
+div.LC_edit_problem_header,
+div.LC_edit_problem_header div,
+div.LC_edit_problem_footer,
+div.LC_edit_problem_footer div,
+div.LC_edit_problem_editxml_header,
+div.LC_edit_problem_editxml_header div {
+ margin-top: 5px;
+}
+
+div.LC_edit_problem_header_title {
+ font-weight: bold;
+ font-size: larger;
+ background: $tabbg;
+ padding: 3px;
+}
+
+table.LC_edit_problem_header_title {
+ font-size: larger;
+ font-weight: bold;
+ width: 100%;
+ border-color: $pgbg;
+ border-style: solid;
+ border-width: $border;
+ background: $tabbg;
+ border-collapse: collapse;
+ padding: 0;
+}
+
+div.LC_edit_problem_discards {
+ float: left;
+ padding-bottom: 5px;
+}
+
+div.LC_edit_problem_saves {
+ float: right;
+ padding-bottom: 5px;
+}
+
+img.stift{
+ border-width: 0;
+ vertical-align: middle;
+}
+
+table#LC_mainmenu{
+ margin-top:10px;
+ width:80%;
+}
+
+table#LC_mainmenu td.LC_mainmenu_col_fieldset{
+ vertical-align: top;
+ width: 45%;
+}
+
+.LC_mainmenu_fieldset_category {
+ color: $font;
+ background: $pgbg;
+ font-size: small;
+ font-weight: bold;
+}
+
+div.LC_createcourse {
+ margin: 10px 10px 10px 10px;
+}
+
+/* ---- Remove when done ----
+# The following styles is part of the redesign of LON-CAPA and are
+# subject to change during this project.
+# Don't rely on their current functionality as they might be
+# changed or removed.
+# --------------------------*/
+
+a:hover,
+ol.LC_smallMenu a:hover,
+ol#LC_MenuBreadcrumbs a:hover,
+ol#LC_PathBreadcrumbs a:hover,
+ul#LC_TabMainMenuContent a:hover,
+.LC_FormSectionClearButton input:hover
+ul.LC_TabContent li:hover a {
+ color:#BF2317;
+ text-decoration:none;
+}
+
+h1 {
+ padding: 0;
+ line-height:130%;
+}
+
+h2,h3,h4,h5,h6 {
+ margin: 5px 0 5px 0;
+ padding: 0;
+ line-height:130%;
+}
+
+.LC_hcell {
+ padding:3px 15px 3px 15px;
+ margin: 0;
+ background-color:$tabbg;
+ color:$fontmenu;
+ border-bottom:solid 1px $lg_border_color;
+}
+
+.LC_Box > .LC_hcell {
+ margin: 0 -10px 10px -10px;
+}
+
+.LC_noBorder {
+ border: 0;
+}
+
+.LC_Right {
+ float: right;
+ margin: 0;
+ padding: 0;
+}
+
+.LC_FormSectionClearButton input {
+ background-color:transparent;
+ border: none;
+ cursor:pointer;
+ text-decoration:underline;
+}
+
+.LC_help_open_topic {
+ color: #FFFFFF;
+ background-color: #EEEEFF;
+ margin: 1px;
+ padding: 4px;
+ border: 1px solid #000033;
+ white-space: nowrap;
+/* vertical-align: middle; */
+}
+
+dl,ul,div,fieldset {
+ margin: 10px 10px 10px 0;
+/* overflow: hidden; */
+}
+
+fieldset > legend {
+ font-weight: bold;
+ padding: 0 5px 0 5px;
+}
+
+#LC_nav_bar {
+ float: left;
+ margin: 0.2em 0 0 0;
+}
+
+#LC_nav_bar em{
+ font-weight: bold;
+ font-style: normal;
+}
+
+ol.LC_smallMenu {
+ float: right;
+ margin: 0.2em 0 0 0;
+}
+
+ol#LC_PathBreadcrumbs {
+ margin: 0;
+}
+
+ol.LC_smallMenu li {
+ display: inline;
+ padding: 5px 5px 0 10px;
+ vertical-align: top;
+}
+
+ol.LC_smallMenu li img {
+ vertical-align: bottom;
+}
+
+ol.LC_smallMenu a {
+ font-size: 90%;
+ color: RGB(80, 80, 80);
+ text-decoration: none;
+}
+
+ul#LC_TabMainMenuContent {
+ clear: both;
+ color: $fontmenu;
+ background: $tabbg;
+ list-style: none;
+ padding: 0;
+ margin: 0;
+ width: 100%;
+}
+
+ul#LC_TabMainMenuContent li {
+ font-weight: bold;
+ line-height: 1.8em;
+ padding: 0 0.8em;
+ border-right: 1px solid black;
+ display: inline;
+ vertical-align: middle;
+}
+
+ul.LC_TabContent {
+ display:block;
+ background: $sidebg;
+ border-bottom: solid 1px $lg_border_color;
+ list-style:none;
+ margin: 0 -10px;
+ padding: 0;
+}
+
+ul.LC_TabContent li,
+ul.LC_TabContentBigger li {
+ float:left;
+}
+
+ul#LC_TabMainMenuContent li a {
+ color: $fontmenu;
+ text-decoration: none;
+}
+
+ul.LC_TabContent {
+ min-height:1.5em;
+}
+
+ul.LC_TabContent li {
+ vertical-align:middle;
+ padding: 0 10px 0 10px;
+ background-color:$tabbg;
+ border-bottom:solid 1px $lg_border_color;
+}
+
+ul.LC_TabContent .right {
+ float:right;
+}
+
+ul.LC_TabContent li a, ul.LC_TabContent li {
+ color:rgb(47,47,47);
+ text-decoration:none;
+ font-size:95%;
+ font-weight:bold;
+ padding-right: 16px;
+}
+
+ul.LC_TabContent li:hover, ul.LC_TabContent li.active {
+ background:#FFFFFF url(/adm/lonIcons/open.gif) no-repeat scroll right center;
+ border-bottom:solid 2px #FFFFFF;
+ padding-right: 16px;
+}
+
+#maincoursedoc {
+ clear:both;
+}
+
+ul.LC_TabContentBigger {
+ display:block;
+ list-style:none;
+ padding: 0;
+}
+
+ul.LC_TabContentBigger li {
+ vertical-align:bottom;
+ height: 30px;
+ font-size:110%;
+ font-weight:bold;
+ color: #737373;
+}
+
+
+ul.LC_TabContentBigger li a {
+ background:url('/adm/lonIcons/tabbgleft.gif') left bottom no-repeat;
+ height: 30px;
+ line-height: 30px;
+ text-align: center;
+ display: block;
+ text-decoration: none;
+}
+
+ul.LC_TabContentBigger li:hover a,
+ul.LC_TabContentBigger li.active a {
+ background:url('/adm/lonIcons/tabbgleft.gif') left top no-repeat;
+ color:$font;
+ text-decoration: underline;
+}
+
+
+ul.LC_TabContentBigger li b {
+ background: url('/adm/lonIcons/tabbgright.gif') no-repeat right bottom;
+ display: block;
+ float: left;
+ padding: 0 30px;
+}
+
+ul.LC_TabContentBigger li:hover b,
+ul.LC_TabContentBigger li.active b {
+ background:url('/adm/lonIcons/tabbgright.gif') right top no-repeat;
+ color:$font;
+ border-bottom: 1px solid #FFFFFF;
+}
+
+
+ul.LC_CourseBreadcrumbs {
+ background: $sidebg;
+ line-height: 32px;
+ padding-left: 10px;
+ margin: 0 0 10px 0;
+ list-style-position: inside;
+
+}
+
+ol#LC_MenuBreadcrumbs,
+ol#LC_PathBreadcrumbs {
+ padding-left: 10px;
+ margin: 0;
+ list-style-position: inside;
+}
+
+ol#LC_MenuBreadcrumbs li,
+ol#LC_PathBreadcrumbs li,
+ul.LC_CourseBreadcrumbs li {
+ display: inline;
+ white-space: nowrap;
+}
+
+ol#LC_MenuBreadcrumbs li a,
+ul.LC_CourseBreadcrumbs li a {
+ text-decoration: none;
+ font-size:90%;
+}
+
+ol#LC_PathBreadcrumbs li a {
+ text-decoration:none;
+ font-size:100%;
+ font-weight:bold;
+}
+
+.LC_Box {
+ border: solid 1px $lg_border_color;
+ padding: 0 10px 10px 10px;
+}
+
+.LC_AboutMe_Image {
+ float:left;
+ margin-right:10px;
+}
+
+.LC_Clear_AboutMe_Image {
+ clear:left;
+}
+
+dl.LC_ListStyleClean dt {
+ padding-right: 5px;
+ display: table-header-group;
+}
+
+dl.LC_ListStyleClean dd {
+ display: table-row;
+}
+
+.LC_ListStyleClean,
+.LC_ListStyleSimple,
+.LC_ListStyleNormal,
+.LC_ListStyle_Border,
+.LC_ListStyleSpecial {
+ /*display:block; */
+ list-style-position: inside;
+ list-style-type: none;
+ overflow: hidden;
+ padding: 0;
+}
+
+.LC_ListStyleSimple li,
+.LC_ListStyleSimple dd,
+.LC_ListStyleNormal li,
+.LC_ListStyleNormal dd,
+.LC_ListStyleSpecial li,
+.LC_ListStyleSpecial dd {
+ margin: 0;
+ padding: 5px 5px 5px 10px;
+ clear: both;
+}
+
+.LC_ListStyleClean li,
+.LC_ListStyleClean dd {
+ padding-top: 0;
+ padding-bottom: 0;
+}
+
+.LC_ListStyleSimple dd,
+.LC_ListStyleSimple li {
+ border-bottom: solid 1px $lg_border_color;
+}
+
+.LC_ListStyleSpecial li,
+.LC_ListStyleSpecial dd {
+ list-style-type: none;
+ background-color: RGB(220, 220, 220);
+ margin-bottom: 4px;
+}
+
+table.LC_SimpleTable {
+ margin:5px;
+ border:solid 1px $lg_border_color;
+}
+
+table.LC_SimpleTable tr {
+ padding: 0;
+ border:solid 1px $lg_border_color;
+}
+
+table.LC_SimpleTable thead {
+ background:rgb(220,220,220);
+}
+
+div.LC_columnSection {
+ display: block;
+ clear: both;
+ overflow: hidden;
+ margin: 0;
+}
+
+div.LC_columnSection>* {
+ float: left;
+ margin: 10px 20px 10px 0;
+ overflow:hidden;
+}
+
+.LC_loginpage_container {
+ text-align:left;
+ margin : 0 auto;
+ width:90%;
+ padding: 10px;
+ height: auto;
+ background-color:#FFFFFF;
+ border:1px solid #CCCCCC;
+}
+
+
+.LC_loginpage_loginContainer {
+ float:left;
+ width: 182px;
+ padding: 2px;
+ border:1px solid #CCCCCC;
+ background-color:$loginbg;
+}
+
+.LC_loginpage_loginContainer h2 {
+ margin-top: 0;
+ display:block;
+ background:$bgcol;
+ color:$textcol;
+ padding-left:5px;
+}
+
+.LC_loginpage_loginInfo {
+ float:left;
+ width:182px;
+ border:1px solid #CCCCCC;
+ padding:2px;
+}
+
+.LC_loginpage_space {
+ clear: both;
+ margin-bottom: 20px;
+ border-bottom: 1px solid #CCCCCC;
+}
+
+.LC_loginpage_floatLeft {
+ float: left;
+ width: 200px;
+ margin: 0;
+}
+
+table em {
+ font-weight: bold;
+ font-style: normal;
+}
+
+table.LC_tableBrowseRes,
+table.LC_tableOfContent {
+ border:none;
+ border-spacing: 1px;
+ padding: 3px;
+ background-color: #FFFFFF;
+ font-size: 90%;
+}
+
+table.LC_tableOfContent{
+ border-collapse: collapse;
+}
+
+table.LC_tableBrowseRes a,
+table.LC_tableOfContent a {
+ background-color: transparent;
+ text-decoration: none;
+}
+
+table.LC_tableBrowseRes tr.LC_trOdd,
+table.LC_tableOfContent tr.LC_trOdd{
+ background-color: #EEEEEE;
+}
+
+table.LC_tableOfContent img {
+ border: none;
+ height: 1.3em;
+ vertical-align: text-bottom;
+ margin-right: 0.3em;
+}
+
+a#LC_content_toolbar_firsthomework {
+ background-image:url(/res/adm/pages/open-first-problem.gif);
+}
+
+a#LC_content_toolbar_launchnav {
+ background-image:url(/res/adm/pages/start-navigation.gif);
+}
+
+a#LC_content_toolbar_closenav {
+ background-image:url(/res/adm/pages/close-navigation.gif);
+}
+
+a#LC_content_toolbar_everything {
+ background-image:url(/res/adm/pages/show-all.gif);
+}
+
+a#LC_content_toolbar_uncompleted {
+ background-image:url(/res/adm/pages/show-incomplete-problems.gif);
+}
+
+#LC_content_toolbar_clearbubbles {
+ background-image:url(/res/adm/pages/mark-discussionentries-read.gif);
+}
+
+a#LC_content_toolbar_changefolder {
+ background : url(/res/adm/pages/close-all-folders.gif) top center ;
+}
+
+a#LC_content_toolbar_changefolder_toggled {
+ background-image:url(/res/adm/pages/open-all-folders.gif);
+}
+
+ul#LC_toolbar li a:hover {
+ background-position: bottom center;
+}
+
+ul#LC_toolbar {
+ padding: 0;
+ margin: 2px;
+ list-style:none;
+ position:relative;
+ background-color:white;
+}
+
+ul#LC_toolbar li {
+ border:1px solid white;
+ padding: 0;
+ margin: 0;
+ float: left;
+ display:inline;
+ vertical-align:middle;
+}
+
+
+a.LC_toolbarItem {
+ display:block;
+ padding: 0;
+ margin: 0;
+ height: 32px;
+ width: 32px;
+ color:white;
+ border: none;
+ background-repeat:no-repeat;
+ background-color:transparent;
+}
+
+ul.LC_funclist li {
+ float: left;
+ white-space: nowrap;
+ height: 35px; /* at least as high as heighest list item */
+ margin: 0 15px 15px 10px;
+}
+
+
+END
+}
+
+=pod
+
+=item * &headtag()
+
+Returns a uniform footer for LON-CAPA web pages.
+
+Inputs: $title - optional title for the head
+ $head_extra - optional extra HTML to put inside the
+ $args - optional arguments
+ force_register - if is true call registerurl so the remote is
+ informed
+ redirect -> array ref of
+ 1- seconds before redirect occurs
+ 2- url to redirect to
+ 3- whether the side effect should occur
+ (side effect of setting
+ $env{'internal.head.redirect'} to the url
+ redirected too)
+ domain -> force to color decorate a page for a specific
+ domain
+ function -> force usage of a specific rolish color scheme
+ bgcolor -> override the default page bgcolor
+ no_auto_mt_title
+ -> prevent &mt()ing the title arg
+
+=cut
+
+sub headtag {
+ my ($title,$head_extra,$args) = @_;
+
+ my $function = $args->{'function'} || &get_users_function();
+ my $domain = $args->{'domain'} || &determinedomain();
+ my $bgcolor = $args->{'bgcolor'} || &designparm($function.'.pgbg',$domain);
+ my $url = join(':',$env{'user.name'},$env{'user.domain'},
+ $Apache::lonnet::perlvar{'lonVersion'},
+ #time(),
+ $env{'environment.color.timestamp'},
+ $function,$domain,$bgcolor);
+
+ $url = '/adm/css/'.&escape($url).'.css';
+
+ my $result =
+ ''.
+ &font_settings();
+
+ if (!$args->{'frameset'}) {
+ $result .= &Apache::lonhtmlcommon::htmlareaheaders();
+ }
+ if ($args->{'force_register'}) {
+ $result .= &Apache::lonmenu::registerurl(1);
+ }
+ if (!$args->{'no_nav_bar'}
+ && !$args->{'only_body'}
+ && !$args->{'frameset'}) {
+ $result .= &help_menu_js();
+ }
+
+ if (ref($args->{'redirect'})) {
+ my ($time,$url,$inhibit_continue) = @{$args->{'redirect'}};
+ $url = &Apache::lonenc::check_encrypt($url);
+ if (!$inhibit_continue) {
+ $env{'internal.head.redirect'} = $url;
+ }
+ $result.=<
+
+ADDMETA
+ }
+ if (!defined($title)) {
+ $title = 'The LearningOnline Network with CAPA';
+ }
+ if (!$args->{'no_auto_mt_title'}) { $title = &mt($title); }
+ $result .= ' LON-CAPA '.$title.' '
+ .' '
+ .$head_extra;
+ return $result;
+}
+
+=pod
+
+=item * &font_settings()
+
+Returns neccessary to set the proper encoding
+
+Inputs: none
+
+=cut
+
+sub font_settings {
+ my $headerstring='';
+ if (!$env{'browser.mathml'} && $env{'browser.unicode'}) {
+ $headerstring.=
+ ' ';
+ }
+ return $headerstring;
+}
+
+=pod
+
+=item * &xml_begin()
+
+Returns the needed doctype and
+
+Inputs: none
+
+=cut
+
+sub xml_begin {
+ my $output='';
+
+ if ($env{'internal.start_page'}==1) {
+ &Apache::lonhtmlcommon::init_htmlareafields();
+ }
+
+ if ($env{'browser.mathml'}) {
+ $output=''
+ #.''."\n"
+# .'] >'
+ .''
+ .'';
+ } else {
+ $output=''
+ .'';
+ }
+ return $output;
+}
+
+=pod
+
+=item * &endheadtag()
+
+Returns a uniform for LON-CAPA web pages.
+
+Inputs: none
+
+=cut
+
+sub endheadtag {
+ return '';
+}
+
+=pod
+
+=item * &head()
+
+Returns a uniform complete .. section for LON-CAPA web pages.
+
+Inputs:
+
+=over 4
+
+$title - optional title for the page
+
+$head_extra - optional extra HTML to put inside the
+
+=back
+
+=cut
+
+sub head {
+ my ($title,$head_extra,$args) = @_;
+ return &headtag($title,$head_extra,$args).&endheadtag();
+}
+
+=pod
+
+=item * &start_page()
+
+Returns a complete .. section for LON-CAPA web pages.
+
+Inputs:
+
+=over 4
+
+$title - optional title for the page
+
+$head_extra - optional extra HTML to incude inside the
+
+$args - additional optional args supported are:
+
+=over 8
+
+ only_body -> is true will set &bodytag() onlybodytag
+ arg on
+ no_nav_bar -> is true will set &bodytag() no_nav_bar arg on
+ add_entries -> additional attributes to add to the
+ domain -> force to color decorate a page for a
+ specific domain
+ function -> force usage of a specific rolish color
+ scheme
+ redirect -> see &headtag()
+ bgcolor -> override the default page bg color
+ js_ready -> return a string ready for being used in
+ a javascript writeln
+ html_encode -> return a string ready for being used in
+ a html attribute
+ force_register -> if is true will turn on the &bodytag()
+ $forcereg arg
+ frameset -> if true will start with a
+ rather than
+ skip_phases -> hash ref of
+ head -> skip the generation
+ body -> skip all generation
+ no_inline_link -> if true and in remote mode, don't show the
+ 'Switch To Inline Menu' link
+ no_auto_mt_title -> prevent &mt()ing the title arg
+ inherit_jsmath -> when creating popup window in a page,
+ should it have jsmath forced on by the
+ current page
+ bread_crumbs -> Array containing breadcrumbs
+ bread_crumbs_components -> if exists show it as headline else show only the breadcrumbs
+
+=back
+
+=back
+
+=cut
+
+sub start_page {
+ my ($title,$head_extra,$args) = @_;
+ #&Apache::lonnet::logthis("start_page ".join(':',caller(0)));
+ my %head_args;
+ foreach my $arg ('redirect','force_register','domain','function',
+ 'bgcolor','frameset','no_nav_bar','only_body',
+ 'no_auto_mt_title') {
+ if (defined($args->{$arg})) {
+ $head_args{$arg} = $args->{$arg};
+ }
+ }
+
+ $env{'internal.start_page'}++;
+ my $result;
+ if (! exists($args->{'skip_phases'}{'head'}) ) {
+ $result.=
+ &xml_begin().
+ &headtag($title,$head_extra,\%head_args).&endheadtag();
+ }
+
+ if (! exists($args->{'skip_phases'}{'body'}) ) {
+ if ($args->{'frameset'}) {
+ my $attr_string = &make_attr_string($args->{'force_register'},
+ $args->{'add_entries'});
+ $result .= "\n\n";
+ } else {
+ $result .=
+ &bodytag($title,
+ $args->{'function'}, $args->{'add_entries'},
+ $args->{'only_body'}, $args->{'domain'},
+ $args->{'force_register'}, $args->{'no_nav_bar'},
+ $args->{'bgcolor'}, $args->{'no_inline_link'},
+ $args);
+ }
+ }
+
+ if ($args->{'js_ready'}) {
+ $result = &js_ready($result);
+ }
+ if ($args->{'html_encode'}) {
+ $result = &html_encode($result);
+ }
+
+ # Preparation for new and consistent functionlist at top of screen
+ # if ($args->{'functionlist'}) {
+ # $result .= &build_functionlist();
+ #}
+
+ # Don't add anything more if only_body wanted
+ return $result if $args->{'only_body'};
+
+ #Breadcrumbs
+ if (exists($args->{'bread_crumbs'}) or exists($args->{'bread_crumbs_component'})) {
+ &Apache::lonhtmlcommon::clear_breadcrumbs();
+ #if any br links exists, add them to the breadcrumbs
+ if (exists($args->{'bread_crumbs'}) and ref($args->{'bread_crumbs'}) eq 'ARRAY') {
+ foreach my $crumb (@{$args->{'bread_crumbs'}}){
+ &Apache::lonhtmlcommon::add_breadcrumb($crumb);
+ }
+ }
+
+ #if bread_crumbs_component exists show it as headline else show only the breadcrumbs
+ if(exists($args->{'bread_crumbs_component'})){
+ $result .= &Apache::lonhtmlcommon::breadcrumbs($args->{'bread_crumbs_component'});
+ }else{
+ $result .= &Apache::lonhtmlcommon::breadcrumbs();
+ }
+ }
+ return $result;
+}
+
+
+=pod
+
+=item * &head()
+
+Returns a complete section for LON-CAPA web pages.
+
+Inputs: $args - additional optional args supported are:
+ js_ready -> return a string ready for being used in
+ a javascript writeln
+ html_encode -> return a string ready for being used in
+ a html attribute
+ frameset -> if true will start with a
+ rather than
+ dicsussion -> if true will get discussion from
+ lonxml::xmlend
+ (you can pass the target and parser arguments
+ through optional 'target' and 'parser' args
+ to this routine)
+
+=cut
+
+sub end_page {
+ my ($args) = @_;
+ $env{'internal.end_page'}++;
+ my $result;
+ if ($args->{'discussion'}) {
+ my ($target,$parser);
+ if (ref($args->{'discussion'})) {
+ ($target,$parser) =($args->{'discussion'}{'target'},
+ $args->{'discussion'}{'parser'});
+ }
+ $result .= &Apache::lonxml::xmlend($target,$parser);
+ }
+
+ if ($args->{'frameset'}) {
+ $result .= ' ';
+ } else {
+ $result .= &endbodytag($args);
+ }
+ $result .= "\n";
+
+ if ($args->{'js_ready'}) {
+ $result = &js_ready($result);
+ }
+
+ if ($args->{'html_encode'}) {
+ $result = &html_encode($result);
+ }
+
+ return $result;
+}
+
+sub html_encode {
+ my ($result) = @_;
+
+ $result = &HTML::Entities::encode($result,'<>&"');
+
+ return $result;
+}
+sub js_ready {
+ my ($result) = @_;
+
+ $result =~ s/[\n\r]/ /xmsg;
+ $result =~ s/\\/\\\\/xmsg;
+ $result =~ s/'/\\'/xmsg;
+ $result =~ s{}{<\\/}xmsg;
+
+ return $result;
+}
+
+sub validate_page {
+ if ( exists($env{'internal.start_page'})
+ && $env{'internal.start_page'} > 1) {
+ &Apache::lonnet::logthis('start_page called multiple times '.
+ $env{'internal.start_page'}.' '.
+ $ENV{'request.filename'});
+ }
+ if ( exists($env{'internal.end_page'})
+ && $env{'internal.end_page'} > 1) {
+ &Apache::lonnet::logthis('end_page called multiple times '.
+ $env{'internal.end_page'}.' '.
+ $env{'request.filename'});
+ }
+ if ( exists($env{'internal.start_page'})
+ && ! exists($env{'internal.end_page'})) {
+ &Apache::lonnet::logthis('start_page called without end_page '.
+ $env{'request.filename'});
+ }
+ if ( ! exists($env{'internal.start_page'})
+ && exists($env{'internal.end_page'})) {
+ &Apache::lonnet::logthis('end_page called without start_page'.
+ $env{'request.filename'});
+ }
+}
+
+sub simple_error_page {
+ my ($r,$title,$msg) = @_;
+ my $page =
+ &Apache::loncommon::start_page($title).
+ &mt($msg).
+ &Apache::loncommon::end_page();
+ if (ref($r)) {
+ $r->print($page);
+ return;
+ }
+ return $page;
+}
+
+{
+ my @row_count;
+ sub start_data_table {
+ my ($add_class) = @_;
+ my $css_class = (join(' ','LC_data_table',$add_class));
+ unshift(@row_count,0);
+ return ''."\n";
+ }
+
+ sub end_data_table {
+ shift(@row_count);
+ return '
'."\n";;
+ }
+
+ sub start_data_table_row {
+ my ($add_class) = @_;
+ $row_count[0]++;
+ my $css_class = ($row_count[0] % 2)?'LC_odd_row':'LC_even_row';
+ $css_class = (join(' ',$css_class,$add_class));
+ return ''."\n";;
+ }
+
+ sub continue_data_table_row {
+ my ($add_class) = @_;
+ my $css_class = ($row_count[0] % 2)?'LC_odd_row':'LC_even_row';
+ $css_class = (join(' ',$css_class,$add_class));
+ return ' '."\n";;
+ }
+
+ sub end_data_table_row {
+ return ' '."\n";;
+ }
+
+ sub start_data_table_empty_row {
+# $row_count[0]++;
+ return ''."\n";;
+ }
+
+ sub end_data_table_empty_row {
+ return ' '."\n";;
+ }
+
+ sub start_data_table_header_row {
+ return ''."\n";;
+ }
+
+ sub data_table_caption {
+ my $caption = shift;
+ return "$caption ";
+ }
+}
+
+=pod
+
+=item * &inhibit_menu_check($arg)
+
+Checks for a inhibitmenu state and generates output to preserve it
+
+Inputs: $arg - can be any of
+ - undef - in which case the return value is a string
+ to add into arguments list of a uri
+ - 'input' - in which case the return value is a HTML
+