--- loncom/publisher/lonpublisher.pm 2003/12/26 18:25:29 1.151
+++ 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.151 2003/12/26 18:25:29 www Exp $
+# $Id: lonpublisher.pm,v 1.158 2003/12/29 21:17:00 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -126,6 +126,7 @@ use Apache::loncommon();
use Apache::lonmysql;
use Apache::lonlocal;
use Apache::loncfile;
+use Apache::lonmeta;
use vars qw(%metadatafields %metadatakeys);
my %addid;
@@ -316,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:".
"
".
' ';
}
@@ -330,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:".
'
';
foreach (@idlist) {
$selout.='0) {
+# more than one entry fit - how did that happen?
+ $error='Error occured retrieving old values in '.
+ 'metadata table in LON-CAPA database: '.$#oldmeta.
+ ' matches ';
+ &Apache::lonnet::logthis($error);
+ return ($error,undef);
+ }
+# store new data on top of it
+ foreach (keys %metadata) {
+ $newmetadata{$_}=$metadata{$_};
+ }
+ $status = &Apache::lonmysql::store_row('metadata',\%newmetadata);
+ }
if (! defined($status)) {
$error='Error occured storing new values in '.
'metadata table in LON-CAPA database ';
@@ -948,9 +985,6 @@ sub publish {
$metadatafields{'author'}=~s/\s+/ /g;
$metadatafields{'author'}=~s/\s+$//;
$metadatafields{'owner'}=$cuname.'@'.$cudom;
- $metadatafields{'modifyinguser'}=$ENV{'user.name'}.'@'.
- $ENV{'user.domain'};
- $metadatafields{'authorspace'}=$cuname.'@'.$cudom;
# ------------------------------------------------ Check out directory hierachy
@@ -1076,7 +1110,7 @@ sub publish {
# --------------------------------------------------- Scan content for 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 $UncheckAll=&mt('uncheck all');
my $keywordout=<<"END";
@@ -1127,7 +1161,7 @@ END
$scrout.=&textfield('Notes','notes',$metadatafields{'notes'});
$scrout.=
- "\n".&mt('ABSTRACT').":".
+ "\n ".&mt('Abstract').":".
"
".
'
';
@@ -1137,11 +1171,11 @@ END
$scrout.=
"\n".
- uc(&mt('Lowest Grade Level:')).
+ &mt('Lowest Grade Level').':'.
"
".
&Apache::loncommon::select_level_form($metadatafields{'lowestgradelevel'},'lowestgradelevel').
"\n".
- uc(&mt('Highest Grade Level:')).
+ &mt('Highest Grade Level').':'.
"
".
&Apache::loncommon::select_level_form($metadatafields{'highestgradelevel'},'highestgradelevel').
&textfield('Standards','standards',$metadatafields{'standards'});
@@ -1166,7 +1200,7 @@ END
$metadatafields{'creationdate'}=time;
}
$scrout.=&hiddenfield('creationdate',
- &Apache::loncommon::unsqltime($metadatafields{'creationdate'}));
+ &Apache::lonmysql::unsqltime($metadatafields{'creationdate'}));
$scrout.=&hiddenfield('lastrevisiondate',time);
@@ -1200,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:".
' 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) {
@@ -1612,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.
@@ -1651,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();
}