Diff for /loncom/publisher/lonpublisher.pm between versions 1.94 and 1.95

version 1.94, 2002/09/10 14:52:35 version 1.95, 2002/09/16 13:05:50
Line 1388  if (-e $target) { Line 1388  if (-e $target) {
   
 }  }
   
   #########################################
   
   sub batchpublish {
       my ($r,$srcfile)=@_;
       my $thisdisfn=$srcfile;
       $thisdisfn=~s/\/home\/korte\/public_html\///;
       $srcfile=~s/\/+/\//g;
       $r->print('<h2>Publishing <tt>'.$thisdisfn.'</tt></h2>');
   }
   
 #########################################  #########################################
   
   sub publishdirectory {
       my ($r,$fn,$thisdisfn)=@_;
         $r->print('<h1>Directory <tt>'.$thisdisfn.'/</tt></h1>');
   
         my $dirptr=16384; # Mask indicating a directory in stat.cmode.
   
         opendir(DIR,$fn);
         my @files=sort(readdir(DIR));
         foreach my $filename (@files) {
            my ($cdev,$cino,$cmode,$cnlink,
               $cuid,$cgid,$crdev,$csize,
               $catime,$cmtime,$cctime,
               $cblksize,$cblocks)=stat($fn.'/'.$filename);
   
            my $extension='';
            if ($filename=~/\.(\w+)$/) { $extension=$1; }
            if ($cmode&$dirptr) {
      if (($filename!~/^\./) && ($ENV{'form.pubrec'})) {
         &publishdirectory($r,$fn.'/'.$filename,$thisdisfn.'/'.$filename);
      }
            } elsif ((&Apache::loncommon::fileembstyle($extension) ne 'hdn') &&
                     ($filename!~/^[\#\.]/) && ($filename!~/\~$/)) {
                &batchpublish($r,$fn.'/'.$filename);
                $r->rflush();
            }
         }
         closedir(DIR);
   }
 #########################################  #########################################
   
 =pod  =pod
Line 1531  unless ($ENV{'form.phase'} eq 'two') { Line 1569  unless ($ENV{'form.phase'} eq 'two') {
   $r->send_http_header;    $r->send_http_header;
   
   $r->print('<html><head><title>LON-CAPA Publishing</title></head>');    $r->print('<html><head><title>LON-CAPA Publishing</title></head>');
   $r->print(    $r->print(&Apache::loncommon::bodytag('Resource Publication'));
     '<body bgcolor="#FFFFFF"><img align="right" '.  
     'src="/adm/lonIcons/lonlogos.gif" />');  
   my $thisfn=$fn;    my $thisfn=$fn;
      
 # ---------------------- Evaluate individual file, and then output information.  
   {  
       $thisfn=~/\.(\w+)$/;  
       my $thistype=$1;  
       my $thisembstyle=&Apache::loncommon::fileembstyle($thistype);  
   
       my $thistarget=$thisfn;    my $thistarget=$thisfn;
               
       $thistarget=~s/^\/home/$targetdir/;    $thistarget=~s/^\/home/$targetdir/;
       $thistarget=~s/\/public\_html//;    $thistarget=~s/\/public\_html//;
   
     my $thisdistarget=$thistarget;
     $thisdistarget=~s/^$docroot//;
   
       my $thisdistarget=$thistarget;    my $thisdisfn=$thisfn;
       $thisdistarget=~s/^$docroot//;    $thisdisfn=~s/^\/home\/$cuname\/public_html\///;
   
       my $thisdisfn=$thisfn;    if ($fn=~/\/$/) {
       $thisdisfn=~s/^\/home\/$cuname\/public_html\///;  # -------------------------------------------------------- This is a directory
         &publishdirectory($r,$fn,$thisdisfn);
   
     } else {
   # ---------------------- Evaluate individual file, and then output information.
         $thisfn=~/\.(\w+)$/;
         my $thistype=$1;
         my $thisembstyle=&Apache::loncommon::fileembstyle($thistype);
   
       $r->print('<h2>Publishing '.        $r->print('<h2>Publishing '.
         &Apache::loncommon::filedescription($thistype).' <tt>'.          &Apache::loncommon::filedescription($thistype).' <tt>'.
         $thisdisfn.'</tt></h2><b>Target:</b> <tt>'.$thisdistarget.'</tt><p>');          '<a href="/~'.$cuname.'/'.$thisdisfn.'" target="cat">'.$thisdisfn.
           '</a></tt></h2><b>Target:</b> <tt>'.$thisdistarget.'</tt><p>');
         
       if (($cuname ne $ENV{'user.name'}) || ($cudom ne $ENV{'user.domain'})) {        if (($cuname ne $ENV{'user.name'}) || ($cudom ne $ENV{'user.domain'})) {
           $r->print('<h3><font color="red">Co-Author: '.$cuname.' at '.$cudom.            $r->print('<h3><font color="red">Co-Author: '.$cuname.' at '.$cudom.

Removed from v.1.94  
changed lines
  Added in v.1.95


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>