';
@@ -377,9 +399,9 @@ sub publish {
}
}
}
- } keys %allow;
+ }
$outstring=~s/(\<\/[^\>]+\>\s*)$/$allowstr$1/s;
- }
+
# ------------------------------------------------------------- Write modified
{
@@ -432,30 +454,30 @@ sub publish {
my $currentpath='/home/'.$cuname.'/';
- map {
+ foreach (@urlparts) {
$currentpath.=$_.'/';
$scrout.=&metaread($logfile,$currentpath.'default.meta');
- } @urlparts;
+ }
# ------------------- Clear out parameters and stores (there should not be any)
- map {
+ foreach (keys %metadatafields) {
if (($_=~/^parameter/) || ($_=~/^stores/)) {
delete $metadatafields{$_};
}
- } keys %metadatafields;
+ }
} else {
# ---------------------- Read previous metafile, remember parameters and stores
$scrout.=&metaread($logfile,$source.'.meta');
- map {
+ foreach (keys %metadatafields) {
if (($_=~/^parameter/) || ($_=~/^stores/)) {
$oldparmstores{$_}=1;
delete $metadatafields{$_};
}
- } keys %metadatafields;
+ }
}
@@ -472,7 +494,7 @@ sub publish {
# ---------------- Find and document discrepancies in the parameters and stores
my $chparms='';
- map {
+ foreach (sort keys %metadatafields) {
if (($_=~/^parameter/) || ($_=~/^stores/)) {
unless ($_=~/\.\w+$/) {
unless ($oldparmstores{$_}) {
@@ -481,14 +503,14 @@ sub publish {
}
}
}
- } sort keys %metadatafields;
+ }
if ($chparms) {
$scrout.='New parameters or stored values: '.
$chparms;
}
my $chparms='';
- map {
+ foreach (sort keys %oldparmstores) {
if (($_=~/^parameter/) || ($_=~/^stores/)) {
unless (($metadatafields{$_.'.name'}) ||
($metadatafields{$_.'.package'}) || ($_=~/\.\w+$/)) {
@@ -496,7 +518,7 @@ sub publish {
$chparms.=$_.' ';
}
}
- } sort keys %oldparmstores;
+ }
if ($chparms) {
$scrout.='
Obsolete parameters or stored values: '.
$chparms;
@@ -506,7 +528,7 @@ sub publish {
$scrout.=
'
';
}
@@ -635,11 +665,11 @@ sub phasetwo {
$metadatafields{'dependencies'}=$ENV{'form.dependencies'};
my $allkeywords=$ENV{'form.addkey'};
- map {
+ foreach (keys %ENV) {
if ($_=~/^form\.key\.(\w+)/) {
$allkeywords.=','.$1;
}
- } keys %ENV;
+ }
$allkeywords=~s/\W+/\,/;
$allkeywords=~s/^\,//;
$metadatafields{'keywords'}=$allkeywords;
@@ -650,44 +680,36 @@ sub phasetwo {
unless ($mfh=Apache::File->new('>'.$source.'.meta')) {
return
'Could not write metadata, FAIL';
- }
- map {
+ }
+ foreach (sort keys %metadatafields) {
unless ($_=~/\./) {
my $unikey=$_;
$unikey=~/^([A-Za-z]+)/;
my $tag=$1;
$tag=~tr/A-Z/a-z/;
print $mfh "\n\<$tag";
- map {
+ foreach (split(/\,/,$metadatakeys{$unikey})) {
my $value=$metadatafields{$unikey.'.'.$_};
$value=~s/\"/\'\'/g;
print $mfh ' '.$_.'="'.$value.'"';
- } split(/\,/,$metadatakeys{$unikey});
+ }
print $mfh '>'.$metadatafields{$unikey}.''.$tag.'>';
}
- } sort keys %metadatafields;
+ }
$scrout.='Wrote Metadata';
print $logfile "\nWrote metadata";
}
# -------------------------------- Synchronize entry with SQL metadata database
- my %perlvar;
- open (CONFIG,"/etc/httpd/conf/access.conf") || die "Can't read access.conf";
- my $configline;
- while ($configline=) {
- if ($configline =~ /PerlSetVar/) {
- my ($dummy,$varname,$varvalue)=split(/\s+/,$configline);
- chomp($varvalue);
- $perlvar{$varname}=$varvalue;
- }
- }
- close(CONFIG);
+ my $warning;
+
+ unless ($metadatafields{'copyright'} eq 'priv') {
- my $warning;
my $dbh;
{
unless (
- $dbh = DBI->connect("DBI:mysql:loncapa","www",$perlvar{'lonSqlAccess'},{ RaiseError =>0,PrintError=>0})
+ $dbh = DBI->connect("DBI:mysql:loncapa","www",
+ $Apache::lonnet::perlvar{'lonSqlAccess'},{ RaiseError =>0,PrintError=>0})
) {
$warning='WARNING: Cannot connect to '.
'database!';
@@ -699,11 +721,12 @@ sub phasetwo {
'delete from metadata where url like binary'.
'"'.$sqldatafields{'url'}.'"');
$sth->execute();
- map {my $field=$metadatafields{$_}; $field=~s/\"/\'\'/g;
- $sqldatafields{$_}=$field;}
- ('title','author','subject','keywords','notes','abstract',
+ foreach ('title','author','subject','keywords','notes','abstract',
'mime','language','creationdate','lastrevisiondate','owner',
- 'copyright');
+ 'copyright') {
+ my $field=$metadatafields{$_}; $field=~s/\"/\'\'/g;
+ $sqldatafields{$_}=$field;
+ }
$sth=$dbh->prepare('insert into metadata values ('.
'"'.delete($sqldatafields{'title'}).'"'.','.
@@ -732,7 +755,10 @@ sub phasetwo {
}
}
-
+} else {
+ $scrout.='Private Publication - did not synchronize database';
+ print $logfile "\nPrivate: Did not ynchronized SQL metadata database";
+}
# ----------------------------------------------------------- Copy old versions
if (-e $target) {
@@ -911,7 +937,7 @@ sub handler {
# Get query string for limited number of parameters
- map {
+ foreach (split(/&/,$ENV{'QUERY_STRING'})) {
my ($name, $value) = split(/=/,$_);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
@@ -920,7 +946,7 @@ sub handler {
$ENV{'form.'.$name}=$value;
}
}
- } (split(/&/,$ENV{'QUERY_STRING'}));
+ }
# -------------------------------------------------------------- Check filename
@@ -995,31 +1021,11 @@ unless ($ENV{'form.phase'} eq 'two') {
{
my $fh=Apache::File->new($r->dir_config('lonIncludes').'/un_keyword.tab');
- map {
+ while (<$fh>) {
my $word=$_;
chomp($word);
$nokey{$word}=1;
- } <$fh>;
- }
-
- %language=();
-
- {
- my $fh=Apache::File->new($r->dir_config('lonTabDir').'/language.tab');
- map {
- $_=~/(\w+)\s+([\w\s\-]+)/;
- $language{$1}=$2;
- } <$fh>;
- }
-
- %cprtag=();
-
- {
- my $fh=Apache::File->new($r->dir_config('lonIncludes').'/copyright.tab');
- map {
- $_=~/(\w+)\s+([\w\s\-]+)/;
- $cprtag{$1}=$2;
- } <$fh>;
+ }
}
}
@@ -1038,7 +1044,7 @@ unless ($ENV{'form.phase'} eq 'two') {
{
$thisfn=~/\.(\w+)$/;
my $thistype=$1;
- my $thisembstyle=&Apache::lonnet::fileembstyle($thistype);
+ my $thisembstyle=&Apache::loncommon::fileembstyle($thistype);
my $thistarget=$thisfn;
@@ -1060,7 +1066,7 @@ unless ($ENV{'form.phase'} eq 'two') {
'');
}
- if (&Apache::lonnet::fileembstyle($thistype) eq 'ssi') {
+ if (&Apache::loncommon::fileembstyle($thistype) eq 'ssi') {
$r->print('
Diffs with Current Version
');