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

bisitz bisitz@source.lon-capa.org
Sun, 07 Dec 2008 19:29:30 -0000


bisitz		Sun Dec  7 19:29:30 2008 EDT

  Modified files:              
    /loncom/interface	lonmsgdisplay.pm 
  Log:
  Display optimizations for functions and actions on message display screen:
  - Replaced hardcoded styles and table  by fieldsets
  - No special background color and no output in bold anymore
  - Optimized float/nobreak behavior for each element
  - Prepare functions in an optimized way: separate data collection from screen output (already done for actions)
  - Added some comments
  
  
Index: loncom/interface/lonmsgdisplay.pm
diff -u loncom/interface/lonmsgdisplay.pm:1.100 loncom/interface/lonmsgdisplay.pm:1.101
--- loncom/interface/lonmsgdisplay.pm:1.100	Fri Dec  5 19:38:32 2008
+++ loncom/interface/lonmsgdisplay.pm	Sun Dec  7 19:29:29 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging display
 #
-# $Id: lonmsgdisplay.pm,v 1.100 2008/12/05 19:38:32 schafran Exp $
+# $Id: lonmsgdisplay.pm,v 1.101 2008/12/07 19:29:29 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2263,29 +2263,66 @@
 # start output
     &printheader($r,'/adm/email?display='.&escape($msgid),'Display a Message','',$content{'baseurl'});
     my %courseinfo=&Apache::lonnet::coursedescription($content{'courseid'});
-# Functions
-    $r->print('<table border="2" width="100%"><tr bgcolor="#FFFFAA"><td>'.&mt('Functions').':</td>');
+
+# Functions and Actions
+    my $li_start='<span class="LC_nobreak">&bull; ';
+    my $li_end='</span> ';
+
+# Prepare available functions
+    my $functionlist='';
     if (!$content{'noreplies'}) {
-        $r->print('<td><a href="/adm/email?replyto='.&escape($msgid).$sqs.
-	          '"><b>'.&mt('Reply').'</b></a></td>');
-    }
-    $r->print('<td><a href="/adm/email?forward='.&escape($msgid).$sqs.
-	      '"><b>'.&mt('Forward').'</b></a></td>'.
-	      '<td><a href="/adm/email?markunread='.&escape($msgid).$sqs.
-	      '"><b>'.&mt('Mark Unread').'</b></a></td>'.
-	      '<td><a href="/adm/email?markdel='.&escape($msgid).$sqs.
-	      '"><b>'.&mt('Delete').'</b></a></td>'.
-	      '<td><a href="/adm/email?'.$sqs.
-	      '"><b>'.&mt('Back to Folder Display').'</b></a></td>');
+        $functionlist.=$li_start
+                     .'<a href="/adm/email?replyto='.&escape($msgid).$sqs.'">'
+                     .&mt('Reply')
+                     .'</a>'
+                     .$li_end;
+    }
+    $functionlist.=$li_start
+                  .'<a href="/adm/email?forward='.&escape($msgid).$sqs.'">'
+                  .&mt('Forward')
+                  .'</a>'
+                  .$li_end;
+    $functionlist.=$li_start
+                  .'<a href="/adm/email?markunread='.&escape($msgid).$sqs.'">'
+                  .&mt('Mark Unread')
+                  .'</a>'
+                  .$li_end;
+    $functionlist.=$li_start
+                  .'<a href="/adm/email?markdel='.&escape($msgid).$sqs.'">'
+                  .&mt('Delete')
+                  .'</a>'
+                  .$li_end;
+    $functionlist.=$li_start
+                  .'<a href="/adm/email?'.$sqs.'">'
+                  .&mt('Back to Folder Display')
+                  .'</a>'
+                  .$li_end;
     if ($counter > 0){
-	$r->print('<td><a href="/adm/email?display='.$messages[$counter-1]->[5].$sqs.
-		  '"><b>'.&mt('Previous').'</b></a></td>');
+        $functionlist.=$li_start
+              .'<a href="/adm/email?display='.$messages[$counter-1]->[5].$sqs.'">'
+              .&mt('Previous')
+              .'</a>'
+              .$li_end;
     }
     if ($counter < $number_of_messages - 1){
-	$r->print('<td><a href="/adm/email?display='.$messages[$counter+1]->[5].$sqs.
-		  '"><b>'.&mt('Next').'</b></a></td>');
-    }
-    $r->print('</tr></table>');
+        $functionlist.=$li_start
+              .'<a href="/adm/email?display='.$messages[$counter+1]->[5].$sqs.'">'
+              .&mt('Next')
+              .'</a>'
+              .$li_end;
+    }
+# Print functions
+    $r->print('<div>'
+             .'<fieldset>'
+             .'<legend>'
+             .&mt('Functions')
+             .'</legend>'
+             .$functionlist
+             .'</fieldset>'
+             .'</div>'
+    );
+
+# Prepare available actions
     my $symb;
     if (defined($content{'symb'})) {
         $symb = $content{'symb'};
@@ -2294,33 +2331,40 @@
     }
     if ($env{'user.adv'}) {
         my $actionlist='';
+
 	if (&Apache::lonnet::allowed('vgr',$env{'request.course.id'})) {
-		$actionlist.='<td><b>'
+		$actionlist.=$li_start
                             .&Apache::loncommon::track_student_link(
                                  &mt('View recent activity'),$content{'sendername'},$content{'senderdomain'},'check')
-                            .'</b></td>';
+                            .$li_end;
 	}
 	if (&Apache::lonnet::allowed('opa',$env{'request.course.id'}) && $symb) {
-	    $actionlist.='<td><b>'
+	    $actionlist.=$li_start
                         .&Apache::loncommon::pprmlink(
                              &mt('Set/Change parameters'),$content{'sendername'},$content{'senderdomain'},$symb,'check')
-                        .'</b></td>';
+                        .$li_end;
 	}
 	if (&Apache::lonnet::allowed('mgr',$env{'request.course.id'}) && $symb) {
-	    $actionlist.='<td><b>'
+	    $actionlist.=$li_start
                        .&Apache::loncommon::pgrdlink(
                             &mt('Set/Change grades'),$content{'sendername'},$content{'senderdomain'},$symb,'check')
-                       .'</b></td>';
+                       .$li_end;
 	}
+
+# Print actions
         if ($actionlist) {
-            $r->print('<table border="2" width="100%">'
-                     .'<tr bgcolor="#FFAAAA"><td>'
+            $r->print('<div>'
+                     .'<fieldset>'
+                     .'<legend>'
                      .&mt('Currently available actions (will open extra window):')
-                     .'</td>'
+                     .'</legend>'
                      .$actionlist
-                     .'</tr></table>');
+                     .'</fieldset>'
+                     .'</div>'
+            );
         }
     }
+
     my ($tonum,$tolist,$cclist,$bcclist,$groupcclist,%recipients);
     if ($content{'recipid'}) {
         $tonum = &retrieve_recips('display',\%content,\%recipients);