Diff for /loncom/interface/lonquickgrades.pm between versions 1.70 and 1.71

version 1.70, 2011/02/20 23:38:00 version 1.71, 2011/02/20 23:57:35
Line 462  sub process_category_edits { Line 462  sub process_category_edits {
 # Simply store the rest of the stuff  # Simply store the rest of the stuff
         foreach my $id (split(/\,/,$categories{'order'})) {          foreach my $id (split(/\,/,$categories{'order'})) {
             %categories=&set_category_name($cangrade,$id,$env{'form.name_'.$id},%categories);              %categories=&set_category_name($cangrade,$id,$env{'form.name_'.$id},%categories);
             %categories=&set_category_weight($cangrade,$id,$env{'form.weighttype_'.$id},$env{'form.weight_'.$id},%categories);              %categories=&set_category_total($cangrade,$id,$env{'form.totaltype_'.$id},$env{'form.total_'.$id},%categories);
               %categories=&set_category_weight($cangrade,$id,$env{'form.weight_'.$id},%categories);
 # More changes here  # More changes here
         }          }
     }      }
Line 505  sub output_category_table_header { Line 506  sub output_category_table_header {
     $r->print('<th>'.&mt('Category').'</th>'.      $r->print('<th>'.&mt('Category').'</th>'.
               '<th>'.&mt('Contents').'</th>'.                '<th>'.&mt('Contents').'</th>'.
               '<th>'.&mt('Calculation').'</th>'.                '<th>'.&mt('Calculation').'</th>'.
               '<th>'.&mt('Weight').'</th>'.                '<th>'.&mt('Total Points').'</th>'.
               '<th>'.&mt('Percent Overall').'</th>');                '<th>'.&mt('Relative Weight').'</th>');
     $r->print(&Apache::loncommon::end_data_table_header_row());      $r->print(&Apache::loncommon::end_data_table_header_row());
 }  }
   
Line 569  ENDMOVE Line 570  ENDMOVE
     } else {      } else {
        $r->print("<td>Calculation</td>");         $r->print("<td>Calculation</td>");
     }      }
 # Weight  # Total
     if ($cangrade) {      if ($cangrade) {
        $r->print('<td>'.         $r->print('<td>'.
                   '<select name="weighttype_'.$id.'">'.                    '<select name="totaltype_'.$id.'">'.
                   '<option value="default"'.($categories{$id.'_weighttype'} eq 'default'?' selected="selected"':'').'>'.&mt('default').'</option>'.                    '<option value="default"'.($categories{$id.'_totaltype'} eq 'default'?' selected="selected"':'').'>'.&mt('default').'</option>'.
                   '<option value="typein"'.($categories{$id.'_weighttype'} eq 'typein'?' selected="selected"':'').'>'.&mt('Type-in value').'</option>'.                    '<option value="typein"'.($categories{$id.'_totaltype'} eq 'typein'?' selected="selected"':'').'>'.&mt('Type-in value').'</option>'.
                   '</select>'.                    '</select>'.
                     '<input type="text" size="4" name="total_'.$id.
                     '" value="'.&Apache::lonhtmlcommon::entity_encode($categories{$id.'_total'}).'" /></td>');
       } else {
           $r->print('<td>'.($categories{$id.'_totaltype'} eq 'default'?&mt('default'):$categories{$id.'_total'}).'</td>');
       }
   # Weight
       if ($cangrade) {
          $r->print('<td>'.
                   '<input type="text" size="4" name="weight_'.$id.                    '<input type="text" size="4" name="weight_'.$id.
                   '" value="'.&Apache::lonhtmlcommon::entity_encode($categories{$id.'_weight'}).'" /></td>');                    '" value="'.&Apache::lonhtmlcommon::entity_encode($categories{$id.'_weight'}).'" /></td>');
     } else {      } else {
         $r->print('<td>'.($categories{$id.'_weighttype'} eq 'default'?&mt('default'):$categories{$id.'_weight'}).'</td>');          $r->print('<td>'.$categories{$id.'_weight'}.'</td>');
     }      }
   
     return ($value,$weight);      return ($value,$weight);
Line 617  sub make_new_category { Line 626  sub make_new_category {
     if (defined($ordernum)) {      if (defined($ordernum)) {
         %categories=&move_category($id,$cangrade,$ordernum,%categories);          %categories=&move_category($id,$cangrade,$ordernum,%categories);
     }      }
     $categories{$id.'_weighttype'}='default';      $categories{$id.'_weight'}=0;
       $categories{$id.'_totaltype'}='default';
     return %categories;      return %categories;
 }  }
   
Line 696  sub set_category_name { Line 706  sub set_category_name {
 }  }
   
 #  #
 # Set weight of a category  # Set total of a category
 #  #
 sub set_category_weight {  sub set_category_total {
     my ($cangrade,$id,$weighttype,$weight,%categories)=@_;      my ($cangrade,$id,$totaltype,$total,%categories)=@_;
     unless ($cangrade) { return %categories; }      unless ($cangrade) { return %categories; }
     if (($categories{$id.'_weight'} eq '') && ($weight=~/\d/)) {      if (($categories{$id.'_total'} eq '') && ($total=~/\d/)) {
         $weighttype='typein';          $totaltype='typein';
     }      }
     $categories{$id.'_weighttype'}=$weighttype;      $categories{$id.'_totaltype'}=$totaltype;
     if ($weighttype eq 'default') {      if ($totaltype eq 'default') {
         $categories{$id.'_weight'}='';          $categories{$id.'_total'}='';
     } else {      } else {
         $weight=~s/\D//gs;          $total=~s/\D//gs;
         unless ($weight) { $weight=0; }          unless ($total) { $total=0; }
         $categories{$id.'_weight'}=$weight;          $categories{$id.'_total'}=$total;
     }      }
     return %categories;      return %categories;
 }  }
   
   sub set_category_weight {
       my ($cangrade,$id,$weight,%categories)=@_;
       unless ($cangrade) { return %categories; }
       $weight=~s/\D//gs;
       unless ($weight) { $weight=0; }
       $categories{$id.'_weight'}=$weight;
       return %categories;
   }
   
 #  #
 # === end category-related  # === end category-related

Removed from v.1.70  
changed lines
  Added in v.1.71


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