Diff for /loncom/publisher/lonpublisher.pm between versions 1.156 and 1.162

version 1.156, 2003/12/28 20:12:59 version 1.162, 2004/01/20 22:52:17
Line 127  use Apache::lonmysql; Line 127  use Apache::lonmysql;
 use Apache::lonlocal;  use Apache::lonlocal;
 use Apache::loncfile;  use Apache::loncfile;
 use Apache::lonmeta;  use Apache::lonmeta;
   use Apache::lonmsg;
 use vars qw(%metadatafields %metadatakeys);  use vars qw(%metadatafields %metadatakeys);
   
 my %addid;  my %addid;
Line 203  sub metaeval { Line 204  sub metaeval {
  if ($newentry !~m|^/res|) { $newentry=$prefix.$newentry; }   if ($newentry !~m|^/res|) { $newentry=$prefix.$newentry; }
     }      }
 # actually store  # actually store
     $metadatafields{$unikey}=$newentry;      if ( $entry eq 'rule' && exists($metadatafields{$unikey})) {
    $metadatafields{$unikey}.=','.$newentry;
       } else {
    $metadatafields{$unikey}=$newentry;
       }
  }   }
     }      }
 }  }
Line 317  sub textfield { Line 322  sub textfield {
     $value=~s/\s+$//gs;      $value=~s/\s+$//gs;
     $value=~s/\s+/ /gs;      $value=~s/\s+/ /gs;
     $title=&mt($title);      $title=&mt($title);
     my $uctitle=uc($title);      return "\n<p><font color=\"#800000\" face=\"helvetica\"><b>$title:".
     return "\n<p><font color=\"#800000\" face=\"helvetica\"><b>$uctitle:".  
            "</b></font></p><br />".             "</b></font></p><br />".
            '<input type="text" name="'.$name.'" size=80 value="'.$value.'" />';             '<input type="text" name="'.$name.'" size=80 value="'.$value.'" />';
 }  }
Line 331  sub hiddenfield { Line 335  sub hiddenfield {
 sub selectbox {  sub selectbox {
     my ($title,$name,$value,$functionref,@idlist)=@_;      my ($title,$name,$value,$functionref,@idlist)=@_;
     $title=&mt($title);      $title=&mt($title);
     my $uctitle=uc($title);  
     $value=(split(/\s*,\s*/,$value))[-1];      $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>$title:".
  '</b></font></p><br /><select name="'.$name.'">';   '</b></font></p><br /><select name="'.$name.'">';
     foreach (@idlist) {      foreach (@idlist) {
         $selout.='<option value=\''.$_.'\'';          $selout.='<option value=\''.$_.'\'';
Line 1031  sub publish { Line 1034  sub publish {
 # ------------------------------------------ See if anything new in file itself  # ------------------------------------------ See if anything new in file itself
     
  $allmeta=&parseformeta($source,$style);   $allmeta=&parseformeta($source,$style);
   
    }     }
   
                 
Line 1112  sub publish { Line 1116  sub publish {
 # --------------------------------------------------- Scan content for keywords  # --------------------------------------------------- Scan content for keywords
   
         my $keywords_help = Apache::loncommon::help_open_topic("Publishing_Keywords");          my $keywords_help = Apache::loncommon::help_open_topic("Publishing_Keywords");
         my $KEYWORDS=&mt('KEYWORDS');          my $KEYWORDS=&mt('Keywords');
  my $CheckAll=&mt('check all');   my $CheckAll=&mt('check all');
  my $UncheckAll=&mt('uncheck all');   my $UncheckAll=&mt('uncheck all');
  my $keywordout=<<"END";   my $keywordout=<<"END";
Line 1163  END Line 1167  END
  $scrout.=&textfield('Notes','notes',$metadatafields{'notes'});   $scrout.=&textfield('Notes','notes',$metadatafields{'notes'});
   
  $scrout.=   $scrout.=
     "\n<p><font color=\"#800000\" face=\"helvetica\"><b>".&mt('ABSTRACT').":".      "\n<p><font color=\"#800000\" face=\"helvetica\"><b>".&mt('Abstract').":".
     "</b></font></p><br />".      "</b></font></p><br />".
     '<textarea cols="80" rows="5" name="abstract">'.      '<textarea cols="80" rows="5" name="abstract">'.
     $metadatafields{'abstract'}.'</textarea></p>';      $metadatafields{'abstract'}.'</textarea></p>';
Line 1173  END Line 1177  END
   
  $scrout.=   $scrout.=
     "\n<p><font color=\"#800000\" face=\"helvetica\"><b>".      "\n<p><font color=\"#800000\" face=\"helvetica\"><b>".
     uc(&mt('Lowest Grade Level:')).      &mt('Lowest Grade Level').':'.
            "</b></font></p><br />".             "</b></font></p><br />".
    &Apache::loncommon::select_level_form($metadatafields{'lowestgradelevel'},'lowestgradelevel').     &Apache::loncommon::select_level_form($metadatafields{'lowestgradelevel'},'lowestgradelevel').
     "\n<p><font color=\"#800000\" face=\"helvetica\"><b>".      "\n<p><font color=\"#800000\" face=\"helvetica\"><b>".
     uc(&mt('Highest Grade Level:')).      &mt('Highest Grade Level').':'.
            "</b></font></p><br />".             "</b></font></p><br />".
    &Apache::loncommon::select_level_form($metadatafields{'highestgradelevel'},'highestgradelevel').     &Apache::loncommon::select_level_form($metadatafields{'highestgradelevel'},'highestgradelevel').
            &textfield('Standards','standards',$metadatafields{'standards'});             &textfield('Standards','standards',$metadatafields{'standards'});
Line 1236  END Line 1240  END
     $scrout.=&textfield('Custom Distribution File','customdistributionfile',      $scrout.=&textfield('Custom Distribution File','customdistributionfile',
  $metadatafields{'customdistributionfile'}).   $metadatafields{'customdistributionfile'}).
     $copyright_help;      $copyright_help;
     my $uctitle=uc(&mt('Obsolete'));      my $uctitle=&mt('Obsolete');
             $scrout.=              $scrout.=
  "\n<p><font color=\"#800000\" face=\"helvetica\"><b>$uctitle:".   "\n<p><font color=\"#800000\" face=\"helvetica\"><b>$uctitle:".
  '</b></font> <input type="checkbox" name="obsolete" ';   '</b></font> <input type="checkbox" name="obsolete" ';
Line 1436  sub phasetwo { Line 1440  sub phasetwo {
  $r->print($error);   $r->print($error);
  print $logfile "\n".$error;   print $logfile "\n".$error;
     }      }
   # --------------------------------------------- Delete author resource messages
       my $delresult=&Apache::lonmsg::del_url_author_res_msg($target); 
       $r->print('<p>'.&mt('Removing error messages:').' '.$delresult.'</p>');
       print $logfile "\nRemoving error messages: $delresult";
 # ----------------------------------------------------------- Copy old versions  # ----------------------------------------------------------- Copy old versions
         
     if (-e $target) {      if (-e $target) {
Line 1695  sub publishdirectory { Line 1702  sub publishdirectory {
     }      }
     closedir(DIR);      closedir(DIR);
 }  }
   
   #########################################
   # publish a default.meta file
   
   sub defaultmetapublish {
       my ($r,$fn,$cuname,$cudom)=@_;
       $fn=~s/^\/\~$cuname\//\/home\/$cuname\/public_html\//;
       unless (-e $fn) {
          return HTTP_NOT_FOUND;
       }
       my $target=$fn;
       $target=~s/^\/home\/$cuname\/public_html\//$Apache::lonnet::perlvar{'lonDocRoot'}\/res\/$cudom\/$cuname\//;
   
   
       &Apache::loncommon::content_type($r,'text/html');
       $r->send_http_header;
   
       $r->print('<html><head><title>LON-CAPA Publishing</title></head>');
       $r->print(&Apache::loncommon::bodytag('Catalog Information Publication'));
   
   # ---------------------------------------------------------------- Write Source
       my $copyfile=$target;
       
       my @parts=split(/\//,$copyfile);
       my $path="/$parts[1]/$parts[2]/$parts[3]/$parts[4]";
       
       my $count;
       for ($count=5;$count<$#parts;$count++) {
           $path.="/$parts[$count]";
           if ((-e $path)!=1) {
               $r->print('<p>'.&mt('Created directory').' '.$parts[$count].'</p>');
               mkdir($path,0777);
           }
       }
       
       if (copy($fn,$copyfile)) {
           $r->print('<p>'.&mt('Copied source file').'</p>');
       } else {
           return "<font color=\"red\">".
       &mt('Failed to copy source').", $!, ".&mt('FAIL')."</font>";
       }
   
   # --------------------------------------------------- Send update notifications
   
       my @subscribed=&get_subscribed_hosts($target);
       foreach my $subhost (@subscribed) {
    $r->print('<p>'.&mt('Notifying host').' '.$subhost.':');$r->rflush;
    my $reply=&Apache::lonnet::critical('update:'.$target,$subhost);
    $r->print($reply.'</p><br />');$r->rflush;
       }
   # ------------------------------------------------------------------- Link back
       my $link=$fn;
       $link=~s/^\/home\/$cuname\/public_html\//\/priv\/$cuname\//;
       $r->print("<a href='$link'>".&mt('Back to Catalog Information').'</a>');
       $r->print('</body></html>');
       return OK;
   }
 #########################################  #########################################
   
 =pod  =pod
Line 1753  sub handler { Line 1817  sub handler {
   
     my $fn=&Apache::lonnet::unescape($ENV{'form.filename'});      my $fn=&Apache::lonnet::unescape($ENV{'form.filename'});
   
       ($cuname,$cudom)=
    &Apache::loncacc::constructaccess($fn,$r->dir_config('lonDefDomain'));
   
   # special publication: default.meta file
       if ($fn=~/\/default.meta$/) {
    return &defaultmetapublish($r,$fn,$cuname,$cudom); 
       }
       $fn=~s/\.meta$//;
       
     unless ($fn) {       unless ($fn) { 
  $r->log_reason($cuname.' at '.$cudom.   $r->log_reason($cuname.' at '.$cudom.
Line 1760  sub handler { Line 1832  sub handler {
  return HTTP_NOT_FOUND;   return HTTP_NOT_FOUND;
     }       } 
   
     ($cuname,$cudom)=  
  &Apache::loncacc::constructaccess($fn,$r->dir_config('lonDefDomain'));  
     unless (($cuname) && ($cudom)) {      unless (($cuname) && ($cudom)) {
  $r->log_reason($cuname.' at '.$cudom.   $r->log_reason($cuname.' at '.$cudom.
        ' trying to publish file '.$ENV{'form.filename'}.         ' trying to publish file '.$ENV{'form.filename'}.

Removed from v.1.156  
changed lines
  Added in v.1.162


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>
500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.