--- loncom/interface/lonparmset.pm 2005/07/19 16:42:02 1.239
+++ loncom/interface/lonparmset.pm 2005/11/11 23:07:27 1.265
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.239 2005/07/19 16:42:02 raeburn Exp $
+# $Id: lonparmset.pm,v 1.265 2005/11/11 23:07:27 banghart Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1921,6 +1921,9 @@ sub crsenv {
'disablesigfigs'
=> ''.&mt('Disable checking of Significant Figures').'
'.
' ('.&mt('"[_1]" to disable, anything else if not','yes').')',
+ 'disableexampointprint'
+ => ''.&mt('Disable automatically printing point values onto exams.').'
'.
+ ' ('.&mt('"[_1]" to disable, anything else if not','yes').')',
'tthoptions'
=> ''.&mt('Default set of options to pass to tth/m when converting tex').''
);
@@ -1947,10 +1950,11 @@ sub crsenv {
'default_enrollment_start_date',
'default_enrollment_end_date',
'tthoptions',
- 'disablesigfigs'
+ 'disablesigfigs',
+ 'disableexampointprint'
);
foreach my $parameter (sort(keys(%values))) {
- unless ($parameter =~ m/^internal\./) {
+ unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./)) {
if (! $descriptions{$parameter}) {
$descriptions{$parameter}=$parameter;
push(@Display_Order,$parameter);
@@ -2189,20 +2193,41 @@ sub listdata {
my $pointer=0;
$tableopen=0;
my $foundkeys=0;
+ my %keyorder=&standardkeyorder();
foreach my $thiskey (sort {
if ($sortorder eq 'realmstudent') {
- my ($astudent,$arealm)=($a=~/^$env{'request.course.id'}\.([^\.]+)\.(.+)\.[^\.]+$/);
- my ($bstudent,$brealm)=($b=~/^$env{'request.course.id'}\.([^\.]+)\.(.+)\.[^\.]+$/);
- if (!defined($astudent) && !defined($bstudent) &&
- !defined($arealm) && !defined($brealm)) {
- ($arealm)=($a=~/^$env{'request.course.id'}\.(.+)\.[^\.]+$/);
- ($brealm)=($b=~/^$env{'request.course.id'}\.(.+)\.[^\.]+$/);
+ my ($astudent,$arealm)=($a=~/^\Q$env{'request.course.id'}\E\.\[([^\.]+)\]\.(.+)\.[^\.]+$/);
+ my ($bstudent,$brealm)=($b=~/^\Q$env{'request.course.id'}\E\.\[([^\.]+)\]\.(.+)\.[^\.]+$/);
+ if (!defined($astudent)) {
+ ($arealm)=($a=~/^\Q$env{'request.course.id'}\E\.(.+)$/);
+ }
+ if (!defined($bstudent)) {
+ ($brealm)=($b=~/^\Q$env{'request.course.id'}\E\.(.+)$/);
+ }
+ $arealm=~s/\.type//;
+ my ($ares, $aparm) = ($arealm=~/^(.*)\.(.*)$/);
+ $aparm=$keyorder{'parameter_0_'.$aparm};
+ $brealm=~s/\.type//;
+ my ($bres, $bparm) = ($brealm=~/^(.*)\.(.*)$/);
+ $bparm=$keyorder{'parameter_0_'.$bparm};
+ if ($ares eq $bres) {
+ if (defined($aparm) && defined($bparm)) {
+ ($aparm <=> $bparm);
+ } elsif (defined($aparm)) {
+ -1;
+ } elsif (defined($bparm)) {
+ 1;
+ } else {
+ ($arealm cmp $brealm) || ($astudent cmp $bstudent);
+ }
+ } else {
+ ($arealm cmp $brealm) || ($astudent cmp $bstudent);
}
- ($arealm cmp $brealm) || ($astudent cmp $bstudent);
} else {
$a cmp $b;
}
} keys %{$listdata}) {
+
if ($$listdata{$thiskey.'.type'}) {
my $thistype=$$listdata{$thiskey.'.type'};
if ($$resourcedata{$thiskey.'.type'}) {
@@ -2677,6 +2702,10 @@ ENDMAINFORMHEAD
action => 'crsenv',
permission => $parm_permission,
},
+ { text => 'Set Portfolio Metadata',
+ action => 'setrestrictmeta',
+ permission => $parm_permission,
+ },
{ text => 'Set/Modify Resource Parameters - Helper Mode',
url => '/adm/helper/parameter.helper',
permission => $parm_permission,
@@ -2720,8 +2749,93 @@ ENDMAINFORMHEAD
$r->print($menu_html);
return;
}
-
-
+### Set portfolio metadata
+sub output_row {
+ my ($r, $field_name, $field_text) = @_;
+ my $output;
+ my $options=$env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.options'};
+ my $values=$env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.values'};
+ unless (defined($options)) {
+ $options = 'active,stuadd';
+ $values = '';
+ }
+ $output.=''.$field_text.':';
+ $output.='
';
+
+ my @options= ( ['active', 'Show to student'],
+ ['onlyone','Student may select only one choice'],
+ ['stuadd', 'Student may type choices']);
+ foreach my $opt (@options) {
+ my $checked = ($options =~ m/$opt->[0]/) ? ' checked="checked" ' : '' ;
+ $output.=(' 'x5).'
';
+ }
+ return ($output);
+}
+
+sub setrestrictmeta {
+ my ($r)=@_;
+ my $next_meta;
+ my $output;
+ my $item_num;
+ my $put_result;
+ $r->print(&Apache::lonxml::xmlbegin());
+ $r->print('
+ $output + + +ENDenv + $r->print('