version 1.49.2.28, 2021/12/24 21:09:09
|
version 1.97, 2022/01/16 16:52:42
|
Line 310 sub handler {
|
Line 310 sub handler {
|
idnu => 'Course ID or number', |
idnu => 'Course ID or number', |
unco => 'Unique code', |
unco => 'Unique code', |
desc => 'Course Description', |
desc => 'Course Description', |
cred => 'Student credits', |
cred => 'Student credits', |
ownr => 'Course Owner', |
ownr => 'Course Owner', |
cown => 'Course Co-owners', |
cown => 'Course Co-owners', |
catg => 'Categorize course', |
catg => 'Categorize course', |
Line 365 sub handler {
|
Line 365 sub handler {
|
} |
} |
|
|
my %values=&Apache::lonnet::dump('environment',$cdom,$cnum); |
my %values=&Apache::lonnet::dump('environment',$cdom,$cnum); |
|
my %courselti=&Apache::lonnet::dump('lti',$cdom,$cnum,undef,undef,undef,1); |
|
if ($courselti{'lock'}) { |
|
delete($courselti{'lock'}); |
|
} |
|
$values{'linkprotection'} = \%courselti; |
my @prefs_order = ('courseinfo','localization','feedback','discussion', |
my @prefs_order = ('courseinfo','localization','feedback','discussion', |
'classlists','appearance','grading','printouts', |
'classlists','appearance','grading','printouts', |
'spreadsheet','bridgetasks','other'); |
'menuitems','linkprotection','spreadsheet','bridgetasks', |
|
'lti','other'); |
|
|
my %prefs = ( |
my %prefs = ( |
'courseinfo' => |
'courseinfo' => |
Line 382 sub handler {
|
Line 388 sub handler {
|
'co-owners' => $lt{'cown'}, |
'co-owners' => $lt{'cown'}, |
'description' => $lt{'desc'}, |
'description' => $lt{'desc'}, |
'courseid' => $lt{'idnu'}, |
'courseid' => $lt{'idnu'}, |
'uniquecode' => $lt{'unco'}, |
'uniquecode' => $lt{'unco'}, |
'categories' => $lt{'catg'}, |
'categories' => $lt{'catg'}, |
'hidefromcat' => $lt{'excc'}, |
'hidefromcat' => $lt{'excc'}, |
'cloners' => $lt{'clon'}, |
'cloners' => $lt{'clon'}, |
Line 419 sub handler {
|
Line 425 sub handler {
|
{ text => 'Discussion and Chat', |
{ text => 'Discussion and Chat', |
help => 'Course_Prefs_Discussions', |
help => 'Course_Prefs_Discussions', |
ordered => ['pch.roles.denied','pch.users.denied', |
ordered => ['pch.roles.denied','pch.users.denied', |
|
'pac.roles.denied','pac.users.denied', |
'plc.roles.denied','plc.users.denied', |
'plc.roles.denied','plc.users.denied', |
'allow_limited_html_in_feedback', |
'allow_limited_html_in_feedback', |
'allow_discussion_post_editing', |
'allow_discussion_post_editing', |
Line 428 sub handler {
|
Line 435 sub handler {
|
'pch.users.denied' => 'No Resource Discussion', |
'pch.users.denied' => 'No Resource Discussion', |
'plc.roles.denied' => 'No Chat room use', |
'plc.roles.denied' => 'No Chat room use', |
'plc.users.denied' => 'No Chat room use', |
'plc.users.denied' => 'No Chat room use', |
|
'pac.roles.denied' => 'No Anonymous Resource Discussion', |
|
'pac.users.denied' => 'No Anonymous Resource Discussion', |
allow_limited_html_in_feedback => 'Allow limited HTML in discussion', |
allow_limited_html_in_feedback => 'Allow limited HTML in discussion', |
allow_discussion_post_editing => 'Users can edit/delete own discussion posts', |
allow_discussion_post_editing => 'Users can edit/delete own discussion posts', |
discussion_post_fonts => 'Discussion post fonts based on likes/unlikes', |
discussion_post_fonts => 'Discussion post fonts based on likes/unlikes', |
}, |
}, |
}, |
}, |
'classlists' => |
'classlists' => |
Line 494 sub handler {
|
Line 503 sub handler {
|
help => 'Course_Prefs_Printouts', |
help => 'Course_Prefs_Printouts', |
ordered => ['problem_stream_switch','suppress_tries', |
ordered => ['problem_stream_switch','suppress_tries', |
'default_paper_size','print_header_format', |
'default_paper_size','print_header_format', |
'disableexampointprint'], |
'disableexampointprint','canuse_pdfforms'], |
itemtext => { |
itemtext => { |
problem_stream_switch => 'Allow problems to be split over pages', |
problem_stream_switch => 'Allow problems to be split over pages', |
suppress_tries => 'Suppress number of tries in printing', |
suppress_tries => 'Suppress number of tries in printing', |
Line 528 sub handler {
|
Line 537 sub handler {
|
suppress_embed_prompt => 'Hide upload references prompt if uploading file to portfolio', |
suppress_embed_prompt => 'Hide upload references prompt if uploading file to portfolio', |
}, |
}, |
}, |
}, |
|
'lti' => |
|
{ |
|
text => 'LTI provider settings', |
|
help => 'Course_Prefs_LTIProvider', |
|
ordered => ['lti.override','lti.topmenu','lti.inlinemenu','lti.lcmenu'], |
|
itemtext => { |
|
'lti.override' => 'Override domain defaults', |
|
'lti.topmenu' => 'Display LON-CAPA page header', |
|
'lti.inlinemenu' => 'Display LON-CAPA inline menu', |
|
'lti.lcmenu' => 'Menu items', |
|
}, |
|
}, |
|
'menuitems' => |
|
{ |
|
text => 'Menu display', |
|
help => 'Course_Prefs_Menus', |
|
header => [{col1 => 'Default Menu', |
|
col2 => 'Value',}, |
|
{col1 => 'Menu collections', |
|
col2 => 'Settings', |
|
}], |
|
ordered => ['menudefault','menucollections'], |
|
itemtext => { |
|
menudefault => 'Choose default collection of menu items for course', |
|
menucollections => 'Menu collections', |
|
}, |
|
}, |
|
'linkprotection' => |
|
{ |
|
text => 'Link protection', |
|
help => 'Course_Prefs_Linkprotection', |
|
header => [{col1 => 'Item', |
|
col2 => 'Settings', |
|
}], |
|
}, |
'other' => |
'other' => |
{ text => 'Other settings', |
{ text => 'Other settings', |
help => 'Course_Prefs_Other', |
help => 'Course_Prefs_Other', |
Line 543 sub handler {
|
Line 587 sub handler {
|
$cnum,undef,\@allitems, |
$cnum,undef,\@allitems, |
'coursepref',$parm_permission); |
'coursepref',$parm_permission); |
} elsif (($phase eq 'display') && ($parm_permission->{'display'})) { |
} elsif (($phase eq 'display') && ($parm_permission->{'display'})) { |
my $jscript = &get_jscript($cid,$cdom,$phase,$crstype,\%values); |
my $noedit; |
|
if (ref($parm_permission) eq 'HASH') { |
|
unless ($parm_permission->{'process'}) { |
|
$noedit = 1; |
|
} |
|
} |
|
my $jscript = &get_jscript($cid,$cdom,$phase,$crstype,\%values,$noedit); |
my @allitems = &get_allitems(%prefs); |
my @allitems = &get_allitems(%prefs); |
&Apache::lonconfigsettings::display_settings($r,$cdom,$phase,$context, |
&Apache::lonconfigsettings::display_settings($r,$cdom,$phase,$context, |
\@prefs_order,\%prefs,\%values,undef,$jscript,\@allitems,$crstype, |
\@prefs_order,\%prefs,\%values,undef,$jscript,\@allitems,$crstype, |
Line 620 sub print_config_box {
|
Line 670 sub print_config_box {
|
} |
} |
$output .= '</span></th>'."\n". |
$output .= '</span></th>'."\n". |
'</tr>'; |
'</tr>'; |
if (($action eq 'feedback') || ($action eq 'classlists')) { |
if (($action eq 'feedback') || ($action eq 'classlists') || ($action eq 'menuitems')) { |
$output .= ' |
$output .= ' |
<tr> |
<tr> |
<td> |
<td> |
Line 645 sub print_config_box {
|
Line 695 sub print_config_box {
|
$output .= &print_feedback('top',$cdom,$settings,$ordered,$itemtext,\$rowtotal,$noedit); |
$output .= &print_feedback('top',$cdom,$settings,$ordered,$itemtext,\$rowtotal,$noedit); |
} elsif ($action eq 'classlists') { |
} elsif ($action eq 'classlists') { |
$output .= &print_classlists('top',$cdom,$settings,$itemtext,\$rowtotal,$crstype,$noedit); |
$output .= &print_classlists('top',$cdom,$settings,$itemtext,\$rowtotal,$crstype,$noedit); |
|
} elsif ($action eq 'menuitems') { |
|
$output .= &print_menuitems('top',$cdom,$settings,$itemtext,\$rowtotal,$crstype,$noedit); |
} |
} |
$output .= ' |
$output .= ' |
</table> |
</table> |
Line 723 sub print_config_box {
|
Line 775 sub print_config_box {
|
$output .= &print_spreadsheet($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype,$noedit); |
$output .= &print_spreadsheet($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype,$noedit); |
} elsif ($action eq 'bridgetasks') { |
} elsif ($action eq 'bridgetasks') { |
$output .= &print_bridgetasks($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype,$noedit); |
$output .= &print_bridgetasks($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype,$noedit); |
|
} elsif ($action eq 'lti') { |
|
$output .= &print_lti($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype,$noedit); |
|
} elsif ($action eq 'menuitems') { |
|
$output .= &print_menuitems('bottom',$cdom,$settings,$itemtext,\$rowtotal,$crstype,$noedit); |
|
} elsif ($action eq 'linkprotection') { |
|
$output .= &print_linkprotection($cdom,$settings,\$rowtotal,$crstype,$noedit); |
} elsif ($action eq 'other') { |
} elsif ($action eq 'other') { |
$output .= &print_other($cdom,$settings,$allitems,\$rowtotal,$crstype,$noedit); |
$output .= &print_other($cdom,$settings,$allitems,\$rowtotal,$crstype,$noedit); |
} |
} |
Line 735 sub print_config_box {
|
Line 793 sub print_config_box {
|
} |
} |
|
|
sub process_changes { |
sub process_changes { |
my ($cdom,$action,$values,$item,$changes,$allitems,$disallowed,$crstype) = @_; |
my ($cdom,$cnum,$action,$values,$item,$changes,$allitems,$disallowed,$crstype) = @_; |
my %newvalues; |
my (%newvalues,%courselti,$errors); |
if (ref($item) eq 'HASH') { |
if (ref($item) eq 'HASH') { |
if (ref($changes) eq 'HASH') { |
if (ref($changes) eq 'HASH') { |
my @ordered; |
my @ordered; |
Line 753 sub process_changes {
|
Line 811 sub process_changes {
|
} |
} |
} |
} |
} |
} |
|
} elsif ($action eq 'linkprotection') { |
|
if (ref($values->{'linkprotection'}) eq 'HASH') { |
|
foreach my $id (keys(%{$values->{'linkprotection'}})) { |
|
if ($id =~ /^\d+$/) { |
|
push(@ordered,$id); |
|
unless (ref($values->{'linkprotection'}->{$id}) eq 'HASH') { |
|
$courselti{$id} = ''; |
|
} |
|
} |
|
} |
|
} |
|
@ordered = sort { $a <=> $b } @ordered; |
|
if (($env{'form.linkprot_add'}) && ($env{'form.linkprot_maxnum'} =~ /^\d+$/)) { |
|
push(@ordered,$env{'form.linkprot_maxnum'}); |
|
} |
} elsif (ref($item->{'ordered'}) eq 'ARRAY') { |
} elsif (ref($item->{'ordered'}) eq 'ARRAY') { |
if ($action eq 'courseinfo') { |
if ($action eq 'courseinfo') { |
my ($can_toggle_cat,$can_categorize) = |
my ($can_toggle_cat,$can_categorize) = |
Line 815 sub process_changes {
|
Line 888 sub process_changes {
|
$changes->{$ext_entry} = $newvalues{$ext_entry}; |
$changes->{$ext_entry} = $newvalues{$ext_entry}; |
} |
} |
} |
} |
|
} elsif ($action eq 'menuitems') { |
|
my (%current,@colls); |
|
my $next = 1; |
|
if ($values->{'menucollections'}) { |
|
foreach my $item (split(/;/,$values->{'menucollections'})) { |
|
my ($num,$value) = split(/\%/,$item); |
|
if ($num =~ /^\d+$/) { |
|
unless (grep(/^$num$/,@colls)) { |
|
push(@colls,$num); |
|
} |
|
my @entries = split(/\&/,$value); |
|
foreach my $entry (@entries) { |
|
my ($name,$fields) = split(/=/,$entry); |
|
$current{$num}{$name} = $fields; |
|
} |
|
} |
|
} |
|
} |
|
if (@colls) { |
|
@colls = sort { $a <=> $b } @colls; |
|
$next += $colls[-1]; |
|
} |
|
if ($env{'form.menucollections_add'} eq $next) { |
|
push(@colls,$next); |
|
} |
|
my $currdef = $values->{'menudefault'}; |
|
my $possdef = $env{'form.menudefault'}; |
|
if (($possdef =~ /^\d+$/) && (grep(/^$possdef$/,@colls))) { |
|
if ($currdef ne $possdef) { |
|
$changes->{'menudefault'} = $possdef; |
|
} |
|
} elsif ($currdef) { |
|
$changes->{'menudefault'} = ''; |
|
} |
|
my $menucoll; |
|
if (@colls) { |
|
my ($ordered,$cats) = &menuitems_categories(); |
|
my %shortcats = &menuitems_abbreviations(); |
|
foreach my $num (@colls) { |
|
my ($entry,%include); |
|
map { $include{$_}= 1; } &Apache::loncommon::get_env_multiple('form.menucollections_'.$num); |
|
foreach my $item (@{$ordered}) { |
|
if ($item eq 'shown') { |
|
foreach my $type (@{$cats->{$item}}) { |
|
$entry .= $type.'='; |
|
if ($include{$type}) { |
|
$entry .= 'y'; |
|
} else { |
|
$entry .= 'n'; |
|
} |
|
$entry .= '&'; |
|
} |
|
} else { |
|
$entry .= $shortcats{$item}.'='; |
|
foreach my $type (@{$cats->{$item}}) { |
|
if ($include{$type}) { |
|
$entry .= $type.','; |
|
} |
|
} |
|
$entry =~ s/,$//; |
|
$entry .= '&'; |
|
} |
|
} |
|
$entry =~ s/\&$//; |
|
if ($menucoll) { |
|
$menucoll .= ';'; |
|
} |
|
$menucoll .= $num.'%'.$entry; |
|
} |
|
if ($menucoll ne $values->{'menucollections'}) { |
|
$changes->{'menucollections'} = $menucoll; |
|
} |
|
} elsif ($values->{'menucollections'}) { |
|
$changes->{'menucollections'} = ''; |
|
} |
|
} elsif ($action eq 'linkprotection') { |
|
my %menutitles = <imenu_titles(); |
|
my (@items,%deletions,%itemids,%haschanges); |
|
if ($env{'form.linkprot_add'}) { |
|
my $name = $env{'form.linkprot_name_add'}; |
|
$name =~ s/(`)/'/g; |
|
my ($newid,$error) = &get_courselti_id($cdom,$cnum,$name); |
|
if ($newid) { |
|
$itemids{'add'} = $newid; |
|
push(@items,'add'); |
|
$haschanges{$newid} = 1; |
|
} else { |
|
$errors .= '<span class="LC_error">'. |
|
&mt('Failed to acquire unique ID for link protection'). |
|
'</span>'; |
|
} |
|
} |
|
if (ref($values->{'linkprotection'}) eq 'HASH') { |
|
my @todelete = &Apache::loncommon::get_env_multiple('form.linkprot_del'); |
|
my $maxnum = $env{'form.linkprot_maxnum'}; |
|
for (my $i=0; $i<=$maxnum; $i++) { |
|
my $itemid = $env{'form.linkprot_id_'.$i}; |
|
$itemid =~ s/\D+//g; |
|
if ($itemid) { |
|
if (ref($values->{'linkprotection'}->{$itemid}) eq 'HASH') { |
|
push(@items,$i); |
|
$itemids{$i} = $itemid; |
|
if ((@todelete > 0) && (grep(/^$i$/,@todelete))) { |
|
$deletions{$itemid} = $values->{'linkprotection'}->{$itemid}->{'name'}; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
foreach my $idx (@items) { |
|
my $itemid = $itemids{$idx}; |
|
next unless ($itemid); |
|
if (exists($deletions{$itemid})) { |
|
$courselti{$itemid} = $deletions{$itemid}; |
|
$haschanges{$itemid} = 1; |
|
next; |
|
} |
|
my %current; |
|
if (ref($values->{'linkprotection'}) eq 'HASH') { |
|
if (ref($values->{'linkprotection'}->{$itemid}) eq 'HASH') { |
|
foreach my $key (keys(%{$values->{'linkprotection'}->{$itemid}})) { |
|
$current{$key} = $values->{'linkprotection'}->{$itemid}->{$key}; |
|
} |
|
} |
|
} |
|
foreach my $inner ('name','key','secret','lifetime','version') { |
|
my $formitem = 'form.linkprot_'.$inner.'_'.$idx; |
|
$env{$formitem} =~ s/(`)/'/g; |
|
if ($inner eq 'lifetime') { |
|
$env{$formitem} =~ s/[^\d.]//g; |
|
} |
|
unless ($idx eq 'add') { |
|
if ($current{$inner} ne $env{$formitem}) { |
|
$haschanges{$itemid} = 1; |
|
} |
|
} |
|
if ($env{$formitem} ne '') { |
|
$courselti{$itemid}{$inner} = $env{$formitem}; |
|
} |
|
} |
|
} |
|
if (keys(%haschanges)) { |
|
foreach my $entry (keys(%haschanges)) { |
|
$changes->{$entry} = $courselti{$entry}; |
|
} |
|
} |
} else { |
} else { |
foreach my $entry (@ordered) { |
foreach my $entry (@ordered) { |
if ($entry eq 'cloners') { |
if ($entry eq 'cloners') { |
Line 855 sub process_changes {
|
Line 1075 sub process_changes {
|
my $clonedom = $env{'form.cloners_newdom'}; |
my $clonedom = $env{'form.cloners_newdom'}; |
if (&check_clone($clonedom,$disallowed) eq 'ok') { |
if (&check_clone($clonedom,$disallowed) eq 'ok') { |
my $newdom = '*:'.$env{'form.cloners_newdom'}; |
my $newdom = '*:'.$env{'form.cloners_newdom'}; |
if (@clonedoms) { |
if (@clonedoms) { |
if (!grep(/^\Q$newdom\E$/,@clonedoms)) { |
if (!grep(/^\Q$newdom\E$/,@clonedoms)) { |
$newvalues{$entry} .= ','.$newdom; |
$newvalues{$entry} .= ','.$newdom; |
} |
} |
Line 944 sub process_changes {
|
Line 1164 sub process_changes {
|
$autocoowner = $domconf{'autoenroll'}{'co-owners'}; |
$autocoowner = $domconf{'autoenroll'}{'co-owners'}; |
} |
} |
} |
} |
unless ($autocoowner) { |
if ($autocoowner) { |
|
$newvalues{'co-owners'} = $values->{'internal.co-owners'}; |
|
} else { |
my @keepcoowners = &Apache::loncommon::get_env_multiple('form.coowners'); |
my @keepcoowners = &Apache::loncommon::get_env_multiple('form.coowners'); |
my @pendingcoowners = &Apache::loncommon::get_env_multiple('form.pendingcoowners'); |
my @pendingcoowners = &Apache::loncommon::get_env_multiple('form.pendingcoowners'); |
my @invitecoowners = &Apache::loncommon::get_env_multiple('form.invitecoowners'); |
my @invitecoowners = &Apache::loncommon::get_env_multiple('form.invitecoowners'); |
Line 989 sub process_changes {
|
Line 1211 sub process_changes {
|
if ($pendingcoowners ne '') { |
if ($pendingcoowners ne '') { |
@newpending = @pendingcoown; |
@newpending = @pendingcoown; |
} |
} |
|
} else { |
|
@newcoown = @currcoown; |
} |
} |
$newvalues{'pendingco-owners'} = join(',',sort(@newpending)); |
$newvalues{'pendingco-owners'} = join(',',sort(@newpending)); |
$newvalues{'co-owners'} = join(',',sort(@newcoown)); |
$newvalues{'co-owners'} = join(',',sort(@newcoown)); |
Line 1058 sub process_changes {
|
Line 1282 sub process_changes {
|
} |
} |
} |
} |
} |
} |
} elsif (($entry eq 'plc.roles.denied') || ($entry eq 'pch.roles.denied')) { |
} elsif (($entry eq 'plc.roles.denied') || ($entry eq 'pch.roles.denied') || |
|
($entry eq 'pac.roles.denied')) { |
my @denied = &Apache::loncommon::get_env_multiple('form.'.$entry); |
my @denied = &Apache::loncommon::get_env_multiple('form.'.$entry); |
@denied = sort(@denied); |
@denied = sort(@denied); |
my $deniedstr = ''; |
my $deniedstr = ''; |
Line 1066 sub process_changes {
|
Line 1291 sub process_changes {
|
$deniedstr = join(',',@denied); |
$deniedstr = join(',',@denied); |
} |
} |
$newvalues{$entry} = $deniedstr; |
$newvalues{$entry} = $deniedstr; |
} elsif (($entry eq 'plc.users.denied') || ($entry eq 'pch.users.denied')) { |
} elsif (($entry eq 'plc.users.denied') || ($entry eq 'pch.users.denied') || |
|
($entry eq 'pac.users.denied')) { |
my $total = $env{'form.'.$entry.'_total'}; |
my $total = $env{'form.'.$entry.'_total'}; |
my $userstr = ''; |
my $userstr = ''; |
my @denied; |
my @denied; |
Line 1118 sub process_changes {
|
Line 1344 sub process_changes {
|
my ($classorder,$classtitles) = &discussion_vote_classes(); |
my ($classorder,$classtitles) = &discussion_vote_classes(); |
my $fontchange = 0; |
my $fontchange = 0; |
foreach my $class (@{$classorder}) { |
foreach my $class (@{$classorder}) { |
my $ext_entry = $entry.'_'.$class; |
my $ext_entry = $entry.'_'.$class; |
my $size = $env{'form.'.$ext_entry.'_size'}; |
my $size = $env{'form.'.$ext_entry.'_size'}; |
my $unit = $env{'form.'.$ext_entry.'_unit'}; |
my $unit = $env{'form.'.$ext_entry.'_unit'}; |
my $weight = $env{'form.'.$ext_entry.'_weight'}; |
my $weight = $env{'form.'.$ext_entry.'_weight'}; |
my $style = $env{'form.'.$ext_entry.'_style'}; |
my $style = $env{'form.'.$ext_entry.'_style'}; |
my $other = $env{'form.'.$ext_entry.'_other'}; |
my $other = $env{'form.'.$ext_entry.'_other'}; |
$size =~ s/,//g; |
$size =~ s/,//g; |
$unit =~ s/,//g; |
$unit =~ s/,//g; |
$weight =~ s/,//g; |
$weight =~ s/,//g; |
$style =~ s/,//g; |
$style =~ s/,//g; |
$other =~ s/[^\w;:\s\-\%.]//g; |
$other =~ s/[^\w;:\s\-\%.]//g; |
Line 1133 sub process_changes {
|
Line 1359 sub process_changes {
|
$newvalues{$ext_entry} = join(',',($size.$unit,$weight,$style,$other)); |
$newvalues{$ext_entry} = join(',',($size.$unit,$weight,$style,$other)); |
my $current = $values->{$ext_entry}; |
my $current = $values->{$ext_entry}; |
if ($values->{$ext_entry} eq '') { |
if ($values->{$ext_entry} eq '') { |
$current = ',,,'; |
$current = ',,,'; |
} |
} |
if ($newvalues{$ext_entry} ne $current) { |
if ($newvalues{$ext_entry} ne $current) { |
$changes->{$ext_entry} = $newvalues{$ext_entry}; |
$changes->{$ext_entry} = $newvalues{$ext_entry}; |
Line 1142 sub process_changes {
|
Line 1368 sub process_changes {
|
} |
} |
if ($fontchange) { |
if ($fontchange) { |
$changes->{$entry} = 1; |
$changes->{$entry} = 1; |
} |
} |
} elsif ($entry eq 'nothideprivileged') { |
} elsif ($entry eq 'nothideprivileged') { |
my @curr_nothide; |
my @curr_nothide; |
my @new_nothide; |
my @new_nothide; |
Line 1217 sub process_changes {
|
Line 1443 sub process_changes {
|
my $newtext = $maxnum-1; |
my $newtext = $maxnum-1; |
$newhdr[$env{'form.printfmthdr_pos_'.$newtext}] = $env{'form.printfmthdr_text_'.$newtext}; |
$newhdr[$env{'form.printfmthdr_pos_'.$newtext}] = $env{'form.printfmthdr_text_'.$newtext}; |
$newvalues{$entry} = join('',@newhdr); |
$newvalues{$entry} = join('',@newhdr); |
} elsif (($entry eq 'languages') || |
} elsif (($entry eq 'languages') || |
($entry eq 'checkforpriv')) { |
($entry eq 'checkforpriv')) { |
my $settings; |
my $settings; |
my $total = $env{'form.'.$entry.'_total'}; |
my $total = $env{'form.'.$entry.'_total'}; |
Line 1233 sub process_changes {
|
Line 1459 sub process_changes {
|
} |
} |
if ($env{'form.'.$entry.'_'.$total} ne '') { |
if ($env{'form.'.$entry.'_'.$total} ne '') { |
my $new = $env{'form.'.$entry.'_'.$total}; |
my $new = $env{'form.'.$entry.'_'.$total}; |
if ($entry eq 'languages') { |
if ($entry eq 'languages') { |
my %langchoices = &get_lang_choices(); |
my %langchoices = &get_lang_choices(); |
if ($langchoices{$new}) { |
if ($langchoices{$new}) { |
$settings .= $new; |
$settings .= $new; |
Line 1254 sub process_changes {
|
Line 1480 sub process_changes {
|
$settings =~ s/,$//; |
$settings =~ s/,$//; |
} |
} |
$newvalues{$entry} = $settings; |
$newvalues{$entry} = $settings; |
|
} elsif ($action eq 'lti') { |
|
if ($entry eq 'lti.override') { |
|
$newvalues{$entry} = $env{'form.'.$entry}; |
|
} elsif (($entry eq 'lti.topmenu') || ($entry eq 'lti.inlinemenu')) { |
|
if ($env{'form.lti.override'}) { |
|
$newvalues{$entry} = $env{'form.'.$entry}; |
|
} else { |
|
$newvalues{$entry} = ''; |
|
} |
|
} elsif ($entry eq 'lti.lcmenu') { |
|
if (($env{'form.lti.override'}) && |
|
(($env{'form.lti.topmenu'}) || ($env{'form.lti.inlinemenu'}))) { |
|
my @lcmenu = &Apache::loncommon::get_env_multiple('form.lti.lcmenu'); |
|
my @newlcmenu; |
|
if (@lcmenu) { |
|
my @menuitems = ('fullname','coursetitle','role','logout','grades'); |
|
foreach my $item (@menuitems) { |
|
next if (($item eq 'grades') && (!$newvalues{'lti.inlinemenu'})); |
|
if (grep(/^\Q$item\E$/,@lcmenu)) { |
|
push(@newlcmenu,$item); |
|
} |
|
} |
|
} |
|
if (@newlcmenu) { |
|
$newvalues{$entry} = join(',',@newlcmenu); |
|
} else { |
|
$newvalues{$entry} = 'none'; |
|
} |
|
} else { |
|
$newvalues{$entry} = ''; |
|
} |
|
} |
} else { |
} else { |
$newvalues{$entry} = $env{'form.'.$entry}; |
$newvalues{$entry} = $env{'form.'.$entry}; |
} |
} |
Line 1267 sub process_changes {
|
Line 1525 sub process_changes {
|
} |
} |
} |
} |
} |
} |
return; |
return $errors; |
|
} |
|
|
|
sub get_courselti_id { |
|
my ($cdom,$cnum,$name) = @_; |
|
# get lock on lti db in course |
|
my $lockhash = { |
|
lock => $env{'user.name'}. |
|
':'.$env{'user.domain'}, |
|
}; |
|
my $tries = 0; |
|
my $gotlock = &Apache::lonnet::newput('lti',$lockhash,$cdom,$cnum); |
|
my ($id,$error); |
|
while (($gotlock ne 'ok') && ($tries<10)) { |
|
$tries ++; |
|
sleep (0.1); |
|
$gotlock = &Apache::lonnet::newput('lti',$lockhash,$cdom,$cnum); |
|
} |
|
if ($gotlock eq 'ok') { |
|
my %currids = &Apache::lonnet::dump('lti',$cdom,$cnum,undef,undef,undef,1); |
|
if ($currids{'lock'}) { |
|
delete($currids{'lock'}); |
|
if (keys(%currids)) { |
|
my @curr = sort { $a <=> $b } keys(%currids); |
|
if ($curr[-1] =~ /^\d+$/) { |
|
$id = 1 + $curr[-1]; |
|
} else { |
|
$id = 1; |
|
} |
|
} else { |
|
$id = 1; |
|
} |
|
if ($id) { |
|
unless (&Apache::lonnet::newput('lti',{ $id => $name },$cdom,$cnum) eq 'ok') { |
|
$error = 'nostore'; |
|
} |
|
} else { |
|
$error = 'nonumber'; |
|
} |
|
} |
|
my $dellockoutcome = &Apache::lonnet::del('lti',['lock'],$cdom,$cnum); |
|
} else { |
|
$error = 'nolock'; |
|
} |
|
return ($id,$error); |
} |
} |
|
|
sub get_sec_str { |
sub get_sec_str { |
Line 1312 sub check_clone {
|
Line 1614 sub check_clone {
|
sub store_changes { |
sub store_changes { |
my ($cdom,$cnum,$prefs_order,$actions,$prefs,$values,$changes,$crstype) = @_; |
my ($cdom,$cnum,$prefs_order,$actions,$prefs,$values,$changes,$crstype) = @_; |
my ($chome,$output); |
my ($chome,$output); |
my (%storehash,@delkeys,@need_env_update,@oldcloner); |
my (%storehash,@delkeys,@need_env_update,@oldcloner,%oldlinkprot); |
if ((ref($values) eq 'HASH') && (ref($changes) eq 'HASH')) { |
if ((ref($values) eq 'HASH') && (ref($changes) eq 'HASH')) { |
|
if (ref($values->{'linkprotection'}) eq 'HASH') { |
|
%oldlinkprot = %{$values->{'linkprotection'}}; |
|
} |
|
delete($values->{'linkprotection'}); |
%storehash = %{$values}; |
%storehash = %{$values}; |
} else { |
} else { |
if ($crstype eq 'Community') { |
if ($crstype eq 'Community') { |
Line 1323 sub store_changes {
|
Line 1629 sub store_changes {
|
} |
} |
return $output; |
return $output; |
} |
} |
|
my ($numchanges,$skipstore); |
|
if (ref($changes) eq 'HASH') { |
|
$numchanges = scalar(keys(%{$changes})); |
|
if (($numchanges == 1) && (exists($changes->{'linkprotection'}))) { |
|
$skipstore = 1; |
|
} elsif (!$numchanges) { |
|
if ($crstype eq 'Community') { |
|
$output = &mt('No changes made to community settings.'); |
|
} else { |
|
$output = &mt('No changes made to course settings.'); |
|
} |
|
return $output; |
|
} |
|
} |
my %yesno = ( |
my %yesno = ( |
hidefromcat => '1', |
hidefromcat => '1', |
problem_stream_switch => '1', |
problem_stream_switch => '1', |
Line 1335 sub store_changes {
|
Line 1655 sub store_changes {
|
if (grep(/^\Q$item\E$/,@{$actions})) { |
if (grep(/^\Q$item\E$/,@{$actions})) { |
$output .= '<h3>'.&mt($prefs->{$item}{'text'}).'</h3>'; |
$output .= '<h3>'.&mt($prefs->{$item}{'text'}).'</h3>'; |
if (ref($changes->{$item}) eq 'HASH') { |
if (ref($changes->{$item}) eq 'HASH') { |
if (keys(%{$changes->{$item}}) > 0) { |
if ((keys(%{$changes->{$item}}) > 0) || ($item eq 'linkprotection')) { |
$output .= &mt('Changes made:').'<ul style="list-style:none;">'; |
$output .= &mt('Changes made:').'<ul style="list-style:none;">'; |
if ($item eq 'other') { |
if ($item eq 'other') { |
foreach my $key (sort(keys(%{$changes->{$item}}))) { |
foreach my $key (sort(keys(%{$changes->{$item}}))) { |
Line 1348 sub store_changes {
|
Line 1668 sub store_changes {
|
"'$storehash{$key}'")).'</li>'; |
"'$storehash{$key}'")).'</li>'; |
} |
} |
} |
} |
|
} elsif ($item eq 'linkprotection') { |
|
if (&Apache::lonnet::put('lti',$changes->{'linkprotection'},$cdom,$cnum,1) eq 'ok') { |
|
my $hashid=$cdom.'_'.$cnum; |
|
&Apache::lonnet::devalidate_cache_new('courselti',$hashid); |
|
foreach my $itemid (sort { $a <=> $b } %{$changes->{'linkprotection'}}) { |
|
if (ref($changes->{'linkprotection'}->{$itemid}) eq 'HASH') { |
|
my %values = %{$changes->{'linkprotection'}->{$itemid}}; |
|
my %desc = &linkprot_names(); |
|
my $display; |
|
foreach my $title ('name','lifetime','version','key','secret') { |
|
if ($title eq 'secret') { |
|
my $length = length($values{$title}); |
|
$display .= $desc{$title}.': '.('*' x $length); |
|
} elsif ($title eq 'version') { |
|
if ($values{$title} eq 'LTI-1p0') { |
|
$display .= $desc{$title}.': 1.1, '; |
|
} |
|
} else { |
|
$display .= $desc{$title}.': '.$values{$title}.', '; |
|
} |
|
} |
|
$output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt('[_1] set to [_2]','<i>'.$itemid.'</i>', |
|
"'$display'")).'</li>'; |
|
} elsif (ref($oldlinkprot{$itemid}) eq 'HASH') { |
|
my $oldname = $oldlinkprot{$itemid}{'name'}; |
|
$output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt('Deleted setting for [_1]','<i>'."$itemid ($oldname)".'</i>')).'</li>'; |
|
} |
|
} |
|
} else { |
|
$output .= '<li>'. |
|
'<span class="LC_error">'. |
|
&mt('An error occurred when saving changes to link protection settings, which remain unchanged.'). |
|
'</span>'. |
|
'</li>'; |
|
} |
} else { |
} else { |
if (ref($prefs->{$item}->{'ordered'}) eq 'ARRAY') { |
if (ref($prefs->{$item}->{'ordered'}) eq 'ARRAY') { |
my @settings = @{$prefs->{$item}->{'ordered'}}; |
my @settings = @{$prefs->{$item}->{'ordered'}}; |
Line 1464 sub store_changes {
|
Line 1819 sub store_changes {
|
} |
} |
} |
} |
$displayname = &mt($text); |
$displayname = &mt($text); |
|
} elsif ($item eq 'lti') { |
|
if ($key eq 'lti.lcmenu') { |
|
if ($changes->{$item}{$key} eq 'none') { |
|
$displayval = &mt('None of the configurable menu items displayed'); |
|
} else { |
|
my %ltititles = <imenu_titles(); |
|
$displayval = join(', ', map { $ltititles{$_}; } split(/,/,$changes->{$item}{$key})); |
|
} |
|
} else { |
|
if ($changes->{$item}{$key} eq '1') { |
|
$displayval = &mt('Yes'); |
|
} elsif ($changes->{$item}{$key} eq '') { |
|
$displayval = &mt('No'); |
|
} |
|
} |
|
$displayname = &mt($text); |
|
} elsif ($item eq 'menuitems') { |
|
unless ($changes->{$item}{$key} eq '') { |
|
if ($key eq 'menudefault') { |
|
$displayname = &mt('Default collection of menu items'); |
|
$displayval = &mt('Collection: [_1]', |
|
$changes->{$item}{$key}); |
|
} elsif ($key eq 'menucollections') { |
|
$displayval = &menucollections_display($changes->{$item}{$key}); |
|
} |
|
} |
} else { |
} else { |
$displayname = &mt($text); |
$displayname = &mt($text); |
} |
} |
Line 1527 sub store_changes {
|
Line 1908 sub store_changes {
|
} |
} |
} elsif ($changes->{$item}{$key} eq '') { |
} elsif ($changes->{$item}{$key} eq '') { |
push(@delkeys,$key); |
push(@delkeys,$key); |
$output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt('Deleted setting for [_1]', |
if ($item eq 'lti') { |
'<i>'.$displayname.'</i>')).'</li>'; |
if (($key eq 'lti.override') || (($key ne 'lti.override') && ($env{'form.lti.override'} ne ''))) { |
|
if (($key eq 'lti.lcmenu') && |
|
((!$env{'form.lti.topmenu'}) && (!$env{'form.lti.inlinemenu'}))) { |
|
$output .= '<li>'.&mt('LTI settings for menu items only saved if page header and/or inline menu is set to be displayed').'</li>'; |
|
} else { |
|
$output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt('[_1] set to [_2]', |
|
'<i>'.$displayname.'</i>', |
|
"'<b>$displayval</b>'")).'</li>'; |
|
} |
|
} elsif (!exists($changes->{$item}{'lti.override'})) { |
|
$output .= '<li>'.&mt('LTI settings only saved if Override is set to "Yes"').'</li>'; |
|
} |
|
} elsif ($item eq 'menuitems') { |
|
if ($key eq 'menudefault') { |
|
$output .= '<li>'.&mt("Default collection of menu items set to: 'Standard' (all menus shown)").'</li>'; |
|
} elsif ($key eq 'menucollections') { |
|
$output .= '<li>'.&mt('Specific collections of menus no longer available').'</li>'; |
|
} |
|
} else { |
|
$output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt('Deleted setting for [_1]', |
|
'<i>'.$displayname.'</i>')).'</li>'; |
|
} |
|
} elsif ($key eq 'menucollections') { |
|
$output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt('Numbered menu collections:')).'<br />'. |
|
$displayval.'</li>'; |
} else { |
} else { |
$output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt('[_1] set to [_2]', |
$output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt('[_1] set to [_2]', |
'<i>'.$displayname.'</i>', |
'<i>'.$displayname.'</i>', |
Line 1567 sub store_changes {
|
Line 1972 sub store_changes {
|
} |
} |
if (($key eq 'description') || ($key eq 'cloners') || |
if (($key eq 'description') || ($key eq 'cloners') || |
($key eq 'hidefromcat') || ($key eq 'categories') || |
($key eq 'hidefromcat') || ($key eq 'categories') || |
($key eq 'co-owners')) { |
($key eq 'co-owners') || ($key eq 'lti.override') || |
|
($key eq 'lti.topmenu') || ($key eq 'lti.inlinemenu') || |
|
($key eq 'lti.lcmenu')) { |
push(@need_env_update,$key); |
push(@need_env_update,$key); |
} |
} |
} |
} |
Line 1584 sub store_changes {
|
Line 1991 sub store_changes {
|
} |
} |
} |
} |
} |
} |
|
if ($skipstore) { |
|
return $output; |
|
} |
if (&Apache::lonnet::put('environment',\%storehash,$cdom,$cnum) eq 'ok') { |
if (&Apache::lonnet::put('environment',\%storehash,$cdom,$cnum) eq 'ok') { |
if (ref($changes) eq 'HASH') { |
if (ref($changes) eq 'HASH') { |
if (ref($changes->{'courseinfo'}) eq 'HASH') { |
if (ref($changes->{'courseinfo'}) eq 'HASH') { |
Line 1651 sub update_env {
|
Line 2061 sub update_env {
|
my @coowners = split(',',$storehash->{'internal.'.$key}); |
my @coowners = split(',',$storehash->{'internal.'.$key}); |
$crsinfo{$env{'request.course.id'}}{'co-owners'} = \@coowners; |
$crsinfo{$env{'request.course.id'}}{'co-owners'} = \@coowners; |
$count ++; |
$count ++; |
|
} elsif ($key =~ /^lti\./) { |
|
&Apache::lonnet::appenv({'course.'.$env{'request.course.id'}.'.'.$key => $storehash->{$key}}); |
} |
} |
} |
} |
if ($count) { |
if ($count) { |
Line 1754 sub get_course {
|
Line 2166 sub get_course {
|
} |
} |
|
|
sub get_jscript { |
sub get_jscript { |
my ($cid,$cdom,$phase,$crstype,$settings) = @_; |
my ($cid,$cdom,$phase,$crstype,$settings,$noedit) = @_; |
my ($can_toggle_cat,$can_categorize) = &can_modify_catsettings($cdom,$crstype); |
my ($can_toggle_cat,$can_categorize) = &can_modify_catsettings($cdom,$crstype); |
my ($jscript,$categorize_js,$loncaparev_js,$instcode_js); |
my ($jscript,$categorize_js,$loncaparev_js,$instcode_js); |
my $stubrowse_js = &Apache::loncommon::studentbrowser_javascript(); |
my $stubrowse_js = &Apache::loncommon::studentbrowser_javascript(); |
Line 1779 sub get_jscript {
|
Line 2191 sub get_jscript {
|
$local_to_standard{$code_order[$i]} = $standardnames[$i]; |
$local_to_standard{$code_order[$i]} = $standardnames[$i]; |
} |
} |
foreach my $cloner (@cloners) { |
foreach my $cloner (@cloners) { |
if (($cloner !~ /^\Q*:\E$match_domain$/) && |
if (($cloner !~ /^\Q*:\E$match_domain$/) && |
($cloner !~ /^$match_username\:$match_domain$/)) { |
($cloner !~ /^$match_username\:$match_domain$/)) { |
foreach my $item (split(/\&/,$cloner)) { |
foreach my $item (split(/\&/,$cloner)) { |
my ($key,$val) = split(/\=/,$item); |
my ($key,$val) = split(/\=/,$item); |
Line 1880 function syllabusinfo() {
|
Line 2292 function syllabusinfo() {
|
} |
} |
} |
} |
ENDSCRIPT |
ENDSCRIPT |
|
my $menuitems_js; |
|
unless ($noedit) { |
|
my $collections; |
|
my $next = 1; |
|
if (ref($settings) eq 'HASH') { |
|
if ($settings->{'menucollections'} ne '') { |
|
my @current; |
|
foreach my $item (split(/;/,$settings->{'menucollections'})) { |
|
my ($num) = split(/\%/,$item); |
|
if ($num =~ /^\d+$/) { |
|
push(@current,$num); |
|
} |
|
} |
|
$collections = join("','",sort { $a <=> $b } @current); |
|
if ($collections) { |
|
$collections = "'$collections'"; |
|
} |
|
$next += $current[-1]; |
|
} |
|
} |
|
my $deftext = &mt('Standard (all menus shown)'); |
|
$menuitems_js = <<ENDSCRIPT; |
|
function toggleAddmenucoll() { |
|
if (document.getElementById('menucollections_add')) { |
|
var state = 'none'; |
|
var add = document.getElementById('menucollections_add').checked; |
|
if (add) { |
|
state = 'inline-block'; |
|
} |
|
var fieldsets = new Array('shown','text','links','list','inline'); |
|
for (var i=0; i<fieldsets.length; i++) { |
|
if (document.getElementById('addmenucoll_'+fieldsets[i])) { |
|
document.getElementById('addmenucoll_'+fieldsets[i]).style.display = state; |
|
} |
|
} |
|
var box = document.getElementsByClassName('LC_menucoll_add'); |
|
if (box.length) { |
|
for (var i=0; i<box.length; i++) { |
|
if (add) { |
|
box[i].checked = true; |
|
} else { |
|
box[i].checked = false; |
|
} |
|
} |
|
} |
|
if (document.getElementById('menudefault')) { |
|
var menudef = document.getElementById('menudefault'); |
|
var currsel = menudef.selectedIndex; |
|
var colls = new Array($collections); |
|
menudef.options.length = 0; |
|
if (!add) { |
|
if (currsel == 1 + colls.length) { |
|
currsel = 0; |
|
} |
|
} |
|
if (currsel == 0) { |
|
menudef.options[0] = new Option('$deftext','',true,true); |
|
} else { |
|
menudef.options[0] = new Option('$deftext','',false,false); |
|
} |
|
if (colls.length) { |
|
for (var i=0; i<colls.length; i++) { |
|
var idx = i+1; |
|
if (currsel == colls[i]) { |
|
menudef.options[idx] = new Option(colls[i],colls[i],true,true); |
|
} else { |
|
menudef.options[idx] = new Option(colls[i],colls[i],false,false); |
|
} |
|
} |
|
} |
|
if (add) { |
|
var addidx = 1 + colls.length; |
|
if (currsel == addidx) { |
|
menudef.options[addidx] = new Option('$next','$next',true,true); |
|
} else { |
|
menudef.options[addidx] = new Option('$next','$next',false,false); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
ENDSCRIPT |
|
} |
$jscript = '<script type="text/javascript" language="Javascript">'."\n". |
$jscript = '<script type="text/javascript" language="Javascript">'."\n". |
'// <![CDATA['."\n". |
'// <![CDATA['."\n". |
$browse_js."\n".$categorize_js."\n".$loncaparev_js."\n". |
$browse_js."\n".$categorize_js."\n".$loncaparev_js."\n". |
$cloners_js."\n".$instcode_js. |
$cloners_js."\n".$instcode_js. |
$syllabus_js."\n".'//]]>'."\n". |
$syllabus_js."\n".$menuitems_js."\n".'//]]>'."\n". |
'</script>'."\n".$stubrowse_js."\n"; |
'</script>'."\n".$stubrowse_js."\n"; |
return $jscript; |
return $jscript; |
} |
} |
Line 2064 sub print_courseinfo {
|
Line 2559 sub print_courseinfo {
|
&mt('Modification may make assessment data inaccessible!'). |
&mt('Modification may make assessment data inaccessible!'). |
'</span>'; |
'</span>'; |
$editsyllabus = &mt('[_1]Edit[_2]','<a href="/public/'.$cdom.'/'.$cnum.'/syllabus?forceedit=1">', |
$editsyllabus = &mt('[_1]Edit[_2]','<a href="/public/'.$cdom.'/'.$cnum.'/syllabus?forceedit=1">', |
'</a>'); |
'</a>'); |
} |
} |
my %items = ( |
my %items = ( |
'url' => { |
'url' => { |
Line 2145 sub print_courseinfo {
|
Line 2640 sub print_courseinfo {
|
next if (!$env{'course.'.$env{'request.course.id'}.'.internal.uniquecode'}); |
next if (!$env{'course.'.$env{'request.course.id'}.'.internal.uniquecode'}); |
} |
} |
unless (($item eq 'cloners') || ($item eq 'rolenames')) { |
unless (($item eq 'cloners') || ($item eq 'rolenames')) { |
$colspan = 2; |
$colspan = 2; |
} |
} |
$count ++; |
$count ++; |
if (exists $items{$item}{advanced} && $items{$item}{advanced} == 1) { |
if (exists $items{$item}{advanced} && $items{$item}{advanced} == 1) { |
Line 2189 sub print_courseinfo {
|
Line 2684 sub print_courseinfo {
|
$default = '0'; |
$default = '0'; |
} |
} |
$datatable .= &new_cloners_dom_row($cdom,'0',$default); |
$datatable .= &new_cloners_dom_row($cdom,'0',$default); |
} |
} |
} elsif ($settings->{$item} ne '*') { |
} elsif ($settings->{$item} ne '*') { |
my @entries = split(/,/,$settings->{$item}); |
my @entries = split(/,/,$settings->{$item}); |
if (@entries > 0) { |
if (@entries > 0) { |
Line 2328 sub print_courseinfo {
|
Line 2823 sub print_courseinfo {
|
if ($clonesrc =~ m{/$match_domain/$match_courseid}) { |
if ($clonesrc =~ m{/$match_domain/$match_courseid}) { |
my %clonesrcinfo = &Apache::lonnet::coursedescription($clonesrc); |
my %clonesrcinfo = &Apache::lonnet::coursedescription($clonesrc); |
if ($clonesrcinfo{'description'}) { |
if ($clonesrcinfo{'description'}) { |
$clonedfrom = $clonesrcinfo{'description'}.' '.($clonesrc); |
$clonedfrom = $clonesrcinfo{'description'}.' '.($clonesrc); |
} |
} |
} |
} |
$datatable .= $clonedfrom; |
$datatable .= $clonedfrom; |
} elsif ($item eq 'uniquecode') { |
} elsif ($item eq 'uniquecode') { |
my $code = $env{'course.'.$env{'request.course.id'}.'.internal.uniquecode'}; |
my $code = $env{'course.'.$env{'request.course.id'}.'.internal.uniquecode'}; |
if ($code) { |
if ($code) { |
$datatable .= $code; |
$datatable .= $code; |
} |
} |
Line 2380 sub print_courseinfo {
|
Line 2875 sub print_courseinfo {
|
} elsif ($uploaded) { |
} elsif ($uploaded) { |
$datatable .= &mt('Uploaded file'); |
$datatable .= &mt('Uploaded file'); |
} else { |
} else { |
$datatable .= &mt('Standard template'); |
$datatable .= &mt('Standard template'); |
} |
} |
$datatable .= (' ' x 2). |
$datatable .= (' ' x 2). |
&mt('[_1]View[_2]', |
&mt('[_1]View[_2]', |
'<a href="javascript:syllabusinfo();">', |
'<a href="javascript:syllabusinfo();">', |
'</a>'); |
'</a>'); |
} elsif ($item eq 'loncaparev') { |
} elsif ($item eq 'loncaparev') { |
my $loncaparev = $env{'course.'.$env{'request.course.id'}.'.internal.releaserequired'}; |
my $loncaparev = $env{'course.'.$env{'request.course.id'}.'.internal.releaserequired'}; |
my $showreqd; |
my $showreqd; |
Line 2410 sub new_cloners_dom_row {
|
Line 2905 sub new_cloners_dom_row {
|
my ($output,$checkedon,$checkedoff); |
my ($output,$checkedon,$checkedoff); |
if ($newdom ne '') { |
if ($newdom ne '') { |
if ($num eq $default) { |
if ($num eq $default) { |
$checkedon = 'checked="checked" '; |
$checkedon = 'checked="checked" '; |
} else { |
} else { |
$checkedoff = 'checked="checked" '; |
$checkedoff = 'checked="checked" '; |
} |
} |
Line 2561 ENDSCRIPT
|
Line 3056 ENDSCRIPT
|
|
|
sub display_loncaparev_constraints { |
sub display_loncaparev_constraints { |
my ($r,$navmap,$loncaparev,$crstype) = @_; |
my ($r,$navmap,$loncaparev,$crstype) = @_; |
my ($reqdmajor,$reqdminor); |
my ($reqdmajor,$reqdminor); |
my $cid = $env{'request.course.id'}; |
my $cid = $env{'request.course.id'}; |
my $cdom = $env{'course.'.$cid.'.domain'}; |
my $cdom = $env{'course.'.$cid.'.domain'}; |
my $cnum = $env{'course.'.$cid.'.num'}; |
my $cnum = $env{'course.'.$cid.'.num'}; |
Line 2578 sub display_loncaparev_constraints {
|
Line 3073 sub display_loncaparev_constraints {
|
$Apache::lonrelrequtils::checkcrstypes{$crstype}).'</h4>'; |
$Apache::lonrelrequtils::checkcrstypes{$crstype}).'</h4>'; |
} |
} |
my (%fromparam,%rowspan,%bymap,%byresource,@scopeorder,%toshow,%allmaps, |
my (%fromparam,%rowspan,%bymap,%byresource,@scopeorder,%toshow,%allmaps, |
%byresponsetype,%bysubmission,%fromblocks); |
%byresponsetype,%bysubmission,%fromblocks,%bycrsrestype); |
@scopeorder = ('all','section/group','user'); |
@scopeorder = ('all','section/group','user'); |
my $now = time; |
my $now = time; |
my $resourcedata = &Apache::lonparmset::readdata($cnum,$cdom); |
my $resourcedata = &Apache::lonparmset::readdata($cnum,$cdom); |
if (ref($resourcedata) eq 'HASH') { |
if (ref($resourcedata) eq 'HASH') { |
foreach my $key (keys(%{$resourcedata})) { |
foreach my $key (keys(%{$resourcedata})) { |
|
my %found; |
foreach my $item (keys(%Apache::lonrelrequtils::checkparms)) { |
foreach my $item (keys(%Apache::lonrelrequtils::checkparms)) { |
if ($key =~ /(\Q$item\E)$/) { |
if ($key =~ /(\Q$item\E)$/) { |
if (ref($Apache::lonrelrequtils::checkparms{$item}) eq 'ARRAY') { |
if (ref($Apache::lonrelrequtils::checkparms{$item}) eq 'ARRAY') { |
my $value = $resourcedata->{$key}; |
my $value = $resourcedata->{$key}; |
if ($item eq 'examcode') { |
if ($item eq 'examcode') { |
if (&Apache::lonnet::validCODE($value)) { |
if (&Apache::lonnet::validCODE($value)) { |
$value = 'valid'; |
$value = 'valid'; |
} else { |
} else { |
$value = ''; |
$value = ''; |
} |
} |
} elsif ($item eq 'printstartdate') { |
} elsif ($item eq 'printstartdate') { |
if ($value =~ /^\d+$/) { |
if ($value =~ /^\d+$/) { |
if ($value > $now) { |
if ($value > $now) { |
$value = 'future'; |
$value = 'future'; |
} |
} |
} |
} |
} elsif ($item eq 'printenddate') { |
} elsif ($item eq 'printenddate') { |
if ($value =~ /^\d+$/) { |
if ($value =~ /^\d+$/) { |
if ($value < $now) { |
if ($value < $now) { |
$value = 'past'; |
$value = 'past'; |
} |
} |
} |
} |
|
} |
} |
if (grep(/^\Q$value\E$/,@{$Apache::lonrelrequtils::checkparms{$item}})) { |
my ($middle,$scope,$which,$level,$map,$resource); |
my $stdtype = &Apache::lonparmset::standard_parameter_types($item); |
if (grep(/^\Q$value\E$/,@{$Apache::lonrelrequtils::checkparms{$item}})) { |
$found{$item}{'valname'} = &get_param_description($stdtype,$value); |
my $stdtype = &Apache::lonparmset::standard_parameter_types($item); |
$found{$item}{'rev'} = $Apache::lonnet::needsrelease{'parameter:'.$item.':'.$value.'::'}; |
my $stdname = &Apache::lonparmset::standard_parameter_names($item); |
} |
my $valname = &get_param_description($stdtype,$value); |
} |
my $rev = $Apache::lonnet::needsrelease{'parameter:'.$item.':'.$value}; |
} |
my $start = $cid.'.'; |
} |
if ($key =~ /^\Q$start\E(\[useropt\:($match_username\:$match_domain)\]\.)/) { |
foreach my $item (keys(%Apache::lonrelrequtils::checkparmvalsmatch)) { |
$middle = $1; |
if (ref($Apache::lonrelrequtils::checkparmvalsmatch{$item}) eq 'ARRAY') { |
$which = $2; |
my $value = $resourcedata->{$key}; |
$scope = 'user'; |
foreach my $valuematch (@{$Apache::lonrelrequtils::checkparmvalsmatch{$item}}) { |
} elsif ($key =~ /^\Q$start\E(\[(\w+)\]\.)/) { |
if ($value =~ /$valuematch/) { |
$middle = $1; |
my $stdtype = &Apache::lonparmset::standard_parameter_types($item); |
$which = $2; |
$found{$item}{'valname'} = &get_param_description($stdtype,$value,1); |
$scope = 'section/group'; |
$found{$item}{'rev'} = |
} else { |
$Apache::lonnet::needsrelease{'parameter:'.$item.'::'.$valuematch.':'}; |
$scope = 'all'; |
last; |
} |
} |
my $what="$stdname=$valname"; |
} |
if ($key =~ /^\Q$start$middle\E\w+\.\Q$item\E$/) { |
} |
$level = 'general'; |
} |
if ($scope eq 'all') { |
foreach my $item (keys(%Apache::lonrelrequtils::checkparmnamesmatch)) { |
if (ref($fromparam{$rev}{$scope}) eq 'ARRAY') { |
my $regexp; |
unless(grep(/^\Q$what\E$/,@{$fromparam{$rev}{$scope}})) { |
if ($item eq 'maplevelrecurse') { |
push(@{$fromparam{$rev}{$scope}},$what); |
$regexp = '\.(?:sequence|page)___\(rec\)\.'; |
} |
} |
} else { |
if ($regexp ne '') { |
push(@{$fromparam{$rev}{$scope}},$what); |
if ($key =~ /$regexp.*\.(\w+)$/) { |
} |
my $name = $1; |
} else { |
my $value = $resourcedata->{$key}; |
if (ref($fromparam{$rev}{$scope}{$which}) eq 'ARRAY') { |
if ($name eq 'type') { |
unless (grep(/^\Q$what\E$/,@{$fromparam{$rev}{$scope}{$which}})) { |
last unless (($value eq 'problem') || ($value eq 'practice') || ($value eq 'exam') || |
push(@{$fromparam{$rev}{$scope}{$which}},$what); |
($value eq 'survey') || ($value eq 'surveycred') || ($value eq 'anonsurvey') || |
} |
($value eq 'anonsurveycred') || ($value eq 'randomizetry') || ($value eq 'library')); |
} else { |
} |
push(@{$fromparam{$rev}{$scope}{$which}},$what); |
my $stdtype = &Apache::lonparmset::standard_parameter_types($name); |
} |
$found{$name}{'valname'} = &get_param_description($stdtype,$value); |
} |
$found{$name}{'extra'} = &mt('Recursive into sub-folders'); |
$rowspan{$rev} ++; |
$found{$name}{'rev'} = |
} elsif ($key =~ /^\Q$start$middle\E(.+)___\(all\).\w+\.\Q$item\E$/) { |
$Apache::lonnet::needsrelease{'parameter::::'.$item}; |
$level = 'folder'; |
} |
$map = $1; |
} |
if ($scope eq 'all') { |
} |
if (ref($bymap{$map}{$rev}{$scope}) eq 'ARRAY') { |
foreach my $item (keys(%found)) { |
unless(grep(/^\Q$what\E$/,@{$bymap{$map}{$rev}{$scope}})) { |
my $stdname = &Apache::lonparmset::standard_parameter_names($item); |
push(@{$bymap{$map}{$rev}{$scope}},$what); |
my $rev = $found{$item}{'rev'}; |
} |
my $valname = $found{$item}{'valname'}; |
} else { |
my $extra = $found{$item}{'extra'}; |
push(@{$bymap{$map}{$rev}{$scope}},$what); |
my ($middle,$scope,$which,$level,$map,$resource); |
} |
my $start = $cid.'.'; |
} else { |
if ($key =~ /^\Q$start\E(\[useropt\:($match_username\:$match_domain)\]\.)/) { |
if (ref($bymap{$map}{$rev}{$scope}{$which}) eq 'ARRAY') { |
$middle = $1; |
unless(grep(/^\Q$what\E$/,@{$bymap{$map}{$rev}{$scope}{$which}})) { |
$which = $2; |
push(@{$bymap{$map}{$rev}{$scope}{$which}},$what); |
$scope = 'user'; |
} |
} elsif ($key =~ /^\Q$start\E(\[(\w+)\]\.)/) { |
} else { |
$middle = $1; |
push(@{$bymap{$map}{$rev}{$scope}{$which}},$what); |
$which = $2; |
} |
$scope = 'section/group'; |
} |
} else { |
} elsif ($key =~ /^\Q$start$middle\E(.+)\.\w+\.\Q$item\E$/) { |
$scope = 'all'; |
$level = 'resource'; |
} |
$resource = $1; |
my $what="$stdname=$valname"; |
if ($scope eq 'all') { |
if ($extra) { |
if (ref($byresource{$resource}{$rev}{$scope}) eq 'ARRAY') { |
$what .= "<br/>$extra<br />"; |
unless(grep(/^\Q$what\E$/,@{$byresource{$resource}{$rev}{$scope}})) { |
} |
push(@{$byresource{$resource}{$rev}{$scope}},$what); |
if ($key =~ /^\Q$start$middle\E\w+\.\Q$item\E$/) { |
} |
$level = 'general'; |
} else { |
if ($scope eq 'all') { |
push(@{$byresource{$resource}{$rev}{$scope}},$what); |
if (ref($fromparam{$rev}{$scope}) eq 'ARRAY') { |
} |
unless(grep(/^\Q$what\E$/,@{$fromparam{$rev}{$scope}})) { |
} else { |
push(@{$fromparam{$rev}{$scope}},$what); |
if (ref($byresource{$resource}{$rev}{$scope}{$which}) eq 'ARRAY') { |
} |
unless (grep(/^\Q$what\E$/,@{$byresource{$resource}{$rev}{$scope}{$which}})) { |
} else { |
push(@{$byresource{$resource}{$rev}{$scope}{$which}},$what); |
push(@{$fromparam{$rev}{$scope}},$what); |
} |
} |
} else { |
} else { |
push(@{$byresource{$resource}{$rev}{$scope}{$which}},$what); |
if (ref($fromparam{$rev}{$scope}{$which}) eq 'ARRAY') { |
} |
unless (grep(/^\Q$what\E$/,@{$fromparam{$rev}{$scope}{$which}})) { |
} |
push(@{$fromparam{$rev}{$scope}{$which}},$what); |
} |
} |
|
} else { |
|
push(@{$fromparam{$rev}{$scope}{$which}},$what); |
|
} |
|
} |
|
$rowspan{$rev} ++; |
|
} elsif ($key =~ /^\Q$start$middle\E(.+)___\((all|rec)\).\w+\.\Q$item\E$/) { |
|
$level = 'folder'; |
|
$map = $1; |
|
if ($scope eq 'all') { |
|
if (ref($bymap{$map}{$rev}{$scope}) eq 'ARRAY') { |
|
unless(grep(/^\Q$what\E$/,@{$bymap{$map}{$rev}{$scope}})) { |
|
push(@{$bymap{$map}{$rev}{$scope}},$what); |
|
} |
|
} else { |
|
push(@{$bymap{$map}{$rev}{$scope}},$what); |
|
} |
|
} else { |
|
if (ref($bymap{$map}{$rev}{$scope}{$which}) eq 'ARRAY') { |
|
unless(grep(/^\Q$what\E$/,@{$bymap{$map}{$rev}{$scope}{$which}})) { |
|
push(@{$bymap{$map}{$rev}{$scope}{$which}},$what); |
|
} |
|
} else { |
|
push(@{$bymap{$map}{$rev}{$scope}{$which}},$what); |
|
} |
|
} |
|
} elsif ($key =~ /^\Q$start$middle\E(.+)\.\w+\.\Q$item\E$/) { |
|
$level = 'resource'; |
|
$resource = $1; |
|
if ($scope eq 'all') { |
|
if (ref($byresource{$resource}{$rev}{$scope}) eq 'ARRAY') { |
|
unless(grep(/^\Q$what\E$/,@{$byresource{$resource}{$rev}{$scope}})) { |
|
push(@{$byresource{$resource}{$rev}{$scope}},$what); |
|
} |
|
} else { |
|
push(@{$byresource{$resource}{$rev}{$scope}},$what); |
|
} |
|
} else { |
|
if (ref($byresource{$resource}{$rev}{$scope}{$which}) eq 'ARRAY') { |
|
unless (grep(/^\Q$what\E$/,@{$byresource{$resource}{$rev}{$scope}{$which}})) { |
|
push(@{$byresource{$resource}{$rev}{$scope}{$which}},$what); |
|
} |
|
} else { |
|
push(@{$byresource{$resource}{$rev}{$scope}{$which}},$what); |
} |
} |
} |
} |
} |
} |
Line 2787 sub display_loncaparev_constraints {
|
Line 3326 sub display_loncaparev_constraints {
|
if (ref($fromblocks{$type}) eq 'HASH') { |
if (ref($fromblocks{$type}) eq 'HASH') { |
foreach my $rev (keys(%{$fromblocks{$type}})) { |
foreach my $rev (keys(%{$fromblocks{$type}})) { |
my ($major,$minor) = split(/\./,$rev); |
my ($major,$minor) = split(/\./,$rev); |
($reqdmajor,$reqdminor) = |
($reqdmajor,$reqdminor) = |
&Apache::lonrelrequtils::update_reqd_loncaparev($major,$minor,$reqdmajor,$reqdminor); |
&Apache::lonrelrequtils::update_reqd_loncaparev($major,$minor,$reqdmajor,$reqdminor); |
$output .= &Apache::loncommon::start_data_table_row(). |
$output .= &Apache::loncommon::start_data_table_row(). |
'<td>'.$rev.'</td><td>'.$lt{$type}.'</td><td>'; |
'<td>'.$rev.'</td><td>'.$lt{$type}.'</td><td>'; |
Line 2805 sub display_loncaparev_constraints {
|
Line 3344 sub display_loncaparev_constraints {
|
|
|
if (defined($navmap)) { |
if (defined($navmap)) { |
my %anonsubms=&Apache::lonnet::dump('nohist_anonsurveys',$cdom,$cnum); |
my %anonsubms=&Apache::lonnet::dump('nohist_anonsurveys',$cdom,$cnum); |
my $rev_anonsurv=$Apache::lonnet::needsrelease{'parameter:type:anonsurvey'}; |
my $rev_anonsurv=$Apache::lonnet::needsrelease{'parameter:type:anonsurvey::'}; |
my %randtrysubms=&Apache::lonnet::dump('nohist_randomizetry',$cdom,$cnum); |
my %randtrysubms=&Apache::lonnet::dump('nohist_randomizetry',$cdom,$cnum); |
my $rev_randtry=$Apache::lonnet::needsrelease{'parameter:type:randomizetry'}; |
my $rev_randtry=$Apache::lonnet::needsrelease{'parameter:type:randomizetry::'}; |
|
my $rev_exttool=$Apache::lonnet::needsrelease{'course:courserestype:exttool'}; |
my $stdtype=&Apache::lonparmset::standard_parameter_types('type'); |
my $stdtype=&Apache::lonparmset::standard_parameter_types('type'); |
my $stdname=&Apache::lonparmset::standard_parameter_names('type'); |
my $stdname=&Apache::lonparmset::standard_parameter_names('type'); |
my $valanon=&get_param_description($stdtype,'anonsurvey'); |
my $valanon=&get_param_description($stdtype,'anonsurvey'); |
my $valrandtry=&get_param_description($stdtype,'randomizetry'); |
my $valrandtry=&get_param_description($stdtype,'randomizetry'); |
my %checkedrev; |
my %checkedrev; |
foreach my $res ($navmap->retrieveResources(undef,sub { $_[0]->is_problem() },1,0)) { |
foreach my $res ($navmap->retrieveResources(undef,sub { $_[0]->is_problem() || $_[0]->is_tool() },1,0)) { |
my @parts = @{$res->parts()}; |
my @parts = @{$res->parts()}; |
my $symb = $res->symb(); |
my $symb = $res->symb(); |
my $enclosing_map = &Apache::lonnet::declutter($res->enclosing_map_src()); |
my $enclosing_map = &Apache::lonnet::declutter($res->enclosing_map_src()); |
|
if ($res->is_tool()) { |
|
my $rev = $rev_exttool; |
|
$bycrsrestype{$symb}{$rev} = &mt('External Tool'); |
|
$allmaps{$enclosing_map} = 1; |
|
next; |
|
} |
foreach my $part (@parts) { |
foreach my $part (@parts) { |
if (exists($anonsubms{$symb."\0".$part})) { |
if (exists($anonsubms{$symb."\0".$part})) { |
my $rev = $rev_anonsurv; |
my $rev = $rev_anonsurv; |
Line 2867 sub display_loncaparev_constraints {
|
Line 3413 sub display_loncaparev_constraints {
|
&Apache::lonrelrequtils::update_reqd_loncaparev($major,$minor, |
&Apache::lonrelrequtils::update_reqd_loncaparev($major,$minor, |
$reqdmajor,$reqdminor); |
$reqdmajor,$reqdminor); |
$checkedrev{$key} = 1; |
$checkedrev{$key} = 1; |
} |
} |
push(@{$byresponsetype{$symb}{$rev}},$key); |
push(@{$byresponsetype{$symb}{$rev}},$key); |
$allmaps{$enclosing_map} = 1; |
$allmaps{$enclosing_map} = 1; |
} |
} |
Line 2904 sub display_loncaparev_constraints {
|
Line 3450 sub display_loncaparev_constraints {
|
} |
} |
} |
} |
} |
} |
|
my $suppmap = 'supplemental.sequence'; |
|
my ($suppcount,$supptools,$errors) = (0,0,0); |
|
($suppcount,$supptools,$errors) = &Apache::loncommon::recurse_supplemental($cnum,$cdom, |
|
$suppmap,$suppcount,$supptools,$errors); |
my $mapres_header = '<h4>'. |
my $mapres_header = '<h4>'. |
&mt('Requirements for specific folders or resources'). |
&mt('Requirements for specific folders or resources'). |
'</h4>'; |
'</h4>'; |
Line 2918 sub display_loncaparev_constraints {
|
Line 3468 sub display_loncaparev_constraints {
|
$r->print($start_page.$top_header); |
$r->print($start_page.$top_header); |
if ($output) { |
if ($output) { |
$r->print($output); |
$r->print($output); |
if (defined($navmap)) { |
if (defined($navmap) || $supptools) { |
&show_contents_view($r,$navmap,$cid,\%toshow,\%bymap,\%byresource,\%bysubmission, |
&show_contents_view($r,$navmap,$cid,\%toshow,\%bymap,\%byresource,\%bysubmission, |
\%byresponsetype,\@scopeorder,\%lt); |
\%byresponsetype,\%bycrsrestype,\@scopeorder,\%lt,$supptools); |
} |
} |
$r->print('<br /><br />'); |
$r->print('<br /><br />'); |
} else { |
} else { |
Line 2938 sub display_loncaparev_constraints {
|
Line 3488 sub display_loncaparev_constraints {
|
|
|
sub show_contents_view { |
sub show_contents_view { |
my ($r,$navmap,$cid,$toshow,$bymap,$byresource,$bysubmission,$byresponsetype, |
my ($r,$navmap,$cid,$toshow,$bymap,$byresource,$bysubmission,$byresponsetype, |
$scopeorder,$lt) = @_; |
$bycrsrestype,$scopeorder,$lt,$supptools) = @_; |
if ((keys(%{$toshow}) > 0) || (keys(%{$byresource}) > 0) || |
my $location=&Apache::loncommon::lonhttpdurl("/adm/lonIcons"); |
(keys(%{$bysubmission}) > 0) || (keys(%{$byresponsetype}) > 0)) { |
my $whitespace = '<img src="'.$location.'/whitespace_21.gif" alt="" />'; |
my $location=&Apache::loncommon::lonhttpdurl("/adm/lonIcons"); |
my $showmaincontent; |
my $whitespace = '<img src="'.$location.'/whitespace_21.gif" alt="" />'; |
if ((ref($navmap)) && |
my $icon = '<img src="'.$location.'/navmap.folder.open.gif" alt="" />'; |
((keys(%{$toshow}) > 0) || (keys(%{$byresource}) > 0) || |
|
(keys(%{$bysubmission}) > 0) || (keys(%{$byresponsetype}) > 0) || |
|
(keys(%{$bycrsrestype}) > 0))) { |
|
$showmaincontent = 1; |
|
} |
|
if ($showmaincontent || $supptools) { |
|
$r->print(&Apache::loncommon::start_data_table()); |
|
} |
|
if ($showmaincontent) { |
|
my $icon = '<img src="'.$location.'/navmap.folder.open.gif" alt="" />'; |
my $topmap = $env{'course.'.$cid.'.url'}; |
my $topmap = $env{'course.'.$cid.'.url'}; |
$r->print(&Apache::loncommon::start_data_table(). |
$r->print(&Apache::loncommon::start_data_table_header_row(). |
&Apache::loncommon::start_data_table_header_row(). |
|
'<th>'.&mt('Location').'</th><th>'.&mt('Release').'</th>'. |
'<th>'.&mt('Location').'</th><th>'.&mt('Release').'</th>'. |
'<th>'.&mt('Attribute/Setting').'</th>'. |
'<th>'.&mt('Attribute/Setting').'</th>'. |
&Apache::loncommon::end_data_table_header_row(). |
&Apache::loncommon::end_data_table_header_row(). |
&Apache::loncommon::start_data_table_row(). |
&Apache::loncommon::start_data_table_row(). |
'<td> '.$icon.' '.&mt('Main Content').'</td>'); |
'<td> '.$icon.' '.&mt('Main Content').'</td>'); |
&releases_by_map($r,$bymap,$topmap,$scopeorder,$lt); |
&releases_by_map($r,$bymap,$topmap,$scopeorder,$lt); |
$r->print(&Apache::loncommon::end_data_table_row()); |
$r->print(&Apache::loncommon::end_data_table_row()); |
my $it=$navmap->getIterator(undef,undef,undef,1,1,undef); |
my $it=$navmap->getIterator(undef,undef,undef,1,1,undef); |
my $curRes; |
my $curRes; |
my $depth = 0; |
my $depth = 0; |
Line 3004 sub show_contents_view {
|
Line 3562 sub show_contents_view {
|
if (ref($byresponsetype->{$symb}) eq 'HASH') { |
if (ref($byresponsetype->{$symb}) eq 'HASH') { |
$rowspan += scalar(keys(%{$byresponsetype->{$symb}})); |
$rowspan += scalar(keys(%{$byresponsetype->{$symb}})); |
} |
} |
|
if (ref($bycrsrestype->{$symb}) eq 'HASH') { |
|
$rowspan += scalar(keys(%{$bycrsrestype->{$symb}})); |
|
} |
next if (!$rowspan); |
next if (!$rowspan); |
$icon = '<img class="LC_contentImage" src="'.$location.'/problem.gif" alt="'. |
$icon = '<img class="LC_contentImage" src="'.$location.'/problem.gif" alt="'. |
&mt('Problem').'" />'; |
&mt('Problem').'" />'; |
Line 3068 sub show_contents_view {
|
Line 3629 sub show_contents_view {
|
$r->print('</td>'); |
$r->print('</td>'); |
} |
} |
$r->print(&Apache::loncommon::end_data_table_row()); |
$r->print(&Apache::loncommon::end_data_table_row()); |
|
$newrow = 1; |
|
} |
|
if (ref($bycrsrestype->{$symb}) eq 'HASH') { |
|
foreach my $rev (sort(keys(%{$bycrsrestype->{$symb}}))) { |
|
if ($newrow) { |
|
$r->print(&Apache::loncommon::continue_data_table_row()); |
|
} |
|
$r->print('<td>'.$rev.'</td><td>'.$bycrsrestype->{$symb}{$rev}.'</td>'); |
|
} |
|
$r->print(&Apache::loncommon::end_data_table_row()); |
} |
} |
} |
} |
} |
} |
} |
} |
|
} |
|
if ($supptools) { |
|
my $icon = '<img src="'.$location.'/navmap.folder.open.gif" alt="" />'; |
|
$r->print(&Apache::loncommon::start_data_table_header_row(). |
|
'<th>'.&mt('Location').'</th><th>'.&mt('Release').'</th>'. |
|
'<th>'.&mt('Resource Type').'</th>'. |
|
&Apache::loncommon::end_data_table_header_row(). |
|
&Apache::loncommon::start_data_table_row(). |
|
'<td> '.$icon.' '.&mt('Supplemental Content').'</td>'. |
|
'<td valign="middle">'. |
|
$Apache::lonrelrequtils::exttool{'major'}.'.'. |
|
$Apache::lonrelrequtils::exttool{'minor'}. |
|
'</td><td>'.&mt('[quant,_1,External Tool,External Tools]', |
|
$supptools).'</td>'. |
|
&Apache::loncommon::end_data_table_row()); |
|
} |
|
if ($showmaincontent || $supptools) { |
$r->print(&Apache::loncommon::end_data_table()); |
$r->print(&Apache::loncommon::end_data_table()); |
} |
} |
return; |
return; |
Line 3080 sub show_contents_view {
|
Line 3668 sub show_contents_view {
|
sub releases_by_map { |
sub releases_by_map { |
my ($r,$bymap,$url,$scopeorder,$lt) = @_; |
my ($r,$bymap,$url,$scopeorder,$lt) = @_; |
return unless ((ref($bymap) eq 'HASH') && (ref($scopeorder) eq 'ARRAY')); |
return unless ((ref($bymap) eq 'HASH') && (ref($scopeorder) eq 'ARRAY')); |
my $newrow = 0; |
my $newrow = 0; |
if (ref($bymap->{$url}) eq 'HASH') { |
if (ref($bymap->{$url}) eq 'HASH') { |
foreach my $rev (sort(keys(%{$bymap->{$url}}))) { |
foreach my $rev (sort(keys(%{$bymap->{$url}}))) { |
if ($newrow) { |
if ($newrow) { |
Line 3117 sub releases_by_map {
|
Line 3705 sub releases_by_map {
|
} |
} |
|
|
sub get_param_description { |
sub get_param_description { |
my ($stdtype,$value) = @_; |
my ($stdtype,$value,$regexp) = @_; |
my $name = $value; |
my ($name,$parammatches,$paramstrings,@possibles); |
my $paramstrings = &Apache::lonparmset::standard_string_options($stdtype); |
if ($stdtype =~ /^string/) { |
unless (ref($paramstrings) eq 'ARRAY') { |
$paramstrings = &Apache::lonparmset::standard_string_options($stdtype); |
return $name; |
} elsif ($stdtype eq 'date_interval') { |
|
$paramstrings = &Apache::lonparmset::standard_interval_options($stdtype); |
|
} |
|
if ($regexp) { |
|
if ($stdtype =~ /^string/) { |
|
$parammatches = &Apache::lonparmset::standard_string_matches($stdtype); |
|
} elsif ($stdtype eq 'date_interval') { |
|
$parammatches = &Apache::lonparmset::standard_interval_matches($stdtype); |
|
} |
|
if (ref($parammatches) eq 'ARRAY') { |
|
@possibles = @{$parammatches}; |
|
} else { |
|
undef($regexp); |
|
$name = $value; |
|
} |
|
} |
|
unless ($regexp) { |
|
$name = $value; |
|
if (ref($paramstrings) eq 'ARRAY') { |
|
@possibles = @{$paramstrings}; |
|
} else { |
|
if (($stdtype eq 'date_start') || ($stdtype eq 'date_end')) { |
|
if ($name == 0) { |
|
$name = &mt('Never'); |
|
} elsif (($name ne '') && ($name !~ /\D/)) { |
|
$name = &Apache::lonlocal::locallocaltime($name); |
|
} |
|
} |
|
return $name; |
|
} |
} |
} |
foreach my $possibilities (@{$paramstrings}) { |
foreach my $possibilities (@possibles) { |
next unless (ref($possibilities) eq 'ARRAY'); |
next unless (ref($possibilities) eq 'ARRAY'); |
my ($thing, $description) = @{ $possibilities }; |
my $gotregexmatch = ''; |
if ($thing eq $value) { |
if ($regexp) { |
$name = $description; |
last if ($gotregexmatch); |
last; |
my ($item,$pattern) = @{ $possibilities }; |
|
if ($value =~ /$pattern/) { |
|
if (ref($paramstrings) eq 'ARRAY') { |
|
foreach my $possibles (@{$paramstrings}) { |
|
next unless (ref($possibles) eq 'ARRAY'); |
|
my ($thing,$description) = @{$possibles}; |
|
if ($thing eq $item) { |
|
$name = $description; |
|
$gotregexmatch = 1; |
|
last; |
|
} |
|
} |
|
last if ($gotregexmatch); |
|
} |
|
} |
|
} else { |
|
my ($thing,$description) = @{ $possibilities }; |
|
if ($thing eq $value) { |
|
$name = $description; |
|
last; |
|
} |
} |
} |
} |
} |
return $name; |
return $name; |
Line 3173 sub coowner_invitations {
|
Line 3810 sub coowner_invitations {
|
@pendingcoown = split(',',$pendingcoowners); |
@pendingcoown = split(',',$pendingcoowners); |
} |
} |
if (ref($currcoownref) eq 'ARRAY') { |
if (ref($currcoownref) eq 'ARRAY') { |
@currcoown == @{$currcoownref}; |
@currcoown = @{$currcoownref}; |
} |
} |
my $disabled; |
my $disabled; |
if ($noedit) { |
if ($noedit) { |
Line 3237 sub manage_coownership {
|
Line 3874 sub manage_coownership {
|
@pendingcoown = split(',',$pendingcoowners); |
@pendingcoown = split(',',$pendingcoowners); |
} |
} |
if (ref($currcoownref) eq 'ARRAY') { |
if (ref($currcoownref) eq 'ARRAY') { |
@currcoown == @{$currcoownref}; |
@currcoown = @{$currcoownref}; |
} |
} |
my $disabled; |
my $disabled; |
if ($noedit) { |
if ($noedit) { |
Line 3338 sub print_localization {
|
Line 3975 sub print_localization {
|
undef,$includeempty,$disabled); |
undef,$includeempty,$disabled); |
} else { |
} else { |
if ($settings->{$item} eq '') { |
if ($settings->{$item} eq '') { |
unless ($noedit) { |
unless ($noedit) { |
$datatable .= '</td><td align="right">'. |
$datatable .= '</td><td align="right">'. |
&Apache::loncommon::select_language('languages_0','',1); |
&Apache::loncommon::select_language('languages_0','',1); |
} |
} |
Line 3368 sub print_localization {
|
Line 4005 sub print_localization {
|
} |
} |
} |
} |
unless ($noedit) { |
unless ($noedit) { |
$datatable .= |
$datatable .= |
&Apache::loncommon::start_data_table_row(). |
&Apache::loncommon::start_data_table_row(). |
'<td align="left"><span class="LC_nobreak">'. |
'<td align="left"><span class="LC_nobreak">'. |
&mt('Additional language:'). '</span><br />'. |
&mt('Additional language:'). '</span><br />'. |
&Apache::loncommon::select_language('languages_'.$num,'',1). |
&Apache::loncommon::select_language('languages_'.$num,'',1). |
'<input type="hidden" name="languages_total" value="'.$num.'" />'. |
'<input type="hidden" name="languages_total" value="'.$num.'" />'. |
'</td>'.&Apache::loncommon::end_data_table_row(); |
'</td>'.&Apache::loncommon::end_data_table_row(); |
} |
} |
$datatable .= &Apache::loncommon::end_data_table().'<br />'; |
$datatable .= &Apache::loncommon::end_data_table().'<br />'; |
} |
} |
} |
} |
$datatable .= &item_table_row_end(); |
$datatable .= &item_table_row_end(); |
Line 3464 sub user_table {
|
Line 4101 sub user_table {
|
if ($currvalue eq '') { |
if ($currvalue eq '') { |
unless ($noedit) { |
unless ($noedit) { |
$output .= &select_recipient($item,'0',$cdom,$sections); |
$output .= &select_recipient($item,'0',$cdom,$sections); |
} |
} |
} else { |
} else { |
my $num = 0; |
my $num = 0; |
my @curr = split(/,/,$currvalue); |
my @curr = split(/,/,$currvalue); |
Line 3616 sub print_discussion {
|
Line 4253 sub print_discussion {
|
&mt('(specific user(s))'), |
&mt('(specific user(s))'), |
input => 'checkbox', |
input => 'checkbox', |
}, |
}, |
|
|
|
'pac.roles.denied' => { |
|
text => '<span class="LC_nobreak"><b>'.&mt($itemtext->{'pac.roles.denied'}).'</b>'. |
|
&Apache::loncommon::help_open_topic("Course_Disable_Anonymous_Discussion").'</span><br />'. |
|
&mt('(role-based)'), |
|
input => 'checkbox', |
|
}, |
|
|
|
'pac.users.denied' => { |
|
text => '<span class="LC_nobreak"><b>'.&mt($itemtext->{'pac.users.denied'}).'</b><br />'. |
|
&mt('(specific user(s))'), |
|
input => 'checkbox', |
|
}, |
|
|
'allow_limited_html_in_feedback' => { |
'allow_limited_html_in_feedback' => { |
text => '<b>'.&mt($itemtext->{'allow_limited_html_in_feedback'}).'</b>', |
text => '<b>'.&mt($itemtext->{'allow_limited_html_in_feedback'}).'</b>', |
input => 'radio', |
input => 'radio', |
Line 3648 sub print_discussion {
|
Line 4299 sub print_discussion {
|
my $colspan; |
my $colspan; |
if ($item eq 'allow_limited_html_in_feedback') { |
if ($item eq 'allow_limited_html_in_feedback') { |
$colspan = 2; |
$colspan = 2; |
} |
} |
$datatable .= &item_table_row_start($items{$item}{text},$count,undef,$colspan); |
$datatable .= &item_table_row_start($items{$item}{text},$count,undef,$colspan); |
if ($item eq 'plc.roles.denied') { |
if ($item eq 'plc.roles.denied') { |
$datatable .= '</td><td align="right">'. |
$datatable .= '</td><td align="right">'. |
Line 3666 sub print_discussion {
|
Line 4317 sub print_discussion {
|
$datatable .= '</td><td align="right">'. |
$datatable .= '</td><td align="right">'. |
&user_table($cdom,$item,undef, |
&user_table($cdom,$item,undef, |
$settings->{$item},\%lt,$noedit); |
$settings->{$item},\%lt,$noedit); |
|
} elsif ($item eq 'pac.roles.denied') { |
|
$datatable .= '</td><td align="right">'. |
|
'<table>'.&role_checkboxes($cdom,$cnum,$item,$settings,undef,undef,$noedit). |
|
'</table>'; |
|
} elsif ($item eq 'pac.users.denied') { |
|
$datatable .= '</td><td align="right">'. |
|
&user_table($cdom,$item,undef, |
|
$settings->{$item},\%lt,$noedit); |
} elsif ($item eq 'allow_limited_html_in_feedback') { |
} elsif ($item eq 'allow_limited_html_in_feedback') { |
$datatable .= &yesno_radio($item,$settings,undef,undef,undef,$noedit); |
$datatable .= &yesno_radio($item,$settings,undef,undef,undef,$noedit); |
} elsif ($item eq 'allow_discussion_post_editing') { |
} elsif ($item eq 'allow_discussion_post_editing') { |
Line 3685 sub print_discussion {
|
Line 4344 sub print_discussion {
|
'<th align="center">'.&mt('font-size').'</th>'. |
'<th align="center">'.&mt('font-size').'</th>'. |
'<th align="center">'.&mt('font-weight').'</th>'. |
'<th align="center">'.&mt('font-weight').'</th>'. |
'<th align="center">'.&mt('font-style').'</th>'. |
'<th align="center">'.&mt('font-style').'</th>'. |
'<th align="center">'.&mt('Other css').'</th>'. |
'<th align="center">'.&mt('Other css').'</th>'. |
&Apache::loncommon::end_data_table_row(). |
&Apache::loncommon::end_data_table_row(). |
&set_discussion_fonts($cdom,$cnum,$item,$settings,$noedit). |
&set_discussion_fonts($cdom,$cnum,$item,$settings,$noedit). |
&Apache::loncommon::end_data_table().'<br />'; |
&Apache::loncommon::end_data_table().'<br />'; |
Line 3737 sub role_checkboxes {
|
Line 4396 sub role_checkboxes {
|
my $count = 0; |
my $count = 0; |
my $disabled; |
my $disabled; |
if ($noedit) { |
if ($noedit) { |
$disabled = ' disabled="disabled"'; |
$disabled = ' disabled="disabled"'; |
} |
} |
foreach my $role (@roles) { |
foreach my $role (@roles) { |
my $checked = ''; |
my $checked = ''; |
Line 3865 sub set_discussion_fonts {
|
Line 4524 sub set_discussion_fonts {
|
|
|
sub discussion_vote_classes { |
sub discussion_vote_classes { |
my $classorder = ['twoplus','oneplus','zero','oneminus','twominus']; |
my $classorder = ['twoplus','oneplus','zero','oneminus','twominus']; |
my %classtitles = &Apache::lonlocal::texthash( |
my %classtitles = &Apache::lonlocal::texthash( |
'twoplus' => 'Two sigma above mean', |
'twoplus' => 'Two sigma above mean', |
'oneplus' => 'One sigma above mean', |
'oneplus' => 'One sigma above mean', |
'zero' => 'Within one sigma of mean', |
'zero' => 'Within one sigma of mean', |
Line 3931 sub print_classlists {
|
Line 4590 sub print_classlists {
|
'defaultcredits' => { |
'defaultcredits' => { |
text => '<b>'.&mt($itemtext->{'defaultcredits'}).'</b>', |
text => '<b>'.&mt($itemtext->{'defaultcredits'}).'</b>', |
}, |
}, |
|
|
'nothideprivileged' => { |
'nothideprivileged' => { |
text => '<b>'.&mt($itemtext->{'nothideprivileged'}).'</b>', |
text => '<b>'.&mt($itemtext->{'nothideprivileged'}).'</b>', |
input => 'checkbox', |
input => 'checkbox', |
Line 4038 sub print_grading {
|
Line 4697 sub print_grading {
|
input => 'selectbox', |
input => 'selectbox', |
options => { |
options => { |
standard => &mt('Standard: shows points'), |
standard => &mt('Standard: shows points'), |
|
categories => &mt('Categories: shows points according to categories'), |
external => &mt('External: shows number of completed parts and totals'), |
external => &mt('External: shows number of completed parts and totals'), |
externalnototals => &mt('External: shows only number of completed parts'), |
externalnototals => &mt('External: shows only number of completed parts'), |
spreadsheet => &mt('Spreadsheet: (with link to detailed scores)'), |
spreadsheet => &mt('Spreadsheet: (with link to detailed scores)'), |
}, |
}, |
order => ['standard','external','externalnototals','spreadsheet'], |
order => ['standard','categories','external','externalnototals','spreadsheet'], |
}, |
}, |
'rndseed' => { |
'rndseed' => { |
text => '<b>'.&mt($itemtext->{'rndseed'}).'</b>'. |
text => '<b>'.&mt($itemtext->{'rndseed'}).'</b>'. |
Line 4212 sub print_bridgetasks {
|
Line 4872 sub print_bridgetasks {
|
return &make_item_rows($cdom,\%items,$ordered,$settings,$rowtotal,$crstype,'bridgetasks',$noedit); |
return &make_item_rows($cdom,\%items,$ordered,$settings,$rowtotal,$crstype,'bridgetasks',$noedit); |
} |
} |
|
|
|
sub print_lti { |
|
my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$crstype,$noedit) = @_; |
|
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) { |
|
return; |
|
} |
|
my @menuitems = ('fullname','coursetitle','role','logout','grades'); |
|
my %menutitles = <imenu_titles(); |
|
my ($domdefs,$displaydefs); |
|
if ($env{'request.lti.login'}) { |
|
my %lti = &Apache::lonnet::get_domain_lti($cdom,'provider'); |
|
my @domdefsmenu; |
|
if (ref($lti{$env{'request.lti.login'}}) eq 'HASH') { |
|
if ($lti{$env{'request.lti.login'}}{'topmenu'}) { |
|
$domdefs = &mt('Header shown').', '; |
|
} |
|
if ($lti{$env{'request.lti.login'}}{'inlinemenu'}) { |
|
$domdefs .= &mt('Inline menu shown'); |
|
} |
|
$domdefs =~ s/,\s$//; |
|
if (!$domdefs) { |
|
$domdefs = &mt('No header or inline menu shown'); |
|
} |
|
$domdefs = ' ('.&mt('Domain default').': '.$domdefs.')'; |
|
if (ref($lti{$env{'request.lti.login'}}{'lcmenu'}) eq 'ARRAY') { |
|
@domdefsmenu = @{$lti{$env{'request.lti.login'}}{'lcmenu'}}; |
|
} |
|
} |
|
$displaydefs = &mt('Domain defaults'); |
|
if (@domdefsmenu) { |
|
my @diffs = &Apache::loncommon::compare_arrays(\@menuitems,\@domdefsmenu); |
|
if (@diffs) { |
|
my $missing; |
|
foreach my $item (@menuitems) { |
|
unless (grep(/^\Q$item\E$/,@domdefsmenu)) { |
|
$missing .= ' '.$menutitles{$item}.','; |
|
} |
|
} |
|
$missing =~ s/,$//; |
|
$displaydefs .= ': '.&mt('Not shown').' --'.$missing; |
|
} else { |
|
$displaydefs .= ': '.&mt('All shown'); |
|
} |
|
} else { |
|
$displaydefs .= ': '.&mt('Not shown').' -- '.join(', ', map { $menutitles{$_}; } @menuitems); |
|
} |
|
} else { |
|
$displaydefs = &mt('Domain defaults only available in LTI context'); |
|
} |
|
my %items = ( |
|
'lti.override' => { |
|
text => '<b>'.&mt($itemtext->{'lti.override'}).'</b>'.$domdefs, |
|
input => 'radio', |
|
}, |
|
'lti.topmenu' => { |
|
text => '<b>'.&mt($itemtext->{'lti.topmenu'}).'</b>', |
|
input => 'radio', |
|
}, |
|
'lti.inlinemenu' => { |
|
text => '<b>'.&mt($itemtext->{'lti.inlinemenu'}).'</b>', |
|
input => 'radio', |
|
}, |
|
'lti.lcmenu' => { |
|
text => '<b>'.&mt($itemtext->{'lti.lcmenu'}).'</b><br />'.$displaydefs, |
|
input => 'custom', |
|
}, |
|
); |
|
return &make_item_rows($cdom,\%items,$ordered,$settings,$rowtotal,$crstype,'lti',$noedit); |
|
} |
|
|
|
sub lcmenu_checkboxes { |
|
my ($cdom,$caller,$settings,$crstype,$noedit) = @_; |
|
my @menuitems = ('fullname','coursetitle','role','logout','grades'); |
|
my %menutitles = <imenu_titles(); |
|
my (@current,@domdefs); |
|
if ($env{'request.lti.login'}) { |
|
my %lti = &Apache::lonnet::get_domain_lti($cdom,'provider'); |
|
if (ref($lti{$env{'request.lti.login'}}) eq 'HASH') { |
|
if (ref($lti{$env{'request.lti.login'}}{'lcmenu'}) eq 'ARRAY') { |
|
@domdefs = @{$lti{$env{'request.lti.login'}}{'lcmenu'}}; |
|
} |
|
} |
|
} |
|
if (ref($settings) eq 'HASH') { |
|
if ($settings->{'lti.lcmenu'}) { |
|
unless ($settings->{'lti.lcmenu'} eq 'none') { |
|
@current = split(',',$settings->{'lti.lcmenu'}); |
|
} |
|
} else { |
|
@current = @domdefs; |
|
} |
|
} else { |
|
@current = @domdefs; |
|
} |
|
my $numinrow = 3; |
|
my $count = 0; |
|
my $disabled; |
|
if ($noedit) { |
|
$disabled = ' disabled="disabled"'; |
|
} |
|
my $output = '<table>'; |
|
foreach my $item (@menuitems) { |
|
my $checked = ''; |
|
if (grep(/^\Q$item\E$/,@current)) { |
|
$checked = ' checked="checked" '; |
|
} |
|
my $rem = $count%($numinrow); |
|
if ($rem == 0) { |
|
if ($count > 0) { |
|
$output .= '</tr>'; |
|
} |
|
$output .= '<tr>'; |
|
} |
|
$output .= '<td align="left"><span class="LC_nobreak"><label><input type="checkbox" '. |
|
'name="lti.lcmenu" value="'.$item.'"'.$checked.$disabled.'/> '. |
|
$menutitles{$item}.'</label></span></td>'; |
|
$count ++; |
|
} |
|
my $rem = $count%($numinrow); |
|
my $colsleft = $numinrow - $rem; |
|
if ($colsleft > 1 ) { |
|
$output .= '<td colspan="'.$colsleft.'" class="LC_left_item">'. |
|
' </td>'; |
|
} elsif ($colsleft == 1) { |
|
$output .= '<td class="LC_left_item"> </td>'; |
|
} |
|
$output .= '</tr></table>'; |
|
} |
|
|
|
sub ltimenu_titles { |
|
return &Apache::lonlocal::texthash( |
|
fullname => 'Full name', |
|
coursetitle => 'Course title', |
|
role => 'Role', |
|
logout => 'Logout', |
|
grades => 'Grades', |
|
); |
|
} |
|
|
|
sub print_menuitems { |
|
my ($position,$cdom,$settings,$itemtext,$rowtotal,$crstype,$noedit) = @_; |
|
unless ((ref($settings) eq 'HASH') && (ref($itemtext) eq 'HASH')) { |
|
return; |
|
} |
|
if ($position eq 'top') { |
|
my (%defaultmenu_options,@defaultmenu_order,$addcollection); |
|
if ($settings->{'menucollections'} ne '') { |
|
foreach my $item (split(/;/,$settings->{'menucollections'})) { |
|
my ($num,$value) = split(/\%/,$item); |
|
if ($num =~ /^\d+$/) { |
|
$defaultmenu_options{$num} = $num; |
|
} |
|
} |
|
@defaultmenu_order = sort { $a <=> $b } keys(%defaultmenu_options); |
|
$addcollection = $defaultmenu_order[-1] + 1; |
|
} else { |
|
$addcollection = 1; |
|
} |
|
$defaultmenu_options{$addcollection} = $addcollection; |
|
my %items = ( |
|
'menudefault' => { |
|
text => '<b>'.&mt($itemtext->{'menudefault'}).'</b><br />'. |
|
&mt("(can be overriden in deep-link context)"), |
|
input => 'selectbox', |
|
options => \%defaultmenu_options, |
|
order => \@defaultmenu_order, |
|
nullval => &mt('Standard (all menus shown)'), |
|
}, |
|
); |
|
return &make_item_rows($cdom,\%items,['menudefault'],$settings,$rowtotal,$crstype,'menuitems',$noedit); |
|
} else { |
|
my %menu; |
|
my $count = 0; |
|
my $next = 1; |
|
my ($datatable,$disabled); |
|
if ($noedit) { |
|
$disabled = ' disabled="disabled"'; |
|
} |
|
|
|
my ($ordered,$cats) = &menuitems_categories(); |
|
my @order = @{$ordered}; |
|
my %categories = %{$cats}; |
|
my %menutitles = &menuitems_titles(); |
|
my %menufields = &menuitems_fields(); |
|
|
|
if ($settings->{'menucollections'} ne '') { |
|
foreach my $item (split(/;/,$settings->{'menucollections'})) { |
|
my ($num,$value) = split(/\%/,$item); |
|
if ($num =~ /^\d+$/) { |
|
my @entries = split(/\&/,$value); |
|
foreach my $entry (@entries) { |
|
my ($name,$fields) = split(/=/,$entry); |
|
$menu{$num}{$name} = $fields; |
|
} |
|
} |
|
} |
|
if (keys(%menu)) { |
|
my @current = sort { $a <=> $b } keys(%menu); |
|
$next += $current[-1]; |
|
foreach my $num (@current) { |
|
my %checked; |
|
my $on = ' checked="checked"'; |
|
foreach my $key (keys(%{$menu{$num}})) { |
|
if (($key eq 'top') || ($key eq 'inline') || ($key eq 'foot') || ($key eq 'main')) { |
|
if ($menu{$num}{$key} eq 'y') { |
|
$checked{$key} = $on; |
|
} |
|
} else { |
|
foreach my $field (split(/,/,$menu{$num}{$key})) { |
|
if (exists($menufields{$field})) { |
|
$checked{$field} = $on; |
|
} |
|
} |
|
} |
|
} |
|
if (ref($menu{$num}) eq 'HASH') { |
|
$datatable .= &item_table_row_start('<em class="LC_nav_bar">'.$num.'</em>',$count,'','','','LC_left_item'); |
|
foreach my $category (@order) { |
|
if ((ref($categories{$category}) eq 'ARRAY') && (@{$categories{$category}} > 0)) { |
|
$datatable .= '<fieldset style="vertical-align:top; display:inline-block"><legend>'.$menutitles{$category}.'</legend>'."\n"; |
|
if ($category eq 'text') { |
|
$datatable .= '<i>'.&mt('Header').'</i><br />'; |
|
} |
|
foreach my $field (@{$categories{$category}}) { |
|
if ($field eq 'disc') { |
|
$datatable .= '<br /><i>'.&mt('Footer').'</i><br />'; |
|
} |
|
$datatable .= '<label><input type="checkbox" name="menucollections_'.$num.'" value="'.$field.'"'.$checked{$field}.$disabled.' />'. |
|
$menufields{$field}.'</label><br />'; |
|
} |
|
$datatable .= '</fieldset>'; |
|
} |
|
} |
|
$datatable .= &item_table_row_end(); |
|
$count ++; |
|
} |
|
} |
|
} |
|
} elsif ($noedit) { |
|
my $text = &mt('No menu collections defined for this course.'); |
|
$datatable .= &item_table_row_start($text,$count); |
|
} |
|
unless ($noedit) { |
|
my $add = '<label><input type="checkbox" name="menucollections_add" id="menucollections_add" value="'.$next.'" '. |
|
'onclick="javascript:toggleAddmenucoll();" />'.&mt('Add').'</label>'; |
|
$datatable .= &item_table_row_start($add,$count,'','','','LC_left_item'); |
|
foreach my $category (@order) { |
|
if ((ref($categories{$category}) eq 'ARRAY') && (@{$categories{$category}} > 0)) { |
|
$datatable .= '<fieldset id="addmenucoll_'.$category.'" style="display:none; vertical-align:top;"><legend>'.$menutitles{$category}.'</legend>'."\n"; |
|
foreach my $field (@{$categories{$category}}) { |
|
$datatable .= '<label><input type="checkbox" class="LC_menucoll_add" name="menucollections_'.$next.'" value="'.$field.'"'.$disabled.' />'. |
|
$menufields{$field}.'</label><br />'; |
|
} |
|
$datatable .= '</fieldset>'; |
|
} |
|
} |
|
$datatable .= &item_table_row_end(); |
|
$count ++; |
|
} |
|
return $datatable; |
|
} |
|
} |
|
|
|
sub menuitems_abbreviations { |
|
my %briefcats = ( |
|
text => 'pt', |
|
links => 'p', |
|
list => 'ps', |
|
inline => 's', |
|
); |
|
return %briefcats; |
|
} |
|
|
|
sub menuitems_categories { |
|
my @order = ('shown','text','links','list','inline'); |
|
my %categories = ( |
|
shown => ['top','inline','foot','main'], |
|
text => ['name','role','crs','disc','fdbk'], |
|
links => ['pers','logo','menu','comm','roles','help','logout'], |
|
list => ['about','prefs','port','wish','anno','rss'], |
|
inline => ['cont','grades','chat','people','groups','resv','syll','feeds'], |
|
); |
|
return (\@order,\%categories); |
|
} |
|
|
|
sub menuitems_titles { |
|
return &Apache::lonlocal::texthash ( |
|
shown => 'Hierarchy', |
|
text => 'Text', |
|
links => 'Header links', |
|
list => 'Drop-down list', |
|
inline => 'Inline links', |
|
); |
|
} |
|
|
|
sub menuitems_fields { |
|
return &Apache::lonlocal::texthash ( |
|
top => 'Display header', |
|
inline => 'Display inline menu', |
|
foot => 'Display footer', |
|
main => 'Access to main menu', |
|
pers => 'Personal', |
|
logo => 'LON-CAPA', |
|
menu => 'Home', |
|
comm => 'Messages', |
|
roles => 'Roles/Courses', |
|
help => 'Help', |
|
logout => 'Logout', |
|
name => 'Fullname', |
|
crs => 'Course Title', |
|
role => 'Current Role', |
|
disc => 'Discussion', |
|
fdbk => 'Feedback', |
|
about => 'Information', |
|
prefs => 'Preferences', |
|
port => 'Portfolio', |
|
wish => 'Stored Links', |
|
anno => 'Calendar', |
|
rss => 'RSS Feeds', |
|
cont => 'Contents', |
|
grades => 'Grades', |
|
chat => 'Chat', |
|
people => 'People', |
|
groups => 'Groups', |
|
resv => 'Reservations', |
|
syll => 'Syllabus', |
|
feeds => 'Feeds', |
|
); |
|
} |
|
|
|
sub menucollections_display { |
|
my ($collections) = @_; |
|
my %menu; |
|
my ($ordered,$cats) = &menuitems_categories(); |
|
my @order = @{$ordered}; |
|
my %categories = %{$cats}; |
|
my %menutitles = &menuitems_titles(); |
|
my %menufields = &menuitems_fields(); |
|
foreach my $item (split(/;/,$collections)) { |
|
my ($num,$value) = split(/\%/,$item); |
|
if ($num =~ /^\d+$/) { |
|
my @entries = split(/\&/,$value); |
|
foreach my $entry (@entries) { |
|
my ($name,$fields) = split(/=/,$entry); |
|
$menu{$num}{$name} = $fields; |
|
} |
|
} |
|
} |
|
my $output = ''; |
|
if (keys(%menu)) { |
|
my @current = sort { $a <=> $b } keys(%menu); |
|
foreach my $num (@current) { |
|
my %checked; |
|
foreach my $key (keys(%{$menu{$num}})) { |
|
if (($key eq 'top') || ($key eq 'inline') || ($key eq 'foot') || ($key eq 'main')) { |
|
if ($menu{$num}{$key} eq 'y') { |
|
$checked{$key} = 1; |
|
} |
|
} else { |
|
foreach my $field (split(/,/,$menu{$num}{$key})) { |
|
if (exists($menufields{$field})) { |
|
$checked{$field} = 1; |
|
} |
|
} |
|
} |
|
} |
|
if (ref($menu{$num}) eq 'HASH') { |
|
$output .= '<fieldset><legend>'.&mt('Collection [_1]',$num).'</legend>'; |
|
foreach my $category (@order) { |
|
if ((ref($categories{$category}) eq 'ARRAY') && (@{$categories{$category}} > 0)) { |
|
$output .= '<fieldset style="vertical-align:top; display:inline-block">'. |
|
'<legend>'.$menutitles{$category}.'</legend>'."\n"; |
|
if ($category eq 'text') { |
|
$output .= '<b>'.&mt('Header Text').'</b><br /><br />'; |
|
} |
|
foreach my $field (@{$categories{$category}}) { |
|
if ($field eq 'disc') { |
|
$output .= '<br /><b>'.&mt('Footer Text').'</b><br /><br />'; |
|
} |
|
if ($checked{$field}) { |
|
$output .= &Apache::lonhtmlcommon::confirm_success($menufields{$field}); |
|
} else { |
|
$output .= &Apache::lonhtmlcommon::confirm_success($menufields{$field},1); |
|
} |
|
$output .= '<br />'; |
|
} |
|
$output .= '</fieldset>'; |
|
} |
|
} |
|
$output .= '</fieldset>'; |
|
} |
|
} |
|
} |
|
return $output; |
|
} |
|
|
|
sub print_linkprotection { |
|
my ($cdom,$settings,$rowtotal,$crstype,$noedit) = @_; |
|
unless (ref($settings) eq 'HASH') { |
|
return; |
|
} |
|
|
|
my %linkprotection; |
|
my $count = 0; |
|
my $next = 1; |
|
my ($datatable,$disabled,$css_class); |
|
if ($noedit) { |
|
$disabled = ' disabled="disabled"'; |
|
} |
|
my %lt = &linkprot_names(); |
|
my $itemcount = 0; |
|
|
|
if (ref($settings->{'linkprotection'}) eq 'HASH') { |
|
if (keys(%{$settings->{'linkprotection'}})) { |
|
my @current = sort { $a <=> $b } keys(%{$settings->{'linkprotection'}}); |
|
$next += $current[-1]; |
|
for (my $i=0; $i<@current; $i++) { |
|
my $num = $current[$i]; |
|
my %values; |
|
if (ref($settings->{'linkprotection'}->{$num}) eq 'HASH') { |
|
%values = %{$settings->{'linkprotection'}->{$num}}; |
|
} else { |
|
next; |
|
} |
|
my $selected; |
|
if (($values{'version'} eq 'LTI-1p0') || ($values{'version'} eq '')) { |
|
$selected = ' selected="selected"'; |
|
} |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
$datatable .= |
|
'<tr '.$css_class.'><td><span class="LC_nobreak">'. |
|
'<label><input type="checkbox" name="linkprot_del" value="'.$i.'"'.$disabled.' />'. |
|
&mt('Delete?').'</label></span></td>'. |
|
'<td><span class="LC_nobreak">'.$lt{'name'}. |
|
':<input type="text" size="15" name="linkprot_name_'.$i.'" value="'.$values{'name'}.'"'.$disabled.' /></span> '. |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'version'}.':<select name="linkprot_version_'.$i.'">'. |
|
'<option value="LTI-1p0" '.$selected.'>1.1</option></select></span> '."\n". |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'lifetime'}.':<input type="text" name="linkprot_lifetime_'.$i.'"'. |
|
'value="'.$values{'lifetime'}.'" size="3"'.$disabled.' /></span>'. |
|
'<br /><br />'. |
|
'<span class="LC_nobreak">'.$lt{'key'}. |
|
':<input type="text" size="25" name="linkprot_key_'.$i.'" value="'.$values{'key'}.'"'.$disabled.' /></span> '. |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'secret'}.':'. |
|
'<input type="password" size="20" name="linkprot_secret_'.$i.'" value="'.$values{'secret'}.'"'.$disabled.' />'. |
|
'<label><input type="checkbox" name="visible" onclick="if (this.checked) { this.form.linkprot_secret_'.$i.'.type='."'text'".' } else { this.form.linkprot_secret_'.$i.'.type='."'password'".' }" />'.&mt('Visible input').'</label>'. |
|
'<input type="hidden" name="linkprot_id_'.$i.'" value="'.$num.'" /></span>'. |
|
'</td></tr>'; |
|
$itemcount ++; |
|
} |
|
} |
|
} |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">'."\n". |
|
'<input type="hidden" name="linkprot_maxnum" value="'.$next.'" />'."\n". |
|
'<input type="checkbox" name="linkprot_add" value="1" />'.&mt('Add').'</span></td>'."\n". |
|
'<td>'. |
|
'<span class="LC_nobreak">'.$lt{'name'}. |
|
':<input type="text" size="15" name="linkprot_name_add" value="" /></span> '."\n". |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'version'}.':<select name="linkprot_version_add">'. |
|
'<option value="LTI-1p0" selected="selected">1.1</option></select></span> '."\n". |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'lifetime'}.':<input type="text" size="3" name="linkprot_lifetime_add" value="300" /></span> '."\n". |
|
'<br /><br />'. |
|
'<span class="LC_nobreak">'.$lt{'key'}.':<input type="text" size="25" name="linkprot_key_add" value="" /></span> '."\n". |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'secret'}.':<input type="password" size="20" name="linkprot_secret_add" value="" />'. |
|
'<label><input type="checkbox" name="visible" onclick="if (this.checked) { this.form.linkprot_secret_add.type='."'text'".' } else { this.form.linkprot_secret_add.type='."'password'".' }" />'.&mt('Visible input').'</label></span> '."\n". |
|
'</td></tr>'; |
|
$$rowtotal ++; |
|
return $datatable;; |
|
} |
|
|
|
sub linkprot_names { |
|
my %lt = &Apache::lonlocal::texthash( |
|
'version' => 'LTI Version', |
|
'key' => 'Key', |
|
'lifetime' => 'Nonce lifetime (s)', |
|
'name' => 'Launcher Application Name', |
|
'secret' => 'Secret', |
|
); |
|
return %lt; |
|
} |
|
|
sub print_other { |
sub print_other { |
my ($cdom,$settings,$allitems,$rowtotal,$crstype,$noedit) = @_; |
my ($cdom,$settings,$allitems,$rowtotal,$crstype,$noedit) = @_; |
unless ((ref($settings) eq 'HASH') && (ref($allitems) eq 'ARRAY')) { |
unless ((ref($settings) eq 'HASH') && (ref($allitems) eq 'ARRAY')) { |
Line 4263 sub get_other_items {
|
Line 5409 sub get_other_items {
|
} |
} |
|
|
sub item_table_row_start { |
sub item_table_row_start { |
my ($text,$count,$add_class,$colspan) = @_; |
my ($text,$count,$add_class,$colspan,$leftclass,$rightclass) = @_; |
my $output; |
my $output; |
my $css_class = ($count % 2) ? 'LC_odd_row' : 'LC_even_row'; |
my $css_class = ($count % 2) ? 'LC_odd_row' : 'LC_even_row'; |
$css_class = (join(' ',$css_class,$add_class)) unless ($add_class eq ''); |
$css_class = (join(' ',$css_class,$add_class)) unless ($add_class eq ''); |
|
if ($leftclass eq '') { |
|
$leftclass = 'LC_left_item'; |
|
} |
|
if ($rightclass eq '') { |
|
$rightclass = 'LC_right_item'; |
|
} |
$output .= '<tr class="'.$css_class.'">'."\n". |
$output .= '<tr class="'.$css_class.'">'."\n". |
'<td class="LC_left_item">'.$text. |
'<td class="'.$leftclass.'">'.$text. |
'</td>'; |
'</td>'; |
if ($colspan) { |
if ($colspan > 1) { |
$output .= '<td class="LC_right_item" colspan="'.$colspan.'">'; |
$output .= '<td class="'.$rightclass.'" colspan="'.$colspan.'">'; |
} else { |
} else { |
$output .= '<td class="LC_right_item">'; |
$output .= '<td class="'.$rightclass.'">'; |
} |
} |
return $output; |
return $output; |
} |
} |
Line 4314 sub yesno_radio {
|
Line 5466 sub yesno_radio {
|
} |
} |
|
|
sub select_from_options { |
sub select_from_options { |
my ($item,$order,$options,$curr,$nullval,$multiple,$maxsize,$onchange,$noedit) = @_; |
my ($item,$order,$options,$curr,$nullval,$multiple,$maxsize,$onchange,$noedit,$id) = @_; |
my $output; |
my $output; |
my $disabled; |
my $disabled; |
if ($noedit) { |
if ($noedit) { |
Line 4330 sub select_from_options {
|
Line 5482 sub select_from_options {
|
$output .= ' size="'.$maxsize.'"'; |
$output .= ' size="'.$maxsize.'"'; |
} |
} |
} |
} |
|
if ($id ne '') { |
|
$output .= ' id="'.$id.'"'; |
|
} |
$output .= $disabled.'>'."\n"; |
$output .= $disabled.'>'."\n"; |
if ($nullval ne '') { |
if ($nullval ne '') { |
$output .= '<option value=""'; |
$output .= '<option value=""'; |
Line 4394 sub make_item_rows {
|
Line 5549 sub make_item_rows {
|
$datatable .= &checkforpriv_row($cdom,$item,$settings,$crstype,$noedit); |
$datatable .= &checkforpriv_row($cdom,$item,$settings,$crstype,$noedit); |
} elsif ($item eq 'print_header_format') { |
} elsif ($item eq 'print_header_format') { |
$datatable .= &print_hdrfmt_row($item,$settings,$noedit); |
$datatable .= &print_hdrfmt_row($item,$settings,$noedit); |
|
} elsif ($item eq 'lti.lcmenu') { |
|
$datatable .= &lcmenu_checkboxes($cdom,$item,$settings,$crstype,$noedit); |
} elsif ($items->{$item}{input} eq 'dates') { |
} elsif ($items->{$item}{input} eq 'dates') { |
my $disabled; |
my $disabled; |
if ($noedit) { |
if ($noedit) { |
Line 4411 sub make_item_rows {
|
Line 5568 sub make_item_rows {
|
} |
} |
$valueyes = "1"; |
$valueyes = "1"; |
$valueno = "0"; |
$valueno = "0"; |
|
} elsif (($item eq 'lti.topmenu') || ($item eq 'lti.inlinemenu')) { |
|
$valueyes = '1'; |
} |
} |
$datatable .= &yesno_radio($item,$settings,$unsetdefault,$valueyes,$valueno,$noedit); |
$datatable .= &yesno_radio($item,$settings,$unsetdefault,$valueyes,$valueno,$noedit); |
} elsif ($items->{$item}{input} eq 'selectbox') { |
} elsif ($items->{$item}{input} eq 'selectbox') { |
|
my $id; |
|
if ($caller eq 'menuitems') { |
|
$id = $item; |
|
} |
my $curr = $settings->{$item}; |
my $curr = $settings->{$item}; |
$datatable .= |
$datatable .= |
&select_from_options($item,$items->{$item}{'order'}, |
&select_from_options($item,$items->{$item}{'order'}, |
$items->{$item}{'options'},$curr, |
$items->{$item}{'options'},$curr, |
$items->{$item}{'nullval'}, |
$items->{$item}{'nullval'}, |
undef,undef,undef,$noedit); |
undef,undef,undef,$noedit,$id); |
} elsif ($items->{$item}{input} eq 'textbox') { |
} elsif ($items->{$item}{input} eq 'textbox') { |
my $disabled; |
my $disabled; |
if ($noedit) { |
if ($noedit) { |
Line 4454 sub nothidepriv_row {
|
Line 5617 sub nothidepriv_row {
|
} |
} |
} |
} |
if ($settings->{'checkforpriv'}) { |
if ($settings->{'checkforpriv'}) { |
@checkdoms = split(/,/,$settings->{'checkforpriv'}); |
@checkdoms = split(/,/,$settings->{'checkforpriv'}); |
} |
} |
} |
} |
push(@checkdoms,$cdom); |
push(@checkdoms,$cdom); |
Line 4468 sub nothidepriv_row {
|
Line 5631 sub nothidepriv_row {
|
if ($end == -1 || $start == -1) { |
if ($end == -1 || $start == -1) { |
next; |
next; |
} |
} |
foreach my $dom (@checkdoms) { |
foreach my $dom (@checkdoms) { |
if (&Apache::lonnet::privileged($uname,$udom,\@checkdoms,['dc','su'])) { |
if (&Apache::lonnet::privileged($uname,$udom,\@checkdoms,['dc','su'])) { |
unless (grep(/^\Q$user\E$/,@privusers)) { |
unless (grep(/^\Q$user\E$/,@privusers)) { |
push(@privusers,$user); |
push(@privusers,$user); |
Line 4544 sub checkforpriv_row {
|
Line 5707 sub checkforpriv_row {
|
my $domdesc = &Apache::lonnet::domain($currdom,'description'); |
my $domdesc = &Apache::lonnet::domain($currdom,'description'); |
if ($domdesc eq '') { |
if ($domdesc eq '') { |
$domdesc = $currdom; |
$domdesc = $currdom; |
} |
} |
$datatable .= |
$datatable .= |
&Apache::loncommon::start_data_table_row(). |
&Apache::loncommon::start_data_table_row(). |
'<td align="left"><span class="LC_nobreak">'. |
'<td align="left"><span class="LC_nobreak">'. |
Line 4556 sub checkforpriv_row {
|
Line 5719 sub checkforpriv_row {
|
&mt('Delete').'</label></span></td>'. |
&mt('Delete').'</label></span></td>'. |
&Apache::loncommon::end_data_table_row(); |
&Apache::loncommon::end_data_table_row(); |
$num ++; |
$num ++; |
unless (grep(/^\Q$currdom\E$/,@excdoms)) { |
unless (grep(/^\Q$currdom\E$/,@excdoms)) { |
push(@excdoms,$currdom); |
push(@excdoms,$currdom); |
} |
} |
} |
} |
} |
} |
if ((scalar(keys(%domains)) - scalar(@excdoms)) > 0) { |
if ((scalar(keys(%domains)) - scalar(@excdoms)) > 0) { |
$datatable .= |
$datatable .= |
&Apache::loncommon::start_data_table_row(). |
&Apache::loncommon::start_data_table_row(). |
'<td align="left"><span class="LC_nobreak">'. |
'<td align="left"><span class="LC_nobreak">'. |
&mt('Additional domain:'). '</span><br />'. |
&mt('Additional domain:'). '</span><br />'. |
Line 4675 ENDJS
|
Line 5838 ENDJS
|
$output .= '</tr>'; |
$output .= '</tr>'; |
} |
} |
} |
} |
my $pos = $currnum+1; |
my $pos = $currnum+1; |
unless ($noedit) { |
unless ($noedit) { |
$output .= |
$output .= |
'<tr>'. |
'<tr>'. |
'<td align="left"><span class="LC_nobreak">'. |
'<td align="left"><span class="LC_nobreak">'. |