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

raeburn lon-capa-cvs@mail.lon-capa.org
Fri, 08 Dec 2006 20:09:29 -0000


raeburn		Fri Dec  8 15:09:29 2006 EDT

  Modified files:              
    /loncom/interface	lonfeedback.pm loncommon.pm 
  Log:
  Bug 4972
  
  "Send Message" link now displayed when discussion is closed and hidden.
  
  Also shown when discussion is blocked. 
  
  
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.231 loncom/interface/lonfeedback.pm:1.232
--- loncom/interface/lonfeedback.pm:1.231	Thu Dec  7 19:28:59 2006
+++ loncom/interface/lonfeedback.pm	Fri Dec  8 15:09:29 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.231 2006/12/08 00:28:59 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.232 2006/12/08 20:09:29 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -74,6 +74,9 @@
 
 sub list_discussion {
     my ($mode,$status,$ressymb,$imsextras,$group)=@_;
+    unless ($ressymb) { $ressymb=&Apache::lonnet::symbread(); }
+    unless ($ressymb) { return ''; }
+    $ressymb=&wrap_symb($ressymb);
     my $outputtarget=$env{'form.grade_target'};
     if (defined($env{'form.export'})) {
 	if($env{'form.export'}) {
@@ -85,7 +88,12 @@
             $outputtarget = 'export';
         }
     }
-    if (not &discussion_visible($status)) { return ''; }
+    if (not &discussion_visible($status)) {
+        if ($mode ne 'board') {
+            my $encsymb=&Apache::lonenc::check_encrypt($ressymb); 
+            return &send_message_link($encsymb);
+        }
+    }
     if ($group ne '' && $mode eq 'board') {
         if (&check_group_priv($group,'vgb') ne 'ok') {
             return '';
@@ -94,7 +102,10 @@
 
     my ($blocked,$blocktext) = &blocking_posts('boards',1);
     if ($blocked) {
-        return $blocktext;
+        if ($mode ne 'board') {
+            my $encsymb=&Apache::lonenc::check_encrypt($ressymb);
+            return $blocktext.'<br />'.&send_message_link($encsymb);
+        }
     }
 
     my @bgcols = ("#cccccc","#eeeeee");
@@ -107,9 +118,6 @@
 	$crs.='_'.$env{'request.course.sec'};
     }
     $crs=~s/\_/\//g;
-    unless ($ressymb) { $ressymb=&Apache::lonnet::symbread(); }
-    unless ($ressymb) { return ''; }
-    $ressymb=&wrap_symb($ressymb);
     my $encsymb=&Apache::lonenc::check_encrypt($ressymb);
     my $viewgrades=(&Apache::lonnet::allowed('vgr',$crs)
 		  && ($ressymb=~/\.(problem|exam|quiz|assess|survey|form|task)$/));
@@ -722,26 +730,45 @@
             }
 	}
     } else {
-	$discussion.='<table bgcolor="#BBBBBB"><tr><td>';
+        $discussion.='<table class="LC_feedback_link"><tr><td>';
         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.='<a href="/adm/feedback?replydisc='.
-		    &escape($ressymb).':::" '.$target.'>'.
-		    '<img alt="" src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/chat.gif').'" border="0" />'.
-		    &mt('Post Discussion').'</a><br />';
+		$discussion.= &send_feedback_link($ressymb,$target).
+                              '<br />';
             }
 	}
-	$discussion.='<a href="/adm/feedback?sendmessageonly=1&amp;symb='.
-	    &escape($ressymb).
-	    '"><img alt="" src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/feedback.gif').'" border="0" />'.
-		    &mt('Send Message').'</a></td></tr></table>';
+        if ($outputtarget ne 'tex') {
+	    $discussion.= &send_message_link($ressymb);
+        }
+        $discussion.='</td></tr></table>';
     }
     return $discussion;
 }
 
+sub send_feedback_link {
+    my ($ressymb,$target) = @_;
+    my $output = '<span class="LC_feedback_link">'.
+                 ' <a href="/adm/feedback?replydisc='.
+                 &escape($ressymb).':::" '.$target.'>'.
+                 '<img alt="" src="'.
+                 &Apache::loncommon::lonhttpdurl('/adm/lonMisc/chat.gif').
+                 '" border="0" />'.&mt('Post Discussion').'</a></span>';
+    return $output;
+}
+
+sub send_message_link {
+    my ($ressymb) = @_;
+    my $output = '<span class="LC_feedback_link">'.
+                 '  <a href="/adm/feedback?sendmessageonly=1&amp;symb='.
+                 &escape($ressymb).'"><img alt="" src="'.
+                 &Apache::loncommon::lonhttpdurl('/adm/lonMisc/feedback.gif').
+                 '" border="0" />'.&mt('Send Message').'</a></span>';
+    return $output;
+}
+
 sub action_links_bar {
     my ($colspan,$ressymb,$visible,$newpostsflag,$group,$prevread,$markondisp) = @_;
     my $discussion = '<tr><td bgcolor="#DDDDBB" colspan="'.$colspan.'">'.
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.488 loncom/interface/loncommon.pm:1.489
--- loncom/interface/loncommon.pm:1.488	Wed Dec  6 06:36:52 2006
+++ loncom/interface/loncommon.pm	Fri Dec  8 15:09:29 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.488 2006/12/06 11:36:52 foxr Exp $
+# $Id: loncommon.pm,v 1.489 2006/12/08 20:09:29 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3503,6 +3503,7 @@
     my $mail_other           = '#99BBBB';
     my $mail_other_hover     = '#669999';
     my $table_header         = '#DDDDDD';
+    my $feedback_link_bg     = '#BBBBBB';
 
     my $border = ($env{'browser.type'} eq 'explorer') ? '0px 2px 0px 2px'
 	                                              : '0px 3px 0px 4px';
@@ -4034,6 +4035,13 @@
   text-align: right;
   font-weight: bold;
 }
+table.LC_feedback_link {
+    background: $feedback_link_bg;
+}
+span.LC_feedback_link {
+    background: $feedback_link_bg;
+    font-size: larger;
+}
 
 END
 }