version 1.86, 2004/08/24 21:40:00
|
version 1.94, 2005/03/17 21:32:17
|
Line 236 sub diffgraph {
|
Line 236 sub diffgraph {
|
|
|
# The field names |
# The field names |
sub fieldnames { |
sub fieldnames { |
return &Apache::lonlocal::texthash |
my $file_type=shift; |
( |
my %fields = |
'title' => 'Title', |
('title' => 'Title', |
'author' =>'Author(s)', |
'author' =>'Author(s)', |
'authorspace' => 'Author Space', |
'authorspace' => 'Author Space', |
'modifyinguser' => 'Last Modifying User', |
'modifyinguser' => 'Last Modifying User', |
Line 247 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 280 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 530 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/(.*)$:) { |
$r->print(&Apache::loncommon::bodytag('Error Messages')); |
$r->print(&Apache::loncommon::bodytag('Error Messages')); |
# Looking for all bombs? |
# Looking for all bombs? |
&report_bombs($r,$uri); |
&report_bombs($r,$uri); |
|
} elsif ($uri=~/\/portfolio\//) { |
|
$r->print(&Apache::loncommon::bodytag |
|
('Edit Portfolio File Information','','','',$resdomain)); |
|
&present_editable_metadata($r,$uri,'portfolio'); |
|
|
} elsif ($uri=~/^\/\~/) { |
} elsif ($uri=~/^\/\~/) { |
# Construction space |
# Construction space |
$r->print(&Apache::loncommon::bodytag |
$r->print(&Apache::loncommon::bodytag |
Line 665 $disuri<br />
|
Line 677 $disuri<br />
|
$obsoletewarning |
$obsoletewarning |
$versiondisplay |
$versiondisplay |
</p> |
</p> |
<table cellspacing=2 border=0> |
<table cellspacing="2" border="0"> |
$table |
$table |
</table> |
</table> |
ENDHEAD |
ENDHEAD |
Line 695 sub print_dynamic_metadata {
|
Line 707 sub print_dynamic_metadata {
|
exists($dynmeta{'goto'}) || |
exists($dynmeta{'goto'}) || |
exists($dynmeta{'course'})) { |
exists($dynmeta{'course'})) { |
$r->print('<h4>'.&mt('Access and Usage Statistics').'</h4>'. |
$r->print('<h4>'.&mt('Access and Usage Statistics').'</h4>'. |
'<table cellspacing=2 border=0>'); |
'<table cellspacing="2" border="0">'); |
foreach ('count', |
foreach ('count', |
'sequsage','sequsage_list', |
'sequsage','sequsage_list', |
'comefrom','comefrom_list', |
'comefrom','comefrom_list', |
Line 720 sub print_dynamic_metadata {
|
Line 732 sub print_dynamic_metadata {
|
$r->print('<h4>'. |
$r->print('<h4>'. |
&mt('Overall Assessment Statistical Data'). |
&mt('Overall Assessment Statistical Data'). |
'</h4>'. |
'</h4>'. |
'<table cellspacing=2 border=0>'); |
'<table cellspacing="2" border="0">'); |
$r->print('<tr><td bgcolor="#AAAAAA">'.$lt{'stdno'}.'</td>'. |
$r->print('<tr><td bgcolor="#AAAAAA">'.$lt{'stdno'}.'</td>'. |
'<td bgcolor="#CCCCCC">'. |
'<td bgcolor="#CCCCCC">'. |
&prettyprint('stdno',$dynmeta{'stdno'}). |
&prettyprint('stdno',$dynmeta{'stdno'}). |
Line 739 sub print_dynamic_metadata {
|
Line 751 sub print_dynamic_metadata {
|
$r->print('<h4>'. |
$r->print('<h4>'. |
&mt('Detailed Assessment Statistical Data'). |
&mt('Detailed Assessment Statistical Data'). |
'</h4>'); |
'</h4>'); |
my $table = '<table cellspacing=2 border=0>'. |
my $table = '<table cellspacing="2" border="0">'. |
'<tr>'. |
'<tr>'. |
'<th>Course</th>'. |
'<th>Course</th>'. |
'<th>Section(s)</th>'. |
'<th>Section(s)</th>'. |
Line 799 sub print_dynamic_metadata {
|
Line 811 sub print_dynamic_metadata {
|
exists($dynmeta{'correct'}) || |
exists($dynmeta{'correct'}) || |
exists($dynmeta{'technical'})){ |
exists($dynmeta{'technical'})){ |
$r->print('<h4>'.&mt('Evaluation Data').'</h4>'. |
$r->print('<h4>'.&mt('Evaluation Data').'</h4>'. |
'<table cellspacing=2 border=0>'); |
'<table cellspacing="2" border="0">'); |
foreach ('clear','depth','helpful','correct','technical') { |
foreach ('clear','depth','helpful','correct','technical') { |
$r->print('<tr><td bgcolor="#AAAAAA">'.$lt{$_}.'</td>'. |
$r->print('<tr><td bgcolor="#AAAAAA">'.$lt{$_}.'</td>'. |
'<td bgcolor="#CCCCCC">'. |
'<td bgcolor="#CCCCCC">'. |
Line 870 sub print_dynamic_metadata {
|
Line 882 sub print_dynamic_metadata {
|
##################################################### |
##################################################### |
##################################################### |
##################################################### |
sub present_editable_metadata { |
sub present_editable_metadata { |
my ($r,$uri) = @_; |
my ($r,$uri, $file_type) = @_; |
# Construction Space Call |
# Construction Space Call |
# Header |
# Header |
my $disuri=$uri; |
my $disuri=$uri; |
Line 907 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 915 ENDEDIT
|
Line 933 ENDEDIT
|
$r->print('<script language="JavaScript">'. |
$r->print('<script language="JavaScript">'. |
&Apache::loncommon::browser_and_searcher_javascript(). |
&Apache::loncommon::browser_and_searcher_javascript(). |
'</script>'); |
'</script>'); |
my %lt=&fieldnames(); |
my %lt=&fieldnames($file_type); |
foreach ('author','title','subject','keywords','abstract','notes', |
my $output; |
|
my @fields; |
|
if ($file_type eq 'portfolio') { |
|
@fields = ('author','title','subject','keywords','abstract','notes','lowestgradelevel', |
|
'highestgradelevel'); |
|
} else { |
|
@fields = ('author','title','subject','keywords','abstract','notes', |
'copyright','customdistributionfile','language', |
'copyright','customdistributionfile','language', |
'standards', |
'standards', |
'lowestgradelevel','highestgradelevel','sourceavail','sourcerights', |
'lowestgradelevel','highestgradelevel','sourceavail','sourcerights', |
'obsolete','obsoletereplacement') { |
'obsolete','obsoletereplacement'); |
|
} |
|
foreach (@fields) { |
if (defined($ENV{'form.new_'.$_})) { |
if (defined($ENV{'form.new_'.$_})) { |
$Apache::lonpublisher::metadatafields{$_}= |
$Apache::lonpublisher::metadatafields{$_}= |
$ENV{'form.new_'.$_}; |
$ENV{'form.new_'.$_}; |
Line 929 ENDEDIT
|
Line 955 ENDEDIT
|
$Apache::lonpublisher::metadatafields{'copyright'}= |
$Apache::lonpublisher::metadatafields{'copyright'}= |
'default'; |
'default'; |
} |
} |
$r->print('<p>'.$lt{$_}.': '. |
$output.=('<p>'.$lt{$_}.': '. |
&prettyinput |
&prettyinput($_, |
($_,$Apache::lonpublisher::metadatafields{$_}, |
$Apache::lonpublisher::metadatafields{$_}, |
'new_'.$_,'defaultmeta').'</p>'); |
'new_'.$_,'defaultmeta').'</p>'); |
} |
} |
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>'); |
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"; |
|
foreach (split(/\,/, |
|
$Apache::lonpublisher::metadatakeys{$unikey}) |
|
) { |
|
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>'.&mt('Wrote Metadata')); |
|
} |
} |
} |
} |
$r->print('<br /><input type="submit" name="store" value="'. |
$r->print($output.'<br /><input type="submit" name="store" value="'. |
&mt('Store Catalog Information').'">'); |
&mt('Store Catalog Information').'">'); |
} |
} |
$r->print('</form>'); |
$r->print('</form>'); |