--- loncom/interface/lonmeta.pm 2006/08/10 21:14:10 1.167
+++ loncom/interface/lonmeta.pm 2008/11/10 15:15:29 1.213
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Metadata display handler
#
-# $Id: lonmeta.pm,v 1.167 2006/08/10 21:14:10 banghart Exp $
+# $Id: lonmeta.pm,v 1.213 2008/11/10 15:15:29 jms Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -26,6 +26,141 @@
# http://www.lon-capa.org/
+=head1 NAME
+
+Apache::lonmeta - display meta data
+
+=head1 SYNOPSIS
+
+Handler to display meta data
+
+This is part of the LearningOnline Network with CAPA project
+described at http://www.lon-capa.org.
+
+=head1 HANDLER SUBROUTINE
+
+handler()
+
+=head1 OTHER SUBROUTINES
+
+=over
+
+=item *
+
+&get_dynamic_metadata_from_sql($url) :
+
+Queries sql database for dynamic metdata
+Returns a hash of hashes, with keys of urls which match $url
+Returned fields are given below.
+
+Examples:
+
+ %DynamicMetadata = &Apache::lonmeta::get_dynmaic_metadata_from_sql
+ ('/res/msu/korte/');
+
+ $DynamicMetadata{'/res/msu/korte/example.problem'}->{$field}
+
+=item *
+
+dynamicmeta() : Fetch and evaluate dynamic metadata
+
+=item *
+
+access_count()
+
+=item *
+
+alttag() : Try to make an alt tag if there is none
+
+=item *
+
+authordisplay() : Author display
+
+=item *
+
+evalgraph() : Pretty display
+
+=item *
+
+diffgraph()
+
+=item *
+
+fieldnames()
+
+=item *
+
+portfolio_linked_path()
+
+=item *
+
+get_port_path_and_group()
+
+=item *
+
+portfolio_display_uri()
+
+=item *
+
+pre_select_course()
+
+=item *
+
+select_course()
+
+=item *
+
+prettyprint() : Pretty printing of metadata field
+
+=item *
+
+direct() : Pretty input of metadata field
+
+=item *
+
+selectbox()
+
+=item *
+
+relatedfield()
+
+=item *
+
+prettyinput()
+
+=item *
+
+report_bombs()
+
+=item *
+
+present_uneditable_metadata()
+
+=item *
+
+present_editable_metadata()
+
+=item *
+
+store_metadata()
+
+=item *
+
+store_transferred_addedfields()
+
+=item *
+
+store_portfolio_metadata()
+
+=item *
+
+update_metadata_table()
+
+=back
+
+=cut
+
+
package Apache::lonmeta;
use strict;
@@ -39,31 +174,12 @@ use Apache::lonpublisher;
use Apache::lonlocal;
use Apache::lonmysql;
use Apache::lonmsg;
-use lib '/home/httpd/lib/perl/';
-use LONCAPA;
+use LONCAPA qw(:DEFAULT :match);
-############################################################
-############################################################
-##
-## &get_dynamic_metadata_from_sql($url)
-##
-## Queries sql database for dynamic metdata
-## Returns a hash of hashes, with keys of urls which match $url
-## Returned fields are given below.
-##
-## Examples:
-##
-## %DynamicMetadata = &Apache::lonmeta::get_dynmaic_metadata_from_sql
-## ('/res/msu/korte/');
-##
-## $DynamicMetadata{'/res/msu/korte/example.problem'}->{$field}
-##
-############################################################
-############################################################
sub get_dynamic_metadata_from_sql {
my ($url) = shift();
- my ($authordom,$author)=($url=~m:^/res/(\w+)/(\w+)/:);
+ my ($authordom,$author)=($url=~m{^/res/($match_domain)/($match_username)/});
if (! defined($authordom)) {
$authordom = shift();
}
@@ -95,7 +211,8 @@ sub get_dynamic_metadata_from_sql {
while (my $result = <$fh>) {
chomp($result);
next if (! $result);
- my %hash=&LONCAPA::lonmetadata::metadata_col_to_hash(map { &unescape($_) } split(/\,/,$result));
+ my %hash=&LONCAPA::lonmetadata::metadata_col_to_hash('metadata',
+ map { &unescape($_) } split(/\,/,$result));
foreach my $key (keys(%hash)) {
$ReturnHash{$hash{'url'}}->{$key}=$hash{$key};
}
@@ -111,7 +228,7 @@ sub get_dynamic_metadata_from_sql {
sub dynamicmeta {
my $url=&Apache::lonnet::declutter(shift);
$url=~s/\.meta$//;
- my ($adomain,$aauthor)=($url=~/^(\w+)\/(\w+)\//);
+ my ($adomain,$aauthor)=($url=~/^($match_domain)\/($match_username)\//);
my $regexp=$url;
$regexp=~s/(\W)/\\$1/g;
$regexp='___'.$regexp.'___';
@@ -235,13 +352,7 @@ sub fieldnames {
'lowestgradelevel' => 'Lowest Grade Level',
'highestgradelevel' => 'Highest Grade Level');
- if (! defined($file_type) || $file_type ne 'portfolio') {
- %fields =
- (%fields,
- 'courserestricted' => 'Course Restricting Metadata');
- }
-
- if (! defined($file_type) || $file_type ne 'portfolio') {
+ if ( !defined($file_type) || ($file_type ne 'portfolio' && $file_type ne 'groups') ) {
%fields =
(%fields,
'domain' => 'Domain',
@@ -271,7 +382,7 @@ sub fieldnames {
'correct' => 'Material appears to be correct',
'technical' => 'Resource is technically correct',
'avetries' => 'Average number of tries till solved',
- 'stdno' => 'Total number of students who have worked on this problem',
+ 'stdno' => 'Statistics calculated for number of students',
'difficulty' => 'Degree of difficulty',
'disc' => 'Degree of discrimination',
'dependencies' => 'Resources used by this resource',
@@ -366,15 +477,15 @@ sub pre_select_course {
$output = &select_course();
$r->print($output.'
');
+ $r->print('');
+ $r->print('');
$r->print('');
my ($port_path,$group) = &get_port_path_and_group($uri);
my $group_input;
if ($group) {
- $group_input = ''
- } else {
- $group_input = "";
- }
+ $group_input = '';
+ }
$r->print('
Course | '. - 'Section(s) | '. - 'Num Students | '. - 'Mean Tries | '. - 'Degree of Difficulty | '. - 'Degree of Discrimination | '. - 'Time of computation | '. + ''.&mt('Course').' | '. + ''.&mt('Section(s)').' | '. + ''.&mt('Num Student').'s | '. + ''.&mt('Mean Tries').' | '. + ''.&mt('Degree of Difficulty').' | '. + ''.&mt('Degree of Discrimination').' | '. + ''.&mt('Time of computation').' | '. '
---|