version 1.90, 2005/02/01 17:37:23
|
version 1.95, 2005/03/18 16:47:31
|
Line 237 sub diffgraph {
|
Line 237 sub diffgraph {
|
# The field names |
# The field names |
sub fieldnames { |
sub fieldnames { |
my $file_type=shift; |
my $file_type=shift; |
if ($file_type eq 'portfolio') { |
my %fields = |
return &Apache::lonlocal::texthash |
('title' => 'Title', |
( |
|
'title' => 'Title', |
|
'author' =>'Author(s)', |
|
'authorspace' => 'Author Space', |
|
'modifyinguser' => 'Last Modifying User', |
|
'subject' => 'Subject', |
|
'keywords' => 'Keyword(s)'); |
|
} else { |
|
return &Apache::lonlocal::texthash |
|
( |
|
'title' => 'Title', |
|
'author' =>'Author(s)', |
'author' =>'Author(s)', |
'authorspace' => 'Author Space', |
'authorspace' => 'Author Space', |
'modifyinguser' => 'Last Modifying User', |
'modifyinguser' => 'Last Modifying User', |
Line 258 sub fieldnames {
|
Line 247 sub fieldnames {
|
'notes' => 'Notes', |
'notes' => 'Notes', |
'abstract' => 'Abstract', |
'abstract' => 'Abstract', |
'lowestgradelevel' => 'Lowest Grade Level', |
'lowestgradelevel' => 'Lowest Grade Level', |
'highestgradelevel' => 'Highest Grade Level', |
'highestgradelevel' => 'Highest Grade Level'); |
|
if (! defined($file_type) || $file_type ne 'portfolio') { |
|
%fields = |
|
(%fields, |
|
'domain' => 'Domain', |
'standards' => 'Standards', |
'standards' => 'Standards', |
'mime' => 'MIME Type', |
'mime' => 'MIME Type', |
'language' => 'Language', |
'language' => 'Language', |
Line 291 sub fieldnames {
|
Line 284 sub fieldnames {
|
'disc' => 'Degree of discrimination', |
'disc' => 'Degree of discrimination', |
'dependencies' => 'Resources used by this resource', |
'dependencies' => 'Resources used by this resource', |
); |
); |
} |
} |
|
return &Apache::lonlocal::texthash(%fields); |
} |
} |
|
|
# Pretty printing of metadata field |
# Pretty printing of metadata field |
Line 542 sub handler {
|
Line 536 sub handler {
|
# |
# |
my ($resdomain,$resuser)= |
my ($resdomain,$resuser)= |
(&Apache::lonnet::declutter($uri)=~/^(\w+)\/(\w+)\//); |
(&Apache::lonnet::declutter($uri)=~/^(\w+)\/(\w+)\//); |
$r->print('<html><head><title>'. |
my $html=&Apache::lonxml::xmlbegin(); |
|
$r->print($html.'<head><title>'. |
'Catalog Information'. |
'Catalog Information'. |
'</title></head>'); |
'</title></head>'); |
if ($uri=~m:/adm/bombs/(.*)$:) { |
if ($uri=~m:/adm/bombs/(.*)$:) { |
Line 924 ENDBOMBS
|
Line 919 ENDBOMBS
|
} |
} |
%Apache::lonpublisher::metadatafields=(); |
%Apache::lonpublisher::metadatafields=(); |
%Apache::lonpublisher::metadatakeys=(); |
%Apache::lonpublisher::metadatakeys=(); |
&Apache::lonpublisher::metaeval(&Apache::lonnet::getfile($fn)); |
my $result=&Apache::lonnet::getfile($fn); |
|
if ($result == -1){ |
|
$r->print('Unable to get '.$fn); |
|
return ; |
|
} else { |
|
&Apache::lonpublisher::metaeval($result); |
|
} |
$r->print(<<ENDEDIT); |
$r->print(<<ENDEDIT); |
<h1>$displayfile</h1> |
<h1>$displayfile</h1> |
<form method="post" name="defaultmeta"> |
<form method="post" name="defaultmeta"> |
Line 936 ENDEDIT
|
Line 937 ENDEDIT
|
my $output; |
my $output; |
my @fields; |
my @fields; |
if ($file_type eq 'portfolio') { |
if ($file_type eq 'portfolio') { |
@fields = ('author','title','subject','keywords'); |
@fields = ('author','title','subject','keywords','abstract','notes','lowestgradelevel', |
|
'highestgradelevel'); |
} else { |
} else { |
@fields = ('author','title','subject','keywords','abstract','notes', |
@fields = ('author','title','subject','keywords','abstract','notes', |
'copyright','customdistributionfile','language', |
'copyright','customdistributionfile','language', |
Line 960 ENDEDIT
|
Line 962 ENDEDIT
|
} |
} |
if ($ENV{'form.store'}) { |
if ($ENV{'form.store'}) { |
my $mfh; |
my $mfh; |
if (! ($mfh=Apache::File->new('>'.$fn))) { |
my $formname='store'; |
$r->print('<p><font color="red">'. |
my $file_content; |
&mt('Could not write metadata').', '. |
foreach (sort keys %Apache::lonpublisher::metadatafields) { |
&mt('FAIL').'</font></p>'); |
next if ($_ =~ /\./); |
|
my $unikey=$_; |
|
$unikey=~/^([A-Za-z]+)/; |
|
my $tag=$1; |
|
$tag=~tr/A-Z/a-z/; |
|
$file_content.= "\n\<$tag"; |
|
foreach (split(/\,/, |
|
$Apache::lonpublisher::metadatakeys{$unikey}) |
|
) { |
|
my $value= |
|
$Apache::lonpublisher::metadatafields{$unikey.'.'.$_}; |
|
$value=~s/\"/\'\'/g; |
|
$file_content.=' '.$_.'="'.$value.'"' ; |
|
# print $mfh ' '.$_.'="'.$value.'"'; |
|
} |
|
$file_content.= '>'. |
|
&HTML::Entities::encode |
|
($Apache::lonpublisher::metadatafields{$unikey}, |
|
'<>&"'). |
|
'</'.$tag.'>'; |
|
} |
|
if ($fn =~ /\/portfolio\//) { |
|
$fn =~ /\/portfolio\/(.*)$/; |
|
my $new_fn = '/'.$1; |
|
$ENV{'form.'.$formname}=$file_content; |
|
$ENV{'form.'.$formname.'.filename'}=$new_fn; |
|
&Apache::lonnet::userfileupload('uploaddoc','', |
|
'portfolio'.$ENV{'form.currentpath'}); |
|
my $status =&Apache::lonnet::userfileupload($formname,'','portfolio'); |
|
if (&Apache::lonnet::userfileupload($formname,'','portfolio') eq 'error: no uploaded file') { |
|
$r->print('<p><font color="red">'. |
|
&mt('Could not write metadata').', '. |
|
&mt('FAIL').'</font></p>'); |
|
} else { |
|
$r->print('<p><font color="blue">'.&mt('Wrote Metadata'). |
|
' '.&Apache::lonlocal::locallocaltime(time). |
|
'</font></p>'); |
|
} |
} else { |
} else { |
foreach (sort keys %Apache::lonpublisher::metadatafields) { |
if (! ($mfh=Apache::File->new('>'.$fn))) { |
next if ($_ =~ /\./); |
$r->print('<p><font color="red">'. |
my $unikey=$_; |
&mt('Could not write metadata').', '. |
$unikey=~/^([A-Za-z]+)/; |
&mt('FAIL').'</font></p>'); |
my $tag=$1; |
} else { |
$tag=~tr/A-Z/a-z/; |
print $mfh $file_content; |
print $mfh "\n\<$tag"; |
$r->print('<p><font color="blue">'.&mt('Wrote Metadata'). |
foreach (split(/\,/, |
' '.&Apache::lonlocal::locallocaltime(time). |
$Apache::lonpublisher::metadatakeys{$unikey}) |
'</font></p>'); |
) { |
|
my $value= |
|
$Apache::lonpublisher::metadatafields{$unikey.'.'.$_}; |
|
$value=~s/\"/\'\'/g; |
|
print $mfh ' '.$_.'="'.$value.'"'; |
|
} |
|
print $mfh '>'. |
|
&HTML::Entities::encode |
|
($Apache::lonpublisher::metadatafields{$unikey}, |
|
'<>&"'). |
|
'</'.$tag.'>'; |
|
} |
} |
$r->print('<p><font color="blue">'.&mt('Wrote Metadata'). |
|
' '.&Apache::lonlocal::locallocaltime(time). |
|
'</font></p>'); |
|
} |
} |
} |
} |
$r->print($output.'<br /><input type="submit" name="store" value="'. |
$r->print($output.'<br /><input type="submit" name="store" value="'. |