[LON-CAPA-cvs] cvs: rat / lonwrapper.pm loncom/interface lonindexer.pm lonsyllabus.pm loncom/lonnet/perl lonnet.pm

www lon-capa-cvs@mail.lon-capa.org
Thu, 20 Feb 2003 19:41:26 -0000


www		Thu Feb 20 14:41:26 2003 EDT

  Modified files:              
    /loncom/interface	lonindexer.pm lonsyllabus.pm 
    /loncom/lonnet/perl	lonnet.pm 
    /rat	lonwrapper.pm 
  Log:
  Created new subroutine to output only the body of a server-side included
  document, both internal and external. Added non-framed mode to lonwrapper
  for text-based interface, which still needs a little work.
  
  
Index: loncom/interface/lonindexer.pm
diff -u loncom/interface/lonindexer.pm:1.60 loncom/interface/lonindexer.pm:1.61
--- loncom/interface/lonindexer.pm:1.60	Thu Feb 13 18:06:10 2003
+++ loncom/interface/lonindexer.pm	Thu Feb 20 14:41:26 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Directory Indexer
 #
-# $Id: lonindexer.pm,v 1.60 2003/02/13 23:06:10 albertel Exp $
+# $Id: lonindexer.pm,v 1.61 2003/02/20 19:41:26 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -843,9 +843,7 @@
             my $output='';
             my $embstyle=&Apache::loncommon::fileembstyle($curfext);
 	    if ($embstyle eq 'ssi') {
-	       $output=&Apache::lonnet::ssi($filelink);
-               $output=~s/^.*\<body[^\>]*\>//si;
-               $output=~s/\<\/body\s*\>.*$//si;
+	       $output=&Apache::lonnet::ssi_body($filelink);
                $output='<font size="-2">'.$output.'</font>';
 	   } elsif ($embstyle eq 'img') {
                $output='<img src="'.$filelink.'" />';
Index: loncom/interface/lonsyllabus.pm
diff -u loncom/interface/lonsyllabus.pm:1.12 loncom/interface/lonsyllabus.pm:1.13
--- loncom/interface/lonsyllabus.pm:1.12	Mon Feb 10 15:03:13 2003
+++ loncom/interface/lonsyllabus.pm	Thu Feb 20 14:41:26 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Syllabus
 #
-# $Id: lonsyllabus.pm,v 1.12 2003/02/10 20:03:13 www Exp $
+# $Id: lonsyllabus.pm,v 1.13 2003/02/20 19:41:26 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -174,11 +174,7 @@
                       my $embstyle=&Apache::loncommon::fileembstyle($curfext);
 	              if (($embstyle eq 'ssi') || ($curfext=~/\/$/)) {
 # make ssi call and remove everything but the body contents
-	                 $output=
-                 ($filelink=~/^http\:/?&Apache::lonnet::externalssi($filelink):
-                                       &Apache::lonnet::ssi($filelink));
-                         $output=~s/^.*\<body[^\>]*\>//si;
-                         $output=~s/\<\/body\s*\>.*$//si;
+			  $output=&Apache::lonnet::ssi_body($filelink);
 	              } elsif ($embstyle eq 'img') {
 # embed as an image
                          $output='<img src="'.$filelink.'" />';
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.329 loncom/lonnet/perl/lonnet.pm:1.330
--- loncom/lonnet/perl/lonnet.pm:1.329	Thu Feb 13 17:22:01 2003
+++ loncom/lonnet/perl/lonnet.pm	Thu Feb 20 14:41:26 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.329 2003/02/13 22:22:01 matthew Exp $
+# $Id: lonnet.pm,v 1.330 2003/02/20 19:41:26 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -802,6 +802,16 @@
            }
        }
     }
+}
+
+# ------------------------------------------------ Get server side include body
+sub ssi_body {
+    my $filelink=shift;
+    my $output=($filelink=~/^http\:/?&externalssi($filelink):
+                                     &ssi($filelink));
+    $output=~s/^.*\<body[^\>]*\>//si;
+    $output=~s/\<\/body\s*\>.*$//si;
+    return $output;
 }
 
 # --------------------------------------------------------- Server Side Include
Index: rat/lonwrapper.pm
diff -u rat/lonwrapper.pm:1.8 rat/lonwrapper.pm:1.9
--- rat/lonwrapper.pm:1.8	Fri Feb 14 14:35:55 2003
+++ rat/lonwrapper.pm	Thu Feb 20 14:41:26 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Wrapper for external and binary files as standalone resources
 #
-# $Id: lonwrapper.pm,v 1.8 2003/02/14 19:35:55 www Exp $
+# $Id: lonwrapper.pm,v 1.9 2003/02/20 19:41:26 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -60,7 +60,11 @@
   my $events='onLoad="'.&Apache::lonmenu::loadevents.
            '" onUnload="'.&Apache::lonmenu::unloadevents.'"';
   my $script=&Apache::lonmenu::registerurl(1,undef);
-  $r->print(<<ENDDOCUMENT);
+  unless ($ENV{'browser.interface'} eq 'textual') {
+#
+# frame-based rendering for graphical interface
+#
+     $r->print(<<ENDDOCUMENT);
 <html>
 <head>
 $script
@@ -71,6 +75,17 @@
 </frameset>
 </html>
 ENDDOCUMENT
+  } else {
+#
+# ssi-based rendering for text-based interface
+#
+      $r->print('<html><head>'.
+                &Apache::lonmenu::registerurl(1).
+                '</head>'.
+                &Apache::loncommon::bodytag().
+                &Apache::lonmenu::menubuttons(1).
+                &Apache::lonnet::ssi_body($url).'</body></html>');
+  }
   return OK;
 }