--- loncom/interface/lonparmset.pm 2012/12/17 15:00:41 1.529
+++ loncom/interface/lonparmset.pm 2014/06/12 22:29:42 1.545
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.529 2012/12/17 15:00:41 raeburn Exp $
+# $Id: lonparmset.pm,v 1.545 2014/06/12 22:29:42 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -46,8 +46,6 @@ This module sets coursewide and assessme
=over
-=pod
-
=item parmval()
Figure out a cascading parameter.
@@ -139,16 +137,22 @@ javascript function 'pjump'.
extractResourceInformation extracts lots of information about all of the the course's resources into a variety of hashes.
-Input: See list below:
+Input: See list below
+
+=over 4
=item * B : Current username
=item * B : Domain of current user.
-=item * b : Course
+
+=back
Outputs: See list below:
+=over 4
+
=item * B (out) : An array that will contain all of the ids in the course.
=item * B(out) : hash, id->type, where "type" contains the extension of the file, thus, I.
@@ -173,6 +177,8 @@ Outputs: See list below:
=item * B
+=back
+
=item isdateparm()
=item parmmenu()
@@ -210,6 +216,8 @@ Returns: nothing
Variables used (guessed by Jeremy):
+=over
+
=item * B: ParameterS CATegories? ends up a list of the types of parameters that exist, e.g., tol, weight, acc, opendate, duedate, answerdate, sig, maxtries, type.
=item * B: ParameterS PaRTs? a list of the parts of a problem that we are displaying? Used to display only selected parts?
@@ -222,6 +230,8 @@ Variables used (guessed by Jeremy):
When storing information, store as part 0
When requesting information, request from full part
+=back
+
=item tablestart()
=item tableend()
@@ -288,7 +298,6 @@ Set portfolio metadata
Main handler. Calls &assessparms subroutine.
-
=back
=cut
@@ -315,11 +324,15 @@ use LONCAPA qw(:DEFAULT :match);
sub startSettingsScreen {
- my ($r,$mode)=@_;
+ my ($r,$mode,$crstype)=@_;
+ my $tabtext = &mt('Course Settings');
+ if ($crstype eq 'Community') {
+ $tabtext = &mt('Community Settings');
+ }
$r->print("\n".'');
$r->print("\n".' '.
- &mt('Course Settings').
+ $tabtext.
' ');
$r->print("\n".''.
@@ -772,7 +785,7 @@ sub valout {
$result =
' ';
+ .' title="'.&mt('Change').'" style="border:0;" />';
} else {
$result=' ';
}
@@ -920,7 +933,7 @@ COURSECONTENTSCRIPT
}
sub startpage {
- my ($r,$psymb) = @_;
+ my ($r,$psymb,$crstype) = @_;
my %loaditems = (
'onload' => "group_or_section('cgroup')",
@@ -954,7 +967,7 @@ sub startpage {
my $escfilter=&Apache::lonhtmlcommon::entity_encode($env{'form.filter'});
my $escpart=&Apache::lonhtmlcommon::entity_encode($env{'form.part'});
$r->print($start_page.$breadcrumbs);
- &startSettingsScreen($r,'parmset');
+ &startSettingsScreen($r,'parmset',$crstype);
$r->print(<
@@ -1106,6 +1119,10 @@ sub print_td {
if ($which > 3) {
$nolink = 1;
}
+ } elsif ($mprefix =~ /examcode\&$/) {
+ unless ($which == 2) {
+ $nolink = 1;
+ }
}
if ($nolink) {
$r->print(&valout($$outpar[$which],$$typeoutpar[$which]));
@@ -1259,7 +1276,7 @@ sub extractResourceInformation {
$$mapp{$mapid}=$$mapp{$id};
$$allmaps{$mapid}=$$mapp{$id};
if ($mapid eq '1') {
- $$maptitles{$mapid}=&mt('Main Course Documents');
+ $$maptitles{$mapid}=&mt('Main Content');
} else {
$$maptitles{$mapid}=&Apache::lonnet::gettitle($$mapp{$id});
}
@@ -1393,8 +1410,8 @@ sub lookUpTableParameter {
'contentopen' => 'time_settings',
'contentclose' => 'time_settings',
'discussend' => 'time_settings',
- 'printopendate' => 'time_settings',
- 'printclosedate' => 'time_settings',
+ 'printstartdate' => 'time_settings',
+ 'printenddate' => 'time_settings',
'weight' => 'grading',
'handgrade' => 'grading',
'maxtries' => 'tries',
@@ -1429,7 +1446,7 @@ sub lookUpTableParameter {
'lenient' => 'grading',
'retrypartial' => 'tries',
'discussvote' => 'misc',
-
+ 'examcode' => 'high_level_randomization',
);
}
@@ -1502,33 +1519,25 @@ sub parmboxes {
&whatIsMyCategory($tempparameter, \%categoryList);
}
#part to print the parm-list
- $r->print(''."\n");
-
- #Print parameters
- for my $key (sort { $category_order{$a} <=> $category_order{$b} } keys %categoryList) {
- if(@{$categoryList{$key}} == 0) {
- next;
- } else {
- $r->print('
'
- .'
'
- .&mt($categories{$key})
- .' '."\n");
- foreach $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) {
- $r->print('
'
- .' print('value="'.$tempkey.'" ');
- if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) {
- $r->print(' checked="checked"');
- }
- $r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey}
- : $tempkey)
- .' '."\n");
+ foreach my $key (sort { $category_order{$a} <=> $category_order{$b} } keys(%categoryList)) {
+ next if (@{$categoryList{$key}} == 0);
+ next if ($key eq '');
+ $r->print('
'
+ .'
'.&mt($categories{$key}).' '."\n");
+ foreach my $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) {
+ $r->print(''
+ .' print( ' checked="checked"');
}
- $r->print(" \n");
+ $r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey}
+ : $tempkey)
+ .'
'."\n");
}
+ $r->print('
');
}
-
- $r->print("
\n");
+ $r->print("\n");
}
#
# This function offers some links on the parameter section to get with one click a group a parameters
@@ -1693,13 +1702,13 @@ function group_or_section(caller) {
# This function shows on table Mode the available Parameters for the selected Resources
#
sub displaymenu {
- my ($r,$allparms,$pscat,$psprt,$keyorder)=@_;
+ my ($r,$allparms,$pscat,$psprt,$keyorder,$divid)=@_;
$r->print(&Apache::lonhtmlcommon::start_pick_box());
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameters to View')));
&parmmenu($r,$allparms,$pscat,$keyorder);
- $r->print(&Apache::loncommon::start_scrollbox());
+ $r->print(&Apache::loncommon::start_scrollbox('480px','440px','200px',$divid));
&parmboxes($r,$allparms,$pscat,$keyorder);
$r->print(&Apache::loncommon::end_scrollbox());
@@ -1773,7 +1782,7 @@ sub mapmenu {
.''
);
- $r->print(&Apache::loncommon::start_scrollbox(undef,undef,undef,'mapmenuscroll'));
+ $r->print(&Apache::loncommon::start_scrollbox('700px','680px','400px','mapmenuscroll'));
$r->print(&Apache::loncommon::start_data_table(undef,'mapmenuinner'));
# Display row: "All Maps or Folders"
@@ -1792,7 +1801,7 @@ sub mapmenu {
.&Apache::loncommon::end_data_table_row()
);
- # Display row: "Main Course Documents"
+ # Display row: "Main Content"
if (exists($$allmaps{1})) {
$r->print(
&Apache::loncommon::start_data_table_row()
@@ -1984,8 +1993,8 @@ sub standardkeyorder {
'parameter_0_discussend' => 19,
'parameter_0_discusshide' => 20,
'parameter_0_discussvote' => 21,
- 'parameter_0_printopendate' => 22,
- 'parameter_0_printclosedate' => 23);
+ 'parameter_0_printstartdate' => 22,
+ 'parameter_0_printenddate' => 23);
}
@@ -2088,8 +2097,10 @@ sub assessparms {
$id='';
} else {
$message=
- ''.&mt("Unknown ID")." '$id' ".
- &mt('at domain')." '$udom' ";
+ ''.
+ &mt('Unknown ID [_1] at domain [_2]',
+ "'".$id."'","'".$udom."'").
+ '
';
}
} else {
$uname=$env{'form.uname'};
@@ -2100,16 +2111,20 @@ sub assessparms {
$uhome=&Apache::lonnet::homeserver($uname,$udom);
if ($uhome eq 'no_host') {
$message=
- ''.&mt("Unknown user")." '$uname' ".
- &mt("at domain")." '$udom' ";
+ ''.
+ &mt('Unknown user [_1] at domain [_2]',
+ "'".$uname."'","'".$udom."'").
+ '
';
$uname='';
} else {
$csec=&Apache::lonnet::getsection($udom,$uname,
$env{'request.course.id'});
if ($csec eq '-1') {
- $message=''.
- &mt("User")." '$uname' ".&mt("at domain")." '$udom' ".
- &mt("not in this course")." ";
+ $message=
+ ''.
+ &mt('User [_1] at domain [_2] not in this course',
+ "'".$uname."'","'".$udom."'").
+ '
';
$uname='';
$csec=$env{'form.csec'};
$cgroup=$env{'form.cgroup'};
@@ -2186,18 +2201,23 @@ sub assessparms {
}
}
}
- } elsif ($markers[$i] =~ /_(type|lenient|retrypartial|discussvote)\&\d+$/) {
+ } elsif ($markers[$i] =~ /_(type|lenient|retrypartial|discussvote|examcode)\&\d+$/) {
$name = $1;
+ my $val = $values[$i];
+ if ($name eq 'examcode') {
+ if (&Apache::lonnet::validCODE($values[$i])) {
+ $val = 'valid';
+ }
+ }
$needsrelease =
- $Apache::lonnet::needsrelease{"parameter:$name:$values[$i]"};
+ $Apache::lonnet::needsrelease{"parameter:$name:$val"};
if ($needsrelease) {
unless ($got_chostname) {
($chostname,$cmajor,$cminor) = ¶meter_release_vars();
$got_chostname = 1;
}
- $needsnewer = ¶meter_releasecheck($name,$values[$i],
+ $needsnewer = ¶meter_releasecheck($name,$val,
$needsrelease,
- $chostname,
$cmajor,$cminor);
}
}
@@ -2226,7 +2246,8 @@ sub assessparms {
if ($psprt[0] eq "all" || !@psprt) {@psprt = (keys %allparts);}
# ------------------------------------------------------------------ Start page
- &startpage($r,$pssymb);
+ my $crstype = &Apache::loncommon::course_type();
+ &startpage($r,$pssymb,$crstype);
foreach ('tolerance','date_default','date_start','date_end',
'date_interval','int','float','string') {
@@ -2278,7 +2299,7 @@ ENDPARMSELSCRIPT
# Step 2
$r->print(&Apache::lonhtmlcommon::topic_bar(2,&mt('Parameter Specification'),'parmstep2'));
- &displaymenu($r,\%allparms,\@pscat,\@psprt,\%keyorder);
+ &displaymenu($r,\%allparms,\@pscat,\@psprt,\%keyorder,'parmmenuscroll');
# Step 3
$r->print(&Apache::lonhtmlcommon::topic_bar(3,&mt('User Specification (optional)'),'parmstep3'));
@@ -2306,7 +2327,6 @@ ENDPARMSELSCRIPT
.' '
.'
');
} else {
- $r->print();
# parameter screen for a single resource.
my ($map,$iid,$resource)=&Apache::lonnet::decode_symb($pssymb);
my $title = &Apache::lonnet::gettitle($pssymb);
@@ -2367,7 +2387,7 @@ ENDPARMSELSCRIPT
$userspan ++;
}
$r->print('');
- $r->print(&mt("User")." $uname ".&mt('at Domain')." $udom ");
+ $r->print(&mt('User [_1] at Domain [_2]',"'".$uname."'","'".$udom."'").'');
}
my %lt=&Apache::lonlocal::texthash(
'pie' => "Parameter in Effect",
@@ -2430,9 +2450,8 @@ ENDTABLEHEADFOUR
my $defbgtwo='';
my $defbgthree = '';
- foreach (@ids) {
+ foreach my $rid (@ids) {
- my $rid=$_;
my ($inmapid)=($rid=~/\.(\d+)$/);
if ((!$pssymb &&
@@ -2838,6 +2857,8 @@ sub storedata {
$name = 'lenient';
} elsif ($typeof eq 'string_discussvote') {
$name = 'discussvote';
+ } elsif ($typeof eq 'string_examcode') {
+ $name = 'examcode';
} elsif ($typeof eq 'string_yesno') {
if ($thiskey =~ /\.retrypartial$/) {
$name = 'retrypartial';
@@ -2853,8 +2874,7 @@ sub storedata {
}
$needsnewer = ¶meter_releasecheck($name,$data,
$needsrelease,
- $chostname,$cmajor,
- $cminor);
+ $cmajor,$cminor);
}
if ($needsnewer) {
$r->print(' '.&oldversion_warning($name,$data,
@@ -3162,7 +3182,7 @@ my %strings =
=> [[ 'problem', 'Standard Problem'],
[ 'survey', 'Survey'],
[ 'anonsurveycred', 'Anonymous Survey (credit for submission)'],
- [ 'exam', 'Exam'],
+ [ 'exam', 'Bubblesheet Exam'],
[ 'anonsurvey', 'Anonymous Survey'],
[ 'randomizetry', 'New Randomization Each N Tries (default N=1)'],
[ 'practice', 'Practice'],
@@ -3208,8 +3228,7 @@ sub string_selector {
$got_chostname = 1;
}
my $needsnewer=¶meter_releasecheck($name,$parmval,$needsrelease,
- $chostname,$cmajor,
- $cminor);
+ $cmajor,$cminor);
if ($needsnewer) {
$skiptype{$parmval} = 1;
}
@@ -3307,6 +3326,7 @@ sub newoverview {
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
+ my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'};
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview',
text=>"Overview Mode"});
@@ -3326,7 +3346,7 @@ sub newoverview {
{'add_entries' => \%loaditems,});
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview');
$r->print($start_page.$breadcrumbs);
- &startSettingsScreen($r,'parmset');
+ &startSettingsScreen($r,'parmset',$crstype);
$r->print(<
ENDOVER
@@ -3495,13 +3515,14 @@ sub overview {
my ($r) = @_;
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
+ my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'};
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview',
text=>"Overview Mode"});
my $start_page=&Apache::loncommon::start_page('Modify Parameters');
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview');
$r->print($start_page.$breadcrumbs);
- &startSettingsScreen($r,'parmset');
+ &startSettingsScreen($r,'parmset',$crstype);
$r->print('