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

bisitz bisitz@source.lon-capa.org
Fri, 27 Mar 2009 16:18:04 -0000


bisitz		Fri Mar 27 16:18:04 2009 EDT

  Modified files:              
    /loncom/interface	lonmsgdisplay.pm 
  Log:
  Replaced hardcoded and handmade functionlist and actionslist
  by standard functionslists provided by lontemplate.pm
  
  
Index: loncom/interface/lonmsgdisplay.pm
diff -u loncom/interface/lonmsgdisplay.pm:1.118 loncom/interface/lonmsgdisplay.pm:1.119
--- loncom/interface/lonmsgdisplay.pm:1.118	Wed Mar 18 13:46:14 2009
+++ loncom/interface/lonmsgdisplay.pm	Fri Mar 27 16:18:04 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging display
 #
-# $Id: lonmsgdisplay.pm,v 1.118 2009/03/18 13:46:14 bisitz Exp $
+# $Id: lonmsgdisplay.pm,v 1.119 2009/03/27 16:18:04 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2280,61 +2280,46 @@
     &printheader($r,'/adm/email?display='.&escape($msgid),'Display a Message','',$content{'baseurl'});
     my %courseinfo=&Apache::lonnet::coursedescription($content{'courseid'});
 
-# Functions and Actions
-    my $li_start='<span class="LC_nobreak">&bull; ';
-    my $li_end='</span> ';
-
 # Prepare available functions
-    my $functionlist='';
+    my @functionlist;
     if (!$content{'noreplies'}) {
-        $functionlist.=$li_start
-                     .'<a href="/adm/email?replyto='.&escape($msgid).$sqs.'">'
+        push(@functionlist,'<a href="/adm/email?replyto='.&escape($msgid).$sqs.'">'
                      .&mt('Reply')
-                     .'</a>'
-                     .$li_end;
+                     .'</a>');
     }
-    $functionlist.=$li_start
-                  .'<a href="/adm/email?forward='.&escape($msgid).$sqs.'">'
+    push(@functionlist,'<a href="/adm/email?forward='.&escape($msgid).$sqs.'">'
                   .&mt('Forward')
-                  .'</a>'
-                  .$li_end;
-    $functionlist.=$li_start
-                  .'<a href="/adm/email?markunread='.&escape($msgid).$sqs.'">'
+                  .'</a>');
+    push(@functionlist,'<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.'">'
+                  .'</a>');
+    push(@functionlist,'<a href="/adm/email?markdel='.&escape($msgid).$sqs.'">'
                   .&mt('Delete')
-                  .'</a>'
-                  .$li_end;
-    $functionlist.=$li_start
-                  .'<a href="/adm/email?'.$sqs.'">'
+                  .'</a>');
+    push(@functionlist,'<a href="/adm/email?'.$sqs.'">'
                   .&mt('Back to Folder Display')
-                  .'</a>'
-                  .$li_end;
+                  .'</a>');
     if ($counter > 0){
-        $functionlist.=$li_start
-              .'<a href="/adm/email?display='.$messages[$counter-1]->[5].$sqs.'">'
-              .&mt('Previous')
-              .'</a>'
-              .$li_end;
+        push(@functionlist,'<a href="/adm/email?display='.$messages[$counter-1]->[5].$sqs.'">'
+                          .&mt('Previous')
+                          .'</a>');
     }
     if ($counter < $number_of_messages - 1){
-        $functionlist.=$li_start
-              .'<a href="/adm/email?display='.$messages[$counter+1]->[5].$sqs.'">'
-              .&mt('Next')
-              .'</a>'
-              .$li_end;
+        push(@functionlist,'<a href="/adm/email?display='.$messages[$counter+1]->[5].$sqs.'">'
+                          .&mt('Next')
+                          .'</a>');
     }
 # Print functions
+    my $legendtext='<span class="LC_mail_functions">'
+                   .&mt('Functions')
+                   .'</span>';
     $r->print('<div class="LC_left_float">'
-             .'<fieldset>'
-             .'<legend><span class="LC_mail_functions">'
-             .&mt('Functions')
-             .'</span></legend>'
-             .$functionlist
-             .'</fieldset>'
+                     .&Apache::lontemplate::start_functionslist($legendtext)
+    );
+    foreach my $item (@functionlist) {
+        $r->print(&Apache::lontemplate::item_functionslist($item));
+    }
+    $r->print(&Apache::lontemplate::end_functionslist()
              .'</div>'
     );
 
@@ -2346,36 +2331,43 @@
         $symb=&Apache::lonnet::symbread($content{'baseurl'});
     }
     if ($env{'user.adv'}) {
-        my $actionlist='';
+        my @actionlist;
 
 	if (&Apache::lonnet::allowed('vgr',$env{'request.course.id'})) {
-		$actionlist.=$li_start
-                            .&Apache::loncommon::track_student_link(
-                                 &mt('View recent activity'),$content{'sendername'},$content{'senderdomain'},'check')
-                            .$li_end;
+		push(@actionlist,&Apache::loncommon::track_student_link(
+                                      &mt('View recent activity')
+                                     ,$content{'sendername'}
+                                     ,$content{'senderdomain'}
+                                     ,'check'));
 	}
 	if (&Apache::lonnet::allowed('opa',$env{'request.course.id'}) && $symb) {
-	    $actionlist.=$li_start
-                        .&Apache::loncommon::pprmlink(
-                             &mt('Set/Change parameters'),$content{'sendername'},$content{'senderdomain'},$symb,'check')
-                        .$li_end;
+	    push(@actionlist,&Apache::loncommon::pprmlink(
+                                  &mt('Set/Change parameters')
+                                     ,$content{'sendername'}
+                                     ,$content{'senderdomain'}
+                                     ,$symb
+                                     ,'check'));
 	}
 	if (&Apache::lonnet::allowed('mgr',$env{'request.course.id'}) && $symb) {
-	    $actionlist.=$li_start
-                       .&Apache::loncommon::pgrdlink(
-                            &mt('Set/Change grades'),$content{'sendername'},$content{'senderdomain'},$symb,'check')
-                       .$li_end;
+	    push(@actionlist,&Apache::loncommon::pgrdlink(
+                                 &mt('Set/Change grades')
+                                     ,$content{'sendername'}
+                                     ,$content{'senderdomain'}
+                                     ,$symb
+                                     ,'check'));
 	}
 
 # Print actions
-        if ($actionlist) {
+        if (@actionlist) {
+            $legendtext=&mt('[_1]Currently available actions[_2] (will open extra window):'
+                           ,'<span class="LC_mail_functions">','</span>');
             $r->print('<div class="LC_left_float">'
-                     .'<fieldset>'
-                     .'<legend>'
-                     .&mt('[_1]Currently available actions[_2] (will open extra window):','<span class="LC_mail_functions">','</span>')
-                     .'</legend>'
-                     .$actionlist
-                     .'</fieldset>'
+                     .&Apache::lontemplate::start_functionslist($legendtext)
+            );
+            foreach my $item (@actionlist) {
+                $r->print(&Apache::lontemplate::item_functionslist($item));
+            }
+            $r->print(&Apache::lontemplate::end_functionslist()
                      .'</div>'
             );
         }