[LON-CAPA-cvs] cvs: loncom /homework bridgetask.pm /interface lonparmset.pm

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 12 Jun 2006 23:17:57 -0000


albertel		Mon Jun 12 19:17:57 2006 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
    /loncom/homework	bridgetask.pm 
  Log:
  - adding option such that bringing up the Done screen can cause a message
    to be generated an sent to the student and possibly to the notes section
    of the about me page
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.312 loncom/interface/lonparmset.pm:1.313
--- loncom/interface/lonparmset.pm:1.312	Mon Jun 12 14:43:56 2006
+++ loncom/interface/lonparmset.pm	Mon Jun 12 19:17:48 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.312 2006/06/12 18:43:56 albertel Exp $
+# $Id: lonparmset.pm,v 1.313 2006/06/12 23:17:48 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2195,6 +2195,8 @@
              'disable_receipt_display'
                  => '<b>'.&mt('Disable display of problem receipts').'</b><br />'.
                     ' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')',
+	     'task_messages'
+	         => '<b>'.&mt('Send message to student when clicking Done on Tasks. [_1] to send a message only to student, [_2] to send message to student and add record to user information page for instructors. Leave blank to disable.','<tt>only_student</tt>','<tt>student_and_user_notes_screen</tt>').'</b>',
 	     'disablesigfigs'
 	         => '<b>'.&mt('Disable checking of Significant Figures').'</b><br />'.
                     ' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')',
@@ -2231,7 +2233,8 @@
                              'default_enrollment_end_date',
 			     'tthoptions',
 			     'disablesigfigs',
-			     'disableexampointprint'
+			     'disableexampointprint',
+			     'task_messages'
                              );
 	foreach my $parameter (sort(keys(%values))) {
             unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./)) {
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.166 loncom/homework/bridgetask.pm:1.167
--- loncom/homework/bridgetask.pm:1.166	Mon Jun 12 14:57:20 2006
+++ loncom/homework/bridgetask.pm	Mon Jun 12 19:17:56 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: bridgetask.pm,v 1.166 2006/06/12 18:57:20 albertel Exp $
+# $Id: bridgetask.pm,v 1.167 2006/06/12 23:17:56 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -419,18 +419,39 @@
     my @files=split(',',$Apache::lonhomework::history{'resource.'.$version.'.0.bridgetask.portfiles'});
     my (undef,undef,$domain,$user)= &Apache::lonxml::whichuser();
     my $files = '<ul>';
+    my $msg;
     foreach my $file (@files) {
 	my $url="/uploaded/$domain/$user/portfolio$file";
 	if (! &Apache::lonnet::stat_file($url)) {
 	    $file = &mt('<span class="LC_error"> Nonexistent file:</span> '.
 			'<span class="LC_filename">[_1]</span>',$file);
+	    $msg .= "<p>Submitted non-existant file $file</p>\n";
 	} else {
 	    $file = '<span class="LC_filename">'.$file.'</span>';
+	    $msg .= "<p>Submitted file $file</p>\n";
 	}
 	$files .= '<li>'.$file.'</li>';
     }
     $files.='</ul>';
-    
+    my $subject = "Submission message for $title";
+    my ($message_status,$comment_status);
+    my $setting = $env{'course.'.$env{'request.course.id'}.'.task_messages'};
+    $setting =~ s/^\s*(\S*)\s*$/$1/;
+    $setting = lc($setting);
+    if ($setting eq 'only_student'
+	|| $setting eq 'student_and_user_notes_screen') {
+	$message_status =
+	    &Apache::lonmsg::user_normal_msg($user,$domain,$subject,$msg);
+	$message_status = '<p>'.&mt('Message sent to user: [_1]',
+				    $message_status).' </p>';
+    }
+    if ($setting eq 'student_and_user_notes_screen') {
+	$comment_status = 
+	    &Apache::lonmsg::store_instructor_comment($subject.'<br />'.
+						      $msg,$user,$domain);
+	$comment_status = '<p>'.&mt('Message sent to instructor: [_1]',
+				    $comment_status).' </p>';
+    }
     return <<DONESCREEN;
 <h2>$title</h2>
 <p> Files submitted: $files </p>
@@ -438,6 +459,8 @@
 <hr />
 <p> <a href="/adm/logout">Logout</a> </p>
 <p> <a href="/adm/roles">Change to a different course</a> </p>
+$message_status
+$comment_status
 DONESCREEN
 
 }
@@ -542,7 +565,7 @@
 		} elsif ($status eq 'WAITING_FOR_GRADE') {
 		    $msg.='<h1>'.&mt('Your submission is in the grading queue.').'</h1>';
 		} elsif ($env{'form.donescreen'}) {
-		    $result .= &done_screen();
+		    $result .= &done_screen($version);
 		} elsif ($status ne 'NOT_YET_VIEWED') {
 		    $msg.='<h1>'.&mt('Not open to be viewed').'</h1>';
 		}