[LON-CAPA-cvs] cvs: loncom /interface lonmsg.pm

www lon-capa-cvs@mail.lon-capa.org
Tue, 26 Oct 2004 19:50:18 -0000


www		Tue Oct 26 15:50:18 2004 EDT

  Modified files:              
    /loncom/interface	lonmsg.pm 
  Log:
  Show current state of resource if available. Also on Reply screen.
  
  
Index: loncom/interface/lonmsg.pm
diff -u loncom/interface/lonmsg.pm:1.110 loncom/interface/lonmsg.pm:1.111
--- loncom/interface/lonmsg.pm:1.110	Tue Sep 28 10:38:50 2004
+++ loncom/interface/lonmsg.pm	Tue Oct 26 15:50:15 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging
 #
-# $Id: lonmsg.pm,v 1.110 2004/09/28 14:38:50 matthew Exp $
+# $Id: lonmsg.pm,v 1.111 2004/10/26 19:50:15 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -970,6 +970,7 @@
 	$dismsg=~s/\f/\n/g;
 	$dismsg=~s/\n+/\n\> /g;
     }
+    my $citation=&displayresource(%content);
     if ($ENV{'form.recdom'}) { $defdom=$ENV{'form.recdom'}; }
       $r->print(
                 '<form action="/adm/email"  name="compemail" method="post"'.
@@ -1010,7 +1011,8 @@
 </textarea></p><br />
 $dispcrit
 <input type="submit" name="send" value="$func $lt{'ma'}" />
-<input type="submit" name="cancel" value="$lt{'ca'}" />
+<input type="submit" name="cancel" value="$lt{'ca'}" /><hr />
+$citation
 ENDCOMP
     } else { # $broadcast is 'upload'
 	$r->print(<<ENDUPLOAD);
@@ -1634,10 +1636,44 @@
 	      '<br /><b>'.&mt('Time').':</b> '.$content{'time'}.
 	      '<p><pre>'.
 	      &Apache::lontexconvert::msgtexconverted($content{'message'},1).
-	      '</pre><hr />'.$content{'citation'}.'</p>');
+	      '</pre><hr />'.&displayresource(%content).'</p>');
     return;   
 }
 
+# =========================================================== Show the citation
+
+sub displayresource {
+    my %content=@_;
+#
+# If the recipient is in the same course that the message was sent from and
+# has sufficient privileges, show "all details," else show citation
+#
+    if (($ENV{'request.course.id'} eq $content{'courseid'})
+     && (&Apache::lonnet::allowed('vgr',$content{'courseid'}))) {
+	my $symb=&Apache::lonnet::symbread($content{'baseurl'});
+# Could not get a symb, give up
+	unless ($symb) { return $content{'citation'}; }
+# Have a symb, can render
+	return '<h2>'.&mt('Current attempts of student (if applicable)').'</h2>'.
+	    &Apache::loncommon::get_previous_attempt($symb,
+						     $content{'sendername'},
+						     $content{'senderdomain'},
+						     $content{'courseid'}).
+	    '<hr /><h2>'.&mt('Current screen output (if applicable)').'</h2>'.
+	    &Apache::loncommon::get_student_view($symb,
+						 $content{'sendername'},
+						 $content{'senderdomain'},
+						 $content{'courseid'}).
+	    '<h2>'.&mt('Correct Answer(s) (if applicable)').'</h2>'.
+	    &Apache::loncommon::get_student_answers($symb,
+						    $content{'sendername'},
+						    $content{'senderdomain'},
+						    $content{'courseid'});
+    } else {
+	return $content{'citation'};
+    }
+}
+
 # ================================================================== The Header
 
 sub header {