-ENDHEAD3
-
- if (!$have_assesments) {
- $r->print(''.&mt('There are no assesment parameters in this course to set.').' ');
- } else {
- $r->print(<
-$sections
-
-$lt{'fu'}
-
-$lt{'oi'}
-
-$lt{'ad'}
-$chooseopt
-
+
ENDHEAD
- }
}
+
sub print_row {
- my ($r,$which,$part,$name,$rid,$default,$defaulttype,$display,$defbgone,
+ my ($r,$which,$part,$name,$symbp,$rid,$default,$defaulttype,$display,$defbgone,
$defbgtwo,$parmlev,$uname,$udom,$csec)=@_;
# get the values for the parameter in cascading order
# empty levels will remain empty
@@ -596,13 +628,16 @@ sub print_row {
}
my $parm=$$display{$which};
- if ($parmlev eq 'full' || $parmlev eq 'brief') {
+ if ($parmlev eq 'full') {
$r->print('
');
- if ($parmlev eq 'full' || $parmlev eq 'brief') {
+ if ($parmlev eq 'full') {
my $sessionval=&Apache::lonnet::EXT('resource.'.$$part{$which}.
- '.'.$$name{$which},$symbp{$rid});
-
-# this doesn't seem to work, and I don't think is correct
-# my $sessionvaltype=&Apache::lonnet::EXT('resource.'.$$part{$which}.
-# '.'.$$name{$which}.'.type',$symbp{$rid});
-# this seems to work
+ '.'.$$name{$which},$$symbp{$rid});
my $sessionvaltype=$typeoutpar[$result];
if (!defined($sessionvaltype)) { $sessionvaltype=$$defaulttype{$which}; }
$r->print('
'.
@@ -696,6 +714,7 @@ sub print_td {
$r->print('
'."\n");
}
+
=pod
=item B: Given the course data hash, extractResourceInformation extracts lots of information about the course's resources into a variety of hashes.
@@ -736,15 +755,15 @@ sub extractResourceInformation {
my $keyp = shift;
my $allparms = shift;
my $allparts = shift;
- my $allkeys = shift;
my $allmaps = shift;
- my $fcat = shift;
- my $defp = shift;
my $mapp = shift;
my $symbp = shift;
my $maptitles=shift;
my $uris=shift;
+ my $keyorder=shift;
+ my $defkeytype=shift;
+ my $keyordercnt=100;
my $navmap = Apache::lonnavmaps::navmap->new();
my @allres=$navmap->retrieveResources(undef,undef,1,undef,1);
@@ -761,30 +780,40 @@ sub extractResourceInformation {
foreach (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys'))) {
if ($_=~/^parameter\_(.*)/) {
my $key=$_;
- my $allkey=$1;
- $allkey=~s/\_/\./g;
- if (&Apache::lonnet::metadata($srcf,$key.'.hidden') eq
- 'parm') {
- next; #hide hidden things
+# Hidden parameters
+ if (&Apache::lonnet::metadata($srcf,$key.'.hidden') eq 'parm') {
+ next;
}
my $display= &Apache::lonnet::metadata($srcf,$key.'.display');
my $name=&Apache::lonnet::metadata($srcf,$key.'.name');
my $part= &Apache::lonnet::metadata($srcf,$key.'.part');
+#
+# allparms is a hash of parameter names
+#
my $parmdis = $display;
- $parmdis =~ s|(\[Part.*)$||g;
- my $partkey = $part;
- $partkey =~ tr|_|.|;
- $$allparms{$name} = $parmdis;
- $$allparts{$part} = "[Part $part]";
- $$allkeys{$allkey}=$display;
- if ($allkey eq $fcat) {
- $$defp{$id}= &Apache::lonnet::metadata($srcf,$key);
- }
+ $parmdis =~ s/\[Part.*$//g;
+ $$allparms{$name}=$parmdis;
+ $$defkeytype{$name}=&Apache::lonnet::metadata($srcf,$key.'.type');
+#
+# allparts is a hash of all parts
+#
+ $$allparts{$part} = "Part: $part";
+#
+# Remember all keys going with this resource
+#
if ($$keyp{$id}) {
$$keyp{$id}.=','.$key;
} else {
$$keyp{$id}=$key;
}
+#
+# Put in order
+#
+ unless ($$keyorder{$key}) {
+ $$keyorder{$key}=$keyordercnt;
+ $keyordercnt++;
+ }
+
}
}
$$mapp{$id}=
@@ -802,6 +831,304 @@ sub extractResourceInformation {
}
}
+
+##################################################
+##################################################
+
+sub isdateparm {
+ my $type=shift;
+ return (($type=~/^date/) && (!($type eq 'date_interval')));
+}
+
+sub parmmenu {
+ my ($r,$allparms,$pscat,$keyorder)=@_;
+ my $tempkey;
+ $r->print(<
+ function checkall(value, checkName) {
+ for (i=0; i
+ENDSCRIPT
+ $r->print();
+ $r->print("\n
');
} else {
undef $firstrow;
}
- &print_row($r,$_,\%part,\%name,$rid,\%default,
+ &print_row($r,$_,\%part,\%name,\%symbp,$rid,\%default,
\%type,\%display,$defbgone,$defbgtwo,
$parmlev,$uname,$udom,$csec);
}
@@ -1319,7 +1501,7 @@ ENDTABLEHEADFOUR
} # end foreach ids
# -------------------------------------------------- End entry for one resource
$r->print('
');
- } # end of brief/full
+ } # end of full
#--------------------------------------------------- Entry for parm level map
if ($parmlev eq 'map') {
my $defbgone = '"E0E099"';
@@ -1366,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_/;
@@ -1395,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 {
@@ -1416,12 +1595,11 @@ ENDMAPONE
$r->print('
\n");
}
$r->print("");
} # end of $parmlev eq general
@@ -1595,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);
@@ -1614,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
@@ -1707,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').')',
@@ -1720,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').''
);
@@ -1757,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);
@@ -1838,7 +2035,8 @@ $output
ENDenv
}
##################################################
-
+# Overview mode
+##################################################
my $tableopen;
sub tablestart {
@@ -1860,26 +2058,38 @@ sub tableend {
}
}
-sub overview {
- my $r=shift;
- my $bodytag=&Apache::loncommon::bodytag(
- 'Set/Modify Course Assessment Parameters');
- my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
- my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
- my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Overview');
- my $html=&Apache::lonxml::xmlbegin();
- $r->print(<
-LON-CAPA Course Environment
-
-$bodytag
-$breadcrumbs
-