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

bisitz lon-capa-cvs-allow@mail.lon-capa.org
Mon, 30 Jun 2008 18:10:24 -0000


bisitz		Mon Jun 30 14:10:24 2008 EDT

  Modified files:              
    /loncom/publisher	lonpublisher.pm 
  Log:
  - Shortened main headline and added new sub headline "Resource Details"
  - Wrapped resource details in LON-CAPA standard table
  - Added info text which asks the author to fill in the metadata
  - Added missing and optimzied some &mt() calls
  - Moved Finalize/Make Obsolete buttons out of metadata table
  - Optimized screen output with some <br /> and <p> tags
  - Added error style to output "...document contains errors..."
  - Extended output "...without responses..."
  
  
Index: loncom/publisher/lonpublisher.pm
diff -u loncom/publisher/lonpublisher.pm:1.238 loncom/publisher/lonpublisher.pm:1.239
--- loncom/publisher/lonpublisher.pm:1.238	Fri Jun 27 14:52:35 2008
+++ loncom/publisher/lonpublisher.pm	Mon Jun 30 14:10:24 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Publication Handler
 #
-# $Id: lonpublisher.pm,v 1.238 2008/06/27 18:52:35 bisitz Exp $
+# $Id: lonpublisher.pm,v 1.239 2008/06/30 18:10:24 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -274,7 +274,7 @@
     }
     &metaeval($metastring,$prefix);
     return '<br /><b>'.&mt('Processed file').':</b> <tt>'.
-	&Apache::loncfile::display($fn).'</tt>';
+	&Apache::loncfile::display($fn).'</tt><br />';
 }
 
 #########################################
@@ -797,7 +797,7 @@
                 }
                 if ((($token->[1] eq 'part') || ($token->[1] eq 'problem'))
                     && (!$responsecounter)) {
-                    my $outstring='<span class="LC_error">'.&mt('Found [_1] without responses',$token->[1]).'</span>';
+                    my $outstring='<span class="LC_error">'.&mt('Found [_1] without responses. This resource cannot be published.',$token->[1]).'</span>';
                     return ($outstring,1);
                 }
 	    } else {
@@ -968,7 +968,7 @@
 	    print $logfile "Copied original file to ".$copyfile."\n";
         } else {
 	    print $logfile "Unable to write backup ".$copyfile.':'.$!."\n";
-	    return ("<span class=\"LC_error\">Failed to write backup copy, $!,FAIL</span>",1);
+	    return ("<span class=\"LC_error\">".&mt("Failed to write backup copy, [_1], FAIL",$1)."</span>",1);
         }
 # ------------------------------------------------------------- IDs and indices
 	
@@ -1044,7 +1044,7 @@
      
     unless ($batch) {
      $scrout.='<h3>'.&mt('Metadata Information').' ' .
-       Apache::loncommon::help_open_topic("Metadata_Description")
+       &Apache::loncommon::help_open_topic("Metadata_Description")
        . '</h3>';
     }
 
@@ -1195,15 +1195,17 @@
 #   $env{'from.'..} so that it can be used by the phase two handler in
 #    batch mode
 
-    my $intr_scrout.=&Apache::lonhtmlcommon::start_pick_box()
+    my $intr_scrout.='<br />'
                     .'<form name="pubform" action="/adm/publish" method="post">';
     unless ($env{'form.makeobsolete'}) {
-       $intr_scrout.=&Apache::lonhtmlcommon::row_title()
-                    .'<input type="submit" value="'
+       $intr_scrout.='<p>'
+                    .&mt('Searching for your resource will be based on the following metadata. Please provide as much data as possible.')
+                    .'</p>'
+                    .'<p><input type="submit" value="'
                     .&mt('Finalize Publication')
-                    .'" />'
-                    .&Apache::lonhtmlcommon::row_closure()
+                    .'" /></p>';
     }
+    $intr_scrout.=&Apache::lonhtmlcommon::start_pick_box();
     $intr_scrout.=
 	&hiddenfield('phase','two').
 	&hiddenfield('filename',$env{'form.filename'}).
@@ -1390,12 +1392,11 @@
    }
     if (!$batch) {
 	$scrout.=$intr_scrout
-            .&Apache::lonhtmlcommon::row_title()
-            .'<input type="submit" value="'
+            .&Apache::lonhtmlcommon::end_pick_box()
+            .'<p><input type="submit" value="'
 	    .&mt($env{'form.makeobsolete'}?'Make Obsolete':'Finalize Publication')
-            .'" />'.&Apache::lonhtmlcommon::row_closure()
-            .'</form>'
-            .&Apache::lonhtmlcommon::end_pick_box();
+            .'" /></p>'
+            .'</form>';
     }
     return($scrout,0);
 }
@@ -1597,7 +1598,7 @@
         unless ($srcd=~/^\/home\/httpd\/html\/res/) {
             print $logfile "\nPANIC: Target dir is ".$srcd;
             $r->print(
-	 "<span class=\"LC_error\">Invalid target directory, FAIL</span>");
+	 "<span class=\"LC_error\">".&mt('Invalid target directory, FAIL')."</span>");
 	    return 0;
         }
         opendir(DIR,$srcd);
@@ -2122,28 +2123,57 @@
 	my $thistype=$1;
 	my $thisembstyle=&Apache::loncommon::fileembstyle($thistype);
         if ($thistype eq 'page') {  $thisembstyle = 'rat'; }
-	$r->print('<h2>'.&mt('Publishing').' '.
-		  &Apache::loncommon::filedescription($thistype).' <tt>');
 
+	$r->print('<h2>'.&mt('Publishing [_1]','<tt>'.$thisdisfn.'</tt>').'</h2>');
+
+        $r->print('<h3>'.&mt('Resource Details').'</h3>');
+
+        $r->print(&Apache::lonhtmlcommon::start_pick_box());
+
+        $r->print(&Apache::lonhtmlcommon::row_title(&mt('Type'))
+                 .&Apache::loncommon::filedescription($thistype)
+                 .&Apache::lonhtmlcommon::row_closure()
+                 );
+
+        $r->print(&Apache::lonhtmlcommon::row_title(&mt('Link to Resource'))
+                 .'<tt>'
+                 );
 	$r->print(<<ENDCAPTION);
 <a href='javascript:void(window.open("/~$cuname/$thisdisfn","cat","height=300,width=500,scrollbars=1,resizable=1,menubar=0,location=1"))'>
 $thisdisfn</a>
 ENDCAPTION
-        $r->print('</tt></h2><b>'.&mt('Target').':</b> <tt>'.
-		  $thisdistarget.'</tt><br />');
-   
+        $r->print('</tt>'
+                 .&Apache::lonhtmlcommon::row_closure()
+                 );
+
+        $r->print(&Apache::lonhtmlcommon::row_title(&mt('Target'))
+                 .'<tt>'.$thisdistarget.'</tt>'
+                 .&Apache::lonhtmlcommon::row_closure()
+                 );
+
+# SB - ToDo:   
 	if (($cuname ne $env{'user.name'})||($cudom ne $env{'user.domain'})) {
-	    $r->print('<h3><font color="red">'.&mt('Co-Author').': '.
-		      $cuname.&mt(' at ').$cudom.'</font></h3>');
+#           $r->print(&Apache::lonhtmlcommon::row_title('<span class="LC_warning">'.&mt('Co-Author').'</span>')
+            $r->print(&Apache::lonhtmlcommon::row_title(&mt('Co-Author'))
+                     .'<span class="LC_warning">'
+		     .&mt('[_1] at [_2]',$cuname,$cudom)
+                     .'</span>'
+                     .&Apache::lonhtmlcommon::row_closure()
+                     );
 	}
 
 	if (&Apache::loncommon::fileembstyle($thistype) eq 'ssi') {
+            $r->print(&Apache::lonhtmlcommon::row_title(&mt('Diffs')));
 	    $r->print(<<ENDDIFF);
-<br />
 <a href='javascript:void(window.open("/adm/diff?filename=/~$cuname/$thisdisfn&versiontwo=priv","cat","height=300,width=500,scrollbars=1,resizable=1,menubar=0,location=1"))'>
 ENDDIFF
-            $r->print(&mt('Diffs with Current Version').'</a><br />');
+            $r->print(&mt('Diffs with Current Version').'</a>'
+                     .&Apache::lonhtmlcommon::row_closure()
+                     );
+
 	}
+
+        $r->print(&Apache::lonhtmlcommon::end_pick_box());
   
 # ------------------ Publishing from $thisfn to $thistarget with $thisembstyle.
 
@@ -2158,7 +2188,7 @@
 		    &publish($thisfn,$thistarget,$thisembstyle);
 		$r->print('<hr />'.$outstring);
 	    } else {
-		$r->print('<h3>'.
+		$r->print('<h3 class="LC_error">'.
 			  &mt('The document contains errors and cannot be published.').
 			  '</h3>');
 	    }