--- loncom/interface/lonparmset.pm 2005/06/02 16:35:32 1.200
+++ loncom/interface/lonparmset.pm 2005/06/04 17:35:19 1.208
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.200 2005/06/02 16:35:32 www Exp $
+# $Id: lonparmset.pm,v 1.208 2005/06/04 17:35:19 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -68,20 +68,11 @@ use Apache::lonnavmaps;
my $parmhashid;
my %parmhash;
+my $symbsid;
+my %symbs;
# --- end local caches
-#
-# FIXME: get rid of items below
-#
-my @ids;
-my %symbp;
-my %mapp;
-my %typep;
-my %keyp;
-my %uris;
-my %maptitles;
-
##################################################
##################################################
@@ -112,9 +103,13 @@ Returns: A list, the first item is the
=cut
##################################################
-##################################################
sub parmval {
my ($what,$id,$def,$uname,$udom,$csec)=@_;
+ return &parmval_by_symb($what,&symbcache($id),$def,$uname,$udom,$csec);
+}
+
+sub parmval_by_symb {
+ my ($what,$symb,$def,$uname,$udom,$csec)=@_;
# load caches
&cacheparmhash();
@@ -128,9 +123,10 @@ sub parmval {
my $result='';
my @outpar=();
# ----------------------------------------------------- Cascading lookup scheme
+ my $map=(&Apache::lonnet::decode_symb($symb))[0];
- my $symbparm=$symbp{$id}.'.'.$what;
- my $mapparm=$mapp{$id}.'___(all).'.$what;
+ my $symbparm=$symb.'.'.$what;
+ my $mapparm=$map.'___(all).'.$what;
my $seclevel=$env{'request.course.id'}.'.['.$csec.'].'.$what;
my $seclevelr=$env{'request.course.id'}.'.['.$csec.'].'.$symbparm;
@@ -180,8 +176,7 @@ sub parmval {
}
if (defined($$courseopt{$seclevelr})) {
- $outpar[4]=$$courseopt
-{$seclevelr};
+ $outpar[4]=$$courseopt{$seclevelr};
$result=4;
}
}
@@ -222,6 +217,29 @@ sub cacheparmhash {
}
}
+sub resetsymbcache {
+ $symbsid='';
+}
+
+sub symbcache {
+ my $id=shift;
+ if ($symbsid ne $env{'request.course.id'}) {
+ %symbs=();
+ }
+ unless ($symbs{$id}) {
+ my $navmap = Apache::lonnavmaps::navmap->new();
+ if ($id=~/\./) {
+ my $resource=$navmap->getById($id);
+ $symbs{$id}=$resource->symb();
+ } else {
+ my $resource=$navmap->getByMapPc($id);
+ $symbs{$id}=&Apache::lonnet::declutter($resource->src());
+ }
+ $symbsid=$env{'request.course.id'};
+ }
+ return $symbs{$id};
+}
+
##################################################
##################################################
#
@@ -238,14 +256,7 @@ sub cacheparmhash {
sub storeparm {
my ($sresid,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec)=@_;
- my $navmap = Apache::lonnavmaps::navmap->new();
- if ($sresid=~/\./) {
- my $resource=$navmap->getById($sresid);
- &storeparm_by_symb($resource->symb(),$spnam,$snum,$nval,$ntype,$uname,$udom,$csec);
- } else {
- my $resource=$navmap->getByMapPc($sresid);
- &storeparm_by_symb(&Apache::lonnet::declutter($resource->src()),$spnam,$snum,$nval,$ntype,$uname,$udom,$csec);
- }
+ &storeparm_by_symb(&symbcache($sresid),$spnam,$snum,$nval,$ntype,$uname,$udom,$csec);
}
#
@@ -435,33 +446,23 @@ sub plink {
&valout($value,$type).'';
}
-
sub startpage {
- my ($r,$id,$udom,$csec,$uname,$have_assesments,$trimheader)=@_;
+ my ($r,$id,$udom,$csec,$uname,$have_assessments)=@_;
my $bodytag=&Apache::loncommon::bodytag('Set/Modify Course Parameters','',
'onUnload="pclose()"');
- my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Table');
+ my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Table Mode Parameter Setting');
my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '.
&Apache::loncommon::selectstudent_link('parmform','uname','udom');
my $selscript=&Apache::loncommon::studentbrowser_javascript();
my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();
my %lt=&Apache::lonlocal::texthash(
- 'cep' => "Course Environment Parameters",
- 'scep' => "Set Course Environment Parameters",
- 'smcap' => "Set/Modify Course Assessment Parameter",
- 'mcap' => "Modify Course Assessment Parameters",
- 'caphm' => "Course Assessment Parameter - Helper Mode",
- 'capom' => "Course Assessment Parameters - Overview Mode",
'captm' => "Course Assessments Parameters - Table Mode",
'sg' => "Section/Group",
'fu' => "For User",
'oi' => "or ID",
'ad' => "at Domain"
);
- my $overallhelp=
- &Apache::loncommon::help_open_menu('','Setting Parameters','Course_Setting_Parameters','',10,'Instructor Interface');
- my $assessparmhelp=&Apache::loncommon::help_open_topic("Cascading_Parameters","Assessment Parameters");
my $html=&Apache::lonxml::xmlbegin();
$r->print(<
$bodytag
$breadcrumbs
-$overallhelp
ENDHEAD
-
- unless ($trimheader) {$r->print(<
-
$lt{'cep'}
-
-
-
-$assessparmhelp
-
-
-
-
-ENDHEAD2
- }
my %sectionhash=();
my $sections='';
if (&Apache::loncommon::get_sections(
@@ -552,8 +532,8 @@ ENDHEAD2
$lt{'captm'}
ENDHEAD3
- if (!$have_assesments) {
- $r->print(''.&mt('There are no assesment parameters in this course to set.').' ');
+ if (!$have_assessments) {
+ $r->print(''.&mt('There are no assessment parameters in this course to set.').' ');
} else {
$r->print(<
@@ -574,7 +554,7 @@ 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,7 +576,7 @@ 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 +659,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.
@@ -802,6 +766,87 @@ sub extractResourceInformation {
}
}
+
+##################################################
+##################################################
+
+sub parmmenu {
+ my ($r,$allparms,$pscat)=@_;
+ my $tempkey;
+ $r->print(<
+ function checkall(value, checkName) {
+ for (i=0; i
+ENDSCRIPT
+ $r->print(&mt('Select Parameters to View'));
+ $r->print("\n
');
@@ -1310,7 +1254,7 @@ ENDTABLEHEADFOUR
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 +1263,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"';
@@ -1418,7 +1362,7 @@ ENDMAPONE
foreach (sort keys %name) {
$r->print('