Diff for /loncom/publisher/lonpublisher.pm between versions 1.116 and 1.127

version 1.116, 2003/03/14 15:29:46 version 1.127, 2003/07/25 02:04:51
Line 82  invocation by F<loncapa_apache.conf>: Line 82  invocation by F<loncapa_apache.conf>:
   ErrorDocument     500 /adm/errorhandler    ErrorDocument     500 /adm/errorhandler
   </Location>    </Location>
   
   =head1 OVERVIEW
   
   Authors can only write-access the C</~authorname/> space. They can
   copy resources into the resource area through the publication step,
   and move them back through a recover step. Authors do not have direct
   write-access to their resource space.
   
   During the publication step, several events will be
   triggered. Metadata is gathered, where a wizard manages default
   entries on a hierarchical per-directory base: The wizard imports the
   metadata (including access privileges and royalty information) from
   the most recent published resource in the current directory, and if
   that is not available, from the next directory above, etc. The Network
   keeps all previous versions of a resource and makes them available by
   an explicit version number, which is inserted between the file name
   and extension, for example C<foo.2.html>, while the most recent
   version does not carry a version number (C<foo.html>). Servers
   subscribing to a changed resource are notified that a new version is
   available.
   
 =head1 DESCRIPTION  =head1 DESCRIPTION
   
 B<lonpublisher> takes the proper steps to add resources to the LON-CAPA  B<lonpublisher> takes the proper steps to add resources to the LON-CAPA
Line 190  sub metaeval { Line 210  sub metaeval {
               }                }
               if ($metadatafields{$unikey}) {                if ($metadatafields{$unikey}) {
   my $newentry=$parser->get_text('/'.$entry);    my $newentry=$parser->get_text('/'.$entry);
                   unless (($metadatafields{$unikey}=~/$newentry/) ||                    unless (($metadatafields{$unikey}=~/\Q$newentry\E/) ||
                           ($newentry eq '')) {                            ($newentry eq '')) {
                      $metadatafields{$unikey}.=', '.$newentry;                       $metadatafields{$unikey}.=', '.$newentry;
   }    }
Line 242  sub metaread { Line 262  sub metaread {
     my ($logfile,$fn)=@_;      my ($logfile,$fn)=@_;
     unless (-e $fn) {      unless (-e $fn) {
  print($logfile 'No file '.$fn."\n");   print($logfile 'No file '.$fn."\n");
         return '<br><b>No file:</b> <tt>'.$fn.'</tt>';          return '<br /><b>No file:</b> <tt>'.$fn.'</tt>';
     }      }
     print($logfile 'Processing '.$fn."\n");      print($logfile 'Processing '.$fn."\n");
     my $metastring;      my $metastring;
Line 251  sub metaread { Line 271  sub metaread {
      $metastring=join('',<$metafh>);       $metastring=join('',<$metafh>);
     }      }
     &metaeval($metastring);      &metaeval($metastring);
     return '<br><b>Processed file:</b> <tt>'.$fn.'</tt>';      return '<br /><b>Processed file:</b> <tt>'.$fn.'</tt>';
 }  }
   
 #########################################  #########################################
Line 304  string which presents the form field (fo Line 324  string which presents the form field (fo
 #########################################  #########################################
 sub textfield {  sub textfield {
     my ($title,$name,$value)=@_;      my ($title,$name,$value)=@_;
     return "\n<p><b>$title:</b><br>".      my $uctitle=uc($title);
       return "\n<p><font color=\"#800000\" face=\"helvetica\"><b>$uctitle:".
              "</b></font></p><br />".
            '<input type="text" name="'.$name.'" size=80 value="'.$value.'" />';             '<input type="text" name="'.$name.'" size=80 value="'.$value.'" />';
 }  }
   
Line 316  sub hiddenfield { Line 338  sub hiddenfield {
 sub selectbox {  sub selectbox {
     my ($title,$name,$value,$functionref,@idlist)=@_;      my ($title,$name,$value,$functionref,@idlist)=@_;
     my $uctitle=uc($title);      my $uctitle=uc($title);
       $value=(split(/\s*,\s*/,$value))[-1];
     my $selout="\n<p><font color=\"#800000\" face=\"helvetica\"><b>$uctitle:".      my $selout="\n<p><font color=\"#800000\" face=\"helvetica\"><b>$uctitle:".
  "</b></font><br />".'<select name="'.$name.'">';   '</b></font></p><br /><select name="'.$name.'">';
     foreach (@idlist) {      foreach (@idlist) {
         $selout.='<option value=\''.$_.'\'';          $selout.='<option value=\''.$_.'\'';
         if ($_ eq $value) {          if ($_ eq $value) {
Line 436  sub get_subscribed_hosts { Line 459  sub get_subscribed_hosts {
     my $srcf=$2;      my $srcf=$2;
     opendir(DIR,$1);      opendir(DIR,$1);
     while ($filename=readdir(DIR)) {      while ($filename=readdir(DIR)) {
  if ($filename=~/$srcf\.(\w+)$/) {   if ($filename=~/\Q$srcf\E\.(\w+)$/) {
     my $subhost=$1;      my $subhost=$1;
     if (($subhost ne 'meta' && $subhost ne 'subscription') &&      if (($subhost ne 'meta' && $subhost ne 'subscription') &&
                 ($subhost ne $Apache::lonnet::perlvar{'lonHostID'})) {                  ($subhost ne $Apache::lonnet::perlvar{'lonHostID'})) {
Line 812  sub publish { Line 835  sub publish {
  return ('<font color="red">No write permission to user directory, FAIL</font>',1);   return ('<font color="red">No write permission to user directory, FAIL</font>',1);
     }      }
     print $logfile       print $logfile 
 "\n\n================= Publish ".localtime()." Phase One  ================\n";  "\n\n================= Publish ".localtime()." Phase One  ================\n".$ENV{'user.name'}.'@'.$ENV{'user.domain'}."\n";
   
     if (($style eq 'ssi') || ($style eq 'rat')) {      if (($style eq 'ssi') || ($style eq 'rat') || ($style eq 'prv')) {
 # ------------------------------------------------------- This needs processing  # ------------------------------------------------------- This needs processing
   
 # ----------------------------------------------------------------- Backup Copy  # ----------------------------------------------------------------- Backup Copy
Line 841  sub publish { Line 864  sub publish {
            unless ($style eq 'rat') {              unless ($style eq 'rat') { 
               $allowstr.="\n".'<allow src="'.$thisdep.'" />';                $allowstr.="\n".'<allow src="'.$thisdep.'" />';
    }     }
            $scrout.='<br>';             $scrout.='<br />';
            unless ($thisdep=~/\*/) {             unless ($thisdep=~/\*/) {
        $scrout.='<a href="'.$thisdep.'">';         $scrout.='<a href="'.$thisdep.'">';
            }             }
Line 907  sub publish { Line 930  sub publish {
         $metadatafields{'author'}=~s/\s+/ /g;          $metadatafields{'author'}=~s/\s+/ /g;
         $metadatafields{'author'}=~s/\s+$//;          $metadatafields{'author'}=~s/\s+$//;
         $metadatafields{'owner'}=$cuname.'@'.$cudom;          $metadatafields{'owner'}=$cuname.'@'.$cudom;
    $metadatafields{'modifyinguser'}=$ENV{'user.name'}.'@'.
                                    $ENV{'user.domain'};
    $metadatafields{'authorspace'}=$cuname.'@'.$cudom;
   
 # ------------------------------------------------ Check out directory hierachy  # ------------------------------------------------ Check out directory hierachy
   
         my $thisdisfn=$source;          my $thisdisfn=$source;
         $thisdisfn=~s/^\/home\/$cuname\///;          $thisdisfn=~s/^\/home\/\Q$cuname\E\///;
   
         my @urlparts=split(/\//,$thisdisfn);          my @urlparts=split(/\//,$thisdisfn);
         $#urlparts--;          $#urlparts--;
Line 946  sub publish { Line 972  sub publish {
     }      }
   
 # -------------------------------------------------- Parse content for metadata  # -------------------------------------------------- Parse content for metadata
     if ($style eq 'ssi') {      if (($style eq 'ssi') || ($style eq 'prv')) {
         my $oldenv=$ENV{'request.uri'};          my $oldenv=$ENV{'request.uri'};
   
         $ENV{'request.uri'}=$target;          $ENV{'request.uri'}=$target;
Line 969  sub publish { Line 995  sub publish {
  }   }
     }      }
     if ($chparms) {      if ($chparms) {
  $scrout.='<p><b>New parameters or stored values:</b> '.$chparms;   $scrout.='<p><b>New parameters or stored values:</b> '.$chparms.'</p>';
     }      }
   
     $chparms='';      $chparms='';
Line 984  sub publish { Line 1010  sub publish {
     }      }
     if ($chparms) {      if ($chparms) {
  $scrout.='<p><b>Obsolete parameters or stored values:</b> '.   $scrout.='<p><b>Obsolete parameters or stored values:</b> '.
     $chparms;      $chparms.'</p>';
     }      }
   
 # ------------------------------------------------------- Now have all metadata  # ------------------------------------------------------- Now have all metadata
Line 1042  function uncheckAll(field) { Line 1068  function uncheckAll(field) {
         field[i].checked = false ;          field[i].checked = false ;
 }  }
 </script>  </script>
 <p><b>Keywords: $keywords_help</b>   <p><font color="#800000" face="helvetica"><b>KEYWORDS:</b></font>
 <input type="button" value="check all" onclick="javascript:checkAll(document.pubform.keywords)">    $keywords_help</b>
 <input type="button" value="uncheck all" onclick="javascript:uncheckAll(document.pubform.keywords)">   <input type="button" value="check all" onclick="javascript:checkAll(document.pubform.keywords)" /> 
   <input type="button" value="uncheck all" onclick="javascript:uncheckAll(document.pubform.keywords)" /> 
   </p>
 <br />  <br />
 END  END
  $keywordout.='<table border=2><tr>';   $keywordout.='<table border="2"><tr>';
  my $colcount=0;   my $colcount=0;
   
  foreach (sort keys %keywords) {   foreach (sort keys %keywords) {
     $keywordout.='<td><input type=checkbox name="keywords" value="'.$_.'"';      $keywordout.='<td><input type="checkbox" name="keywords" value="'.$_.'"';
     if ($metadatafields{'keywords'}) {      if ($metadatafields{'keywords'}) {
  if ($metadatafields{'keywords'}=~/$_/) {   if ($metadatafields{'keywords'}=~/\Q$_\E/) {
     $keywordout.=' checked';      $keywordout.=' checked="on"';
  }   }
     } elsif (&Apache::loncommon::keyword($_)) {      } elsif (&Apache::loncommon::keyword($_)) {
  $keywordout.=' checked';   $keywordout.=' checked="on"';
     }      }
     $keywordout.='>'.$_.'</td>';      $keywordout.=' />'.$_.'</td>';
     if ($colcount>10) {      if ($colcount>10) {
  $keywordout.="</tr><tr>\n";   $keywordout.="</tr><tr>\n";
  $colcount=0;   $colcount=0;
Line 1076  END Line 1104  END
  $scrout.=&textfield('Notes','notes',$metadatafields{'notes'});   $scrout.=&textfield('Notes','notes',$metadatafields{'notes'});
   
  $scrout.=   $scrout.=
     '<p><b>Abstract:</b><br><textarea cols=80 rows=5 name=abstract>'.      "\n<p><font color=\"#800000\" face=\"helvetica\"><b>ABSTRACT:".
     $metadatafields{'abstract'}.'</textarea>';      "</b></font></p><br />".
       '<textarea cols="80" rows="5" name="abstract">'.
       $metadatafields{'abstract'}.'</textarea></p>';
   
  $source=~/\.(\w+)$/;   $source=~/\.(\w+)$/;
   
  $scrout.=&hiddenfield('mime',$1);   $scrout.=&hiddenfield('mime',$1);
   
    my $defaultlanguage=$metadatafields{'language'};
    $defaultlanguage =~ s/\s*notset\s*//g;
    $defaultlanguage =~ s/^,\s*//g;
    $defaultlanguage =~ s/,\s*$//g;
   
  $scrout.=&selectbox('Language','language',   $scrout.=&selectbox('Language','language',
     $metadatafields{'language'},      $defaultlanguage,
     \&Apache::loncommon::languagedescription,      \&Apache::loncommon::languagedescription,
     (&Apache::loncommon::languageids),      (&Apache::loncommon::languageids),
    );     );
Line 1102  END Line 1137  END
     $metadatafields{'owner'});      $metadatafields{'owner'});
   
 # -------------------------------------------------- Correct copyright for rat.  # -------------------------------------------------- Correct copyright for rat.
           my $defaultoption=$metadatafields{'copyright'};
           unless ($defaultoption) { $defaultoption='default'; }
  unless ($style eq 'prv') {   unless ($style eq 'prv') {
     if ($style eq 'rat') {      if ($style eq 'rat') {
  if ($metadatafields{'copyright'} eq 'public') {    if ($metadatafields{'copyright'} eq 'public') { 
     delete $metadatafields{'copyright'};      delete $metadatafields{'copyright'};
                       $defaultoption='default';
  }   }
  $scrout.=&selectbox('Copyright/Distribution','copyright',   $scrout.=&selectbox('Copyright/Distribution','copyright',
     $metadatafields{'copyright'},      $defaultoption,
     \&Apache::loncommon::copyrightdescription,      \&Apache::loncommon::copyrightdescription,
     (grep !/^public$/,(&Apache::loncommon::copyrightids)));      (grep !/^public$/,(&Apache::loncommon::copyrightids)));
     } else {      } else {
  $scrout.=&selectbox('Copyright/Distribution','copyright',   $scrout.=&selectbox('Copyright/Distribution','copyright',
     $metadatafields{'copyright'},      $defaultoption,
     \&Apache::loncommon::copyrightdescription,      \&Apache::loncommon::copyrightdescription,
     (&Apache::loncommon::copyrightids));      (&Apache::loncommon::copyrightids));
     }      }
Line 1140  END Line 1178  END
  $ENV{'form.keywords'}='';   $ENV{'form.keywords'}='';
  foreach (keys %keywords) {   foreach (keys %keywords) {
     if ($metadatafields{'keywords'}) {      if ($metadatafields{'keywords'}) {
  if ($metadatafields{'keywords'}=~/$_/) {    if ($metadatafields{'keywords'}=~/\Q$_\E/) { 
     $ENV{'form.keywords'}.=$_.',';       $ENV{'form.keywords'}.=$_.','; 
  }   }
     } elsif (&Apache::loncommon::keyword($_)) {      } elsif (&Apache::loncommon::keyword($_)) {
Line 1216  sub phasetwo { Line 1254  sub phasetwo {
         return 0;          return 0;
     }      }
     print $logfile       print $logfile 
         "\n================= Publish ".localtime()." Phase Two  ================\n";          "\n================= Publish ".localtime()." Phase Two  ================\n".$ENV{'user.name'}.'@'.$ENV{'user.domain'}."\n";
           
     %metadatafields=();      %metadatafields=();
     %metadatakeys=();      %metadatakeys=();
Line 1274  sub phasetwo { Line 1312  sub phasetwo {
                         .'</'.$tag.'>';                          .'</'.$tag.'>';
             }              }
         }          }
         $r->print('<p>Wrote Metadata');          $r->print('<p>Wrote Metadata</p>');
         print $logfile "\nWrote metadata";          print $logfile "\nWrote metadata";
     }      }
           
Line 1285  sub phasetwo { Line 1323  sub phasetwo {
     unless ($metadatafields{'copyright'} eq 'priv') {      unless ($metadatafields{'copyright'} eq 'priv') {
         my ($error,$success) = &store_metadata(\%metadatafields);          my ($error,$success) = &store_metadata(\%metadatafields);
         if ($success) {          if ($success) {
             $r->print('<p>Synchronized SQL metadata database');              $r->print('<p>Synchronized SQL metadata database</p>');
             print $logfile "\nSynchronized SQL metadata database";              print $logfile "\nSynchronized SQL metadata database";
         } else {          } else {
             $r->print($error);              $r->print($error);
             print $logfile "\n".$error;              print $logfile "\n".$error;
         }          }
     } else {      } else {
         $r->print('<p>Private Publication - did not synchronize database');          $r->print('<p>Private Publication - did not synchronize database</p>');
         print $logfile "\nPrivate: Did not synchronize data into ".          print $logfile "\nPrivate: Did not synchronize data into ".
             "SQL metadata database";              "SQL metadata database";
     }      }
Line 1315  sub phasetwo { Line 1353  sub phasetwo {
                 unlink($srcd.'/'.$filename);                  unlink($srcd.'/'.$filename);
                 unlink($srcd.'/'.$filename.'.meta');                  unlink($srcd.'/'.$filename.'.meta');
             } else {              } else {
                 if ($filename=~/$srcf\.(\d+)\.$srct$/) {                  if ($filename=~/\Q$srcf\E\.(\d+)\.\Q$srct\E$/) {
                     $maxversion=($1>$maxversion)?$1:$maxversion;                      $maxversion=($1>$maxversion)?$1:$maxversion;
                 }                  }
             }              }
         }          }
         closedir(DIR);          closedir(DIR);
         $maxversion++;          $maxversion++;
         $r->print('<p>Creating old version '.$maxversion);          $r->print('<p>Creating old version '.$maxversion.'</p>');
         print $logfile "\nCreating old version ".$maxversion;          print $logfile "\nCreating old version ".$maxversion."\n";
                   
         my $copyfile=$srcd.'/'.$srcf.'.'.$maxversion.'.'.$srct;          my $copyfile=$srcd.'/'.$srcf.'.'.$maxversion.'.'.$srct;
                   
         if (copy($target,$copyfile)) {          if (copy($target,$copyfile)) {
     print $logfile "Copied old target to ".$copyfile."\n";      print $logfile "Copied old target to ".$copyfile."\n";
             $r->print('<p>Copied old target file');              $r->print('<p>Copied old target file</p>');
         } else {          } else {
     print $logfile "Unable to write ".$copyfile.':'.$!."\n";      print $logfile "Unable to write ".$copyfile.':'.$!."\n";
             return "<font color=\"red\">Failed to copy old target, $!, FAIL</font>";              return "<font color=\"red\">Failed to copy old target, $!, FAIL</font>";
Line 1341  sub phasetwo { Line 1379  sub phasetwo {
                   
         if (copy($target.'.meta',$copyfile)) {          if (copy($target.'.meta',$copyfile)) {
     print $logfile "Copied old target metadata to ".$copyfile."\n";      print $logfile "Copied old target metadata to ".$copyfile."\n";
             $r->print('<p>Copied old metadata')              $r->print('<p>Copied old metadata</p>')
         } else {          } else {
     print $logfile "Unable to write metadata ".$copyfile.':'.$!."\n";      print $logfile "Unable to write metadata ".$copyfile.':'.$!."\n";
             if (-e $target.'.meta') {              if (-e $target.'.meta') {
Line 1352  sub phasetwo { Line 1390  sub phasetwo {
                   
                   
     } else {      } else {
         $r->print('<p>Initial version');          $r->print('<p>Initial version</p>');
         print $logfile "\nInitial version";          print $logfile "\nInitial version";
     }      }
   
Line 1367  sub phasetwo { Line 1405  sub phasetwo {
         $path.="/$parts[$count]";          $path.="/$parts[$count]";
         if ((-e $path)!=1) {          if ((-e $path)!=1) {
             print $logfile "\nCreating directory ".$path;              print $logfile "\nCreating directory ".$path;
             $r->print('<p>Created directory '.$parts[$count]);              $r->print('<p>Created directory '.$parts[$count].'</p>');
             mkdir($path,0777);              mkdir($path,0777);
         }          }
     }      }
           
     if (copy($source,$copyfile)) {      if (copy($source,$copyfile)) {
         print $logfile "\nCopied original source to ".$copyfile."\n";          print $logfile "\nCopied original source to ".$copyfile."\n";
         $r->print('<p>Copied source file');          $r->print('<p>Copied source file</p>');
     } else {      } else {
         print $logfile "\nUnable to write ".$copyfile.':'.$!."\n";          print $logfile "\nUnable to write ".$copyfile.':'.$!."\n";
         return "<font color=\"red\">Failed to copy source, $!, FAIL</font>";          return "<font color=\"red\">Failed to copy source, $!, FAIL</font>";
Line 1386  sub phasetwo { Line 1424  sub phasetwo {
           
     if (copy($source.'.meta',$copyfile)) {      if (copy($source.'.meta',$copyfile)) {
         print $logfile "\nCopied original metadata to ".$copyfile."\n";          print $logfile "\nCopied original metadata to ".$copyfile."\n";
         $r->print('<p>Copied metadata');          $r->print('<p>Copied metadata</p>');
     } else {      } else {
         print $logfile "\nUnable to write metadata ".$copyfile.':'.$!."\n";          print $logfile "\nUnable to write metadata ".$copyfile.':'.$!."\n";
         return           return 
Line 1400  sub phasetwo { Line 1438  sub phasetwo {
  $r->print('<p>Notifying host '.$subhost.':');$r->rflush;   $r->print('<p>Notifying host '.$subhost.':');$r->rflush;
  print $logfile "\nNotifying host ".$subhost.':';   print $logfile "\nNotifying host ".$subhost.':';
  my $reply=&Apache::lonnet::critical('update:'.$target,$subhost);   my $reply=&Apache::lonnet::critical('update:'.$target,$subhost);
  $r->print($reply.'<br />');$r->rflush;   $r->print($reply.'</p><br />');$r->rflush;
  print $logfile $reply;   print $logfile $reply;
     }      }
           
Line 1412  sub phasetwo { Line 1450  sub phasetwo {
  print $logfile "\nNotifying host for metadata only ".$subhost.':';   print $logfile "\nNotifying host for metadata only ".$subhost.':';
  my $reply=&Apache::lonnet::critical('update:'.$target.'.meta',   my $reply=&Apache::lonnet::critical('update:'.$target.'.meta',
     $subhost);      $subhost);
  $r->print($reply.'<br />');$r->rflush;   $r->print($reply.'</p><br />');$r->rflush;
  print $logfile $reply;   print $logfile $reply;
     }      }
           
Line 1425  sub phasetwo { Line 1463  sub phasetwo {
         my ($cdom,$cname)=split(/\_/,$_);          my ($cdom,$cname)=split(/\_/,$_);
  my $reply=&Apache::lonnet::cput   my $reply=&Apache::lonnet::cput
                   ('versionupdate',{$target => $now},$cdom,$cname);                    ('versionupdate',{$target => $now},$cdom,$cname);
  $r->print($reply.'<br />');$r->rflush;   $r->print($reply.'</p><br />');$r->rflush;
  print $logfile $reply;   print $logfile $reply;
     }      }
 # ------------------------------------------------ Provide link to new resource  # ------------------------------------------------ Provide link to new resource
     unless ($batch) {      unless ($batch) {
         my $thisdistarget=$target;          my $thisdistarget=$target;
         $thisdistarget=~s/^$docroot//;          $thisdistarget=~s/^\Q$docroot\E//;
                   
         my $thissrc=$source;          my $thissrc=$source;
         $thissrc=~s/^\/home\/(\w+)\/public_html/\/priv\/$1/;          $thissrc=~s/^\/home\/(\w+)\/public_html/\/priv\/$1/;
Line 1441  sub phasetwo { Line 1479  sub phasetwo {
                   
                   
         $r->print(          $r->print(
            '<hr><a href="'.$thisdistarget.'"><font size="+2">'.             '<hr /><a href="'.$thisdistarget.'"><font size="+2">'.
            'View Published Version</font></a>'.             'View Published Version</font></a>'.
            '<p><a href="'.$thissrc.'"><font size=+2>Back to Source</font></a>'.             '<p><a href="'.$thissrc.'"><font size=+2>Back to Source</font></a></p>'.
            '<p><a href="'.$thissrcdir.             '<p><a href="'.$thissrcdir.
                    '"><font size="+2">Back to Source Directory</font></a>');                     '"><font size="+2">Back to Source Directory</font></a></p>');
     }      }
 }  }
   
Line 1461  sub batchpublish { Line 1499  sub batchpublish {
   
     my $docroot=$r->dir_config('lonDocRoot');      my $docroot=$r->dir_config('lonDocRoot');
     my $thisdistarget=$targetfile;      my $thisdistarget=$targetfile;
     $thisdistarget=~s/^$docroot//;      $thisdistarget=~s/^\Q$docroot\E//;
   
   
     undef %metadatafields;      undef %metadatafields;
Line 1528  sub publishdirectory { Line 1566  sub publishdirectory {
         $ruid,$rgid,$rrdev,$rsize,          $ruid,$rgid,$rrdev,$rsize,
         $ratime,$rmtime,$rctime,          $ratime,$rmtime,$rctime,
         $rblksize,$rblocks)=stat($resdir.'/'.$filename);          $rblksize,$rblocks)=stat($resdir.'/'.$filename);
         if ($rmtime<$cmtime) {          if (($rmtime<$cmtime) || ($ENV{'form.forcerepub'})) {
 # previously published, modified now  # previously published, modified now
     $publishthis=1;      $publishthis=1;
                 }                  }
Line 1698  unless ($ENV{'form.phase'} eq 'two') { Line 1736  unless ($ENV{'form.phase'} eq 'two') {
   $thistarget=~s/\/public\_html//;    $thistarget=~s/\/public\_html//;
   
   my $thisdistarget=$thistarget;    my $thisdistarget=$thistarget;
   $thisdistarget=~s/^$docroot//;    $thisdistarget=~s/^\Q$docroot\E//;
   
   my $thisdisfn=$thisfn;    my $thisdisfn=$thisfn;
   $thisdisfn=~s/^\/home\/$cuname\/public_html\///;    $thisdisfn=~s/^\/home\/\Q$cuname\E\/public_html\///;
   
   if ($fn=~/\/$/) {    if ($fn=~/\/$/) {
 # -------------------------------------------------------- This is a directory  # -------------------------------------------------------- This is a directory
Line 1716  unless ($ENV{'form.phase'} eq 'two') { Line 1754  unless ($ENV{'form.phase'} eq 'two') {
       $r->print('<h2>Publishing '.        $r->print('<h2>Publishing '.
         &Apache::loncommon::filedescription($thistype).' <tt>'.          &Apache::loncommon::filedescription($thistype).' <tt>'.
         '<a href="/~'.$cuname.'/'.$thisdisfn.'" target="cat">'.$thisdisfn.          '<a href="/~'.$cuname.'/'.$thisdisfn.'" target="cat">'.$thisdisfn.
         '</a></tt></h2><b>Target:</b> <tt>'.$thisdistarget.'</tt><p>');          '</a></tt></h2><b>Target:</b> <tt>'.$thisdistarget.'</tt><br />');
         
       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.
Line 1726  unless ($ENV{'form.phase'} eq 'two') { Line 1764  unless ($ENV{'form.phase'} eq 'two') {
       if (&Apache::loncommon::fileembstyle($thistype) eq 'ssi') {        if (&Apache::loncommon::fileembstyle($thistype) eq 'ssi') {
           $r->print('<br /><a href="/adm/diff?filename=/~'.$cuname.'/'.            $r->print('<br /><a href="/adm/diff?filename=/~'.$cuname.'/'.
                     $thisdisfn.                      $thisdisfn.
    '&versiontwo=priv" target="cat">Diffs with Current Version</a><p>');     '&versiontwo=priv" target="cat">Diffs with Current Version</a><br />');
       }        }
       
 # ------------------ Publishing from $thisfn to $thistarget with $thisembstyle.  # ------------------ Publishing from $thisfn to $thistarget with $thisembstyle.
Line 1751  __END__ Line 1789  __END__
   
 =back  =back
   
   =back
   
 =cut  =cut
   

Removed from v.1.116  
changed lines
  Added in v.1.127


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