[LON-CAPA-cvs] cvs: loncom /publisher lonpublisher.pm

www www@source.lon-capa.org
Thu, 03 Dec 2009 17:23:00 -0000


www		Thu Dec  3 17:23:00 2009 EDT

  Modified files:              
    /loncom/publisher	lonpublisher.pm 
  Log:
  Part of Bug #6139: remove local tmp-preview files on re-publication
  
  
Index: loncom/publisher/lonpublisher.pm
diff -u loncom/publisher/lonpublisher.pm:1.264 loncom/publisher/lonpublisher.pm:1.265
--- loncom/publisher/lonpublisher.pm:1.264	Tue Nov 24 01:44:44 2009
+++ loncom/publisher/lonpublisher.pm	Thu Dec  3 17:23:00 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Publication Handler
 #
-# $Id: lonpublisher.pm,v 1.264 2009/11/24 01:44:44 raeburn Exp $
+# $Id: lonpublisher.pm,v 1.265 2009/12/03 17:23:00 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1668,11 +1668,10 @@
         
         if (copy($target,$copyfile)) {
 	    print $logfile "Copied old target to ".$copyfile."\n";
-            $r->print('<p>'.&mt('Copied old target file').'</p>');
+            $r->print(&Apache::lonhtmlcommon::confirm_success(&mt('Copied old target file')));
         } else {
 	    print $logfile "Unable to write ".$copyfile.':'.$!."\n";
-            $r->print("<span class=\"LC_error\">".&mt('Failed to copy old target').
-		", $!, ".&mt('FAIL')."</span>");
+            $r->print(&Apache::lonhtmlcommon::confirm_success(&mt('Failed to copy old target').", $!",1));
 	    return 0;
         }
         
@@ -1682,13 +1681,12 @@
         
         if (copy($target.'.meta',$copyfile)) {
 	    print $logfile "Copied old target metadata to ".$copyfile."\n";
-            $r->print('<p>'.&mt('Copied old metadata').'</p>')
+            $r->print(&Apache::lonhtmlcommon::confirm_success(&mt('Copied old metadata')));
         } else {
 	    print $logfile "Unable to write metadata ".$copyfile.':'.$!."\n";
             if (-e $target.'.meta') {
-                $r->print( 
-                    "<span class=\"LC_error\">".
-&mt('Failed to write old metadata copy').", $!, ".&mt('FAIL')."</span>");
+                $r->print(&Apache::lonhtmlcommon::confirm_success(
+                           &mt('Failed to write old metadata copy').", $!",1));
 		return 0;
 	    }
         }
@@ -1721,25 +1719,27 @@
     
     if (copy($source,$copyfile)) {
         print $logfile "\nCopied original source to ".$copyfile."\n";
-        $r->print('<p>'.&mt('Copied source file').'</p>');
+        $r->print(&Apache::lonhtmlcommon::confirm_success(&mt('Copied source file')));
     } else {
         print $logfile "\nUnable to write ".$copyfile.':'.$!."\n";
-        $r->print("<span class=\"LC_error\">".
-	    &mt('Failed to copy source').", $!, ".&mt('FAIL')."</span>");
+        $r->print(&Apache::lonhtmlcommon::confirm_success(
+	    &mt('Failed to copy source').", $!",1));
 	return 0;
     }
     
+# ---------------------------------------------- Delete local tmp-preview files
+    unlink($copyfile.'.tmp');
 # --------------------------------------------------------------- Copy Metadata
 
     $copyfile=$copyfile.'.meta';
     
     if (copy($source.'.meta',$copyfile)) {
         print $logfile "\nCopied original metadata to ".$copyfile."\n";
-        $r->print('<p>'.&mt('Copied metadata').'</p>');
+        $r->print(&Apache::lonhtmlcommon::confirm_success(&mt('Copied metadata')));
     } else {
         print $logfile "\nUnable to write metadata ".$copyfile.':'.$!."\n";
-        $r->print(
-            "<span class=\"LC_error\">".&mt('Failed to write metadata copy').", $!, ".&mt('FAIL')."</span>");
+        $r->print(&Apache::lonhtmlcommon::confirm_success(
+                  &mt('Failed to write metadata copy').", $!",1));
 	return 0;
     }
     $r->rflush;