Diff for /loncom/lonmap.pm between versions 1.10 and 1.11

version 1.10, 2013/05/30 04:02:02 version 1.11, 2013/05/30 05:04:16
Line 617  sub traceroute { Line 617  sub traceroute {
  my $hidden=&Apache::lonnet::EXT('resource.0.hiddenresource',$symb);   my $hidden=&Apache::lonnet::EXT('resource.0.hiddenresource',$symb);
   
  if ($hdnflag || lc($hidden) eq 'yes') {   if ($hdnflag || lc($hidden) eq 'yes') {
     $hiddenurl{$rid}=1;              my $ignorehidden;
               if (defined($hash->{'is_map_'.$rid})) {
                   if (($hash->{'context.nohideurl'}) && ($hash->{'context.nohideurl'} eq $hash->{'src_'.$rid})) {
                       $ignorehidden = 1; # Hidden parameter explicitly deleted 
                                          # if printing/grading bubblesheet exam
                   }
               }
               unless ($ignorehidden) {
           $hiddenurl{$rid}=1;
               }
  }   }
  if (!$hdnflag && lc($hidden) eq 'no') {   if (!$hdnflag && lc($hidden) eq 'no') {
     delete($hiddenurl{$rid});      delete($hiddenurl{$rid});
Line 782  sub parse_param { Line 791  sub parse_param {
     $hiddenurl{$referid}=1;      $hiddenurl{$referid}=1;
  }   }
     }      }
   
 }  }
   
   
Line 970  sub parse_resource { Line 978  sub parse_resource {
     if (($turi=~/\.sequence$/) ||      if (($turi=~/\.sequence$/) ||
  ($turi=~/\.page$/)) {   ($turi=~/\.page$/)) {
  $hash->{'is_map_'.$rid}='1'; # String in lonuserstate.   $hash->{'is_map_'.$rid}='1'; # String in lonuserstate.
           if ($hiddenurl{$rid}) {
               if (($hash->{'context.nohideurl'}) &&
                   ($hash->{'context.nohideurl'} eq $hash->{'src_'.$rid})) {
                   delete($hiddenurl{$rid}); # Hidden parameter explicitly deleted
                                             # if printing/grading bubblesheet exam  
               }
           }
   
  &read_map($turi,$rid,$code,$hash);   &read_map($turi,$rid,$code,$hash);
     }       } 
     return $token->[2]->{'id'};      return $token->[2]->{'id'};
Line 1399  sub read_map { Line 1415  sub read_map {
 #    $uname      - Name of the user for whom the course is being read  #    $uname      - Name of the user for whom the course is being read
 #    $udom       - Name of the domain of the user for whom the course is being read.  #    $udom       - Name of the domain of the user for whom the course is being read.
 #    $code       - CODE for which course is being read (CODEd assignments)  #    $code       - CODE for which course is being read (CODEd assignments)
   #    $nohideurl  - URL for an exam folder for which hidden state is to be ignored.
 #    $target_hash- Reference to the target hash into which all of this is read.  #    $target_hash- Reference to the target hash into which all of this is read.
 #                  Note tht some of the hash entries we need to build require knowledge of the  #                  Note tht some of the hash entries we need to build require knowledge of the
 #                  course URI.. these are expected to be filled in by the caller.  #                  course URI.. these are expected to be filled in by the caller.
Line 1407  sub read_map { Line 1424  sub read_map {
 #  #
 #    #  
 sub loadmap {  sub loadmap {
     my ($cnum, $cdom, $uname, $udom, $code, $target_hash) = @_;      my ($cnum, $cdom, $uname, $udom, $code, $nohideurl, $target_hash) = @_;
   
   
   
Line 1426  sub loadmap { Line 1443  sub loadmap {
     %mapalias_cache = ();      %mapalias_cache = ();
     %cenv           = ();      %cenv           = ();
     $map_number     =  0;      $map_number     =  0;
       
     #       # 
   
     $username   = $uname;      $username   = $uname;
Line 1477  sub loadmap { Line 1494  sub loadmap {
  $target_hash->{'context.username'} = $username;   $target_hash->{'context.username'} = $username;
  $target_hash->{'context.userdom'}  = $userdomain;   $target_hash->{'context.userdom'}  = $userdomain;
  $target_hash->{'context.courseid'} = $course_id;   $target_hash->{'context.courseid'} = $course_id;
    
           # When grading or printing a bubblesheet exam ignore
           # "hidden" parameter set in the map containing the exam folder.
           $target_hash->{'context.nohideurl'} = $nohideurl;
   
         &read_map($course_uri, '0.0', $code, $target_hash);          &read_map($course_uri, '0.0', $code, $target_hash);
   
  #   
   
  if (defined($target_hash->{'map_start_'.$map_uri})) {   if (defined($target_hash->{'map_start_'.$map_uri})) {
   
     &traceroute('0',$target_hash->{'map_start_'.$course_uri},'&', 0, 0, $target_hash);      &traceroute('0',$target_hash->{'map_start_'.$course_uri},'&', 0, 0, $target_hash);
Line 1561  Apache::lonmap - Construct a hash that r Line 1579  Apache::lonmap - Construct a hash that r
   
 =head1 SYNOPSIS  =head1 SYNOPSIS
   
 &Apache::lonmap::loadmap($filepath, \%target_hash);  &Apache::lonmap::loadmap($cnum, $cdom, $uname, $udom, $code, $nohideurl, \%target_hash);
   
 =head1 INTRODUCTION  =head1 INTRODUCTION
   
 This module reads a course filename into a hash reference.  It's up to the caller  This module reads a course filename into a hash reference.  It's up to the caller
 to to things like decide the has should be tied to some external file and handle the locking  to do things like decide that the hash should be tied to some external file and handle the
 if this file should be shared amongst several Apache children.  the locking if this file should be shared amongst several Apache children.
   
 =head1 SUBROUTINES  =head1 SUBROUTINES
   
 =over  =over
   
 =item loadmap($filepath, $targethash)  =item loadmap($cnum, $cdom, $uname, $udom, $code, $nohideurl, $targethash)
   
   
 Reads the map file into a target hash.  Reads the top-level map file into a target hash. This is done by first parsing the
   map file into local hashes and then unrolling those hashes into the big hash.
   
 =over  =over
   
 =item $filepath - The path to the map file to read.  =item $cnum - number of course being read.
   
   =item $cdom - domain in which the course is evaluated.
   
   =item $uname - name of the user for whom the course is being read.
   
   =item $udom  - name of the domain of the user for whom the course is being read.
   
   =item $code  - CODE for which course is being read (CODEd assignments).
   
   =item $nohideurl - URL for an exam folder for which hidden state is to be ignored.
   
 =item $targethash - A reference to hash into which the course is read.  =item $targethash - A reference to hash into which the course is read
   
 =back  =back
   

Removed from v.1.10  
changed lines
  Added in v.1.11


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