version 1.189, 2005/03/18 15:17:36
|
version 1.195, 2005/05/30 17:58:51
|
Line 115 sub parmval {
|
Line 115 sub parmval {
|
my $symbparm=$symbp{$id}.'.'.$what; |
my $symbparm=$symbp{$id}.'.'.$what; |
my $mapparm=$mapp{$id}.'___(all).'.$what; |
my $mapparm=$mapp{$id}.'___(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; |
my $seclevelm=$ENV{'request.course.id'}.'.['.$csec.'].'.$mapparm; |
my $seclevelm=$env{'request.course.id'}.'.['.$csec.'].'.$mapparm; |
|
|
my $courselevel=$ENV{'request.course.id'}.'.'.$what; |
my $courselevel=$env{'request.course.id'}.'.'.$what; |
my $courselevelr=$ENV{'request.course.id'}.'.'.$symbparm; |
my $courselevelr=$env{'request.course.id'}.'.'.$symbparm; |
my $courselevelm=$ENV{'request.course.id'}.'.'.$mapparm; |
my $courselevelm=$env{'request.course.id'}.'.'.$mapparm; |
|
|
|
|
|
|
Line 212 sub storeparm {
|
Line 212 sub storeparm {
|
my $symbparm=$symbp{$sresid}.'.'.$spnam; |
my $symbparm=$symbp{$sresid}.'.'.$spnam; |
my $mapparm=$mapp{$sresid}.'___(all).'.$spnam; |
my $mapparm=$mapp{$sresid}.'___(all).'.$spnam; |
|
|
my $seclevel=$ENV{'request.course.id'}.'.['.$csec.'].'.$spnam; |
my $seclevel=$env{'request.course.id'}.'.['.$csec.'].'.$spnam; |
my $seclevelr=$ENV{'request.course.id'}.'.['.$csec.'].'.$symbparm; |
my $seclevelr=$env{'request.course.id'}.'.['.$csec.'].'.$symbparm; |
my $seclevelm=$ENV{'request.course.id'}.'.['.$csec.'].'.$mapparm; |
my $seclevelm=$env{'request.course.id'}.'.['.$csec.'].'.$mapparm; |
|
|
my $courselevel=$ENV{'request.course.id'}.'.'.$spnam; |
my $courselevel=$env{'request.course.id'}.'.'.$spnam; |
my $courselevelr=$ENV{'request.course.id'}.'.'.$symbparm; |
my $courselevelr=$env{'request.course.id'}.'.'.$symbparm; |
my $courselevelm=$ENV{'request.course.id'}.'.'.$mapparm; |
my $courselevelm=$env{'request.course.id'}.'.'.$mapparm; |
|
|
my $storeunder=''; |
my $storeunder=''; |
if (($snum==11) || ($snum==3)) { $storeunder=$courselevel; } |
if (($snum==11) || ($snum==3)) { $storeunder=$courselevel; } |
Line 249 sub storeparm {
|
Line 249 sub storeparm {
|
if ($delete) { |
if ($delete) { |
$reply=&Apache::lonnet::del |
$reply=&Apache::lonnet::del |
('resourcedata',[keys(%storecontent)], |
('resourcedata',[keys(%storecontent)], |
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
} else { |
} else { |
$reply=&Apache::lonnet::cput |
$reply=&Apache::lonnet::cput |
('resourcedata',\%storecontent, |
('resourcedata',\%storecontent, |
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
} |
} |
} else { |
} else { |
# ------------------------------------------------------------------ Store User |
# ------------------------------------------------------------------ Store User |
Line 279 sub storeparm {
|
Line 279 sub storeparm {
|
$reply=&Apache::lonnet::cput |
$reply=&Apache::lonnet::cput |
('resourcedata',\%storecontent,$udom,$uname); |
('resourcedata',\%storecontent,$udom,$uname); |
} |
} |
|
&Apache::lonnet::devalidateuserresdata($uname,$udom); |
} |
} |
|
|
if ($reply=~/^error\:(.*)/) { |
if ($reply=~/^error\:(.*)/) { |
Line 367 sub plink {
|
Line 368 sub plink {
|
my $winvalue=$value; |
my $winvalue=$value; |
unless ($winvalue) { |
unless ($winvalue) { |
if ($type=~/^date/) { |
if ($type=~/^date/) { |
$winvalue=$ENV{'form.recent_'.$type}; |
$winvalue=$env{'form.recent_'.$type}; |
} else { |
} else { |
$winvalue=$ENV{'form.recent_'.(split(/\_/,$type))[0]}; |
$winvalue=$env{'form.recent_'.(split(/\_/,$type))[0]}; |
} |
} |
} |
} |
return |
return |
Line 384 sub startpage {
|
Line 385 sub startpage {
|
|
|
my $bodytag=&Apache::loncommon::bodytag('Set/Modify Course Parameters','', |
my $bodytag=&Apache::loncommon::bodytag('Set/Modify Course Parameters','', |
'onUnload="pclose()"'); |
'onUnload="pclose()"'); |
|
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Table'); |
my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '. |
my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '. |
&Apache::loncommon::selectstudent_link('parmform','uname','udom'); |
&Apache::loncommon::selectstudent_link('parmform','uname','udom'); |
my $selscript=&Apache::loncommon::studentbrowser_javascript(); |
my $selscript=&Apache::loncommon::studentbrowser_javascript(); |
Line 453 $html
|
Line 455 $html
|
$selscript |
$selscript |
</head> |
</head> |
$bodytag |
$bodytag |
|
$breadcrumbs |
$overallhelp |
$overallhelp |
ENDHEAD |
ENDHEAD |
|
|
Line 478 ENDHEAD2
|
Line 481 ENDHEAD2
|
my %sectionhash=(); |
my %sectionhash=(); |
my $sections=''; |
my $sections=''; |
if (&Apache::loncommon::get_sections( |
if (&Apache::loncommon::get_sections( |
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}, |
$env{'course.'.$env{'request.course.id'}.'.num'}, |
\%sectionhash)) { |
\%sectionhash)) { |
$sections=$lt{'sg'}.': <select name="csec">'; |
$sections=$lt{'sg'}.': <select name="csec">'; |
foreach ('',sort keys %sectionhash) { |
foreach ('',sort keys %sectionhash) { |
Line 489 ENDHEAD2
|
Line 492 ENDHEAD2
|
$sections.='</select>'; |
$sections.='</select>'; |
} |
} |
$r->print(<<ENDHEAD3); |
$r->print(<<ENDHEAD3); |
<form method="post" action="/adm/parmset" name="parmform"> |
<form method="post" action="/adm/parmset?action=settable" name="parmform"> |
<h4>$lt{'captm'}</h4> |
<h4>$lt{'captm'}</h4> |
ENDHEAD3 |
ENDHEAD3 |
|
|
Line 712 sub extractResourceInformation {
|
Line 715 sub extractResourceInformation {
|
my $name=&Apache::lonnet::metadata($srcf,$key.'.name'); |
my $name=&Apache::lonnet::metadata($srcf,$key.'.name'); |
my $part= &Apache::lonnet::metadata($srcf,$key.'.part'); |
my $part= &Apache::lonnet::metadata($srcf,$key.'.part'); |
my $parmdis = $display; |
my $parmdis = $display; |
$parmdis =~ s|(\[Part.*$)||g; |
$parmdis =~ s|(\[Part.*)$||g; |
my $partkey = $part; |
my $partkey = $part; |
$partkey =~ tr|_|.|; |
$partkey =~ tr|_|.|; |
$$allparms{$name} = $parmdis; |
$$allparms{$name} = $parmdis; |
Line 788 sub assessparms {
|
Line 791 sub assessparms {
|
my $uhome; |
my $uhome; |
my $csec; |
my $csec; |
|
|
my $coursename=$ENV{'course.'.$ENV{'request.course.id'}.'.description'}; |
my $coursename=$env{'course.'.$env{'request.course.id'}.'.description'}; |
|
|
$alllevs{'Resource Level'}='full'; |
$alllevs{'Resource Level'}='full'; |
$alllevs{'Map Level'}='map'; |
$alllevs{'Map Level'}='map'; |
Line 808 sub assessparms {
|
Line 811 sub assessparms {
|
|
|
my $message=''; |
my $message=''; |
|
|
$csec=$ENV{'form.csec'}; |
$csec=$env{'form.csec'}; |
|
|
if ($udom=$ENV{'form.udom'}) { |
if ($udom=$env{'form.udom'}) { |
} elsif ($udom=$ENV{'request.role.domain'}) { |
} elsif ($udom=$env{'request.role.domain'}) { |
} elsif ($udom=$ENV{'user.domain'}) { |
} elsif ($udom=$env{'user.domain'}) { |
} else { |
} else { |
$udom=$r->dir_config('lonDefDomain'); |
$udom=$r->dir_config('lonDefDomain'); |
} |
} |
|
|
my @pscat=&Apache::loncommon::get_env_multiple('form.pscat'); |
my @pscat=&Apache::loncommon::get_env_multiple('form.pscat'); |
my $pschp=$ENV{'form.pschp'}; |
my $pschp=$env{'form.pschp'}; |
my @psprt=&Apache::loncommon::get_env_multiple('form.psprt'); |
my @psprt=&Apache::loncommon::get_env_multiple('form.psprt'); |
if (!@psprt) { $psprt[0]='0'; } |
if (!@psprt) { $psprt[0]='0'; } |
my $showoptions=$ENV{'form.showoptions'}; |
my $showoptions=$env{'form.showoptions'}; |
|
|
my $pssymb=''; |
my $pssymb=''; |
my $parmlev=''; |
my $parmlev=''; |
my $trimheader=''; |
my $trimheader=''; |
my $prevvisit=$ENV{'form.prevvisit'}; |
my $prevvisit=$env{'form.prevvisit'}; |
|
|
unless ($ENV{'form.parmlev'}) { |
unless ($env{'form.parmlev'}) { |
$parmlev = 'map'; |
$parmlev = 'map'; |
} else { |
} else { |
$parmlev = $ENV{'form.parmlev'}; |
$parmlev = $env{'form.parmlev'}; |
} |
} |
|
|
# ----------------------------------------------- Was this started from grades? |
# ----------------------------------------------- Was this started from grades? |
|
|
if (($ENV{'form.command'} eq 'set') && ($ENV{'form.url'}) |
if (($env{'form.command'} eq 'set') && ($env{'form.url'}) |
&& (!$ENV{'form.dis'})) { |
&& (!$env{'form.dis'})) { |
my $url=$ENV{'form.url'}; |
my $url=$env{'form.url'}; |
$url=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--; |
$url=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--; |
$pssymb=&Apache::lonnet::symbread($url); |
$pssymb=&Apache::lonnet::symbread($url); |
if (!@pscat) { @pscat=('all'); } |
if (!@pscat) { @pscat=('all'); } |
$pschp=''; |
$pschp=''; |
$parmlev = 'full'; |
$parmlev = 'full'; |
$trimheader='yes'; |
$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'; |
$trimheader='yes'; |
} else { |
} else { |
$ENV{'form.url'}=''; |
$env{'form.url'}=''; |
} |
} |
|
|
my $id=$ENV{'form.id'}; |
my $id=$env{'form.id'}; |
if (($id) && ($udom)) { |
if (($id) && ($udom)) { |
$uname=(&Apache::lonnet::idget($udom,$id))[1]; |
$uname=(&Apache::lonnet::idget($udom,$id))[1]; |
if ($uname) { |
if ($uname) { |
Line 866 sub assessparms {
|
Line 869 sub assessparms {
|
&mt('at domain')." '$udom'</font>"; |
&mt('at domain')." '$udom'</font>"; |
} |
} |
} else { |
} else { |
$uname=$ENV{'form.uname'}; |
$uname=$env{'form.uname'}; |
} |
} |
unless ($udom) { $uname=''; } |
unless ($udom) { $uname=''; } |
$uhome=''; |
$uhome=''; |
Line 879 sub assessparms {
|
Line 882 sub assessparms {
|
$uname=''; |
$uname=''; |
} else { |
} else { |
$csec=&Apache::lonnet::getsection($udom,$uname, |
$csec=&Apache::lonnet::getsection($udom,$uname, |
$ENV{'request.course.id'}); |
$env{'request.course.id'}); |
if ($csec eq '-1') { |
if ($csec eq '-1') { |
$message="<font color=red>". |
$message="<font color=red>". |
&mt("User")." '$uname' ".&mt("at domain")." '$udom' ". |
&mt("User")." '$uname' ".&mt("at domain")." '$udom' ". |
&mt("not in this course")."</font>"; |
&mt("not in this course")."</font>"; |
$uname=''; |
$uname=''; |
$csec=$ENV{'form.csec'}; |
$csec=$env{'form.csec'}; |
} else { |
} else { |
my %name=&Apache::lonnet::userenvironment($udom,$uname, |
my %name=&Apache::lonnet::userenvironment($udom,$uname, |
('firstname','middlename','lastname','generation','id')); |
('firstname','middlename','lastname','generation','id')); |
Line 899 sub assessparms {
|
Line 902 sub assessparms {
|
|
|
unless ($csec) { $csec=''; } |
unless ($csec) { $csec=''; } |
|
|
my $fcat=$ENV{'form.fcat'}; |
my $fcat=$env{'form.fcat'}; |
unless ($fcat) { $fcat=''; } |
unless ($fcat) { $fcat=''; } |
|
|
# ------------------------------------------------------------------- Tie hashs |
# ------------------------------------------------------------------- Tie hashs |
if (!(tie(%bighash,'GDBM_File',$ENV{'request.course.fn'}.'.db', |
if (!(tie(%bighash,'GDBM_File',$env{'request.course.fn'}.'.db', |
&GDBM_READER(),0640))) { |
&GDBM_READER(),0640))) { |
$r->print("Unable to access course data. (File $ENV{'request.course.fn'}.db not tieable)"); |
$r->print("Unable to access course data. (File $env{'request.course.fn'}.db not tieable)"); |
return ; |
return ; |
} |
} |
if (!(tie(%parmhash,'GDBM_File', |
if (!(tie(%parmhash,'GDBM_File', |
$ENV{'request.course.fn'}.'_parms.db',&GDBM_READER(),0640))) { |
$env{'request.course.fn'}.'_parms.db',&GDBM_READER(),0640))) { |
$r->print("Unable to access parameter data. (File $ENV{'request.course.fn'}_parms.db not tieable)"); |
$r->print("Unable to access parameter data. (File $env{'request.course.fn'}_parms.db not tieable)"); |
return ; |
return ; |
} |
} |
|
|
Line 921 sub assessparms {
|
Line 924 sub assessparms {
|
$symbp{'0.0'} = ''; |
$symbp{'0.0'} = ''; |
|
|
# ---------------------------------------------------------- Anything to store? |
# ---------------------------------------------------------- Anything to store? |
if ($ENV{'form.pres_marker'}) { |
if ($env{'form.pres_marker'}) { |
$message.=&storeparm(split(/\&/,$ENV{'form.pres_marker'}), |
$message.=&storeparm(split(/\&/,$env{'form.pres_marker'}), |
$ENV{'form.pres_value'}, |
$env{'form.pres_value'}, |
$ENV{'form.pres_type'}, |
$env{'form.pres_type'}, |
$uname,$udom,$csec); |
$uname,$udom,$csec); |
# ---------------------------------------------------------------- Done storing |
# ---------------------------------------------------------------- Done storing |
$message.='<h3>'.&mt('Changes can take up to 10 minutes before being active for all students.').&Apache::loncommon::help_open_topic('Caching').'</h3>'; |
$message.='<h3>'.&mt('Changes can take up to 10 minutes before being active for all students.').&Apache::loncommon::help_open_topic('Caching').'</h3>'; |
} |
} |
# --------------------------------------------- Devalidate cache for this child |
# --------------------------------------------- Devalidate cache for this child |
&Apache::lonnet::devalidatecourseresdata( |
&Apache::lonnet::devalidatecourseresdata( |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}, |
$env{'course.'.$env{'request.course.id'}.'.num'}, |
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}); |
$env{'course.'.$env{'request.course.id'}.'.domain'}); |
&Apache::lonnet::clear_EXT_cache_status(); |
#&Apache::lonnet::clear_EXT_cache_status(); |
# -------------------------------------------------------------- Get coursedata |
# -------------------------------------------------------------- Get coursedata |
%courseopt = &Apache::lonnet::dump |
%courseopt = &Apache::lonnet::dump |
('resourcedata', |
('resourcedata', |
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
# --------------------------------------------------- Get userdata (if present) |
# --------------------------------------------------- Get userdata (if present) |
if ($uname) { |
if ($uname) { |
%useropt=&Apache::lonnet::dump('resourcedata',$udom,$uname); |
%useropt=&Apache::lonnet::dump('resourcedata',$udom,$uname); |
Line 965 sub assessparms {
|
Line 968 sub assessparms {
|
my $have_assesments=1; |
my $have_assesments=1; |
if (scalar(keys(%allkeys)) eq 0) { $have_assesments=0; } |
if (scalar(keys(%allkeys)) eq 0) { $have_assesments=0; } |
|
|
|
$trimheader = 'yes'; |
&startpage($r,$id,$udom,$csec,$uname,$have_assesments,$trimheader); |
&startpage($r,$id,$udom,$csec,$uname,$have_assesments,$trimheader); |
|
|
if (!$have_assesments) { |
if (!$have_assesments) { |
Line 972 sub assessparms {
|
Line 976 sub assessparms {
|
untie(%parmhash); |
untie(%parmhash); |
return ''; |
return ''; |
} |
} |
# 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'}. |
# '" name="url"><input type="hidden" name="command" value="set">'); |
# '" name="url"><input type="hidden" name="command" value="set">'); |
# } |
# } |
$r->print('<input type="hidden" value="true" name="prevvisit">'); |
$r->print('<input type="hidden" value="true" name="prevvisit">'); |
Line 981 sub assessparms {
|
Line 985 sub assessparms {
|
foreach ('tolerance','date_default','date_start','date_end', |
foreach ('tolerance','date_default','date_start','date_end', |
'date_interval','int','float','string') { |
'date_interval','int','float','string') { |
$r->print('<input type="hidden" value="'. |
$r->print('<input type="hidden" value="'. |
$ENV{'form.recent_'.$_}.'" name="recent_'.$_.'">'); |
$env{'form.recent_'.$_}.'" name="recent_'.$_.'">'); |
} |
} |
|
|
$r->print('<h2>'.$message.'</h2><table>'); |
$r->print('<h2>'.$message.'</h2><table>'); |
Line 1147 sub assessparms {
|
Line 1151 sub assessparms {
|
if (($prevvisit) || ($pschp) || ($pssymb)) { |
if (($prevvisit) || ($pschp) || ($pssymb)) { |
# ----------------------------------------------------------------- Start Table |
# ----------------------------------------------------------------- Start Table |
my @catmarker=map { tr|.|_|; 'parameter_'.$_; } @pscat; |
my @catmarker=map { tr|.|_|; 'parameter_'.$_; } @pscat; |
my $csuname=$ENV{'user.name'}; |
my $csuname=$env{'user.name'}; |
my $csudom=$ENV{'user.domain'}; |
my $csudom=$env{'user.domain'}; |
|
|
if ($parmlev eq 'full' || $parmlev eq 'brief') { |
if ($parmlev eq 'full' || $parmlev eq 'brief') { |
my $coursespan=$csec?8:5; |
my $coursespan=$csec?8:5; |
Line 1190 ENDTABLETWO
|
Line 1194 ENDTABLETWO
|
$r->print(<<ENDTABLEHEADFOUR); |
$r->print(<<ENDTABLEHEADFOUR); |
</tr><tr><th>$lt{'aut'}</th><th>$lt{'type'}</th> |
</tr><tr><th>$lt{'aut'}</th><th>$lt{'type'}</th> |
<th>$lt{'emof'}</th><th>$lt{'part'}</th><th>$lt{'pn'}</th> |
<th>$lt{'emof'}</th><th>$lt{'part'}</th><th>$lt{'pn'}</th> |
<th>$lt{'gen'}</th><th>$lt{'femof'}</th> |
<th>$lt{'gen'}</th><th>$lt{'foremf'}</th> |
<th>$lt{'def'}</th><th>$lt{'foremf'}</th><th>$lt{'fr'}</th> |
<th>$lt{'def'}</th><th>$lt{'femof'}</th><th>$lt{'fr'}</th> |
ENDTABLEHEADFOUR |
ENDTABLEHEADFOUR |
|
|
if ($csec) { |
if ($csec) { |
Line 1509 sub crsenv {
|
Line 1513 sub crsenv {
|
my $setoutput=''; |
my $setoutput=''; |
my $bodytag=&Apache::loncommon::bodytag( |
my $bodytag=&Apache::loncommon::bodytag( |
'Set Course Environment Parameters'); |
'Set Course Environment Parameters'); |
my $dom = $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}; |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef, |
my $crs = $ENV{'course.'.$ENV{'request.course.id'}.'.num'}; |
'Edit Course Environment'); |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
|
# |
# |
# Go through list of changes |
# Go through list of changes |
foreach (keys %ENV) { |
foreach (keys %env) { |
next if ($_!~/^form\.(.+)\_setparmval$/); |
next if ($_!~/^form\.(.+)\_setparmval$/); |
my $name = $1; |
my $name = $1; |
my $value = $ENV{'form.'.$name.'_value'}; |
my $value = $env{'form.'.$name.'_value'}; |
if ($name eq 'newp') { |
if ($name eq 'newp') { |
$name = $ENV{'form.newp_name'}; |
$name = $env{'form.newp_name'}; |
} |
} |
if ($name eq 'url') { |
if ($name eq 'url') { |
$value=~s/^\/res\///; |
$value=~s/^\/res\///; |
Line 1595 sub crsenv {
|
Line 1601 sub crsenv {
|
} |
} |
# ------------------------- Re-init course environment entries for this session |
# ------------------------- Re-init course environment entries for this session |
|
|
&Apache::lonnet::coursedescription($ENV{'request.course.id'}); |
&Apache::lonnet::coursedescription($env{'request.course.id'}); |
|
|
# -------------------------------------------------------- Get parameters again |
# -------------------------------------------------------- Get parameters again |
|
|
Line 1791 sub crsenv {
|
Line 1797 sub crsenv {
|
my $Set=&mt('Set'); |
my $Set=&mt('Set'); |
my $browse_js=&Apache::loncommon::browser_and_searcher_javascript('parmset'); |
my $browse_js=&Apache::loncommon::browser_and_searcher_javascript('parmset'); |
my $html=&Apache::lonxml::xmlbegin(); |
my $html=&Apache::lonxml::xmlbegin(); |
$r->print(<<ENDENV); |
$r->print(<<ENDenv); |
$html |
$html |
<head> |
<head> |
<script type="text/javascript" language="Javascript" > |
<script type="text/javascript" language="Javascript" > |
Line 1800 $browse_js
|
Line 1806 $browse_js
|
<title>LON-CAPA Course Environment</title> |
<title>LON-CAPA Course Environment</title> |
</head> |
</head> |
$bodytag |
$bodytag |
<form method="post" action="/adm/parmset" name="envform"> |
$breadcrumbs |
|
<form method="post" action="/adm/parmset?action=crsenv" name="envform"> |
$setoutput |
$setoutput |
<p> |
<p> |
<table border=2> |
<table border=2> |
Line 1811 $output
|
Line 1818 $output
|
</form> |
</form> |
</body> |
</body> |
</html> |
</html> |
ENDENV |
ENDenv |
} |
} |
################################################## |
################################################## |
|
|
Line 1840 sub overview {
|
Line 1847 sub overview {
|
my $r=shift; |
my $r=shift; |
my $bodytag=&Apache::loncommon::bodytag( |
my $bodytag=&Apache::loncommon::bodytag( |
'Set/Modify Course Assessment Parameters'); |
'Set/Modify Course Assessment Parameters'); |
my $dom = $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $ENV{'course.'.$ENV{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Overview'); |
my $html=&Apache::lonxml::xmlbegin(); |
my $html=&Apache::lonxml::xmlbegin(); |
$r->print(<<ENDOVER); |
$r->print(<<ENDOVER); |
$html |
$html |
Line 1849 $html
|
Line 1857 $html
|
<title>LON-CAPA Course Environment</title> |
<title>LON-CAPA Course Environment</title> |
</head> |
</head> |
$bodytag |
$bodytag |
<form method="post" action="/adm/parmset" name="overviewform"> |
$breadcrumbs |
|
<form method="post" action="/adm/parmset?action=setoverview" name="overviewform"> |
<input type="hidden" name="overview" value="1" /> |
<input type="hidden" name="overview" value="1" /> |
ENDOVER |
ENDOVER |
# Setting |
# Setting |
Line 1858 ENDOVER
|
Line 1867 ENDOVER
|
undef %newdata; |
undef %newdata; |
my @deldata=(); |
my @deldata=(); |
undef @deldata; |
undef @deldata; |
foreach (keys %ENV) { |
foreach (keys %env) { |
if ($_=~/^form\.([a-z]+)\_(.+)$/) { |
if ($_=~/^form\.([a-z]+)\_(.+)$/) { |
my $cmd=$1; |
my $cmd=$1; |
my $thiskey=$2; |
my $thiskey=$2; |
if ($cmd eq 'set') { |
if ($cmd eq 'set') { |
my $data=$ENV{$_}; |
my $data=$env{$_}; |
if ($olddata{$thiskey} ne $data) { $newdata{$thiskey}=$data; } |
if ($olddata{$thiskey} ne $data) { $newdata{$thiskey}=$data; } |
} elsif ($cmd eq 'del') { |
} elsif ($cmd eq 'del') { |
push (@deldata,$thiskey); |
push (@deldata,$thiskey); |
} elsif ($cmd eq 'datepointer') { |
} elsif ($cmd eq 'datepointer') { |
my $data=&Apache::lonhtmlcommon::get_date_from_form($ENV{$_}); |
my $data=&Apache::lonhtmlcommon::get_date_from_form($env{$_}); |
if (defined($data) and $olddata{$thiskey} ne $data) { $newdata{$thiskey}=$data; } |
if (defined($data) and $olddata{$thiskey} ne $data) { $newdata{$thiskey}=$data; } |
} |
} |
} |
} |
Line 1989 Returns:
|
Line 1998 Returns:
|
sub change_clone { |
sub change_clone { |
my ($clonelist,$oldcloner) = @_; |
my ($clonelist,$oldcloner) = @_; |
my ($uname,$udom); |
my ($uname,$udom); |
my $cnum = $ENV{'course.'.$ENV{'request.course.id'}.'.num'}; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cdom = $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $clone_crs = $cnum.':'.$cdom; |
my $clone_crs = $cnum.':'.$cdom; |
|
|
if ($cnum && $cdom) { |
if ($cnum && $cdom) { |
Line 2046 sub change_clone {
|
Line 2055 sub change_clone {
|
} |
} |
} |
} |
|
|
|
|
|
################################################## |
|
################################################## |
|
|
|
=pod |
|
|
|
=item * header |
|
|
|
Output html header for page |
|
|
|
=cut |
|
|
|
################################################## |
|
################################################## |
|
sub header { |
|
my $html=&Apache::lonxml::xmlbegin(); |
|
my $bodytag=&Apache::loncommon::bodytag('Parameter Manager'); |
|
my $title = &mt('LON-CAPA Parameter Manager'); |
|
return(<<ENDHEAD); |
|
$html |
|
<head> |
|
<title>$title</title> |
|
</head> |
|
$bodytag |
|
ENDHEAD |
|
} |
|
################################################## |
|
################################################## |
|
sub print_main_menu { |
|
my ($r,$parm_permission)=@_; |
|
# |
|
$r->print(<<ENDMAINFORMHEAD); |
|
<form method="post" enctype="multipart/form-data" |
|
action="/adm/parmset" name="studentform"> |
|
ENDMAINFORMHEAD |
|
# |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my @menu = |
|
( |
|
{ text => 'Set Course Environment Parameters', |
|
help => 'Course_Setting_Parameters', |
|
action => 'crsenv', |
|
permission => $parm_permission, |
|
}, |
|
{ text => 'Set/Modify Course Assessment Parameters - Helper Mode', |
|
url => '/adm/helper/parameter.helper', |
|
permission => $parm_permission, |
|
}, |
|
{ text => 'Modify Course Assessment Parameters - Overview Mode', |
|
action => 'setoverview', |
|
permission => $parm_permission, |
|
}, |
|
{ text => 'Set/Modify Course Assessment Parameters - Table Mode', |
|
action => 'settable', |
|
permission => $parm_permission, |
|
}, |
|
# { text => 'Set Parameter Default Preferences', |
|
# help => 'Course_View_Class_List', |
|
# action => 'setdefaults', |
|
# permission => $parm_permission, |
|
# }, |
|
); |
|
my $menu_html = ''; |
|
foreach my $menu_item (@menu) { |
|
next if (! $menu_item->{'permission'}); |
|
$menu_html.='<p>'; |
|
$menu_html.='<font size="+1">'; |
|
if (exists($menu_item->{'url'})) { |
|
$menu_html.=qq{<a href="$menu_item->{'url'}">}; |
|
} else { |
|
$menu_html.= |
|
qq{<a href="/adm/parmset?action=$menu_item->{'action'}">}; |
|
} |
|
$menu_html.= &mt($menu_item->{'text'}).'</a></font>'; |
|
if (exists($menu_item->{'help'})) { |
|
$menu_html.= |
|
&Apache::loncommon::help_open_topic($menu_item->{'help'}); |
|
} |
|
$menu_html.='</p>'.$/; |
|
} |
|
$r->print($menu_html); |
|
return; |
|
} |
|
|
|
|
|
|
|
|
################################################## |
################################################## |
################################################## |
################################################## |
|
|
Line 2056 sub change_clone {
|
Line 2153 sub change_clone {
|
Main handler. Calls &assessparms and &crsenv subroutines. |
Main handler. Calls &assessparms and &crsenv subroutines. |
|
|
=cut |
=cut |
|
|
################################################## |
################################################## |
################################################## |
################################################## |
use Data::Dumper; |
use Data::Dumper; |
Line 2068 sub handler {
|
Line 2164 sub handler {
|
$r->send_http_header; |
$r->send_http_header; |
return OK; |
return OK; |
} |
} |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
|
['action','state']); |
|
|
# ----------------------------------------------------------- Clear out garbage |
# ----------------------------------------------------------- Clear out garbage |
|
|
Line 2084 sub handler {
|
Line 2181 sub handler {
|
|
|
%maptitles=(); |
%maptitles=(); |
|
|
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/parmset", |
|
text=>"Parameter Manager", |
|
faq=>9, |
|
bug=>'Instructor Interface'}); |
# ----------------------------------------------------- Needs to be in a course |
# ----------------------------------------------------- Needs to be in a course |
|
my $parm_permission = |
|
(&Apache::lonnet::allowed('opa',$env{'request.course.id'}) || |
|
&Apache::lonnet::allowed('opa',$env{'request.course.id'}.'/'. |
|
$env{'request.course.sec'})); |
|
if ($env{'request.course.id'} && $parm_permission) { |
|
|
if (($ENV{'request.course.id'}) && |
# Start Page |
(&Apache::lonnet::allowed('opa',$ENV{'request.course.id'}) || |
|
&Apache::lonnet::allowed('opa',$ENV{'request.course.id'}.'/'. |
|
$ENV{'request.course.sec'}) |
|
)) { |
|
|
|
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
|
|
if (($ENV{'form.crsenv'}) || (!$ENV{'request.course.fn'})) { |
# |
# ---------------------------------------------- This is for course environment |
# Main switch on form.action and form.state, as appropriate |
# -------------------------- also call if toplevel map coudl not be initialized |
# |
&crsenv($r); |
# Check first if coming from someone else headed directly for |
} elsif ($ENV{'form.overview'}) { |
# the table mode |
# --------------------------------------------------------------- Overview mode |
if ((($env{'form.command'} eq 'set') && ($env{'form.url'}) |
|
&& (!$env{'form.dis'})) || ($env{'form.symb'})) { |
|
&assessparms($r); |
|
|
|
} elsif (! exists($env{'form.action'})) { |
|
$r->print(&header()); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs(undef, |
|
'Parameter Manager')); |
|
&print_main_menu($r,$parm_permission); |
|
} elsif ($env{'form.action'} eq 'crsenv' && $parm_permission) { |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=crsenv', |
|
text=>"Course Environment"}); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs(undef, |
|
'Edit Course Environment')); |
|
&crsenv($r); |
|
} elsif ($env{'form.action'} eq 'setoverview' && $parm_permission) { |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
|
text=>"Overview Mode"}); |
&overview($r); |
&overview($r); |
} else { |
} elsif ($env{'form.action'} eq 'settable' && $parm_permission) { |
# --------------------------------------------------------- Bring up assessment |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', |
|
text=>"Table Mode"}); |
&assessparms($r); |
&assessparms($r); |
} |
} |
|
|
} else { |
} else { |
# ----------------------------- Not in a course, or not allowed to modify parms |
# ----------------------------- Not in a course, or not allowed to modify parms |
$ENV{'user.error.msg'}= |
$env{'user.error.msg'}= |
"/adm/parmset:opa:0:0:Cannot modify assessment parameters"; |
"/adm/parmset:opa:0:0:Cannot modify assessment parameters"; |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |