version 1.366.2.1, 2007/06/20 21:08:15
|
version 1.378, 2007/08/30 00:01:56
|
Line 67 use Apache::longroup;
|
Line 67 use Apache::longroup;
|
use Apache::lonrss; |
use Apache::lonrss; |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA qw(:DEFAULT :match); |
|
|
# --- Caches local to lonparmset |
|
|
|
my $parmhashid; |
|
my %parmhash; |
|
my $symbsid; |
|
my %symbs; |
|
my $rulesid; |
|
my %rules; |
|
|
|
# --- end local caches |
|
|
|
################################################## |
################################################## |
################################################## |
################################################## |
Line 119 sub parmval {
|
Line 109 sub parmval {
|
|
|
sub parmval_by_symb { |
sub parmval_by_symb { |
my ($what,$symb,$def,$uname,$udom,$csec,$cgroup,$courseopt)=@_; |
my ($what,$symb,$def,$uname,$udom,$csec,$cgroup,$courseopt)=@_; |
# load caches |
|
&cacheparmhash(); |
|
|
|
my $useropt; |
my $useropt; |
if ($uname ne '' && $udom ne '') { |
if ($uname ne '' && $udom ne '') { |
Line 167 sub parmval_by_symb {
|
Line 155 sub parmval_by_symb {
|
|
|
# ------------------------------------------------------ third, check map parms |
# ------------------------------------------------------ third, check map parms |
|
|
my $thisparm=$parmhash{$symbparm}; |
my $thisparm=&parmhash($symbparm); |
if (defined($thisparm)) { $outpar[11]=$thisparm; $result=11; } |
if (defined($thisparm)) { $outpar[11]=$thisparm; $result=11; } |
|
|
if (defined($$courseopt{$courselevelr})) { |
if (defined($$courseopt{$courselevelr})) { |
Line 228 sub parmval_by_symb {
|
Line 216 sub parmval_by_symb {
|
return ($result,@outpar); |
return ($result,@outpar); |
} |
} |
|
|
sub resetparmhash { |
|
$parmhashid=''; |
|
} |
|
|
|
sub cacheparmhash { |
|
if ($parmhashid eq $env{'request.course.fn'}) { return; } |
|
my %parmhashfile; |
|
if (tie(%parmhashfile,'GDBM_File', |
|
$env{'request.course.fn'}.'_parms.db',&GDBM_READER(),0640)) { |
|
%parmhash=%parmhashfile; |
|
untie %parmhashfile; |
|
$parmhashid=$env{'request.course.fn'}; |
|
} |
|
} |
|
|
|
sub resetsymbcache { |
# --- Caches local to lonparmset |
$symbsid=''; |
|
|
|
|
sub reset_caches { |
|
&resetparmhash(); |
|
&resetsymbcache(); |
|
&resetrulescache(); |
} |
} |
|
|
sub symbcache { |
{ |
my $id=shift; |
my $parmhashid; |
if ($symbsid ne $env{'request.course.id'}) { |
my %parmhash; |
%symbs=(); |
sub resetparmhash { |
|
undef($parmhashid); |
|
undef(%parmhash); |
} |
} |
unless ($symbs{$id}) { |
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
sub cacheparmhash { |
if ($id=~/\./) { |
if ($parmhashid eq $env{'request.course.fn'}) { return; } |
my $resource=$navmap->getById($id); |
my %parmhashfile; |
$symbs{$id}=$resource->symb(); |
if (tie(%parmhashfile,'GDBM_File', |
} else { |
$env{'request.course.fn'}.'_parms.db',&GDBM_READER(),0640)) { |
my $resource=$navmap->getByMapPc($id); |
%parmhash=%parmhashfile; |
$symbs{$id}=&Apache::lonnet::declutter($resource->src()); |
untie(%parmhashfile); |
|
$parmhashid=$env{'request.course.fn'}; |
} |
} |
$symbsid=$env{'request.course.id'}; |
|
} |
} |
return $symbs{$id}; |
|
} |
sub parmhash { |
|
my ($id) = @_; |
sub resetrulescache { |
&cacheparmhash(); |
$rulesid=''; |
return $parmhash{$id}; |
} |
} |
|
} |
|
|
|
{ |
|
my $symbsid; |
|
my %symbs; |
|
sub resetsymbcache { |
|
undef($symbsid); |
|
undef(%symbs); |
|
} |
|
|
|
sub symbcache { |
|
my $id=shift; |
|
if ($symbsid ne $env{'request.course.id'}) { |
|
undef(%symbs); |
|
} |
|
if (!$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}; |
|
} |
|
} |
|
|
sub rulescache { |
{ |
my $id=shift; |
my $rulesid; |
if ($rulesid ne $env{'request.course.id'} |
my %rules; |
&& !defined($rules{$id})) { |
sub resetrulescache { |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
undef($rulesid); |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
undef(%rules); |
%rules=&Apache::lonnet::dump('parmdefactions',$dom,$crs); |
} |
$rulesid=$env{'request.course.id'}; |
|
|
sub rulescache { |
|
my $id=shift; |
|
if ($rulesid ne $env{'request.course.id'} |
|
&& !defined($rules{$id})) { |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
%rules=&Apache::lonnet::dump('parmdefactions',$dom,$crs); |
|
$rulesid=$env{'request.course.id'}; |
|
} |
|
return $rules{$id}; |
} |
} |
return $rules{$id}; |
|
} |
} |
|
|
sub preset_defaults { |
sub preset_defaults { |
Line 345 sub storeparm {
|
Line 365 sub storeparm {
|
# - new type |
# - new type |
# - username |
# - username |
# - userdomain |
# - userdomain |
|
|
my %recstack; |
my %recstack; |
sub storeparm_by_symb { |
sub storeparm_by_symb { |
my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$recflag,$cgroup)=@_; |
my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$recflag,$cgroup)=@_; |
Line 558 sub valout {
|
Line 577 sub valout {
|
&date_sanity_info($value); |
&date_sanity_info($value); |
} else { |
} else { |
$result = $value; |
$result = $value; |
|
$result = &HTML::Entities::encode($result,'"<>&'); |
} |
} |
} |
} |
return $result; |
return $result; |
Line 594 sub plink {
|
Line 614 sub plink {
|
my ($parmname)=((split(/\&/,$marker))[1]=~/\_([^\_]+)$/); |
my ($parmname)=((split(/\&/,$marker))[1]=~/\_([^\_]+)$/); |
my ($hour,$min,$sec,$val)=&preset_defaults($parmname); |
my ($hour,$min,$sec,$val)=&preset_defaults($parmname); |
unless (defined($winvalue)) { $winvalue=$val; } |
unless (defined($winvalue)) { $winvalue=$val; } |
|
my $valout = &valout($value,$type,1); |
|
foreach my $item (\$type, \$dis, \$winvalue, \$marker, \$return, \$call, |
|
\$hour, \$min, \$sec) { |
|
$$item = &HTML::Entities::encode($$item,'"<>&'); |
|
$$item =~ s/\'/\\\'/g; |
|
} |
return '<table width="100%"><tr valign="top" align="right"><td><a name="'.$marker.'" /></td></tr><tr><td align="center">'. |
return '<table width="100%"><tr valign="top" align="right"><td><a name="'.$marker.'" /></td></tr><tr><td align="center">'. |
'<a href="javascript:pjump('."'".$type."','".$dis."','".$winvalue."','" |
'<a href="javascript:pjump('."'".$type."','".$dis."','".$winvalue."','" |
.$marker."','".$return."','".$call."','".$hour."','".$min."','".$sec."'".');">'. |
.$marker."','".$return."','".$call."','".$hour."','".$min."','".$sec."'".');">'. |
&valout($value,$type,1).'</a></td></tr></table>'; |
$valout.'</a></td></tr></table>'; |
} |
} |
|
|
sub page_js { |
sub page_js { |
Line 944 sub extractResourceInformation {
|
Line 970 sub extractResourceInformation {
|
# allparms is a hash of parameter names |
# allparms is a hash of parameter names |
# |
# |
my $name=&Apache::lonnet::metadata($srcf,$key.'.name'); |
my $name=&Apache::lonnet::metadata($srcf,$key.'.name'); |
if (!exists($$allparms{$name})) { |
if (!exists($$allparms{$name}) || $$allparms{$name} =~ m/^\s*$/ ) { |
my $display= &Apache::lonnet::metadata($srcf,$key.'.display'); |
my $display= &Apache::lonnet::metadata($srcf,$key.'.display'); |
my $parmdis = $display; |
my $parmdis = $display; |
$parmdis =~ s/\[Part.*$//g; |
$parmdis =~ s/\[Part.*$//g; |
Line 1081 ENDSCRIPT
|
Line 1107 ENDSCRIPT
|
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
$r->print(' checked'); |
$r->print(' checked'); |
} |
} |
$r->print('>'.$$allparms{$tempkey}.'</label></td>'); |
$r->print('>'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} |
|
: $tempkey) |
|
.'</label></td>'); |
$cnt++; |
$cnt++; |
if ($cnt==3) { |
if ($cnt==3) { |
$r->print("</tr>\n<tr>"); |
$r->print("</tr>\n<tr>"); |
Line 1573 sub assessparms {
|
Line 1601 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_'.$_.'" />'); |
&HTML::Entities::encode($env{'form.recent_'.$_},'"&<>'). |
|
'" name="recent_'.$_.'" />'); |
} |
} |
|
|
if (!$pssymb) { |
if (!$pssymb) { |
Line 2147 sub crsenv {
|
Line 2176 sub crsenv {
|
'cloners' => '<b>'.&mt('Users allowed to clone course').'</b><br /><tt>(user:domain,user:domain)</tt><br />'.&mt('Users with active Course Coordinator role in the course automatically have the right to clone it, and can be omitted from list.'), |
'cloners' => '<b>'.&mt('Users allowed to clone course').'</b><br /><tt>(user:domain,user:domain)</tt><br />'.&mt('Users with active Course Coordinator role in the course automatically have the right to clone it, and can be omitted from list.'), |
'grading' => '<b>'.&mt('Grading').'</b><br />'. |
'grading' => '<b>'.&mt('Grading').'</b><br />'. |
'<tt>"standard", "external", or "spreadsheet"</tt> '.&Apache::loncommon::help_open_topic('GradingOptions'), |
'<tt>"standard", "external", or "spreadsheet"</tt> '.&Apache::loncommon::help_open_topic('GradingOptions'), |
|
'task_grading' => '<b>'.&mt('Bridge Task Grading').'</b><br />'. |
|
&mt('Instructors and TAs in sections, when grading bridge tasks, should be allowed to grade other sections, "[_1]" they are allowed (this is the default), "[_2]" no, they can only grade their own section','<tt>any</tt>','<tt>section</tt>'), |
'default_xml_style' => '<b>'.&mt('Default XML Style File').'</b> '. |
'default_xml_style' => '<b>'.&mt('Default XML Style File').'</b> '. |
'<a href="javascript:openbrowser'. |
'<a href="javascript:openbrowser'. |
"('envform','default_xml_style'". |
"('envform','default_xml_style'". |
Line 2169 sub crsenv {
|
Line 2200 sub crsenv {
|
'pageseparators' => '<b>'.&mt('Visibly Separate Items on Pages').'</b><br />'. |
'pageseparators' => '<b>'.&mt('Visibly Separate Items on Pages').'</b><br />'. |
'('.&mt('"[_1]" for visible separation','<tt>yes</tt>').', '. |
'('.&mt('"[_1]" for visible separation','<tt>yes</tt>').', '. |
&mt('changes will not show until next login').')', |
&mt('changes will not show until next login').')', |
'student_classlist_view' => '<b>'.&mt('Allow students to view classlist.').'</b>'.&mt('("all":students can view all sections,"section":students can only view their own section.blank or "disabled" prevents student view.'), |
'student_classlist_view' => '<b>'.&mt('Allow students to view classlist.').'</b><br />'.&mt('("all":students can view all sections,"section":students can only view their own section.blank or "disabled" prevents student view.)'), |
|
'student_classlist_portfiles' => '<b>'.&mt('Include link to accessible portfolio files').'</b><br />'.&mt('"[_1]" for link to each a listing of each student\'s files.','<tt>yes</tt>'), |
|
'student_classlist_opt_in' => '<b>'.&mt("Student's agreement needed for listing in student-viewable roster").'</b><br />'.&mt('"[_1]" to require students to opt-in to listing in the roster (on the roster page).','<tt>yes</tt>'), |
'plc.roles.denied'=> '<b>'.&mt('Disallow live chatroom use for Roles'). |
'plc.roles.denied'=> '<b>'.&mt('Disallow live chatroom use for Roles'). |
'</b><br />"<tt>st</tt>": '. |
'</b><br />("<tt>st</tt>": '. |
&mt('student').', "<tt>ta</tt>": '. |
&mt('student').', "<tt>ta</tt>": '. |
'TA, "<tt>in</tt>": '. |
'TA, "<tt>in</tt>": '. |
&mt('instructor').';<br /><tt>'.&mt('role,role,...').'</tt>) '. |
&mt('instructor').';<br /><tt>'.&mt('role,role,...').'</tt>) '. |
Line 2182 sub crsenv {
|
Line 2214 sub crsenv {
|
'(<tt>user:domain,user:domain,...</tt>)', |
'(<tt>user:domain,user:domain,...</tt>)', |
|
|
'pch.roles.denied'=> '<b>'.&mt('Disallow Resource Discussion for Roles'). |
'pch.roles.denied'=> '<b>'.&mt('Disallow Resource Discussion for Roles'). |
'</b><br />"<tt>st</tt>": '. |
'</b><br />("<tt>st</tt>": '. |
'student, "<tt>ta</tt>": '. |
'student, "<tt>ta</tt>": '. |
'TA, "<tt>in</tt>": '. |
'TA, "<tt>in</tt>": '. |
'instructor;<br /><tt>role,role,...</tt>) '. |
'instructor;<br /><tt>role,role,...</tt>) '. |
Line 2233 sub crsenv {
|
Line 2265 sub crsenv {
|
' Tabloid [11x17 in], Executive [7 1/2x10 in], A2 [420x594 mm],'. |
' Tabloid [11x17 in], Executive [7 1/2x10 in], A2 [420x594 mm],'. |
' A3 [297x420 mm], A4 [210x297 mm], A5 [148x210 mm], A6 [105x148 mm])', |
' A3 [297x420 mm], A4 [210x297 mm], A5 [148x210 mm], A6 [105x148 mm])', |
'print_header_format' |
'print_header_format' |
=> '<b>Print header format; substitutions</b>: %n student name %c course id %a assignment note, numbers after the % limit the field size', |
=> &mtn('<b> Print header format; substitutions </b>: %n student name %c course id %a assignment note, numbers after the % limit the field size.').'</b>', |
'anonymous_quiz' |
|
=> '<b>'.&mt('Anonymous quiz/exam').'</b><br />'. |
|
' (<tt><b>'.&mt('yes').'</b> '.&mt('to avoid print students names').' </tt>)', |
|
'default_enrollment_start_date' => '<b>'.&mt('Default beginning date for student access.').'</b>', |
'default_enrollment_start_date' => '<b>'.&mt('Default beginning date for student access.').'</b>', |
'default_enrollment_end_date' => '<b>'.&mt('Default ending date for student access.').'</b>', |
'default_enrollment_end_date' => '<b>'.&mt('Default ending date for student access.').'</b>', |
'nothideprivileged' => '<b>'.&mt('Privileged users that should not be hidden on staff listings').'</b>'. |
'nothideprivileged' => '<b>'.&mt('Privileged users that should not be hidden on staff listings').'</b>'. |
Line 2256 sub crsenv {
|
Line 2285 sub crsenv {
|
'externalsyllabus' |
'externalsyllabus' |
=> '<b>'.&mt('URL of Syllabus (not using internal handler)').'</b>', |
=> '<b>'.&mt('URL of Syllabus (not using internal handler)').'</b>', |
'tthoptions' |
'tthoptions' |
=> '<b>'.&mt('Default set of options to pass to tth/m when converting tex').'</b>' |
=> '<b>'.&mt('Default set of options to pass to tth/m when converting tex').'</b>', |
|
|
|
'texengine' |
|
=> '<b>'.&mt('Force all students in the course to use a specific math rendering engine.').'</b><br />'.&mt('(Valid options are [_1].)','"tth", "jsMath", "mimetex"').'</b>', |
); |
); |
my @Display_Order = ('url','description','courseid','cloners','grading', |
my @Display_Order = ('url','description','courseid','cloners','grading', |
'externalsyllabus', |
'externalsyllabus', |
'default_xml_style','pageseparators', |
'default_xml_style','pageseparators', |
'question.email','question.email.text','comment.email','comment.email.text','policy.email','policy.email.text', |
'question.email','question.email.text','comment.email','comment.email.text','policy.email','policy.email.text', |
'student_classlist_view', |
'student_classlist_view', |
|
'student_classlist_opt_in', |
|
'student_classlist_portfiles', |
'plc.roles.denied','plc.users.denied', |
'plc.roles.denied','plc.users.denied', |
'pch.roles.denied','pch.users.denied', |
'pch.roles.denied','pch.users.denied', |
'allow_limited_html_in_feedback', |
'allow_limited_html_in_feedback', |
Line 2283 sub crsenv {
|
Line 2317 sub crsenv {
|
'default_enrollment_start_date', |
'default_enrollment_start_date', |
'default_enrollment_end_date', |
'default_enrollment_end_date', |
'tthoptions', |
'tthoptions', |
|
'texengine', |
'disablesigfigs', |
'disablesigfigs', |
'disableexampointprint', |
'disableexampointprint', |
'task_messages' |
'task_messages','task_grading', |
); |
); |
foreach my $parameter (sort(keys(%values))) { |
foreach my $parameter (sort(keys(%values))) { |
unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./)) { |
unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./)) { |
Line 2366 $start_header_row
|
Line 2401 $start_header_row
|
$end_header_row |
$end_header_row |
$output |
$output |
$end_table |
$end_table |
<input type="submit" name="crsenv" value="$lt{'sce'}"> |
<input type="submit" name="crsenv" value="$lt{'sce'}" /> |
</form> |
</form> |
$end_page |
$end_page |
ENDENV |
ENDENV |
Line 2721 ENDOVER
|
Line 2756 ENDOVER
|
my @selected_sections = |
my @selected_sections = |
&Apache::loncommon::get_env_multiple('form.Section'); |
&Apache::loncommon::get_env_multiple('form.Section'); |
@selected_sections = ('all') if (! @selected_sections); |
@selected_sections = ('all') if (! @selected_sections); |
foreach (@selected_sections) { |
foreach my $sec (@selected_sections) { |
if ($_ eq 'all') { |
if ($sec eq 'all') { |
@selected_sections = ('all'); |
@selected_sections = ('all'); |
} |
} |
} |
} |
Line 2742 ENDOVER
|
Line 2777 ENDOVER
|
\%mapp, \%symbp,\%maptitles,\%uris, |
\%mapp, \%symbp,\%maptitles,\%uris, |
\%keyorder,\%defkeytype); |
\%keyorder,\%defkeytype); |
|
|
|
if (grep {$_ eq 'all'} (@psprt)) { |
|
@psprt = keys(%allparts); |
|
} |
# Menu to select levels, etc |
# Menu to select levels, etc |
|
|
$r->print('<table id="LC_parm_overview_scope"> |
$r->print('<table id="LC_parm_overview_scope"> |
Line 2979 sub parse_key {
|
Line 3017 sub parse_key {
|
$data{'realm_type'} = 'folder'; |
$data{'realm_type'} = 'folder'; |
$data{'realm_title'} = &Apache::lonnet::gettitle($data{'realm'}); |
$data{'realm_title'} = &Apache::lonnet::gettitle($data{'realm'}); |
($data{'realm_exists'}) = &Apache::lonnet::is_on_map($data{'realm'}); |
($data{'realm_exists'}) = &Apache::lonnet::is_on_map($data{'realm'}); |
&Apache::lonnet::logthis($1." siad ". $data{'realm_exists'} ); |
|
} elsif ($middle) { |
} elsif ($middle) { |
$data{'realm'} = $middle; |
$data{'realm'} = $middle; |
$data{'realm_type'} = 'symb'; |
$data{'realm_type'} = 'symb'; |
Line 3942 sub check_for_course_info {
|
Line 3979 sub check_for_course_info {
|
Main handler. Calls &assessparms and &crsenv subroutines. |
Main handler. Calls &assessparms and &crsenv subroutines. |
|
|
=cut |
=cut |
|
|
################################################## |
################################################## |
################################################## |
################################################## |
# use Data::Dumper; |
|
|
|
|
|
sub handler { |
sub handler { |
my $r=shift; |
my $r=shift; |
|
|
|
&reset_caches(); |
|
|
if ($r->header_only) { |
if ($r->header_only) { |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
Line 3984 sub handler {
|
Line 4022 sub handler {
|
$r->send_http_header; |
$r->send_http_header; |
|
|
|
|
# id numbers can change on re-ordering of folders |
|
|
|
&resetsymbcache(); |
|
|
|
# |
# |
# Main switch on form.action and form.state, as appropriate |
# Main switch on form.action and form.state, as appropriate |
# |
# |
Line 4056 sub handler {
|
Line 4090 sub handler {
|
} |
} |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
|
&reset_caches(); |
|
|
return OK; |
return OK; |
} |
} |
|
|