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

www lon-capa-cvs@mail.lon-capa.org
Thu, 25 Sep 2003 22:30:06 -0000


This is a MIME encoded message

--www1064529006
Content-Type: text/plain

www		Thu Sep 25 18:30:06 2003 EDT

  Modified files:              
    /loncom/interface	lonmeta.pm 
    /loncom/publisher	lonpubdir.pm lonpublisher.pm 
  Log:
  Bug #1715 "obsolete marking" and internationalization
  
  
--www1064529006
Content-Type: text/plain
Content-Disposition: attachment; filename="www-20030925183006.txt"

Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.35 loncom/interface/lonmeta.pm:1.36
--- loncom/interface/lonmeta.pm:1.35	Sun Sep 21 20:48:32 2003
+++ loncom/interface/lonmeta.pm	Thu Sep 25 18:30:06 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.35 2003/09/22 00:48:32 www Exp $
+# $Id: lonmeta.pm,v 1.36 2003/09/25 22:30:06 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -244,6 +244,14 @@
    $customdistributionfile='<a href="'.$content{'customdistributionfile'}.
      '"><tt>'.$content{'customdistributionfile'}.'</tt></a>';
 }
+
+my $obsolete=$content{'obsolete'};
+my $obsoletereplace=$content{'obsoletereplacement'};
+my $obsoletewarning='';
+if (($obsolete) && ($ENV{'user.adv'})) {
+    $obsoletewarning='<p><font color="red">'.&mt('This resource has been marked obsolete by the author(s)').'</font></p>';
+}
+
 my %lt=&Apache::lonlocal::texthash(
 				   'au' =>'Author(s)',
 				   'sb' => 'Subject',
@@ -255,7 +263,10 @@
 				   'cd' => 'Creation Date',
 				   'pu' => 'Publisher/Owner',
                                    'co' => 'Copyright/Distribution',
-				   'cf' => 'Custom Distribution File');
+				   'cf' => 'Custom Distribution File',
+                                   'ob' => 'Obsolete',
+                                   'or' => 
+                                    'Suggested Replacement for Obsolete File');
 my $bodytag=&Apache::loncommon::bodytag
             ('Catalog Information','','','',$resdomain);
   $r->print(<<ENDHEAD);
@@ -263,6 +274,7 @@
 $bodytag
 <h2>$content{'title'}</h2>
 <h3><tt>$disuri</tt></h3>
+$obsoletewarning
 $versiondisplay<br />
 <table cellspacing=2 border=0>
 <tr><td bgcolor='#AAAAAA'>$lt{'au'}</td>
@@ -289,6 +301,10 @@
 <td bgcolor="#CCCCCC">$content{'copyright'}&nbsp;</td></tr>
 <tr><td bgcolor='#AAAAAA'>$lt{'cf'}</td>
 <td bgcolor="#CCCCCC">$customdistributionfile&nbsp;</td></tr>
+<tr><td bgcolor='#AAAAAA'>$lt{'ob'}</td>
+<td bgcolor="#CCCCCC">$obsolete&nbsp;</td></tr>
+<tr><td bgcolor='#AAAAAA'>$lt{'or'}</td>
+<td bgcolor="#CCCCCC">$obsoletereplace&nbsp;</td></tr>
 </table>
 ENDHEAD
   delete($content{'title'});
@@ -304,6 +320,8 @@
   delete($content{'owner'});
   delete($content{'copyright'});
   delete($content{'customdistributionfile'});
+  delete($content{'obsolete'});
+  delete($content{'obsoletereplacement'});
   if ($ENV{'user.adv'}) {
 # ------------------------------------------------------------ Dynamic Metadata
    $r->print(
Index: loncom/publisher/lonpubdir.pm
diff -u loncom/publisher/lonpubdir.pm:1.39 loncom/publisher/lonpubdir.pm:1.40
--- loncom/publisher/lonpubdir.pm:1.39	Sun Sep 21 23:02:06 2003
+++ loncom/publisher/lonpubdir.pm	Thu Sep 25 18:30:06 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Construction Space Directory Lister
 #
-# $Id: lonpubdir.pm,v 1.39 2003/09/22 03:02:06 www Exp $
+# $Id: lonpubdir.pm,v 1.40 2003/09/25 22:30:06 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -221,11 +221,14 @@
               '<form method="post" action="/adm/publish" target="_parent">'.
               '<table><tr><td><input type="hidden" name="filename" value="/~'.
                $uname.$thisdisfn.'/" />'.
-              '<input type="button" onClick="pubdir(this.form);" value="Publish Directory" />'.
+              '<input type="button" onClick="pubdir(this.form);" value="'.
+&mt('Publish Directory').'" />'.
               '<input type="hidden" name="pubrec" value="" />'.
-              '<input type="button" onClick="pubrecdir(this.form);" value="Publish Directory and Sub Directories" /></td><td>'.
+              '<input type="button" onClick="pubrecdir(this.form);" value="'.
+&mt('Publish Directory and Sub Directories').'" /></td><td>'.
 '<input type="button" onClick="window.location='."'/~".
-               $uname.$thisdisfn."/default.meta'".'" value="Edit Directory Catalog Information" /></td></tr><tr><td><input type="checkbox" name="forcerepub" /> Force publication of unmodified files.</td><td>&nbsp;</td></tr></table></form>');
+               $uname.$thisdisfn."/default.meta'".'" value="'.
+&mt('Edit Directory Catalog Information').'" /></td></tr><tr><td><input type="checkbox" name="forcerepub" /> '.&mt('Force publication of unmodified files').'.</td><td>&nbsp;</td></tr></table></form>');
     
     if (($uname ne $ENV{'user.name'}) || ($udom ne $ENV{'user.domain'})) {
 	$r->print('<h3>'.&mt('Co-Author').': '.$uname.' at '.$udom.
@@ -247,7 +250,7 @@
     my $title    = &Apache::lonnet::metadata($fullname, 'title');
 
     unless ($title) {
-	$title = "[untitled]";
+	$title = "[".&mt('untitled')."]";
     }
     return $title;
 }
@@ -303,6 +306,10 @@
 	if ($rmtime>=$cmtime) {
 	    $status='Published';
             $bgcolor='#CCFFCC';
+	    if (&Apache::lonnet::metadata($targetdir.'/'.$filename,'obsolete')) {
+		$status='Obsolete';
+                $bgcolor='#AAAAAA';
+	    }
 	    $title='<a href="/res/'.$targetdir.'/'.$filename.
 		'.meta" target=cat>'.
 		getTitleString($targetdir.'/'.$filename, 'title').'</a>';
@@ -331,14 +338,14 @@
     }
     $r->print('<tr bgcolor="'.$bgcolor.'">'.
 	      '<td><a target="_parent" href="/adm/publish?filename=/~'.
-	      $uname.$thisdisfn.'/'.$filename.'">'.'Publish</a>'.
+	      $uname.$thisdisfn.'/'.$filename.'">'.&mt('Publish').'</a>'.
 	      '</td>'.
 	      '<td>'.
 	      '<a href="'.$linkdir.'/'.$filename.'" target="_top">'.
                $filename.'</a>'.$editlink2.$editlink.
 	      '</td>'.
 	      '<td>'.$title.'</td>'.
-	      '<td>'.$status.'</td>'.
+	      '<td>'.&mt($status).'</td>'.
 	      '<td>'.localtime($cmtime).'</td>'.
 	      "</tr>\n");
     return OK;
Index: loncom/publisher/lonpublisher.pm
diff -u loncom/publisher/lonpublisher.pm:1.137 loncom/publisher/lonpublisher.pm:1.138
--- loncom/publisher/lonpublisher.pm:1.137	Thu Sep 25 16:13:19 2003
+++ loncom/publisher/lonpublisher.pm	Thu Sep 25 18:30:06 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Publication Handler
 #
-# $Id: lonpublisher.pm,v 1.137 2003/09/25 20:13:19 albertel Exp $
+# $Id: lonpublisher.pm,v 1.138 2003/09/25 22:30:06 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1301,6 +1301,9 @@
     $metadatafields{'copyright'}=$ENV{'form.copyright'};
     $metadatafields{'customdistributionfile'}=
                                  $ENV{'form.customdistributionfile'};
+    $metadatafields{'obsolete'}=$ENV{'form.obsolete'};
+    $metadatafields{'obsoletereplacement'}=
+	                        $ENV{'form.obsoletereplacement'};
     $metadatafields{'dependencies'}=$ENV{'form.dependencies'};
     
     my $allkeywords=$ENV{'form.addkey'};
@@ -1351,7 +1354,7 @@
     unless ($metadatafields{'copyright'} eq 'priv') {
         my ($error,$success) = &store_metadata(\%metadatafields);
         if ($success) {
-            $r->print('<p>Synchronized SQL metadata database</p>');
+            $r->print('<p>'.&mt('Synchronized SQL metadata database').'</p>');
             print $logfile "\nSynchronized SQL metadata database";
         } else {
             $r->print($error);
@@ -1421,7 +1424,7 @@
         
         
     } else {
-        $r->print('<p>Initial version</p>');
+        $r->print('<p>'.&mt('Initial version').'</p>');
         print $logfile "\nInitial version";
     }
 
@@ -1513,10 +1516,12 @@
         
         $r->print(
            '<hr /><a href="'.$thisdistarget.'"><font size="+2">'.
-           'View Published Version</font></a>'.
-           '<p><a href="'.$thissrc.'"><font size=+2>Back to Source</font></a></p>'.
+           &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">Back to Source Directory</font></a></p>');
+                   '"><font size="+2">'.
+		  &mt('Back to Source Directory').'</font></a></p>');
     }
 }
 
@@ -1547,7 +1552,7 @@
 
       my $thisembstyle=&Apache::loncommon::fileembstyle($thistype);
      
-    $r->print('<h2>Publishing <tt>'.$thisdisfn.'</tt></h2>');
+    $r->print('<h2>'.&mt('Publishing').' <tt>'.$thisdisfn.'</tt></h2>');
 
 # phase one takes
 #  my ($source,$target,$style,$batch)=@_;

--www1064529006--