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

raeburn raeburn@source.lon-capa.org
Wed, 27 Jan 2010 03:44:48 -0000


raeburn		Wed Jan 27 03:44:48 2010 EDT

  Modified files:              (Branch: version_2_9_X)
    /loncom/publisher	lonpublisher.pm 
  Log:
  - Backport 1.264 (part), 1.265.
  
  
Index: loncom/publisher/lonpublisher.pm
diff -u loncom/publisher/lonpublisher.pm:1.258.2.3 loncom/publisher/lonpublisher.pm:1.258.2.4
--- loncom/publisher/lonpublisher.pm:1.258.2.3	Tue Nov 24 01:11:53 2009
+++ loncom/publisher/lonpublisher.pm	Wed Jan 27 03:44:48 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Publication Handler
 #
-# $Id: lonpublisher.pm,v 1.258.2.3 2009/11/24 01:11:53 raeburn Exp $
+# $Id: lonpublisher.pm,v 1.258.2.4 2010/01/27 03:44:48 raeburn 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,13 @@
         
         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 +1720,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;
@@ -1770,16 +1771,14 @@
         
         my $thissrcdir=$thissrc;
         $thissrcdir=~s/\/[^\/]+$/\//;
-        
-        unless ($env{'request.role'} =~ /^aa/) {
-            $r->print(
-               '<hr /><a href="'.$thisdistarget.'"><font size="+2">'.
-               &mt('View Published Version').'</font></a>');
-        }
-        $r->print('<p><a href="'.$thissrc.'"><font size="+2">'.
+ 
+        $r->print(
+           '<hr /><a href="'.$thisdistarget.'"><font size="+2">'.
+           &mt('View Published Version').'</font></a>'.
+           '<p><a href="'.$thissrc.'"><font size="+2">'.
 		  &mt('Back to Source').'</font></a></p>'.
-                  '<p><a href="'.$thissrcdir.
-                  '"><font size="+2">'.
+           '<p><a href="'.$thissrcdir.
+                   '"><font size="+2">'.
 		  &mt('Back to Source Directory').'</font></a></p>');
     }
     return 1;