[LON-CAPA-cvs] cvs: loncom /xml lonxml.pm

bowersj2 lon-capa-cvs@mail.lon-capa.org
Fri, 16 May 2003 18:34:56 -0000


bowersj2		Fri May 16 14:34:56 2003 EDT

  Modified files:              
    /loncom/xml	lonxml.pm 
  Log:
  If we're editing the file, show the filename in the title of the frame,
  which will show in the tabs.
  
  (Guy: Please make sure that $ENV{'form.editmode'} is true if and only
  if we're in editing mode; I think this is so but I don't want to be
  wrong.)
  
  Fixes bug 1448. 
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.251 loncom/xml/lonxml.pm:1.252
--- loncom/xml/lonxml.pm:1.251	Sat May  3 17:09:03 2003
+++ loncom/xml/lonxml.pm	Fri May 16 14:34:56 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.251 2003/05/03 21:09:03 albertel Exp $
+# $Id: lonxml.pm,v 1.252 2003/05/16 18:34:56 bowersj2 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1251,6 +1251,18 @@
   }
 
   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);