version 1.103, 2002/10/18 13:49:49
|
version 1.110, 2003/02/18 16:29:37
|
Line 33
|
Line 33
|
# 11/28,11/29,11/30,12/01,12/02,12/04,12/23 Gerd Kortemeyer |
# 11/28,11/29,11/30,12/01,12/02,12/04,12/23 Gerd Kortemeyer |
# 03/23 Guy Albertelli |
# 03/23 Guy Albertelli |
# 03/24,03/29,04/03 Gerd Kortemeyer |
# 03/24,03/29,04/03 Gerd Kortemeyer |
# 04/16/2001 Scott Harrison |
|
# 05/03,05/05,05/07 Gerd Kortemeyer |
# 05/03,05/05,05/07 Gerd Kortemeyer |
# 05/28/2001 Scott Harrison |
|
# 06/23,08/07,08/11,8/13,8/17,8/18,8/24,9/26,10/16 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/04,12/05 Guy Albertelli |
# 12/05 Gerd Kortemeyer |
# 12/05 Gerd Kortemeyer |
# 12/05 Guy Albertelli |
# 12/05 Guy Albertelli |
# 12/06,12/07 Gerd Kortemeyer |
# 12/06,12/07 Gerd Kortemeyer |
# 12/15,12/16 Scott Harrison |
|
# 12/25 Gerd Kortemeyer |
# 12/25 Gerd Kortemeyer |
# YEAR=2002 |
# YEAR=2002 |
# 1/16,1/17 Scott Harrison |
|
# 1/17 Gerd Kortemeyer |
# 1/17 Gerd Kortemeyer |
# |
# |
### |
### |
Line 127 use DBI;
|
Line 123 use DBI;
|
use Apache::lonnet(); |
use Apache::lonnet(); |
use Apache::loncommon(); |
use Apache::loncommon(); |
use Apache::lonmysql; |
use Apache::lonmysql; |
|
use vars qw(%metadatafields %metadatakeys); |
|
|
my %addid; |
my %addid; |
my %nokey; |
my %nokey; |
|
|
my %metadatafields; |
|
my %metadatakeys; |
|
|
|
my $docroot; |
my $docroot; |
|
|
my $cuname; |
my $cuname; |
Line 262 sub metaread {
|
Line 256 sub metaread {
|
} |
} |
|
|
######################################### |
######################################### |
|
|
######################################### |
|
######################################### |
######################################### |
|
|
sub coursedependencies { |
sub coursedependencies { |
Line 492 sub get_max_ids_indices {
|
Line 484 sub get_max_ids_indices {
|
my $maxindex=10; |
my $maxindex=10; |
my $maxid=10; |
my $maxid=10; |
my $needsfixup=0; |
my $needsfixup=0; |
|
my $duplicateids=0; |
|
|
|
my %allids; |
|
my %duplicatedids; |
|
|
my $parser=HTML::LCParser->new($content); |
my $parser=HTML::LCParser->new($content); |
my $token; |
my $token; |
Line 502 sub get_max_ids_indices {
|
Line 498 sub get_max_ids_indices {
|
if ($counter eq 'id') { |
if ($counter eq 'id') { |
if (defined($token->[2]->{'id'})) { |
if (defined($token->[2]->{'id'})) { |
$maxid=($token->[2]->{'id'}>$maxid)?$token->[2]->{'id'}:$maxid; |
$maxid=($token->[2]->{'id'}>$maxid)?$token->[2]->{'id'}:$maxid; |
|
if (exists($allids{$token->[2]->{'id'}})) { |
|
$duplicateids=1; |
|
$duplicatedids{$token->[2]->{'id'}}=1; |
|
} else { |
|
$allids{$token->[2]->{'id'}}=1; |
|
} |
} else { |
} else { |
$needsfixup=1; |
$needsfixup=1; |
} |
} |
Line 515 sub get_max_ids_indices {
|
Line 517 sub get_max_ids_indices {
|
} |
} |
} |
} |
} |
} |
return ($needsfixup,$maxid,$maxindex); |
return ($needsfixup,$maxid,$maxindex,$duplicateids, |
|
(keys(%duplicatedids))); |
} |
} |
|
|
######################################### |
######################################### |
Line 547 sub get_all_text_unbalanced {
|
Line 550 sub get_all_text_unbalanced {
|
} elsif ($token->[0] eq 'E') { |
} elsif ($token->[0] eq 'E') { |
$result.=$token->[2]; |
$result.=$token->[2]; |
} |
} |
if ($result =~ /(.*)$tag(.*)/) { |
if ($result =~ /(.*)\Q$tag\E(.*)/s) { |
#&Apache::lonnet::logthis('Got a winner with leftovers ::'.$2); |
#&Apache::lonnet::logthis('Got a winner with leftovers ::'.$2); |
#&Apache::lonnet::logthis('Result is :'.$1); |
#&Apache::lonnet::logthis('Result is :'.$1); |
$result=$1; |
$result=$1; |
Line 584 sub fix_ids_and_indices {
|
Line 587 sub fix_ids_and_indices {
|
$content=join('',<$org>); |
$content=join('',<$org>); |
} |
} |
|
|
my ($needsfixup,$maxid,$maxindex)=&get_max_ids_indices(\$content); |
my ($needsfixup,$maxid,$maxindex,$duplicateids,@duplicatedids)= |
|
&get_max_ids_indices(\$content); |
|
|
|
print $logfile ("Got $needsfixup,$maxid,$maxindex,$duplicateids--". |
|
join(', ',@duplicatedids)); |
|
if ($duplicateids) { |
|
print $logfile "Duplicate ID(s) exist, ".join(', ',@duplicatedids)."\n"; |
|
my $outstring='<font color="red">Unable to publish file, it contains duplicated ID(s), ID(s) need to be unique. The duplicated ID(s) are: '.join(', ',@duplicatedids).'</font>'; |
|
return ($outstring,1); |
|
} |
if ($needsfixup) { |
if ($needsfixup) { |
print $logfile "Needs ID and/or index fixup\n". |
print $logfile "Needs ID and/or index fixup\n". |
"Max ID : $maxid (min 10)\n". |
"Max ID : $maxid (min 10)\n". |
Line 709 sub fix_ids_and_indices {
|
Line 720 sub fix_ids_and_indices {
|
print $logfile "Does not need ID and/or index fixup\n"; |
print $logfile "Does not need ID and/or index fixup\n"; |
} |
} |
|
|
return ($outstring,%allow); |
return ($outstring,0,%allow); |
} |
} |
|
|
######################################### |
######################################### |
Line 814 sub publish {
|
Line 825 sub publish {
|
} |
} |
# ------------------------------------------------------------- IDs and indices |
# ------------------------------------------------------------- IDs and indices |
|
|
my $outstring; |
my ($outstring,$error); |
($outstring,%allow)=&fix_ids_and_indices($logfile,$source,$target); |
($outstring,$error,%allow)=&fix_ids_and_indices($logfile,$source, |
|
$target); |
|
if ($error) { return $outstring; } |
# ------------------------------------------------------------ Construct Allows |
# ------------------------------------------------------------ Construct Allows |
|
|
$scrout.='<h3>Dependencies</h3>'; |
$scrout.='<h3>Dependencies</h3>'; |
Line 1186 sub phasetwo {
|
Line 1199 sub phasetwo {
|
my ($r,$source,$target,$style,$distarget,$batch)=@_; |
my ($r,$source,$target,$style,$distarget,$batch)=@_; |
$source=~s/\/+/\//g; |
$source=~s/\/+/\//g; |
$target=~s/\/+/\//g; |
$target=~s/\/+/\//g; |
|
|
|
if ($target=~/\_\_\_/) { |
|
$r->print( |
|
'<font color=red>Unsupported character combination "<tt>___</tt>" in filename, FAIL</font>'); |
|
return 0; |
|
} |
$distarget=~s/\/+/\//g; |
$distarget=~s/\/+/\//g; |
my $logfile; |
my $logfile; |
unless ($logfile=Apache::File->new('>>'.$source.'.log')) { |
unless ($logfile=Apache::File->new('>>'.$source.'.log')) { |
return |
$r->print( |
'<font color=red>No write permission to user directory, FAIL</font>'; |
'<font color=red>No write permission to user directory, FAIL</font>'); |
|
return 0; |
} |
} |
print $logfile |
print $logfile |
"\n================= Publish ".localtime()." Phase Two ================\n"; |
"\n================= Publish ".localtime()." Phase Two ================\n"; |
Line 1698 unless ($ENV{'form.phase'} eq 'two') {
|
Line 1718 unless ($ENV{'form.phase'} eq 'two') {
|
if (&Apache::loncommon::fileembstyle($thistype) eq 'ssi') { |
if (&Apache::loncommon::fileembstyle($thistype) eq 'ssi') { |
$r->print('<br /><a href="/adm/diff?filename=/~'.$cuname.'/'. |
$r->print('<br /><a href="/adm/diff?filename=/~'.$cuname.'/'. |
$thisdisfn. |
$thisdisfn. |
'&versionone=priv" target="cat">Diffs with Current Version</a><p>'); |
'&versiontwo=priv" target="cat">Diffs with Current Version</a><p>'); |
} |
} |
|
|
# ------------------ Publishing from $thisfn to $thistarget with $thisembstyle. |
# ------------------ Publishing from $thisfn to $thistarget with $thisembstyle. |