[LON-CAPA-cvs] cvs: loncom /interface lonaboutme.pm lonbulletin.pm lonchat.pm loncoursegroups.pm loncreateuser.pm londocs.pm lonfeedback.pm lonnavmaps.pm lonsimplepage.pm lonsyllabus.pm

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


This is a MIME encoded message

--albertel1144699196
Content-Type: text/plain

albertel		Mon Apr 10 15:59:56 2006 EDT

  Modified files:              
    /loncom/interface	lonaboutme.pm lonbulletin.pm lonchat.pm 
                     	loncoursegroups.pm loncreateuser.pm londocs.pm 
                     	lonfeedback.pm lonnavmaps.pm lonsimplepage.pm 
                     	lonsyllabus.pm 
  Log:
  - start_page takes care of registering urls and the loadeventes/ unloadevents needed
  
  
--albertel1144699196
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20060410155956.txt"

Index: loncom/interface/lonaboutme.pm
diff -u loncom/interface/lonaboutme.pm:1.41 loncom/interface/lonaboutme.pm:1.42
--- loncom/interface/lonaboutme.pm:1.41	Sat Apr  8 02:59:34 2006
+++ loncom/interface/lonaboutme.pm	Mon Apr 10 15:59:53 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # "About Me" Personal Information
 #
-# $Id: lonaboutme.pm,v 1.41 2006/04/08 06:59:34 albertel Exp $
+# $Id: lonaboutme.pm,v 1.42 2006/04/10 19:59:53 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -64,13 +64,6 @@
 # ------------------------------------------------------------ Get Query String
     &Apache::loncommon::get_unprocessed_cgi
                             ($ENV{'QUERY_STRING'},['forcestudent','register']);
-# ----------------------------------------------------- Force menu registration
-    my $addentries='';
-    if ($env{'form.register'}) {
-       $addentries=' onLoad="'.&Apache::lonmenu::loadevents().
-	   '" onUnload="'.&Apache::lonmenu::unloadevents().'"';
-       $r->print(&Apache::lonmenu::registerurl(1));
-    }
 # --------------------------------------------------------------- Force Student
     my $forcestudent='';
     if ($env{'form.forcestudent'}) { $forcestudent='student'; };
@@ -81,7 +74,6 @@
 	my $start_page = 
 	    &Apache::loncommon::start_page("Personal Information",undef,
 					   {'function'       => $forcestudent,
-					    'add_entries'    => $addentries,
 					    'domain'         => $cdom,
 					    'force_register' =>
 						$env{'form.register'},});
Index: loncom/interface/lonbulletin.pm
diff -u loncom/interface/lonbulletin.pm:1.34 loncom/interface/lonbulletin.pm:1.35
--- loncom/interface/lonbulletin.pm:1.34	Tue Mar 21 16:01:22 2006
+++ loncom/interface/lonbulletin.pm	Mon Apr 10 15:59:53 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Bulletin Board Handler
 #
-# $Id: lonbulletin.pm,v 1.34 2006/03/21 21:01:22 albertel Exp $
+# $Id: lonbulletin.pm,v 1.35 2006/04/10 19:59:53 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -76,16 +76,9 @@
     &Apache::loncommon::get_unprocessed_cgi
                 ($ENV{'QUERY_STRING'},['forcestudent','forceedit','register','origpage']);
 # ----------------------------------------------------- Force menu registration
-    my $addentries='';
-    if ($env{'form.register'}) {
-       $addentries=' onLoad="'.&Apache::lonmenu::loadevents();
-       if ($env{'form.origpage'}) {
-           $addentries .= "document.location='#newpost';";
-       }
-       $addentries .= '" onUnload="'.&Apache::lonmenu::unloadevents().'"';
-       $r->print(&Apache::lonmenu::registerurl(1));
-    } elsif ($env{'form.origpage'}) {
-         $addentries = "onLoad=\"document.location='#newpost';\"";
+    my %addentries;
+    if ($env{'form.origpage'}) {
+	$addentries{'onload'} = "document.location='#newpost';";
     }
 # --------------------------------------------------------------- Force Student
     my $forcestudent='';
@@ -101,7 +94,7 @@
 	my $start_page =
 	    &Apache::loncommon::start_page("Bulletin Board/Discussion",undef,
 					   {'function'       => $forcestudent,
-					    'add_entries'    => $addentries,
+					    'add_entries'    => \%addentries,
 					    'domain'         => $dom,
 					    'force_register' =>
 						$env{'form.register'}});
Index: loncom/interface/lonchat.pm
diff -u loncom/interface/lonchat.pm:1.12 loncom/interface/lonchat.pm:1.13
--- loncom/interface/lonchat.pm:1.12	Wed Mar 29 14:56:28 2006
+++ loncom/interface/lonchat.pm	Mon Apr 10 15:59:53 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Chat
 #
-# $Id: lonchat.pm,v 1.12 2006/03/29 19:56:28 raeburn Exp $
+# $Id: lonchat.pm,v 1.13 2006/04/10 19:59:53 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -61,11 +61,11 @@
     }
 # --------------------------------------------------- Print login screen header
     my $latexHelp = Apache::loncommon::helpLatexCheatsheet();
-    my $loaditems = 'onLoad="this.document.chatentry.newchat.focus();"';
+    my %loaditems = (onload => 'this.document.chatentry.newchat.focus();');
     my $start_page = 
 	&Apache::loncommon::start_page('Chat',undef,
 				       {'only_body'   => 1,
-					'add_entries' => $loaditems,});
+					'add_entries' => \%loaditems,});
     my $end_page = &Apache::loncommon::end_page();
     $r->print(<<ENDDOCUMENT);
 $start_page
Index: loncom/interface/loncoursegroups.pm
diff -u loncom/interface/loncoursegroups.pm:1.12 loncom/interface/loncoursegroups.pm:1.13
--- loncom/interface/loncoursegroups.pm:1.12	Wed Mar 29 11:22:46 2006
+++ loncom/interface/loncoursegroups.pm	Mon Apr 10 15:59:53 2006
@@ -976,23 +976,23 @@
 
 sub onload_action {
     my ($action,$state) = @_;
-    my $loaditems;
+    my %loaditems;
     if ((defined($env{'form.origin'})) && ($action eq 'create') &&
                 ($state eq 'pick_name' || $state eq 'pick_members' || 
                  $state eq 'pick_privs')) {
         unless ($env{'form.origin'} eq '') {
-            $loaditems = 
-             'onload="javascript:setFormElements(document.'.$state.')"';
+	    $loaditems{'onload'} = 
+		'javascript:setFormElements(document.'.$state.')';
         }
     }
     if (($action eq 'modify') &&
                 ($state eq 'change_settings' || $state eq 'change_members' ||
                  $state eq 'change_privs' || $state eq 'add_members' ||
                  $state eq 'pick_members')) {
-            $loaditems =
-             'onload="javascript:setFormElements(document.'.$state.')"';
+	$loaditems{'onload'} = 
+	    'javascript:setFormElements(document.'.$state.')';
     }
-    return $loaditems;
+    return \%loaditems;
 }
 
 sub footer {
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.111 loncom/interface/loncreateuser.pm:1.112
--- loncom/interface/loncreateuser.pm:1.111	Tue Mar 21 13:51:28 2006
+++ loncom/interface/loncreateuser.pm	Mon Apr 10 15:59:53 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.111 2006/03/21 18:51:28 albertel Exp $
+# $Id: loncreateuser.pm,v 1.112 2006/04/10 19:59:53 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -283,10 +283,10 @@
     $ccdomain=~s/\W//g;
     my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();
     my $dc_setcourse_code = '';
-    my $loaditem;
+    my %loaditem;
     if ($env{'request.role'} =~ m-^dc\./(\w+)/$-) {
         my $dcdom = $1;
-        $loaditem = qq|OnLoad="document.cu.coursedesc.value=''"|;
+        $loaditem{'onload'} = "document.cu.coursedesc.value=''";
         $dc_setcourse_code = <<"ENDSCRIPT";
     function setCourse() {
         var course = document.cu.dccourse.value;
@@ -361,7 +361,7 @@
     my $js = &user_modification_js($pjump_def, $dc_setcourse_code);
     my $start_page = 
 	&Apache::loncommon::start_page('Create Users, Change User Privileges',
-				       $js,{'add_entries' => $loaditem,});
+				       $js,{'add_entries' => \%loaditem,});
 
     my $forminfo =<<"ENDFORMINFO";
 <form action="/adm/createuser" method="post" name="cu">
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.224 loncom/interface/londocs.pm:1.225
--- loncom/interface/londocs.pm:1.224	Thu Mar 16 19:06:54 2006
+++ loncom/interface/londocs.pm	Mon Apr 10 15:59:53 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.224 2006/03/17 00:06:54 albertel Exp $
+# $Id: londocs.pm,v 1.225 2006/04/10 19:59:53 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2139,7 +2139,6 @@
     my $forcestandard = 0;
     my $forcesupplement;
     my $script='';
-    my $events='';
     my $showdoc=0;
     my $containertag;
     my $uploadtag;
@@ -2177,17 +2176,13 @@
        }
     } else { # got called in sequence from course
        $allowed=0;
-       $script='</script>'.&Apache::lonmenu::registerurl(1,undef).'<script>';
-       $events='onLoad="'.&Apache::lonmenu::loadevents().
-           '" onUnload="'.&Apache::lonmenu::unloadevents().'"';
     }
 
 # get course data
     my $coursenum=$env{'course.'.$env{'request.course.id'}.'.num'};
     my $coursedom=$env{'course.'.$env{'request.course.id'}.'.domain'};
 
-# get personal data
- 
+# get personal data 
     my $uname=$env{'user.name'};
     my $udom=$env{'user.domain'};
     my $plainname=&Apache::lonnet::escape(
@@ -2203,8 +2198,7 @@
 # -------------------------------------------------------------------- Body tag
     $script = '<script type="text/javascript">'."\n".$script."\n".'</script>';
     $r->print(&Apache::loncommon::start_page('Course Documents', $script,
-					     {'add_entries'    => $events,
-					      'force_register' => $showdoc,}).
+					     {'force_register' => $showdoc,}).
 	      &Apache::loncommon::help_open_menu('','','','',273,'RAT'));
   
   my %allfiles = ();
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.188 loncom/interface/lonfeedback.pm:1.189
--- loncom/interface/lonfeedback.pm:1.188	Thu Mar 23 17:39:51 2006
+++ loncom/interface/lonfeedback.pm	Mon Apr 10 15:59:53 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.188 2006/03/23 22:39:51 albertel Exp $
+# $Id: lonfeedback.pm,v 1.189 2006/04/10 19:59:53 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1498,10 +1498,10 @@
 </script>
 END
 
-  my $onload = 'onLoad="window.focus();setposttype();"';
+  my %onload = ('onload' => 'window.focus();setposttype();');
   my $start_page=
       &Apache::loncommon::start_page('Resource Feedback and Discussion',$js,
-				     {'add_entries' => $onload});
+				     {'add_entries' => \%onload});
 
   $r->print(<<END);
 $start_page
@@ -2201,12 +2201,12 @@
   }
   $feedurl=&Apache::lonenc::check_encrypt($feedurl);
   my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');
-  my $onload = 'onLoad=\'if (window.name!="loncapaclient") { this.document.reldt.submit(); self.window.close(); }\'';
+  my %onload = ('onload' => "if (window.name!='loncapaclient') { this.document.reldt.submit(); self.window.close(); }");
   my $start_page=
       &Apache::loncommon::start_page('New posts marked as read',undef,
 				     {'redirect'    => [2,$feedurl],
 				      'only_body'   => 1,
-				      'add_entries' => $onload});
+				      'add_entries' => \%onload});
   my $end_page = &Apache::loncommon::end_page();
 
   $r->print(<<ENDREDIR);
@@ -2233,7 +2233,7 @@
   my $nofeed=&mt('Sorry, no feedback possible on this resource  ...');
  
   my %body_options = ('only_body'   => 1,
-		      'add_entries' =>  'onLoad=\'if (window.name!="loncapaclient") { self.window.close(); }\'');
+		      'add_entries' => {'onload' => "if (window.name!='loncapaclient') { self.window.close(); }"});
 
   if ($feedurl !~ m{^/adm/feedback}) { 
       $body_options{'rediect'} = [2,$feedurl];
@@ -3107,12 +3107,12 @@
       &Apache::loncommon::content_type($r,'text/html');
       $r->send_http_header;
       my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');
-      my $onload = 'onLoad=\'if (window.name!="loncapaclient") { this.document.reldt.submit(); self.window.close(); }\'';
+      my %onload = ('onload' => "if (window.name!='loncapaclient') { this.document.reldt.submit(); self.window.close(); }");
       my $start_page=
 	  &Apache::loncommon::start_page('New posts marked as read',undef,
 					 {'redirect'    => [2,$feedurl],
 					  'only_body'   => 1,
-					  'add_entries' => $onload});
+					  'add_entries' => \%onload});
       my $end_page = &Apache::loncommon::end_page();
       $r->print (<<ENDREDIR);
 $start_page
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.374 loncom/interface/lonnavmaps.pm:1.375
--- loncom/interface/lonnavmaps.pm:1.374	Thu Mar 23 17:32:10 2006
+++ loncom/interface/lonnavmaps.pm	Mon Apr 10 15:59:53 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.374 2006/03/23 22:32:10 albertel Exp $
+# $Id: lonnavmaps.pm,v 1.375 2006/04/10 19:59:53 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -245,8 +245,6 @@
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['register','sort','showOnlyHomework','postsymb']);
     
 # ----------------------------------------------------- Force menu registration
-    my $addentries='';
-    my $more_unload;
     my $body_only='';
     my $js;
     if ($env{'environment.remotenavmap'} eq 'on') {
@@ -255,24 +253,13 @@
                    this.document.location="/adm/navmaps?collapseExternal";
                 }
              </script>';
-# FIXME need to be smarter to only catch window close events
-#	$more_unload="collapse()"
 	$body_only=1;
     }
-    if ($env{'form.register'}) {
-	$addentries=' onLoad="'.&Apache::lonmenu::loadevents().
-	    '" onUnload="'.&Apache::lonmenu::unloadevents().';'.
-	    $more_unload.'"';
-	$r->print(&Apache::lonmenu::registerurl(1));
-    } else {
-	$addentries=' onUnload="'.$more_unload.'"';
-    }
 
     # Header
     $r->print(&Apache::loncommon::start_page('Navigate Course Contents',$js,
-					     {'add_entries'     => $addentries,
-					      'only_body'       => $body_only,
-					      'force_resgister' =>
+					     {'only_body'       => $body_only,
+					      'force_register'  =>
 						  $env{'form.register'},}));
     $r->print('<script type="text/javascript">window.focus();</script>');
      
Index: loncom/interface/lonsimplepage.pm
diff -u loncom/interface/lonsimplepage.pm:1.37 loncom/interface/lonsimplepage.pm:1.38
--- loncom/interface/lonsimplepage.pm:1.37	Fri Apr  7 17:56:02 2006
+++ loncom/interface/lonsimplepage.pm	Mon Apr 10 15:59:54 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Simple Page Editor
 #
-# $Id: lonsimplepage.pm,v 1.37 2006/04/07 21:56:02 albertel Exp $
+# $Id: lonsimplepage.pm,v 1.38 2006/04/10 19:59:54 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -100,17 +100,11 @@
 # ------------------------------------------------------------ Get query string
     &Apache::loncommon::get_unprocessed_cgi
                         ($ENV{'QUERY_STRING'},['forcestudent','forceedit','register']);
-# ----------------------------------------------------- Force menu registration
-    my $addentries='';
-    if ($env{'form.register'}) {
-       $addentries=' onLoad="'.&Apache::lonmenu::loadevents().
-	   '" onUnload="'.&Apache::lonmenu::unloadevents().'"';
-    }
 # --------------------------------------------------------------- Force Student
     my $forcestudent='';
     if ($env{'form.forcestudent'} || $target eq 'tex' ) { $forcestudent='student'; };
-     my $forceedit='';
-     if ($env{'form.forceedit'}) { $forceedit='edit'; }
+    my $forceedit='';
+    if ($env{'form.forceedit'}) { $forceedit='edit'; }
 
    
     my %syllabus=&Apache::lonnet::dump($namespace,$dom,$crs);
@@ -125,7 +119,6 @@
 	my $start_page = 
 	    &Apache::loncommon::start_page($title,undef,
 					   {'function'       => $forcestudent,
-					    'add_entries'    => $addentries,
 					    'domain'         => $dom,
 					    'force_register' =>
 						$env{'form.register'},});
Index: loncom/interface/lonsyllabus.pm
diff -u loncom/interface/lonsyllabus.pm:1.50 loncom/interface/lonsyllabus.pm:1.51
--- loncom/interface/lonsyllabus.pm:1.50	Tue Mar 21 16:50:49 2006
+++ loncom/interface/lonsyllabus.pm	Mon Apr 10 15:59:54 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Syllabus
 #
-# $Id: lonsyllabus.pm,v 1.50 2006/03/21 21:50:49 albertel Exp $
+# $Id: lonsyllabus.pm,v 1.51 2006/04/10 19:59:54 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -71,12 +71,6 @@
     if ($target eq 'tex') {
 	$r->print(&Apache::lonprintout::print_latex_header($env{'form.latex_type'}));
     } 
-# ----------------------------------------------------- Force menu registration
-    my $addentries='';
-    if ($env{'form.register'}) {
-       $addentries=' onLoad="'.&Apache::lonmenu::loadevents().
-           '" onUnload="'.&Apache::lonmenu::unloadevents().'"';
-    }
 # -------------------------------------------------- Let's see who handles this
     my $externalsyllabus=$courseenv{'externalsyllabus'};
 
@@ -120,7 +114,6 @@
 	my $start_page = 
 	    &Apache::loncommon::start_page("Syllabus", $rss_link,
 					   {'function'       => $forcestudent,
-					    'add_entries'    => $addentries,
 					    'domain'         => $cdom,
 					    'force_register' =>
 						$env{'form.register'},});

--albertel1144699196--