version 1.376.2.1, 2007/10/05 17:56:29
|
version 1.378, 2007/08/30 00:01:56
|
Line 577 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 613 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 1594 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 2101 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 2124 sub crsenv {
|
Line 2132 sub crsenv {
|
$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') && (keys(%failed_cloners) > 0)) { |
if (($name eq 'cloners') && ($failed_cloners)) { |
$setoutput.= &mt('Unable to include').': '; |
$setoutput.= &mt('Unable to include').' - <b>'.$failed_cloners.'</b>, '. |
my @fails; |
&mt('reason').' - '.&mt('LON-CAPA user(s) do(es) not exist'). |
my $num = 0; |
'.<br />'.&mt('Please '). |
if (defined($failed_cloners{'format'})) { |
' <a href="/adm/createuser">'. |
$fails[$num] .= '<b>'.$failed_cloners{'format'}. |
&mt('add the user(s)').'</a>, '. |
'</b>, '.&mt('reason').' - '. |
&mt('and then return to the '). |
&mt('Invalid format'); |
'<a href="/admparmset?action=crsenv">'. |
$num ++; |
&mt('Course Parameters page').'</a> '. |
} |
&mt('to add the new user(s) to the list of possible cloners'). |
if (defined($failed_cloners{'domain'})) { |
'.<br />'; |
$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 2182 sub crsenv {
|
Line 2173 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,*:domain)</tt><br />'.&mt('Users with active Course Coordinator role in course are permitted to clone and need not be included.<br /> |
'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.'), |
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 />'. |
'task_grading' => '<b>'.&mt('Bridge Task Grading').'</b><br />'. |
Line 2211 Use * to allow unrestricted cloning in a
|
Line 2200 Use * to allow unrestricted cloning in a
|
'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_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>'), |
'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 2225 Use * to allow unrestricted cloning in a
|
Line 2214 Use * to allow unrestricted cloning in a
|
'(<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 3074 where $action is add or drop, and $clone
|
Line 3063 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(/^\Q$currclone\E$/,@$oldcloner)) { |
if (!grep/^$currclone$/,@$oldcloner) { |
if ($currclone eq '*') { |
my ($uname,$udom) = split/:/,$currclone; |
$clean_clonelist .= $currclone.','; |
if ($uname && $udom) { |
} else { |
if (&Apache::lonnet::homeserver($uname,$udom) eq 'no_host') { |
my ($uname,$udom) = split(/:/,$currclone); |
$disallowed .= $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 { |
if (&Apache::lonnet::homeserver($uname,$udom) eq 'no_host') { |
$clean_clonelist .= $currclone.','; |
$disallowed{'newuser'} .= $currclone.','; |
|
} else { |
|
$clean_clonelist .= $currclone.','; |
|
} |
|
} |
} |
} |
} |
} else { |
} else { |
$clean_clonelist .= $currclone.','; |
$clean_clonelist .= $currclone.','; |
} |
} |
} |
} |
foreach my $key (keys(%disallowed)) { |
if ($disallowed) { |
$disallowed{$key} =~ s/,$//; |
$disallowed =~ 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 3143 sub change_clone {
|
Line 3117 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) { |
if ($currclone ne '*') { |
($uname,$udom) = split/:/,$currclone; |
($uname,$udom) = split(/:/,$currclone); |
if ($uname && $udom) { |
if ($uname && $udom && $uname ne '*') { |
unless (&Apache::lonnet::homeserver($uname,$udom) eq 'no_host') { |
if (&Apache::lonnet::homeserver($uname,$udom) ne 'no_host') { |
my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable'); |
my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable'); |
if ($currclonecrs{'cloneable'} !~ /\Q$clone_crs\E/) { |
if ($currclonecrs{'cloneable'} !~ /\Q$clone_crs\E/) { |
if ($currclonecrs{'cloneable'} eq '') { |
if ($currclonecrs{'cloneable'} eq '') { |
$currclonecrs{'cloneable'} = $clone_crs; |
$currclonecrs{'cloneable'} = $clone_crs; |
} else { |
} else { |
$currclonecrs{'cloneable'} .= ','.$clone_crs; |
$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(/^\Q$oldclone\E$/,@allowclone)) { |
if (!grep/^$oldclone$/,@allowclone) { |
if ($oldclone ne '*') { |
($uname,$udom) = split/:/,$oldclone; |
($uname,$udom) = split(/:/,$oldclone); |
if ($uname && $udom) { |
if ($uname && $udom && $uname ne '*' ) { |
unless (&Apache::lonnet::homeserver($uname,$udom) eq 'no_host') { |
if (&Apache::lonnet::homeserver($uname,$udom) ne 'no_host') { |
my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable'); |
my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable'); |
my %newclonecrs = (); |
my %newclonecrs = (); |
if ($currclonecrs{'cloneable'} =~ /\Q$clone_crs\E/) { |
if ($currclonecrs{'cloneable'} =~ /\Q$clone_crs\E/) { |
if ($currclonecrs{'cloneable'} =~ /,/) { |
if ($currclonecrs{'cloneable'} =~ /,/) { |
my @currclonecrs = split/,/,$currclonecrs{'cloneable'}; |
my @currclonecrs = split/,/,$currclonecrs{'cloneable'}; |
foreach (@currclonecrs) { |
foreach my $crs (@currclonecrs) { |
unless ($_ eq $clone_crs) { |
if ($crs ne $clone_crs) { |
$newclonecrs{'cloneable'} .= $_.','; |
$newclonecrs{'cloneable'} .= $crs.','; |
|
} |
|
} |
} |
$newclonecrs{'cloneable'} =~ s/,$//; |
|
} else { |
|
$newclonecrs{'cloneable'} = ''; |
|
} |
} |
&Apache::lonnet::put('environment',\%newclonecrs,$udom,$uname); |
$newclonecrs{'cloneable'} =~ s/,$//; |
|
} else { |
|
$newclonecrs{'cloneable'} = ''; |
} |
} |
|
&Apache::lonnet::put('environment',\%newclonecrs,$udom,$uname); |
} |
} |
} |
} |
} |
} |