[LON-CAPA-cvs] cvs: loncom /html/adm/helper resettimes.helper

albertel lon-capa-cvs-allow@mail.lon-capa.org
Tue, 20 Nov 2007 00:15:34 -0000


albertel		Mon Nov 19 19:15:34 2007 EDT

  Modified files:              
    /loncom/html/adm/helper	resettimes.helper 
  Log:
  - add ability to remove access times from both the course and individual resources
  
  
Index: loncom/html/adm/helper/resettimes.helper
diff -u loncom/html/adm/helper/resettimes.helper:1.6 loncom/html/adm/helper/resettimes.helper:1.7
--- loncom/html/adm/helper/resettimes.helper:1.6	Fri Aug 31 20:41:34 2007
+++ loncom/html/adm/helper/resettimes.helper	Mon Nov 19 19:15:31 2007
@@ -4,8 +4,8 @@
       <message_text>Select </message_text>
     </message>
     <choices variable="harry">
-      <choice computer='1' nextstate="Student">Reset times on one or more folders/maps for a single student.</choice>
-      <choice computer='0' nextstate="Class">Reset times on a single folder/map for a section or whole class.</choice>
+      <choice computer='1' nextstate="Student">Reset times on one or more folders/maps, resources or the course for a single student.</choice>
+      <choice computer='0' nextstate="Class">Reset times on a single folder/map, resource or the course for a section or the whole class.</choice>
       </choices>
   </state>
   <state name="Student" title="Select Student">
@@ -17,7 +17,7 @@
 
   <state name="SelectAccess">
     <message nextstate="ConfirmStu">
-       <message_text>This is a list of folders/maps and times they were accessed, plese select those you want deleted.</message_text>
+       <message_text>This is a list of first access times and what was accessed, plese select those you want deleted.</message_text>
     </message>
     <choices variable='delete' multichoice='true'>
       <exec>
@@ -27,7 +27,9 @@
          foreach my $res (sort(keys(%times))) {
 	     my (undef,$symb)=split("\0",$res);
 	     my $escsymb=&Apache::lonnet::escape($symb);
-	     my $title=&Apache::lonnet::gettitle($symb);
+	     my $title = 
+		 ($symb ne 'course') ? &Apache::lonnet::gettitle($symb)
+	                             : $env{'course.'.$env{'request.course.id'}.'.description'};
 	     my $time=&Apache::lonlocal::locallocaltime($times{$res});
 	     my $description="<a href='/adm/navmaps?postsymb=".&Apache::lonnet::escape($symb)."'>$title</a> on $time";
 	     push(@{$state->{CHOICES}},[$description,$escsymb]);
@@ -45,13 +47,16 @@
         if (!$fullname) { $fullname="$uname\@$udom"; }
         return '<li>'.$fullname.'</li>';
     </eval>
-    <message><message_text></ul> for folders/maps <ul></message_text></message>
+    <message><message_text></ul> for <ul></message_text></message>
     <eval>
 	my $list;
 	my @symbs=split(/\|\|\|/,$helper->{'VARS'}{'delete'});
 	foreach my $escsymb (@symbs) {
 	    my $symb=&Apache::lonnet::unescape($escsymb);
-	    $list.='<li>'.&Apache::lonnet::gettitle($symb).'</li>';
+	    my $title = 
+		($symb ne 'course') ? &Apache::lonnet::gettitle($symb)
+	                            : $env{'course.'.$env{'request.course.id'}.'.description'};
+	    $list.='<li>'.$title.'</li>';
 	}
 	return $list;
     </eval>
@@ -60,7 +65,6 @@
   <state name="FinishStu" title="Processing">
     <final>
       <finalcode>
-        &Apache::lonnet::logthis($helper->{'VARS'}{'delete'});
         if ($helper->{'STATE'} ne 'FinishStu') { return; }
         my $result;
         my $courseid=$env{'request.course.id'};
@@ -70,8 +74,11 @@
 	    my $symb=&Apache::lonnet::unescape($escsymb);
 	    my $res=&Apache::lonnet::del('firstaccesstimes',
 					 ["$courseid\0$symb"],$udom,$uname);
+	    my $title = 
+		($symb ne 'course') ? &Apache::lonnet::gettitle($symb)
+	                            : $env{'course.'.$env{'request.course.id'}.'.description'};
 	    $result.="Removing access time from ".
-		      &Apache::lonnet::gettitle($symb).": ".$res.'</li><li>';
+		      $title.": ".$res.'</li><li>';
 	}
         $result=~s/<li>$//;
         return $result;
@@ -88,7 +95,8 @@
 
   <state name="SelectMap" title="Select a folder/map">
     <resource variable="res2" includecourse="true">
-      <filterfunc>return ($res->is_map() && $res->map_contains_problem());</filterfunc>
+      <filterfunc>return (($res->is_map() && $res->map_contains_problem()) 
+                          ||$res->is_problem() );</filterfunc>
       <valuefunc>return $res->symb()</valuefunc>
       <nextstate>ShowPlan</nextstate>
     </resource>