version 1.355, 2006/12/14 20:49:22
|
version 1.384, 2007/11/02 23:29:49
|
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 554 sub valout {
|
Line 573 sub valout {
|
} |
} |
$result=~s/\s+$//; |
$result=~s/\s+$//; |
} elsif (&isdateparm($type)) { |
} elsif (&isdateparm($type)) { |
$result = localtime($value).&date_sanity_info($value); |
$result = &Apache::lonlocal::locallocaltime($value). |
|
&date_sanity_info($value); |
} else { |
} else { |
$result = $value; |
$result = $value; |
|
$result = &HTML::Entities::encode($result,'"<>&'); |
} |
} |
} |
} |
return $result; |
return $result; |
Line 593 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 934 sub extractResourceInformation {
|
Line 961 sub extractResourceInformation {
|
$$typep{$id}=$1; |
$$typep{$id}=$1; |
$$keyp{$id}=''; |
$$keyp{$id}=''; |
$$uris{$id}=$srcf; |
$$uris{$id}=$srcf; |
foreach (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys'))) { |
foreach my $key (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys'))) { |
if ($_=~/^parameter\_(.*)/) { |
next if ($key!~/^parameter_/); |
my $key=$_; |
|
# Hidden parameters |
# Hidden parameters |
if (&Apache::lonnet::metadata($srcf,$key.'.hidden') eq 'parm') { |
next if (&Apache::lonnet::metadata($srcf,$key.'.hidden') eq 'parm'); |
next; |
|
} |
|
my $display= &Apache::lonnet::metadata($srcf,$key.'.display'); |
|
my $name=&Apache::lonnet::metadata($srcf,$key.'.name'); |
|
my $part= &Apache::lonnet::metadata($srcf,$key.'.part'); |
|
# |
# |
# allparms is a hash of parameter names |
# allparms is a hash of parameter names |
# |
# |
|
my $name=&Apache::lonnet::metadata($srcf,$key.'.name'); |
|
if (!exists($$allparms{$name}) || $$allparms{$name} =~ m/^\s*$/ ) { |
|
my $display= &Apache::lonnet::metadata($srcf,$key.'.display'); |
my $parmdis = $display; |
my $parmdis = $display; |
$parmdis =~ s/\[Part.*$//g; |
$parmdis =~ s/\[Part.*$//g; |
$$allparms{$name}=$parmdis; |
$$allparms{$name}=$parmdis; |
$$defkeytype{$name}=&Apache::lonnet::metadata($srcf,$key.'.type'); |
if (ref($defkeytype)) { |
|
$$defkeytype{$name}= |
|
&Apache::lonnet::metadata($srcf,$key.'.type'); |
|
} |
|
} |
|
|
# |
# |
# allparts is a hash of all parts |
# allparts is a hash of all parts |
# |
# |
$$allparts{$part} = "Part: $part"; |
my $part= &Apache::lonnet::metadata($srcf,$key.'.part'); |
|
$$allparts{$part} = "Part: $part"; |
# |
# |
# Remember all keys going with this resource |
# Remember all keys going with this resource |
# |
# |
if ($$keyp{$id}) { |
if ($$keyp{$id}) { |
$$keyp{$id}.=','.$key; |
$$keyp{$id}.=','.$key; |
} else { |
} else { |
$$keyp{$id}=$key; |
$$keyp{$id}=$key; |
} |
} |
# |
# |
# Put in order |
# Put in order |
# |
# |
unless ($$keyorder{$key}) { |
unless ($$keyorder{$key}) { |
$$keyorder{$key}=$keyordercnt; |
$$keyorder{$key}=$keyordercnt; |
$keyordercnt++; |
$keyordercnt++; |
} |
|
|
|
} |
} |
} |
} |
$$mapp{$id}= |
|
&Apache::lonnet::declutter($resource->enclosing_map_src()); |
|
$$mapp{$mapid}=$$mapp{$id}; |
if (!exists($$mapp{$mapid})) { |
$$allmaps{$mapid}=$$mapp{$id}; |
$$mapp{$id}= |
if ($mapid eq '1') { |
&Apache::lonnet::declutter($resource->enclosing_map_src()); |
$$maptitles{$mapid}='Main Course Documents'; |
$$mapp{$mapid}=$$mapp{$id}; |
|
$$allmaps{$mapid}=$$mapp{$id}; |
|
if ($mapid eq '1') { |
|
$$maptitles{$mapid}='Main Course Documents'; |
|
} else { |
|
$$maptitles{$mapid}= |
|
&Apache::lonnet::gettitle($$mapp{$id}); |
|
} |
|
$$maptitles{$$mapp{$id}}=$$maptitles{$mapid}; |
|
$$symbp{$mapid}=$$mapp{$id}.'___(all)'; |
} else { |
} else { |
$$maptitles{$mapid}=&Apache::lonnet::gettitle(&Apache::lonnet::clutter($$mapp{$id})); |
$$mapp{$id} = $$mapp{$mapid}; |
} |
} |
$$maptitles{$$mapp{$id}}=$$maptitles{$mapid}; |
|
$$symbp{$id}=&Apache::lonnet::encode_symb($$mapp{$id},$resid,$srcf); |
$$symbp{$id}=&Apache::lonnet::encode_symb($$mapp{$id},$resid,$srcf); |
$$symbp{$mapid}=$$mapp{$id}.'___(all)'; |
|
} |
} |
} |
} |
|
|
Line 1071 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 1563 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 2034 sub crsenv {
|
Line 2073 sub crsenv {
|
if ($name =~ /^default_enrollment_(start|end)_date$/) { |
if ($name =~ /^default_enrollment_(start|end)_date$/) { |
$value=&Apache::lonhtmlcommon::get_date_from_form($name.'_value'); |
$value=&Apache::lonhtmlcommon::get_date_from_form($name.'_value'); |
} |
} |
|
# |
|
# Deal with the emails |
|
if ($name =~ /\.email$/) { |
|
foreach my $specifier (split(',',$value)) { |
|
my ($user,$sections_or_groups)= |
|
($specifier=~/^([^\(]+)\(([^\)]+)\)/); |
|
if (!$sections_or_groups) { |
|
$user = $specifier; |
|
} |
|
my ($name,$domain) = split(':',$user); |
|
if (!defined($user) || !defined($domain)) { |
|
$setoutput.= '<br /> <span class="LC_error">'. |
|
&mt("Invalid email address specified, address must be of the form username:domain what was specified was ([_1])",$user). |
|
'</span>'; |
|
undef($value); |
|
} elsif (&Apache::lonnet::homeserver($user,$domain) eq 'no_host') { |
|
$setoutput.= '<br /> <span class="LC_error">'. |
|
&mt("Invalid email address specified, user [_1] is unknown.",$name). |
|
'</span>'; |
|
undef($value); |
|
} |
|
} |
|
} |
# Get existing cloners |
# Get existing cloners |
my @oldcloner = (); |
my @oldcloner = (); |
if ($name eq 'cloners') { |
if ($name eq 'cloners') { |
Line 2047 sub crsenv {
|
Line 2109 sub crsenv {
|
# |
# |
# Let the user know we made the changes |
# Let the user know we made the changes |
if ($name && defined($value)) { |
if ($name && defined($value)) { |
my $failed_cloners; |
my %failed_cloners; |
if ($name eq 'cloners') { |
if ($name eq 'cloners') { |
$value =~ s/\s//g; |
$value =~ s/\s//g; |
$value =~ s/^,//; |
$value =~ s/^,//; |
$value =~ s/,$//; |
$value =~ s/,$//; |
# check requested clones are valid users. |
# check requested clones are valid users. |
$failed_cloners = &check_cloners(\$value,\@oldcloner); |
%failed_cloners = &check_cloners(\$value,\@oldcloner); |
} |
} |
my $put_result = &Apache::lonnet::put('environment', |
my $put_result = &Apache::lonnet::put('environment', |
{$name=>$value},$dom,$crs); |
{$name=>$value},$dom,$crs); |
Line 2062 sub crsenv {
|
Line 2124 sub crsenv {
|
if ($name eq 'cloners') { |
if ($name eq 'cloners') { |
&change_clone($value,\@oldcloner); |
&change_clone($value,\@oldcloner); |
} |
} |
# Flush the course logs so course description is immediately updated |
# Update environment and nohist_courseids.db |
if ($name eq 'description' && defined($value)) { |
if ($name eq 'description' && defined($value)) { |
&Apache::lonnet::flushcourselogs(); |
my %crsinfo = |
|
&Apache::lonnet::courseiddump($dom,'.',1,'.','.', |
|
$crs,undef,undef,'Course'); |
|
&Apache::lonnet::appenv('course.'.$env{'request.course.id'}.'.description' => $value); |
|
if (ref($crsinfo{$env{'request.course.id'}}) eq 'HASH') { |
|
$crsinfo{$env{'request.course.id'}}{'description'} = $value; |
|
my $chome = &Apache::lonnet::homeserver($crs,$dom); |
|
my $putresult = |
|
&Apache::lonnet::courseidput($dom,\%crsinfo, |
|
$chome,'notime'); |
|
} |
} |
} |
} else { |
} else { |
$setoutput.=&mt('Unable to set').' <b>'.$name.'</b> '.&mt('to'). |
$setoutput.=&mt('Unable to set').' <b>'.$name.'</b> '.&mt('to'). |
' <b>'.$value.'</b> '.&mt('due to').' '.$put_result.'.<br />'; |
' <b>'.$value.'</b> '.&mt('due to').' '.$put_result.'.<br />'; |
} |
} |
if (($name eq 'cloners') && ($failed_cloners)) { |
if (($name eq 'cloners') && (keys(%failed_cloners) > 0)) { |
$setoutput.= &mt('Unable to include').' - <b>'.$failed_cloners.'</b>, '. |
$setoutput.= &mt('Unable to include').': '; |
&mt('reason').' - '.&mt('LON-CAPA user(s) do(es) not exist'). |
my @fails; |
'.<br />'.&mt('Please '). |
my $num = 0; |
' <a href="/adm/createuser">'. |
if (defined($failed_cloners{'format'})) { |
&mt('add the user(s)').'</a>, '. |
$fails[$num] .= '<b>'.$failed_cloners{'format'}. |
&mt('and then return to the '). |
'</b>, '.&mt('reason').' - '. |
'<a href="/admparmset?action=crsenv">'. |
&mt('Invalid format'); |
&mt('Course Parameters page').'</a> '. |
$num ++; |
&mt('to add the new user(s) to the list of possible cloners'). |
} |
'.<br />'; |
if (defined($failed_cloners{'domain'})) { |
|
$fails[$num] .= '<b>'.$failed_cloners{'domain'}. |
|
'</b>, '.&mt('reason').' - '. |
|
&mt('Domain does not exist'); |
|
$num ++; |
|
} |
|
if (defined($failed_cloners{'newuser'})) { |
|
$fails[$num] .= '<b>'.$failed_cloners{'newuser'}. '</b>, '.&mt('reason').' - '. |
|
&mt('LON-CAPA user(s) do(es) not exist.'). |
|
'.<br />'.&mt('Please '). |
|
' <a href="/adm/createuser">'. |
|
&mt('add the user(s)').'</a>, '. |
|
&mt('and then return to the '). |
|
'<a href="/adm/parmset?action=crsenv">'. |
|
&mt('Course Parameters page').'</a> '. |
|
&mt('to add the new user(s) to the list of possible cloners'); |
|
} |
|
$setoutput .= join('; ',@fails).'.<br />'; |
} |
} |
} |
} |
} |
} |
Line 2111 sub crsenv {
|
Line 2200 sub crsenv {
|
'courseid' => '<b>'.&mt('Course ID or number'). |
'courseid' => '<b>'.&mt('Course ID or number'). |
'</b><br />'. |
'</b><br />'. |
'('.&mt('internal').', '.&mt('optional').')', |
'('.&mt('internal').', '.&mt('optional').')', |
'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,*:domain)</tt><br />'.&mt('Users with active Course Coordinator role in course are permitted to clone and need not be included.<br /> |
|
Use *:domain to allow course to be cloned by anyone in the specified domain.<br /> |
|
Use * to allow unrestricted cloning in all domains.'), |
'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 2121 sub crsenv {
|
Line 2214 sub crsenv {
|
'question.email' => '<b>'.&mt('Feedback Addresses for Resource Content Question'). |
'question.email' => '<b>'.&mt('Feedback Addresses for Resource Content Question'). |
'</b><br />(<tt>user:domain,'. |
'</b><br />(<tt>user:domain,'. |
'user:domain(section;section;...;*;...),...</tt>)', |
'user:domain(section;section;...;*;...),...</tt>)', |
|
'question.email.text' => '<b>'.&mt('Custom Text for Resource Content Question Option in Feedback'). |
|
'</b>', |
'comment.email' => '<b>'.&mt('Feedback Addresses for Course Content Comments').'</b><br />'. |
'comment.email' => '<b>'.&mt('Feedback Addresses for Course Content Comments').'</b><br />'. |
'(<tt>user:domain,user:domain(section;section;...;*;...),...</tt>)', |
'(<tt>user:domain,user:domain(section;section;...;*;...),...</tt>)', |
|
'comment.email.text' => '<b>'.&mt('Custom Text for Course Content Option in Feedback'). |
|
'</b>', |
'policy.email' => '<b>'.&mt('Feedback Addresses for Course Policy').'</b>'. |
'policy.email' => '<b>'.&mt('Feedback Addresses for Course Policy').'</b>'. |
'<br />(<tt>user:domain,user:domain(section;section;...;*;...),...</tt>)', |
'<br />(<tt>user:domain,user:domain(section;section;...;*;...),...</tt>)', |
|
'policy.email.text' => '<b>'.&mt('Custom Text for Course Policy Option in Feedback'). |
|
'</b>', |
'hideemptyrows' => '<b>'.&mt('Hide Empty Rows in Spreadsheets').'</b><br />'. |
'hideemptyrows' => '<b>'.&mt('Hide Empty Rows in Spreadsheets').'</b><br />'. |
'('.&mt('"[_1]" for default hiding','<tt>yes</tt>').')', |
'('.&mt('"[_1]" for default hiding','<tt>yes</tt>').')', |
'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 2143 sub crsenv {
|
Line 2243 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 2194 sub crsenv {
|
Line 2294 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 2207 sub crsenv {
|
Line 2304 sub crsenv {
|
=> '<b>'.&mt('Disable display of problem receipts').'</b><br />'. |
=> '<b>'.&mt('Disable display of problem receipts').'</b><br />'. |
' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')', |
' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')', |
'task_messages' |
'task_messages' |
=> '<b>'.&mt('Send message to student when clicking Done on Tasks. [_1] to send a message only to student, [_2] to send message to student and add record to user information page for instructors. Leave blank to disable.','<tt>only_student</tt>','<tt>student_and_user_notes_screen</tt>').'</b>', |
=> '<b>'.&mt('Send message to student when clicking Done on Tasks').'</b><br /> ('.&mt('[_1] to send a message only to student, [_2] to send message to student and add record to user information page for instructors. Leave blank to disable.','<tt>only_student</tt>','<tt>student_and_user_notes_screen</tt>').')', |
'disablesigfigs' |
'disablesigfigs' |
=> '<b>'.&mt('Disable checking of Significant Figures').'</b><br />'. |
=> '<b>'.&mt('Disable checking of Significant Figures').'</b><br />'. |
' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')', |
' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')', |
Line 2217 sub crsenv {
|
Line 2314 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','comment.email','policy.email', |
'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 2244 sub crsenv {
|
Line 2346 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 2327 $start_header_row
|
Line 2430 $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 2400 sub storedata {
|
Line 2503 sub storedata {
|
if ($tuname) { |
if ($tuname) { |
$tkey=~s/\.\[useropt\:$tuname\:$tudom\]\./\./; |
$tkey=~s/\.\[useropt\:$tuname\:$tudom\]\./\./; |
} |
} |
if ($cmd eq 'set') { |
if ($cmd eq 'set' || $cmd eq 'datepointer') { |
my $data=$env{$_}; |
my ($data, $typeof, $text); |
my $typeof=$env{'form.typeof_'.$thiskey}; |
if ($cmd eq 'set') { |
if ($$olddata{$thiskey} ne $data) { |
$data=$env{$_}; |
|
$typeof=$env{'form.typeof_'.$thiskey}; |
|
$text = &mt('Saved modified parameter for'); |
|
} elsif ($cmd eq 'datepointer') { |
|
$data=&Apache::lonhtmlcommon::get_date_from_form($env{$_}); |
|
$typeof=$env{'form.typeof_'.$thiskey}; |
|
$text = &mt('Saved modified date for'); |
|
} |
|
if (defined($data) and $$olddata{$thiskey} ne $data) { |
if ($tuname) { |
if ($tuname) { |
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data, |
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data, |
$tkey.'.type' => $typeof}, |
$tkey.'.type' => $typeof}, |
$tudom,$tuname) eq 'ok') { |
$tudom,$tuname) eq 'ok') { |
&log_parmset({$tkey=>$data,$tkey.'.type' => $typeof},0,$tuname,$tudom); |
&log_parmset({$tkey=>$data,$tkey.'.type' => $typeof},0,$tuname,$tudom); |
$r->print('<br />'.&mt('Stored modified parameter for').' '. |
$r->print('<br />'.$text.' '. |
&Apache::loncommon::plainname($tuname,$tudom)); |
&Apache::loncommon::plainname($tuname,$tudom)); |
} else { |
} else { |
$r->print('<div class="LC_error">'. |
$r->print('<div class="LC_error">'. |
&mt('Error storing parameters').'</div>'); |
&mt('Error saving parameters').'</div>'); |
} |
} |
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
} else { |
} else { |
Line 2434 sub storedata {
|
Line 2545 sub storedata {
|
} else { |
} else { |
push (@deldata,$thiskey,$thiskey.'.type'); |
push (@deldata,$thiskey,$thiskey.'.type'); |
} |
} |
} elsif ($cmd eq 'datepointer') { |
|
my $data=&Apache::lonhtmlcommon::get_date_from_form($env{$_}); |
|
my $typeof=$env{'form.typeof_'.$thiskey}; |
|
if (defined($data) and $$olddata{$thiskey} ne $data) { |
|
if ($tuname) { |
|
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data, |
|
$tkey.'.type' => $typeof}, |
|
$tudom,$tuname) eq 'ok') { |
|
&log_parmset({$tkey=>$data,$tkey.'.type' => $typeof},0,$tuname,$tudom); |
|
$r->print('<br />'.&mt('Stored modified date for').' '.&Apache::loncommon::plainname($tuname,$tudom)); |
|
} else { |
|
$r->print('<div class="LC_error">'. |
|
&mt('Error storing parameters').'</div>'); |
|
} |
|
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
|
} else { |
|
$newdata{$thiskey}=$data; |
|
$newdata{$thiskey.'.type'}=$typeof; |
|
} |
|
} |
|
} |
} |
} |
} |
} |
} |
Line 2475 sub storedata {
|
Line 2566 sub storedata {
|
if ($putentries) { |
if ($putentries) { |
if (&Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs) eq 'ok') { |
if (&Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs) eq 'ok') { |
&log_parmset(\%newdata,0); |
&log_parmset(\%newdata,0); |
$r->print('<h3>'.&mt('Stored [_1] parameter(s)',$putentries/2).'</h3>'); |
$r->print('<h3>'.&mt('Saved [_1] parameter(s)',$putentries/2).'</h3>'); |
} else { |
} else { |
$r->print('<div class="LC_error">'. |
$r->print('<div class="LC_error">'. |
&mt('Error storing parameters').'</div>'); |
&mt('Error saving parameters').'</div>'); |
} |
} |
&Apache::lonnet::devalidatecourseresdata($crs,$dom); |
&Apache::lonnet::devalidatecourseresdata($crs,$dom); |
} |
} |
Line 2489 sub extractuser {
|
Line 2580 sub extractuser {
|
return ($key=~/^$env{'request.course.id'}.\[useropt\:($match_username)\:($match_domain)\]\./); |
return ($key=~/^$env{'request.course.id'}.\[useropt\:($match_username)\:($match_domain)\]\./); |
} |
} |
|
|
|
sub parse_listdata_key { |
|
my ($key,$listdata) = @_; |
|
# split into student/section affected, and |
|
# the realm (folder/resource part and parameter |
|
my ($student,$realm) = |
|
($key=~/^\Q$env{'request.course.id'}\E\.\[([^\.]+)\]\.(.+)$/); |
|
# if course wide student would be undefined |
|
if (!defined($student)) { |
|
($realm)=($key=~/^\Q$env{'request.course.id'}\E\.(.+)$/); |
|
} |
|
# strip off the .type if it's not the Question type parameter |
|
if ($realm=~/\.type$/ && !exists($listdata->{$key.'.type'})) { |
|
$realm=~s/\.type//; |
|
} |
|
# split into resource+part and parameter name |
|
my ($res, $parm) = ($realm=~/^(.*)\.(.*)$/); |
|
my ($res, $part) = ($res =~/^(.*)\.(.*)$/); |
|
return ($student,$res,$part,$parm); |
|
} |
|
|
sub listdata { |
sub listdata { |
my ($r,$resourcedata,$listdata,$sortorder)=@_; |
my ($r,$resourcedata,$listdata,$sortorder)=@_; |
# Start list output |
# Start list output |
Line 2500 sub listdata {
|
Line 2611 sub listdata {
|
$tableopen=0; |
$tableopen=0; |
my $foundkeys=0; |
my $foundkeys=0; |
my %keyorder=&standardkeyorder(); |
my %keyorder=&standardkeyorder(); |
|
|
foreach my $thiskey (sort { |
foreach my $thiskey (sort { |
|
my ($astudent,$ares,$apart,$aparm) = &parse_listdata_key($a,$listdata); |
|
my ($bstudent,$bres,$bpart,$bparm) = &parse_listdata_key($b,$listdata); |
|
|
|
# get the numerical order for the param |
|
$aparm=$keyorder{'parameter_0_'.$aparm}; |
|
$bparm=$keyorder{'parameter_0_'.$bparm}; |
|
|
|
my $result=0; |
|
|
if ($sortorder eq 'realmstudent') { |
if ($sortorder eq 'realmstudent') { |
my ($astudent,$arealm)=($a=~/^\Q$env{'request.course.id'}\E\.\[([^\.]+)\]\.(.+)\.[^\.]+$/); |
if ($ares ne $bres ) { |
my ($bstudent,$brealm)=($b=~/^\Q$env{'request.course.id'}\E\.\[([^\.]+)\]\.(.+)\.[^\.]+$/); |
$result = ($ares cmp $bres); |
if (!defined($astudent)) { |
} elsif ($astudent ne $bstudent) { |
($arealm)=($a=~/^\Q$env{'request.course.id'}\E\.(.+)$/); |
$result = ($astudent cmp $bstudent); |
} |
} elsif ($apart ne $bpart ) { |
if (!defined($bstudent)) { |
$result = ($apart cmp $bpart); |
($brealm)=($b=~/^\Q$env{'request.course.id'}\E\.(.+)$/); |
|
} |
|
$arealm=~s/\.type//; |
|
my ($ares, $aparm) = ($arealm=~/^(.*)\.(.*)$/); |
|
$aparm=$keyorder{'parameter_0_'.$aparm}; |
|
$brealm=~s/\.type//; |
|
my ($bres, $bparm) = ($brealm=~/^(.*)\.(.*)$/); |
|
$bparm=$keyorder{'parameter_0_'.$bparm}; |
|
if ($ares eq $bres) { |
|
if (defined($aparm) && defined($bparm)) { |
|
($aparm <=> $bparm); |
|
} elsif (defined($aparm)) { |
|
-1; |
|
} elsif (defined($bparm)) { |
|
1; |
|
} else { |
|
($arealm cmp $brealm) || ($astudent cmp $bstudent); |
|
} |
|
} else { |
|
($arealm cmp $brealm) || ($astudent cmp $bstudent); |
|
} |
} |
} else { |
} else { |
$a cmp $b; |
if ($astudent ne $bstudent) { |
|
$result = ($astudent cmp $bstudent); |
|
} elsif ($ares ne $bres ) { |
|
$result = ($ares cmp $bres); |
|
} elsif ($apart ne $bpart ) { |
|
$result = ($apart cmp $bpart); |
|
} |
} |
} |
|
|
|
if (!$result) { |
|
if (defined($aparm) && defined($bparm)) { |
|
$result = ($aparm <=> $bparm); |
|
} elsif (defined($aparm)) { |
|
$result = -1; |
|
} elsif (defined($bparm)) { |
|
$result = 1; |
|
} |
|
} |
|
|
|
$result; |
} keys %{$listdata}) { |
} keys %{$listdata}) { |
|
|
if ($$listdata{$thiskey.'.type'}) { |
if ($$listdata{$thiskey.'.type'}) { |
my $thistype=$$listdata{$thiskey.'.type'}; |
my $thistype=$$listdata{$thiskey.'.type'}; |
if ($$resourcedata{$thiskey.'.type'}) { |
if ($$resourcedata{$thiskey.'.type'}) { |
Line 2608 sub listdata {
|
Line 2727 sub listdata {
|
'<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'. |
'<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'. |
&date_sanity_info($$resourcedata{$thiskey}) |
&date_sanity_info($$resourcedata{$thiskey}) |
); |
); |
} elsif ($thistype eq 'string_yesno') { |
} elsif ($thistype =~ m/^string/) { |
my $showval; |
$r->print(&string_selector($thistype,$thiskey, |
if (defined($$resourcedata{$thiskey})) { |
$$resourcedata{$thiskey})); |
$showval=$$resourcedata{$thiskey}; |
|
} |
|
$r->print('<label><input type="radio" name="set_'.$thiskey. |
|
'" value="yes"'); |
|
if ($showval eq 'yes') { |
|
$r->print(' checked="checked"'); |
|
} |
|
$r->print(' />'.&mt('Yes').'</label> '); |
|
$r->print('<label><input type="radio" name="set_'.$thiskey. |
|
'" value="no"'); |
|
if ($showval eq 'no') { |
|
$r->print(' checked="checked"'); |
|
} |
|
$r->print(' />'.&mt('No').'</label>'); |
|
} else { |
} else { |
my $showval; |
$r->print(&default_selector($thiskey,$$resourcedata{$thiskey})); |
if (defined($$resourcedata{$thiskey})) { |
|
$showval=$$resourcedata{$thiskey}; |
|
} |
|
$r->print('<input type="text" name="set_'.$thiskey.'" value="'. |
|
$showval.'">'); |
|
} |
} |
$r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'. |
$r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'. |
$thistype.'">'); |
$thistype.'">'); |
Line 2641 sub listdata {
|
Line 2741 sub listdata {
|
return $foundkeys; |
return $foundkeys; |
} |
} |
|
|
|
sub default_selector { |
|
my ($thiskey, $showval) = @_; |
|
return '<input type="text" name="set_'.$thiskey.'" value="'.$showval.'">' ; |
|
} |
|
|
|
my %strings = |
|
( |
|
'string_yesno' |
|
=> [[ 'yes', 'Yes' ], |
|
[ 'no', 'No' ]], |
|
'string_problemstatus' |
|
=> [[ 'yes', 'Yes' ], |
|
[ 'no', 'No, don\'t show correct/incorrect feedback.' ], |
|
[ 'no_feedback_ever', 'No, show no feedback at all.' ]], |
|
); |
|
|
|
|
|
sub string_selector { |
|
my ($thistype, $thiskey, $showval) = @_; |
|
|
|
if (!exists($strings{$thistype})) { |
|
return &default_selector($thiskey,$showval); |
|
} |
|
|
|
my $result; |
|
foreach my $possibilities (@{ $strings{$thistype} }) { |
|
my ($name, $description) = @{ $possibilities }; |
|
$result .= '<label><input type="radio" name="set_'.$thiskey. |
|
'" value="'.$name.'"'; |
|
if ($showval eq $name) { |
|
$result .= ' checked="checked"'; |
|
} |
|
$result .= ' />'.&mt($description).'</label> '; |
|
} |
|
return $result; |
|
} |
|
|
sub newoverview { |
sub newoverview { |
my ($r) = @_; |
my ($r) = @_; |
|
|
Line 2682 ENDOVER
|
Line 2819 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 2703 ENDOVER
|
Line 2840 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 2759 ENDOVER
|
Line 2899 ENDOVER
|
&listdata($r,$resourcedata,$listdata,$sortorder); |
&listdata($r,$resourcedata,$listdata,$sortorder); |
} |
} |
$r->print(&tableend(). |
$r->print(&tableend(). |
((($env{'form.store'}) || ($env{'form.dis'}))?'<p><input type="submit" name="store" value="'.&mt('Store').'" /></p>':''). |
((($env{'form.store'}) || ($env{'form.dis'}))?'<p><input type="submit" name="store" value="'.&mt('Save').'" /></p>':''). |
'</form>'.&Apache::loncommon::end_page()); |
'</form>'.&Apache::loncommon::end_page()); |
} |
} |
|
|
Line 2868 ENDOVER
|
Line 3008 ENDOVER
|
next if (!exists($resourcedata->{$thiskey.'.type'}) |
next if (!exists($resourcedata->{$thiskey.'.type'}) |
&& $thiskey=~/\.type$/); |
&& $thiskey=~/\.type$/); |
my %data = &parse_key($thiskey); |
my %data = &parse_key($thiskey); |
if (exists($data{'realm_exists'}) |
if (1) { #exists($data{'realm_exists'}) |
&& !$data{'realm_exists'}) { |
#&& !$data{'realm_exists'}) { |
$r->print(&Apache::loncommon::start_data_table_row(). |
$r->print(&Apache::loncommon::start_data_table_row(). |
'<tr>'. |
'<tr>'. |
'<td><input type="checkbox" name="del_'.$thiskey.'" /></td>' ); |
'<td><input type="checkbox" name="del_'.$thiskey.'" /></td>' ); |
|
|
$r->print('<td>'); |
$r->print('<td>'); |
|
my $display_value = $resourcedata->{$thiskey}; |
|
if (&isdateparm($resourcedata->{$thiskey.'.type'})) { |
|
$display_value = |
|
&Apache::lonlocal::locallocaltime($display_value); |
|
} |
$r->print(&mt('Parameter: "[_1]" with value: "[_2]"', |
$r->print(&mt('Parameter: "[_1]" with value: "[_2]"', |
&standard_parameter_names($data{'parameter_name'}), |
&standard_parameter_names($data{'parameter_name'}), |
$resourcedata->{$thiskey})); |
$resourcedata->{$thiskey})); |
Line 2899 ENDOVER
|
Line 3044 ENDOVER
|
$r->print(&mt('Resource: [_1] <br /> with ID: [_2] <br /> in folder [_3]', |
$r->print(&mt('Resource: [_1] <br /> with ID: [_2] <br /> in folder [_3]', |
$url,$resid,$map)); |
$url,$resid,$map)); |
} |
} |
$r->print(&mt('Part: [_1]',$data{'parameter_part'})); |
$r->print(' <br /> '.&mt('Part: [_1]',$data{'parameter_part'})); |
$r->print('</td></tr>'); |
$r->print('</td></tr>'); |
|
|
} |
} |
Line 2935 sub parse_key {
|
Line 3080 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 2982 where $action is add or drop, and $clone
|
Line 3126 where $action is add or drop, and $clone
|
user for whom cloning ability is to be changed in course. |
user for whom cloning ability is to be changed in course. |
|
|
=cut |
=cut |
|
|
################################################## |
################################################## |
################################################## |
################################################## |
|
|
sub extract_cloners { |
sub extract_cloners { |
my ($clonelist,$allowclone) = @_; |
my ($clonelist,$allowclone) = @_; |
if ($clonelist =~ /,/) { |
if ($clonelist =~ /,/) { |
@{$allowclone} = split/,/,$clonelist; |
@{$allowclone} = split(/,/,$clonelist); |
} else { |
} else { |
$$allowclone[0] = $clonelist; |
$$allowclone[0] = $clonelist; |
} |
} |
} |
} |
|
|
|
|
sub check_cloners { |
sub check_cloners { |
my ($clonelist,$oldcloner) = @_; |
my ($clonelist,$oldcloner) = @_; |
my ($clean_clonelist,$disallowed); |
my ($clean_clonelist,%disallowed); |
my @allowclone = (); |
my @allowclone = (); |
&extract_cloners($$clonelist,\@allowclone); |
&extract_cloners($$clonelist,\@allowclone); |
foreach my $currclone (@allowclone) { |
foreach my $currclone (@allowclone) { |
if (!grep/^$currclone$/,@$oldcloner) { |
if (!grep(/^\Q$currclone\E$/,@$oldcloner)) { |
my ($uname,$udom) = split/:/,$currclone; |
if ($currclone eq '*') { |
if ($uname && $udom) { |
$clean_clonelist .= $currclone.','; |
if (&Apache::lonnet::homeserver($uname,$udom) eq 'no_host') { |
} else { |
$disallowed .= $currclone.','; |
my ($uname,$udom) = split(/:/,$currclone); |
|
if ($uname eq '*') { |
|
if ($udom =~ /^$match_domain$/) { |
|
if (!&Apache::lonnet::domain($udom)) { |
|
$disallowed{'domain'} .= $currclone.','; |
|
} else { |
|
$clean_clonelist .= $currclone.','; |
|
} |
|
} else { |
|
$disallowed{'format'} .= $currclone.','; |
|
} |
|
} elsif ($currclone !~/^($match_username)\:($match_domain)$/) { |
|
$disallowed{'format'} .= $currclone.','; |
} else { |
} else { |
$clean_clonelist .= $currclone.','; |
if (&Apache::lonnet::homeserver($uname,$udom) eq 'no_host') { |
|
$disallowed{'newuser'} .= $currclone.','; |
|
} else { |
|
$clean_clonelist .= $currclone.','; |
|
} |
} |
} |
} |
} |
} else { |
} else { |
$clean_clonelist .= $currclone.','; |
$clean_clonelist .= $currclone.','; |
} |
} |
} |
} |
if ($disallowed) { |
foreach my $key (keys(%disallowed)) { |
$disallowed =~ s/,$//; |
$disallowed{$key} =~ s/,$//; |
} |
} |
if ($clean_clonelist) { |
if ($clean_clonelist) { |
$clean_clonelist =~ s/,$//; |
$clean_clonelist =~ s/,$//; |
} |
} |
$$clonelist = $clean_clonelist; |
$$clonelist = $clean_clonelist; |
return $disallowed; |
return %disallowed; |
} |
} |
|
|
sub change_clone { |
sub change_clone { |
my ($clonelist,$oldcloner) = @_; |
my ($clonelist,$oldcloner) = @_; |
Line 3036 sub change_clone {
|
Line 3195 sub change_clone {
|
my @allowclone; |
my @allowclone; |
&extract_cloners($clonelist,\@allowclone); |
&extract_cloners($clonelist,\@allowclone); |
foreach my $currclone (@allowclone) { |
foreach my $currclone (@allowclone) { |
if (!grep/^$currclone$/,@$oldcloner) { |
if (!grep(/^$currclone$/,@$oldcloner)) { |
($uname,$udom) = split/:/,$currclone; |
if ($currclone ne '*') { |
if ($uname && $udom) { |
($uname,$udom) = split(/:/,$currclone); |
unless (&Apache::lonnet::homeserver($uname,$udom) eq 'no_host') { |
if ($uname && $udom && $uname ne '*') { |
my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable'); |
if (&Apache::lonnet::homeserver($uname,$udom) ne 'no_host') { |
if ($currclonecrs{'cloneable'} !~ /\Q$clone_crs\E/) { |
my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable'); |
if ($currclonecrs{'cloneable'} eq '') { |
if ($currclonecrs{'cloneable'} !~ /\Q$clone_crs\E/) { |
$currclonecrs{'cloneable'} = $clone_crs; |
if ($currclonecrs{'cloneable'} eq '') { |
} else { |
$currclonecrs{'cloneable'} = $clone_crs; |
$currclonecrs{'cloneable'} .= ','.$clone_crs; |
} else { |
|
$currclonecrs{'cloneable'} .= ','.$clone_crs; |
|
} |
|
&Apache::lonnet::put('environment',\%currclonecrs,$udom,$uname); |
} |
} |
&Apache::lonnet::put('environment',\%currclonecrs,$udom,$uname); |
|
} |
} |
} |
} |
} |
} |
} |
} |
} |
} |
foreach my $oldclone (@$oldcloner) { |
foreach my $oldclone (@$oldcloner) { |
if (!grep/^$oldclone$/,@allowclone) { |
if (!grep(/^\Q$oldclone\E$/,@allowclone)) { |
($uname,$udom) = split/:/,$oldclone; |
if ($oldclone ne '*') { |
if ($uname && $udom) { |
($uname,$udom) = split(/:/,$oldclone); |
unless (&Apache::lonnet::homeserver($uname,$udom) eq 'no_host') { |
if ($uname && $udom && $uname ne '*' ) { |
my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable'); |
if (&Apache::lonnet::homeserver($uname,$udom) ne 'no_host') { |
my %newclonecrs = (); |
my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable'); |
if ($currclonecrs{'cloneable'} =~ /\Q$clone_crs\E/) { |
my %newclonecrs = (); |
if ($currclonecrs{'cloneable'} =~ /,/) { |
if ($currclonecrs{'cloneable'} =~ /\Q$clone_crs\E/) { |
my @currclonecrs = split/,/,$currclonecrs{'cloneable'}; |
if ($currclonecrs{'cloneable'} =~ /,/) { |
foreach (@currclonecrs) { |
my @currclonecrs = split/,/,$currclonecrs{'cloneable'}; |
unless ($_ eq $clone_crs) { |
foreach my $crs (@currclonecrs) { |
$newclonecrs{'cloneable'} .= $_.','; |
if ($crs ne $clone_crs) { |
|
$newclonecrs{'cloneable'} .= $crs.','; |
|
} |
} |
} |
|
$newclonecrs{'cloneable'} =~ s/,$//; |
|
} else { |
|
$newclonecrs{'cloneable'} = ''; |
} |
} |
$newclonecrs{'cloneable'} =~ s/,$//; |
&Apache::lonnet::put('environment',\%newclonecrs,$udom,$uname); |
} else { |
|
$newclonecrs{'cloneable'} = ''; |
|
} |
} |
&Apache::lonnet::put('environment',\%newclonecrs,$udom,$uname); |
|
} |
} |
} |
} |
} |
} |
Line 3111 ENDMAINFORMHEAD
|
Line 3274 ENDMAINFORMHEAD
|
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 $vgr = &Apache::lonnet::allowed('vgr',$env{'request.course.id'}); |
my $vgr = &Apache::lonnet::allowed('vgr',$env{'request.course.id'}); |
|
my $mgr = &Apache::lonnet::allowed('mgr',$env{'request.course.id'}); |
|
|
my @menu = |
my @menu = |
( { divider=>'Settings for Your Course', |
( { divider=>'Settings for Your Course', |
Line 3128 ENDMAINFORMHEAD
|
Line 3292 ENDMAINFORMHEAD
|
url => '/adm/slotrequest?command=showslots', |
url => '/adm/slotrequest?command=showslots', |
permission => $vgr, |
permission => $vgr, |
}, |
}, |
|
{ text => 'Reset Student Access Times', |
|
url => '/adm/helper/resettimes.helper', |
|
permission => $mgr, |
|
}, |
|
|
{ text => 'Set Parameter Setting Default Actions', |
{ text => 'Set Parameter Setting Default Actions', |
action => 'setdefaults', |
action => 'setdefaults', |
permission => $parm_permission, |
permission => $parm_permission, |
Line 3288 sub order_meta_fields {
|
Line 3457 sub order_meta_fields {
|
{'metadata.addedorder'=>$ordered_fields},$dom,$crs); |
{'metadata.addedorder'=>$ordered_fields},$dom,$crs); |
&Apache::lonnet::appenv('course.'.$env{'request.course.id'}.'.metadata.addedorder' => $ordered_fields); |
&Apache::lonnet::appenv('course.'.$env{'request.course.id'}.'.metadata.addedorder' => $ordered_fields); |
} |
} |
my $fields = &get_added_meta_fieldnames(); |
my $fields = &get_added_meta_fieldnames($env{'request.course.id'}); |
my $ordered_fields; |
my $ordered_fields; |
my @fields_in_order = split /,/,$env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'}; |
my @fields_in_order = split /,/,$env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'}; |
if (!@fields_in_order) { |
if (!@fields_in_order) { |
Line 3323 sub order_meta_fields {
|
Line 3492 sub order_meta_fields {
|
$r->print('</table>'); |
$r->print('</table>'); |
return 'ok'; |
return 'ok'; |
} |
} |
|
sub continue { |
|
my $output; |
|
$output .= '<form action="" method="post">'; |
|
$output .= '<input type="hidden" name="action" value="setrestrictmeta" />'; |
|
$output .= '<input type="submit" value="Continue" />'; |
|
return ($output); |
|
} |
sub addmetafield { |
sub addmetafield { |
my ($r)=@_; |
my ($r)=@_; |
$r->print(&Apache::loncommon::start_page('Add Metadata Field')); |
$r->print(&Apache::loncommon::start_page('Add Metadata Field')); |
Line 3330 sub addmetafield {
|
Line 3506 sub addmetafield {
|
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'}; |
if (exists($env{'form.undelete'})) { |
if (exists($env{'form.undelete'})) { |
my @meta_fields = &Apache::loncommon::get_env_multiple('form.undelete'); |
my @meta_fields = &Apache::loncommon::get_env_multiple('form.undeletefield'); |
foreach my $meta_field(@meta_fields) { |
foreach my $meta_field(@meta_fields) { |
my $options = $env{'course.'.$env{'request.course.id'}.'.metadata.'.$meta_field.'.options'}; |
my $options = $env{'course.'.$env{'request.course.id'}.'.metadata.'.$meta_field.'.options'}; |
$options =~ s/deleted//; |
$options =~ s/deleted//; |
Line 3340 sub addmetafield {
|
Line 3516 sub addmetafield {
|
|
|
$r->print('Undeleted Metadata Field <strong>'.$env{'course.'.$env{'request.course.id'}.'.metadata.'.$meta_field.'.added'}."</strong> with result ".$put_result.'<br />'); |
$r->print('Undeleted Metadata Field <strong>'.$env{'course.'.$env{'request.course.id'}.'.metadata.'.$meta_field.'.added'}."</strong> with result ".$put_result.'<br />'); |
} |
} |
$r->print('<form action="" method="post">'); |
$r->print(&continue()); |
$r->print('<input type="hidden" name="action" value="setrestrictmeta" />'); |
|
$r->print('<input type="submit" value="Continue" />'); |
|
} elsif (exists($env{'form.fieldname'})) { |
} elsif (exists($env{'form.fieldname'})) { |
my $meta_field = $env{'form.fieldname'}; |
my $meta_field = $env{'form.fieldname'}; |
my $display_field = $env{'form.fieldname'}; |
my $display_field = $env{'form.fieldname'}; |
Line 3352 sub addmetafield {
|
Line 3526 sub addmetafield {
|
{'metadata.'.$meta_field.'.values'=>"", |
{'metadata.'.$meta_field.'.values'=>"", |
'metadata.'.$meta_field.'.added'=>"$display_field", |
'metadata.'.$meta_field.'.added'=>"$display_field", |
'metadata.'.$meta_field.'.options'=>""},$dom,$crs); |
'metadata.'.$meta_field.'.options'=>""},$dom,$crs); |
$r->print('Added new Metadata Field '.$env{'form.fieldname'}." with result ".$put_result); |
$r->print('Added new Metadata Field <strong>'.$env{'form.fieldname'}."</strong> with result ".$put_result.'<br />'); |
|
$r->print(&continue()); |
} else { |
} else { |
my $fields = &get_deleted_meta_fieldnames(); |
my $fields = &get_deleted_meta_fieldnames($env{'request.course.id'}); |
if ($fields) { |
if ($fields) { |
$r->print('You may undelete previously deleted fields.<br />Check those you wish to undelete and click Undelete.<br />'); |
$r->print('You may undelete previously deleted fields.<br />Check those you wish to undelete and click Undelete.<br />'); |
$r->print('<form method="post" action="">'); |
$r->print('<form method="post" action="">'); |
foreach my $key(keys(%$fields)) { |
foreach my $key(keys(%$fields)) { |
$r->print('<input type="checkbox" name="undelete" value="'.$key.'" />'.$$fields{$key}.'<br /'); |
$r->print('<input type="checkbox" name="undeletefield" value="'.$key.'" />'.$$fields{$key}.'<br /'); |
} |
} |
$r->print('<input type="submit" name="undelete" value="Undelete" />'); |
$r->print('<input type="submit" name="undelete" value="Undelete" />'); |
$r->print('</form>'); |
$r->print('</form>'); |
Line 3367 sub addmetafield {
|
Line 3542 sub addmetafield {
|
$r->print('<hr /><strong>Or</strong> you may enter a new metadata field name.<form method="post" action="/adm/parmset?action=addmetadata"'); |
$r->print('<hr /><strong>Or</strong> you may enter a new metadata field name.<form method="post" action="/adm/parmset?action=addmetadata"'); |
$r->print('<input type="text" name="fieldname" /><br />'); |
$r->print('<input type="text" name="fieldname" /><br />'); |
$r->print('<input type="submit" value="Add Metadata Field" />'); |
$r->print('<input type="submit" value="Add Metadata Field" />'); |
$r->print('</form>'); |
|
} |
} |
|
$r->print('</form>'); |
} |
} |
sub setrestrictmeta { |
sub setrestrictmeta { |
my ($r)=@_; |
my ($r)=@_; |
Line 3419 sub setrestrictmeta {
|
Line 3594 sub setrestrictmeta {
|
# Get the default metadata fields |
# Get the default metadata fields |
my %metadata_fields = &Apache::lonmeta::fieldnames('portfolio'); |
my %metadata_fields = &Apache::lonmeta::fieldnames('portfolio'); |
# Now get possible added metadata fields |
# Now get possible added metadata fields |
my $added_metadata_fields = &get_added_meta_fieldnames(\%metadata_fields); |
my $added_metadata_fields = &get_added_meta_fieldnames($env{'request.course.id'}); |
my $row_alt = 1; |
my $row_alt = 1; |
$output .= &Apache::loncommon::start_data_table(); |
$output .= &Apache::loncommon::start_data_table(); |
foreach my $field (sort(keys(%metadata_fields))) { |
foreach my $field (sort(keys(%metadata_fields))) { |
Line 3455 ENDenv
|
Line 3630 ENDenv
|
} |
} |
################################################## |
################################################## |
sub get_added_meta_fieldnames { |
sub get_added_meta_fieldnames { |
|
my ($cid) = @_; |
my %fields; |
my %fields; |
foreach my $key(%env) { |
foreach my $key(%env) { |
if ($key =~ m/\.metadata\.(.+)\.added$/) { |
if ($key =~ m/\Q$cid\E\.metadata\.(.+)\.added$/) { |
my $field_name = $1; |
my $field_name = $1; |
my ($display_field_name) = $env{$key}; |
my ($display_field_name) = $env{$key}; |
$fields{$field_name} = $display_field_name; |
$fields{$field_name} = $display_field_name; |
Line 3466 sub get_added_meta_fieldnames {
|
Line 3642 sub get_added_meta_fieldnames {
|
return \%fields; |
return \%fields; |
} |
} |
sub get_deleted_meta_fieldnames { |
sub get_deleted_meta_fieldnames { |
|
my ($cid) = @_; |
my %fields; |
my %fields; |
my ($default_fields) = @_; |
|
foreach my $key(%env) { |
foreach my $key(%env) { |
if ($key =~ m/\.metadata\.(.+)\.added$/) { |
if ($key =~ m/\Q$cid\E\.metadata\.(.+)\.added$/) { |
my $field_name = $1; |
my $field_name = $1; |
if ($env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.options'} =~ m/deleted/) { |
if ($env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.options'} =~ m/deleted/) { |
my ($display_field_name) = $env{$key}; |
my ($display_field_name) = $env{$key}; |
Line 3634 ENDYESNO
|
Line 3810 ENDYESNO
|
} |
} |
$r->print(&Apache::loncommon::end_data_table(). |
$r->print(&Apache::loncommon::end_data_table(). |
"\n<input type='submit' name='storerules' value='". |
"\n<input type='submit' name='storerules' value='". |
&mt('Store Rules')."' /></form>\n". |
&mt('Save Rules')."' /></form>\n". |
&Apache::loncommon::end_page()); |
&Apache::loncommon::end_page()); |
return; |
return; |
} |
} |
Line 3753 sub parm_change_log {
|
Line 3929 sub parm_change_log {
|
} |
} |
if ($last) { ($folder) = &Apache::lonnet::decode_symb($last); } |
if ($last) { ($folder) = &Apache::lonnet::decode_symb($last); } |
} |
} |
foreach my $id (sort { $parmlog{$b}{'exe_time'}<=>$parmlog{$a}{'exe_time'} } (keys(%parmlog))) { |
foreach my $id (sort |
|
{ |
|
if ($parmlog{$b}{'exe_time'} ne $parmlog{$a}{'exe_time'}) { |
|
return $parmlog{$b}{'exe_time'} <=>$parmlog{$a}{'exe_time'} |
|
} |
|
my $aid = (split('00000',$a))[-1]; |
|
my $bid = (split('00000',$b))[-1]; |
|
return $bid<=>$aid; |
|
} (keys(%parmlog))) { |
my @changes=keys(%{$parmlog{$id}{'logentry'}}); |
my @changes=keys(%{$parmlog{$id}{'logentry'}}); |
my $count = 0; |
my $count = 0; |
my $time = |
my $time = |
Line 3877 sub check_for_course_info {
|
Line 4061 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 3919 sub handler {
|
Line 4104 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 3991 sub handler {
|
Line 4172 sub handler {
|
} |
} |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
|
&reset_caches(); |
|
|
return OK; |
return OK; |
} |
} |
|
|