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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 16 Mar 2006 22:42:59 -0000


albertel		Thu Mar 16 17:42:59 2006 EDT

  Modified files:              
    /loncom/interface	lonindexer.pm lonmanagekeys.pm 
  Log:
  - some more start_page stuff
  
  
Index: loncom/interface/lonindexer.pm
diff -u loncom/interface/lonindexer.pm:1.140 loncom/interface/lonindexer.pm:1.141
--- loncom/interface/lonindexer.pm:1.140	Mon Mar  6 13:23:10 2006
+++ loncom/interface/lonindexer.pm	Thu Mar 16 17:42:58 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Directory Indexer
 #
-# $Id: lonindexer.pm,v 1.140 2006/03/06 18:23:10 www Exp $
+# $Id: lonindexer.pm,v 1.141 2006/03/16 22:42:58 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -116,7 +116,7 @@
     my $closebutton='';
     my $groupimportbutton='';
     my $colspan=''; 
-
+    
     $extrafield='';
     my $diropendb = 
 	"/home/httpd/perl/tmp/$env{'user.domain'}_$env{'user.name'}_indexer.db";
@@ -133,7 +133,7 @@
     {
 	if ($env{'form.launch'} eq '1') {
 	    &start_fresh_session();
-   }
+	}
   #Hijack lonindexer to verify a title and be close down.
    if ($env{'form.launch'} eq '2') {
        &Apache::loncommon::content_type($r,'text/html');
@@ -145,11 +145,7 @@
 	   $verify_title=~s/'/\\'/g;
 	   $extra='window.opener.document.forms["'.$env{'form.form'}.'"].elements["'.$env{'form.titleelement'}.'"].value=\''.$verify_title.'\';';
        }
-       my $html=&Apache::lonxml::xmlbegin();
-       $r->print(<<ENDSUBM);
-	   $html
-	     <!-- Generated by lonindexer.pm -->
-	     <head>
+       my $js = <<ENDSUBM;
 	       <script type="text/javascript">
 		function load() {
 			window.opener.document.forms["$env{'form.form'}"]
@@ -159,11 +155,12 @@
 			window.close();
 		}
    	       </script>
-	     </head>
-    	<body onLoad="load();">
-     	</body>
-    	</html>
 ENDSUBM
+       $r->print(&Apache::loncommon::start_page(undef,$js,
+						{'only_body'   =>1,
+						 'add_entries' =>
+						     'onLoad="load();"',}).
+		 &Apache::loncommon::end_page());
        return OK;
    }
     
@@ -347,14 +344,7 @@
 	}
 
 # ---------------------------------------------------------------- Print Header
-	my $html=&Apache::lonxml::xmlbegin();
-	$r->print(<<ENDHEADER);
-$html
-<head>
-<title>The LearningOnline Network With CAPA Directory Browser</title>
-
-<!-- Generated by lonindexer.pm -->
-
+	my $js = <<"ENDHEADER";
 <script type="text/javascript">
 $catalogmodefunctions
 function openWindow(url, wdwName, w, h, toolbar,scrollbar,locationbar) {
@@ -372,12 +362,11 @@
     window.location=val+'?acts='+document.forms.fileattr.acts.value;
 }
 </script>
-
-</head>
 ENDHEADER
-my ($headerdom)=($uri=~/^\/res\/(\w+)\//);
-$r->print(&Apache::loncommon::bodytag('Browse Resources',undef,undef,undef,
-				      $headerdom));
+
+        my ($headerdom)=($uri=~/^\/res\/(\w+)\//);
+	$r->print(&Apache::loncommon::start_page('Browse Resources',$js,
+						 {'domain' => $headerdom,}));
 # - Evaluate actions from previous page (both cumulatively and chronologically)
         if ($env{'form.catalogmode'} eq 'groupimport') {
 	    my $acts=$env{'form.acts'};
@@ -598,7 +587,7 @@
 	$r->print('</td></tr></table>');
 
 # --------------------------------------------------- end the output and return
-	$r->print('</body></html>'."\n");
+	$r->print(&Apache::loncommon::end_page()."\n");
     }
     if(! $c->aborted()) {
 # write back into the temporary file
@@ -721,9 +710,12 @@
 }
 
 sub initdebug {
-    my $html=&Apache::lonxml::xmlbegin();
+    my $start_page=
+	&Apache::loncommon::start_page('Debug',undef,
+				       {'only_body' => 1,});
+    $start_page =~ s/\n/ /g;
     return <<ENDJS;
-<script>
+<script type="text/javascript">
 var debugging = true;
 if (debugging) {
     var debuggingWindow = window.open('','Debug','width=400,height=300',true);
@@ -734,14 +726,14 @@
         debuggingWindow.document.writeln(text);
     }
 }
-output('$html<head><title>Debugging Window</title><!-- for lonindexer.pm --></head><body><pre>');   
+output('$start_page<pre>');   
 </script>
 ENDJS
 }
 
 sub writedebug {
-    my $text = shift;
-    return "<script>output('$text');</script>";
+    my ($text) = @_;
+    return "<script type=\"text/javascript\">output('$text');</script>";
 }
 
 # -------------------- filters out files based on extensions (returns an array)
Index: loncom/interface/lonmanagekeys.pm
diff -u loncom/interface/lonmanagekeys.pm:1.17 loncom/interface/lonmanagekeys.pm:1.18
--- loncom/interface/lonmanagekeys.pm:1.17	Thu Apr  7 02:56:23 2005
+++ loncom/interface/lonmanagekeys.pm	Thu Mar 16 17:42:58 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to manage course access keys 
 #
-# $Id: lonmanagekeys.pm,v 1.17 2005/04/07 06:56:23 albertel Exp $
+# $Id: lonmanagekeys.pm,v 1.18 2006/03/16 22:42:58 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -41,14 +41,9 @@
 ###############################################################
 ###############################################################
 sub header {
-    my $html=&Apache::lonxml::xmlbegin();
-    my $bodytag=&Apache::loncommon::bodytag('Access Key Management');
+    my $start_page=&Apache::loncommon::start_page('Access Key Management');
     return(<<ENDHEAD);
-$html
-<head>
-<title>LON-CAPA Access Key Management</title>
-</head>
-$bodytag
+$start_page
 <form method="post" enctype="multipart/form-data"  
       action="/adm/managekeys" name="keyform">
 ENDHEAD
@@ -269,7 +264,7 @@
 <input type="submit" name="listkeys" value="List Keys/Add Comments" />
 <input type="submit" name="listkeyscsv" value="CSV List of Keys" />
 ENDKEYMENU
-	    $r->print('</form></body></html>');
+	    $r->print('</form>'.&Apache::loncommon::end_page());
 	}
     } else {
 	# Start page no course id
@@ -283,7 +278,7 @@
         $r->print(&Apache::loncommon::selectcourse_link(
 					        'keyform','course','domain'));
         $r->print('<br /><input type="submit" value="'.&mt('Manage Access Keys').'" />');
-	$r->print('</form></body></html>');
+	$r->print('</form>'.&Apache::loncommon::end_page());
     }
     return OK;
 }