');
} else {
@@ -1310,7 +1548,7 @@ ENDTABLEHEADFOUR
# When storing information, store as part 0
# When requesting information, request from full part
#-------------------------------------------------------------------
- foreach (split(/\,/,$keyp{$rid})) {
+ foreach (&keysplit($keyp{$rid})) {
my $tempkeyp = $_;
my $fullkeyp = $tempkeyp;
$tempkeyp =~ s/_\w+_/_0_/;
@@ -1339,10 +1577,7 @@ Set Defaults for All Resources in $folde
Specifically for
ENDMAPONE
if ($uname) {
- my %name=&Apache::lonnet::userenvironment($udom,$uname,
- ('firstname','middlename','lastname','generation', 'id'));
- my $person=$name{'firstname'}.' '.$name{'middlename'}.' '
- .$name{'lastname'}.' '.$name{'generation'};
+ my $person=&Apache::loncommon::plainname($uname,$udom);
$r->print(&mt("User")." $uname \($person\) ".
&mt('in')." \n");
} else {
@@ -1360,12 +1595,11 @@ ENDMAPONE
$r->print('
\n");
}
$r->print("");
} # end of $parmlev eq general
@@ -1539,9 +1769,13 @@ sub crsenv {
#
# Let the user know we made the changes
if ($name && defined($value)) {
+ my $failed_cloners;
if ($name eq 'cloners') {
+ $value =~ s/\s//g;
$value =~ s/^,//;
$value =~ s/,$//;
+ # check requested clones are valid users.
+ $failed_cloners = &check_cloners(\$value,\@oldcloner);
}
my $put_result = &Apache::lonnet::put('environment',
{$name=>$value},$dom,$crs);
@@ -1558,6 +1792,18 @@ sub crsenv {
$setoutput.=&mt('Unable to set').' '.$name.' '.&mt('to').
' '.$value.' '.&mt('due to').' '.$put_result.'. ';
}
+ if (($name eq 'cloners') && ($failed_cloners)) {
+ $setoutput.= &mt('Unable to include').' - '.$failed_cloners.', '.
+ &mt('reason').' - '.&mt('LON-CAPA user(s) do(es) not exist').
+ '. '.&mt('Please ').
+ ' '.
+ &mt('add the user(s)').', '.
+ &mt('and then return to the ').
+ ''.
+ &mt('Course Parameters page').' '.
+ &mt('to add the new user(s) to the list of possible cloners').
+ '. ';
+ }
}
}
# ------------------------- Re-init course environment entries for this session
@@ -1651,8 +1897,8 @@ sub crsenv {
=> ''.&mt('Receipt algorithm used').' '.
&mt('This controls how receipt numbers are generated.'),
'suppress_tries'
- => ''.&mt('Suppress number of tries in printing').'('.
- &mt('yes if supress').')',
+ => ''.&mt('Suppress number of tries in printing').' '.
+ ' ('.&mt('"[_1]" to suppress, anything else to not suppress','yes').')',
'problem_stream_switch'
=> ''.&mt('Allow problems to be split over pages').' '.
' ('.&mt('"[_1]" if allowed, anything else if not','yes').')',
@@ -1664,17 +1910,22 @@ sub crsenv {
'anonymous_quiz'
=> ''.&mt('Anonymous quiz/exam').' '.
' ('.&mt('yes').' '.&mt('to avoid print students names').' )',
- 'default_enrollment_start_date' => ''.&mt('Default beginning date when enrolling students').'',
- 'default_enrollment_end_date' => ''.&mt('Default ending date when enrolling students').'',
+ 'default_enrollment_start_date' => ''.&mt('Default beginning date for student access.').'',
+ 'default_enrollment_end_date' => ''.&mt('Default ending date for student access.').'',
'nothideprivileged' => ''.&mt('Privileged users that should not be hidden on staff listings').''.
' (user:domain,user:domain,...)',
'languages' => ''.&mt('Languages used').'',
'disable_receipt_display'
=> ''.&mt('Disable display of problem receipts').' '.
' ('.&mt('"[_1]" to disable, anything else if not','yes').')',
+ 'task_messages'
+ => ''.&mt('Send message to student when clicking Done on Tasks. [_1] to send a message only to student, [_2] to send message to student and add record to user information page for instructors. Leave blank to disable.','only_student','student_and_user_notes_screen').'',
'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').''
);
@@ -1701,10 +1952,12 @@ sub crsenv {
'default_enrollment_start_date',
'default_enrollment_end_date',
'tthoptions',
- 'disablesigfigs'
+ 'disablesigfigs',
+ 'disableexampointprint',
+ 'task_messages'
);
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);
@@ -1852,9 +2105,12 @@ sub storedata {
}
if ($cmd eq 'set') {
my $data=$env{$_};
- if ($$olddata{$thiskey} ne $data) {
+ my $typeof=$env{'form.typeof_'.$thiskey};
+ if ($$olddata{$thiskey} ne $data) {
if ($tuname) {
- if (&Apache::lonnet::put('resourcedata',{$tkey=>$data},$tudom,$tuname) eq 'ok') {
+ if (&Apache::lonnet::put('resourcedata',{$tkey=>$data,
+ $tkey.'.type' => $typeof},
+ $tudom,$tuname) eq 'ok') {
$r->print(' '.&mt('Stored modified parameter for').' '.
&Apache::loncommon::plainname($tuname,$tudom));
} else {
@@ -1864,7 +2120,8 @@ sub storedata {
&Apache::lonnet::devalidateuserresdata($tuname,$tudom);
} else {
$newdata{$thiskey}=$data;
- }
+ $newdata{$thiskey.'.type'}=$typeof;
+ }
}
} elsif ($cmd eq 'del') {
if ($tuname) {
@@ -1880,9 +2137,12 @@ sub storedata {
}
} elsif ($cmd eq 'datepointer') {
my $data=&Apache::lonhtmlcommon::get_date_from_form($env{$_});
+ my $typeof=$env{'form.typeof_'.$thiskey};
if (defined($data) and $$olddata{$thiskey} ne $data) {
if ($tuname) {
- if (&Apache::lonnet::put('resourcedata',{$tkey=>$data},$tudom,$tuname) eq 'ok') {
+ if (&Apache::lonnet::put('resourcedata',{$tkey=>$data,
+ $tkey.'.type' => $typeof},
+ $tudom,$tuname) eq 'ok') {
$r->print(' '.&mt('Stored modified date for').' '.&Apache::loncommon::plainname($tuname,$tudom));
} else {
$r->print('
'.
@@ -1890,7 +2150,8 @@ sub storedata {
}
&Apache::lonnet::devalidateuserresdata($tuname,$tudom);
} else {
- $newdata{$thiskey}=$data;
+ $newdata{$thiskey}=$data;
+ $newdata{$thiskey.'.type'}=$typeof;
}
}
}
@@ -1911,7 +2172,7 @@ sub storedata {
}
if ($putentries) {
if (&Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs) eq 'ok') {
- $r->print('
'.&mt('Stored [_1] parameter(s)
',$putentries));
+ $r->print('
'.&mt('Stored [_1] parameter(s)',$putentries/2).'
');
} else {
$r->print('
'.
&mt('Error storing parameters').'
');
@@ -1926,7 +2187,7 @@ sub extractuser {
}
sub listdata {
- my ($r,$resourcedata,$listdata)=@_;
+ my ($r,$resourcedata,$listdata,$sortorder)=@_;
# Start list output
my $oldsection='';
@@ -1935,8 +2196,46 @@ sub listdata {
my $pointer=0;
$tableopen=0;
my $foundkeys=0;
- foreach my $thiskey (sort keys %{$listdata}) {
- if ($$resourcedata{$thiskey.'.type'}) {
+ my %keyorder=&standardkeyorder();
+ foreach my $thiskey (sort {
+ if ($sortorder eq 'realmstudent') {
+ 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);
+ }
+ } else {
+ $a cmp $b;
+ }
+ } keys %{$listdata}) {
+
+ if ($$listdata{$thiskey.'.type'}) {
+ my $thistype=$$listdata{$thiskey.'.type'};
+ if ($$resourcedata{$thiskey.'.type'}) {
+ $thistype=$$resourcedata{$thiskey.'.type'};
+ }
my ($middle,$part,$name)=
($thiskey=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/);
my $section=&mt('All Students');
@@ -1958,42 +2257,91 @@ sub listdata {
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle);
$realm=''.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' ('.$url.' in '.$map.' id: '.$id.')';
}
- if ($section ne $oldsection) {
- $r->print(&tableend()."\n
$section
");
- $oldsection=$section;
- $oldrealm='';
- }
- if ($realm ne $oldrealm) {
- $r->print(&tableend()."\n
$realm
");
- $oldrealm=$realm;
- $oldpart='';
+ if ($sortorder eq 'realmstudent') {
+ if ($realm ne $oldrealm) {
+ $r->print(&tableend()."\n
$realm
");
+ $oldrealm=$realm;
+ $oldsection='';
+ }
+ if ($section ne $oldsection) {
+ $r->print(&tableend()."\n
$section
");
+ $oldsection=$section;
+ $oldpart='';
+ }
+ } else {
+ if ($section ne $oldsection) {
+ $r->print(&tableend()."\n
$section
");
+ $oldsection=$section;
+ $oldrealm='';
+ }
+ if ($realm ne $oldrealm) {
+ $r->print(&tableend()."\n
$realm
");
+ $oldrealm=$realm;
+ $oldpart='';
+ }
}
if ($part ne $oldpart) {
$r->print(&tableend().
- "\n