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

www lon-capa-cvs@mail.lon-capa.org
Tue, 21 Oct 2003 00:22:24 -0000


www		Mon Oct 20 20:22:24 2003 EDT

  Modified files:              
    /loncom/interface	lonfeedback.pm 
  Log:
  Tiny steps toward threaded discussion. The "Reply" link does nothing at all
  yet.
  
  
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.63 loncom/interface/lonfeedback.pm:1.64
--- loncom/interface/lonfeedback.pm:1.63	Wed Oct 15 16:13:31 2003
+++ loncom/interface/lonfeedback.pm	Mon Oct 20 20:22:23 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.63 2003/10/15 20:13:31 albertel Exp $
+# $Id: lonfeedback.pm,v 1.64 2003/10/21 00:22:23 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -69,17 +69,13 @@
     unless ($symb) { return ''; }
     my $seeid=&Apache::lonnet::allowed('rin',$crs);
     my $viewgrades=&Apache::lonnet::allowed('vgr',$crs);
-    my $discussion='';
+    my %discussionitems=();
     my %contrib=&Apache::lonnet::restore($symb,$ENV{'request.course.id'},
 			  $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
 			  $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
     if ($contrib{'version'}) {
-	unless ($discussiononly) {
-	    $discussion.=
-		'<address><hr />';
-	}
-	my $idx;
-	for ($idx=1;$idx<=$contrib{'version'};$idx++) {
+	for (my $id=1;$id<=$contrib{'version'};$id++) {
+	    my $idx=$id;
 	    my $hidden=($contrib{'hidden'}=~/\.$idx\./);
 	    my $deleted=($contrib{'deleted'}=~/\.$idx\./);
 	    unless ((($hidden) && (!$seeid)) || ($deleted)) {
@@ -128,6 +124,12 @@
 			    $sender.=' <a href="/adm/feedback?deldisc='.
 				$symb.':::'.$idx.'">'.&mt('Delete').'</a>';
 			}
+			if (&Apache::lonnet::allowed('pch',
+				   $ENV{'request.course.id'}.
+	($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) {
+			    $sender.=' <a href="/adm/feedback?replydisc='.
+				$symb.':::'.$idx.'">'.&mt('Reply').'</a>';
+			}
 		    } else {
 			if ($screenname) {
 			    $sender='<i>'.$screenname.'</i>';
@@ -138,16 +140,17 @@
 			$vgrlink=&Apache::loncommon::submlink('Submissions',
             $contrib{$idx.':sendername'},$contrib{$idx.':senderdomain'},$symb);
 		    }
-		    $discussion.='<p><b>'.$sender.'</b> '.$vgrlink.' ('.
+		    $discussionitems{$idx}='<p><b>'.$sender.'</b> '.$vgrlink.' ('.
 			localtime($contrib{$idx.':timestamp'}).
 			'):<blockquote>'.$message.
 			'</blockquote></p>';
 	        }
 	    } 
 	}
-	unless ($discussiononly) {
-	    $discussion.='</address>';
-	}
+    }
+    my $discussion='<hr />';
+    foreach (sort { $a <=> $b } keys %discussionitems) {
+	$discussion.=$discussionitems{$_};
     }
     if ($discussiononly) {
 	$discussion.=(<<ENDDISCUSS);