--- loncom/homework/grades.pm	2010/04/27 00:06:34	1.632
+++ loncom/homework/grades.pm	2010/12/04 15:02:26	1.639
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.632 2010/04/27 00:06:34 www Exp $
+# $Id: grades.pm,v 1.639 2010/12/04 15:02:26 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -44,6 +44,7 @@ use Apache::Constants qw(:common);
 use Apache::lonlocal;
 use Apache::lonenc;
 use Apache::lonstathelpers;
+use Apache::lonquickgrades;
 use String::Similarity;
 use LONCAPA;
 
@@ -1267,12 +1268,6 @@ sub sub_page_js {
 	    }
 	    
 	}
-	if (val == "Grade Student") {
-	    if (formname.Status.value == "") {
-		formname.Status.value = "Active";
-	    }
-	    formname.studentNo.value = total;
-	}
 	formname.submit();
     }
 
@@ -2214,13 +2209,8 @@ KEYWORDS
     $request->print('<input type="hidden" name="unamedom'.$counter.'" value="'.$uname.':'
 	.$udom.'" />'."\n");
     # return if view submission with no grading option
-# FIXME: the logic seems off here. Why show the grade button if you cannot grade?
     if (!&canmodify($usec)) {
-	my $toGrade.='<input type="button" value="Grade Student" '.
-	    'onclick="javascript:checksubmit(this.form,\'Grade Student\',\''
-	    .$counter.'\');" target="_self" /> &nbsp;'."\n" if (&canmodify($usec));
-	$toGrade.='</div>'."\n";
-	$request->print($toGrade);
+	$request->print('<p><span class="LC_warning">'.&mt('No grading privileges').'</span></p></div>');
 	return;
     } else {
 	$request->print('</div>'."\n");
@@ -2593,16 +2583,6 @@ sub processHandGrade {
 	return '';
     }
 
-# Go directly to grade student - from submission or link from chart page
-# FIXME: looks like reading off the button label!
-    if ($button eq 'Grade Student') {
-	my $processUser = $env{'form.unamedom'.$env{'form.studentNo'}};
-	($env{'form.student'},$env{'form.userdom'}) = split(/:/,$processUser);
-	$env{'form.fullname'} = $$fullname{$processUser};
-	&submission($request,0,0,$symb);
-	return '';
-    }
-
     # Get the next/previous one or group of students
     my $firststu = $env{'form.unamedom0'};
     my $laststu = $env{'form.unamedom'.($ngrade-1)};
@@ -4078,6 +4058,9 @@ sub csvuploadassign {
                     my $pcr=$entries{$fields{$dest}} / $wgt;
                     my $award=($pcr == 0) ? 'incorrect_by_override'
                                           : 'correct_by_override';
+                    if ($pcr>1) {
+                       push(@skipped,&mt("[_1]: point value larger than weight","$username:$domain"));
+                    }
                     $grades{"resource.$part.awarded"}=$pcr;
                     $grades{"resource.$part.solved"}=$award;
                     $points{$part}=1;
@@ -8401,32 +8384,32 @@ sub grading_menu {
                         {	linktext => 'Select individual students to grade',
                     		url => $url1a,
                     		permission => 'F',
-                    		icon => 'edit-find-replace.png',
+                    		icon => 'grade_students.png',
                     		linktitle => 'Grade current resource for a selection of students.'
                         }, 
                         {       linktext => 'Grade ungraded submissions.',
                                 url => $url1b,
                                 permission => 'F',
-                                icon => 'edit-find-replace.png',
+                                icon => 'ungrade_sub.png',
                                 linktitle => 'Grade all submissions that have not been graded yet.'
                         },
 
                         {       linktext => 'Grading table',
                                 url => $url1c,
                                 permission => 'F',
-                                icon => 'edit-find-replace.png',
+                                icon => 'grading_table.png',
                                 linktitle => 'Grade current resource for all students.'
                         },
                         {       linktext => 'Grade page/folder for one student',
                                 url => $url1d,
                                 permission => 'F',
-                                icon => 'edit-find-replace.png',
+                                icon => 'grade_PageFolder.png',
                                 linktitle => 'Grade all resources in current page/sequence/folder for one student.'
                         },
                         {       linktext => 'Download submissions',
                                 url => $url1e,
                                 permission => 'F',
-                                icon => 'edit-find-replace.png',
+                                icon => 'download_sub.png',
                                 linktitle => 'Download all students submissions.'
                         }]},
                          { categorytitle=>'Automated Grading',
@@ -8447,13 +8430,13 @@ sub grading_menu {
                 	    {	linktext => 'Grade/Manage/Review Bubblesheets',
                     		url => $url4,
                     		permission => 'F',
-                    		icon => 'stat.png',
+                    		icon => 'bubblesheet.png',
                     		linktitle => 'Grade scantron exams, upload/download scantron data files, and review previously graded scantron exams.'
                 	    },
                             {   linktext => 'Verify Receipt Number',
                                 url => $url5,
                                 permission => 'F',
-                                icon => 'edit-find-replace.png',
+                                icon => 'receipt_number.png',
                                 linktitle => 'Verify a system-generated receipt number for correct problem solution.'
                             }
 
@@ -8558,6 +8541,14 @@ sub submit_options {
 
 sub selectfield {
    my ($full)=@_;
+   my %options = 
+          (&Apache::lonlocal::texthash(
+             'yes'       => 'with submissions',
+             'queued'    => 'in grading queue',
+             'graded'    => 'with ungraded submissions',
+             'incorrect' => 'with incorrect submissions',
+             'all'       => 'with any status'),
+             'select_form_order' => ['yes','queued','graded','incorrect','all']);
    my $result='<div class="LC_columnSection">
   
     <fieldset>
@@ -8586,14 +8577,7 @@ sub selectfield {
       <legend>
         '.&mt('Submission Status').'
       </legend>'.
-       &Apache::loncommon::select_form('all','submitonly',
-          (&Apache::lonlocal::texthash(
-             'yes'       => 'with submissions',
-             'queued'    => 'in grading queue',
-             'graded'    => 'with ungraded submissions',
-             'incorrect' => 'with incorrect submissions',
-             'all'       => 'with any status'),
-             'select_form_order' => ['yes','queued','graded','incorrect','all'])).
+       &Apache::loncommon::select_form('all','submitonly',\%options).
    '</fieldset>';
     }
     $result.='</div><br />';
@@ -8718,8 +8702,8 @@ sub process_clicker {
     my $pcorrect=&mt("Percentage points for correct solution");
     my $pincorrect=&mt("Percentage points for incorrect solution");
     my $selectform=&Apache::loncommon::select_form($env{'form.upfiletype'},'upfiletype',
-						   ('iclicker' => 'i>clicker',
-                                                    'interwrite' => 'interwrite PRS'));
+						   {'iclicker' => 'i>clicker',
+                                                    'interwrite' => 'interwrite PRS'});
     $symb = &Apache::lonenc::check_encrypt($symb);
     $result.= &Apache::lonhtmlcommon::scripttag(<<ENDUPFORM);
 function sanitycheck() {
@@ -9157,7 +9141,7 @@ sub startpage {
     unshift(@$crumbs,{href=>&href_symb_cmd($symb,'gradingmenu'),text=>"Grading"});
     $r->print(&Apache::loncommon::start_page('Grading',undef,
                                           {'bread_crumbs' => $crumbs}));
-    $r->print('<h3>'.$$crumbs[-1]{'text'}.'</h3>');
+    &Apache::lonquickgrades::startGradeScreen($r,'grading');
     unless ($nodisplayflag) {
        $r->print(&Apache::lonhtmlcommon::resource_info_box($symb,$onlyfolderflag));
     }
@@ -9202,9 +9186,9 @@ sub handler {
     &Apache::lonenc::check_decrypt(\$symb);                             
 
     $ssi_error = 0;
-    if ($symb eq '' || $command eq '') {
+    if (($symb eq '' || $command eq '') && ($env{'request.course.id'})) {
 #
-# Not called from a resource
+# Not called from a resource, but inside a course
 #    
         &startpage($request,undef,[],1,1);
         &select_problem($request);
@@ -9350,6 +9334,7 @@ sub handler {
     if ($ssi_error) {
 	&ssi_print_error($request);
     }
+    &Apache::lonquickgrades::endGradeScreen($request);
     $request->print(&Apache::loncommon::end_page());
     &reset_caches();
     return '';