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

raeburn raeburn@source.lon-capa.org
Sat, 14 Aug 2010 17:48:13 -0000


This is a MIME encoded message

--raeburn1281808093
Content-Type: text/plain

raeburn		Sat Aug 14 17:48:13 2010 EDT

  Modified files:              
    /loncom/interface	lonfeedback.pm 
  Log:
  - Coding style.
      - Gather together items which are not to be displayed when outparttarget is 'tex'.
  
  
--raeburn1281808093
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20100814174813.txt"

Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.298 loncom/interface/lonfeedback.pm:1.299
--- loncom/interface/lonfeedback.pm:1.298	Sat Aug 14 15:24:46 2010
+++ loncom/interface/lonfeedback.pm	Sat Aug 14 17:48:13 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.298 2010/08/14 15:24:46 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.299 2010/08/14 17:48:13 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -722,7 +722,7 @@
                 $attachnum += @{$currnewattach};
             }
         }
-	if (&discussion_open($status)) {
+	if ((&discussion_open($status)) && ($outputtarget ne 'tex')) {
             if (($group ne '') && ($mode eq 'board')) {  
                 if (&check_group_priv($group,'pgd') eq 'ok') {
                     $discussion .=
@@ -738,31 +738,24 @@
 					 $currnewattach,$currdelold,'',$crstype);
             }
 	}
-    } else {
+    } elsif ($outputtarget ne 'tex') {
         $discussion.='<div class="LC_feedback_link">';
         if (&discussion_open($status) &&
             &Apache::lonnet::allowed('pch',
     	        $env{'request.course.id'}.
 	        ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
-	    if ($outputtarget ne 'tex') {
-                $discussion.= &send_feedback_link($ressymb,$target);
-                if ($env{'request.role.adv'}) {
-                    my $close = &Apache::lonnet::EXT('resource.0.discussend',$ressymb);
-                    if (defined($close) && $close ne '' && $close < time) {
-                        $discussion .= '&nbsp;'.&mt('(Closed for [_1] roles)',
-                                                    &Apache::lonnet::plaintext('st',$crstype));
-                    }
+            $discussion.= &send_feedback_link($ressymb,$target);
+            if ($env{'request.role.adv'}) {
+                my $close = &Apache::lonnet::EXT('resource.0.discussend',$ressymb);
+                if (defined($close) && $close ne '' && $close < time) {
+                    $discussion .= '&nbsp;'.&mt('(Closed for [_1] roles)',
+                                                &Apache::lonnet::plaintext('st',$crstype));
                 }
             }
 	} else {
-            if ($outputtarget ne 'tex') {
-                $discussion.= '<span class="LC_feedback_link">'.&mt('This discussion is closed.').'</span>';
-            }
-        }
-        if ($outputtarget ne 'tex') {
-	    $discussion.= &send_message_link($ressymb);
+            $discussion.= '<span class="LC_feedback_link">'.&mt('This discussion is closed.').'</span>';
         }
-        $discussion.='</div>';
+	$discussion.= &send_message_link($ressymb).'</div>';
     }
     return $discussion;
 }
@@ -842,7 +835,6 @@
 sub postingform_display {
     my ($mode,$ressymb,$now,$subject,$comment,$outputtarget,$attachnum,
         $currnewattach,$currdelold,$group,$crstype) = @_;
-    if ($outputtarget eq 'tex') { return ''; }
     my $newattachmsg;
     my %lt = &Apache::lonlocal::texthash(
               'note' => 'Note: in anonymous discussion, your name is visible only to course faculty',
@@ -1070,48 +1062,50 @@
                             } else {
                                 @{$$namesort{$lastname}{$firstname}} = ("$idx");
                             }
-                            if ((&editing_allowed($escsymb.':::'.$idx,$group)) && ($outputtarget ne 'tex')) {
-                                if (($env{'user.domain'} eq $contrib{$idx.':senderdomain'}) && ($env{'user.name'} eq $contrib{$idx.':sendername'})) {
-                                    $sender.=' <a href="/adm/feedback?editdisc='.
-                                         $escsymb.':::'.$idx;
-                                    if ($$newpostsflag) {
-                                        $sender .= '&amp;previous='.$prevread;
-                                    }
-				    $sender .= &group_args($group);
-                                    $sender .= '" '.$target.'>'.&mt('Edit').'</a>';
+                            if ($outputtarget ne 'tex') {
+                                if (&editing_allowed($escsymb.':::'.$idx,$group)) {
+                                    if (($env{'user.domain'} eq $contrib{$idx.':senderdomain'}) && ($env{'user.name'} eq $contrib{$idx.':sendername'})) {
+                                        $sender.=' <a href="/adm/feedback?editdisc='.
+                                             $escsymb.':::'.$idx;
+                                        if ($$newpostsflag) {
+                                            $sender .= '&amp;previous='.$prevread;
+                                        }
+				        $sender .= &group_args($group);
+                                        $sender .= '" '.$target.'>'.&mt('Edit').'</a>';
                                     
-                                    unless ($seeid) {
-                                        my $grpargs = &group_args($group);
-                                        $sender.=" <a href=\"javascript:verifydelete('studentdelete','$escsymb','$idx','$$newpostsflag','$prevread','$grpargs')";
-                                        $sender .= '">'.&mt('Delete').'</a>';
+                                        unless ($seeid) {
+                                            my $grpargs = &group_args($group);
+                                            $sender.=" <a href=\"javascript:verifydelete('studentdelete','$escsymb','$idx','$$newpostsflag','$prevread','$grpargs')";
+                                            $sender .= '">'.&mt('Delete').'</a>';
+                                        }
                                     }
                                 }
-                            } 
-			    if (($seeid) && ($outputtarget ne 'tex')) {
-			        if ($hidden) {
-                                    unless ($studenthidden) {
-			                $sender.=' <a href="/adm/feedback?unhide='.
-				                $escsymb.':::'.$idx;
+			        if ($seeid) {
+			            if ($hidden) {
+                                        unless ($studenthidden) {
+			                    $sender.=' <a href="/adm/feedback?unhide='.
+				                     $escsymb.':::'.$idx;
+                                            if ($$newpostsflag) {
+                                                $sender .= '&amp;previous='.$prevread;
+                                            }
+                                            $sender .= '">'.&mt('Make Visible').'</a>';
+                                        }
+			            } else {
+				        $sender.=' <a href="/adm/feedback?hide='.
+				                 $escsymb.':::'.$idx;
                                         if ($$newpostsflag) {
                                             $sender .= '&amp;previous='.$prevread;
                                         }
-                                        $sender .= '">'.&mt('Make Visible').'</a>';
-                                    }
-			        } else {
-				    $sender.=' <a href="/adm/feedback?hide='.
-				        $escsymb.':::'.$idx;
-                                    if ($$newpostsflag) {
-                                        $sender .= '&amp;previous='.$prevread;
-                                    }
-				    $sender .= &group_args($group);
-                                    $sender .= '">'.&mt('Hide').'</a>';
-			        }
-                                my $grpargs = &group_args($group);
-			        $sender.= 
-                                    " <a href=\"javascript:verifydelete('seeiddelete','$escsymb','$idx','$$newpostsflag','$prevread','$grpargs')\">";
-                                $sender .= &mt('Delete').'</a>';
+				        $sender .= &group_args($group);
+                                        $sender .= '">'.&mt('Hide').'</a>';
+			            }
+                                    my $grpargs = &group_args($group);
+			            $sender.= 
+                                        " <a href=\"javascript:verifydelete('seeiddelete','$escsymb','$idx','$$newpostsflag','$prevread','$grpargs')\">";
+                                    $sender .= &mt('Delete').'</a>';
+                                }
                             }
-		        } else {
+                        } else {
 			    if ($screenname) {
 			        $sender='<i>'.$screenname.'</i>';
 			    } else {
@@ -1137,36 +1131,38 @@
                                 @{$$namesort{'__anon'}{'__anon'}} = ("$idx");
                             }
 		        }
-		        if ((&discussion_open($status)) && ($outputtarget ne 'tex')) {
-                            if (($group ne '') && 
-                                (&check_group_priv($group,'pgd') eq 'ok')) {
-                                 $sender.=' <a href="/adm/feedback?replydisc='.
-                                          $escsymb.':::'.$idx;
-                                if ($$newpostsflag) {
-                                    $sender .= '&amp;previous='.$prevread;
-                                }
-                                $sender .= &group_args($group);
-                                $sender .= '" '.$target.'>'.&mt('Reply').'</a>';
-                            } elsif (&Apache::lonnet::allowed('pch', 
-				 $env{'request.course.id'}.
-				 ($env{'request.course.sec'}?'/'.
-                                  $env{'request.course.sec'}:''))) {
-			         $sender.=' <a href="/adm/feedback?replydisc='.
-			                  $escsymb.':::'.$idx;
-                                if ($$newpostsflag) {
-                                    $sender .= '&amp;previous='.$prevread;
+                        if ($outputtarget ne 'tex') {
+		            if (&discussion_open($status)) {
+                                if (($group ne '') && 
+                                    (&check_group_priv($group,'pgd') eq 'ok')) {
+                                     $sender.=' <a href="/adm/feedback?replydisc='.
+                                              $escsymb.':::'.$idx;
+                                    if ($$newpostsflag) {
+                                        $sender .= '&amp;previous='.$prevread;
+                                    }
+                                    $sender .= &group_args($group);
+                                    $sender .= '" '.$target.'>'.&mt('Reply').'</a>';
+                                } elsif (&Apache::lonnet::allowed('pch', 
+				     $env{'request.course.id'}.
+				     ($env{'request.course.sec'}?'/'.
+                                      $env{'request.course.sec'}:''))) {
+			             $sender.=' <a href="/adm/feedback?replydisc='.
+			                      $escsymb.':::'.$idx;
+                                    if ($$newpostsflag) {
+                                        $sender .= '&amp;previous='.$prevread;
+                                    }
+                                    $sender .= '" '.$target.'>'.&mt('Reply').'</a>';
                                 }
-                                $sender .= '" '.$target.'>'.&mt('Reply').'</a>';
                             }
-                        }
-		        if (($viewgrades) && ($outputtarget ne 'tex')) {
+		            if ($viewgrades) {
 			        $vgrlink=&Apache::loncommon::submlink(&mt('Submissions'),
-                            $contrib{$idx.':sendername'},$contrib{$idx.':senderdomain'},$ressymb);
-		        }
-                        if (($$dischash{$readkey}=~/\.$idx\./) && ($outputtarget ne 'tex')) { 
-                            $ctlink = '<label><b>'.&mt('Mark unread').'?</b>&nbsp;<input type="checkbox" name="postunread_'.$idx.'" /></label>';
-                        } else {
-                            $ctlink = '<label><b>'.&mt('Mark read').'?</b>&nbsp;<input type="checkbox" name="postread_'.$idx.'" /></label>';
+                                $contrib{$idx.':sendername'},$contrib{$idx.':senderdomain'},$ressymb);
+		            }
+                            if ($$dischash{$readkey}=~/\.$idx\./) { 
+                                $ctlink = '<label><b>'.&mt('Mark unread').'?</b>&nbsp;<input type="checkbox" name="postunread_'.$idx.'" /></label>';
+                            } else {
+                                $ctlink = '<label><b>'.&mt('Mark read').'?</b>&nbsp;<input type="checkbox" name="postread_'.$idx.'" /></label>';
+                            }
                         }
                     }
 #figure out at what position this needs to print

--raeburn1281808093--