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

www lon-capa-cvs@mail.lon-capa.org
Wed, 13 Aug 2003 14:23:37 -0000


www		Wed Aug 13 10:23:37 2003 EDT

  Modified files:              
    /loncom/xml	lonxml.pm 
  Log:
  Bug #486: feedback after saving HTML/XML file.
  Jay Ihry
  Gerd: changed from lazy loading of POSIX 
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.270 loncom/xml/lonxml.pm:1.271
--- loncom/xml/lonxml.pm:1.270	Mon Aug 11 16:05:53 2003
+++ loncom/xml/lonxml.pm	Wed Aug 13 10:23:37 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.270 2003/08/11 20:05:53 albertel Exp $
+# $Id: lonxml.pm,v 1.271 2003/08/13 14:23:37 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -69,6 +69,7 @@
 use Math::Cephes();
 use Math::Random();
 use Opcode();
+use POSIX qw(strftime);
 
 
 sub register {
@@ -1137,8 +1138,10 @@
     if (my $fh=Apache::File->new('>'.$file)) {
 	print $fh $contents;
         $fh->close();
+        return 1;
     } else {
-      &warning("Unable to save file $file");
+	&warning("Unable to save file $file");
+	return 0;
     }
 }
 
@@ -1242,7 +1245,9 @@
 #
     unless ($ENV{'request.state'} eq 'published') {
 	if (($ENV{'form.savethisfile'}) || ($ENV{'form.attemptclean'})) {
-	    &storefile($file,$ENV{'form.filecont'});
+	    if (&storefile($file,$ENV{'form.filecont'})) {
+		$request->print("<font COLOR=\"#0000FF\">Updated: ". strftime("%d %b %H:%M:%S",localtime())." </font>");
+	    } 
 	}
     }
     my %mystyle;