--- loncom/interface/lonparmset.pm 2011/03/11 02:39:53 1.511
+++ loncom/interface/lonparmset.pm 2011/11/21 03:25:19 1.515
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.511 2011/03/11 02:39:53 www Exp $
+# $Id: lonparmset.pm,v 1.515 2011/11/21 03:25:19 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -137,33 +137,41 @@ javascript function 'pjump'.
=item extractResourceInformation() :
-Given the course data hash, extractResourceInformation extracts lots of information about the course's resources into a variety of hashes.
+ extractResourceInformation extracts lots of information about all of the the course's resources into a variety of hashes.
Input: See list below:
-=item * B : An array that will contain all of the ids in the course.
+=item * B : Current username
-=item * B : hash, id->type, where "type" contains the extension of the file, thus, I.
+=item * B : Domain of current user.
-=item * B : hash, id->key list, will contain a comma separated list of the meta-data keys available for the given id
+=item * b : hash, name of parameter->display value (what is the display value?)
+Outputs: See list below:
-=item * B : hash, part identification->text representation of part, where the text representation is "[Part $part]"
+=item * B (out) : An array that will contain all of the ids in the course.
-=item * B : hash, full key to part->display value (what's display value?)
+=item * B(out) : hash, id->type, where "type" contains the extension of the file, thus, I.
-=item * B : hash, ???
+=item * B (out) : hash, id->key list, will contain a comma separated list of the meta-data keys available for the given id
-=item * B : ???
+=item * B (out) : hash, name of parameter->display value (what is the display value?)
-=item * B : hash, ???
+=item * B (out) : hash, part identification->text representation of part, where the text representation is "[Part $part]"
+
+=item * B (out) : hash, ???
=item * B : ??
=item * B : hash, id->full sym?
+=item * B
+
+=item * B
+=item * B
+
+=item * B
=item isdateparm()
@@ -196,8 +204,8 @@ Input: See list below:
Show assessment data and parameters. This is a large routine that should
be simplified and shortened... someday.
-Inputs: $r
-
+Inputs: $r - the Apache request object.
+
Returns: nothing
Variables used (guessed by Jeremy):
@@ -892,11 +900,15 @@ ENDJS
}
sub startpage {
- my ($r) = @_;
+ my ($r,$psymb) = @_;
- my %loaditems = ('onunload' => "pclose()",
- 'onload' => "showHide_courseContent(); group_or_section('cgroup')",
- );
+ my %loaditems = (
+ 'onunload' => "pclose()",
+ 'onload' => "group_or_section('cgroup')",
+ );
+ if (!$psymb) {
+ $loaditems{'onload'} = "showHide_courseContent(); group_or_section('cgroup')";
+ }
if ((($env{'form.command'} eq 'set') && ($env{'form.url'})
&& (!$env{'form.dis'})) || ($env{'form.symb'})) {
@@ -1165,6 +1177,7 @@ sub extractResourceInformation {
$$typep{$id}=$1;
$$keyp{$id}='';
$$uris{$id}=$srcf;
+
foreach my $key (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys'))) {
next if ($key!~/^parameter_/);
@@ -1353,6 +1366,8 @@ sub lookUpTableParameter {
'contentopen' => 'time_settings',
'contentclose' => 'time_settings',
'discussend' => 'time_settings',
+ 'printopendate' => 'time_settings',
+ 'printclosedate' => 'time_settings',
'weight' => 'grading',
'handgrade' => 'grading',
'maxtries' => 'tries',
@@ -1384,6 +1399,7 @@ sub lookUpTableParameter {
'acc' => 'misc',
'maxcollaborators' => 'misc',
'scoreformat' => 'misc',
+ 'lenient' => 'grading',
);
}
@@ -1932,7 +1948,9 @@ sub standardkeyorder {
'parameter_0_sig' => 17,
'parameter_0_turnoffunit' => 18,
'parameter_0_discussend' => 19,
- 'parameter_0_discusshide' => 20);
+ 'parameter_0_discusshide' => 20,
+ 'parameter_0_printopendate' => 21,
+ 'parameter_0_printclosedate' => 22);
}
@@ -1940,6 +1958,9 @@ sub assessparms {
my $r=shift;
+
+
+# -------------------------------------------------------- Variable declaration
my @ids=();
my %symbp=();
my %mapp=();
@@ -1947,9 +1968,6 @@ sub assessparms {
my %keyp=();
my %uris=();
my %maptitles=();
-
-# -------------------------------------------------------- Variable declaration
-
my %allmaps=();
my %alllevs=();
@@ -1968,14 +1986,16 @@ sub assessparms {
my %allparms;
my %allparts;
+# ------------------------------------------------------------------------------
+
#
# Order in which these parameters will be displayed
#
my %keyorder=&standardkeyorder();
- @ids=();
- %symbp=();
- %typep=();
+# @ids=();
+# %symbp=(); # These seem defined above already.
+# %typep=();
my $message='';
@@ -2097,8 +2117,10 @@ sub assessparms {
my $chome = $env{'course.'.$env{'request.course.id'}.'.home'};
my ($got_chostname,$chostname,$cmajor,$cminor);
my $totalstored = 0;
+
+
for (my $i=0;$i<=$#markers;$i++) {
- my ($needsrelease,$needsnewer);
+ my ($needsrelease,$needsnewer,$name);
if ($markers[$i] =~ /^[\d.]+\&0_availablestudent\&(1|2|3)$/) {
my (@ok_slots,@fail_slots,@del_slots);
my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom);
@@ -2129,22 +2151,23 @@ sub assessparms {
}
}
}
- } elsif ($markers[$i] =~ /_type\&\d+$/) {
+ } elsif ($markers[$i] =~ /_(type|lenient)\&\d+$/) {
+ $name = $1;
$needsrelease =
- $Apache::lonnet::needsrelease{'parameter:type:'.$values[$i]};
+ $Apache::lonnet::needsrelease{"parameter:$name:$values[$i]"};
if ($needsrelease) {
unless ($got_chostname) {
- ($chostname,$cmajor,$cminor) = &questiontype_release_vars();
+ ($chostname,$cmajor,$cminor) = ¶meter_release_vars();
$got_chostname = 1;
}
- $needsnewer = &questiontype_releasecheck($values[$i],
- $needsrelease,
- $chostname,
- $cmajor,$cminor);
+ $needsnewer = ¶meter_releasecheck($name,$values[$i],
+ $needsrelease,
+ $chostname,
+ $cmajor,$cminor);
}
}
if ($needsnewer) {
- $message .= &oldversion_warning($values[$i],$chostname,$cmajor,
+ $message .= &oldversion_warning($name,$values[$i],$chostname,$cmajor,
$cminor,$needsrelease);
} else {
$message.=&storeparm(split(/\&/,$markers[$i]),
@@ -2168,7 +2191,7 @@ sub assessparms {
if ($psprt[0] eq "all" || !@psprt) {@psprt = (keys %allparts);}
# ------------------------------------------------------------------ Start page
- &startpage($r);
+ &startpage($r,$pssymb);
foreach ('tolerance','date_default','date_start','date_end',
'date_interval','int','float','string') {
@@ -2260,6 +2283,7 @@ COURSECONTENTSCRIPT
.''
.'
');
} else {
+ $r->print();
# parameter screen for a single resource.
my ($map,$iid,$resource)=&Apache::lonnet::decode_symb($pssymb);
my $title = &Apache::lonnet::gettitle($pssymb);
@@ -2425,7 +2449,6 @@ ENDTABLEHEADFOUR
my $uri=&Apache::lonnet::declutter($uris{$rid});
my $filter=$env{'form.filter'};
-
foreach (&keysplit($keyp{$rid})) {
my $tempkeyp = $_;
if (grep $_ eq $tempkeyp, @catmarker) {
@@ -2480,8 +2503,8 @@ ENDTABLEHEADFOUR
$r->print(''.$maptitles{$mapp{$rid}}.' | ');
-
foreach (&keysinorder_bytype(\%name,\%keyorder)) {
+
unless ($firstrow) {
$r->print('');
} else {
@@ -2787,25 +2810,32 @@ sub storedata {
$tkey=~s/\.\[useropt\:$tuname\:$tudom\]\./\./;
}
if ($cmd eq 'set' || $cmd eq 'datepointer' || $cmd eq 'dateinterval') {
- my ($data, $typeof, $text);
+ my ($data, $typeof, $text, $name);
if ($cmd eq 'set') {
$data=$env{$key};
$typeof=$env{'form.typeof_'.$thiskey};
$text = &mt('Saved modified parameter for');
if ($typeof eq 'string_questiontype') {
+ $name = 'type';
+ } elsif ($typeof eq 'string_lenient') {
+ $name = 'lenient';
+ }
+ if ($name ne '') {
my ($needsrelease,$needsnewer);
- $needsrelease = $Apache::lonnet::needsrelease{'parameter:type:'.$data};
+ $needsrelease = $Apache::lonnet::needsrelease{"parameter:$name:$data"};
if ($needsrelease) {
unless ($got_chostname) {
- ($chostname,$cmajor,$cminor)=&questiontype_release_vars();
+ ($chostname,$cmajor,$cminor)=¶meter_release_vars();
$got_chostname = 1;
}
- $needsnewer = &questiontype_releasecheck($data,$needsrelease,
- $chostname,$cmajor,
- $cminor);
+ $needsnewer = ¶meter_releasecheck($name,$data,
+ $needsrelease,
+ $chostname,$cmajor,
+ $cminor);
}
if ($needsnewer) {
- $r->print('
'.&oldversion_warning($data,$chostname,$cmajor,
+ $r->print('
'.&oldversion_warning($name,$data,
+ $chostname,$cmajor,
$cminor,$needsrelease));
next;
}
@@ -3040,7 +3070,7 @@ sub listdata {
$$resourcedata{$thiskey}));
} elsif ($thistype =~ m/^string/) {
$r->print(&string_selector($thistype,$thiskey,
- $$resourcedata{$thiskey}));
+ $$resourcedata{$thiskey},$name));
} else {
$r->print(&default_selector($thiskey,$$resourcedata{$thiskey}));
}
@@ -3114,6 +3144,10 @@ my %strings =
[ 'randomizetry', 'New Randomization Each N Tries (default N=1)'],
[ 'practice', 'Practice'],
[ 'surveycred', 'Survey (credit for submission)']],
+ 'string_lenient'
+ => [['yes', 'Yes' ],
+ [ 'no', 'No' ],
+ [ 'default', 'Default - only bubblesheet grading is lenient' ]]
);
sub standard_string_options {
@@ -3125,33 +3159,35 @@ sub standard_string_options {
}
sub string_selector {
- my ($thistype, $thiskey, $showval) = @_;
+ my ($thistype, $thiskey, $showval, $name) = @_;
if (!exists($strings{$thistype})) {
return &default_selector($thiskey,$showval);
}
my %skiptype;
- if ($thistype eq 'string_questiontype') {
+ if (($thistype eq 'string_questiontype') ||
+ ($thistype eq 'string_lenient')) {
my ($got_chostname,$chostname,$cmajor,$cminor);
foreach my $possibilities (@{ $strings{$thistype} }) {
next unless (ref($possibilities) eq 'ARRAY');
- my ($name, $description) = @{ $possibilities };
- my $needsrelease=$Apache::lonnet::needsrelease{'parameter:type:'.$name};
+ my ($parmval, $description) = @{ $possibilities };
+ my $needsrelease=$Apache::lonnet::needsrelease{"parameter:$name:$parmval"};
if ($needsrelease) {
unless ($got_chostname) {
- ($chostname,$cmajor,$cminor)=&questiontype_release_vars();
+ ($chostname,$cmajor,$cminor)=¶meter_release_vars();
$got_chostname = 1;
}
- my $needsnewer=&questiontype_releasecheck($name,$needsrelease,
- $chostname,$cmajor,
- $cminor);
+ my $needsnewer=¶meter_releasecheck($name,$parmval,$needsrelease,
+ $chostname,$cmajor,
+ $cminor);
if ($needsnewer) {
- $skiptype{$name} = 1;
+ $skiptype{$parmval} = 1;
}
}
}
}
+
my $result;
my $numinrow = 3;
@@ -3549,7 +3585,8 @@ sub date_shift_one {
''.&mt('Currently set date:').' | '.
&Apache::lonlocal::locallocaltime($env{'form.timebase'}).' |
'.
''.&mt('Shifted date:').' | '.
- &Apache::lonhtmlcommon::date_setter('shiftform',
+ &Apache::lonhtmlcommon::dshowerfuck.net
+ate_setter('shiftform',
'timeshifted',
$env{'form.timebase'},,
'').
@@ -4555,7 +4592,7 @@ sub check_for_course_info {
return 0;
}
-sub questiontype_release_vars {
+sub parameter_release_vars {
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $chome = $env{'course.'.$env{'request.course.id'}.'.home'};
my $chostname = &Apache::lonnet::hostname($chome);
@@ -4564,35 +4601,42 @@ sub questiontype_release_vars {
return ($chostname,$cmajor,$cminor);
}
-sub questiontype_releasecheck {
- my ($questiontype,$needsrelease,$chostname,$cmajor,$cminor) = @_;
+sub parameter_releasecheck {
+ my ($name,$value,$needsrelease,$chostname,$cmajor,$cminor) = @_;
my $needsnewer;
my ($needsmajor,$needsminor) = split(/\./,$needsrelease);
if (($cmajor < $needsmajor) ||
($cmajor == $needsmajor && $cminor < $needsminor)) {
$needsnewer = 1;
} else {
- &Apache::lonnet::update_released_required($Apache::lonnet::needsrelease{'parameter:type:'.$questiontype});
+ &Apache::lonnet::update_released_required($Apache::lonnet::needsrelease{'parameter:'.$name.':'.$value});
}
return $needsnewer;
}
sub oldversion_warning {
- my ($questiontype,$chostname,$cmajor,$cminor,$needsrelease) = @_;
+ my ($name,$value,$chostname,$cmajor,$cminor,$needsrelease) = @_;
my $desc;
- if (ref($strings{'string_questiontype'}) eq 'ARRAY') {
- foreach my $possibilities (@{ $strings{'string_questiontype'} }) {
- next unless (ref($possibilities) eq 'ARRAY');
- my ($name, $description) = @{ $possibilities };
- if ($name eq $questiontype) {
- $desc = $description;
- last;
+ my %stringtypes = (
+ type => 'string_questiontype',
+ lenient => 'string_lenient'
+ );
+ if (exists($stringtypes{$name})) {
+ if (ref($strings{$stringtypes{$name}}) eq 'ARRAY') {
+ foreach my $possibilities (@{ $strings{$stringtypes{$name}} }) {
+ next unless (ref($possibilities) eq 'ARRAY');
+ my ($parmval, $description) = @{ $possibilities };
+ if ($parmval eq $value) {
+ $desc = $description;
+ last;
+ }
}
}
}
+ my $standard_name = &standard_parameter_names($name);
return ' '.
- &mt('Question Type was [_1]not[_2] set to [_3].',
- '','','"'.$desc.'"').' '.
+ &mt('[_1] was [_2]not[_3] set to [_4].',
+ $standard_name,'','','"'.$desc.'"').' '.
&mt('LON-CAPA version ([_1]) installed on home server ([_2]) does not meet version requirements ([_3] or newer).',
$cmajor.'.'.$cminor,$chostname,
$needsrelease).
|