[LON-CAPA-cvs] cvs: loncom /interface lonparmset.pm
www
lon-capa-cvs@mail.lon-capa.org
Fri, 03 Jun 2005 21:19:06 -0000
www Fri Jun 3 17:19:06 2005 EDT
Modified files:
/loncom/interface lonparmset.pm
Log:
Saving my work on Bug #2396 - not able to set useropt parms yet
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.205 loncom/interface/lonparmset.pm:1.206
--- loncom/interface/lonparmset.pm:1.205 Fri Jun 3 15:16:25 2005
+++ loncom/interface/lonparmset.pm Fri Jun 3 17:19:04 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.205 2005/06/03 19:16:25 www Exp $
+# $Id: lonparmset.pm,v 1.206 2005/06/03 21:19:04 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1888,21 +1888,45 @@
}
&Apache::lonnet::devalidatecourseresdata($crs,$dom);
}
-# Read and display
- my %resourcedata=&Apache::lonnet::dump('resourcedata',$dom,$crs);
+# Read coursedata
+ my $resourcedata=&Apache::lonnet::get_courseresdata($crs,$dom);
+# Read userdata
+
+ my $classlist=&Apache::loncoursedata::get_classlist();
+ foreach (keys %$classlist) {
+ # the following undefs are for 'domain', and 'username' respectively.
+ if ($_=~/^(\w+)\:(\w+)$/) {
+ my ($tuname,$tudom)=($1,$2);
+ my $useropt=&Apache::lonnet::get_userresdata($tuname,$tudom);
+ foreach my $userkey (keys %{$useropt}) {
+ if ($userkey=~/^$env{'request.course.id'}/) {
+ my $newkey=$userkey;
+ $newkey=~s/^($env{'request.course.id'}\.)/$1\[useropt\:$tuname\:$tudom\]\./;
+ $$resourcedata{$newkey}=$$useropt{$userkey};
+ }
+ }
+ }
+ }
+
my $oldsection='';
my $oldrealm='';
my $oldpart='';
my $pointer=0;
$tableopen=0;
my $foundkeys=0;
- foreach my $thiskey (sort keys %resourcedata) {
- if ($resourcedata{$thiskey.'.type'}) {
+ foreach my $thiskey (sort keys %{$resourcedata}) {
+ if ($$resourcedata{$thiskey.'.type'}) {
+ $r->print($thiskey);
my ($course,$middle,$part,$name)=
($thiskey=~/^(\w+)\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/);
my $section=&mt('All Students');
if ($middle=~/^\[(.*)\]\./) {
- $section=&mt('Group/Section').': '.$1;
+ my $issection=$1;
+ if ($issection=~/^useropt\:(\w+)\:(\w+)/) {
+ $section=&mt('User').": ".&Apache::loncommon::plainname($1,$2);
+ } else {
+ $section=&mt('Group/Section').': '.$issection;
+ }
$middle=~s/^\[(.*)\]\.//;
}
$middle=~s/\.$//;
@@ -1935,19 +1959,19 @@
':</b></td><td><input type="checkbox" name="del_'.
$thiskey.'" /></td><td>');
$foundkeys++;
- if ($resourcedata{$thiskey.'.type'}=~/^date/) {
+ if ($$resourcedata{$thiskey.'.type'}=~/^date/) {
my $jskey='key_'.$pointer;
$pointer++;
$r->print(
&Apache::lonhtmlcommon::date_setter('overviewform',
$jskey,
- $resourcedata{$thiskey}).
+ $$resourcedata{$thiskey}).
'<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'
);
} else {
$r->print(
'<input type="text" name="set_'.$thiskey.'" value="'.
- $resourcedata{$thiskey}.'">');
+ $$resourcedata{$thiskey}.'">');
}
$r->print('</td></tr>');
}
@@ -2154,7 +2178,8 @@
['action','state',
'pres_marker',
'pres_value',
- 'pres_type']);
+ 'pres_type',
+ 'udom','uname']);
&Apache::lonhtmlcommon::clear_breadcrumbs();