version 1.58, 2004/01/15 15:12:31
|
version 1.63, 2004/04/12 21:13:13
|
Line 29
|
Line 29
|
package Apache::lonmeta; |
package Apache::lonmeta; |
|
|
use strict; |
use strict; |
|
use LONCAPA::lonmetadata(); |
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
use Apache::lonnet(); |
use Apache::lonnet(); |
use Apache::loncommon(); |
use Apache::loncommon(); |
Line 54 sub dynamicmeta {
|
Line 55 sub dynamicmeta {
|
$regexp='___'.$regexp.'___'; |
$regexp='___'.$regexp.'___'; |
my %evaldata=&Apache::lonnet::dump('nohist_resevaldata',$adomain, |
my %evaldata=&Apache::lonnet::dump('nohist_resevaldata',$adomain, |
$aauthor,$regexp); |
$aauthor,$regexp); |
my %sum=(); |
my %DynamicData = &LONCAPA::lonmetadata::process_reseval_data(\%evaldata); |
my %cnt=(); |
my %Data = &LONCAPA::lonmetadata::process_dynamic_metadata($url, |
my %concat=(); |
\%DynamicData); |
my %listitems=( |
|
'course' => 'add', |
|
'goto' => 'add', |
|
'comefrom' => 'add', |
|
'avetries' => 'avg', |
|
'stdno' => 'add', |
|
'difficulty' => 'avg', |
|
'clear' => 'avg', |
|
'technical' => 'avg', |
|
'helpful' => 'avg', |
|
'correct' => 'avg', |
|
'depth' => 'avg', |
|
'comments' => 'app', |
|
'usage' => 'cnt' |
|
); |
|
while ($_=each(%evaldata)) { |
|
my ($item,$purl,$cat)=split(/___/,$_); |
|
### Apache->request->print("\n".$_.' - '.$item.'<br />'); |
|
if (defined($cnt{$cat})) { $cnt{$cat}++; } else { $cnt{$cat}=1; } |
|
unless ($listitems{$cat} eq 'app') { |
|
if (defined($sum{$cat})) { |
|
$sum{$cat}+=$evaldata{$_}; |
|
$concat{$cat}.=','.$item; |
|
} else { |
|
$sum{$cat}=$evaldata{$_}; |
|
$concat{$cat}=$item; |
|
} |
|
} else { |
|
if (defined($sum{$cat})) { |
|
if ($evaldata{$_}) { |
|
$sum{$cat}.='<hr />'.$evaldata{$_}; |
|
} |
|
} else { |
|
$sum{$cat}=''.$evaldata{$_}; |
|
} |
|
} |
|
} |
|
my %returnhash=(); |
|
while ($_=each(%cnt)) { |
|
if ($listitems{$_} eq 'avg') { |
|
$returnhash{$_}=int(($sum{$_}/$cnt{$_})*100.0+0.5)/100.0; |
|
} elsif ($listitems{$_} eq 'cnt') { |
|
$returnhash{$_}=$cnt{$_}; |
|
} else { |
|
$returnhash{$_}=$sum{$_}; |
|
} |
|
$returnhash{$_.'_list'}=$concat{$_}; |
|
### Apache->request->print("\n<hr />".$_.': '.$returnhash{$_}.'<br />'.$returnhash{$_.'_list'}); |
|
} |
|
# |
# |
# Deal with 'count' separately |
# Deal with 'count' separately |
$returnhash{'count'} = &access_count($url,$aauthor,$adomain); |
$Data{'count'} = &access_count($url,$aauthor,$adomain); |
# since "usage" is reserved word in MySQL ... |
# since "usage" is reserved word in MySQL ... |
$returnhash{'sequsage'}=$returnhash{'usage'}; |
|
$returnhash{'sequsage_list'}=$returnhash{'usage_list'}; |
|
|
|
return %returnhash; |
return %Data; |
} |
} |
|
|
sub access_count { |
sub access_count { |
Line 302 sub prettyprint {
|
Line 252 sub prettyprint {
|
($type eq 'sequsage_list')) { |
($type eq 'sequsage_list')) { |
return join('<br />',map { |
return join('<br />',map { |
my $url=&Apache::lonnet::clutter($_); |
my $url=&Apache::lonnet::clutter($_); |
'<br /><b>'.&Apache::lonnet::gettitle($url).'</b>'. |
'<b>'.&Apache::lonnet::gettitle($url).'</b>'. |
&Apache::lonhtmlcommon::crumbs($url,'preview',''); |
&Apache::lonhtmlcommon::crumbs($url,'preview','',undef,'+0'); |
} split(/\s*\,\s*/,$value)); |
} split(/\s*\,\s*/,$value)); |
} |
} |
# Evaluations |
# Evaluations |
Line 434 sub handler {
|
Line 384 sub handler {
|
|
|
my $uri=$r->uri; |
my $uri=$r->uri; |
|
|
unless ($uri=~/^\/\~/) { |
# ====================================================== Looking for all bombs? |
|
if ($uri=~/\/adm\/bombs\/(.*)$/) { |
|
# ----------------------------------------------------------- Set document type |
|
$uri=&Apache::lonnet::declutter($1); |
|
&Apache::loncommon::content_type($r,'text/html'); |
|
$r->send_http_header; |
|
|
|
return OK if $r->header_only; |
|
$r->print(&Apache::loncommon::bodytag('Error Messages')); |
|
$r->print('<h1>'.&Apache::lonnet::clutter($uri).'</h1>'); |
|
my ($domain,$author)=($uri=~/^(\w+)\/(\w+)\//); |
|
if (&Apache::loncacc::constructaccess('/~'.$author.'/',$domain)) { |
|
my %brokenurls=&Apache::lonmsg::all_url_author_res_msg($author,$domain); |
|
foreach (sort keys %brokenurls) { |
|
if ($_=~/^\Q$uri\E/) { |
|
$r->print(&Apache::lonhtmlcommon::crumbs(&Apache::lonnet::clutter($_)). |
|
&Apache::lonmsg::retrieve_author_res_msg($_).'<hr />'); |
|
} |
|
} |
|
} else { |
|
$r->print(&mt('Not authorized')); |
|
} |
|
$r->print('</body></html>'); |
|
} elsif ($uri!~/^\/\~/) { |
# =========================================== This is not in construction space |
# =========================================== This is not in construction space |
my ($resdomain,$resuser)= |
my ($resdomain,$resuser)= |
(&Apache::lonnet::declutter($uri)=~/^(\w+)\/(\w+)\//); |
(&Apache::lonnet::declutter($uri)=~/^(\w+)\/(\w+)\//); |
Line 538 ENDHEAD
|
Line 511 ENDHEAD
|
'goto','goto_list', |
'goto','goto_list', |
'course','course_list') { |
'course','course_list') { |
$r->print('<tr><td bgcolor="#AAAAAA">'.$lt{$_}.'</td><td bgcolor="#CCCCCC">'. |
$r->print('<tr><td bgcolor="#AAAAAA">'.$lt{$_}.'</td><td bgcolor="#CCCCCC">'. |
&prettyprint($dynmeta{$_})."</td></tr>\n"); |
&prettyprint($_,$dynmeta{$_})."</td></tr>\n"); |
} |
} |
$r->print('</table>'); |
$r->print('</table>'); |
if ($uri=~/\.(problem|exam|quiz|assess|survey|form)\.meta$/) { |
if ($uri=~/\.(problem|exam|quiz|assess|survey|form)\.meta$/) { |
Line 547 ENDHEAD
|
Line 520 ENDHEAD
|
'<h4>'.&mt('Assessment Statistical Data').'</h4><table cellspacing=2 border=0>'); |
'<h4>'.&mt('Assessment Statistical Data').'</h4><table cellspacing=2 border=0>'); |
foreach ('stdno','avetries','difficulty') { |
foreach ('stdno','avetries','difficulty') { |
$r->print('<tr><td bgcolor="#AAAAAA">'.$lt{$_}.'</td><td bgcolor="#CCCCCC">'. |
$r->print('<tr><td bgcolor="#AAAAAA">'.$lt{$_}.'</td><td bgcolor="#CCCCCC">'. |
&prettyprint($dynmeta{$_})."</td></tr>\n"); |
&prettyprint($_,$dynmeta{$_})."</td></tr>\n"); |
} |
} |
$r->print('</table>'); |
$r->print('</table>'); |
} |
} |
$r->print('<h4>'.&mt('Evaluation Data').'</h4><table cellspacing=2 border=0>'); |
$r->print('<h4>'.&mt('Evaluation Data').'</h4><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><td bgcolor="#CCCCCC">'. |
$r->print('<tr><td bgcolor="#AAAAAA">'.$lt{$_}.'</td><td bgcolor="#CCCCCC">'. |
&prettyprint($dynmeta{$_})."</td></tr>\n"); |
&prettyprint($_,$dynmeta{$_})."</td></tr>\n"); |
} |
} |
$r->print('</table>'); |
$r->print('</table>'); |
$uri=~/^\/res\/(\w+)\/(\w+)\//; |
$uri=~/^\/res\/(\w+)\/(\w+)\//; |
Line 610 ENDHEAD
|
Line 583 ENDHEAD
|
$target=~s/\.meta$//; |
$target=~s/\.meta$//; |
my $bombs=&Apache::lonmsg::retrieve_author_res_msg($target); |
my $bombs=&Apache::lonmsg::retrieve_author_res_msg($target); |
if ($bombs) { |
if ($bombs) { |
my $del=''; |
if ($ENV{'form.delmsg'}) { |
if ($target=~/allbombs$/) { |
if (&Apache::lonmsg::del_url_author_res_msg($target) eq 'ok') { |
$disuri='All Error Messages'; |
$bombs=&mt('Messages deleted.'); |
} else { |
} else { |
if ($ENV{'form.delmsg'}) { |
$bombs=&mt('Error deleting messages'); |
if (&Apache::lonmsg::del_url_author_res_msg($target) eq 'ok') { |
|
$bombs=&mt('Messages deleted.'); |
|
} else { |
|
$bombs=&mt('Error deleting messages'); |
|
} |
|
} |
} |
$del='<input type="submit" name="delmsg" value="'. |
|
&mt('Delete Messages').'" />'; |
|
} |
} |
my $bodytag=&Apache::loncommon::bodytag('Error Messages'); |
my $bodytag=&Apache::loncommon::bodytag('Error Messages'); |
|
my $del=&mt('Delete Messages'); |
$r->print(<<ENDBOMBS); |
$r->print(<<ENDBOMBS); |
<html><head><title>Edit Catalog Information</title></head> |
<html><head><title>Edit Catalog Information</title></head> |
$bodytag |
$bodytag |
<h1>$disuri</h1> |
<h1>$disuri</h1> |
<form method="post" name="defaultmeta"> |
<form method="post" name="defaultmeta"> |
$del |
<input type="submit" name="delmsg" value="$del" /> |
<br />$bombs |
<br />$bombs |
</form> |
</form> |
</body> |
</body> |
Line 694 ENDEDIT
|
Line 661 ENDEDIT
|
print $mfh ' '.$_.'="'.$value.'"'; |
print $mfh ' '.$_.'="'.$value.'"'; |
} |
} |
print $mfh '>'. |
print $mfh '>'. |
&HTML::Entities::encode($Apache::lonpublisher::metadatafields{$unikey}) |
&HTML::Entities::encode($Apache::lonpublisher::metadatafields{$unikey},'<>&"') |
.'</'.$tag.'>'; |
.'</'.$tag.'>'; |
} |
} |
} |
} |
Line 704 ENDEDIT
|
Line 671 ENDEDIT
|
$r->print( |
$r->print( |
'<br /><input type="submit" name="store" value="'. |
'<br /><input type="submit" name="store" value="'. |
&mt('Store Catalog Information').'"></form></body></html>'); |
&mt('Store Catalog Information').'"></form></body></html>'); |
|
} |
} |
} |
return OK; |
return OK; |
} |
|
} |
} |
|
|
# ================================================================= BEGIN Block |
# ================================================================= BEGIN Block |