version 1.200, 2005/06/02 16:35:32
|
version 1.202, 2005/06/02 22:03:18
|
Line 68 use Apache::lonnavmaps;
|
Line 68 use Apache::lonnavmaps;
|
|
|
my $parmhashid; |
my $parmhashid; |
my %parmhash; |
my %parmhash; |
|
my $symbsid; |
|
my %symbs; |
|
|
# --- end local caches |
# --- end local caches |
|
|
# |
|
# FIXME: get rid of items below |
|
# |
|
my @ids; |
|
my %symbp; |
|
my %mapp; |
|
my %typep; |
|
my %keyp; |
|
my %uris; |
|
my %maptitles; |
|
|
|
################################################## |
################################################## |
################################################## |
################################################## |
|
|
Line 112 Returns: A list, the first item is the
|
Line 103 Returns: A list, the first item is the
|
=cut |
=cut |
|
|
################################################## |
################################################## |
################################################## |
|
sub parmval { |
sub parmval { |
my ($what,$id,$def,$uname,$udom,$csec)=@_; |
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 |
# load caches |
|
|
&cacheparmhash(); |
&cacheparmhash(); |
Line 128 sub parmval {
|
Line 123 sub parmval {
|
my $result=''; |
my $result=''; |
my @outpar=(); |
my @outpar=(); |
# ----------------------------------------------------- Cascading lookup scheme |
# ----------------------------------------------------- Cascading lookup scheme |
|
my $map=(&Apache::lonnet::decode_symb($symb))[0]; |
|
|
my $symbparm=$symbp{$id}.'.'.$what; |
my $symbparm=$symb.'.'.$what; |
my $mapparm=$mapp{$id}.'___(all).'.$what; |
my $mapparm=$map.'___(all).'.$what; |
|
|
my $seclevel=$env{'request.course.id'}.'.['.$csec.'].'.$what; |
my $seclevel=$env{'request.course.id'}.'.['.$csec.'].'.$what; |
my $seclevelr=$env{'request.course.id'}.'.['.$csec.'].'.$symbparm; |
my $seclevelr=$env{'request.course.id'}.'.['.$csec.'].'.$symbparm; |
Line 180 sub parmval {
|
Line 176 sub parmval {
|
} |
} |
|
|
if (defined($$courseopt{$seclevelr})) { |
if (defined($$courseopt{$seclevelr})) { |
$outpar[4]=$$courseopt |
$outpar[4]=$$courseopt{$seclevelr}; |
{$seclevelr}; |
|
$result=4; |
$result=4; |
} |
} |
} |
} |
Line 222 sub cacheparmhash {
|
Line 217 sub cacheparmhash {
|
} |
} |
} |
} |
|
|
|
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}; |
|
} |
|
|
################################################## |
################################################## |
################################################## |
################################################## |
# |
# |
Line 238 sub cacheparmhash {
|
Line 252 sub cacheparmhash {
|
|
|
sub storeparm { |
sub storeparm { |
my ($sresid,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec)=@_; |
my ($sresid,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec)=@_; |
my $navmap = Apache::lonnavmaps::navmap->new(); |
&storeparm_by_symb(&symbcache($sresid),$spnam,$snum,$nval,$ntype,$uname,$udom,$csec); |
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); |
|
} |
|
} |
} |
|
|
# |
# |
Line 435 sub plink {
|
Line 442 sub plink {
|
&valout($value,$type).'</a><a name="'.$marker.'"></a>'; |
&valout($value,$type).'</a><a name="'.$marker.'"></a>'; |
} |
} |
|
|
|
|
sub startpage { |
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','', |
my $bodytag=&Apache::loncommon::bodytag('Set/Modify Course Parameters','', |
'onUnload="pclose()"'); |
'onUnload="pclose()"'); |
Line 447 sub startpage {
|
Line 453 sub startpage {
|
my $selscript=&Apache::loncommon::studentbrowser_javascript(); |
my $selscript=&Apache::loncommon::studentbrowser_javascript(); |
my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition(); |
my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition(); |
my %lt=&Apache::lonlocal::texthash( |
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", |
'captm' => "Course Assessments Parameters - Table Mode", |
'sg' => "Section/Group", |
'sg' => "Section/Group", |
'fu' => "For User", |
'fu' => "For User", |
Line 514 $bodytag
|
Line 514 $bodytag
|
$breadcrumbs |
$breadcrumbs |
$overallhelp |
$overallhelp |
ENDHEAD |
ENDHEAD |
|
|
unless ($trimheader) {$r->print(<<ENDHEAD2); |
|
<form method="post" action="/adm/parmset" name="envform"> |
|
<h4>$lt{'cep'}</h4> |
|
<input type="submit" name="crsenv" value="$lt{'scep'}" /> |
|
</form> |
|
<hr /> |
|
$assessparmhelp |
|
<form method="post" action="/adm/helper/parameter.helper" name="helpform"> |
|
<h4>$lt{'caphm'}</h4> |
|
<input type="submit" value="$lt{'smcap'}" /> |
|
</form> |
|
<hr /> |
|
<form method="post" action="/adm/parmset" name="overview"> |
|
<h4>$lt{'capom'}</h4> |
|
<input type="submit" name="overview" value="$lt{'mcap'}" /> |
|
</form> |
|
<hr /> |
|
ENDHEAD2 |
|
} |
|
my %sectionhash=(); |
my %sectionhash=(); |
my $sections=''; |
my $sections=''; |
if (&Apache::loncommon::get_sections( |
if (&Apache::loncommon::get_sections( |
Line 552 ENDHEAD2
|
Line 532 ENDHEAD2
|
<h4>$lt{'captm'}</h4> |
<h4>$lt{'captm'}</h4> |
ENDHEAD3 |
ENDHEAD3 |
|
|
if (!$have_assesments) { |
if (!$have_assessments) { |
$r->print('<font color="red">'.&mt('There are no assesment parameters in this course to set.').'</font><br />'); |
$r->print('<font color="red">'.&mt('There are no assessment parameters in this course to set.').'</font><br />'); |
} else { |
} else { |
$r->print(<<ENDHEAD); |
$r->print(<<ENDHEAD); |
<b> |
<b> |
Line 574 ENDHEAD
|
Line 554 ENDHEAD
|
} |
} |
|
|
sub print_row { |
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)=@_; |
$defbgtwo,$parmlev,$uname,$udom,$csec)=@_; |
# get the values for the parameter in cascading order |
# get the values for the parameter in cascading order |
# empty levels will remain empty |
# empty levels will remain empty |
Line 666 sub print_row {
|
Line 646 sub print_row {
|
|
|
if ($parmlev eq 'full' || $parmlev eq 'brief') { |
if ($parmlev eq 'full' || $parmlev eq 'brief') { |
my $sessionval=&Apache::lonnet::EXT('resource.'.$$part{$which}. |
my $sessionval=&Apache::lonnet::EXT('resource.'.$$part{$which}. |
'.'.$$name{$which},$symbp{$rid}); |
'.'.$$name{$which},$$symbp{$rid}); |
|
|
# this doesn't seem to work, and I don't think is correct |
# this doesn't seem to work, and I don't think is correct |
# my $sessionvaltype=&Apache::lonnet::EXT('resource.'.$$part{$which}. |
# my $sessionvaltype=&Apache::lonnet::EXT('resource.'.$$part{$which}. |
Line 696 sub print_td {
|
Line 676 sub print_td {
|
$r->print('</td>'."\n"); |
$r->print('</td>'."\n"); |
} |
} |
|
|
|
|
=pod |
=pod |
|
|
=item B<extractResourceInformation>: Given the course data hash, extractResourceInformation extracts lots of information about the course's resources into a variety of hashes. |
=item B<extractResourceInformation>: Given the course data hash, extractResourceInformation extracts lots of information about the course's resources into a variety of hashes. |
Line 835 Variables used (guessed by Jeremy):
|
Line 816 Variables used (guessed by Jeremy):
|
sub assessparms { |
sub assessparms { |
|
|
my $r=shift; |
my $r=shift; |
|
|
|
my @ids=(); |
|
my %symbp=(); |
|
my %mapp=(); |
|
my %typep=(); |
|
my %keyp=(); |
|
my %uris=(); |
|
my %maptitles=(); |
|
|
# -------------------------------------------------------- Variable declaration |
# -------------------------------------------------------- Variable declaration |
my %allkeys=(); |
my %allkeys=(); |
my %allmaps=(); |
my %allmaps=(); |
Line 879 sub assessparms {
|
Line 869 sub assessparms {
|
|
|
my $pssymb=''; |
my $pssymb=''; |
my $parmlev=''; |
my $parmlev=''; |
my $trimheader=''; |
|
my $prevvisit=$env{'form.prevvisit'}; |
my $prevvisit=$env{'form.prevvisit'}; |
|
|
unless ($env{'form.parmlev'}) { |
unless ($env{'form.parmlev'}) { |
Line 898 sub assessparms {
|
Line 887 sub assessparms {
|
if (!@pscat) { @pscat=('all'); } |
if (!@pscat) { @pscat=('all'); } |
$pschp=''; |
$pschp=''; |
$parmlev = 'full'; |
$parmlev = 'full'; |
$trimheader='yes'; |
|
} elsif ($env{'form.symb'}) { |
} elsif ($env{'form.symb'}) { |
$pssymb=$env{'form.symb'}; |
$pssymb=$env{'form.symb'}; |
if (!@pscat) { @pscat=('all'); } |
if (!@pscat) { @pscat=('all'); } |
$pschp=''; |
$pschp=''; |
$parmlev = 'full'; |
$parmlev = 'full'; |
$trimheader='yes'; |
|
} else { |
} else { |
$env{'form.url'}=''; |
$env{'form.url'}=''; |
} |
} |
Line 989 sub assessparms {
|
Line 976 sub assessparms {
|
if ($psprt[0] eq "all" || !@psprt) {@psprt = (keys %allparts);} |
if ($psprt[0] eq "all" || !@psprt) {@psprt = (keys %allparts);} |
# ------------------------------------------------------------------ Start page |
# ------------------------------------------------------------------ Start page |
|
|
my $have_assesments=1; |
&startpage($r,$id,$udom,$csec,$uname,scalar(keys(%allkeys))); |
if (scalar(keys(%allkeys)) eq 0) { $have_assesments=0; } |
|
|
|
$trimheader = 'yes'; |
|
&startpage($r,$id,$udom,$csec,$uname,$have_assesments,$trimheader); |
|
|
|
# if ($env{'form.url'}) { |
# if ($env{'form.url'}) { |
# $r->print('<input type="hidden" value="'.$env{'form.url'}. |
# $r->print('<input type="hidden" value="'.$env{'form.url'}. |
Line 1310 ENDTABLEHEADFOUR
|
Line 1293 ENDTABLEHEADFOUR
|
undef $firstrow; |
undef $firstrow; |
} |
} |
|
|
&print_row($r,$_,\%part,\%name,$rid,\%default, |
&print_row($r,$_,\%part,\%name,\%symbp,$rid,\%default, |
\%type,\%display,$defbgone,$defbgtwo, |
\%type,\%display,$defbgone,$defbgtwo, |
$parmlev,$uname,$udom,$csec); |
$parmlev,$uname,$udom,$csec); |
} |
} |
Line 1418 ENDMAPONE
|
Line 1401 ENDMAPONE
|
|
|
foreach (sort keys %name) { |
foreach (sort keys %name) { |
$r->print('<tr>'); |
$r->print('<tr>'); |
&print_row($r,$_,\%part,\%name,$mapid,\%default, |
&print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, |
\%type,\%display,$defbgone,$defbgtwo, |
\%type,\%display,$defbgone,$defbgtwo, |
$parmlev,$uname,$udom,$csec); |
$parmlev,$uname,$udom,$csec); |
# $r->print("<tr><td>resource.$part{$_}.$name{$_},$symbp{$mapid}</td></tr>\n"); |
# $r->print("<tr><td>resource.$part{$_}.$name{$_},$symbp{$mapid}</td></tr>\n"); |
Line 1496 ENDMAPONE
|
Line 1479 ENDMAPONE
|
|
|
foreach (sort keys %name) { |
foreach (sort keys %name) { |
$r->print('<tr>'); |
$r->print('<tr>'); |
&print_row($r,$_,\%part,\%name,$mapid,\%default, |
&print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, |
\%type,\%display,$defbgone,$defbgtwo,$parmlev,$uname,$udom,$csec); |
\%type,\%display,$defbgone,$defbgtwo,$parmlev,$uname,$udom,$csec); |
# $r->print("<tr><td>resource.$part{$_}.$name{$_},$symbp{$mapid}</td></tr>\n"); |
# $r->print("<tr><td>resource.$part{$_}.$name{$_},$symbp{$mapid}</td></tr>\n"); |
} |
} |
Line 2184 sub handler {
|
Line 2167 sub handler {
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['action','state']); |
['action','state']); |
|
|
# ----------------------------------------------------------- Clear out garbage |
|
|
|
|
|
@ids=(); |
|
%symbp=(); |
|
%mapp=(); |
|
%typep=(); |
|
%keyp=(); |
|
|
|
%maptitles=(); |
|
|
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/parmset", |
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/parmset", |