version 1.87, 2011/05/21 01:29:43
|
version 1.89, 2011/05/24 17:17:24
|
Line 569 sub output_category_table {
|
Line 569 sub output_category_table {
|
# |
# |
my @order=split(/\,/,$categories{'order'}); |
my @order=split(/\,/,$categories{'order'}); |
# |
# |
|
my %performance=&dumpdata($navmaps); |
my $maxpos=$#order; |
my $maxpos=$#order; |
for (my $i=0;$i<=$maxpos;$i++) { |
for (my $i=0;$i<=$maxpos;$i++) { |
my ($value,$weight)=&output_and_calc_category($r,$cangrade,$navmaps,$order[$i],$i,$maxpos,%categories); |
my ($value,$weight)=&output_and_calc_category($r,$cangrade,$navmaps,$order[$i],$i,$maxpos,\%performance,1,%categories); |
$sum+=$value*$weight; |
$sum+=$value*$weight; |
$total+=$weight; |
$total+=$weight; |
} |
} |
Line 603 sub output_category_table_header {
|
Line 604 sub output_category_table_header {
|
# |
# |
|
|
sub output_and_calc_category { |
sub output_and_calc_category { |
my ($r,$cangrade,$navmaps,$id,$currentpos,$maxpos,%categories)=@_; |
my ($r,$cangrade,$navmaps,$id,$currentpos,$maxpos,$performance,$output,%categories)=@_; |
my $value=0; |
my $value=0; |
my $weight=0; |
my $weight=0; |
my $iconpath = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL') . "/"); |
my $iconpath = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL') . "/"); |
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'up' => 'Move Up', |
'up' => 'Move Up', |
'dw' => 'Move Down'); |
'dw' => 'Move Down'); |
$r->print("\n".&Apache::loncommon::start_data_table_row()); |
if ($output) { $r->print("\n".&Apache::loncommon::start_data_table_row()); } |
|
|
if ($cangrade) { |
if ($output && $cangrade) { |
$r->print(<<ENDMOVE); |
$r->print(<<ENDMOVE); |
<td> |
<td> |
<div class="LC_docs_entry_move"> |
<div class="LC_docs_entry_move"> |
Line 639 ENDMOVE
|
Line 640 ENDMOVE
|
$r->print('<td><a href="javascript:storecmd(\'delcat_'.$id.'\');">'.&mt('Delete').'</a></td>'); |
$r->print('<td><a href="javascript:storecmd(\'delcat_'.$id.'\');">'.&mt('Delete').'</a></td>'); |
$r->print('<td><input type="text" name="name_'.$id. |
$r->print('<td><input type="text" name="name_'.$id. |
'" value="'.&Apache::lonhtmlcommon::entity_encode($categories{$id.'_name'}).'" /></td>'); |
'" value="'.&Apache::lonhtmlcommon::entity_encode($categories{$id.'_name'}).'" /></td>'); |
} else { |
} elsif ($output) { |
$r->print('<td>'.$categories{$id.'_name'}.'</td>'); |
$r->print('<td>'.$categories{$id.'_name'}.'</td>'); |
} |
} |
# Content |
# Content display and summing up of points |
$r->print('<td><ul>'); |
my $totalpossible=0; |
|
my $totalcorrect=0; |
|
if ($output) { $r->print('<td><ul>'); } |
foreach my $contentid (split(/\,/,$categories{$id.'_content'})) { |
foreach my $contentid (split(/\,/,$categories{$id.'_content'})) { |
$r->print('<li>'); |
my ($type,$possible,$attempted,$correct)=split(/\:/,$$performance{$contentid}); |
$r->print(&Apache::lonnet::gettitle($contentid)); |
$totalpossible+=$possible; |
if ($cangrade) { |
$totalcorrect+=$correct; |
$r->print(' <a href="javascript:storecmd(\'delcont_'.$id.'______'.$contentid.'\');">'.&mt('Delete').'</a>'); |
if ($output) { |
|
$r->print('<li>'); |
|
$r->print(&Apache::lonnet::gettitle($contentid).' ('.$correct.'/'.$possible.')'); |
|
if ($cangrade) { |
|
$r->print(' <a href="javascript:storecmd(\'delcont_'.$id.'______'.$contentid.'\');">'.&mt('Delete').'</a>'); |
|
} |
|
$r->print('</li>'); |
} |
} |
$r->print('</li>'); |
|
} |
} |
$r->print('</ul>'); |
if ($output) { |
if ($cangrade) { |
$r->print('</ul>'); |
$r->print('<br />'.&Apache::loncommon::selectresource_link('quickform','addcont_'.$id,&mt('Add Problem or Folder')).'<br />'); |
$r->print('<p>'.&mt('Total raw points: [_1]/[_2]',$totalcorrect,$totalpossible).'</p>'); |
|
if ($cangrade) { |
|
$r->print('<br />'.&Apache::loncommon::selectresource_link('quickform','addcont_'.$id,&mt('Add Problem or Folder')).'<br />'); |
|
} |
|
$r->print('</td>'); |
} |
} |
$r->print('</td>'); |
|
|
|
# Total |
# Total |
if ($cangrade) { |
if ($cangrade) { |
$r->print('<td>'. |
if ($output) { |
|
$r->print('<td>'. |
'<select name="totaltype_'.$id.'">'. |
'<select name="totaltype_'.$id.'">'. |
'<option value="default"'.($categories{$id.'_totaltype'} 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.'_totaltype'} 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. |
'<input type="text" size="4" name="total_'.$id. |
'" value="'.&Apache::lonhtmlcommon::entity_encode($categories{$id.'_total'}).'" /></td>'); |
'" value="'.&Apache::lonhtmlcommon::entity_encode($categories{$id.'_total'}).'" /></td>'); |
|
} |
} else { |
} else { |
$r->print('<td>'.($categories{$id.'_totaltype'} eq 'default'?&mt('default'):$categories{$id.'_total'}).'</td>'); |
if ($output) { |
|
$r->print('<td>'.($categories{$id.'_totaltype'} eq 'default'?&mt('default'):$categories{$id.'_total'}).'</td>'); |
|
} |
} |
} |
|
|
|
|
# Calculation |
# Calculation |
$r->print('<td><ul>'); |
if ($output) { $r->print('<td><ul>'); } |
foreach my $calcrule (split(/\,/,$categories{$id.'_calculations'})) { |
foreach my $calcrule (split(/\,/,$categories{$id.'_calculations'})) { |
$r->print('<li>'); |
if ($output) { $r->print('<li>'); } |
my ($code,$value)=split(/\:/,$calcrule); |
my ($code,$value)=split(/\:/,$calcrule); |
$r->print(&pretty_prt_rule($cangrade,$id,$code,$value)); |
if ($output) { $r->print(&pretty_prt_rule($cangrade,$id,$code,$value)); } |
if ($cangrade) { |
if ($cangrade) { |
$r->print(' <a href="javascript:storecmd(\'delrule_'.$id.'______'.$code.'\');">'.&mt('Delete').'</a>'); |
if ($output) { $r->print(' <a href="javascript:storecmd(\'delrule_'.$id.'______'.$code.'\');">'.&mt('Delete').'</a>'); } |
} |
} |
$r->print('</li>'); |
if ($output) { $r->print('</li>'); } |
} |
} |
$r->print('</ul>'); |
if ($output) { $r->print('</ul>'); } |
if ($cangrade) { |
if ($cangrade) { |
$r->print('<br />'.&new_calc_rule_form($id)); |
if ($output) { $r->print('<br />'.&new_calc_rule_form($id)); } |
} |
} |
$r->print('</td>'); |
if ($output) { $r->print('</td>'); } |
|
|
# Weight |
# Weight |
if ($cangrade) { |
if ($cangrade) { |
$r->print('<td>'. |
if ($output) { |
|
$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.'_weight'}.'</td>'); |
if ($output) { |
|
$r->print('<td>'.$categories{$id.'_weight'}.'</td>'); |
|
} |
} |
} |
# Achieved |
# Achieved |
$r->print('<td>'); |
if ($output) { $r->print('<td>'); } |
if ($cangrade) { |
if ($cangrade) { |
$r->print('<select name="displayachieved_'.$id.'">'. |
if ($output) { |
|
$r->print('<select name="displayachieved_'.$id.'">'. |
'<option value="percent"'.($categories{$id.'_displayachieved'} eq 'percent'?' selected="selected"':'').'>'.&mt('percent').'</option>'. |
'<option value="percent"'.($categories{$id.'_displayachieved'} eq 'percent'?' selected="selected"':'').'>'.&mt('percent').'</option>'. |
'<option value="points"'.($categories{$id.'_displayachieved'} eq 'points'?' selected="selected"':'').'>'.&mt('points').'</option>'. |
'<option value="points"'.($categories{$id.'_displayachieved'} eq 'points'?' selected="selected"':'').'>'.&mt('points').'</option>'. |
'</select>'); |
'</select>'); |
|
} |
} else { |
} else { |
if ($categories{$id.'_displayachieved'} eq 'percent') { |
if ($output) { |
$r->print(&mt('percent')); |
if ($categories{$id.'_displayachieved'} eq 'percent') { |
} else { |
$r->print(&mt('percent')); |
$r->print(&mt('points')); |
} else { |
|
$r->print(&mt('points')); |
|
} |
} |
} |
} |
} |
$r->print('</td>'); |
if ($output) { $r->print('</td>'); } |
|
|
return ($value,$weight); |
return ($value,$weight); |
} |
} |