[LON-CAPA-cvs] cvs: rat / lonratedt.pm

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 11 Apr 2006 19:35:17 -0000


albertel		Tue Apr 11 15:35:17 2006 EDT

  Modified files:              
    /rat	lonratedt.pm 
  Log:
  - start_page
  
  
  
Index: rat/lonratedt.pm
diff -u rat/lonratedt.pm:1.74 rat/lonratedt.pm:1.75
--- rat/lonratedt.pm:1.74	Fri Jun 10 17:45:46 2005
+++ rat/lonratedt.pm	Tue Apr 11 15:35:16 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Edit Handler for RAT Maps
 #
-# $Id: lonratedt.pm,v 1.74 2005/06/10 21:45:46 www Exp $
+# $Id: lonratedt.pm,v 1.75 2006/04/11 19:35:16 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -405,25 +405,31 @@
 # --------------------------------------------------------- Build up RAT screen
 sub ratedt {
   my ($r,$url)=@_;
-  my $frameset = '<frameset rows="1,70,*" border="0">';
-  if ($env{'environment.remote'} eq 'off') {
-      $frameset = '<frameset rows="1,250,*" border="0">';
+  my %layout = ('border' => "0");
+    if ($env{'environment.remote'} eq 'off') {
+      $layout{'rows'} = "1,250,*";
+  } else {
+      $layout{'rows'} = "1,70,*";
   }
-  $r->print(<<ENDDOCUMENT);
-
-<html>
-<head>
-<script language="JavaScript">
+  my $js ='
+<script type="text/javascript">
     var flag=0;
-</script>
-</head>
-$frameset
-<frame name=server src="$url/loadonly/ratserver" noresize noscroll>
-<frame name=code src="$url/loadonly/adveditmenu">
-<frame name=mapout src="/adm/rat/map.html">
-</frameset>
-</html>
+</script>';
+
+  my $start_page = 
+      &Apache::loncommon::start_page('Edit Sequence',$js,
+				     {'frameset'    => 1,
+				      'add_entries' => \%layout});
+  my $end_page = 
+      &Apache::loncommon::end_page({'frameset' => 1});
 
+  $r->print(<<ENDDOCUMENT);
+$start_page
+<frame name="server" src="$url/loadonly/ratserver" noresize="noresize"
+       noscroll="noscroll" />
+<frame name="code" src="$url/loadonly/adveditmenu" />
+<frame name="mapout" src="/adm/rat/map.html" />
+$end_page
 ENDDOCUMENT
 }
 
@@ -1022,9 +1028,7 @@
 
 # ----------------------------------------------------- Start simple RAT screen
    my $editscript=&editscript('simple');
-   my $bodytag=&Apache::loncommon::bodytag(undef,undef,undef,
-					($env{'environment.remote'} ne 'off')).
-       &Apache::loncommon::help_open_menu('','Sequence_Simple_Editor_Creation','Sequence_Simple_Editor_Creation','',6,'RAT');
+
    my %lt=&Apache::lonlocal::texthash(
 				      'sa' => 'Save',
 				      'nt' => 'New Title',
@@ -1046,10 +1050,8 @@
                                       'pas' => 'Paste after selected',
                                       'reco' => 'Recover Deleted'
 				      );
-   $r->print(<<ENDSMPHEAD);
-<html>
-<head>
-<script>
+   my $js=<<ENDJS;
+<script type="text/javascript>
 
    $editscript
 
@@ -1092,8 +1094,17 @@
    }
 
 </script>
-</head>                 
-$bodytag
+ENDJS
+
+    my $start_page =
+        &Apache::loncommon::start_page(undef,$js,
+				       {'only_body' =>
+					    ($env{'environment.remote'} ne 'off')}).
+        &Apache::loncommon::help_open_menu('','Sequence_Simple_Editor_Creation','Sequence_Simple_Editor_Creation','',6,'RAT');    
+    my $end_page = &Apache::loncommon::end_page();
+
+    $r->print(<<ENDSMPHEAD);
+$start_page
 $buttons
 <font color=red>$errtext</font>
 <form name=simpleedit method=post>
@@ -1160,29 +1171,27 @@
 <input type=hidden name=targetdetail value="$targetdetail">
 <input type=hidden name=impfortarget value="0">
 </form>
-</body></html>
+$end_page
 ENDSMPHEAD
 }
 
 # ----------------------------------------------------------------- No such dir
 sub nodir {
    my ($r,$dir)=@_;
-   $dir=~s/^\/home\/\w+\/public\_html//;
-   $r->print(<<ENDNODIR);
-<html>
-<body bgcolor='#FFFFFF'>
-<h1>No such directory: $dir</h1>
-</body>
-</html>
-ENDNODIR
+   $dir=~s{^/home/\w+/public_html}{};
+   $r->print(&Apache::loncommon::start_page(undef,undef,
+					    {'only_body' => 1,
+					     'bgcolor'   => '#FFFFFF',}).
+	     "<h1>No such directory: $dir</h1>".
+	     &Apache::loncommon::end_page());
 }
 
 # ---------------------------------------------------------------- View Handler
 
 sub viewmap {
     my ($r,$url,$adv,$errtext)=@_;
-    $r->print('<html>'.
-     &Apache::loncommon::bodytag('Edit Content of a Map').
+    $r->print(
+	      &Apache::loncommon::start_page('Edit Content of a Map').
 	      &Apache::loncommon::help_open_menu('','','','',6,'RAT').
 	      &buttons($adv));
     if ($errtext) {
@@ -1235,7 +1244,7 @@
         }
     }
     $r->print('</table>');
-    $r->print('</body></html>');
+    $r->print(&Apache::loncommon::end_page());
 }
 
 # ================================================================ Main Handler