[LON-CAPA-cvs] cvs: loncom /interface lonquickgrades.pm /interface/spreadsheet classcalc.pm lonspreadsheet.pm

www www@source.lon-capa.org
Fri, 03 Dec 2010 21:33:56 -0000


This is a MIME encoded message

--www1291412036
Content-Type: text/plain

www		Fri Dec  3 21:33:56 2010 EDT

  Modified files:              
    /loncom/interface	lonquickgrades.pm 
    /loncom/interface/spreadsheet	classcalc.pm lonspreadsheet.pm 
  Log:
  Work-in-progress: Grading
  
  
--www1291412036
Content-Type: text/plain
Content-Disposition: attachment; filename="www-20101203213356.txt"

Index: loncom/interface/lonquickgrades.pm
diff -u loncom/interface/lonquickgrades.pm:1.54 loncom/interface/lonquickgrades.pm:1.55
--- loncom/interface/lonquickgrades.pm:1.54	Fri Dec  3 15:21:35 2010
+++ loncom/interface/lonquickgrades.pm	Fri Dec  3 21:33:52 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Quick Student Grades Display
 #
-# $Id: lonquickgrades.pm,v 1.54 2010/12/03 15:21:35 www Exp $
+# $Id: lonquickgrades.pm,v 1.55 2010/12/03 21:33:52 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -61,9 +61,9 @@
     &Apache::loncommon::no_cache($r);
     $r->send_http_header;
 
-    my $showPoints = 
+    my $showPoints =
         $env{'course.'.$env{'request.course.id'}.'.grading'} eq 'standard';
-    my $notshowSPRSlink = 
+    my $notshowSPRSlink =
         (($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'external')
       || ($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'externalnototals'));
     my $notshowTotals=
@@ -72,25 +72,13 @@
         $env{'course.'.$env{'request.course.id'}.'.grading'} eq 'categories';
 
 
-    # Header
     my $title = "Grading and Statistics";#$showPoints ? "Points Display" : "Completed Problems Display";
     my $brcrum = [{href=>"/adm/quickgrades",text => "Points Display"}];
     $r->print(&Apache::loncommon::start_page($title,undef,
                                             {'bread_crumbs' => $brcrum})
              );
 
-    $r->print(&Apache::lonhtmlcommon::coursepreflink(&mt('Grade display settings'),'grading'));
-
-    if (!$showPoints && !$notshowSPRSlink ) {
-        $r->print('<p>'
-                 .&mt('This screen shows how many problems (or problem parts) you have completed'
-                     .', and how many you have not yet done.'
-                     .' You can also look at [_1]a detailed score sheet[_2].'
-                     ,'<a href="/adm/studentcalc">','</a>')
-                 .'</p>');
-    }
-
-    $r->print('<p class="LC_info">'.&mt('This may take a few moments to display.').'</p>');
+    &startGradeScreen($r,'quick');
 
     $r->rflush();
 
@@ -110,10 +98,56 @@
        &outputTable($r,$showPoints,$notshowTotals,
                  $navmap,$totalParts,$totalPossible,$totalRight,$totalAttempted,$topLevelParts,$topLevelRight,$topLevelAttempted);
     }
+    &endGradeScreen($r);
     return OK;
 
 }
 
+sub startGradeScreen {
+    my ($r,$mode)=@_;
+
+    my $showPoints =
+        $env{'course.'.$env{'request.course.id'}.'.grading'} eq 'standard';
+    my $notshowSPRSlink =
+        (($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'external')
+      || ($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'externalnototals')
+      || ($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'categories'));
+    my $notshowTotals=
+        $env{'course.'.$env{'request.course.id'}.'.grading'} eq 'externalnototals';
+    my $showCategories=
+        $env{'course.'.$env{'request.course.id'}.'.grading'} eq 'categories';
+
+    my $allowed_to_view =  &Apache::lonnet::allowed('vgr',$env{'request.course.id'});
+    my $allowed_to_edit =  &Apache::lonnet::allowed('mgr',$env{'request.course.id'});
+
+    if ($allowed_to_view) {
+       $r->print('<table><tr>');
+       if ($notshowTotals)  { $r->print ('<td>'.&mt('Students do not see total points.').'</td>'); }
+       if ($notshowSPRSlink){ $r->print ('<td>'.&mt('Students do not see link to spreadsheet.').'</td>'); }
+       if ($showPoints)     { $r->print ('<td>'.&mt('Students will see points based on problem weights.').'</td>'); }
+       if ($showCategories) { $r->print ('<td>'.&mt('Students will see points based on categories.').'</td>'); }
+       $r->print('<td>'.&Apache::lonhtmlcommon::coursepreflink(&mt('Grade display settings'),'grading').'</td></td></table>');
+    }
+
+
+    $r->print('<ul class="LC_TabContentBigger" id="main">');
+    $r->print('<li'.($mode eq 'quick'?' class="active"':'').'><a href="/adm/quickgrades"><b>'.
+                                          ($showPoints?&mt('Points'):($showCategories?&mt('Grades'):&mt('Completion'))).'</b></a></li>');
+
+    if (!($showPoints || $notshowSPRSlink) || ($allowed_to_view)) {
+       $r->print('<li'.($mode eq 'spreadsheet'?' class="active"':'').'><a href="/adm/'.($allowed_to_view?'classcalc':'studentcalc').'"><b>'.
+                                                                 &mt('Spreadsheet').'</b></a></li>');
+    }
+    $r->print('</ul>');
+    $r->print('<div class="LC_Box" style="clear:both;margin:0;"><div id="maincoursedoc" style="margin:0 0;padding:0 0;"><div class="LC_ContentBox" id="mainCourseDocuments" style="display: block;">');
+}
+
+sub endGradeScreen {
+   my ($r)=@_;
+   $r->print('</div></div></div>');
+}
+
+
 sub getData {
 
     my ($showPoints,$uname,$udom)=@_;
Index: loncom/interface/spreadsheet/classcalc.pm
diff -u loncom/interface/spreadsheet/classcalc.pm:1.29 loncom/interface/spreadsheet/classcalc.pm:1.30
--- loncom/interface/spreadsheet/classcalc.pm:1.29	Thu Oct 23 09:07:57 2008
+++ loncom/interface/spreadsheet/classcalc.pm	Fri Dec  3 21:33:56 2010
@@ -1,5 +1,5 @@
 #
-# $Id: classcalc.pm,v 1.29 2008/10/23 09:07:57 bisitz Exp $
+# $Id: classcalc.pm,v 1.30 2010/12/03 21:33:56 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -322,7 +322,7 @@
     #
     if ($show_expire_link) {
         $r->print('<a href="/adm/classcalc?output_format=htmlclasslist&'.
-                  'recalc=ilovewastingtime&not_first_run=1">'.
+                  'recalc=expireallsheets&not_first_run=1">'.
                   &mt('Expire all student spreadsheets').'</a>'.$/);
     }
     #
Index: loncom/interface/spreadsheet/lonspreadsheet.pm
diff -u loncom/interface/spreadsheet/lonspreadsheet.pm:1.57 loncom/interface/spreadsheet/lonspreadsheet.pm:1.58
--- loncom/interface/spreadsheet/lonspreadsheet.pm:1.57	Thu Dec  2 00:53:46 2010
+++ loncom/interface/spreadsheet/lonspreadsheet.pm	Fri Dec  3 21:33:56 2010
@@ -1,5 +1,5 @@
 #
-# $Id: lonspreadsheet.pm,v 1.57 2010/12/02 00:53:46 www Exp $
+# $Id: lonspreadsheet.pm,v 1.58 2010/12/03 21:33:56 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -64,6 +64,7 @@
 use Apache::lonhtmlcommon;
 use Apache::lonlocal;
 use Apache::loncoursedata();
+use Apache::lonquickgrades();
 use HTML::Entities();
 
 ##
@@ -395,9 +396,17 @@
           bug   => 'Spreadsheet'});
     $r->print(&Apache::loncommon::start_page('Grades Spreadsheet',$js).
               &Apache::lonhtmlcommon::breadcrumbs('Spreadsheet',
-						  'Spreadsheet_About').
-              &Apache::lonhtmlcommon::coursepreflink(&mt('Grade display settings'),'grading').
-              '<form action="'.$r->uri.'" name="sheet" method="post">');
+						  'Spreadsheet_About'));
+
+    #
+    # Tabs
+    # 
+    &Apache::lonquickgrades::startGradeScreen($r,'spreadsheet');
+
+    #
+    # Open the form
+    # 
+    $r->print('<form action="'.$r->uri.'" name="sheet" method="post">');
     $r->print(&hiddenfield('sname'  ,$env{'form.sname'}).
               &hiddenfield('sdomain',$env{'form.sdomain'}).
               &hiddenfield('usymb'  ,$env{'form.usymb'}));
@@ -419,7 +428,7 @@
         if (exists($env{'form.recalc'})) {
             &Apache::loncoursedata::delete_caches($env{'requres.course.id'});
         }
-        if ($env{'form.recalc'} eq 'ilovewastingtime') {
+        if ($env{'form.recalc'} eq 'expireallsheets') {
             &Apache::lonnet::logthis('spreadsheet expired: entire course');
             # expire ALL spreadsheets
             &Apache::lonnet::expirespread('','','studentcalc');
@@ -539,7 +548,7 @@
     $r->print(&hiddenfield('filename',$filename));
     #
     # Keep track of the number of times we have been called, sort of.
-    $r->print(&hiddenfield('not_first_run','whatever'));
+    $r->print(&hiddenfield('not_first_run','1'));
     #
     if (exists($env{'form.not_first_run'}) || $sheettype ne 'classcalc') {
         $r->print($spreadsheet->get_html_title());
@@ -549,7 +558,9 @@
         $r->rflush();
         $spreadsheet->display($r);
     }
-    $r->print('</form>'.&Apache::loncommon::end_page());
+    $r->print('</form>');
+    &Apache::lonquickgrades::endGradeScreen($r);
+    $r->print(&Apache::loncommon::end_page());
     $spreadsheet->clear_package();
     return OK;
 }

--www1291412036--