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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 10 Apr 2006 19:54:54 -0000


albertel		Mon Apr 10 15:54:54 2006 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
  Log:
  - addentries can be a hash now
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.328 loncom/interface/loncommon.pm:1.329
--- loncom/interface/loncommon.pm:1.328	Sun Apr  9 12:43:43 2006
+++ loncom/interface/loncommon.pm	Mon Apr 10 15:54:54 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.328 2006/04/09 16:43:43 www Exp $
+# $Id: loncommon.pm,v 1.329 2006/04/10 19:54:54 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2768,7 +2768,6 @@
     my $vlink=&designparm($function.'.vlink',$domain);
     my $sidebg=&designparm($function.'.sidebg',$domain);
 # Accessibility font enhance
-    unless ($addentries) { $addentries=''; }
     my $addstyle='';
     if ($env{'browser.fontenhance'} eq 'on') {
 	$addstyle=' font-size: x-large;';
@@ -2787,6 +2786,26 @@
 # Port for miniserver
     my $lonhttpdPort=$Apache::lonnet::perlvar{'lonhttpdPort'};
     if (!defined($lonhttpdPort)) { $lonhttpdPort='8080'; }
+    my $extra_body_attr;
+    if ($forcereg) {
+	if (ref($addentries)) {
+	    $addentries->{'onload'}   = &Apache::lonmenu::loadevents().
+		$addentries->{'onload'};
+	    $addentries->{'onunload'} = &Apache::lonmenu::unloadevents().
+		$addentries->{'onunload'};
+	} else {
+	    $extra_body_attr.=' onload="'.&Apache::lonmenu::loadevents().
+		'" onunload="'.&Apache::lonmenu::unloadevents().'"';
+	}
+    }
+    if (!ref($addentries)) {
+	$extra_body_attr .= $addentries;
+    } else {
+	foreach my $attr (keys(%$addentries)) {
+	    $extra_body_attr .= " $attr=\"".$addentries->{$attr}.'" ';
+	}
+    }
+
 # construct main body tag
     my $bodytag = <<END;
 <style type="text/css">
@@ -2799,7 +2818,7 @@
 .filename {font-family: monospace;}
 </style>
 <body bgcolor="$pgbg" text="$font" alink="$alink" vlink="$vlink" link="$link"
-style="margin-top: 0px;$addstyle" $addentries>
+style="margin-top: 0px;$addstyle" $extra_body_attr>
 END
     &Apache::lontexconvert::jsMath_reset();
     if ($env{'environment.texengine'} eq 'jsMath' ||