--- loncom/publisher/lonpublisher.pm 2003/11/01 17:09:52 1.141 +++ loncom/publisher/lonpublisher.pm 2003/12/29 21:17:00 1.158 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Publication Handler # -# $Id: lonpublisher.pm,v 1.141 2003/11/01 17:09:52 www Exp $ +# $Id: lonpublisher.pm,v 1.158 2003/12/29 21:17:00 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -25,24 +25,6 @@ # # http://www.lon-capa.org/ # -# -# (TeX Content Handler -# -# 05/29/00,05/30,10/11 Gerd Kortemeyer) -# -# 11/28,11/29,11/30,12/01,12/02,12/04,12/23 Gerd Kortemeyer -# 03/23 Guy Albertelli -# 03/24,03/29,04/03 Gerd Kortemeyer -# 05/03,05/05,05/07 Gerd Kortemeyer -# 06/23,08/07,08/11,8/13,8/17,8/18,8/24,9/26,10/16 Gerd Kortemeyer -# 12/04,12/05 Guy Albertelli -# 12/05 Gerd Kortemeyer -# 12/05 Guy Albertelli -# 12/06,12/07 Gerd Kortemeyer -# 12/25 Gerd Kortemeyer -# YEAR=2002 -# 1/17 Gerd Kortemeyer -# ### ############################################################################### @@ -143,6 +125,8 @@ use Apache::lonnet(); use Apache::loncommon(); use Apache::lonmysql; use Apache::lonlocal; +use Apache::loncfile; +use Apache::lonmeta; use vars qw(%metadatafields %metadatakeys); my %addid; @@ -180,6 +164,10 @@ nothing ######################################### ######################################### +# +# Modifies global %metadatafields %metadatakeys +# + sub metaeval { my ($metastring,$prefix)=@_; @@ -214,14 +202,8 @@ sub metaeval { $newentry=~s/^\s*//; if ($newentry !~m|^/res|) { $newentry=$prefix.$newentry; } } - if ($metadatafields{$unikey}) { - unless (($metadatafields{$unikey}=~/\Q$newentry\E/) || - ($newentry eq '')) { - $metadatafields{$unikey}.=', '.$newentry; - } - } else { - $metadatafields{$unikey}=$newentry; - } +# actually store + $metadatafields{$unikey}=$newentry; } } } @@ -267,7 +249,8 @@ sub metaread { my ($logfile,$fn,$prefix)=@_; unless (-e $fn) { print($logfile 'No file '.$fn."\n"); - return '
No file: '.$fn.''; + return '
'.&mt('No file').': '. + &Apache::loncfile::display($fn).''; } print($logfile 'Processing '.$fn."\n"); my $metastring; @@ -276,7 +259,8 @@ sub metaread { $metastring=join('',<$metafh>); } &metaeval($metastring,$prefix); - return '
Processed file: '.$fn.''; + return '
'.&mt('Processed file').': '. + &Apache::loncfile::display($fn).''; } ######################################### @@ -333,8 +317,7 @@ sub textfield { $value=~s/\s+$//gs; $value=~s/\s+/ /gs; $title=&mt($title); - my $uctitle=uc($title); - return "\n

$uctitle:". + return "\n

$title:". "


". ''; } @@ -347,9 +330,8 @@ sub hiddenfield { sub selectbox { my ($title,$name,$value,$functionref,@idlist)=@_; $title=&mt($title); - my $uctitle=uc($title); $value=(split(/\s*,\s*/,$value))[-1]; - my $selout="\n

$uctitle:". + my $selout="\n

$title:". '


'. + '

'. &hiddenfield('phase','two'). &hiddenfield('filename',$ENV{'form.filename'}). &hiddenfield('allmeta',&Apache::lonnet::escape($allmeta)). @@ -1078,6 +1110,9 @@ sub publish { # --------------------------------------------------- Scan content for keywords my $keywords_help = Apache::loncommon::help_open_topic("Publishing_Keywords"); + my $KEYWORDS=&mt('Keywords'); + my $CheckAll=&mt('check all'); + my $UncheckAll=&mt('uncheck all'); my $keywordout=<<"END"; -

KEYWORDS: +

$KEYWORDS: $keywords_help - - + +


END @@ -1126,13 +1161,28 @@ END $scrout.=&textfield('Notes','notes',$metadatafields{'notes'}); $scrout.= - "\n

ABSTRACT:". + "\n

".&mt('Abstract').":". "


". '

'; $source=~/\.(\w+)$/; + + $scrout.= + "\n

". + &mt('Lowest Grade Level').':'. + "


". + &Apache::loncommon::select_level_form($metadatafields{'lowestgradelevel'},'lowestgradelevel'). + "\n

". + &mt('Highest Grade Level').':'. + "


". + &Apache::loncommon::select_level_form($metadatafields{'highestgradelevel'},'highestgradelevel'). + &textfield('Standards','standards',$metadatafields{'standards'}); + + + + $scrout.=&hiddenfield('mime',$1); my $defaultlanguage=$metadatafields{'language'}; @@ -1150,7 +1200,7 @@ END $metadatafields{'creationdate'}=time; } $scrout.=&hiddenfield('creationdate', - &Apache::loncommon::unsqltime($metadatafields{'creationdate'})); + &Apache::lonmysql::unsqltime($metadatafields{'creationdate'})); $scrout.=&hiddenfield('lastrevisiondate',time); @@ -1184,7 +1234,7 @@ END $scrout.=&textfield('Custom Distribution File','customdistributionfile', $metadatafields{'customdistributionfile'}). $copyright_help; - my $uctitle=uc(&mt('Obsolete')); + my $uctitle=&mt('Obsolete'); $scrout.= "\n

$uctitle:". ' '.&mt('No valid custom distribution rights file specified, FAIL'). + ''; + } + } { print $logfile "\nWrite metadata file for ".$source; my $mfh; @@ -1360,21 +1425,16 @@ sub phasetwo { $metadatafields{'url'} = $distarget; $metadatafields{'version'} = 'current'; - unless ($metadatafields{'copyright'} eq 'priv') { - my ($error,$success) = &store_metadata(\%metadatafields); - if ($success) { - $r->print('

'.&mt('Synchronized SQL metadata database').'

'); - print $logfile "\nSynchronized SQL metadata database"; - } else { - $r->print($error); - print $logfile "\n".$error; - } + + my ($error,$success) = &store_metadata(%metadatafields); + if ($success) { + $r->print('

'.&mt('Synchronized SQL metadata database').'

'); + print $logfile "\nSynchronized SQL metadata database"; } else { - $r->print('

'. - &mt('Private Publication - did not synchronize database').'

'); - print $logfile "\nPrivate: Did not synchronize data into ". - "SQL metadata database"; + $r->print($error); + print $logfile "\n".$error; } + # ----------------------------------------------------------- Copy old versions if (-e $target) { @@ -1532,6 +1592,7 @@ sub phasetwo { '">'. &mt('Back to Source Directory').'

'); } + return '

'.&mt('Done').'

'; } ######################################### @@ -1586,8 +1647,8 @@ sub publishdirectory { my $resdir= $Apache::lonnet::perlvar{'lonDocRoot'}.'/res/'.$cudom.'/'.$cuname.'/'. $thisdisfn; - $r->print('

Directory '.$thisdisfn.'

'. - 'Target: '.$resdir.'
'); + $r->print('

'.&mt('Directory').' '.$thisdisfn.'

'. + &mt('Target').': '.$resdir.'
'); my $dirptr=16384; # Mask indicating a directory in stat.cmode. @@ -1625,7 +1686,7 @@ sub publishdirectory { if ($publishthis) { &batchpublish($r,$fn.'/'.$filename,$resdir.'/'.$filename); } else { - $r->print('
Skipping '.$filename.'
'); + $r->print('
'.&mt('Skipping').' '.$filename.'
'); } $r->rflush(); } @@ -1831,8 +1892,8 @@ ENDDIFF my ($outstring,$error)=&publish($thisfn,$thistarget,$thisembstyle); $r->print('
'.$outstring); } else { - $r->print('
'); - &phasetwo($r,$thisfn,$thistarget,$thisembstyle,$thisdistarget); + $r->print('
'. + &phasetwo($r,$thisfn,$thistarget,$thisembstyle,$thisdistarget)); } } $r->print('');