Diff for /loncom/interface/lonparmset.pm between versions 1.59 and 1.63

version 1.59, 2002/08/12 18:54:16 version 1.63, 2002/08/19 23:01:27
Line 437  sub get_env_multiple { Line 437  sub get_env_multiple {
     return(@values);      return(@values);
 }  }
   
   =pod
   
   =item B<extractResourceInformation>: Given the course data hash, extractResourceInformation extracts lots of information about the course's resources into a variety of hashes.
   
   Input: See list below:
   
   =over 4
   
   =item B<ids>: An array that will contain all of the ids in the course.
   
   =item B<typep>: hash, id->type, where "type" contains the extension of the file, thus, I<problem exam quiz assess survey form>.
   
   =item B<keyp>: hash, id->key list, will contain a comma seperated list of the meta-data keys available for the given id
   
   =item B<allparms>: hash, name of parameter->display value (what is the display value?)
   
   =item B<allparts>: hash, part identification->text representation of part, where the text representation is "[Part $part]"
   
   =item B<allkeys>: hash, full key to part->display value (what's display value?)
   
   =item B<allmaps>: hash, ???
   
   =item B<fcat>: ???
   
   =item B<defp>: hash, ???
   
   =item B<mapp>: ??
   
   =item B<symbp>: hash, id->full sym?
   
   =back
   
   =cut
   
   sub extractResourceInformation {
       my $bighash = shift;
       my $ids = shift;
       my $typep = shift;
       my $keyp = shift;
       my $allparms = shift;
       my $allparts = shift;
       my $allkeys = shift;
       my $allmaps = shift;
       my $fcat = shift;
       my $defp = shift;
       my $mapp = shift;
       my $symbp = shift;
   
       foreach (keys %$bighash) {
    if ($_=~/^src\_(\d+)\.(\d+)$/) {
       my $mapid=$1;
       my $resid=$2;
       my $id=$mapid.'.'.$resid;
       my $srcf=$$bighash{$_};
       if ($srcf=~/\.(problem|exam|quiz|assess|survey|form)$/) {
    $$ids[$#$ids+1]=$id;
    $$typep{$id}=$1;
    $$keyp{$id}='';
    foreach (split(/\,/,&Apache::lonnet::metadata($srcf,'keys'))) {
     if ($_=~/^parameter\_(.*)/) {
                       my $key=$_;
                       my $allkey=$1;
                       $allkey=~s/\_/\./g;
                       my $display= &Apache::lonnet::metadata($srcf,$key.'.display');
                       my $name=&Apache::lonnet::metadata($srcf,$key.'.name');
                       my $part= &Apache::lonnet::metadata($srcf,$key.'.part');
                       my $parmdis = $display;
                       $parmdis =~ s|(\[Part.*$)||g;
                       my $partkey = $part;
                       $partkey =~ tr|_|.|;
                       $$allparms{$name} = $parmdis;
                       $$allparts{$part} = "[Part $part]";
                       $$allkeys{$allkey}=$display;
                       if ($allkey eq $fcat) {
           $$defp{$id}= &Apache::lonnet::metadata($srcf,$key);
       }
       if ($$keyp{$id}) {
           $$keyp{$id}.=','.$key;
       } else {
           $$keyp{$id}=$key;
       }
     }
    }
    $$mapp{$id}=
       &Apache::lonnet::declutter($$bighash{'map_id_'.$mapid});
                   $$mapp{$mapid}=$$mapp{$id};
    $$allmaps{$mapid}=$$mapp{$id};
    $$symbp{$id}=$$mapp{$id}.
    '___'.$resid.'___'.
       &Apache::lonnet::declutter($srcf);
                   $$symbp{$mapid}=$$mapp{$id}.'___(all)';
       }
    }
       }
   }
   
 ##################################################  ##################################################
 ##################################################  ##################################################
   
Line 451  Inputs: $r Line 547  Inputs: $r
   
 Returns: nothing  Returns: nothing
   
   Variables used (guessed by Jeremy):
   
   =over 4
   
   =item B<pscat>: ParameterS CATegories? ends up a list of the types of parameters that exist, e.g., tol, weight, acc, opendate, duedate, answerdate, sig, maxtries, type.
   
   =item B<psprt>: ParameterS PaRTs? a list of the parts of a problem that we are displaying? Used to display only selected parts?
   
   =item B<allmaps>:
   
   =back
   
 =cut  =cut
   
 ##################################################  ##################################################
Line 580  sub assessparms { Line 688  sub assessparms {
  $r->print("Unable to access parameter data. (File $ENV{'request.course.fn'}_parms.db not tieable)");   $r->print("Unable to access parameter data. (File $ENV{'request.course.fn'}_parms.db not tieable)");
  return ;   return ;
     }      }
   
 # --------------------------------------------------------- Get all assessments  # --------------------------------------------------------- Get all assessments
     foreach (keys %bighash) {      extractResourceInformation(\%bighash, \@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allkeys, \%allmaps, $fcat, \%defp, \%mapp, \%symbp);
  if ($_=~/^src\_(\d+)\.(\d+)$/) {  
     my $mapid=$1;  
     my $resid=$2;  
     my $id=$mapid.'.'.$resid;  
     my $srcf=$bighash{$_};  
     if ($srcf=~/\.(problem|exam|quiz|assess|survey|form)$/) {  
  $ids[$#ids+1]=$id;  
  $typep{$id}=$1;  
  $keyp{$id}='';  
  foreach (split(/\,/,&Apache::lonnet::metadata($srcf,'keys'))) {  
   if ($_=~/^parameter\_(.*)/) {  
                     my $key=$_;  
                     my $allkey=$1;  
                     $allkey=~s/\_/\./g;  
                     my $display= &Apache::lonnet::metadata($srcf,$key.'.display');  
                     my $name=&Apache::lonnet::metadata($srcf,$key.'.name');  
                     my $part= &Apache::lonnet::metadata($srcf,$key.'.part');  
                     my $parmdis = $display;  
                     $parmdis =~ s|(\[Part.*$)||g;  
                     my $partkey = $part;  
                     $partkey =~ tr|_|.|;  
                     $allparms{$name} = $parmdis;  
                     $allparts{$part} = "[Part $part]";  
                     $allkeys{$allkey}=$display;  
                     if ($allkey eq $fcat) {  
         $defp{$id}= &Apache::lonnet::metadata($srcf,$key);  
     }  
     if ($keyp{$id}) {  
         $keyp{$id}.=','.$key;  
     } else {  
         $keyp{$id}=$key;  
     }  
   }  
  }  
  $mapp{$id}=  
     &Apache::lonnet::declutter($bighash{'map_id_'.$mapid});  
                 $mapp{$mapid}=$mapp{$id};  
  $allmaps{$mapid}=$mapp{$id};  
  $symbp{$id}=$mapp{$id}.  
  '___'.$resid.'___'.  
     &Apache::lonnet::declutter($srcf);  
                 $symbp{$mapid}=$mapp{$id}.'___(all)';  
     }  
  }  
     }  
     $mapp{'0.0'} = '';      $mapp{'0.0'} = '';
     $symbp{'0.0'} = '';      $symbp{'0.0'} = '';
 # ---------------------------------------------------------- Anything to store?  # ---------------------------------------------------------- Anything to store?
Line 725  sub assessparms { Line 790  sub assessparms {
     if ($pscat[0] eq "all" || !@pscat) {@pscat = (keys %allparms);}      if ($pscat[0] eq "all" || !@pscat) {@pscat = (keys %allparms);}
     if ($psprt[0] eq "all" || !@psprt) {@psprt = (keys %allparts);}      if ($psprt[0] eq "all" || !@psprt) {@psprt = (keys %allparts);}
 # ------------------------------------------------------------------ Start page  # ------------------------------------------------------------------ Start page
   
     &startpage($r,$id,$udom,$csec,$uname);      &startpage($r,$id,$udom,$csec,$uname);
 #    if ($ENV{'form.url'}) {  #    if ($ENV{'form.url'}) {
 # $r->print('<input type="hidden" value="'.$ENV{'form.url'}.  # $r->print('<input type="hidden" value="'.$ENV{'form.url'}.
Line 870  sub assessparms { Line 936  sub assessparms {
     $r->print('</table>');      $r->print('</table>');
   
     my @temp_psprt;      my @temp_psprt;
     map {      foreach my $t (@psprt) {
          my $t = $_;   push(@temp_psprt, grep {eval (/^$t\./ || ($_ == $t))} (keys %allparts));
          push(@temp_psprt,      }
          grep {eval (/^$t\./ || ($_ == $t))} (keys %allparts));  
     } @psprt;  
   
     @psprt = @temp_psprt;      @psprt = @temp_psprt;
   
Line 1034  ENDTABLEHEADFOUR Line 1098  ENDTABLEHEADFOUR
   
 #-------------------------------------------- for each map, gather information  #-------------------------------------------- for each map, gather information
             my $mapid;              my $mapid;
             foreach $mapid (keys %maplist) {      foreach $mapid (sort {$maplist{$a} cmp $maplist{$b}} keys %maplist) {
                 my $maptitle = $allmaps{$mapid};                  my $maptitle = $maplist{$mapid};
   
 #-----------------------  loop through ids and get all parameter types for map  #-----------------------  loop through ids and get all parameter types for map
 #-----------------------------------------          and associated information  #-----------------------------------------          and associated information
Line 1235  sub crsenv { Line 1299  sub crsenv {
             }              }
             if ($name eq 'url') {              if ($name eq 'url') {
  $value=~s/^\/res\///;   $value=~s/^\/res\///;
                   my $bkuptime=time;
                 my @tmp = &Apache::lonnet::get                  my @tmp = &Apache::lonnet::get
                     ('environment',['url'],$dom,$crs);                      ('environment',['url'],$dom,$crs);
                 $setoutput.='Backing up previous URL: '.                  $setoutput.='Backing up previous URL: '.
                     &Apache::lonnet::put                      &Apache::lonnet::put
                         ('environment',                          ('environment',
                          {'top level map backup ' => $tmp[1] },                           {'top level map backup '.$bkuptime => $tmp[1] },
                          $dom,$crs).                           $dom,$crs).
                     '<br>';                      '<br>';
             }              }
Line 1284  sub crsenv { Line 1349  sub crsenv {
              'pageseparators'  => '<b>Visibly Separate Items on Pages</b><br>'.               'pageseparators'  => '<b>Visibly Separate Items on Pages</b><br>'.
                                  '("<tt>yes</tt>" for visible separation)',                                   '("<tt>yes</tt>" for visible separation)',
              'pch.roles.denied'=> '<b>Disallow Resource Discussion for '.               'pch.roles.denied'=> '<b>Disallow Resource Discussion for '.
                                   'Roles</b> ' .                                     'Roles</b><br>"<tt>st</tt>": '.
    Apache::loncommon::help_open_topic("Course_Disable_Discussion")                                    'student, "<tt>ta</tt>": '.
                           ,                                    'TA, "<tt>in</tt>": '.
                                     'instructor;<br><tt>role,role,...</tt>) '.
          Apache::loncommon::help_open_topic("Course_Disable_Discussion"),
              'pch.users.denied' =>                'pch.users.denied' => 
                           '<b>Disallow Resource Discussion for Users</b><br>'.                            '<b>Disallow Resource Discussion for Users</b><br>'.
                                  '(<tt>user:domain,user:domain,...</tt>)',                                   '(<tt>user:domain,user:domain,...</tt>)',

Removed from v.1.59  
changed lines
  Added in v.1.63


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