[LON-CAPA-cvs] cvs: loncom /interface lonmenu.pm /publisher lonpubdir.pm /xml lonxml.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 16 May 2003 20:47:08 -0000


albertel		Fri May 16 16:47:08 2003 EDT

  Modified files:              
    /loncom/interface	lonmenu.pm 
    /loncom/xml	lonxml.pm 
    /loncom/publisher	lonpubdir.pm 
  Log:
  - should take care of #1448,
    - directories put their name in the title
    - any html puts a name in the title
  
  (currently images don't and I don't see any good way of changing that.)
  
  
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.65 loncom/interface/lonmenu.pm:1.66
--- loncom/interface/lonmenu.pm:1.65	Fri Apr 18 13:51:32 2003
+++ loncom/interface/lonmenu.pm	Fri May 16 16:47:07 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.65 2003/04/18 17:51:32 www Exp $
+# $Id: lonmenu.pm,v 1.66 2003/05/16 20:47:07 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -164,7 +164,11 @@
     my $forcereg=shift;
     my $target = shift;
     my $result = '';
-    
+
+    my $force_title='';
+    if ($ENV{'request.state'} eq 'construct') {
+	$force_title=&Apache::lonxml::display_title();
+    }
     if ($target eq 'edit') {
         $result .="<script type=\"text/javascript\">\n".
             "if (typeof swmenu != 'undefined') {swmenu.currentURL=null;}\n".
@@ -177,12 +181,12 @@
          (!&Apache::lonnet::is_on_map($ENV{'REQUEST_URI'}))) &&
         (!$forcereg))) {
 	return $result.
-         '<script type="text/javascript">function LONCAPAreg(){;} function LONCAPAstale(){}</script>';
+         '<script type="text/javascript">function LONCAPAreg(){;} function LONCAPAstale(){}</script>'.$force_title;
     }
 # Graphical display after login only
     if ($Apache::lonxml::registered && !$forcereg) { return ''; }
     $result.=&innerregister($forcereg,$target);
-    return $result;
+    return $result.$force_title;
 }
 
 # =========== This gets called in order to register a URL, both with the Remote
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.252 loncom/xml/lonxml.pm:1.253
--- loncom/xml/lonxml.pm:1.252	Fri May 16 14:34:56 2003
+++ loncom/xml/lonxml.pm	Fri May 16 16:47:07 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.252 2003/05/16 18:34:56 bowersj2 Exp $
+# $Id: lonxml.pm,v 1.253 2003/05/16 20:47:07 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1252,21 +1252,23 @@
 
   writeallows($request->uri);
 
-  # If we're editing, show the filename of the resource in the frame's main
-  # title
-  if ($ENV{'form.editmode'}) {
-      my $filename = $request->uri;
-      # Everything after the last /
-      $filename = substr($filename, rindex($filename, '/') + 1);
-      $result = substr($result, 0, rindex($result, '</html>'));
-      $result .= "<script>top.document.title = '$filename - LON-CAPA Construction Space';</script>";
-      $result .= "\n</html>\n";
-  }
-
 
   $request->print($result);
 
   return OK;
+}
+
+sub display_title {
+    my $result;
+    if ($ENV{'request.state'} eq 'construct') {
+	my $title=&Apache::lonnet::gettitle();
+	if (!defined($title) || $title eq '') {
+	    $title = $ENV{'request.filename'};
+	    $title = substr($title, rindex($title, '/') + 1);
+	}
+	$result = "<script type='text/javascript'>top.document.title = '$title - LON-CAPA Construction Space';</script>";
+    }
+    return $result;
 }
 
 sub debug {
Index: loncom/publisher/lonpubdir.pm
diff -u loncom/publisher/lonpubdir.pm:1.30 loncom/publisher/lonpubdir.pm:1.31
--- loncom/publisher/lonpubdir.pm:1.30	Mon Feb  3 13:03:53 2003
+++ loncom/publisher/lonpubdir.pm	Fri May 16 16:47:08 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # (Publication Handler
 #
-# $Id: lonpubdir.pm,v 1.30 2003/02/03 18:03:53 harris41 Exp $
+# $Id: lonpubdir.pm,v 1.31 2003/05/16 20:47:08 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -202,7 +202,10 @@
 ENDPUBDIRSCRIPT
 
     $r->print('<h1>Construction Space Directory <tt>'.
-	      $thisdisfn.'/</tt></h1>'.$pubdirscript.
+	      $thisdisfn.'/</tt></h1>'.
+	      '<script type="text/javascript">top.document.title = \''.
+	      $thisdisfn.'/ - LON-CAPA Construction Space\';</script>'.
+	      $pubdirscript.
               '<form method="post" action="/adm/publish" target="_parent">'.
               '<input type="hidden" name="filename" value="/~'.
                $uname.$thisdisfn.'/" />'.