--- loncom/publisher/lonpublisher.pm 2003/11/01 17:38:58 1.142
+++ loncom/publisher/lonpublisher.pm 2003/12/22 21:57:25 1.148
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Publication Handler
#
-# $Id: lonpublisher.pm,v 1.142 2003/11/01 17:38:58 www Exp $
+# $Id: lonpublisher.pm,v 1.148 2003/12/22 21:57:25 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -143,6 +143,7 @@ use Apache::lonnet();
use Apache::loncommon();
use Apache::lonmysql;
use Apache::lonlocal;
+use Apache::loncfile;
use vars qw(%metadatafields %metadatakeys);
my %addid;
@@ -180,6 +181,10 @@ nothing
#########################################
#########################################
+#
+# Modifies global %metadatafields %metadatakeys
+#
+
sub metaeval {
my ($metastring,$prefix)=@_;
@@ -262,7 +267,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;
@@ -271,7 +277,8 @@ sub metaread {
$metastring=join('',<$metafh>);
}
&metaeval($metastring,$prefix);
- return '
Processed file: '.$fn.'';
+ return '
'.&mt('Processed file').': '.
+ &Apache::loncfile::display($fn).'';
}
#########################################
@@ -621,7 +628,7 @@ sub fix_ids_and_indices {
join(', ',@duplicatedids));
if ($duplicateids) {
print $logfile "Duplicate ID(s) exist, ".join(', ',@duplicatedids)."\n";
- my $outstring='Unable to publish file, it contains duplicated ID(s), ID(s) need to be unique. The duplicated ID(s) are: '.join(', ',@duplicatedids).'';
+ my $outstring=''.&mt('Unable to publish file, it contains duplicated ID(s), ID(s) need to be unique. The duplicated ID(s) are').': '.join(', ',@duplicatedids).'';
return ($outstring,1);
}
if ($needsfixup) {
@@ -686,8 +693,15 @@ sub fix_ids_and_indices {
}
if ($lctag eq 'applet') {
my $codebase='';
- if (defined($parms{'codebase'})) {
- my $oldcodebase=$parms{'codebase'};
+ my $havecodebase=0;
+ foreach my $key (keys(%parms)) {
+ if (lc($key) eq 'codebase') {
+ $codebase=$parms{$key};
+ $havecodebase=1;
+ }
+ }
+ if ($havecodebase) {
+ my $oldcodebase=$codebase;
unless ($oldcodebase=~/\/$/) {
$oldcodebase.='/';
}
@@ -701,14 +715,13 @@ sub fix_ids_and_indices {
}
$allow{&absoluteurl($codebase,$target).'/*'}=1;
} else {
- foreach ('archive','code','object') {
- if (defined($parms{$_})) {
- my $oldurl=$parms{$_};
+ foreach my $key (keys(%parms)) {
+ if ($key =~ /(archive|code|object)/i) {
+ my $oldurl=$parms{$key};
my $newurl=&urlfixup($oldurl,$target);
$newurl=~s/\/[^\/]+$/\/\*/;
- print $logfile 'Allow: applet '.$_.':'.
- $oldurl.' allows '.
- $newurl."\n";
+ print $logfile 'Allow: applet '.lc($key).':'.
+ $oldurl.' allows '.$newurl."\n";
$allow{&absoluteurl($newurl,$target)}=1;
}
}
@@ -812,19 +825,22 @@ sub store_metadata {
# ============================================== Parse file itself for metadata
-
+#
+# parses a file with target meta, sets global %metadatafields %metadatakeys
sub parseformeta {
my ($source,$style)=@_;
+ my $allmeta='';
if (($style eq 'ssi') || ($style eq 'prv')) {
my $dir=$source;
$dir=~s-/[^/]*$--;
my $file=$source;
$file=(split('/',$file))[-1];
$source=&Apache::lonnet::hreflocation($dir,$file);
- my $allmeta=&Apache::lonnet::ssi_body($source,('grade_target' => 'meta'));
+ $allmeta=&Apache::lonnet::ssi_body($source,('grade_target' => 'meta'));
&metaeval($allmeta);
}
+ return $allmeta;
}
#########################################
@@ -858,7 +874,7 @@ sub publish {
my %allow=();
unless ($logfile=Apache::File->new('>>'.$source.'.log')) {
- return ('No write permission to user directory, FAIL',1);
+ return (''.&mt('No write permission to user directory, FAIL').'',1);
}
print $logfile
"\n\n================= Publish ".localtime()." Phase One ================\n".$ENV{'user.name'}.'@'.$ENV{'user.domain'}."\n";
@@ -882,7 +898,7 @@ sub publish {
if ($error) { return ($outstring,$error); }
# ------------------------------------------------------------ Construct Allows
- $scrout.='
'.&mt('Obsolete parameters or stored values').': '. - $chparms.'
'; + $chparms.''. + &mt('If this resource is in active use, student performance data from the previous version may become inaccessible.').'