Diff for /loncom/interface/lonparmset.pm between versions 1.583 and 1.584

version 1.583, 2017/11/12 23:05:42 version 1.584, 2017/12/18 23:13:53
Line 1856  sub extractResourceInformation { Line 1856  sub extractResourceInformation {
         my $srcf=$resource->src();          my $srcf=$resource->src();
         $srcf=~/\.(\w+)$/;          $srcf=~/\.(\w+)$/;
         $$typep{$id}=$1;          $$typep{$id}=$1;
           my $toolsymb;
           if ($srcf =~ /ext\.tool$/) {
               $toolsymb = $resource->symb();
           }
         $$keyp{$id}='';          $$keyp{$id}='';
         $$uris{$id}=$srcf;          $$uris{$id}=$srcf;
   
         foreach my $key (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys'))) {          foreach my $key (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys',$toolsymb))) {
             next if ($key!~/^parameter_/);              next if ($key!~/^parameter_/);
   
 # Hidden parameters  # Hidden parameters
             next if (&Apache::lonnet::metadata($srcf,$key.'.hidden') eq 'parm');              next if (&Apache::lonnet::metadata($srcf,$key.'.hidden',$toolsymb) eq 'parm');
 #  #
 # allparms is a hash of parameter names  # allparms is a hash of parameter names
 #  #
             my $name=&Apache::lonnet::metadata($srcf,$key.'.name');              my $name=&Apache::lonnet::metadata($srcf,$key.'.name',$toolsymb);
             if (!exists($$allparms{$name}) || $$allparms{$name} =~ m/^\s*$/ ) {              if (!exists($$allparms{$name}) || $$allparms{$name} =~ m/^\s*$/ ) {
                 my ($display,$parmdis);                  my ($display,$parmdis);
                 $display = &standard_parameter_names($name);                  $display = &standard_parameter_names($name);
                 if ($display eq '') {                  if ($display eq '') {
                     $display= &Apache::lonnet::metadata($srcf,$key.'.display');                      $display= &Apache::lonnet::metadata($srcf,$key.'.display',$toolsymb);
                     $parmdis = $display;                      $parmdis = $display;
                     $parmdis =~ s/\s*\[Part.*$//g;                      $parmdis =~ s/\s*\[Part.*$//g;
                 } else {                  } else {
Line 1881  sub extractResourceInformation { Line 1885  sub extractResourceInformation {
                 $$allparms{$name}=$parmdis;                  $$allparms{$name}=$parmdis;
                 if (ref($defkeytype)) {                  if (ref($defkeytype)) {
                     $$defkeytype{$name}=                      $$defkeytype{$name}=
                     &Apache::lonnet::metadata($srcf,$key.'.type');                      &Apache::lonnet::metadata($srcf,$key.'.type',$toolsymb);
                 }                  }
             }              }
   
 #  #
 # allparts is a hash of all parts  # allparts is a hash of all parts
 #  #
             my $part= &Apache::lonnet::metadata($srcf,$key.'.part');              my $part= &Apache::lonnet::metadata($srcf,$key.'.part',$toolsymb);
             $$allparts{$part} = &mt('Part: [_1]',$part);              $$allparts{$part} = &mt('Part: [_1]',$part);
 #  #
 # Remember all keys going with this resource  # Remember all keys going with this resource
Line 2112  sub lookUpTableParameter { Line 2116  sub lookUpTableParameter {
         'lenient' => 'grading',          'lenient' => 'grading',
         'retrypartial' => 'tries',          'retrypartial' => 'tries',
         'discussvote'  => 'misc',          'discussvote'  => 'misc',
         'examcode' => 'high_level_randomization',           'examcode' => 'high_level_randomization',
     );      );
 }  }
   
Line 3150  sub assessparms { Line 3154  sub assessparms {
                      .'</p>';                       .'</p>';
         }          }
     }      }
   
 #----------------------------------------------- if all selected, fill in array  #----------------------------------------------- if all selected, fill in array
     if ($pscat[0] eq "all") {      if ($pscat[0] eq "all") {
         @pscat = (keys(%allparms));          @pscat = (keys(%allparms));
Line 3404  ENDTABLEHEADFOUR Line 3409  ENDTABLEHEADFOUR
                     my %type=   ();                      my %type=   ();
                     my %default=();                      my %default=();
                     my $uri=&Apache::lonnet::declutter($uris{$rid});                      my $uri=&Apache::lonnet::declutter($uris{$rid});
                       my $toolsymb;
                       if ($uri =~ /ext\.tool$/) {
                           $toolsymb = $symbp{$rid};
                       }
   
                     my $filter=$env{'form.filter'};                      my $filter=$env{'form.filter'};
                     foreach my $tempkeyp (&keysplit($keyp{$rid})) {                      foreach my $tempkeyp (&keysplit($keyp{$rid})) {
                         if (grep $_ eq $tempkeyp, @catmarker) {                          if (grep $_ eq $tempkeyp, @catmarker) {
                             my $parmname=&Apache::lonnet::metadata($uri,$tempkeyp.'.name');                              my $parmname=&Apache::lonnet::metadata($uri,$tempkeyp.'.name',$toolsymb);
     # We may only want certain parameters listed      # We may only want certain parameters listed
                             if ($filter) {                              if ($filter) {
                                 unless ($filter=~/\Q$parmname\E/) { next; }                                  unless ($filter=~/\Q$parmname\E/) { next; }
                             }                              }
                             $name{$tempkeyp}=$parmname;                              $name{$tempkeyp}=$parmname;
                             $part{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp.'.part');                              $part{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp.'.part',$toolsymb);
   
                             my $parmdis=&Apache::lonnet::metadata($uri,$tempkeyp.'.display');                              my $parmdis=&Apache::lonnet::metadata($uri,$tempkeyp.'.display',$toolsymb);
                             if ($allparms{$name{$tempkeyp}} ne '') {                              if ($allparms{$name{$tempkeyp}} ne '') {
                                 my $identifier;                                  my $identifier;
                                 if ($parmdis =~ /(\s*\[Part.*)$/) {                                  if ($parmdis =~ /(\s*\[Part.*)$/) {
Line 3428  ENDTABLEHEADFOUR Line 3437  ENDTABLEHEADFOUR
                             }                              }
                             unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; }                              unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; }
                             $display{$tempkeyp}.=' ('.$name{$tempkeyp}.')';                              $display{$tempkeyp}.=' ('.$name{$tempkeyp}.')';
                             $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp);                              $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp,$toolsymb);
                             $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp.'.type');                              $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp.'.type',$toolsymb);
                             $thistitle=&Apache::lonnet::metadata($uri,$tempkeyp.'.title');                              $thistitle=&Apache::lonnet::metadata($uri,$tempkeyp.'.title',$toolsymb);
                         }                          }
                     }                      }
                     my $totalparms=scalar(keys(%name));                      my $totalparms=scalar(keys(%name));
Line 3521  ENDTABLEHEADFOUR Line 3530  ENDTABLEHEADFOUR
   
                     if ($map eq $mapid) {                      if ($map eq $mapid) {
                         my $uri=&Apache::lonnet::declutter($uris{$rid});                          my $uri=&Apache::lonnet::declutter($uris{$rid});
                           my $toolsymb;
                           if ($uri =~ /ext\.tool$/) {
                               $toolsymb = $symbp{$rid};
                           }
   
 #                    $r->print("Keys: $keyp{$rid} <br />\n");  #                    $r->print("Keys: $keyp{$rid} <br />\n");
   
Line 3537  ENDTABLEHEADFOUR Line 3550  ENDTABLEHEADFOUR
   
                             if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) {                              if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) {
                                 $part{$tempkeyp}="0";                                  $part{$tempkeyp}="0";
                                 $name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name');                                  $name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name',$toolsymb);
                                 my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display');                                  my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display',$toolsymb);
                                 if ($allparms{$name{$tempkeyp}} ne '') {                                  if ($allparms{$name{$tempkeyp}} ne '') {
                                     my $identifier;                                      my $identifier;
                                     if ($parmdis =~ /(\s*\[Part.*)$/) {                                      if ($parmdis =~ /(\s*\[Part.*)$/) {
Line 3551  ENDTABLEHEADFOUR Line 3564  ENDTABLEHEADFOUR
                                 unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; }                                  unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; }
                                 $display{$tempkeyp}.=' ('.$name{$tempkeyp}.')';                                  $display{$tempkeyp}.=' ('.$name{$tempkeyp}.')';
                                 $display{$tempkeyp} =~ s/_\w+_/_0_/;                                  $display{$tempkeyp} =~ s/_\w+_/_0_/;
                                 $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp);                                  $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp,$toolsymb);
                                 $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type');                                  $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type',$toolsymb);
                               }                                }
                         } # end loop through keys                          } # end loop through keys
                     }                      }
Line 3637  ENDTABLEHEADFOUR Line 3650  ENDTABLEHEADFOUR
                 my $rid = $id;                  my $rid = $id;
   
                 my $uri=&Apache::lonnet::declutter($uris{$rid});                  my $uri=&Apache::lonnet::declutter($uris{$rid});
                   my $toolsymb;
                   if ($uri =~ /ext\.tool$/) {
                       $toolsymb = $symbp{$rid};
                   }
   
 #--------------------------------------------------------------------  #--------------------------------------------------------------------
 # @catmarker contains list of all possible parameters including part #s  # @catmarker contains list of all possible parameters including part #s
Line 3650  ENDTABLEHEADFOUR Line 3667  ENDTABLEHEADFOUR
                     $tempkeyp =~ s/_\w+_/_0_/;                      $tempkeyp =~ s/_\w+_/_0_/;
                     if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) {                      if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) {
                         $part{$tempkeyp}="0";                          $part{$tempkeyp}="0";
                         $name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name');                          $name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name',$toolsymb);
                         my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display');                          my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display',$toolsymb);
                         if ($allparms{$name{$tempkeyp}} ne '') {                          if ($allparms{$name{$tempkeyp}} ne '') {
                             my $identifier;                              my $identifier;
                             if ($parmdis =~ /(\s*\[Part.*)$/) {                              if ($parmdis =~ /(\s*\[Part.*)$/) {
Line 3664  ENDTABLEHEADFOUR Line 3681  ENDTABLEHEADFOUR
                         unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; }                          unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; }
                         $display{$tempkeyp}.=' ('.$name{$tempkeyp}.')';                          $display{$tempkeyp}.=' ('.$name{$tempkeyp}.')';
                         $display{$tempkeyp} =~ s/_\w+_/_0_/;                          $display{$tempkeyp} =~ s/_\w+_/_0_/;
                         $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp);                          $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp,$toolsymb);
                         $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type');                          $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type',$toolsymb);
                     }                      }
                 } # end loop through keys                  } # end loop through keys
             } # end loop through ids              } # end loop through ids
Line 6596  sub parm_change_log { Line 6613  sub parm_change_log {
                     $parmitem = &mt($parmitem);                      $parmitem = &mt($parmitem);
                     $output .= &mt('Type: [_1]',$parmitem);                      $output .= &mt('Type: [_1]',$parmitem);
                 } else {                  } else {
                       my $toolsymb;
                       if ($middle =~ /ext\.tool$/) {
                           $toolsymb = $middle;
                       }
                     my ($level,@all)=&parmval_by_symb($what,$middle,                      my ($level,@all)=&parmval_by_symb($what,$middle,
                         &Apache::lonnet::metadata($middle,$what),                          &Apache::lonnet::metadata($middle,$what,$toolsymb),
                         $uname,$udom,$issection,$issection,$courseopt);                          $uname,$udom,$issection,$issection,$courseopt);
                     my $showvalue = $value;                      my $showvalue = $value;
                     if ($istype{$parmname} eq '') {                      if ($istype{$parmname} eq '') {

Removed from v.1.583  
changed lines
  Added in v.1.584


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