[LON-CAPA-cvs] cvs: loncom /homework grades.pm /interface lonhtmlcommon.pm

www www@source.lon-capa.org
Tue, 13 Apr 2010 10:21:29 -0000


This is a MIME encoded message

--www1271154089
Content-Type: text/plain

www		Tue Apr 13 10:21:29 2010 EDT

  Modified files:              
    /loncom/homework	grades.pm 
    /loncom/interface	lonhtmlcommon.pm 
  Log:
  More breadcrumbs, remove unneeded code.
  
  
--www1271154089
Content-Type: text/plain
Content-Disposition: attachment; filename="www-20100413102129.txt"

Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.613 loncom/homework/grades.pm:1.614
--- loncom/homework/grades.pm:1.613	Mon Apr 12 22:19:53 2010
+++ loncom/homework/grades.pm	Tue Apr 13 10:21:21 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.613 2010/04/12 22:19:53 www Exp $
+# $Id: grades.pm,v 1.614 2010/04/13 10:21:21 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -800,7 +800,7 @@
 	    $contents.
 	    &Apache::loncommon::end_data_table()."\n";
     }
-    return $string.&show_grading_menu_form($symb);
+    return $string;
 }
 
 #--- This is called by a number of programs.
@@ -1082,7 +1082,6 @@
     } elsif ($ctr == 1) {
 	$gradeTable =~ s/type="checkbox"/type="checkbox" checked="checked"/;
     }
-    $gradeTable.=&show_grading_menu_form($symb);
     $request->print($gradeTable);
     return '';
 }
@@ -1896,7 +1895,6 @@
 	$request->print('<span class="LC_warning">Unable to view requested student.('.
 			$uname.':'.$udom.' in section '.$usec.' in course id '.
 			$env{'request.course.id'}.')</span>');
-	$request->print(&show_grading_menu_form($symb));
 	return;
     }
 
@@ -2225,10 +2223,6 @@
 	    'onclick="javascript:checksubmit(this.form,\'Grade Student\',\''
 	    .$counter.'\');" target="_self" /> &nbsp;'."\n" if (&canmodify($usec));
 	$toGrade.='</div>'."\n";
-	if (($env{'form.command'} eq 'submission') || 
-	    ($env{'form.command'} eq 'processGroup' && $counter == $total)) {
-	    $toGrade.='</form>'.&show_grading_menu_form($symb); 
-	}
 	$request->print($toGrade);
 	return;
     } else {
@@ -2328,7 +2322,6 @@
         $endform.="<input type='hidden' value='".&get_increment().
             "' name='increment' />";
 	$endform.='</td></tr></table></form>';
-	$endform.=&show_grading_menu_form($symb);
 	$request->print($endform);
     }
     return '';
@@ -2701,7 +2694,6 @@
 	my $the_end = '<h3><span class="LC_info">'.&mt('LON-CAPA User Message').'</span></h3><br />'."\n";
 	$the_end.=&mt('<b>Message: </b> No more students for this section or class.').'<br /><br />'."\n";
 	$the_end.=&mt('Click on the button below to return to the grading menu.').'<br /><br />'."\n";
-	$the_end.=&show_grading_menu_form($symb);
 	$request->print($the_end);
     }
     return '';
@@ -3432,7 +3424,6 @@
 	        $section_display, $stu_status).
 	    '</span>';
     }
-    $result.=&show_grading_menu_form($symb);
     return $result;
 }
 
@@ -3715,8 +3706,7 @@
 		&Apache::loncommon::end_data_table_row();
 	}
     }
-    $result .= &Apache::loncommon::end_data_table().
-	&show_grading_menu_form($symb);
+    $result .= &Apache::loncommon::end_data_table();
     my $msg = '<p><b>'.
 	&mt('Number of records updated = [_1] for [quant,_2,student].',
 	    $rec_update,$count).'</b><br />'.
@@ -3938,7 +3928,6 @@
                            &mt("How do I create a CSV file from a spreadsheet"))
     .'</td></tr></table>'."\n";
     $result.='</td></tr></table><br /><br />'."\n";
-    $result.=&show_grading_menu_form($symb);
     return $result;
 }
 
@@ -3985,7 +3974,6 @@
 	}
     }
     &csvuploadmap_footer($request,$i,$keyfields);
-    $request->print(&show_grading_menu_form($symb));
 
     return '';
 }
@@ -4029,7 +4017,6 @@
     # FIXME do a check for any invalid user ids?...
     $request->print('<input type="submit" value="Assign Grades" /><br />
 <hr /></form>'."\n");
-    $request->print(&show_grading_menu_form($symb));
     return '';
 }
 
@@ -4158,7 +4145,6 @@
 	$request->print(join(', ',@notallowed));
     }
     $request->print("<br />\n");
-    $request->print(&show_grading_menu_form($symb));
     return $error_msg;
 }
 #------------- end of section for handling csv file upload ---------
@@ -4288,7 +4274,6 @@
     $studentTable.='<input type="button" '.
                    'onclick="javascript:checkPickOne(this.form);" value="'.&mt('Next').' &rarr;" /></form>'."\n";
 
-    $studentTable.=&show_grading_menu_form($symb);
     $request->print($studentTable);
 
     return '';
@@ -4343,7 +4328,6 @@
 
     if (!&canview($usec)) {
 	$request->print('<span class="LC_warning">'.&mt('Unable to view requested student. ([_1])',$env{'form.student'}).'</span>');
-	$request->print(&show_grading_menu_form($symb));
 	return;
     }
     my $result='<h3><span class="LC_info">&nbsp;'.$env{'form.title'}.'</span></h3>';
@@ -4361,14 +4345,12 @@
     my $navmap = Apache::lonnavmaps::navmap->new();
     unless (ref($navmap)) {
         $request->print(&navmap_errormsg());
-        $request->print(&show_grading_menu_form($symb));
         return;
     }
     my ($mapUrl, $id, $resUrl)=&Apache::lonnet::decode_symb($env{'form.page'});
     my $map = $navmap->getResourceByUrl($resUrl); # add to navmaps
     if (!$map) {
 	$request->print('<span class="LC_warning">'.&mt('Unable to view requested sequence. ([_1])',$resUrl).'</span>');
-	$request->print(&show_grading_menu_form($symb));
 	return; 
     }
     my $iterator = $navmap->getIterator($map->map_start(),
@@ -4483,7 +4465,6 @@
         '<input type="button" value="'.&mt('Save').'" '.
         'onclick="javascript:checkSubmitPage(this.form,'.$question.');" />'.
         '</form>'."\n";
-    $studentTable.=&show_grading_menu_form($symb);
     $request->print($studentTable);
 
     return '';
@@ -4621,7 +4602,6 @@
     my $usec=$classlist->{$env{'form.student'}}[5];
     if (!&canmodify($usec)) {
 	$request->print('<span class="LC_warning">'.&mt('Unable to modify requested student ([_1])',$env{'form.student'}).'</span>');
-	$request->print(&show_grading_menu_form($env{'form.symb'}));
 	return;
     }
     my $result='<h3><span class="LC_info">&nbsp;'.$env{'form.title'}.'</span></h3>';
@@ -4640,7 +4620,6 @@
     my $map = $navmap->getResourceByUrl($resUrl); # add to navmaps
     if (!$map) {
 	$request->print('<span class="LC_warning">'.&mt('Unable to grade requested sequence ([_1]).',$resUrl).'</span>');
-	$request->print(&show_grading_menu_form($symb));
 	return; 
     }
     my $iterator = $navmap->getIterator($map->map_start(),
@@ -4766,7 +4745,6 @@
     }
 
     $studentTable.=&Apache::loncommon::end_data_table();
-    $studentTable.=&show_grading_menu_form($env{'form.symb'});
     my $grademsg=($changeflag == 0 ? &mt('No score was changed or updated.') :
 		  &mt('The scores were changed for [quant,_1,problem].',
 		  $changeflag));
@@ -5139,7 +5117,6 @@
         return;
     }
     my $default_form_data=&defaultFormData($symb);
-    my $grading_menu_button=&show_grading_menu_form($symb);
     my $file_selector=&scantron_uploads($file2grade);
     my $format_selector=&scantron_scantab();
     my $CODE_selector=&scantron_CODElist();
@@ -5301,7 +5278,6 @@
               &Apache::loncommon::end_data_table_row()."\n".
               &Apache::loncommon::end_data_table()."\n".
               '</form><br />');
-    $r->print($grading_menu_button);
     return;
 }
 
@@ -6226,7 +6202,7 @@
 <input type="hidden" name="command" value="scantron_validate" />
 ');
     }
-    $r->print("</form><br />".&show_grading_menu_form($symb));
+    $r->print("</form><br />");
     return '';
 }
 
@@ -6374,7 +6350,7 @@
 	    $r->print(" ".&mt("this scanline saving it for later."));
 	}
     }
-    $r->print(" </form><br />".&show_grading_menu_form($symb));
+    $r->print(" </form><br />");
     return '';
 }
 
@@ -7637,7 +7613,6 @@
     if ($ssi_error) {
 	$r->print("</form>");
 	&ssi_print_error($r);
-	$r->print(&show_grading_menu_form($symb));
         &Apache::lonnet::remove_lock($lock);
 	return '';		# Dunno why the other returns return '' rather than just returning.
     }
@@ -7715,7 +7690,6 @@
             $ssi_error = 0; # So end of handler error message does not trigger.
             $r->print("</form>");
             &ssi_print_error($r);
-            $r->print(&show_grading_menu_form($symb));
             &Apache::lonnet::remove_lock($lock);
             return '';      # Why return ''?  Beats me.
         }
@@ -7743,7 +7717,6 @@
                     $ssi_error = 0; # So end of handler error message does not trigger.
                     $r->print("</form>");
                     &ssi_print_error($r);
-                    $r->print(&show_grading_menu_form($symb));
                     &Apache::lonnet::remove_lock($lock);
                     delete($completedstudents{$uname});
                     return '';
@@ -7799,7 +7772,6 @@
 #    $r->print("<p>took $lasttime</p>");
 
     $r->print("</form>");
-    $r->print(&show_grading_menu_form($symb));
     return '';
 }
 
@@ -7935,9 +7907,7 @@
 	!&Apache::lonnet::allowed('usc',
 			    $env{'form.domainid'}.'_'.$env{'form.courseid'})) {
 	$r->print(&mt("You are not allowed to upload bubblesheet data to the requested course.")."<br />");
-	if ($symb) {
-	    $r->print(&show_grading_menu_form($symb));
-	} else {
+	unless ($symb) {
 	    $r->print($doanotherupload);
 	}
 	return '';
@@ -8078,7 +8048,6 @@
 	    '.&mt('The requested file name was invalid.').'
         </p>
 ');
-	$r->print(&show_grading_menu_form($symb));
 	return;
     }
     my $orig='/uploaded/'.$cdom.'/'.$cname.'/scantron_orig_'.$file;
@@ -8101,14 +8070,12 @@
 	      '<a href="'.$skipped.'">','</a>').'
     </p>
 ');
-    $r->print(&show_grading_menu_form($symb));
     return '';
 }
 
 sub checkscantron_results {
     my ($r,$symb) = @_;
     if (!$symb) {return '';}
-    my $grading_menu_button=&show_grading_menu_form($symb);
     my $cid = $env{'request.course.id'};
     my %lettdig = &letter_to_digits();
     my $numletts = scalar(keys(%lettdig));
@@ -8261,7 +8228,7 @@
                  &Apache::loncommon::end_data_table()).'<br />'.
                  &mt('Differences can occur if submissions were modified using manual grading after a bubblesheet grading pass.').'<br />'.&mt('If unexpected discrepancies were detected, it is recommended that you inspect the original bubblesheets.');  
     }
-    $r->print('</form><br />'.$grading_menu_button);
+    $r->print('</form><br />');
     return;
 }
 
@@ -8403,15 +8370,11 @@
 
 #-------------------------- Menu interface -------------------------
 #
-#--- Show a Grading Menu button - Calls the next routine ---
-sub show_grading_menu_form {
-    my ($symb)=@_;
-    my $result.='<br /><form action="/adm/grades" method="post">'."\n".
-	'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n".
-	'<input type="hidden" name="command" value="gradingmenu" />'."\n".
-	'<input type="submit" name="submit" value="'.&mt('Grading Menu').'" />'."\n".
-	'</form>'."\n";
-    return $result;
+#--- Href with symb and command ---
+
+sub href_symb_cmd {
+    my ($symb,$cmd)=@_;
+    return '/adm/grades?symb='.&HTML::Entities::encode(&Apache::lonenc::check_encrypt($symb),'<>&"').'&command='.$cmd;
 }
 
 sub grading_menu {
@@ -8544,7 +8507,6 @@
             </div>
         </div>
   </form>';
-    $result .= &show_grading_menu_form($symb);
     return $result;
 }
 
@@ -8570,7 +8532,6 @@
             </div>
         </div>
   </form>';
-    $result .= &show_grading_menu_form($symb);
     return $result;
 }
 
@@ -8600,7 +8561,6 @@
 
 
   </form>';
-    $result .= &show_grading_menu_form($symb);
     return $result;
 }
 
@@ -8829,7 +8789,6 @@
 ENDUPFORM
     $result.='</td></tr></table>'."\n".
              '</td></tr></table><br /><br />'."\n";
-    $result.=&show_grading_menu_form($symb);
     return $result;
 }
 
@@ -8843,11 +8802,11 @@
     my $result='';
     if (($env{'form.gradingmechanism'} eq 'specific') && ($env{'form.specificid'}!~/\w/)) {
 	$result.='<span class="LC_error">'.&mt('You need to specify a clicker ID for the correct answer').'</span>';
-	return $result.&show_grading_menu_form($symb);
+	return $result;
     }
     if (($env{'form.gradingmechanism'} eq 'given') && ($env{'form.givenanswer'}!~/\S/)) {
         $result.='<span class="LC_error">'.&mt('You need to specify the correct answer').'</span>';
-        return $result.&show_grading_menu_form($symb);
+        return $result;
     }
     my $foundgiven=0;
     if ($env{'form.gradingmechanism'} eq 'given') {
@@ -8894,7 +8853,7 @@
         $result.="</p>\n";
 	if ($number==0) {
 	    $result.='<span class="LC_error">'.&mt('No IDs found to determine correct answer').'</span>';
-	    return $result.&show_grading_menu_form($symb);
+	    return $result;
 	}
     }
     if (length($env{'form.upfile'}) < 2) {
@@ -8902,7 +8861,7 @@
 		     '<span class="LC_error">',
 		     '</span>',
 		     '<span class="LC_filename">'.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').'</span>');
-        return $result.&show_grading_menu_form($symb);
+        return $result;
     }
 
 # Were able to get all the info needed, now analyze the file
@@ -8941,7 +8900,7 @@
              '<br />';
     if (($env{'form.gradingmechanism'} eq 'given') && ($number!=$foundgiven)) {
        $result.='<span class="LC_error">'.&mt('Number of given answers does not agree with number of questions in file.').'</span>';
-       return $result.&show_grading_menu_form($symb);
+       return $result;
     } 
 # Remember Question Titles
 # FIXME: Possibly need delimiter other than ":"
@@ -9003,7 +8962,7 @@
     }
     $result.='</form></td></tr></table>'."\n".
              '</td></tr></table><br /><br />'."\n";
-    return $result.&show_grading_menu_form($symb);
+    return $result;
 }
 
 sub iclicker_eval {
@@ -9173,7 +9132,7 @@
     $result.='<br />'.&mt('Successfully stored grades for [quant,_1,student].',$storecount).
              '</td></tr></table>'."\n".
              '</td></tr></table><br /><br />'."\n";
-    return $result.&show_grading_menu_form($symb);
+    return $result;
 }
 
 sub navmap_errormsg {
@@ -9185,7 +9144,7 @@
 
 sub startpage {
     my ($r,$symb,$crumbs,$onlyfolderflag,$nodisplayflag) = @_;
-    unshift(@$crumbs,{href=>"/adm/grades?command=gradingmenu&symb=".&HTML::Entities::encode($symb,'<>&"'),text=>"Grading"});
+    unshift(@$crumbs,{href=>&href_symb_cmd($symb,'gradingmenu'),text=>"Grading"});
     $r->print(&Apache::loncommon::start_page('Grading',undef,
                                           {'bread_crumbs' => $crumbs}));
     unless ($nodisplayflag) {
@@ -9256,19 +9215,22 @@
             &startpage($request,$symb);
             $request->print(&submit_options($request,$symb));
         } elsif ($command eq 'table' && $perm{'vgr'}) {
-            &startpage($request,$symb,[{href=>"", text=>"Grading table"}],1);
+            &startpage($request,$symb,[{href=>"", text=>"Grading table"}]);
             $request->print(&submit_options_table($request,$symb));
         } elsif ($command eq 'all_for_one' && $perm{'vgr'}) {
             &startpage($request,$symb);
             $request->print(&submit_options_sequence($request,$symb));
 	} elsif ($command eq 'viewgrades' && $perm{'vgr'}) {
-            &startpage($request,$symb,[{href=>"/adm/grades?symb=".&HTML::Entities::encode($symb,'<>&"')."&command=table", text=>"Grading table"},{href=>'', text=>"Modify grades"}],1);
+            &startpage($request,$symb,[{href=>&href_symb_cmd($symb,"table"), text=>"Grading table"},{href=>'', text=>"Modify grades"}]);
 	    $request->print(&viewgrades($request,$symb));
 	} elsif ($command eq 'handgrade' && $perm{'mgr'}) {
             &startpage($request,$symb);
 	    $request->print(&processHandGrade($request,$symb));
 	} elsif ($command eq 'editgrades' && $perm{'mgr'}) {
-            &startpage($request,$symb);
+            &startpage($request,$symb,[{href=>&href_symb_cmd($symb,"table"), text=>"Grading table"},
+                                       {href=>&href_symb_cmd($symb,'viewgrades').'&group=all&section=all&Status=Active',
+                                                                             text=>"Modify grades"},
+                                       {href=>'', text=>"Store grades"}]);
 	    $request->print(&editgrades($request,$symb));
         } elsif ($command eq 'initialverifyreceipt' && $perm{'vgr'}) {
             &startpage($request,$symb);
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.270 loncom/interface/lonhtmlcommon.pm:1.271
--- loncom/interface/lonhtmlcommon.pm:1.270	Mon Apr 12 01:22:49 2010
+++ loncom/interface/lonhtmlcommon.pm	Tue Apr 13 10:21:29 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.270 2010/04/12 01:22:49 www Exp $
+# $Id: lonhtmlcommon.pm,v 1.271 2010/04/13 10:21:29 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1993,19 +1993,18 @@
    my ($symb,$onlyfolderflag)=@_;
    my $return='';
    if ($symb) {
-       my $title=&Apache::lonnet::gettitle($symb);
        $return=&Apache::loncommon::start_data_table();
-       unless ($onlyfolderflag) {
-          $return.=&Apache::loncommon::start_data_table_row().
-                    '<th>'.&mt('Resource:').'</th><td>'.$title.'</td>'.
-                    &Apache::loncommon::end_data_table_row();
-       }
        my ($map,$id,$resource)=&Apache::lonnet::decode_symb($symb);
        my $folder=&Apache::lonnet::gettitle($map);
        $return.=&Apache::loncommon::start_data_table_row().
                     '<th>'.&mt('Folder:').'</th><td>'.$folder.'</td>'.
-                    &Apache::loncommon::end_data_table_row().
-                    &Apache::loncommon::end_data_table();
+                    &Apache::loncommon::end_data_table_row();
+       unless ($onlyfolderflag) {
+          $return.=&Apache::loncommon::start_data_table_row().
+                    '<th>'.&mt('Resource:').'</th><td>'.&Apache::lonnet::gettitle($symb).'</td>'.
+                    &Apache::loncommon::end_data_table_row();
+       }
+       $return.=&Apache::loncommon::end_data_table();
     } else {
        $return='<p><span class="LC_error">'.&mt('No context provided.').'</span></p>';
     }

--www1271154089--