Diff for /loncom/interface/lonparmset.pm between versions 1.7 and 1.9

version 1.7, 2000/11/23 20:50:41 version 1.9, 2000/11/24 17:22:13
Line 9 Line 9
 #  #
 # 10/11,10/12,10/16 Gerd Kortemeyer)  # 10/11,10/12,10/16 Gerd Kortemeyer)
 #  #
 # 11/20,11/21,11/22,11/23 Gerd Kortemeyer  # 11/20,11/21,11/22,11/23,11/24,11/25 Gerd Kortemeyer
   
 package Apache::lonparmset;  package Apache::lonparmset;
   
Line 25  my %useropt; Line 25  my %useropt;
 my %bighash;  my %bighash;
 my %parmhash;  my %parmhash;
   
   my @outpar;
   
 my @ids;  my @ids;
 my %symbp;  my %symbp;
 my %typep;  my %typep;
Line 41  my $fcat; Line 43  my $fcat;
   
 sub parmval {  sub parmval {
     my ($what,$id)=@_;      my ($what,$id)=@_;
       my $result='';
 # ----------------------------------------------------- Cascading lookup scheme  # ----------------------------------------------------- Cascading lookup scheme
        my $symbparm=$symbp{$id}.'.'.$what;         my $symbparm=$symbp{$id}.'.'.$what;
        my $reslevel=         my $reslevel=
Line 52  sub parmval { Line 55  sub parmval {
             $ENV{'request.course.id'}.'.'.$what;              $ENV{'request.course.id'}.'.'.$what;
   
 # ----------------------------------------------------------- first, check user  # ----------------------------------------------------------- first, check user
         
       if ($uname) {        if ($uname) { 
        if ($useropt{$reslevel}) { return $useropt{$reslevel}; }         if ($useropt{$reslevel}) { $result=$useropt{$reslevel}; 
        if ($useropt{$seclevel}) { return $useropt{$seclevel}; }                                    $outpar[1]=$result; }
        if ($useropt{$courselevel}) { return $useropt{$courselevel}; }         if ($useropt{$seclevel}) { $result=$useropt{$seclevel};  
                                     $outpar[2]=$result; }
          if ($useropt{$courselevel}) { $result=$useropt{$courselevel};  
                                        $outpar[3]=$result; }
       }        }
   
 # -------------------------------------------------------- second, check course  # -------------------------------------------------------- second, check course
   
        if ($courseopt{$reslevel}) { return $courseopt{$reslevel}; }         if ($courseopt{$reslevel}) { $result=$courseopt{$reslevel};  
        if ($courseopt{$seclevel}) { return $courseopt{$seclevel}; }                                        $outpar[4]=$result; }
        if ($courseopt{$courselevel}) { return $courseopt{$courselevel}; }         if ($courseopt{$seclevel}) { $result=$courseopt{$seclevel};  
                                       $outpar[5]=$result; }  
          if ($courseopt{$courselevel}) { $result=$courseopt{$courselevel};  
                                          $outpar[6]=$result; }
   
 # ------------------------------------------------------ third, check map parms  # ------------------------------------------------------ third, check map parms
   
        my $thisparm=$parmhash{$symbparm};         my $thisparm=$parmhash{$symbparm};
        if ($thisparm) { return $thisparm; }         if ($thisparm) { $result=$thisparm;  
                           $outpar[7]=$result; }
             
 # --------------------------------------------- last, look in resource metadata  # --------------------------------------------- last, look in resource metadata
   
Line 81  sub parmval { Line 90  sub parmval {
             }              }
             if (join('',@content)=~              if (join('',@content)=~
                  /\<$what[^\>]*\>([^\<]*)\<\/$what\>/) {                   /\<$what[^\>]*\>([^\<]*)\<\/$what\>/) {
         return $1;          $result=$1; 
                   $outpar[8]=$result;
      }       }
         }          }
     return '';      return $result;
 }  }
   
 # ---------------------------------------------------------------- Sort routine  # ---------------------------------------------------------------- Sort routine
Line 97  sub bycat { Line 107  sub bycat {
     }      }
 }  }
   
   # ------------------------------------------------------------ Output for value
   
   sub valout {
       my ($value,$type)=@_;
       return
    ($value?(($type=~/^date/)?localtime($value):$value):'&nbsp;&nbsp;');
   }
   
 # -------------------------------------------------------- Produces link anchor  # -------------------------------------------------------- Produces link anchor
   
 sub plink {  sub plink {
     my ($type,$dis,$value,$marker,$return,$call)=@_;      my ($type,$dis,$value,$marker,$return,$call)=@_;
     return '<a href="javascript:pjump('."'".$type."','".$dis."','".$value."','"      return '<a href="javascript:pjump('."'".$type."','".$dis."','".$value."','"
            .$marker."','".$return."','".$call."'".');">'.        .$marker."','".$return."','".$call."'".');">'.
            (($type=~/^date/)?localtime($value):$value).'</a>';        &valout($value,$type).'</a>';
 }  }
   
 # ================================================================ Main Handler  # ================================================================ Main Handler
Line 141  sub handler { Line 159  sub handler {
       }        }
       if ($uhome eq 'no_host') {         if ($uhome eq 'no_host') { 
           $message=            $message=
          "<h3><font color=red>Unknown User $uname at Domain $udom</font></h3>";       "<h3><font color=red>Unknown user '$uname' at domain '$udom'</font></h3>";
           $uname='';             $uname=''; 
       }        }
   
Line 222  sub handler { Line 240  sub handler {
 </head>  </head>
 <body bgcolor="#FFFFFF" onUnload="pclose()">  <body bgcolor="#FFFFFF" onUnload="pclose()">
 <h1>Set Assessment Parameters</h1>  <h1>Set Assessment Parameters</h1>
   <form method="post" action="/adm/parmset" name="parmform">
   <h2>Course: $ENV{'course.'.$ENV{'request.course.id'}.'.description'}</h2>
   <b>
   Section/Group: 
   <input type="text" value="$csec" size="6" name="csec" 
   onBlur="this.form.submit();">
   <br>
   For User 
   <input type="text" value="$uname" size="12" name="uname" 
   onBlur="if (this.form.udom.value) { this.form.submit(); }"> 
   at Domain 
   <input type="text" value="$udom" size="6" name="udom" 
   onBlur="if (this.form.uname.value) { this.form.submit(); }">
   </b>
 ENDHEAD  ENDHEAD
  $r->print("<h2>Course: $ENV{'course.'.    
                    $ENV{'request.course.id'}.'.description'}</h2>");  
  if ($csec) {  
             $r->print("<h3>Section/Group: $csec</h3>");  
  }  
  if ($uname) {  
             $r->print("<h3>For User $uname at Domain $udom");  
  }  
  if ($uhome eq 'no_host') {   if ($uhome eq 'no_host') {
             $r->print($message);              $r->print($message);
          }           }
  $r->print("\n<table border=2>\n<tr>");          $r->print('<p>Sort list by ');
    $r->print('<select name="fcat" onChange="this.form.submit();">');
           my $k;
           my @sopt=('map','Map','name','Problem Name','deadline','Deadline');
           for ($k=0;$k<$#sopt;$k=$k+2) {
       $r->print('<option value="'.$sopt[$k].'"');
               if ($fcat eq $sopt[$k]) { $r->print(' selected'); }
               $r->print('>'.$sopt[$k+1].'</option>');
           }
           $r->print('</select>');
    $r->print(<<ENDTABLEHEAD);
   <p><table border=2>
   <tr><th>Assessment URL and Title</th><th>Part No.</th><th>Parameter Name</th>
   <th>Resource Metadata</th><th>Enclosing Map Parameter</th>
   <th>Course</th>
   ENDTABLEHEAD
       if ($csec) {
    $r->print('<th>Section/Group: '.$csec.'</th>');
       }
    $r->print('<th>Resource in Course</th>');
    if ($uname) {
       $r->print('<th>User in Course</th>');
               if ($csec) {
    $r->print('<th>User in Section/Group: '.$csec.'</th>');
               }
               $r->print('<th>User for Resource in Course</th>');
    }
    $r->print('<tr>');
   map {    map {
 # ------------------------------------------------------ Entry for one resource  # ------------------------------------------------------ Entry for one resource
       @outpar=();
             my $rid=$_;              my $rid=$_;
             my $thistitle='';              my $thistitle='';
             my @part=(0,1,1);              my @part=(0,1,1);
Line 261  ENDHEAD Line 314  ENDHEAD
             } keys %metadata;              } keys %metadata;
             my $totalparms=$#name+1;              my $totalparms=$#name+1;
             $r->print('<td rowspan='.$totalparms.'><tt><font size=-1>'.              $r->print('<td rowspan='.$totalparms.'><tt><font size=-1>'.
                 $bighash{'src_'.$rid}.'</font></tt><p><b>'.            join(' / ',split(/\//,$bighash{'src_'.$rid})).'</font></tt><p><b>'.
                       $bighash{'title_'.$rid});                        $bighash{'title_'.$rid});
             if ($thistitle) {              if ($thistitle) {
  $r->print(' ('.$thistitle.')');   $r->print(' ('.$thistitle.')');
Line 269  ENDHEAD Line 322  ENDHEAD
             $r->print('</b></td>');              $r->print('</b></td>');
             my $i;              my $i;
             for ($i=0;$i<$totalparms;$i++) {              for ($i=0;$i<$totalparms;$i++) {
                $r->print("<td>$part[$i]</td><td>$display[$i]</td>");                 $r->print("<td>$part[$i]</td><td>$display[$i]</td>"); 
                $r->print('<td>'.&plink($type[$i],$display[$i],'987684455').'</td>');                 $r->print('<td>'.&valout($outpar[8],$type[$i]).'</td>');
                  $r->print('<td>'.&valout($outpar[7],$type[$i]).'</td>');
                  $r->print('<td>'.
                     &plink($type[$i],$display[$i],$outpar[6]).'</td>');
                  if ($csec) {
                     $r->print('<td>'.
                     &plink($type[$i],$display[$i],$outpar[5]).'</td>');
                  }
                  $r->print('<td>'.
                     &plink($type[$i],$display[$i],$outpar[4]).'</td>');
                  if ($uname) {
                   $r->print('<td>'.
                     &plink($type[$i],$display[$i],$outpar[3]).'</td>');
                   if ($csec) {
                     $r->print('<td>'.
                     &plink($type[$i],$display[$i],$outpar[2]).'</td>');
                   }
                   $r->print('<td>'.
                     &plink($type[$i],$display[$i],$outpar[1]).'</td>');
                  }
                $r->print("</tr>\n<tr>");                 $r->print("</tr>\n<tr>");
    }     }
 # -------------------------------------------------- End entry for one resource  # -------------------------------------------------- End entry for one resource
  } @ids;   } @ids;
          $r->print('</table></body></html>');           $r->print('</table></form></body></html>');
          untie(%bighash);           untie(%bighash);
  untie(%parmhash);   untie(%parmhash);
       }        }

Removed from v.1.7  
changed lines
  Added in v.1.9


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