version 1.45, 2003/12/29 15:10:54
|
version 1.46, 2003/12/29 17:11:53
|
Line 32 use strict;
|
Line 32 use strict;
|
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
use Apache::lonnet(); |
use Apache::lonnet(); |
use Apache::loncommon(); |
use Apache::loncommon(); |
|
use Apache::lonhtmlcommon(); |
use Apache::lonmsg; |
use Apache::lonmsg; |
use Apache::lonpublisher; |
use Apache::lonpublisher; |
use Apache::lonlocal; |
use Apache::lonlocal; |
Line 85 sub dynamicmeta {
|
Line 86 sub dynamicmeta {
|
} else { |
} else { |
if (defined($sum{$cat})) { |
if (defined($sum{$cat})) { |
if ($evaldata{$_}) { |
if ($evaldata{$_}) { |
$sum{$cat}.='<hr>'.$evaldata{$_}; |
$sum{$cat}.='<hr />'.$evaldata{$_}; |
} |
} |
} else { |
} else { |
$sum{$cat}=''.$evaldata{$_}; |
$sum{$cat}=''.$evaldata{$_}; |
Line 105 sub dynamicmeta {
|
Line 106 sub dynamicmeta {
|
### Apache->request->print("\n<hr />".$_.': '.$returnhash{$_}.'<br />'.$returnhash{$_.'_list'}); |
### Apache->request->print("\n<hr />".$_.': '.$returnhash{$_}.'<br />'.$returnhash{$_.'_list'}); |
} |
} |
# |
# |
# Deal with 'count' seperately |
# Deal with 'count' separately |
$returnhash{'count'} = &access_count($url,$aauthor,$adomain); |
$returnhash{'count'} = &access_count($url,$aauthor,$adomain); |
|
|
return %returnhash; |
return %returnhash; |
Line 145 sub authordisplay {
|
Line 146 sub authordisplay {
|
my ($aname,$adom)=@_; |
my ($aname,$adom)=@_; |
return &Apache::loncommon::aboutmewrapper( |
return &Apache::loncommon::aboutmewrapper( |
&Apache::loncommon::plainname($aname,$adom), |
&Apache::loncommon::plainname($aname,$adom), |
$aname,$adom).' <tt>['.$aname.'@'.$adom.']</tt>'; |
$aname,$adom,'preview').' <tt>['.$aname.'@'.$adom.']</tt>'; |
} |
} |
|
|
# -------------------------------------------------------------- Pretty display |
# -------------------------------------------------------------- Pretty display |
Line 238 sub fieldnames {
|
Line 239 sub fieldnames {
|
'difficulty' => 'Degree of difficulty' |
'difficulty' => 'Degree of difficulty' |
); |
); |
} |
} |
|
|
|
# =========================================== Pretty printing of metadata field |
|
|
|
sub prettyprint { |
|
my ($type,$value)=@_; |
|
unless (defined($value)) { return ' '; } |
|
# Title |
|
if ($type eq 'title') { |
|
return '<font size="+1" face="arial">'.$value.'</font>'; |
|
} |
|
# Dates |
|
if (($type eq 'creationdate') || |
|
($type eq 'lastrevisiondate')) { |
|
return &Apache::lonlocal::locallocaltime( |
|
&Apache::lonmysql::unsqltime($value)); |
|
} |
|
# Language |
|
if ($type eq 'language') { |
|
return &Apache::loncommon::languagedescription($value); |
|
} |
|
# Copyright |
|
if ($type eq 'copyright') { |
|
return &Apache::loncommon::copyrightdescription($value); |
|
} |
|
# MIME |
|
if ($type eq 'mime') { |
|
return '<img src="'.&Apache::loncommon::icon($value).'" /> '. |
|
&Apache::loncommon::filedescription($value); |
|
} |
|
# Person |
|
if (($type eq 'author') || |
|
($type eq 'owner') || |
|
($type eq 'modifyinguser') || |
|
($type eq 'authorspace')) { |
|
$value=~s/(\w+)(\:|\@)(\w+)/&authordisplay($1,$3)/gse; |
|
return $value; |
|
} |
|
# File |
|
if (($type eq 'customdistributionfile') || |
|
($type eq 'obsoletereplacement') || |
|
($type eq 'goto_list') || |
|
($type eq 'comefrom_list') || |
|
($type eq 'sequsage_list')) { |
|
return join('<br />',map { |
|
&Apache::lonnet::gettitle($_).' ['. |
|
&Apache::lonhtmlcommon::crumbs(&Apache::lonnet::clutter($_),'preview').']'; |
|
} split(/\s*\,\s*/,$value)); |
|
} |
|
# Evaluations |
|
if (($type eq 'clear') || |
|
($type eq 'depth') || |
|
($type eq 'helpful') || |
|
($type eq 'correct') || |
|
($type eq 'technical')) { |
|
return &evalgraph($value); |
|
} |
|
# Difficulty |
|
if ($type eq 'difficulty') { |
|
return &diffgraph($value); |
|
} |
|
# List of courses |
|
if ($type=~/\_list/) { |
|
return join('<br />',map { |
|
my %courseinfo=&Apache::lonnet::coursedescription($_); |
|
'<a href="/public/'. |
|
$courseinfo{'domain'}.'/'.$courseinfo{'num'}.'/syllabus" target="preview">'. |
|
$courseinfo{'description'}.'</a>'; |
|
} split(/\s*\,\s*/,$value)); |
|
} |
|
# No pretty print found |
|
return $value; |
|
} |
|
# ============================================== Pretty input of metadata field |
|
|
|
sub prettyinput { |
|
my ($type,$value,$fieldname)=@_; |
|
} |
|
|
# ================================================================ Main Handler |
# ================================================================ Main Handler |
|
|
sub handler { |
sub handler { |
Line 281 sub handler {
|
Line 360 sub handler {
|
} |
} |
|
|
# --------------------------------------------------------------- Render Output |
# --------------------------------------------------------------- Render Output |
|
# displayed url |
my ($thisversion)=($uri=~/\.(\d+)\.(\w+)\.meta$/); |
my ($thisversion)=($uri=~/\.(\d+)\.(\w+)\.meta$/); |
$content{'creationdate'}=&Apache::lonlocal::locallocaltime( |
my $disuri=&Apache::lonnet::clutter($uri); |
&Apache::lonmysql::unsqltime($content{'creationdate'})); |
|
$content{'lastrevisiondate'}=&Apache::lonlocal::locallocaltime( |
|
&Apache::lonmysql::unsqltime($content{'lastrevisiondate'})); |
|
$content{'language'}=&Apache::loncommon::languagedescription($content{'language'}); |
|
$content{'mime'}=&Apache::loncommon::filedescription($content{'mime'}); |
|
my $disuri=&Apache::lonnet::declutter($uri); |
|
$disuri=~s/\.meta$//; |
$disuri=~s/\.meta$//; |
|
$disuri=&Apache::lonhtmlcommon::crumbs($disuri); |
|
# version |
my $currentversion=&Apache::lonnet::getversion($disuri); |
my $currentversion=&Apache::lonnet::getversion($disuri); |
my $author=$content{'author'}; |
|
$content{'author'}=~s/(\w+)(\:|\@)(\w+)/&authordisplay($1,$3)/gse; |
|
$content{'owner'}=~s/(\w+)(\:|\@)(\w+)/&authordisplay($1,$3)/gse; |
|
my $versiondisplay=''; |
my $versiondisplay=''; |
if ($thisversion) { |
if ($thisversion) { |
$versiondisplay=&mt('Version').': '.$thisversion. |
$versiondisplay=&mt('Version').': '.$thisversion. |
Line 301 sub handler {
|
Line 374 sub handler {
|
} else { |
} else { |
$versiondisplay='Version: '.$currentversion; |
$versiondisplay='Version: '.$currentversion; |
} |
} |
if ($content{'customdistributionfile'}) { |
# obsolete |
$content{'customdistributionfile'}='<a href="'.$content{'customdistributionfile'}. |
|
'"><tt>'.$content{'customdistributionfile'}.'</tt></a>'; |
|
} else { |
|
$content{'customdistributionfile'}=''; |
|
} |
|
my $obsolete=$content{'obsolete'}; |
my $obsolete=$content{'obsolete'}; |
my $obsoletewarning=''; |
my $obsoletewarning=''; |
if (($obsolete) && ($ENV{'user.adv'})) { |
if (($obsolete) && ($ENV{'user.adv'})) { |
Line 335 sub handler {
|
Line 403 sub handler {
|
'obsoletereplacement') { |
'obsoletereplacement') { |
$table.='<tr><td bgcolor="#AAAAAA">'.$lt{$_}. |
$table.='<tr><td bgcolor="#AAAAAA">'.$lt{$_}. |
'</td><td bgcolor="#CCCCCC">'. |
'</td><td bgcolor="#CCCCCC">'. |
$content{$_}.' </td></tr>'; |
&prettyprint($_,$content{$_}).'</td></tr>'; |
delete $content{$_}; |
delete $content{$_}; |
} |
} |
|
|