version 1.492, 2010/01/30 17:35:10
|
version 1.506, 2011/01/13 17:44:30
|
Line 248 Variables used (guessed by Jeremy):
|
Line 248 Variables used (guessed by Jeremy):
|
|
|
=item parse_key() |
=item parse_key() |
|
|
=item check_cloners() : |
|
|
|
Checks if new users included in list of allowed cloners |
|
are valid users. Replaces supplied list with |
|
cleaned list containing only users with valid usernames |
|
and domains. |
|
|
|
Inputs: $clonelist, $oldcloner |
|
where $clonelist is ref to array of requested cloners, |
|
and $oldcloner is ref to array of currently allowed |
|
cloners. |
|
|
|
Returns: string - comma separated list of requested |
|
cloners (username:domain) who do not exist in system. |
|
|
|
=item change_clone() : |
|
|
|
Modifies the list of courses a user can clone (stored |
|
in the user's environment.db file), called when a |
|
change is made to the list of users allowed to clone |
|
a course. |
|
|
|
Inputs: $action,$cloner |
|
where $action is add or drop, and $cloner is identity of |
|
user for whom cloning ability is to be changed in course. |
|
|
|
|
|
=item check_cloners() |
|
|
|
=item change_clone() |
|
|
|
=item header() |
=item header() |
|
|
Output html header for page |
Output html header for page |
Line 333 use Apache::lonlocal;
|
Line 302 use Apache::lonlocal;
|
use Apache::lonnavmaps; |
use Apache::lonnavmaps; |
use Apache::longroup; |
use Apache::longroup; |
use Apache::lonrss; |
use Apache::lonrss; |
|
use HTML::Entities; |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA qw(:DEFAULT :match); |
|
|
|
|
Line 921 sub startpage {
|
Line 891 sub startpage {
|
{'add_entries' => \%loaditems,}); |
{'add_entries' => \%loaditems,}); |
my $breadcrumbs = |
my $breadcrumbs = |
&Apache::lonhtmlcommon::breadcrumbs('Table Mode Parameter Setting','Table_Mode'); |
&Apache::lonhtmlcommon::breadcrumbs('Table Mode Parameter Setting','Table_Mode'); |
|
my $escfilter=&Apache::lonhtmlcommon::entity_encode($env{'form.filter'}); |
|
my $escpart=&Apache::lonhtmlcommon::entity_encode($env{'form.part'}); |
$r->print(<<ENDHEAD); |
$r->print(<<ENDHEAD); |
$start_page |
$start_page |
$breadcrumbs |
$breadcrumbs |
Line 929 $breadcrumbs
|
Line 901 $breadcrumbs
|
<input type="hidden" value="" name="pres_type" /> |
<input type="hidden" value="" name="pres_type" /> |
<input type="hidden" value="" name="pres_marker" /> |
<input type="hidden" value="" name="pres_marker" /> |
<input type="hidden" value="1" name="prevvisit" /> |
<input type="hidden" value="1" name="prevvisit" /> |
|
<input type="hidden" value="$escfilter" name="filter" /> |
|
<input type="hidden" value="$escpart" name="part" /> |
ENDHEAD |
ENDHEAD |
} |
} |
|
|
Line 961 sub print_row {
|
Line 935 sub print_row {
|
|
|
if ($parmlev eq 'full') { |
if ($parmlev eq 'full') { |
$r->print('<td style="background-color:'.$defbgtwo.';" align="center">' |
$r->print('<td style="background-color:'.$defbgtwo.';" align="center">' |
.$$part{$which}.'</td>'); |
.($$part{$which} eq '0'?'0 ('.&mt('default').')':$$part{$which}).'</td>'); |
} else { |
} else { |
$parm=~s|\[.*\]\s||g; |
$parm=~s|\[.*\]\s||g; |
} |
} |
Line 1245 sub isdateparm {
|
Line 1219 sub isdateparm {
|
} |
} |
|
|
# |
# |
# This function prints a list of parameters, which were selected. It also display a link from which you can |
# parmmenu displays a list of the selected parameters. |
# hide or show the complete parameter list, from which you can choose your parameters. |
# It also offers a link to show/hide the complete parameter list |
|
# from which you can select all desired parameters. |
# |
# |
sub parmmenu { |
sub parmmenu { |
my ($r,$allparms,$pscat,$keyorder)=@_; |
my ($r,$allparms,$pscat,$keyorder)=@_; |
Line 1321 sub parmmenu {
|
Line 1296 sub parmmenu {
|
checkdates(); |
checkdates(); |
checkthis('weight','pscat'); |
checkthis('weight','pscat'); |
checkthis('maxtries','pscat'); |
checkthis('maxtries','pscat'); |
|
checkthis('type','pscat'); |
|
checkthis('problemstatus','pscat'); |
} |
} |
|
|
function hideParms() { |
function hideParms() { |
Line 1350 ENDSCRIPT
|
Line 1327 ENDSCRIPT
|
$r->print(&mt('Selected Parameters:').'<br />'); |
$r->print(&mt('Selected Parameters:').'<br />'); |
|
|
#print out all possible parms and hide them by default |
#print out all possible parms and hide them by default |
$r->print('<ul>'); |
$r->print('<ul class="LC_parm_parmlist">'); |
foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) { |
foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) { |
$r->print('<li id="'.$tempkey.'_li" value="'.$tempkey.'_li" name="pscat_li"'); |
$r->print('<li id="'.$tempkey.'_li" value="'.$tempkey.'_li" name="pscat_li"'); |
if (!($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat})) { |
if (!($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat})) { |
Line 1404 sub lookUpTableParameter {
|
Line 1381 sub lookUpTableParameter {
|
'handgrade' => 'grading', |
'handgrade' => 'grading', |
'maxtries' => 'tries', |
'maxtries' => 'tries', |
'hinttries' => 'tries', |
'hinttries' => 'tries', |
|
'randomizeontries' => 'tries', |
'type' => 'problem_appearance', |
'type' => 'problem_appearance', |
'problemstatus' => 'problem_appearance', |
'problemstatus' => 'problem_appearance', |
'display' => 'problem_appearance', |
'display' => 'problem_appearance', |
Line 1716 sub displaymenu {
|
Line 1694 sub displaymenu {
|
} |
} |
|
|
sub mapmenu { |
sub mapmenu { |
my ($r,$allmaps,$pschp,$maptitles, $symbp)=@_; |
my ($r,$allmaps,$pschp,$maptitles,$symbp)=@_; |
my %allmaps_inverted = reverse %$allmaps; |
my %allmaps_inverted = reverse %$allmaps; |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $tree=[]; |
my $tree=[]; |
my $treeinfo={}; |
my $treeinfo={}; |
if (defined($navmap)) { |
if (defined($navmap)) { |
my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef); |
my $it=$navmap->getIterator(undef,undef,undef,1,1,undef); |
my $curRes; |
my $curRes; |
my $depth = 0; |
my $depth = 0; |
my %parent = (); |
my %parent = (); |
Line 1767 sub mapmenu {
|
Line 1745 sub mapmenu {
|
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Enclosing Map or Folder'),'','',' id="mapmenu"')); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Enclosing Map or Folder'),'','',' id="mapmenu"')); |
if ((ref($tree) eq 'ARRAY') && (ref($treeinfo) eq 'HASH')) { |
if ((ref($tree) eq 'ARRAY') && (ref($treeinfo) eq 'HASH')) { |
my $icon = '<img src="/adm/lonIcons/navmap.folder.open.gif" alt="" />'; |
my $icon = '<img src="/adm/lonIcons/navmap.folder.open.gif" alt="" />'; |
$r->print(&Apache::loncommon::start_data_table() |
my $whitespace = |
.&Apache::loncommon::start_data_table_row() |
'<img src="' |
.'<td>'.$icon |
.&Apache::loncommon::lonhttpdurl('/adm/lonIcons/whitespace_21.gif') |
.'<label> ' |
.'" alt="" />'; |
.'<input type="radio" name="pschp" checked="checked" value="all" />' |
|
.&mt('All Maps or Folders') |
# Info about selectable folders/maps |
.'</label></td>' |
$r->print( |
.&Apache::loncommon::end_data_table_row() |
'<div class="LC_info">' |
|
.&mt('You can only select those maps and folders which can be currently parameterized.') |
|
# .' '.&Apache::loncommon::help_open_topic('...') # Later: Add further help |
|
.'</div>' |
|
); |
|
|
|
|
|
$r->print(&Apache::loncommon::start_data_table()); |
|
|
|
# Display row: "All Maps or Folders" |
|
$r->print( |
|
&Apache::loncommon::start_data_table_row() |
|
.'<td>' |
|
.'<label>' |
|
.'<input type="radio" name="pschp"' |
|
); |
|
$r->print(' checked="checked"') if ($pschp eq 'all' || !$pschp); |
|
$r->print( |
|
' value="all" /> '.$icon.' ' |
|
.&mt('All Maps or Folders') |
|
.'</label>' |
|
.'<hr /></td>' |
|
.&Apache::loncommon::end_data_table_row() |
); |
); |
my $whitespace = '<img src="' |
|
.&Apache::loncommon::lonhttpdurl("/adm/lonIcons/whitespace_21.gif") |
# Display row: "Main Course Documents" |
.'" alt="" />'; |
|
if (exists($$allmaps{1})) { |
if (exists($$allmaps{1})) { |
$r->print(&Apache::loncommon::start_data_table_row() |
$r->print( |
.'<td>'.$icon |
&Apache::loncommon::start_data_table_row() |
.'<label> ' |
.'<td>' |
.'<input type="radio" name="pschp" value="1"' |
.'<label>' |
|
.'<input type="radio" name="pschp" value="1"' |
); |
); |
if ($pschp eq 1) { |
$r->print(' checked="checked"') if ($pschp eq '1'); |
$r->print(' checked="checked"'); |
$r->print( |
} |
'/> '.$icon.' ' |
$r->print('/>' |
.$$maptitles{1} |
.$$maptitles{1} |
.($$allmaps{1} !~/^uploaded/?' ['.$$allmaps{1}.']':'') |
.($$allmaps{1} !~/^uploaded/?' ['.$$allmaps{1}.']':'') |
.'</label>' |
.'</label>' |
.'</td>' |
.'</td>' |
.&Apache::loncommon::end_data_table_row() |
.&Apache::loncommon::end_data_table_row() |
|
); |
); |
} |
} |
|
|
|
# Display rows for all course maps and folders |
foreach my $id (@{$tree}) { |
foreach my $id (@{$tree}) { |
my ($mapid,$resid)=split(/\./,$id); |
my ($mapid,$resid)=split(/\./,$id); |
# Indentation |
# Indentation |
Line 1811 sub mapmenu {
|
Line 1812 sub mapmenu {
|
my $symb_name = $$symbp{$id}; |
my $symb_name = $$symbp{$id}; |
my ($front, $tail) = split (/___${resid}___/, $symb_name); |
my ($front, $tail) = split (/___${resid}___/, $symb_name); |
$symb_name = $tail; |
$symb_name = $tail; |
$r->print(&Apache::loncommon::start_data_table_row() |
$r->print( |
.'<td>'.$indent.$icon |
&Apache::loncommon::start_data_table_row() |
.'<label> ' |
.'<td>' |
.'<input type ="radio" name="pschp" value="'.$allmaps_inverted{$symb_name}.'"' |
.'<label>' |
); |
); |
if ($pschp eq $allmaps_inverted{$symb_name}) { |
# Only offer radio button for folders/maps which can be parameterized |
$r->print(' checked="checked"'); |
if ($allmaps_inverted{$symb_name}) { |
|
$r->print( |
|
'<input type ="radio" name="pschp"' |
|
.' value="'.$allmaps_inverted{$symb_name}.'"' |
|
); |
|
$r->print(' checked="checked"') if ($allmaps_inverted{$symb_name} eq $pschp); |
|
$r->print('/>'); |
|
} else { |
|
$r->print($whitespace); |
} |
} |
$r->print('/>' |
$r->print( |
.$treeinfo->{$id}->{name} |
$indent.$icon.' ' |
.($$allmaps{$mapid}!~/^uploaded/?' ['.$$allmaps{$mapid}.']':'') |
.$treeinfo->{$id}->{name} |
.'</label>' |
.($$allmaps{$mapid}!~/^uploaded/?' ['.$$allmaps{$mapid}.']':'') |
.'</td>' |
.'</label>' |
.&Apache::loncommon::end_data_table_row() |
.'</td>' |
|
.&Apache::loncommon::end_data_table_row() |
); |
); |
} |
} |
|
|
$r->print(&Apache::loncommon::end_data_table()); |
$r->print(&Apache::loncommon::end_data_table()); |
} |
} |
} |
} |
Line 2014 sub assessparms {
|
Line 2025 sub assessparms {
|
|
|
my @pscat=&Apache::loncommon::get_env_multiple('form.pscat'); |
my @pscat=&Apache::loncommon::get_env_multiple('form.pscat'); |
my $pschp=$env{'form.pschp'}; |
my $pschp=$env{'form.pschp'}; |
|
|
|
|
my @psprt=&Apache::loncommon::get_env_multiple('form.psprt'); |
my @psprt=&Apache::loncommon::get_env_multiple('form.psprt'); |
if (!@psprt) { $psprt[0]='0'; } |
if (!@psprt) { $psprt[0]='0'; } |
|
if (($env{'form.part'}) && ($psprt[0] ne 'all')) { $psprt[0]=$env{'form.part'}; } |
|
|
my $pssymb=''; |
my $pssymb=''; |
my $parmlev=''; |
my $parmlev=''; |
Line 2083 sub assessparms {
|
Line 2097 sub assessparms {
|
$message="\n<p>\n".&mt("Full 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 />\n".&mt('ID').": ".$name{'id'}.'<p>'; |
"<br />\n".&mt('Student/Employee ID').": ".$name{'id'}.'<p>'; |
} |
} |
@usersgroups = &Apache::lonnet::get_users_groups( |
@usersgroups = &Apache::lonnet::get_users_groups( |
$udom,$uname,$env{'request.course.id'}); |
$udom,$uname,$env{'request.course.id'}); |
Line 2111 sub assessparms {
|
Line 2125 sub assessparms {
|
my @markers=split(/\&\&\&/,$env{'form.pres_marker'}); |
my @markers=split(/\&\&\&/,$env{'form.pres_marker'}); |
my @values=split(/\&\&\&/,$env{'form.pres_value'}); |
my @values=split(/\&\&\&/,$env{'form.pres_value'}); |
my @types=split(/\&\&\&/,$env{'form.pres_type'}); |
my @types=split(/\&\&\&/,$env{'form.pres_type'}); |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $chome = $env{'course.'.$env{'request.course.id'}.'.home'}; |
|
my ($got_chostname,$chostname,$cmajor,$cminor); |
|
my $totalstored = 0; |
for (my $i=0;$i<=$#markers;$i++) { |
for (my $i=0;$i<=$#markers;$i++) { |
|
my ($needsrelease,$needsnewer); |
if ($markers[$i] =~ /^[\d.]+\&0_availablestudent\&(1|2|3)$/) { |
if ($markers[$i] =~ /^[\d.]+\&0_availablestudent\&(1|2|3)$/) { |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my (@ok_slots,@fail_slots,@del_slots); |
my (@ok_slots,@fail_slots,@del_slots); |
my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); |
my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); |
my ($level,@all) = |
my ($level,@all) = |
Line 2144 sub assessparms {
|
Line 2162 sub assessparms {
|
} |
} |
} |
} |
} |
} |
|
} elsif ($markers[$i] =~ /_type\&\d+$/) { |
|
$needsrelease = |
|
$Apache::lonnet::needsrelease{'parameter:type:'.$values[$i]}; |
|
if ($needsrelease) { |
|
unless ($got_chostname) { |
|
($chostname,$cmajor,$cminor) = &questiontype_release_vars(); |
|
$got_chostname = 1; |
|
} |
|
$needsnewer = &questiontype_releasecheck($values[$i], |
|
$needsrelease, |
|
$chostname, |
|
$cmajor,$cminor); |
|
} |
|
} |
|
if ($needsnewer) { |
|
$message .= &oldversion_warning($values[$i],$chostname,$cmajor, |
|
$cminor,$needsrelease); |
|
} else { |
|
$message.=&storeparm(split(/\&/,$markers[$i]), |
|
$values[$i], |
|
$types[$i], |
|
$uname,$udom,$csec,$cgroup); |
|
$totalstored ++; |
} |
} |
$message.=&storeparm(split(/\&/,$markers[$i]), |
|
$values[$i], |
|
$types[$i], |
|
$uname,$udom,$csec,$cgroup); |
|
} |
} |
# ---------------------------------------------------------------- Done storing |
# ---------------------------------------------------------------- Done storing |
$message.='<p class="LC_warning">' |
if ($totalstored) { |
.&mt('Changes can take up to 10 minutes before being active for all students.') |
$message.='<p class="LC_warning">' |
.&Apache::loncommon::help_open_topic('Caching') |
.&mt('Changes can take up to 10 minutes before being active for all students.') |
.'</p>'; |
.&Apache::loncommon::help_open_topic('Caching') |
|
.'</p>'; |
|
} |
} |
} |
#----------------------------------------------- if all selected, fill in array |
#----------------------------------------------- if all selected, fill in array |
if ($pscat[0] eq "all") {@pscat = (keys %allparms);} |
if ($pscat[0] eq "all") {@pscat = (keys %allparms);} |
if (!@pscat) { @pscat=('duedate','opendate','answerdate','weight','maxtries') }; |
if (!@pscat) { @pscat=('duedate','opendate','answerdate','weight','maxtries','type','problemstatus') }; |
if ($psprt[0] eq "all" || !@psprt) {@psprt = (keys %allparts);} |
if ($psprt[0] eq "all" || !@psprt) {@psprt = (keys %allparts);} |
# ------------------------------------------------------------------ Start page |
# ------------------------------------------------------------------ Start page |
|
|
Line 2257 COURSECONTENTSCRIPT
|
Line 2296 COURSECONTENTSCRIPT
|
# parameter screen for a single resource. |
# parameter screen for a single resource. |
my ($map,$iid,$resource)=&Apache::lonnet::decode_symb($pssymb); |
my ($map,$iid,$resource)=&Apache::lonnet::decode_symb($pssymb); |
my $title = &Apache::lonnet::gettitle($pssymb); |
my $title = &Apache::lonnet::gettitle($pssymb); |
$r->print(&mt('Specific Resource: [_1] ([_2])',$title,$resource). |
$r->print(&mt('Specific Resource: [_1] ([_2])', |
|
$title,'<span class="LC_filename">'.$resource.'</span>'). |
'<input type="hidden" value="'.$pssymb.'" name="symb" />'. |
'<input type="hidden" value="'.$pssymb.'" name="symb" />'. |
'<br />'); |
'<br />'); |
$r->print(&Apache::lonhtmlcommon::topic_bar('',&mt('Additional Display Specification (optional)'))); |
$r->print(&Apache::lonhtmlcommon::topic_bar('',&mt('Additional Display Specification (optional)'))); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View')). |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View')). |
'<label>'.&mt('Show all parts').': <input type="checkbox" name="psprt" value="all"'. |
'<label>'. |
($env{'form.psprt'}?' checked="checked"':'').' /></label></td></tr>'); |
'<input type="checkbox" name="psprt" value="all"'. |
|
($env{'form.psprt'}?' checked="checked"':'').' />'. |
|
&mt('Show all parts'). |
|
'</label></td></tr>'); |
&usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups); |
&usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups); |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
Line 2296 COURSECONTENTSCRIPT
|
Line 2339 COURSECONTENTSCRIPT
|
my $csudom=$env{'user.domain'}; |
my $csudom=$env{'user.domain'}; |
|
|
if ($parmlev eq 'full') { |
if ($parmlev eq 'full') { |
|
# |
|
# This produces the cascading table output of parameters |
|
# |
my $coursespan=$csec?8:5; |
my $coursespan=$csec?8:5; |
my $userspan=3; |
my $userspan=3; |
if ($cgroup ne '') { |
if ($cgroup ne '') { |
Line 2303 COURSECONTENTSCRIPT
|
Line 2349 COURSECONTENTSCRIPT
|
} |
} |
|
|
$r->print('<p><table border="2">'); |
$r->print('<p><table border="2">'); |
|
# |
|
# This produces the headers |
|
# |
$r->print('<tr><td colspan="5"></td>'); |
$r->print('<tr><td colspan="5"></td>'); |
$r->print('<th colspan="'.($coursespan).'">'.&mt('Any User').'</th>'); |
$r->print('<th colspan="'.($coursespan).'">'.&mt('Any User').'</th>'); |
if ($uname) { |
if ($uname) { |
Line 2315 COURSECONTENTSCRIPT
|
Line 2364 COURSECONTENTSCRIPT
|
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'pie' => "Parameter in Effect", |
'pie' => "Parameter in Effect", |
'csv' => "Current Session Value", |
'csv' => "Current Session Value", |
'at' => 'at', |
|
'rl' => "Resource Level", |
'rl' => "Resource Level", |
'ic' => 'in Course', |
'ic' => 'in Course', |
'aut' => "Assessment URL and Title", |
'aut' => "Assessment URL and Title", |
Line 2331 COURSECONTENTSCRIPT
|
Line 2379 COURSECONTENTSCRIPT
|
); |
); |
$r->print(<<ENDTABLETWO); |
$r->print(<<ENDTABLETWO); |
<th rowspan="3">$lt{'pie'}</th> |
<th rowspan="3">$lt{'pie'}</th> |
<th rowspan="3">$lt{'csv'}<br />($csuname $lt{'at'} $csudom)</th> |
<th rowspan="3">$lt{'csv'}<br />($csuname:$csudom)</th> |
</tr><tr><td colspan="5"></td><th colspan="2">$lt{'ic'}</th><th colspan="2">$lt{'rl'}</th> |
</tr><tr><td colspan="5"></td><th colspan="2">$lt{'ic'}</th><th colspan="2">$lt{'rl'}</th> |
<th colspan="1">$lt{'ic'}</th> |
<th colspan="1">$lt{'ic'}</th> |
|
|
Line 2367 ENDTABLEHEADFOUR
|
Line 2415 ENDTABLEHEADFOUR
|
} |
} |
|
|
$r->print('</tr>'); |
$r->print('</tr>'); |
|
# |
|
# Done with the headers |
|
# |
my $defbgone=''; |
my $defbgone=''; |
my $defbgtwo=''; |
my $defbgtwo=''; |
my $defbgthree = ''; |
my $defbgthree = ''; |
Line 2407 ENDTABLEHEADFOUR
|
Line 2457 ENDTABLEHEADFOUR
|
my %default=(); |
my %default=(); |
my $uri=&Apache::lonnet::declutter($uris{$rid}); |
my $uri=&Apache::lonnet::declutter($uris{$rid}); |
|
|
|
my $filter=$env{'form.filter'}; |
|
|
foreach (&keysplit($keyp{$rid})) { |
foreach (&keysplit($keyp{$rid})) { |
my $tempkeyp = $_; |
my $tempkeyp = $_; |
if (grep $_ eq $tempkeyp, @catmarker) { |
if (grep $_ eq $tempkeyp, @catmarker) { |
|
my $parmname=&Apache::lonnet::metadata($uri,$_.'.name'); |
|
# We may only want certain parameters listed |
|
if ($filter) { |
|
unless ($filter=~/\Q$parmname\E/) { next; } |
|
} |
|
$name{$_}=$parmname; |
$part{$_}=&Apache::lonnet::metadata($uri,$_.'.part'); |
$part{$_}=&Apache::lonnet::metadata($uri,$_.'.part'); |
$name{$_}=&Apache::lonnet::metadata($uri,$_.'.name'); |
|
my $parmdis=&Apache::lonnet::metadata($uri,$_.'.display'); |
my $parmdis=&Apache::lonnet::metadata($uri,$_.'.display'); |
if ($allparms{$name{$_}} ne '') { |
if ($allparms{$name{$_}} ne '') { |
my $identifier; |
my $identifier; |
Line 2749 sub storedata {
|
Line 2807 sub storedata {
|
undef %newdata; |
undef %newdata; |
my @deldata=(); |
my @deldata=(); |
undef @deldata; |
undef @deldata; |
foreach (keys %env) { |
my ($got_chostname,$chostname,$cmajor,$cminor); |
if ($_=~/^form\.([a-z]+)\_(.+)$/) { |
foreach my $key (keys(%env)) { |
|
if ($key =~ /^form\.([a-z]+)\_(.+)$/) { |
my $cmd=$1; |
my $cmd=$1; |
my $thiskey=$2; |
my $thiskey=$2; |
my ($tuname,$tudom)=&extractuser($thiskey); |
my ($tuname,$tudom)=&extractuser($thiskey); |
Line 2761 sub storedata {
|
Line 2820 sub storedata {
|
if ($cmd eq 'set' || $cmd eq 'datepointer' || $cmd eq 'dateinterval') { |
if ($cmd eq 'set' || $cmd eq 'datepointer' || $cmd eq 'dateinterval') { |
my ($data, $typeof, $text); |
my ($data, $typeof, $text); |
if ($cmd eq 'set') { |
if ($cmd eq 'set') { |
$data=$env{$_}; |
$data=$env{$key}; |
$typeof=$env{'form.typeof_'.$thiskey}; |
$typeof=$env{'form.typeof_'.$thiskey}; |
$text = &mt('Saved modified parameter for'); |
$text = &mt('Saved modified parameter for'); |
|
if ($typeof eq 'string_questiontype') { |
|
my ($needsrelease,$needsnewer); |
|
$needsrelease = $Apache::lonnet::needsrelease{'parameter:type:'.$data}; |
|
if ($needsrelease) { |
|
unless ($got_chostname) { |
|
($chostname,$cmajor,$cminor)=&questiontype_release_vars(); |
|
$got_chostname = 1; |
|
} |
|
$needsnewer = &questiontype_releasecheck($data,$needsrelease, |
|
$chostname,$cmajor, |
|
$cminor); |
|
} |
|
if ($needsnewer) { |
|
$r->print('<br />'.&oldversion_warning($data,$chostname,$cmajor, |
|
$cminor,$needsrelease)); |
|
next; |
|
} |
|
} |
} elsif ($cmd eq 'datepointer') { |
} elsif ($cmd eq 'datepointer') { |
$data=&Apache::lonhtmlcommon::get_date_from_form($env{$_}); |
$data=&Apache::lonhtmlcommon::get_date_from_form($env{$key}); |
$typeof=$env{'form.typeof_'.$thiskey}; |
$typeof=$env{'form.typeof_'.$thiskey}; |
$text = &mt('Saved modified date for'); |
$text = &mt('Saved modified date for'); |
} elsif ($cmd eq 'dateinterval') { |
} elsif ($cmd eq 'dateinterval') { |
Line 3020 sub date_interval_selector {
|
Line 3097 sub date_interval_selector {
|
my %select = ((map {$_ => $_} (0..$max)), |
my %select = ((map {$_ => $_} (0..$max)), |
'select_form_order' => [0..$max]); |
'select_form_order' => [0..$max]); |
$result .= &Apache::loncommon::select_form($amount,$name.'_'.$thiskey, |
$result .= &Apache::loncommon::select_form($amount,$name.'_'.$thiskey, |
%select); |
\%select); |
$result .= ' '.&mt($name); |
$result .= ' '.&mt($name); |
} |
} |
$result .= '<input type="hidden" name="dateinterval_'.$thiskey.'" />'; |
$result .= '<input type="hidden" name="dateinterval_'.$thiskey.'" />'; |
Line 3059 my %strings =
|
Line 3136 my %strings =
|
[ 'answer', 'Yes, and show correct answer if they exceed the maximum number of tries.' ], |
[ 'answer', 'Yes, and show correct answer if they exceed the maximum number of tries.' ], |
[ 'no', 'No, don\'t show correct/incorrect feedback.' ], |
[ 'no', 'No, don\'t show correct/incorrect feedback.' ], |
[ 'no_feedback_ever', 'No, show no feedback at all.' ]], |
[ 'no_feedback_ever', 'No, show no feedback at all.' ]], |
|
'string_questiontype' |
|
=> [[ 'problem', 'Standard Problem'], |
|
[ 'survey', 'Survey'], |
|
[ 'anonsurveycred', 'Anonymous Survey (credit for submission)'], |
|
[ 'exam', 'Exam'], |
|
[ 'anonsurvey', 'Anonymous Survey'], |
|
[ 'randomizetry', 'New Randomization Each N Tries (default N=1)'], |
|
[ 'practice', 'Practice'], |
|
[ 'surveycred', 'Survey (credit for submission)']], |
); |
); |
|
|
|
sub standard_string_options { |
|
my ($string_type) = @_; |
|
if (ref($strings{$string_type}) eq 'ARRAY') { |
|
return $strings{$string_type}; |
|
} |
|
return; |
|
} |
|
|
sub string_selector { |
sub string_selector { |
my ($thistype, $thiskey, $showval) = @_; |
my ($thistype, $thiskey, $showval) = @_; |
Line 3069 sub string_selector {
|
Line 3162 sub string_selector {
|
return &default_selector($thiskey,$showval); |
return &default_selector($thiskey,$showval); |
} |
} |
|
|
|
my %skiptype; |
|
if ($thistype eq 'string_questiontype') { |
|
my ($got_chostname,$chostname,$cmajor,$cminor); |
|
foreach my $possibilities (@{ $strings{$thistype} }) { |
|
next unless (ref($possibilities) eq 'ARRAY'); |
|
my ($name, $description) = @{ $possibilities }; |
|
my $needsrelease=$Apache::lonnet::needsrelease{'parameter:type:'.$name}; |
|
if ($needsrelease) { |
|
unless ($got_chostname) { |
|
($chostname,$cmajor,$cminor)=&questiontype_release_vars(); |
|
$got_chostname = 1; |
|
} |
|
my $needsnewer=&questiontype_releasecheck($name,$needsrelease, |
|
$chostname,$cmajor, |
|
$cminor); |
|
if ($needsnewer) { |
|
$skiptype{$name} = 1; |
|
} |
|
} |
|
} |
|
} |
|
|
my $result; |
my $result; |
foreach my $possibilities (@{ $strings{$thistype} }) { |
my $numinrow = 3; |
my ($name, $description) = @{ $possibilities }; |
if ($thistype eq 'string_problemstatus') { |
$result .= '<label><input type="radio" name="set_'.$thiskey. |
$numinrow = 2; |
'" value="'.$name.'"'; |
} elsif ($thistype eq 'string_questiontype') { |
if ($showval eq $name) { |
if (keys(%skiptype) > 0) { |
$result .= ' checked="checked"'; |
$numinrow = 4; |
|
} |
|
} |
|
my $rem; |
|
if (ref($strings{$thistype}) eq 'ARRAY') { |
|
my $i=0; |
|
foreach my $possibilities (@{ $strings{$thistype} }) { |
|
next unless (ref($possibilities) eq 'ARRAY'); |
|
my ($name, $description) = @{ $possibilities }; |
|
next if ($skiptype{$name}); |
|
$rem = $i%($numinrow); |
|
if ($rem == 0) { |
|
if ($i > 0) { |
|
$result .= '</tr>'; |
|
} |
|
$result .= '<tr>'; |
|
} |
|
$result .= '<td class="LC_left_item">'. |
|
'<span class="LC_nobreak"><label>'. |
|
'<input type="radio" name="set_'.$thiskey. |
|
'" value="'.$name.'"'; |
|
if ($showval eq $name) { |
|
$result .= ' checked="checked"'; |
|
} |
|
$result .= ' />'.&mt($description).'</label></span></td>'; |
|
$i++; |
|
} |
|
$rem = @{ $strings{$thistype} }%($numinrow); |
|
my $colsleft = $numinrow - $rem; |
|
if ($colsleft > 1 ) { |
|
$result .= '<td colspan="'.$colsleft.'" class="LC_left_item">'. |
|
' </td>'; |
|
} elsif ($colsleft == 1) { |
|
$result .= '<td class="LC_left_item"> </td>'; |
|
} |
|
$result .= '</tr>'; |
} |
} |
$result .= ' />'.&mt($description).'</label> '; |
if ($result) { |
|
$result = '<table border="0">'.$result.'</table>'; |
} |
} |
return $result; |
return $result; |
} |
} |
Line 3154 ENDOVER
|
Line 3305 ENDOVER
|
|
|
my @pscat=&Apache::loncommon::get_env_multiple('form.pscat'); |
my @pscat=&Apache::loncommon::get_env_multiple('form.pscat'); |
my $pschp=$env{'form.pschp'}; |
my $pschp=$env{'form.pschp'}; |
|
|
my @psprt=&Apache::loncommon::get_env_multiple('form.psprt'); |
my @psprt=&Apache::loncommon::get_env_multiple('form.psprt'); |
if (!@psprt) { $psprt[0]='0'; } |
if (!@psprt) { $psprt[0]='0'; } |
|
|
Line 3503 sub parse_key {
|
Line 3655 sub parse_key {
|
} |
} |
|
|
|
|
|
|
sub extract_cloners { |
|
my ($clonelist,$allowclone) = @_; |
|
if ($clonelist =~ /,/) { |
|
@{$allowclone} = split(/,/,$clonelist); |
|
} else { |
|
$$allowclone[0] = $clonelist; |
|
} |
|
} |
|
|
|
sub check_cloners { |
|
my ($clonelist,$oldcloner) = @_; |
|
my ($clean_clonelist,%disallowed); |
|
my @allowclone = (); |
|
&extract_cloners($$clonelist,\@allowclone); |
|
foreach my $currclone (@allowclone) { |
|
if (!grep(/^\Q$currclone\E$/,@$oldcloner)) { |
|
if ($currclone eq '*') { |
|
$clean_clonelist .= $currclone.','; |
|
} else { |
|
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 { |
|
if (&Apache::lonnet::homeserver($uname,$udom) eq 'no_host') { |
|
$disallowed{'newuser'} .= $currclone.','; |
|
} else { |
|
$clean_clonelist .= $currclone.','; |
|
} |
|
} |
|
} |
|
} else { |
|
$clean_clonelist .= $currclone.','; |
|
} |
|
} |
|
foreach my $key (keys(%disallowed)) { |
|
$disallowed{$key} =~ s/,$//; |
|
} |
|
if ($clean_clonelist) { |
|
$clean_clonelist =~ s/,$//; |
|
} |
|
$$clonelist = $clean_clonelist; |
|
return %disallowed; |
|
} |
|
|
|
sub change_clone { |
|
my ($clonelist,$oldcloner) = @_; |
|
my ($uname,$udom); |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $clone_crs = $cnum.':'.$cdom; |
|
|
|
if ($cnum && $cdom) { |
|
my @allowclone; |
|
&extract_cloners($clonelist,\@allowclone); |
|
foreach my $currclone (@allowclone) { |
|
if (!grep(/^$currclone$/,@$oldcloner)) { |
|
if ($currclone ne '*') { |
|
($uname,$udom) = split(/:/,$currclone); |
|
if ($uname && $udom && $uname ne '*') { |
|
if (&Apache::lonnet::homeserver($uname,$udom) ne 'no_host') { |
|
my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable'); |
|
if ($currclonecrs{'cloneable'} !~ /\Q$clone_crs\E/) { |
|
if ($currclonecrs{'cloneable'} eq '') { |
|
$currclonecrs{'cloneable'} = $clone_crs; |
|
} else { |
|
$currclonecrs{'cloneable'} .= ','.$clone_crs; |
|
} |
|
&Apache::lonnet::put('environment',\%currclonecrs,$udom,$uname); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
foreach my $oldclone (@$oldcloner) { |
|
if (!grep(/^\Q$oldclone\E$/,@allowclone)) { |
|
if ($oldclone ne '*') { |
|
($uname,$udom) = split(/:/,$oldclone); |
|
if ($uname && $udom && $uname ne '*' ) { |
|
if (&Apache::lonnet::homeserver($uname,$udom) ne 'no_host') { |
|
my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable'); |
|
my %newclonecrs = (); |
|
if ($currclonecrs{'cloneable'} =~ /\Q$clone_crs\E/) { |
|
if ($currclonecrs{'cloneable'} =~ /,/) { |
|
my @currclonecrs = split/,/,$currclonecrs{'cloneable'}; |
|
foreach my $crs (@currclonecrs) { |
|
if ($crs ne $clone_crs) { |
|
$newclonecrs{'cloneable'} .= $crs.','; |
|
} |
|
} |
|
$newclonecrs{'cloneable'} =~ s/,$//; |
|
} else { |
|
$newclonecrs{'cloneable'} = ''; |
|
} |
|
&Apache::lonnet::put('environment',\%newclonecrs,$udom,$uname); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
|
|
|
|
sub header { |
sub header { |
return &Apache::loncommon::start_page('Parameter Manager'); |
return &Apache::loncommon::start_page('Parameter Manager'); |
} |
} |
Line 3647 ENDMAINFORMHEAD
|
Line 3682 ENDMAINFORMHEAD
|
my @menu = |
my @menu = |
( { categorytitle=>"Settings for this $crstype", |
( { categorytitle=>"Settings for this $crstype", |
items => [ |
items => [ |
{ linktext => "$crstype Configuration", |
|
url => '/adm/courseprefs?origin=params', |
|
permission => $parm_permission, |
|
linktitle => "Edit $lc_crstype configuration." , |
|
icon => 'preferences-desktop-remote-desktop.png' , |
|
#help => 'Course_Environment', |
|
}, |
|
{ linktext => 'Portfolio Metadata', |
{ linktext => 'Portfolio Metadata', |
url => '/adm/parmset?action=setrestrictmeta', |
url => '/adm/parmset?action=setrestrictmeta', |
permission => $parm_permission, |
permission => $parm_permission, |
linktitle => "Restrict metadata for this $lc_crstype." , |
linktitle => "Restrict metadata for this $lc_crstype." , |
icon =>'contact-new.png' , |
icon =>'contact-new.png' , |
}, |
}, |
{ linktext => "Manage $crstype Slots", |
|
url => '/adm/slotrequest?command=showslots', |
|
permission => $vgr, |
|
linktitle => "Manage slots for this $lc_crstype." , |
|
icon => 'rsrv.png' , |
|
}, |
|
{ linktext => 'Reset Student Access Times', |
{ linktext => 'Reset Student Access Times', |
url => '/adm/helper/resettimes.helper', |
url => '/adm/helper/resettimes.helper', |
permission => $mgr, |
permission => $mgr, |
Line 4559 sub check_for_course_info {
|
Line 4581 sub check_for_course_info {
|
return 0; |
return 0; |
} |
} |
|
|
|
sub questiontype_release_vars { |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $chome = $env{'course.'.$env{'request.course.id'}.'.home'}; |
|
my $chostname = &Apache::lonnet::hostname($chome); |
|
my ($cmajor,$cminor) = |
|
split(/\./,&Apache::lonnet::get_server_loncaparev($cdom,$chome)); |
|
return ($chostname,$cmajor,$cminor); |
|
} |
|
|
|
sub questiontype_releasecheck { |
|
my ($questiontype,$needsrelease,$chostname,$cmajor,$cminor) = @_; |
|
my $needsnewer; |
|
my ($needsmajor,$needsminor) = split(/\./,$needsrelease); |
|
if (($cmajor < $needsmajor) || |
|
($cmajor == $needsmajor && $cminor < $needsminor)) { |
|
$needsnewer = 1; |
|
} else { |
|
&Apache::lonnet::update_released_required($Apache::lonnet::needsrelease{'parameter:type:'.$questiontype}); |
|
} |
|
return $needsnewer; |
|
} |
|
|
|
sub oldversion_warning { |
|
my ($questiontype,$chostname,$cmajor,$cminor,$needsrelease) = @_; |
|
my $desc; |
|
if (ref($strings{'string_questiontype'}) eq 'ARRAY') { |
|
foreach my $possibilities (@{ $strings{'string_questiontype'} }) { |
|
next unless (ref($possibilities) eq 'ARRAY'); |
|
my ($name, $description) = @{ $possibilities }; |
|
if ($name eq $questiontype) { |
|
$desc = $description; |
|
last; |
|
} |
|
} |
|
} |
|
return '<p class="LC_warning">'. |
|
&mt('Question Type was [_1]not[_2] set to [_3].', |
|
'<b>','</b>','"'.$desc.'"').'<br />'. |
|
&mt('LON-CAPA version ([_1]) installed on home server ([_2]) does not meet version requirements ([_3] or newer).', |
|
$cmajor.'.'.$cminor,$chostname, |
|
$needsrelease). |
|
'</p>'; |
|
} |
|
|
sub handler { |
sub handler { |
my $r=shift; |
my $r=shift; |
Line 4574 sub handler {
|
Line 4639 sub handler {
|
'pres_marker', |
'pres_marker', |
'pres_value', |
'pres_value', |
'pres_type', |
'pres_type', |
|
'filter','part', |
'udom','uname','symb','serial','timebase']); |
'udom','uname','symb','serial','timebase']); |
|
|
|
|