version 1.130, 2003/10/09 01:40:05
|
version 1.139, 2003/11/21 19:54:42
|
Line 131 sub parmval {
|
Line 131 sub parmval {
|
|
|
# -------------------------------------------------------- first, check default |
# -------------------------------------------------------- first, check default |
|
|
if ($def) { $outpar[11]=$def; $result=11; } |
if (defined($def)) { $outpar[11]=$def; $result=11; } |
|
|
# ----------------------------------------------------- second, check map parms |
# ----------------------------------------------------- second, check map parms |
|
|
my $thisparm=$parmhash{$symbparm}; |
my $thisparm=$parmhash{$symbparm}; |
if ($thisparm) { $outpar[10]=$thisparm; $result=10; } |
if (defined($thisparm)) { $outpar[10]=$thisparm; $result=10; } |
|
|
# --------------------------------------------------------- third, check course |
# --------------------------------------------------------- third, check course |
|
|
Line 285 sub plink {
|
Line 285 sub plink {
|
|
|
|
|
sub startpage { |
sub startpage { |
my ($r,$id,$udom,$csec,$uname,$have_assesments)=@_; |
my ($r,$id,$udom,$csec,$uname,$have_assesments,$trimheader)=@_; |
|
|
my $bodytag=&Apache::loncommon::bodytag('Set/Modify Course Parameters','', |
my $bodytag=&Apache::loncommon::bodytag('Set/Modify Course Parameters','', |
'onUnload="pclose()"'); |
'onUnload="pclose()"'); |
Line 293 sub startpage {
|
Line 293 sub startpage {
|
&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(); |
my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition(); |
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" |
|
); |
$r->print(<<ENDHEAD); |
$r->print(<<ENDHEAD); |
<html> |
<html> |
<head> |
<head> |
Line 341 sub startpage {
|
Line 354 sub startpage {
|
$selscript |
$selscript |
</head> |
</head> |
$bodytag |
$bodytag |
|
ENDHEAD |
|
|
|
unless ($trimheader) {$r->print(<<ENDHEAD2); |
<form method="post" action="/adm/parmset" name="envform"> |
<form method="post" action="/adm/parmset" name="envform"> |
<h4>Course Environment Parameters</h4> |
<h4>$lt{'cep'}</h4> |
<input type="submit" name="crsenv" value="Set Course Environment Parameters" /> |
<input type="submit" name="crsenv" value="$lt{'scep'}" /> |
</form> |
</form> |
<hr /> |
<hr /> |
<form method="post" action="/adm/helper/parameter.helper" name="helpform"> |
<form method="post" action="/adm/helper/parameter.helper" name="helpform"> |
<h4>Course Assessment Parameter - Helper Mode</h4> |
<h4>$lt{'caphm'}</h4> |
<input type="submit" value="Set/Modify Course Assessment Parameter" /> |
<input type="submit" value="$lt{'smcap'}" /> |
</form> |
</form> |
<hr /> |
<hr /> |
<form method="post" action="/adm/parmset" name="overview"> |
<form method="post" action="/adm/parmset" name="overview"> |
<h4>Course Assessment Parameters - Overview Mode</h4> |
<h4>$lt{'capom'}</h4> |
<input type="submit" name="overview" value="Modify Course Assessment Parameters" /> |
<input type="submit" name="overview" value="$lt{'mcap'}" /> |
</form> |
</form> |
<hr /> |
<hr /> |
|
ENDHEAD2 |
|
} |
|
$r->print(<<ENDHEAD3); |
<form method="post" action="/adm/parmset" name="parmform"> |
<form method="post" action="/adm/parmset" name="parmform"> |
<h4>Course Assessments Parameters - Table Mode</h4> |
<h4>$lt{'captm'}</h4> |
ENDHEAD |
ENDHEAD3 |
|
|
if (!$have_assesments) { |
if (!$have_assesments) { |
$r->print('<font color="red">There are no assesment parameters in this course to set.</font><br />'); |
$r->print('<font color="red">'.&mt('There are no assesment parameters in this course to set.').'</font><br />'); |
} else { |
} else { |
$r->print(<<ENDHEAD); |
$r->print(<<ENDHEAD); |
<b> |
<b> |
Section/Group: |
$lt{'sg'}: |
<input type="text" value="$csec" size="6" name="csec"> |
<input type="text" value="$csec" size="6" name="csec"> |
<br> |
<br> |
For User |
$lt{'fu'} |
<input type="text" value="$uname" size="12" name="uname"> |
<input type="text" value="$uname" size="12" name="uname"> |
or ID |
$lt{'oi'} |
<input type="text" value="$id" size="12" name="id"> |
<input type="text" value="$id" size="12" name="id"> |
at Domain |
$lt{'ad'} |
$chooseopt |
$chooseopt |
</b> |
</b> |
<input type="hidden" value='' name="pres_value"> |
<input type="hidden" value='' name="pres_value"> |
Line 472 sub print_row {
|
Line 490 sub print_row {
|
} # end of $brief if/else |
} # end of $brief if/else |
} # end of $parmlev if/else |
} # end of $parmlev if/else |
|
|
if ($parmlev eq 'full' || $parmlev eq 'brief') { |
$r->print('<td bgcolor=#CCCCFF align="center">'. |
$r->print('<td bgcolor=#CCCCFF align="center">'. |
|
&valout($outpar[$result],$typeoutpar[$result]).'</td>'); |
&valout($outpar[$result],$typeoutpar[$result]).'</td>'); |
} |
|
my $sessionval=&Apache::lonnet::EXT('resource.'.$$part{$which}. |
if ($parmlev eq 'full' || $parmlev eq 'brief') { |
|
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}. |
# '.'.$$name{$which}.'.type',$symbp{$rid}); |
# '.'.$$name{$which}.'.type',$symbp{$rid}); |
# this seems to work |
# this seems to work |
my $sessionvaltype=$typeoutpar[$result]; |
my $sessionvaltype=$typeoutpar[$result]; |
if (!defined($sessionvaltype)) { $sessionvaltype=$$defaulttype{$which}; } |
if (!defined($sessionvaltype)) { $sessionvaltype=$$defaulttype{$which}; } |
$r->print('<td bgcolor=#999999 align="center"><font color=#FFFFFF>'. |
$r->print('<td bgcolor=#999999 align="center"><font color=#FFFFFF>'. |
&valout($sessionval,$sessionvaltype).' '. |
&valout($sessionval,$sessionvaltype).' '. |
'</font></td>'); |
'</font></td>'); |
|
} |
$r->print('</tr>'); |
$r->print('</tr>'); |
$r->print("\n"); |
$r->print("\n"); |
} |
} |
Line 505 sub print_td {
|
Line 525 sub print_td {
|
$r->print('</td>'."\n"); |
$r->print('</td>'."\n"); |
} |
} |
|
|
sub get_env_multiple { |
|
my ($name) = @_; |
|
my @values; |
|
if (defined($ENV{$name})) { |
|
# exists is it an array |
|
if (ref($ENV{$name})) { |
|
@values=@{ $ENV{$name} }; |
|
} else { |
|
$values[0]=$ENV{$name}; |
|
} |
|
} |
|
return(@values); |
|
} |
|
|
|
=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 680 sub assessparms {
|
Line 686 sub assessparms {
|
$udom=$ENV{'form.udom'}; |
$udom=$ENV{'form.udom'}; |
unless ($udom) { $udom=$r->dir_config('lonDefDomain'); } |
unless ($udom) { $udom=$r->dir_config('lonDefDomain'); } |
|
|
my @pscat=&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=&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 $prevvisit=$ENV{'form.prevvisit'}; |
my $prevvisit=$ENV{'form.prevvisit'}; |
|
|
# unless ($parmlev==$ENV{'form.parmlev'}) { |
# unless ($parmlev==$ENV{'form.parmlev'}) { |
Line 710 sub assessparms {
|
Line 717 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 726 sub assessparms {
|
Line 735 sub assessparms {
|
$id=''; |
$id=''; |
} else { |
} else { |
$message= |
$message= |
"<font color=red>Unknown ID '$id' at domain '$udom'</font>"; |
"<font color=red>".&mt("Unknown ID")." '$id' ". |
|
&mt('at domain')." '$udom'</font>"; |
} |
} |
} else { |
} else { |
$uname=$ENV{'form.uname'}; |
$uname=$ENV{'form.uname'}; |
Line 737 sub assessparms {
|
Line 747 sub assessparms {
|
$uhome=&Apache::lonnet::homeserver($uname,$udom); |
$uhome=&Apache::lonnet::homeserver($uname,$udom); |
if ($uhome eq 'no_host') { |
if ($uhome eq 'no_host') { |
$message= |
$message= |
"<font color=red>Unknown user '$uname' at domain '$udom'</font>"; |
"<font color=red>".&mt("Unknown user")." '$uname' ". |
|
&mt("at domain")." '$udom'</font>"; |
$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>". |
"User '$uname' at domain '$udom' not ". |
&mt("User")." '$uname' ".&mt("at domain")." '$udom' ". |
"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')); |
$message="\n<p>\nFull Name: ". |
$message="\n<p>\n".&mt("Full Name").": ". |
$name{'firstname'}.' '.$name{'middlename'}.' ' |
$name{'firstname'}.' '.$name{'middlename'}.' ' |
.$name{'lastname'}.' '.$name{'generation'}. |
.$name{'lastname'}.' '.$name{'generation'}. |
"<br>\nID: ".$name{'id'}.'<p>'; |
"<br>\n".&mt('ID').": ".$name{'id'}.'<p>'; |
} |
} |
} |
} |
} |
} |
Line 902 sub assessparms {
|
Line 913 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; } |
|
|
&startpage($r,$id,$udom,$csec,$uname,$have_assesments); |
&startpage($r,$id,$udom,$csec,$uname,$have_assesments,$trimheader); |
|
|
if (!$have_assesments) { |
if (!$have_assesments) { |
untie(%bighash); |
untie(%bighash); |
Line 1081 sub assessparms {
|
Line 1092 sub assessparms {
|
$r->print("<th colspan=3 rowspan=2>"); |
$r->print("<th colspan=3 rowspan=2>"); |
$r->print(&mt("User")." $uname ".&mt('at Domain')." $udom</th>"); |
$r->print(&mt("User")." $uname ".&mt('at Domain')." $udom</th>"); |
} |
} |
|
my %lt=&Apache::lonlocal::texthash( |
|
'pie' => "Parameter in Effect", |
|
'csv' => "Current Session Value", |
|
'at' => 'at', |
|
'rl' => "Resource Level", |
|
'ic' => 'in Course', |
|
'aut' => "Assessment URL and Title", |
|
'type' => 'Type', |
|
'emof' => "Enclosing Map or Folder", |
|
'part' => 'Part', |
|
'pn' => 'Parameter Name', |
|
'def' => 'default', |
|
'femof' => 'from Enclosing Map or Folder', |
|
'gen' => 'general', |
|
'foremf' => 'for Enclosing Map or Folder', |
|
'fr' => 'for Resource' |
|
); |
$r->print(<<ENDTABLETWO); |
$r->print(<<ENDTABLETWO); |
<th rowspan=3>Parameter in Effect</th> |
<th rowspan=3>$lt{'pie'}</th> |
<th rowspan=3>Current Session Value<br>($csuname at $csudom)</th> |
<th rowspan=3>$lt{'csv'}<br>($csuname $lt{'at'} $csudom)</th> |
</tr><tr><td colspan=5></td><th colspan=2>Resource Level</th> |
</tr><tr><td colspan=5></td><th colspan=2>$lt{'rl'}</th> |
<th colspan=3>in Course</th> |
<th colspan=3>$lt{'ic'}</th> |
ENDTABLETWO |
ENDTABLETWO |
if ($csec) { |
if ($csec) { |
$r->print("<th colspan=3>in Section/Group $csec</th>"); |
$r->print("<th colspan=3>". |
|
&mt("in Section/Group")." $csec</th>"); |
} |
} |
$r->print(<<ENDTABLEHEADFOUR); |
$r->print(<<ENDTABLEHEADFOUR); |
</tr><tr><th>Assessment URL and Title</th><th>Type</th> |
</tr><tr><th>$lt{'aut'}</th><th>$lt{'type'}</th> |
<th>Enclosing Map or Folder</th><th>Part</th><th>Parameter Name</th> |
<th>$lt{'emof'}</th><th>$lt{'part'}</th><th>$lt{'pn'}</th> |
<th>default</th><th>from Enclosing Map or Folder</th> |
<th>$lt{'def'}</th><th>$lt{'femof'}</th> |
<th>general</th><th>for Enclosing Map or Folder</th><th>for Resource</th> |
<th>$lt{'gen'}</th><th>$lt{'foremf'}</th><th>$lt{'fr'}</th> |
ENDTABLEHEADFOUR |
ENDTABLEHEADFOUR |
|
|
if ($csec) { |
if ($csec) { |
Line 1264 ENDTABLEHEADFOUR
|
Line 1293 ENDTABLEHEADFOUR
|
} # end loop through ids |
} # end loop through ids |
|
|
#---------------------------------------------------- print header information |
#---------------------------------------------------- print header information |
my $foldermap=($maptitle=~/^uploaded/?'Folder':'Map'); |
my $foldermap=&mt($maptitle=~/^uploaded/?'Folder':'Map'); |
my $showtitle=$maptitles{$maptitle}.($maptitle!~/^uploaded/?' ['.$maptitle.']':''); |
my $showtitle=$maptitles{$maptitle}.($maptitle!~/^uploaded/?' ['.$maptitle.']':''); |
$r->print(<<ENDMAPONE); |
$r->print(<<ENDMAPONE); |
<center><h4> |
<center><h4> |
<font color="red">Set Defaults for All Resources in $foldermap<br /> |
Set Defaults for All Resources in $foldermap<br /> |
<i>$showtitle</i><br /> |
<font color="red"><i>$showtitle</i></font><br /> |
Specifically for |
Specifically for |
ENDMAPONE |
ENDMAPONE |
if ($uname) { |
if ($uname) { |
Line 1277 ENDMAPONE
|
Line 1306 ENDMAPONE
|
('firstname','middlename','lastname','generation', 'id')); |
('firstname','middlename','lastname','generation', 'id')); |
my $person=$name{'firstname'}.' '.$name{'middlename'}.' ' |
my $person=$name{'firstname'}.' '.$name{'middlename'}.' ' |
.$name{'lastname'}.' '.$name{'generation'}; |
.$name{'lastname'}.' '.$name{'generation'}; |
$r->print(&mt("User")." <i>$uname \($person\) </i> ". |
$r->print(&mt("User")." <font color=\"red\"><i>$uname \($person\) </i></font> ". |
&mt('in')." \n"); |
&mt('in')." \n"); |
} else { |
} else { |
$r->print("<i>".&mt('all').'</i> '.&mt('users in')." \n"); |
$r->print("<font color=\"red\"><i>".&mt('all').'</i></font> '.&mt('users in')." \n"); |
} |
} |
|
|
if ($csec) {$r->print(&mt("Section")." <i>$csec</i> ". |
if ($csec) {$r->print(&mt("Section")." <font color=\"red\"><i>$csec</i></font> ". |
&mt('of')." \n")}; |
&mt('of')." \n")}; |
|
|
$r->print("<i>$coursename</i><br />"); |
$r->print("<font color=\"red\"><i>$coursename</i></font><br />"); |
$r->print("</font></h4>\n"); |
$r->print("</h4>\n"); |
#---------------------------------------------------------------- print table |
#---------------------------------------------------------------- print table |
$r->print('<p><table border="2">'); |
$r->print('<p><table border="2">'); |
$r->print('<tr><th>'.&mt('Parameter Name').'</th>'); |
$r->print('<tr><th>'.&mt('Parameter Name').'</th>'); |
Line 1348 ENDMAPONE
|
Line 1377 ENDMAPONE
|
} # end loop through ids |
} # end loop through ids |
|
|
#---------------------------------------------------- print header information |
#---------------------------------------------------- print header information |
|
my $setdef=&mt("Set Defaults for All Resources in Course"); |
$r->print(<<ENDMAPONE); |
$r->print(<<ENDMAPONE); |
<center><h4> |
<center><h4>$setdef |
<font color="red">Set Defaults for All Resources in Course |
<font color="red"><i>$coursename</i></font><br /> |
<i>$coursename</i><br /> |
|
ENDMAPONE |
ENDMAPONE |
if ($uname) { |
if ($uname) { |
my %name=&Apache::lonnet::userenvironment($udom,$uname, |
my %name=&Apache::lonnet::userenvironment($udom,$uname, |
('firstname','middlename','lastname','generation', 'id')); |
('firstname','middlename','lastname','generation', 'id')); |
my $person=$name{'firstname'}.' '.$name{'middlename'}.' ' |
my $person=$name{'firstname'}.' '.$name{'middlename'}.' ' |
.$name{'lastname'}.' '.$name{'generation'}; |
.$name{'lastname'}.' '.$name{'generation'}; |
$r->print(" ".&mt("User")." <i>$uname \($person\) </i> \n"); |
$r->print(" ".&mt("User")."<font color=\"red\"> <i>$uname \($person\) </i></font> \n"); |
} else { |
} else { |
$r->print("<i>".&mt("ALL")."</i> ".&mt("USERS")." \n"); |
$r->print("<i><font color=\"red\"> ".&mt("ALL")."</i> ".&mt("USERS")."</font> \n"); |
} |
} |
|
|
if ($csec) {$r->print(&mt("Section")." <i>$csec</i>\n")}; |
if ($csec) {$r->print(&mt("Section")."<font color=\"red\"> <i>$csec</i></font>\n")}; |
$r->print("</font></h4>\n"); |
$r->print("</h4>\n"); |
#---------------------------------------------------------------- print table |
#---------------------------------------------------------------- print table |
$r->print('<p><table border="2">'); |
$r->print('<p><table border="2">'); |
$r->print('<tr><th>'.&mt('Parameter Name').'</th>'); |
$r->print('<tr><th>'.&mt('Parameter Name').'</th>'); |
Line 1491 sub crsenv {
|
Line 1520 sub crsenv {
|
'courseid' => '<b>Course ID or number</b><br />'. |
'courseid' => '<b>Course ID or number</b><br />'. |
'(internal, optional)', |
'(internal, optional)', |
'grading' => '<b>Grading</b>'. |
'grading' => '<b>Grading</b>'. |
'"standard" or any other value. '. |
'"standard", "external", or any other value.'. |
'Default for new courses is "standard".', |
' Default for new courses is "standard".', |
|
|
'default_xml_style' => '<b>Default XML Style File</b> '. |
'default_xml_style' => '<b>Default XML Style File</b> '. |
'<a href="javascript:openbrowser'. |
'<a href="javascript:openbrowser'. |
Line 1820 sub handler {
|
Line 1849 sub handler {
|
} |
} |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}); |
|
|
|
# ----------------------------------------------------------- Clear out garbage |
|
|
|
%courseopt=(); |
|
%useropt=(); |
|
%parmhash=(); |
|
|
|
@ids=(); |
|
%symbp=(); |
|
%mapp=(); |
|
%typep=(); |
|
%keyp=(); |
|
|
|
%maptitles=(); |
|
|
# ----------------------------------------------------- Needs to be in a course |
# ----------------------------------------------------- Needs to be in a course |
|
|
if (($ENV{'request.course.id'}) && |
if (($ENV{'request.course.id'}) && |