version 1.77, 2011/03/21 00:56:58
|
version 1.78, 2011/03/25 01:34:49
|
Line 612 ENDMOVE
|
Line 612 ENDMOVE
|
$r->print('<td><ul>'); |
$r->print('<td><ul>'); |
foreach my $calcrule (split(/\,/,$categories{$id.'_calculations'})) { |
foreach my $calcrule (split(/\,/,$categories{$id.'_calculations'})) { |
$r->print('<li>'); |
$r->print('<li>'); |
$r->print(&pretty_prt_rule($calcrule)); |
my ($code,$value)=split(/\:/,$calcrule); |
|
$r->print(&pretty_prt_rule($cangrade,$id,$code,$value)); |
if ($cangrade) { |
if ($cangrade) { |
$r->print(' <a href="javascript:storecmd(\'delcalc_'.$id.'______'.$calcrule.'\');">'.&mt('Delete').'</a>'); |
$r->print(' <a href="javascript:storecmd(\'delcalc_'.$id.'______'.$code.'\');">'.&mt('Delete').'</a>'); |
} |
} |
$r->print('</li>'); |
$r->print('</li>'); |
} |
} |
Line 690 sub make_new_category {
|
Line 691 sub make_new_category {
|
# === Calculation Rule Editing |
# === Calculation Rule Editing |
|
|
sub pretty_prt_rule { |
sub pretty_prt_rule { |
my ($rule)=@_; |
my ($cangrade,$id,$code,$value)=@_; |
return $rule; |
my $cid=$id.'_'.$code; |
|
my %lt=&Apache::lonlocal::texthash( |
|
'droplow' => 'Drop N lowest grade assignments', |
|
'drophigh' => 'Drop N highest grade assignments', |
|
'capabove' => 'Cap percentage above N percent', |
|
'capbelow' => 'Cap percentage below N percent'); |
|
my $ret='<span class="LC_nobreak">'; |
|
if ($cangrade) { |
|
$ret.='<select name="sel_'.$cid.'">'; |
|
foreach my $calc (''=>'',sort(keys(%lt))) { |
|
$ret.='<option value="'.$calc.'"'.($calc eq $code?' selected="selected"':'').' />'.$lt{$calc}.'</input>'; |
|
} |
|
$ret.='</select> N=<input type="text" size="5" name="val_'.$cid.'" /></span>'; |
|
} else { |
|
$ret.=$lt{$code}.'; N='.$value; |
|
} |
|
$ret.='</span>'; |
|
return $ret; |
} |
} |
|
|
sub new_calc_rule_form { |
sub new_calc_rule_form { |
Line 723 sub del_calculation_rule {
|
Line 741 sub del_calculation_rule {
|
unless ($cangrade) { return %categories; } |
unless ($cangrade) { return %categories; } |
my @newcontent=(); |
my @newcontent=(); |
foreach my $current (split(/\,/,$categories{$id.'_calculations'})) { |
foreach my $current (split(/\,/,$categories{$id.'_calculations'})) { |
unless ($current eq $delcontent) { |
unless ($current=~/^\Q$delcontent\E\:/) { |
push(@newcontent,$current); |
push(@newcontent,$current); |
} |
} |
} |
} |