version 1.144, 2003/11/05 20:27:20
|
version 1.148, 2003/12/22 21:57:25
|
Line 143 use Apache::lonnet();
|
Line 143 use Apache::lonnet();
|
use Apache::loncommon(); |
use Apache::loncommon(); |
use Apache::lonmysql; |
use Apache::lonmysql; |
use Apache::lonlocal; |
use Apache::lonlocal; |
|
use Apache::loncfile; |
use vars qw(%metadatafields %metadatakeys); |
use vars qw(%metadatafields %metadatakeys); |
|
|
my %addid; |
my %addid; |
Line 266 sub metaread {
|
Line 267 sub metaread {
|
my ($logfile,$fn,$prefix)=@_; |
my ($logfile,$fn,$prefix)=@_; |
unless (-e $fn) { |
unless (-e $fn) { |
print($logfile 'No file '.$fn."\n"); |
print($logfile 'No file '.$fn."\n"); |
return '<br /><b>No file:</b> <tt>'.$fn.'</tt>'; |
return '<br /><b>'.&mt('No file').':</b> <tt>'. |
|
&Apache::loncfile::display($fn).'</tt>'; |
} |
} |
print($logfile 'Processing '.$fn."\n"); |
print($logfile 'Processing '.$fn."\n"); |
my $metastring; |
my $metastring; |
Line 275 sub metaread {
|
Line 277 sub metaread {
|
$metastring=join('',<$metafh>); |
$metastring=join('',<$metafh>); |
} |
} |
&metaeval($metastring,$prefix); |
&metaeval($metastring,$prefix); |
return '<br /><b>Processed file:</b> <tt>'.$fn.'</tt>'; |
return '<br /><b>'.&mt('Processed file').':</b> <tt>'. |
|
&Apache::loncfile::display($fn).'</tt>'; |
} |
} |
|
|
######################################### |
######################################### |
Line 625 sub fix_ids_and_indices {
|
Line 628 sub fix_ids_and_indices {
|
join(', ',@duplicatedids)); |
join(', ',@duplicatedids)); |
if ($duplicateids) { |
if ($duplicateids) { |
print $logfile "Duplicate ID(s) exist, ".join(', ',@duplicatedids)."\n"; |
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>'; |
my $outstring='<font color="red">'.&mt('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); |
return ($outstring,1); |
} |
} |
if ($needsfixup) { |
if ($needsfixup) { |
Line 690 sub fix_ids_and_indices {
|
Line 693 sub fix_ids_and_indices {
|
} |
} |
if ($lctag eq 'applet') { |
if ($lctag eq 'applet') { |
my $codebase=''; |
my $codebase=''; |
if (defined($parms{'codebase'})) { |
my $havecodebase=0; |
my $oldcodebase=$parms{'codebase'}; |
foreach my $key (keys(%parms)) { |
|
if (lc($key) eq 'codebase') { |
|
$codebase=$parms{$key}; |
|
$havecodebase=1; |
|
} |
|
} |
|
if ($havecodebase) { |
|
my $oldcodebase=$codebase; |
unless ($oldcodebase=~/\/$/) { |
unless ($oldcodebase=~/\/$/) { |
$oldcodebase.='/'; |
$oldcodebase.='/'; |
} |
} |
Line 705 sub fix_ids_and_indices {
|
Line 715 sub fix_ids_and_indices {
|
} |
} |
$allow{&absoluteurl($codebase,$target).'/*'}=1; |
$allow{&absoluteurl($codebase,$target).'/*'}=1; |
} else { |
} else { |
foreach ('archive','code','object') { |
foreach my $key (keys(%parms)) { |
if (defined($parms{$_})) { |
if ($key =~ /(archive|code|object)/i) { |
my $oldurl=$parms{$_}; |
my $oldurl=$parms{$key}; |
my $newurl=&urlfixup($oldurl,$target); |
my $newurl=&urlfixup($oldurl,$target); |
$newurl=~s/\/[^\/]+$/\/\*/; |
$newurl=~s/\/[^\/]+$/\/\*/; |
print $logfile 'Allow: applet '.$_.':'. |
print $logfile 'Allow: applet '.lc($key).':'. |
$oldurl.' allows '. |
$oldurl.' allows '.$newurl."\n"; |
$newurl."\n"; |
|
$allow{&absoluteurl($newurl,$target)}=1; |
$allow{&absoluteurl($newurl,$target)}=1; |
} |
} |
} |
} |
Line 865 sub publish {
|
Line 874 sub publish {
|
my %allow=(); |
my %allow=(); |
|
|
unless ($logfile=Apache::File->new('>>'.$source.'.log')) { |
unless ($logfile=Apache::File->new('>>'.$source.'.log')) { |
return ('<font color="red">No write permission to user directory, FAIL</font>',1); |
return ('<font color="red">'.&mt('No write permission to user directory, FAIL').'</font>',1); |
} |
} |
print $logfile |
print $logfile |
"\n\n================= Publish ".localtime()." Phase One ================\n".$ENV{'user.name'}.'@'.$ENV{'user.domain'}."\n"; |
"\n\n================= Publish ".localtime()." Phase One ================\n".$ENV{'user.name'}.'@'.$ENV{'user.domain'}."\n"; |
Line 889 sub publish {
|
Line 898 sub publish {
|
if ($error) { return ($outstring,$error); } |
if ($error) { return ($outstring,$error); } |
# ------------------------------------------------------------ Construct Allows |
# ------------------------------------------------------------ Construct Allows |
|
|
$scrout.='<h3>Dependencies</h3>'; |
$scrout.='<h3>'.&mt('Dependencies').'</h3>'; |
my $allowstr=''; |
my $allowstr=''; |
foreach (sort(keys(%allow))) { |
foreach (sort(keys(%allow))) { |
my $thisdep=$_; |
my $thisdep=$_; |
Line 907 sub publish {
|
Line 916 sub publish {
|
if ( |
if ( |
&Apache::lonnet::getfile($Apache::lonnet::perlvar{'lonDocRoot'}.'/'. |
&Apache::lonnet::getfile($Apache::lonnet::perlvar{'lonDocRoot'}.'/'. |
$thisdep.'.meta') eq '-1') { |
$thisdep.'.meta') eq '-1') { |
$scrout.= ' - <font color="red">Currently not available'. |
$scrout.= ' - <font color="red">'.&mt('Currently not available'). |
'</font>'; |
'</font>'; |
} else { |
} else { |
my %temphash=(&Apache::lonnet::declutter($target).'___'. |
my %temphash=(&Apache::lonnet::declutter($target).'___'. |
Line 1084 sub publish {
|
Line 1093 sub publish {
|
unless ($batch) { |
unless ($batch) { |
$scrout.= |
$scrout.= |
'<form name="pubform" action="/adm/publish" method="post">'. |
'<form name="pubform" action="/adm/publish" method="post">'. |
'<p><input type="submit" value="Finalize Publication" /></p>'. |
'<p><input type="submit" value="'.&mt('Finalize Publication').'" /></p>'. |
&hiddenfield('phase','two'). |
&hiddenfield('phase','two'). |
&hiddenfield('filename',$ENV{'form.filename'}). |
&hiddenfield('filename',$ENV{'form.filename'}). |
&hiddenfield('allmeta',&Apache::lonnet::escape($allmeta)). |
&hiddenfield('allmeta',&Apache::lonnet::escape($allmeta)). |
Line 1096 sub publish {
|
Line 1105 sub publish {
|
# --------------------------------------------------- Scan content for keywords |
# --------------------------------------------------- Scan content for keywords |
|
|
my $keywords_help = Apache::loncommon::help_open_topic("Publishing_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"; |
my $keywordout=<<"END"; |
<script> |
<script> |
function checkAll(field) { |
function checkAll(field) { |
Line 1108 function uncheckAll(field) {
|
Line 1120 function uncheckAll(field) {
|
field[i].checked = false ; |
field[i].checked = false ; |
} |
} |
</script> |
</script> |
<p><font color="#800000" face="helvetica"><b>KEYWORDS:</b></font> |
<p><font color="#800000" face="helvetica"><b>$KEYWORDS:</b></font> |
$keywords_help</b> |
$keywords_help</b> |
<input type="button" value="check all" onclick="javascript:checkAll(document.pubform.keywords)" /> |
<input type="button" value="$CheckAll" onclick="javascript:checkAll(document.pubform.keywords)" /> |
<input type="button" value="uncheck all" onclick="javascript:uncheckAll(document.pubform.keywords)" /> |
<input type="button" value="$UncheckAll" onclick="javascript:uncheckAll(document.pubform.keywords)" /> |
</p> |
</p> |
<br /> |
<br /> |
END |
END |
Line 1144 END
|
Line 1156 END
|
$scrout.=&textfield('Notes','notes',$metadatafields{'notes'}); |
$scrout.=&textfield('Notes','notes',$metadatafields{'notes'}); |
|
|
$scrout.= |
$scrout.= |
"\n<p><font color=\"#800000\" face=\"helvetica\"><b>ABSTRACT:". |
"\n<p><font color=\"#800000\" face=\"helvetica\"><b>".&mt('ABSTRACT').":". |
"</b></font></p><br />". |
"</b></font></p><br />". |
'<textarea cols="80" rows="5" name="abstract">'. |
'<textarea cols="80" rows="5" name="abstract">'. |
$metadatafields{'abstract'}.'</textarea></p>'; |
$metadatafields{'abstract'}.'</textarea></p>'; |