Diff for /loncom/interface/loncommon.pm between versions 1.1055 and 1.1063

version 1.1055, 2012/01/31 23:47:15 version 1.1063, 2012/04/04 21:04:55
Line 1748  Inputs: $workbook Line 1748  Inputs: $workbook
   
 Returns: $format, a hash reference.  Returns: $format, a hash reference.
   
   
 =cut  =cut
   
 ###############################################################  ###############################################################
Line 2856  database which holds them. Line 2857  database which holds them.
   
 Uses global $thesaurus_db_file.  Uses global $thesaurus_db_file.
   
   
 =cut  =cut
   
 ###############################################################  ###############################################################
Line 4015  sub findallcourses { Line 4017  sub findallcourses {
             if ($tstart) {              if ($tstart) {
                 next if ($tstart > $now);                  next if ($tstart > $now);
             }              }
             my ($cdom,$cnum,$sec,$cnumpart,$secpart,$role,$realsec);              my ($cdom,$cnum,$sec,$cnumpart,$secpart,$role);
             (undef,$cdom,$cnumpart,$secpart) = split(/\//,$entry);              (undef,$cdom,$cnumpart,$secpart) = split(/\//,$entry);
               my $value = $trole.'/'.$cdom.'/';
             if ($secpart eq '') {              if ($secpart eq '') {
                 ($cnum,$role) = split(/_/,$cnumpart);                   ($cnum,$role) = split(/_/,$cnumpart); 
                 $sec = 'none';                  $sec = 'none';
                 $realsec = '';                  $value .= $cnum.'/';
             } else {              } else {
                 $cnum = $cnumpart;                  $cnum = $cnumpart;
                 ($sec,$role) = split(/_/,$secpart);                  ($sec,$role) = split(/_/,$secpart);
                 $realsec = $sec;                  $value .= $cnum.'/'.$sec;
               }
               if (ref($courses{$cdom.'_'.$cnum}{$sec}) eq 'ARRAY') {
                   unless (grep(/^\Q$value\E$/,@{$courses{$cdom.'_'.$cnum}{$sec}})) {
                       push(@{$courses{$cdom.'_'.$cnum}{$sec}},$value);
                   }
               } else {
                   @{$courses{$cdom.'_'.$cnum}{$sec}} = ($value);
             }              }
             $courses{$cdom.'_'.$cnum}{$sec} = $trole.'/'.$cdom.'/'.$cnum.'/'.$realsec;  
         }          }
     } else {      } else {
         foreach my $key (keys(%env)) {          foreach my $key (keys(%env)) {
Line 4044  sub findallcourses { Line 4053  sub findallcourses {
                     if ($now>$endtime) { $active=0; }                      if ($now>$endtime) { $active=0; }
                 }                  }
                 if ($active) {                  if ($active) {
                       my $value = $role.'/'.$cdom.'/'.$cnum.'/';
                     if ($sec eq '') {                      if ($sec eq '') {
                         $sec = 'none';                          $sec = 'none';
                       } else {
                           $value .= $sec;
                       }
                       if (ref($courses{$cdom.'_'.$cnum}{$sec}) eq 'ARRAY') {
                           unless (grep(/^\Q$value\E$/,@{$courses{$cdom.'_'.$cnum}{$sec}})) {
                               push(@{$courses{$cdom.'_'.$cnum}{$sec}},$value);
                           }
                       } else {
                           @{$courses{$cdom.'_'.$cnum}{$sec}} = ($value);
                     }                      }
                     $courses{$cdom.'_'.$cnum}{$sec} =   
                                      $role.'/'.$cdom.'/'.$cnum.'/'.$sec;  
                 }                  }
             }              }
         }          }
Line 4059  sub findallcourses { Line 4076  sub findallcourses {
 ###############################################  ###############################################
   
 sub blockcheck {  sub blockcheck {
     my ($setters,$activity,$uname,$udom) = @_;      my ($setters,$activity,$uname,$udom,$url) = @_;
   
     if (!defined($udom)) {      if (!defined($udom)) {
         $udom = $env{'user.domain'};          $udom = $env{'user.domain'};
Line 4071  sub blockcheck { Line 4088  sub blockcheck {
     # If uname and udom are for a course, check for blocks in the course.      # If uname and udom are for a course, check for blocks in the course.
   
     if (&Apache::lonnet::is_course($udom,$uname)) {      if (&Apache::lonnet::is_course($udom,$uname)) {
         my %records = &Apache::lonnet::dump('comm_block',$udom,$uname);          my ($startblock,$endblock,$triggerblock) = 
         my ($startblock,$endblock)=&get_blocks($setters,$activity,$udom,$uname);              &get_blocks($setters,$activity,$udom,$uname,$url);
         return ($startblock,$endblock);          return ($startblock,$endblock,$triggerblock);
     }      }
   
     my $startblock = 0;      my $startblock = 0;
     my $endblock = 0;      my $endblock = 0;
       my $triggerblock = '';
     my %live_courses = &findallcourses(undef,$uname,$udom);      my %live_courses = &findallcourses(undef,$uname,$udom);
   
     # If uname is for a user, and activity is course-specific, i.e.,      # If uname is for a user, and activity is course-specific, i.e.,
Line 4141  sub blockcheck { Line 4159  sub blockcheck {
             if ($otheruser) {              if ($otheruser) {
                 # Resource belongs to user other than current user.                  # Resource belongs to user other than current user.
                 # Assemble privs for that user, and check for 'evb' priv.                  # Assemble privs for that user, and check for 'evb' priv.
                 my ($trole,$tdom,$tnum,$tsec);                  my (%allroles,%userroles);
                 my $entry = $live_courses{$course}{$sec};                  if (ref($live_courses{$course}{$sec}) eq 'ARRAY') {
                 if ($entry =~ /^cr/) {                      foreach my $entry (@{$live_courses{$course}{$sec}}) { 
                     ($trole,$tdom,$tnum,$tsec) =                           my ($trole,$tdom,$tnum,$tsec);
                       ($entry =~ m|^(cr/$match_domain/$match_username/\w+)\./($match_domain)/($match_username)/?(\w*)$|);                          if ($entry =~ /^cr/) {
                 } else {                              ($trole,$tdom,$tnum,$tsec) = 
                     ($trole,$tdom,$tnum,$tsec) = split(/\//,$entry);                                  ($entry =~ m|^(cr/$match_domain/$match_username/\w+)\./($match_domain)/($match_username)/?(\w*)$|);
                 }                          } else {
                 my ($spec,$area,$trest,%allroles,%userroles);                             ($trole,$tdom,$tnum,$tsec) = split(/\//,$entry);
                 $area = '/'.$tdom.'/'.$tnum;                          }
                 $trest = $tnum;                          my ($spec,$area,$trest);
                 if ($tsec ne '') {                          $area = '/'.$tdom.'/'.$tnum;
                     $area .= '/'.$tsec;                          $trest = $tnum;
                     $trest .= '/'.$tsec;                          if ($tsec ne '') {
                 }                              $area .= '/'.$tsec;
                 $spec = $trole.'.'.$area;                              $trest .= '/'.$tsec;
                 if ($trole =~ /^cr/) {                          }
                     &Apache::lonnet::custom_roleprivs(\%allroles,$trole,                          $spec = $trole.'.'.$area;
                                                       $tdom,$spec,$trest,$area);                          if ($trole =~ /^cr/) {
                 } else {                              &Apache::lonnet::custom_roleprivs(\%allroles,$trole,
                     &Apache::lonnet::standard_roleprivs(\%allroles,$trole,                                                                $tdom,$spec,$trest,$area);
                                                        $tdom,$spec,$trest,$area);                          } else {
                 }                              &Apache::lonnet::standard_roleprivs(\%allroles,$trole,
                 my ($author,$adv) = &Apache::lonnet::set_userprivs(\%userroles,\%allroles);                                                                  $tdom,$spec,$trest,$area);
                 if ($userroles{'user.priv.'.$checkrole} =~ /evb\&([^\:]*)/) {                          }
                     if ($1) {                      }
                         $no_userblock = 1;                      my ($author,$adv) = &Apache::lonnet::set_userprivs(\%userroles,\%allroles);
                         last;                      if ($userroles{'user.priv.'.$checkrole} =~ /evb\&([^\:]*)/) {
                           if ($1) {
                               $no_userblock = 1;
                               last;
                           }
                     }                      }
                 }                  }
             } else {              } else {
Line 4188  sub blockcheck { Line 4210  sub blockcheck {
         # Retrieve blocking times and identity of locker for course          # Retrieve blocking times and identity of locker for course
         # of specified user, unless user has 'evb' privilege.          # of specified user, unless user has 'evb' privilege.
                   
         my ($start,$end)=&get_blocks($setters,$activity,$cdom,$cnum);          my ($start,$end,$trigger) = 
               &get_blocks($setters,$activity,$cdom,$cnum,$url);
         if (($start != 0) &&           if (($start != 0) && 
             (($startblock == 0) || ($startblock > $start))) {              (($startblock == 0) || ($startblock > $start))) {
             $startblock = $start;              $startblock = $start;
               if ($trigger ne '') {
                   $triggerblock = $trigger;
               }
         }          }
         if (($end != 0)  &&          if (($end != 0)  &&
             (($endblock == 0) || ($endblock < $end))) {              (($endblock == 0) || ($endblock < $end))) {
             $endblock = $end;              $endblock = $end;
               if ($trigger ne '') {
                   $triggerblock = $trigger;
               }
         }          }
     }      }
     return ($startblock,$endblock);      return ($startblock,$endblock,$triggerblock);
 }  }
   
 sub get_blocks {  sub get_blocks {
     my ($setters,$activity,$cdom,$cnum) = @_;      my ($setters,$activity,$cdom,$cnum,$url) = @_;
     my $startblock = 0;      my $startblock = 0;
     my $endblock = 0;      my $endblock = 0;
       my $triggerblock = '';
     my $course = $cdom.'_'.$cnum;      my $course = $cdom.'_'.$cnum;
     $setters->{$course} = {};      $setters->{$course} = {};
     $setters->{$course}{'staff'} = [];      $setters->{$course}{'staff'} = [];
     $setters->{$course}{'times'} = [];      $setters->{$course}{'times'} = [];
     my %records = &Apache::lonnet::dump('comm_block',$cdom,$cnum);      $setters->{$course}{'triggers'} = [];
     foreach my $record (keys(%records)) {      my (@blockers,%triggered);
         my ($start,$end) = ($record =~ m/^(\d+)____(\d+)$/);      my $now = time;
         if ($start <= time && $end >= time) {      my %commblocks = &Apache::lonnet::get_comm_blocks($cdom,$cnum);
             my ($staff_name,$staff_dom,$title,$blocks) =      if ($activity eq 'docs') {
                 &parse_block_record($records{$record});          @blockers = &Apache::lonnet::has_comm_blocking('bre',undef,$url,\%commblocks);
             if ($blocks->{$activity} eq 'on') {          foreach my $block (@blockers) {
                 push(@{$$setters{$course}{'staff'}},[$staff_name,$staff_dom]);              if ($block =~ /^firstaccess____(.+)$/) {
                 push(@{$$setters{$course}{'times'}}, [$start,$end]);                  my $item = $1;
                 if ( ($startblock == 0) || ($startblock > $start) ) {                  my $type = 'map';
                     $startblock = $start;                  my $timersymb = $item;
                   if ($item eq 'course') {
                       $type = 'course';
                   } elsif ($item =~ /___\d+___/) {
                       $type = 'resource';
                   } else {
                       $timersymb = &Apache::lonnet::symbread($item);
                   }
                   my $start = $env{'course.'.$cdom.'_'.$cnum.'.firstaccess.'.$timersymb};
                   my $end = $start + $env{'course.'.$cdom.'_'.$cnum.'.timerinterval.'.$timersymb};
                   $triggered{$block} = {
                                          start => $start,
                                          end   => $end,
                                          type  => $type,
                                        };
               }
           }
       } else {
           foreach my $block (keys(%commblocks)) {
               if ($block =~ m/^(\d+)____(\d+)$/) { 
                   my ($start,$end) = ($1,$2);
                   if ($start <= time && $end >= time) {
                       if (ref($commblocks{$block}) eq 'HASH') {
                           if (ref($commblocks{$block}{'blocks'}) eq 'HASH') {
                               if ($commblocks{$block}{'blocks'}{$activity} eq 'on') {
                                   unless(grep(/^\Q$block\E$/,@blockers)) {
                                       push(@blockers,$block);
                                   }
                               }
                           }
                       }
                 }                  }
                 if ( ($endblock == 0) || ($endblock < $end) ) {              } elsif ($block =~ /^firstaccess____(.+)$/) {
                     $endblock = $end;                  my $item = $1;
                   my $timersymb = $item; 
                   my $type = 'map';
                   if ($item eq 'course') {
                       $type = 'course';
                   } elsif ($item =~ /___\d+___/) {
                       $type = 'resource';
                   } else {
                       $timersymb = &Apache::lonnet::symbread($item);
                   }
                   my $start = $env{'course.'.$cdom.'_'.$cnum.'.firstaccess.'.$timersymb};
                   my $end = $start + $env{'course.'.$cdom.'_'.$cnum.'.timerinterval.'.$timersymb}; 
                   if ($start && $end) {
                       if (($start <= time) && ($end >= time)) {
                           unless (grep(/^\Q$block\E$/,@blockers)) {
                               push(@blockers,$block);
                               $triggered{$block} = {
                                                      start => $start,
                                                      end   => $end,
                                                      type  => $type,
                                                    };
                           }
                       }
                 }                  }
             }              }
         }          }
     }      }
     return ($startblock,$endblock);      foreach my $blocker (@blockers) {
           my ($staff_name,$staff_dom,$title,$blocks) =
               &parse_block_record($commblocks{$blocker});
           push(@{$$setters{$course}{'staff'}},[$staff_name,$staff_dom]);
           my ($start,$end,$triggertype);
           if ($blocker =~ m/^(\d+)____(\d+)$/) {
               ($start,$end) = ($1,$2);
           } elsif (ref($triggered{$blocker}) eq 'HASH') {
               $start = $triggered{$blocker}{'start'};
               $end = $triggered{$blocker}{'end'};
               $triggertype = $triggered{$blocker}{'type'};
           }
           if ($start) {
               push(@{$$setters{$course}{'times'}}, [$start,$end]);
               if ($triggertype) {
                   push(@{$$setters{$course}{'triggers'}},$triggertype);
               } else {
                   push(@{$$setters{$course}{'triggers'}},0);
               }
               if ( ($startblock == 0) || ($startblock > $start) ) {
                   $startblock = $start;
                   if ($triggertype) {
                       $triggerblock = $blocker;
                   }
               }
               if ( ($endblock == 0) || ($endblock < $end) ) {
                  $endblock = $end;
                  if ($triggertype) {
                      $triggerblock = $blocker;
                  }
               }
           }
       }
       return ($startblock,$endblock,$triggerblock);
 }  }
   
 sub parse_block_record {  sub parse_block_record {
Line 4251  sub parse_block_record { Line 4366  sub parse_block_record {
 }  }
   
 sub blocking_status {  sub blocking_status {
   my ($activity,$uname,$udom) = @_;      my ($activity,$uname,$udom,$url) = @_;
   my %setters;      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  # check for active blocking
   if (!wantarray) { return $blocked; }      my ($startblock,$endblock,$triggerblock) = 
           &blockcheck(\%setters,$activity,$uname,$udom,$url);
   # build a link to a popup window containing the details      my $blocked = 0;
   my $querystring  = "?activity=$activity";      if ($startblock && $endblock) {
   # $uname and $udom decide whose portfolio the user is trying to look at          $blocked = 1;
      $querystring .= "&amp;udom=$udom"      if $udom;      }
      $querystring .= "&amp;uname=$uname"    if $uname;  
   # caller just wants to know whether a block is active
   my $output .= <<'END_MYBLOCK';      if (!wantarray) { return $blocked; }
     function openWindow(url, wdwName, w, h, toolbar,scrollbar) {  
         var options = "width=" + w + ",height=" + h + ",";  # build a link to a popup window containing the details
         options += "resizable=yes,scrollbars="+scrollbar+",status=no,";      my $querystring  = "?activity=$activity";
         options += "menubar=no,toolbar="+toolbar+",location=no,directories=no";  # $uname and $udom decide whose portfolio the user is trying to look at
         var newWin = window.open(url, wdwName, options);      if ($activity eq 'port') {
         newWin.focus();          $querystring .= "&amp;udom=$udom"      if $udom;
     }          $querystring .= "&amp;uname=$uname"    if $uname;
       } elsif ($activity eq 'docs') {
           $querystring .= '&amp;url='.&HTML::Entities::encode($url,'&"');
       }
   
       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  END_MYBLOCK
   
   $output = Apache::lonhtmlcommon::scripttag($output);      $output = Apache::lonhtmlcommon::scripttag($output);
       
   my $popupUrl = "/adm/blockingstatus/$querystring";      my $popupUrl = "/adm/blockingstatus/$querystring";
   my $text = mt('Communication Blocked');      my $text = &mt('Communication Blocked');
       if ($activity eq 'docs') {
   $output .= <<"END_BLOCK";          $text = &mt('Content Access Blocked');
       } elsif ($activity eq 'printout') {
           $text = &mt('Printing Blocked');
       }
       $output .= <<"END_BLOCK";
 <div class='LC_comblock'>  <div class='LC_comblock'>
   <a onclick='openWindow("$popupUrl","Blocking Table",600,300,"no","no");return false;' href='/adm/blockingstatus/$querystring'    <a onclick='openWindow("$popupUrl","Blocking Table",600,300,"no","no");return false;' href='/adm/blockingstatus/$querystring'
   title='$text'>    title='$text'>
Line 4294  END_MYBLOCK Line 4420  END_MYBLOCK
   
 END_BLOCK  END_BLOCK
   
   return ($blocked, $output);      return ($blocked, $output);
 }  }
   
 ###############################################  ###############################################
Line 4993  sub standard_css { Line 5119  sub standard_css {
     my $mono                 = 'monospace';      my $mono                 = 'monospace';
     my $data_table_head      = $sidebg;      my $data_table_head      = $sidebg;
     my $data_table_light     = '#FAFAFA';      my $data_table_light     = '#FAFAFA';
     my $data_table_dark      = '#F0F0F0';      my $data_table_dark      = '#E0E0E0';
     my $data_table_darker    = '#CCCCCC';      my $data_table_darker    = '#CCCCCC';
     my $data_table_highlight = '#FFFF00';      my $data_table_highlight = '#FFFF00';
     my $mail_new             = '#FFBB77';      my $mail_new             = '#FFBB77';
Line 6080  div.LC_edit_problem_footer { Line 6206  div.LC_edit_problem_footer {
   font-weight: normal;    font-weight: normal;
   font-size:  medium;    font-size:  medium;
   margin: 2px;    margin: 2px;
     background-color: $sidebg;
 }  }
   
 div.LC_edit_problem_header,  div.LC_edit_problem_header,
Line 6096  div.LC_edit_problem_header_title { Line 6223  div.LC_edit_problem_header_title {
   font-size: larger;    font-size: larger;
   background: $tabbg;    background: $tabbg;
   padding: 3px;    padding: 3px;
     margin: 0 0 5px 0;
 }  }
   
 table.LC_edit_problem_header_title {  table.LC_edit_problem_header_title {
Line 8817  sub get_future_slots { Line 8945  sub get_future_slots {
   
 =pod  =pod
   
   =back
   
 =head1 HTTP Helpers  =head1 HTTP Helpers
   
 =over 4  =over 4
Line 9735  sub decompress_form { Line 9865  sub decompress_form {
     }      }
     $output .= '</p>';      $output .= '</p>';
     $output .= <<"START";      $output .= <<"START";
 <p>  
 $lt{'this'} $lt{'youm'}  
 </p>  
 <div id="uploadfileresult">  <div id="uploadfileresult">
   <form name="uploaded_decompress" action="$action" method="post">    <form name="uploaded_decompress" action="$action" method="post">
   <input type="hidden" name="archiveurl" value="$archiveurl" />    <input type="hidden" name="archiveurl" value="$archiveurl" />
Line 9857  sub process_decompression { Line 9984  sub process_decompression {
                         }                          }
                     }                      }
                     if (@contents > 0) {                      if (@contents > 0) {
                         my (%children,%parent);                          my (%children,%parent,%dirorder,%titles);
                         my $wantform = 1;                          my $wantform = 1;
                         my ($count,$datatable) = &get_extracted($docudom,$docuname,                          my ($count,$datatable) = &get_extracted($docudom,$docuname,
                                                                 $currdir,\%is_dir,                                                                  $currdir,\%is_dir,
                                                                 \%children,\%parent,                                                                  \%children,\%parent,
                                                                 \@contents,$wantform);                                                                  \@contents,\%dirorder,
                                                                   \%titles,$wantform);
                         if ($datatable ne '') {                          if ($datatable ne '') {
                             $output .= &archive_options_form('decompressed',$datatable,                              $output .= &archive_options_form('decompressed',$datatable,
                                                              $count,$hiddenelem);                                                               $count,$hiddenelem);
                             my $startcount = 3;                              my $startcount = 4;
                             $output .= &archive_javascript($startcount,$count,                              $output .= &archive_javascript($startcount,$count,
                                                            %children);                                                             \%titles,\%children);
                         }                          }
                     } else {                      } else {
                         $warning = &mt('No new items extracted from archive file.');                          $warning = &mt('No new items extracted from archive file.');
Line 9891  sub process_decompression { Line 10019  sub process_decompression {
 }  }
   
 sub get_extracted {  sub get_extracted {
     my ($docudom,$docuname,$currdir,$is_dir,$children,$parent,$contents,$wantform) = @_;      my ($docudom,$docuname,$currdir,$is_dir,$children,$parent,$contents,$dirorder,
           $titles,$wantform) = @_;
     my $count = 0;      my $count = 0;
     my $lastcontainer = 0;  
     my $depth = 0;      my $depth = 0;
     my $datatable;      my $datatable;
       my @hierarchy;
     return unless ((ref($is_dir) eq 'HASH') && (ref($children) eq 'HASH') &&      return unless ((ref($is_dir) eq 'HASH') && (ref($children) eq 'HASH') &&
                    (ref($parent) eq 'HASH') && (ref($contents) eq 'ARRAY'));                     (ref($parent) eq 'HASH') && (ref($contents) eq 'ARRAY') &&
                      (ref($dirorder) eq 'HASH') && (ref($titles) eq 'HASH'));
     foreach my $item (@{$contents}) {      foreach my $item (@{$contents}) {
         $count ++;          $count ++;
           @{$dirorder->{$count}} = @hierarchy;
           $titles->{$count} = $item;
         &archive_hierarchy($depth,$count,$parent,$children);          &archive_hierarchy($depth,$count,$parent,$children);
         if ($wantform) {          if ($wantform) {
             $datatable .= &archive_row($is_dir->{$item},$item,              $datatable .= &archive_row($is_dir->{$item},$item,
Line 9907  sub get_extracted { Line 10039  sub get_extracted {
         }          }
         if ($is_dir->{$item}) {          if ($is_dir->{$item}) {
             $depth ++;              $depth ++;
             $lastcontainer = $count;              push(@hierarchy,$count);
             $parent->{$depth} = $lastcontainer;              $parent->{$depth} = $count;
             $datatable .=              $datatable .=
                 &recurse_extracted_archive("$currdir/$item",$docudom,$docuname,                  &recurse_extracted_archive("$currdir/$item",$docudom,$docuname,
                                            \$depth,\$count,\$lastcontainer,                                             \$depth,\$count,\@hierarchy,$dirorder,
                                            $children,$parent,$wantform);                                             $children,$parent,$titles,$wantform);
             $depth --;              $depth --;
             $lastcontainer = $parent->{$depth};              pop(@hierarchy);
         }          }
     }      }
     return ($count,$datatable);      return ($count,$datatable);
 }  }
   
 sub recurse_extracted_archive {  sub recurse_extracted_archive {
     my ($currdir,$docudom,$docuname,$depth,$count,$lastcontainer,      my ($currdir,$docudom,$docuname,$depth,$count,$hierarchy,$dirorder,
         $children,$parent,$wantform) = @_;          $children,$parent,$titles,$wantform) = @_;
     my $result='';      my $result='';
     unless ((ref($depth)) && (ref($count)) && (ref($lastcontainer)) &&      unless ((ref($depth)) && (ref($count)) && (ref($hierarchy) eq 'ARRAY') &&
             (ref($children) eq 'HASH') && (ref($parent) eq 'HASH')) {              (ref($children) eq 'HASH') && (ref($parent) eq 'HASH') &&
               (ref($dirorder) eq 'HASH')) {
         return $result;          return $result;
     }      }
     my $dirptr = 16384;      my $dirptr = 16384;
Line 9936  sub recurse_extracted_archive { Line 10069  sub recurse_extracted_archive {
             my ($item,undef,undef,$testdir)=split(/\&/,$dir_line,5);              my ($item,undef,undef,$testdir)=split(/\&/,$dir_line,5);
             unless ($item =~ /^\.+$/) {              unless ($item =~ /^\.+$/) {
                 $$count ++;                  $$count ++;
                   @{$dirorder->{$$count}} = @{$hierarchy};
                   $titles->{$$count} = $item;
                 &archive_hierarchy($$depth,$$count,$parent,$children);                  &archive_hierarchy($$depth,$$count,$parent,$children);
   
                 my $is_dir;                  my $is_dir;
                 if ($dirptr&$testdir) {                  if ($dirptr&$testdir) {
                     $is_dir = 1;                      $is_dir = 1;
Line 9946  sub recurse_extracted_archive { Line 10082  sub recurse_extracted_archive {
                 }                  }
                 if ($is_dir) {                  if ($is_dir) {
                     $$depth ++;                      $$depth ++;
                     $$lastcontainer = $$count;                      push(@{$hierarchy},$$count);
                     $parent->{$$depth} = $$lastcontainer;                      $parent->{$$depth} = $$count;
                     $result .=                      $result .=
                         &recurse_extracted_archive("$currdir/$item",$docudom,                          &recurse_extracted_archive("$currdir/$item",$docudom,
                                                    $docuname,$depth,$count,                                                     $docuname,$depth,$count,
                                                    $lastcontainer,$children,                                                     $hierarchy,$dirorder,$children,
                                                    $parent,$wantform);                                                     $parent,$titles,$wantform);
                     $$depth --;                      $$depth --;
                     $$lastcontainer = $parent->{$$depth};                      pop(@{$hierarchy});
                 }                  }
             }              }
         }          }
Line 9976  sub archive_row { Line 10112  sub archive_row {
     my ($is_dir,$item,$currdir,$depth,$count) = @_;      my ($is_dir,$item,$currdir,$depth,$count) = @_;
     my ($name) = ($item =~ m{([^/]+)$});      my ($name) = ($item =~ m{([^/]+)$});
     my %choices = &Apache::lonlocal::texthash (      my %choices = &Apache::lonlocal::texthash (
                                        'display'    => 'Add as File',                                         'display'    => 'Add as file',
                                        'dependency' => 'Include as dependency',                                         'dependency' => 'Include as dependency',
                                        'discard'    => 'Discard',                                         'discard'    => 'Discard',
                                       );                                        );
     if ($is_dir) {      if ($is_dir) {
         $choices{'display'} = &mt('Add as Folder');           $choices{'display'} = &mt('Add as folder'); 
     }      }
     my $output = &start_data_table_row()."\n";      my $output = &start_data_table_row().'<td align="right">'.$count.'</td>'."\n";
       my $offset = 0;
     foreach my $action ('display','dependency','discard') {      foreach my $action ('display','dependency','discard') {
           $offset ++;
         $output .= '<td><span class="LC_nobreak">'.          $output .= '<td><span class="LC_nobreak">'.
                    '<label><input type="radio" name="archive_'.$count.                     '<label><input type="radio" name="archive_'.$count.
                    '" id="archive_'.$action.'_'.$count.'" value="'.$action.'"';                     '" id="archive_'.$action.'_'.$count.'" value="'.$action.'"';
Line 9992  sub archive_row { Line 10130  sub archive_row {
         if ($is_dir) {          if ($is_dir) {
             $output .= ' onclick="javascript:propagateCheck(this.form,'."'$count'".');"';              $output .= ' onclick="javascript:propagateCheck(this.form,'."'$count'".');"';
             if ($action eq 'display') {              if ($action eq 'display') {
                 $text = &mt('Add as Folder');                  $text = &mt('Add as folder');
             }              }
           } else {
               $output .= ' onclick="javascript:dependencyCheck(this.form,'."$count,$offset".');"';
   
         }          }
         $output .= ' />&nbsp;'.$choices{$action}.'</label></span></td>';          $output .= ' />&nbsp;'.$choices{$action}.'</label></span>';
           if ($action eq 'dependency') {
               $output .= '<div id="arc_depon_'.$count.'" style="display:none;">'."\n".
                          &mt('Used by:').'&nbsp;<select name="archive_dependent_on_'.$count.'" '.
                          'onchange="propagateSelect(this.form,'."$count,$offset".')">'."\n".
                          '<option value=""></option>'."\n".
                          '</select>'."\n".
                          '</div>';
           } elsif ($action eq 'display') {
               $output .= '<div id="arc_title_'.$count.'" style="display:none;">'."\n".
                          &mt('Title:').'&nbsp;<input type="text" name="archive_title_'.$count.'" id="archive_title_'.$count.'" />'."\n".
                          '</div>';
           }
           $output .= '</td>';
     }      }
     $output .= '<td><input type="hidden" name="archive_content_'.$count.'" value="'.      $output .= '<td><input type="hidden" name="archive_content_'.$count.'" value="'.
                &HTML::Entities::encode("$currdir/$item",'"<>&').'" />'.('&nbsp;' x 2);                 &HTML::Entities::encode("$currdir/$item",'"<>&').'" />'.('&nbsp;' x 2);
Line 10022  sub archive_options_form { Line 10176  sub archive_options_form {
                     '</p>'.                      '</p>'.
                     '<div class="LC_columnSection"><fieldset>'.                      '<div class="LC_columnSection"><fieldset>'.
                     '<legend>'.&mt('Content actions for all').'</legend>'.                      '<legend>'.&mt('Content actions for all').'</legend>'.
                     '<input type="button" value="'.&mt('Display in Contents').'" '.                      '<input type="button" value="'.&mt('Add as folder/file').'" '.
                     'onclick="javascript:checkAll(document.'.$form.",'display'".')" />'.                      'onclick="javascript:checkAll(document.'.$form.",'display'".')" />'.
                     '&nbsp;&nbsp;<input type="button" value="'.&mt('Include as dependency for a displayed item').'"'.                      '&nbsp;&nbsp;<input type="button" value="'.&mt('Include as dependency for a displayed file').'"'.
                     ' onclick="javascript:checkAll(document.'.$form.",'dependency'".')" />'.                      ' onclick="javascript:checkAll(document.'.$form.",'dependency'".')" />'.
                     '&nbsp;&nbsp;<input type="button" value="'.&mt('Discard').'"'.                      '&nbsp;&nbsp;<input type="button" value="'.&mt('Discard').'"'.
                     ' onclick="javascript:checkAll(document.'.$form.",'discard'".')" />'.                      ' onclick="javascript:checkAll(document.'.$form.",'discard'".')" />'.
Line 10039  sub archive_options_form { Line 10193  sub archive_options_form {
 }  }
   
 sub archive_javascript {  sub archive_javascript {
     my ($startcount,$numitems,%children) = @_;      my ($startcount,$numitems,$titles,$children) = @_;
       return unless ((ref($titles) eq 'HASH') && (ref($children) eq 'HASH'));
       my $maintitle = $env{'form.comment'};
     my $scripttag = <<START;      my $scripttag = <<START;
 <script type="text/javascript">  <script type="text/javascript">
 // <![CDATA[  // <![CDATA[
Line 10052  function checkAll(form,prefix) { Line 10208  function checkAll(form,prefix) {
             if (idstr.test(id)) {              if (idstr.test(id)) {
                 if (form.elements[i].type == 'radio') {                  if (form.elements[i].type == 'radio') {
                     form.elements[i].checked = true;                      form.elements[i].checked = true;
                       var nostart = i-$startcount;
                       var offset = nostart%7;
                       var count = (nostart-offset)/7;    
                       dependencyCheck(form,count,offset);
                 }                  }
             }              }
         }          }
Line 10060  function checkAll(form,prefix) { Line 10220  function checkAll(form,prefix) {
   
 function propagateCheck(form,count) {  function propagateCheck(form,count) {
     if (count > 0) {      if (count > 0) {
         var startelement = $startcount + (count-1) * 5;          var startelement = $startcount + ((count-1) * 7);
         for (var j=1; j<4; j++) {          for (var j=1; j<6; j++) {
             var item = startelement + j;               if ((j != 2) && (j != 4)) {
             if (form.elements[item].type == 'radio') {                  var item = startelement + j; 
                 if (form.elements[item].checked) {                  if (form.elements[item].type == 'radio') {
                     containerCheck(form,count,j);                      if (form.elements[item].checked) {
                     break;                          containerCheck(form,count,j);
                           break;
                       }
                 }                  }
             }              }
         }          }
Line 10074  function propagateCheck(form,count) { Line 10236  function propagateCheck(form,count) {
 }  }
   
 numitems = $numitems  numitems = $numitems
 var parents = new Array(numitems)  var titles = new Array(numitems);
   var parents = new Array(numitems);
 for (var i=0; i<numitems; i++) {  for (var i=0; i<numitems; i++) {
     parents[i] = new Array      parents[i] = new Array;
 }  }
   var maintitle = '$maintitle';
   
 START  START
   
     foreach my $container (sort { $a <=> $b } (keys(%children))) {      foreach my $container (sort { $a <=> $b } (keys(%{$children}))) {
         my @contents = split(/:/,$children{$container});          my @contents = split(/:/,$children->{$container});
         for (my $i=0; $i<@contents; $i ++) {          for (my $i=0; $i<@contents; $i ++) {
             $scripttag .= 'parents['.$container.']['.$i.'] = '.$contents[$i]."\n";              $scripttag .= 'parents['.$container.']['.$i.'] = '.$contents[$i]."\n";
         }          }
     }      }
   
       foreach my $key (sort { $a <=> $b } (keys(%{$titles}))) {
           $scripttag .= "titles[$key] = '".$titles->{$key}."';\n";
       }
   
     $scripttag .= <<END;      $scripttag .= <<END;
   
 function containerCheck(form,count,offset) {  function containerCheck(form,count,offset) {
     if (count > 0) {      if (count > 0) {
         var item = $startcount + ((count-1) * 5) + offset;          dependencyCheck(form,count,offset);
           var item = (offset+$startcount)+7*(count-1);
         form.elements[item].checked = true;          form.elements[item].checked = true;
         if(Object.prototype.toString.call(parents[count]) === '[object Array]') {          if(Object.prototype.toString.call(parents[count]) === '[object Array]') {
             if (parents[count].length > 0) {              if (parents[count].length > 0) {
                 for (var j=0; j<parents[count].length; j++) {                  for (var j=0; j<parents[count].length; j++) {
                     containerCheck(form,parents[count][j],offset)                      containerCheck(form,parents[count][j],offset);
                 }                  }
             }              }
         }          }
     }      }
 }  }
   
   function dependencyCheck(form,count,offset) {
       if (count > 0) {
           var chosen = (offset+$startcount)+7*(count-1);
           var depitem = $startcount + ((count-1) * 7) + 4;
           var currtype = form.elements[depitem].type;
           if (form.elements[chosen].value == 'dependency') {
               document.getElementById('arc_depon_'+count).style.display='block'; 
               form.elements[depitem].options.length = 0;
               form.elements[depitem].options[0] = new Option('Select','',true,true);
               for (var i=1; i<count; i++) {
                   var startelement = $startcount + (i-1) * 7;
                   for (var j=1; j<6; j++) {
                       if ((j != 2) && (j!= 4)) {
                           var item = startelement + j;
                           if (form.elements[item].type == 'radio') {
                               if (form.elements[item].checked) {
                                   if (form.elements[item].value == 'display') {
                                       var n = form.elements[depitem].options.length;
                                       form.elements[depitem].options[n] = new Option(titles[i],i,false,false);
                                   }
                               }
                           }
                       }
                   }
               }
           } else {
               document.getElementById('arc_depon_'+count).style.display='none';
               form.elements[depitem].options.length = 0;
               form.elements[depitem].options[0] = new Option('Select','',true,true);
           }
           titleCheck(form,count,offset);
       }
   }
   
   function propagateSelect(form,count,offset) {
       if (count > 0) {
           var item = (2+offset+$startcount)+7*(count-1);
           var picked = form.elements[item].options[form.elements[item].selectedIndex].value; 
           if (Object.prototype.toString.call(parents[count]) === '[object Array]') {
               if (parents[count].length > 0) {
                   for (var j=0; j<parents[count].length; j++) {
                       containerSelect(form,parents[count][j],offset,picked);
                   }
               }
           }
       }
   }
   
   function containerSelect(form,count,offset,picked) {
       if (count > 0) {
           var item = (1+offset+$startcount)+7*(count-1);
           if (form.elements[item].type == 'radio') {
               if (form.elements[item].value == 'dependency') {
                   if (form.elements[item+1].type == 'select-one') {
                       for (var i=0; i<form.elements[item+1].options.length; i++) {
                           if (form.elements[item+1].options[i].value == picked) {
                               form.elements[item+1].selectedIndex = i;
                               break;
                           }
                       }
                   }
                   if (Object.prototype.toString.call(parents[count]) === '[object Array]') {
                       if (parents[count].length > 0) {
                           for (var j=0; j<parents[count].length; j++) {
                               containerSelect(form,parents[count][j],offset,picked);
                           }
                       }
                   }
               }
           }
       }
   }
   
   function titleCheck(form,count,offset) {
       if (count > 0) {
           var chosen = (offset+$startcount)+7*(count-1);
           var depitem = $startcount + ((count-1) * 7) + 2;
           var currtype = form.elements[depitem].type;
           if (form.elements[chosen].value == 'display') {
               document.getElementById('arc_title_'+count).style.display='block';
               if ((count==1) && ((parents[count].length > 0) || (numitems == 1))) {
                   document.getElementById('archive_title_'+count).value=maintitle;
               }
           } else {
               document.getElementById('arc_title_'+count).style.display='none';
               if (currtype == 'text') { 
                   document.getElementById('archive_title_'+count).value='';
               }
           }
       }
       return;
   }
   
 // ]]>  // ]]>
 </script>  </script>
 END  END
Line 10151  sub process_extracted_files { Line 10414  sub process_extracted_files {
             }              }
         }          }
     }      }
     my ($output,%children,%parent);      my ($output,%children,%parent,%titles,%dirorder);
     if (keys(%toplevelitems) > 0) {      if (keys(%toplevelitems) > 0) {
         my @contents = sort(keys(%toplevelitems));          my @contents = sort(keys(%toplevelitems));
         my ($count,undef) = &get_extracted($docudom,$docuname,$currdir,\%is_dir,          (my $count,undef) = &get_extracted($docudom,$docuname,$currdir,\%is_dir,\%children,
                                            \%children,\%parent,\@contents);                                             \%parent,\@contents,\%dirorder,\%titles);
     }  
     my (@above,%hierarchy,%referrer,%orphaned,%todelete);  
     foreach my $depth (sort { $a <=> $b } keys(%parent)) {  
         push(@above,$parent{$depth});   
         foreach my $item (split(/:/,$children{$parent{$depth}})) {  
             $hierarchy{$item} = \@above;  
         }  
     }      }
       my (%referrer,%orphaned,%todelete,%newdest,%newseqid);
     if ($numitems) {      if ($numitems) {
         for (my $i=1; $i<=$numitems; $i++) {          for (my $i=1; $i<=$numitems; $i++) {
             my $path = $env{'form.archive_content_'.$i};              my $path = $env{'form.archive_content_'.$i};
Line 10175  sub process_extracted_files { Line 10432  sub process_extracted_files {
                         }                          }
                     }                      }
                 } elsif ($env{'form.archive_'.$i} eq 'display') {                  } elsif ($env{'form.archive_'.$i} eq 'display') {
                     my ($title,$url,$outer);                      my ($docstitle,$title,$url,$outer);
                     ($title) = ($path =~ m{/([^/]+)$});                      ($title) = ($path =~ m{/([^/]+)$});
                       $docstitle = $env{'form.archive_title_'.$i};
                       if ($docstitle eq '') {
                           $docstitle = $title;
                       }
                     $outer = 0;                      $outer = 0;
                     if (ref($hierarchy{$i}) eq 'ARRAY') {                      if (ref($dirorder{$i}) eq 'ARRAY') {
                         if (@{$hierarchy{$i}} > 0) {                          if (@{$dirorder{$i}} > 0) {
                             foreach my $item (reverse(@{$hierarchy{$i}})) {                              foreach my $item (reverse(@{$dirorder{$i}})) {
                                 if ($env{'form.archive_'.$item} eq 'display') {                                  if ($env{'form.archive_'.$item} eq 'display') {
                                     $outer = $item;                                      $outer = $item;
                                     last;                                      last;
Line 10195  sub process_extracted_files { Line 10456  sub process_extracted_files {
                     next if ($fatal);                      next if ($fatal);
                     if ((@archdirs > 0) && (grep(/^\Q$i\E$/,@archdirs))) {                      if ((@archdirs > 0) && (grep(/^\Q$i\E$/,@archdirs))) {
                         if ($context eq 'coursedocs') {                          if ($context eq 'coursedocs') {
                             $mapinner{$i} = time;                               $mapinner{$i} = time;
                             $folders{$i} = 'default_'.$mapinner{$i};                              $folders{$i} = 'default_'.$mapinner{$i};
                             $containers{$i} = 'sequence';                              $containers{$i} = 'sequence';
                             my $url = '/uploaded/'.$docudom.'/'.$docuname.'/'.                              my $url = '/uploaded/'.$docudom.'/'.$docuname.'/'.
                                       $folders{$i}.'.'.$containers{$i};                                        $folders{$i}.'.'.$containers{$i};
                             my $newidx = &LONCAPA::map::getresidx();                              my $newidx = &LONCAPA::map::getresidx();
                             $LONCAPA::map::resources[$newidx]=                              $LONCAPA::map::resources[$newidx]=
                                 $title.':'.$url.':false:normal:res';                                  $docstitle.':'.$url.':false:normal:res';
                             push(@LONCAPA::map::order,$newidx);                              push(@LONCAPA::map::order,$newidx);
                             my ($outtext,$errtext) =                              my ($outtext,$errtext) =
                                 &LONCAPA::map::storemap('/uploaded/'.$docudom.'/'.                                  &LONCAPA::map::storemap('/uploaded/'.$docudom.'/'.
                                                         $docuname.'/'.$folders{$outer}.                                                          $docuname.'/'.$folders{$outer}.
                                                         '.'.$containers{$outer},1);                                                          '.'.$containers{$outer},1);
                               $newseqid{$i} = $newidx;
                         }                          }
                     } else {                      } else {
                         if ($context eq 'coursedocs') {                          if ($context eq 'coursedocs') {
Line 10223  sub process_extracted_files { Line 10485  sub process_extracted_files {
                             }                              }
                             if (-e "$prefix$dir/$docstype/$mapinner{$outer}/$newidx") {                              if (-e "$prefix$dir/$docstype/$mapinner{$outer}/$newidx") {
                                 system("mv $prefix$path $prefix$dir/$docstype/$mapinner{$outer}/$newidx/$title");                                  system("mv $prefix$path $prefix$dir/$docstype/$mapinner{$outer}/$newidx/$title");
                                   $newdest{$i} = "$prefix$dir/$docstype/$mapinner{$outer}/$newidx";
                             }                              }
                             $LONCAPA::map::resources[$newidx]=                              $LONCAPA::map::resources[$newidx]=
                                 $title.':'.$url.':false:normal:res';                                  $docstitle.':'.$url.':false:normal:res';
                             push(@LONCAPA::map::order, $newidx);                              push(@LONCAPA::map::order, $newidx);
                             my ($outtext,$errtext)=                              my ($outtext,$errtext)=
                                 &LONCAPA::map::storemap('/uploaded/'.$docudom.'/'.                                  &LONCAPA::map::storemap('/uploaded/'.$docudom.'/'.
Line 10234  sub process_extracted_files { Line 10497  sub process_extracted_files {
                         }                          }
                     }                      }
                 } elsif ($env{'form.archive_'.$i} eq 'dependency') {                  } elsif ($env{'form.archive_'.$i} eq 'dependency') {
                     if (ref($hierarchy{$i}) eq 'ARRAY') {                      my ($title) = ($path =~ m{/([^/]+)$});
                         foreach my $item (reverse(@{$hierarchy{$i}})) {                      $referrer{$i} = $env{'form.archive_dependent_on_'.$i};
                             if ($env{'form.archive_'.$item} eq 'display') {                      if ($env{'form.archive_'.$referrer{$i}} eq 'display') {
                                 $referrer{$i} = $item;                          if (ref($dirorder{$i}) eq 'ARRAY') {
                                 last;                              my ($itemidx,$fullpath);
                                 #FIXME identify as dependency in db file                              for (my $j=0; $j<@{$dirorder{$i}}; $j++) {
                                 #FIXME need to move item to referrer location                                  if (ref($dirorder{$referrer{$i}}) eq 'ARRAY') {
                                 #FIXME need to setup httprefs so access allowed                                      my $container = $dirorder{$referrer{$i}}->[-1];
                             } elsif ($env{'form.archive_'.$item} eq 'discard') {                                      for (my $j=0; $j<@{$dirorder{$i}}; $j++) {
                                 $orphaned{$i} = $item;                                          if ($dirorder{$i}->[$j] eq $container) {
                                 last;                                              $itemidx = $j;
                                           }
                                       }
                                   }
                               }
                               if ($itemidx ne '') {
                                   if (grep(/^\Q$referrer{$i}\E$/,@archdirs)) {
                                       if ($mapinner{$referrer{$i}}) {
                                           $fullpath = "$prefix$dir/$docstype/$mapinner{$referrer{$i}}";
                                           for (my $j=$itemidx; $j<@{$dirorder{$i}}; $j++) {
                                               if (grep(/^\Q$dirorder{$i}->[$j]\E$/,@archdirs)) {
                                                   unless (defined($newseqid{$dirorder{$i}->[$j]})) {
                                                       $fullpath .= '/'.$titles{$dirorder{$i}->[$j]};
                                                       if (!-e $fullpath) {
                                                           mkdir($fullpath,0755);
                                                       }
                                                   }
                                               } else {
                                                   last;
                                               }
                                           }
                                       }
                                   } elsif ($newdest{$referrer{$i}}) {
                                       $fullpath = $newdest{$referrer{$i}};
                                       for (my $j=$itemidx; $j<@{$dirorder{$i}}; $j++) {
                                           if ($env{'form.archive_'.$dirorder{$i}->[$j]} eq 'discard') {
                                               $orphaned{$i} = $env{'form.archive_'.$dirorder{$i}->[$j]};
                                               last;
                                           } elsif (grep(/^\Q$dirorder{$i}->[$j]\E$/,@archdirs)) {
                                               unless (defined($newseqid{$dirorder{$i}->[$j]})) {
                                                   $fullpath .= '/'.$titles{$dirorder{$i}->[$j]};
                                                   if (!-e $fullpath) {
                                                       mkdir($fullpath,0755);
                                                   }
                                               }
                                           } else {
                                               last;
                                           }
                                       }
                                   }
                                   if ($fullpath ne '') {
                                       system("mv $prefix$path $fullpath/$title");
                                   }
                             }                              }
                         }                          }
                       } elsif ($env{'form.archive_'.$referrer{$i}} eq 'discard') {
                           $warning .= &mt('[_1] is a dependency of [_2], which was discarded.',
                                           $path,$env{'form.archive_content_'.$referrer{$i}}).'<br />';
                     }                      }
                 }                  }
             } else {              } else {
Line 12419  sub init_user_environment { Line 12727  sub init_user_environment {
   
 # See if old ID present, if so, remove  # See if old ID present, if so, remove
   
     my ($filename,$cookie,$userroles);      my ($filename,$cookie,$userroles,$firstaccenv,$timerintenv);
     my $now=time;      my $now=time;
   
     if ($public) {      if ($public) {
Line 12457  sub init_user_environment { Line 12765  sub init_user_environment {
           
 # Initialize roles  # Initialize roles
   
  $userroles=&Apache::lonnet::rolesinit($domain,$username,$authhost);   ($userroles,$firstaccenv,$timerintenv) = 
               &Apache::lonnet::rolesinit($domain,$username,$authhost);
     }      }
 # ------------------------------------ Check browser type and MathML capability  # ------------------------------------ Check browser type and MathML capability
   
Line 12532  sub init_user_environment { Line 12841  sub init_user_environment {
         }          }
   
  $env{'user.environment'} = "$lonids/$cookie.id";   $env{'user.environment'} = "$lonids/$cookie.id";
   
  if (tie(my %disk_env,'GDBM_File',"$lonids/$cookie.id",   if (tie(my %disk_env,'GDBM_File',"$lonids/$cookie.id",
  &GDBM_WRCREAT(),0640)) {   &GDBM_WRCREAT(),0640)) {
     &_add_to_env(\%disk_env,\%initial_env);      &_add_to_env(\%disk_env,\%initial_env);
     &_add_to_env(\%disk_env,\%userenv,'environment.');      &_add_to_env(\%disk_env,\%userenv,'environment.');
     &_add_to_env(\%disk_env,$userroles);      &_add_to_env(\%disk_env,$userroles);
               if (ref($firstaccenv) eq 'HASH') {
                   &_add_to_env(\%disk_env,$firstaccenv);
               }
               if (ref($timerintenv) eq 'HASH') {
                   &_add_to_env(\%disk_env,$timerintenv);
               }
     if (ref($args->{'extra_env'})) {      if (ref($args->{'extra_env'})) {
  &_add_to_env(\%disk_env,$args->{'extra_env'});   &_add_to_env(\%disk_env,$args->{'extra_env'});
     }      }

Removed from v.1.1055  
changed lines
  Added in v.1.1063


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>