version 1.49.2.28.2.18, 2023/10/06 23:01:38
|
version 1.104, 2022/02/16 15:58:28
|
Line 116 This module is used for configuration of
|
Line 116 This module is used for configuration of
|
|
|
=item item_table_row_end() |
=item item_table_row_end() |
|
|
=item yesno_radio() |
=item yes_no_radio() |
|
|
=item select_from_options() |
=item select_from_options() |
|
|
Line 225 use Apache::courseclassifier;
|
Line 225 use Apache::courseclassifier;
|
use Apache::lonlocal; |
use Apache::lonlocal; |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA qw(:DEFAULT :match); |
use Crypt::CBC; |
use Crypt::CBC; |
use Time::HiRes qw( sleep ); |
|
|
|
my $registered_cleanup; |
my $registered_cleanup; |
my $modified_courses; |
my $modified_courses; |
Line 294 sub handler {
|
Line 293 sub handler {
|
excc => 'Exclude from community catalog', |
excc => 'Exclude from community catalog', |
clon => 'Users allowed to clone community', |
clon => 'Users allowed to clone community', |
rept => 'Replacement titles for standard community roles', |
rept => 'Replacement titles for standard community roles', |
time => 'Time Zone where the community is located', |
time => 'Timezone where the community is located', |
date => 'Locale used for community calendar', |
date => 'Locale used for community calendar', |
coco => 'Community Content', |
coco => 'Community Content', |
copo => 'Community Policy', |
copo => 'Community Policy', |
Line 316 sub handler {
|
Line 315 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', |
excc => 'Exclude from course catalog', |
excc => 'Exclude from course catalog', |
clon => 'Users allowed to clone course', |
clon => 'Users allowed to clone course', |
rept => 'Replacement titles for standard course roles', |
rept => 'Replacement titles for standard course roles', |
time => 'Time Zone in which the course takes place', |
time => 'Timezone in which the course takes place', |
date => 'Locale used for course calendar', |
date => 'Locale used for course calendar', |
coco => 'Course Content', |
coco => 'Course Content', |
copo => 'Course Policy', |
copo => 'Course Policy', |
Line 373 sub handler {
|
Line 372 sub handler {
|
my %values=&Apache::lonnet::dump('environment',$cdom,$cnum); |
my %values=&Apache::lonnet::dump('environment',$cdom,$cnum); |
my %linkprot=&Apache::lonnet::dump('lti',$cdom,$cnum,undef,undef,undef,1); |
my %linkprot=&Apache::lonnet::dump('lti',$cdom,$cnum,undef,undef,undef,1); |
my %ltienc = &Apache::lonnet::dump('nohist_ltienc',$cdom,$cnum,undef,undef,undef,1); |
my %ltienc = &Apache::lonnet::dump('nohist_ltienc',$cdom,$cnum,undef,undef,undef,1); |
my %ltitools = &Apache::lonnet::dump('ltitools',$cdom,$cnum,undef,undef,undef,1); |
|
my %ltitoolsenc = &Apache::lonnet::dump('nohist_toolsenc',$cdom,$cnum,undef,undef,undef,1); |
|
foreach my $id (keys(%linkprot)) { |
foreach my $id (keys(%linkprot)) { |
if (ref($linkprot{$id}) eq 'HASH') { |
if (ref($linkprot{$id}) eq 'HASH') { |
if (ref($ltienc{$id}) eq 'HASH') { |
if (ref($ltienc{$id}) eq 'HASH') { |
Line 392 sub handler {
|
Line 389 sub handler {
|
if ($linkprot{'lock'}) { |
if ($linkprot{'lock'}) { |
delete($linkprot{'lock'}); |
delete($linkprot{'lock'}); |
} |
} |
foreach my $id (keys(%ltitools)) { |
|
if (ref($ltitools{$id}) eq 'HASH') { |
|
if (ref($ltitoolsenc{$id}) eq 'HASH') { |
|
$values{'ltitools'}{$id} = { %{$ltitools{$id}}, %{$ltitoolsenc{$id}} }; |
|
} else { |
|
$values{'ltitools'}{$id} = $ltitools{$id}; |
|
} |
|
} |
|
unless ($phase eq 'process') { |
|
if (ref($values{'ltitools'}{$id}) eq 'HASH') { |
|
delete($values{'ltitools'}{$id}{'secret'}); |
|
} |
|
} |
|
} |
|
if ($ltitools{'lock'}) { |
|
delete($ltitools{'lock'}); |
|
} |
|
my @prefs_order = ('courseinfo','localization','feedback','discussion', |
my @prefs_order = ('courseinfo','localization','feedback','discussion', |
'classlists','appearance','grading','printouts', |
'classlists','appearance','grading','printouts', |
'menuitems','ltitools','linkprot','spreadsheet', |
'menuitems','linkprot','spreadsheet','bridgetasks', |
'bridgetasks','other'); |
'lti','other'); |
|
|
my %prefs = ( |
my %prefs = ( |
'courseinfo' => |
'courseinfo' => |
{ text => $lt{'gens'}, |
{ text => $lt{'gens'}, |
Line 463 sub handler {
|
Line 444 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 472 sub handler {
|
Line 454 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', |
Line 508 sub handler {
|
Line 492 sub handler {
|
help => 'Course_Prefs_Display', |
help => 'Course_Prefs_Display', |
ordered => ['default_xml_style','pageseparators', |
ordered => ['default_xml_style','pageseparators', |
'disable_receipt_display','texengine', |
'disable_receipt_display','texengine', |
'tthoptions','uselcmath','usejsme', |
'tthoptions','uselcmath','usejsme','inline_chem'], |
'inline_chem','extresource'], |
|
itemtext => { |
itemtext => { |
default_xml_style => 'Default XML style file', |
default_xml_style => 'Default XML style file', |
pageseparators => 'Visibly Separate Items on Pages', |
pageseparators => 'Visibly Separate Items on Pages', |
Line 519 sub handler {
|
Line 502 sub handler {
|
uselcmath => 'Student formula entry uses inline preview, not DragMath pop-up', |
uselcmath => 'Student formula entry uses inline preview, not DragMath pop-up', |
usejsme => 'Molecule editor uses JSME (HTML5) in place of JME (Java)', |
usejsme => 'Molecule editor uses JSME (HTML5) in place of JME (Java)', |
inline_chem => 'Chemical reaction response uses inline preview, not pop-up', |
inline_chem => 'Chemical reaction response uses inline preview, not pop-up', |
extresource => 'Display of external resources', |
|
}, |
}, |
}, |
}, |
'grading' => |
'grading' => |
Line 540 sub handler {
|
Line 522 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 574 sub handler {
|
Line 556 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' => |
'menuitems' => |
{ |
{ |
text => 'Menu display', |
text => 'Menu display', |
Line 597 sub handler {
|
Line 591 sub handler {
|
col2 => 'Settings', |
col2 => 'Settings', |
}], |
}], |
}, |
}, |
'ltitools' => |
|
{ |
|
text => 'External tools', |
|
help => 'Course_Prefs_ExternalTools', |
|
header => [{col1 => 'Item', |
|
col2 => 'Settings', |
|
}], |
|
}, |
|
'other' => |
'other' => |
{ text => 'Other settings', |
{ text => 'Other settings', |
help => 'Course_Prefs_Other', |
help => 'Course_Prefs_Other', |
Line 615 sub handler {
|
Line 601 sub handler {
|
); |
); |
if (($phase eq 'process') && ($parm_permission->{'process'})) { |
if (($phase eq 'process') && ($parm_permission->{'process'})) { |
my @allitems = &get_allitems(%prefs); |
my @allitems = &get_allitems(%prefs); |
my $result = &Apache::lonconfigsettings::make_changes($r,$cdom,$phase,$context, |
&Apache::lonconfigsettings::make_changes($r,$cdom,$phase,$context, |
\@prefs_order,\%prefs,\%values, |
\@prefs_order,\%prefs,\%values, |
$cnum,undef,\@allitems, |
$cnum,undef,\@allitems, |
'coursepref',$parm_permission); |
'coursepref',$parm_permission); |
if ((ref($result) eq 'HASH') && (keys(%{$result}))) { |
|
$r->rflush(); |
|
&devalidate_remote_courseprefs($cdom,$cnum,$result); |
|
} |
|
} elsif (($phase eq 'display') && ($parm_permission->{'display'})) { |
} elsif (($phase eq 'display') && ($parm_permission->{'display'})) { |
my $noedit; |
my $noedit; |
if (ref($parm_permission) eq 'HASH') { |
if (ref($parm_permission) eq 'HASH') { |
Line 679 sub get_allitems {
|
Line 661 sub get_allitems {
|
if ($item eq 'feedback') { |
if ($item eq 'feedback') { |
push(@allitems,(map { $_.'.text'; } @{$prefs{$item}{'ordered'}})); |
push(@allitems,(map { $_.'.text'; } @{$prefs{$item}{'ordered'}})); |
} |
} |
} elsif (($item eq 'linkprot') || ($item eq 'ltitools')) { |
|
push(@allitems,$item); |
|
} |
} |
} |
} |
} |
} |
Line 807 sub print_config_box {
|
Line 787 sub print_config_box {
|
} elsif ($action eq 'appearance') { |
} elsif ($action eq 'appearance') { |
$output .= &print_appearance($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype,$noedit); |
$output .= &print_appearance($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype,$noedit); |
} elsif ($action eq 'grading') { |
} elsif ($action eq 'grading') { |
$output .= &print_grading($cdom,$cnum,$settings,$ordered,$itemtext,\$rowtotal,$crstype,$noedit); |
$output .= &print_grading($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype,$noedit); |
} elsif ($action eq 'printouts') { |
} elsif ($action eq 'printouts') { |
$output .= &print_printouts($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype,$noedit); |
$output .= &print_printouts($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype,$noedit); |
} elsif ($action eq 'spreadsheet') { |
} elsif ($action eq 'spreadsheet') { |
$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 'ltitools') { |
} elsif ($action eq 'lti') { |
my $currtools = {}; |
$output .= &print_lti($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype,$noedit); |
if ((ref($settings) eq 'HASH') && (ref($settings->{'ltitools'}))) { |
|
$currtools = $settings->{'ltitools'}; |
|
} |
|
$output .= &print_ltitools($cdom,$cnum,$currtools,\$rowtotal,$crstype,$noedit,'course'); |
|
} elsif ($action eq 'menuitems') { |
} elsif ($action eq 'menuitems') { |
$output .= &print_menuitems('bottom',$cdom,$settings,$itemtext,\$rowtotal,$crstype,$noedit); |
$output .= &print_menuitems('bottom',$cdom,$settings,$itemtext,\$rowtotal,$crstype,$noedit); |
} elsif ($action eq 'linkprot') { |
} elsif ($action eq 'linkprot') { |
Line 836 sub print_config_box {
|
Line 812 sub print_config_box {
|
} |
} |
|
|
sub process_changes { |
sub process_changes { |
my ($cdom,$cnum,$action,$values,$item,$changes,$allitems,$disallowed,$crstype,$lastactref) = @_; |
my ($cdom,$cnum,$action,$values,$item,$changes,$allitems,$disallowed,$crstype) = @_; |
my (%newvalues,$errors); |
my (%newvalues,$errors); |
if (ref($item) eq 'HASH') { |
if (ref($item) eq 'HASH') { |
if (ref($changes) eq 'HASH') { |
if (ref($changes) eq 'HASH') { |
Line 854 sub process_changes {
|
Line 830 sub process_changes {
|
} |
} |
} |
} |
} |
} |
} elsif (($action eq 'linkprot') || ($action eq 'ltitools')) { |
} elsif ($action eq 'linkprot') { |
if (ref($values->{$action}) eq 'HASH') { |
if (ref($values->{$action}) eq 'HASH') { |
foreach my $id (keys(%{$values->{$action}})) { |
foreach my $id (keys(%{$values->{$action}})) { |
if ($id =~ /^\d+$/) { |
if ($id =~ /^\d+$/) { |
Line 863 sub process_changes {
|
Line 839 sub process_changes {
|
} |
} |
} |
} |
@ordered = sort { $a <=> $b } @ordered; |
@ordered = sort { $a <=> $b } @ordered; |
if (($env{'form.'.$action.'_add'}) && ($env{'form.'.$action.'_maxnum'} =~ /^\d+$/)) { |
if (($env{'form.linkprot_add'}) && ($env{'form.linkprot_maxnum'} =~ /^\d+$/)) { |
push(@ordered,$env{'form.'.$action.'_maxnum'}); |
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') { |
Line 1005 sub process_changes {
|
Line 981 sub process_changes {
|
} |
} |
} elsif ($action eq 'linkprot') { |
} elsif ($action eq 'linkprot') { |
if (ref($values) eq 'HASH') { |
if (ref($values) eq 'HASH') { |
$errors = &process_linkprot($cdom,$cnum,$values->{$action},$changes,'course',$lastactref); |
$errors = &process_linkprot($cdom,$cnum,$values->{$action},$changes,'course'); |
} |
|
} elsif ($action eq 'ltitools') { |
|
if (ref($values) eq 'HASH') { |
|
my $switchserver = &check_switchserver($cdom,$cnum,'course','/adm/courseprefs'); |
|
$errors = &process_ltitools('',$cdom,$cnum,$values->{$action},$changes,'course',$lastactref, |
|
'ok','','ok'); |
|
} |
} |
} else { |
} else { |
foreach my $entry (@ordered) { |
foreach my $entry (@ordered) { |
Line 1260 sub process_changes {
|
Line 1230 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 1268 sub process_changes {
|
Line 1239 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 1320 sub process_changes {
|
Line 1292 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 1335 sub process_changes {
|
Line 1307 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 1344 sub process_changes {
|
Line 1316 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 1419 sub process_changes {
|
Line 1391 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 1435 sub process_changes {
|
Line 1407 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 1456 sub process_changes {
|
Line 1428 sub process_changes {
|
$settings =~ s/,$//; |
$settings =~ s/,$//; |
} |
} |
$newvalues{$entry} = $settings; |
$newvalues{$entry} = $settings; |
} elsif ($entry eq 'extresource') { |
} elsif ($action eq 'lti') { |
if ($env{'form.'.$entry} =~ /^iframe|tab|window$/) { |
if ($entry eq 'lti.override') { |
$newvalues{$entry} = $env{'form.'.$entry}; |
|
if ($env{'form.'.$entry} ne 'iframe') { |
|
if ($env{'form.extwintabreuse'}) { |
|
$newvalues{$entry} .= ':1'; |
|
} else { |
|
$newvalues{$entry} .= ':0'; |
|
} |
|
if ($env{'form.'.$entry} eq 'window') { |
|
foreach my $dim ('width','height') { |
|
$env{'form.extreswin'.$dim} =~ s/^\s+|\s+$//g; |
|
if ($env{'form.extreswin'.$dim} =~ /^\d+$/) { |
|
$newvalues{$entry} .= ':'.$env{'form.extreswin'.$dim}; |
|
} else { |
|
$newvalues{$entry} .= ':'; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
unless (($newvalues{$entry} eq 'iframe') && ($values->{$entry} eq '')) { |
|
if ($newvalues{$entry} ne $values->{$entry}) { |
|
$changes->{$entry} = $newvalues{$entry}; |
|
} |
|
} |
|
} elsif ($entry eq 'timezone') { |
|
if ($env{'form.'.$entry}) { |
|
$newvalues{$entry} = $env{'form.'.$entry}; |
$newvalues{$entry} = $env{'form.'.$entry}; |
if ($newvalues{$entry} ne $values->{$entry}) { |
} elsif (($entry eq 'lti.topmenu') || ($entry eq 'lti.inlinemenu')) { |
$changes->{$entry} = $newvalues{$entry}; |
if ($env{'form.lti.override'}) { |
|
$newvalues{$entry} = $env{'form.'.$entry}; |
|
} else { |
|
$newvalues{$entry} = ''; |
} |
} |
if ($env{'form.tzover'}) { |
} elsif ($entry eq 'lti.lcmenu') { |
$newvalues{'tzover'} = $env{'form.tzover'}; |
if (($env{'form.lti.override'}) && |
if ($newvalues{'tzover'} ne $values->{'tzover'}) { |
(($env{'form.lti.topmenu'}) || ($env{'form.lti.inlinemenu'}))) { |
$changes->{'tzover'} = $newvalues{'tzover'}; |
my @lcmenu = &Apache::loncommon::get_env_multiple('form.lti.lcmenu'); |
} |
my @newlcmenu; |
} elsif ($values->{'tzover'}) { |
if (@lcmenu) { |
$changes->{'tzover'} = ''; |
my @menuitems = ('fullname','coursetitle','role','logout','grades'); |
} |
foreach my $item (@menuitems) { |
} elsif ($values->{$entry}) { |
next if (($item eq 'grades') && (!$newvalues{'lti.inlinemenu'})); |
$changes->{$entry} = ''; |
if (grep(/^\Q$item\E$/,@lcmenu)) { |
} |
push(@newlcmenu,$item); |
} elsif ($entry eq 'grading') { |
|
if ($env{'form.'.$entry} eq 'standard') { |
|
if ($env{'form.hidetotals'}) { |
|
my %sections = &Apache::loncommon::get_sections($cdom,$cnum); |
|
if (keys(%sections)) { |
|
my @secs = &Apache::loncommon::get_env_multiple('form.hidetotals_sections'); |
|
if (grep(/^all$/,@secs)) { |
|
$newvalues{'hidetotals'} = 'all'; |
|
} elsif (@secs) { |
|
$newvalues{'hidetotals'} = ''; |
|
foreach my $sec (sort {$a <=> $b} @secs) { |
|
if (exists($sections{$sec})) { |
|
$newvalues{'hidetotals'} .= $sec.',' |
|
} |
|
} |
} |
$newvalues{'hidetotals'} =~ s/,$//; |
|
} |
} |
|
} |
|
if (@newlcmenu) { |
|
$newvalues{$entry} = join(',',@newlcmenu); |
} else { |
} else { |
$newvalues{'hidetotals'} = 'all'; |
$newvalues{$entry} = 'none'; |
} |
} |
|
} else { |
|
$newvalues{$entry} = ''; |
} |
} |
} |
} |
if ($newvalues{'hidetotals'} ne $values->{'hidetotals'}) { |
|
$changes->{'hidetotals'} = $newvalues{'hidetotals'}; |
|
$changes->{'grading'} = $env{'form.'.$entry}; |
|
} |
|
$newvalues{$entry} = $env{'form.'.$entry}; |
|
} else { |
} else { |
$newvalues{$entry} = $env{'form.'.$entry}; |
$newvalues{$entry} = $env{'form.'.$entry}; |
} |
} |
unless (($entry eq 'co-owners') || ($entry eq 'discussion_post_fonts') || |
unless (($entry eq 'co-owners') || ($entry eq 'discussion_post_fonts')) { |
($entry eq 'extresource') || ($entry eq 'timezone')) { |
|
if ($newvalues{$entry} ne $values->{$entry}) { |
if ($newvalues{$entry} ne $values->{$entry}) { |
$changes->{$entry} = $newvalues{$entry}; |
$changes->{$entry} = $newvalues{$entry}; |
} |
} |
Line 1544 sub process_changes {
|
Line 1477 sub process_changes {
|
} |
} |
|
|
sub process_linkprot { |
sub process_linkprot { |
my ($cdom,$cnum,$values,$changes,$context,$lastactref) = @_; |
my ($cdom,$cnum,$values,$changes,$context) = @_; |
my ($dest,$ltiauth,$privnum,$cipher,$errors,%linkprot); |
my ($home,$dest,$ltiauth,$privkey,$privnum,$cipher,$errors,%linkprot); |
if (ref($values) eq 'HASH') { |
if (ref($values) eq 'HASH') { |
foreach my $id (keys(%{$values})) { |
foreach my $id (keys(%{$values})) { |
if ($id =~ /^\d+$/) { |
if ($id =~ /^\d+$/) { |
Line 1555 sub process_linkprot {
|
Line 1488 sub process_linkprot {
|
} |
} |
} |
} |
} |
} |
($cipher,$privnum) = &get_credentials($cdom,$cnum,'lti',$context); |
my %domdefs = &Apache::lonnet::get_domain_defaults($cdom); |
|
my @ids=&Apache::lonnet::current_machine_ids(); |
|
if ($context eq 'domain') { |
|
$home = &Apache::lonnet::domain($cdom,'primary'); |
|
} else { |
|
$home = &Apache::lonnet::homeserver($cnum,$cdom); |
|
} |
|
if ((($context eq 'domain') && ($domdefs{'linkprotenc_dom'})) || |
|
(($context eq 'course') && ($domdefs{'linkprotenc_crs'}))) { |
|
unless (($home eq 'no_host') || ($home eq '')) { |
|
if (grep(/^\Q$home\E$/,@ids)) { |
|
if (ref($domdefs{'privhosts'}) eq 'ARRAY') { |
|
if (grep(/^\Q$home\E$/,@{$domdefs{'privhosts'}})) { |
|
my %privhash = &Apache::lonnet::restore_dom('lti','private',$cdom,$home,1); |
|
$privkey = $privhash{'key'}; |
|
$privnum = $privhash{'version'}; |
|
if (($privnum) && ($privkey ne '')) { |
|
$cipher = Crypt::CBC->new({'key' => $privkey, |
|
'cipher' => 'DES'}); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
if ($context eq 'domain') { |
if ($context eq 'domain') { |
$dest = '/adm/domainprefs'; |
$dest = '/adm/domainprefs'; |
$ltiauth = 1; |
$ltiauth = 1; |
Line 1587 sub process_linkprot {
|
Line 1544 sub process_linkprot {
|
if (ref($values) eq 'HASH') { |
if (ref($values) eq 'HASH') { |
my @todelete = &Apache::loncommon::get_env_multiple('form.linkprot_del'); |
my @todelete = &Apache::loncommon::get_env_multiple('form.linkprot_del'); |
my $maxnum = $env{'form.linkprot_maxnum'}; |
my $maxnum = $env{'form.linkprot_maxnum'}; |
for (my $i=0; $i<$maxnum; $i++) { |
for (my $i=0; $i<=$maxnum; $i++) { |
my $itemid = $env{'form.linkprot_id_'.$i}; |
my $itemid = $env{'form.linkprot_id_'.$i}; |
$itemid =~ s/\D+//g; |
$itemid =~ s/\D+//g; |
if ($itemid) { |
if ($itemid) { |
Line 1632 sub process_linkprot {
|
Line 1589 sub process_linkprot {
|
$linkprot{$itemid}{$inner} = $env{$formitem}; |
$linkprot{$itemid}{$inner} = $env{$formitem}; |
} |
} |
} |
} |
my $urlitem = 'form.linkprot_returnurl_'.$idx; |
|
my $urlparamname = 'form.linkprot_urlparam_'.$idx; |
|
if ($env{$urlitem} == 1) { |
|
$env{$urlparamname} =~ s/(`)/'/g; |
|
} elsif (exists($env{$urlparamname})) { |
|
$env{$urlparamname} = ''; |
|
} |
|
my $passback = 'form.linkprot_passback_'.$idx; |
|
my $passbackparamname = 'form.linkprot_passbackformat_'.$idx; |
|
if ($env{$passback} == 1) { |
|
unless ($env{$passbackparamname} =~ /^1\.(0|1)$/) { |
|
$env{$passbackparamname} = ''; |
|
} |
|
} elsif (exists($env{$passbackparamname})) { |
|
$env{$passbackparamname} = ''; |
|
} |
|
unless ($idx eq 'add') { |
|
if ((!$current{'returnurl'} && ($env{$urlparamname} ne '')) || |
|
($current{'returnurl'} && ($env{$urlparamname} eq ''))) { |
|
$haschanges{$itemid} = 1; |
|
} |
|
if ((!$current{'passback'} && ($env{$passbackparamname} ne '')) || |
|
($current{'passback'} && ($env{$passbackparamname} eq ''))) { |
|
$haschanges{$itemid} = 1; |
|
} |
|
} |
|
if ($env{$urlparamname} ne '') { |
|
$linkprot{$itemid}{'returnurl'} = $env{$urlparamname}; |
|
} |
|
if ($env{$passbackparamname} ne '') { |
|
$linkprot{$itemid}{'passback'} = 1; |
|
$linkprot{$itemid}{'passbackformat'} = $env{$passbackparamname}; |
|
} |
|
if ($ltiauth) { |
if ($ltiauth) { |
my $reqitem = 'form.linkprot_requser_'.$idx; |
my $reqitem = 'form.linkprot_requser_'.$idx; |
$env{$reqitem} =~ s/(`)/'/g; |
$env{$reqitem} =~ s/(`)/'/g; |
Line 1732 sub process_linkprot {
|
Line 1656 sub process_linkprot {
|
} |
} |
} else { |
} else { |
$linkprot{$itemid}{'secret'} = $current{'secret'}; |
$linkprot{$itemid}{'secret'} = $current{'secret'}; |
$linkprot{$itemid}{'cipher'} = $current{'cipher'}; |
|
} |
} |
} elsif ($env{$secretitem} ne '') { |
} elsif ($env{$secretitem} ne '') { |
if ($privnum && $cipher) { |
if ($privnum && $cipher) { |
Line 1749 sub process_linkprot {
|
Line 1672 sub process_linkprot {
|
foreach my $entry (keys(%haschanges)) { |
foreach my $entry (keys(%haschanges)) { |
$changes->{$entry} = $linkprot{$entry}; |
$changes->{$entry} = $linkprot{$entry}; |
} |
} |
if (ref($lastactref) eq 'HASH') { |
|
$lastactref->{'courselti'} = 1; |
|
} |
|
} |
} |
return $errors; |
return $errors; |
} |
} |
Line 1775 sub get_linkprot_id {
|
Line 1695 sub get_linkprot_id {
|
$tries ++; |
$tries ++; |
sleep (0.1); |
sleep (0.1); |
if ($context eq 'domain') { |
if ($context eq 'domain') { |
$gotlock = &Apache::lonnet::newput_dom('linkprot',$lockhash,$cdom); |
$gotlock = &Apache::lonnet::newput_dom('linkprot',$lockhash,$cdom); |
} else { |
} else { |
$gotlock = &Apache::lonnet::newput('lti',$lockhash,$cdom,$cnum); |
$gotlock = &Apache::lonnet::newput('lti',$lockhash,$cdom,$cnum); |
} |
} |
Line 1813 sub get_linkprot_id {
|
Line 1733 sub get_linkprot_id {
|
$error = 'nonumber'; |
$error = 'nonumber'; |
} |
} |
} |
} |
my $dellockoutcome; |
my $dellockoutcome; |
if ($context eq 'domain') { |
if ($context eq 'domain') { |
$dellockoutcome = &Apache::lonnet::del_dom('linkprot',['lock'],$cdom); |
$dellockoutcome = &Apache::lonnet::del_dom('linkprot',['lock'],$cdom); |
} else { |
} else { |
Line 1825 sub get_linkprot_id {
|
Line 1745 sub get_linkprot_id {
|
return ($id,$error); |
return ($id,$error); |
} |
} |
|
|
sub get_credentials { |
|
my ($cdom,$cnum,$type,$context) = @_; |
|
my ($cipher,$privnum,$home); |
|
my %domdefs = &Apache::lonnet::get_domain_defaults($cdom); |
|
my @ids=&Apache::lonnet::current_machine_ids(); |
|
if ($context eq 'domain') { |
|
$home = &Apache::lonnet::domain($cdom,'primary'); |
|
} else { |
|
$home = &Apache::lonnet::homeserver($cnum,$cdom); |
|
} |
|
my ($hostskey,$domkey,$crskey); |
|
if ($type eq 'ltitools') { |
|
$hostskey = 'toolprivhosts'; |
|
$domkey = 'toolenc_dom'; |
|
$crskey = 'toolenc_crs'; |
|
} else { |
|
$hostskey = 'ltiprivhosts'; |
|
$domkey = 'linkprotenc_dom'; |
|
$crskey = 'linkprotenc_crs'; |
|
} |
|
if ((($context eq 'domain') && ($domdefs{$domkey})) || |
|
(($context eq 'course') && ($domdefs{$crskey}))) { |
|
unless (($home eq 'no_host') || ($home eq '')) { |
|
if (grep(/^\Q$home\E$/,@ids)) { |
|
if (ref($domdefs{$hostskey}) eq 'ARRAY') { |
|
if (grep(/^\Q$home\E$/,@{$domdefs{$hostskey}})) { |
|
my %privhash = &Apache::lonnet::restore_dom($type,'private',$cdom,$home,1); |
|
my $privkey = $privhash{'key'}; |
|
$privnum = $privhash{'version'}; |
|
if (($privnum) && ($privkey ne '')) { |
|
$cipher = Crypt::CBC->new({'key' => $privkey, |
|
'cipher' => 'DES'}); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
return ($cipher,$privnum); |
|
} |
|
|
|
sub process_ltitools { |
|
my ($r,$cdom,$cnum,$values,$changes,$context,$lastactref,$configuserok,$lonhost, |
|
$author_ok,$confname) = @_; |
|
my (%currconfig,$newid,@allpos,%changes,%ltitools,$errors); |
|
|
|
my (%posslti,%possfield); |
|
my @courseroles = ('cc','in','ta','ep','st'); |
|
my @ltiroles = qw(Instructor ContentDeveloper TeachingAssistant Learner); |
|
map { $posslti{$_} = 1; } @ltiroles; |
|
my @allfields = ('fullname','firstname','lastname','email','user','roles'); |
|
map { $possfield{$_} = 1; } @allfields; |
|
|
|
my ($dest,$privnum,$cipher); |
|
|
|
($cipher,$privnum) = &get_credentials($cdom,$cnum,'ltitools',$context); |
|
if ($context eq 'domain') { |
|
$dest = '/adm/domainprefs'; |
|
} else { |
|
$dest = '/adm/courseprefs'; |
|
} |
|
my $switchserver = &check_switchserver($cdom,$cnum,$context,$dest); |
|
|
|
my (@allpos,@items,%deletions,%itemids,%haschanges); |
|
if ($env{'form.ltitools_add'}) { |
|
my $title = $env{'form.ltitools_add_title'}; |
|
$title =~ s/(`)/'/g; |
|
my ($newid,$error) = &Apache::lonnet::get_ltitools_id($context,$cdom,$cnum,$title); |
|
if ($newid) { |
|
my $position = $env{'form.ltitools_add_pos'}; |
|
$position =~ s/\D+//g; |
|
if ($position ne '') { |
|
$allpos[$position] = $newid; |
|
} |
|
$haschanges{$newid} = 1; |
|
foreach my $item ('title','url','lifetime') { |
|
$env{'form.ltitools_add_'.$item} =~ s/(`)/'/g; |
|
if ($item eq 'lifetime') { |
|
$env{'form.ltitools_add_'.$item} =~ s/[^\d.]//g; |
|
} |
|
if ($env{'form.ltitools_add_'.$item}) { |
|
$ltitools{$newid}{$item} = $env{'form.ltitools_add_'.$item}; |
|
} |
|
} |
|
if ($env{'form.ltitools_add_version'} eq 'LTI-1p0') { |
|
$ltitools{$newid}{'version'} = $env{'form.ltitools_add_version'}; |
|
} |
|
if ($env{'form.ltitools_add_msgtype'} eq 'basic-lti-launch-request') { |
|
$ltitools{$newid}{'msgtype'} = $env{'form.ltitools_add_msgtype'}; |
|
} |
|
if ($env{'form.ltitools_add_sigmethod'} eq 'HMAC-SHA256') { |
|
$ltitools{$newid}{'sigmethod'} = $env{'form.ltitools_add_sigmethod'}; |
|
} else { |
|
$ltitools{$newid}{'sigmethod'} = 'HMAC-SHA1'; |
|
} |
|
foreach my $item ('width','height','linktext','explanation') { |
|
$env{'form.ltitools_add_'.$item} =~ s/^\s+//; |
|
$env{'form.ltitools_add_'.$item} =~ s/\s+$//; |
|
if (($item eq 'width') || ($item eq 'height')) { |
|
if ($env{'form.ltitools_add_'.$item} =~ /^\d+$/) { |
|
$ltitools{$newid}{'display'}{$item} = $env{'form.ltitools_add_'.$item}; |
|
} |
|
} else { |
|
if ($env{'form.ltitools_add_'.$item} ne '') { |
|
$ltitools{$newid}{'display'}{$item} = $env{'form.ltitools_add_'.$item}; |
|
} |
|
} |
|
} |
|
if ($env{'form.ltitools_add_target'} eq 'window') { |
|
$ltitools{$newid}{'display'}{'target'} = $env{'form.ltitools_add_target'}; |
|
} elsif ($env{'form.ltitools_add_target'} eq 'tab') { |
|
$ltitools{$newid}{'display'}{'target'} = $env{'form.ltitools_add_target'}; |
|
} else { |
|
$ltitools{$newid}{'display'}{'target'} = 'iframe'; |
|
} |
|
foreach my $item ('passback','roster') { |
|
if ($env{'form.ltitools_'.$item.'_add'}) { |
|
$ltitools{$newid}{$item} = 1; |
|
if ($env{'form.ltitools_'.$item.'valid_add'} ne '') { |
|
my $lifetime = $env{'form.ltitools_'.$item.'valid_add'}; |
|
$lifetime =~ s/^\s+|\s+$//g; |
|
if ($lifetime =~ /^\d+\.?\d*$/) { |
|
$ltitools{$newid}{$item.'valid'} = $lifetime; |
|
} |
|
} |
|
} |
|
} |
|
if ($env{'form.ltitools_add_image.filename'} ne '') { |
|
my ($imageurl,$error) = |
|
&process_ltitools_image($r,$context,$cdom,$cnum,$confname,'ltitools_add_image', |
|
$newid,$configuserok,$lonhost,$author_ok); |
|
if ($imageurl) { |
|
$ltitools{$newid}{'image'} = $imageurl; |
|
} |
|
if ($error) { |
|
&Apache::lonnet::logthis($error); |
|
$errors .= '<li><span class="LC_error">'.$error.'</span></li>'; |
|
} |
|
} |
|
my @fields = &Apache::loncommon::get_env_multiple('form.ltitools_add_fields'); |
|
foreach my $field (@fields) { |
|
if ($possfield{$field}) { |
|
if ($field eq 'roles') { |
|
foreach my $role (@courseroles) { |
|
my $choice = $env{'form.ltitools_add_roles_'.$role}; |
|
if (($choice ne '') && ($posslti{$choice})) { |
|
$ltitools{$newid}{'roles'}{$role} = $choice; |
|
if ($role eq 'cc') { |
|
$ltitools{$newid}{'roles'}{'co'} = $choice; |
|
} |
|
} |
|
} |
|
} else { |
|
$ltitools{$newid}{'fields'}{$field} = 1; |
|
} |
|
} |
|
} |
|
if (ref($ltitools{$newid}{'fields'}) eq 'HASH') { |
|
if ($ltitools{$newid}{'fields'}{'user'}) { |
|
if ($env{'form.ltitools_add_userincdom'}) { |
|
$ltitools{$newid}{'incdom'} = 1; |
|
} |
|
} |
|
} |
|
my @courseconfig = &Apache::loncommon::get_env_multiple('form.ltitools_add_courseconfig'); |
|
foreach my $item (@courseconfig) { |
|
$ltitools{$newid}{'crsconf'}{$item} = 1; |
|
} |
|
if ($env{'form.ltitools_add_custom'}) { |
|
my $name = $env{'form.ltitools_add_custom_name'}; |
|
my $value = $env{'form.ltitools_add_custom_value'}; |
|
$value =~ s/(`)/'/g; |
|
$name =~ s/(`)/'/g; |
|
$ltitools{$newid}{'custom'}{$name} = $value; |
|
} |
|
unless ($switchserver) { |
|
my $keyitem = 'form.ltitools_add_key'; |
|
$env{$keyitem} =~ s/(`)/'/g; |
|
if ($env{$keyitem} ne '') { |
|
$ltitools{$newid}{'key'} = $env{$keyitem}; |
|
} |
|
my $secretitem = 'form.ltitools_secret_add'; |
|
$env{$secretitem} =~ s/(`)/'/g; |
|
if ($env{$secretitem} ne '') { |
|
if ($privnum && $cipher) { |
|
$ltitools{$newid}{'secret'} = $cipher->encrypt_hex($env{$secretitem}); |
|
$ltitools{$newid}{'cipher'} = $privnum; |
|
} else { |
|
$ltitools{$newid}{'secret'} = $env{$secretitem}; |
|
} |
|
} |
|
} |
|
} else { |
|
$errors .= '<li><span class="LC_error">'. |
|
&mt('Failed to acquire unique ID for new external tool'). |
|
'</span></li>'; |
|
} |
|
} |
|
if (ref($values) eq 'HASH') { |
|
my %deletions; |
|
my @todelete = &Apache::loncommon::get_env_multiple('form.ltitools_del'); |
|
if (@todelete) { |
|
map { $deletions{$_} = 1; } @todelete; |
|
} |
|
my %customadds; |
|
my @newcustom = &Apache::loncommon::get_env_multiple('form.ltitools_customadd'); |
|
if (@newcustom) { |
|
map { $customadds{$_} = 1; } @newcustom; |
|
} |
|
my %imgdeletions; |
|
my @todeleteimages = &Apache::loncommon::get_env_multiple('form.ltitools_image_del'); |
|
if (@todeleteimages) { |
|
map { $imgdeletions{$_} = 1; } @todeleteimages; |
|
} |
|
my $maxnum = $env{'form.ltitools_maxnum'}; |
|
for (my $i=0; $i<=$maxnum; $i++) { |
|
my $itemid = $env{'form.ltitools_id_'.$i}; |
|
$itemid =~ s/\D+//g; |
|
if (ref($values->{$itemid}) eq 'HASH') { |
|
if ($deletions{$itemid}) { |
|
if ($values->{$itemid}{'image'}) { |
|
#FIXME need to obsolete item in RES space |
|
} |
|
$haschanges{$itemid} = $values->{$itemid}{'title'}; |
|
next; |
|
} else { |
|
my $newpos = $env{'form.ltitools_'.$itemid}; |
|
$newpos =~ s/\D+//g; |
|
foreach my $item ('title','url','lifetime') { |
|
$ltitools{$itemid}{$item} = $env{'form.ltitools_'.$item.'_'.$i}; |
|
if ($values->{$itemid}{$item} ne $ltitools{$itemid}{$item}) { |
|
$haschanges{$itemid} = 1; |
|
} |
|
} |
|
if ($env{'form.ltitools_version_'.$i} eq 'LTI-1p0') { |
|
$ltitools{$itemid}{'version'} = $env{'form.ltitools_version_'.$i}; |
|
} |
|
if ($env{'form.ltitools_msgtype_'.$i} eq 'basic-lti-launch-request') { |
|
$ltitools{$itemid}{'msgtype'} = $env{'form.ltitools_msgtype_'.$i}; |
|
} |
|
if ($env{'form.ltitools_sigmethod_'.$i} eq 'HMAC-SHA256') { |
|
$ltitools{$itemid}{'sigmethod'} = $env{'form.ltitools_sigmethod_'.$i}; |
|
} else { |
|
$ltitools{$itemid}{'sigmethod'} = 'HMAC-SHA1'; |
|
} |
|
if ($values->{$itemid}{'sigmethod'} eq '') { |
|
if ($ltitools{$itemid}{'sigmethod'} ne 'HMAC-SHA1') { |
|
$haschanges{$itemid} = 1; |
|
} |
|
} elsif ($values->{$itemid}{'sigmethod'} ne $ltitools{$itemid}{'sigmethod'}) { |
|
$haschanges{$itemid} = 1; |
|
} |
|
foreach my $size ('width','height') { |
|
$env{'form.ltitools_'.$size.'_'.$i} =~ s/^\s+//; |
|
$env{'form.ltitools_'.$size.'_'.$i} =~ s/\s+$//; |
|
if ($env{'form.ltitools_'.$size.'_'.$i} =~ /^\d+$/) { |
|
$ltitools{$itemid}{'display'}{$size} = $env{'form.ltitools_'.$size.'_'.$i}; |
|
if (ref($values->{$itemid}{'display'}) eq 'HASH') { |
|
if ($values->{$itemid}{'display'}{$size} ne $ltitools{$itemid}{'display'}{$size}) { |
|
$haschanges{$itemid} = 1; |
|
} |
|
} else { |
|
$haschanges{$itemid} = 1; |
|
} |
|
} elsif (ref($values->{$itemid}{'display'}) eq 'HASH') { |
|
if ($values->{$itemid}{'display'}{$size} ne '') { |
|
$haschanges{$itemid} = 1; |
|
} |
|
} |
|
} |
|
foreach my $item ('linktext','explanation') { |
|
$env{'form.ltitools_'.$item.'_'.$i} =~ s/^\s+//; |
|
$env{'form.ltitools_'.$item.'_'.$i} =~ s/\s+$//; |
|
if ($env{'form.ltitools_'.$item.'_'.$i} ne '') { |
|
$ltitools{$itemid}{'display'}{$item} = $env{'form.ltitools_'.$item.'_'.$i}; |
|
if (ref($values->{$itemid}{'display'}) eq 'HASH') { |
|
if ($values->{$itemid}{'display'}{$item} ne $ltitools{$itemid}{'display'}{$item}) { |
|
$haschanges{$itemid} = 1; |
|
} |
|
} else { |
|
$haschanges{$itemid} = 1; |
|
} |
|
} elsif (ref($values->{$itemid}{'display'}) eq 'HASH') { |
|
if ($values->{$itemid}{'display'}{$item} ne '') { |
|
$haschanges{$itemid} = 1; |
|
} |
|
} |
|
} |
|
if ($env{'form.ltitools_target_'.$i} eq 'window') { |
|
$ltitools{$itemid}{'display'}{'target'} = $env{'form.ltitools_target_'.$i}; |
|
} elsif ($env{'form.ltitools_target_'.$i} eq 'tab') { |
|
$ltitools{$itemid}{'display'}{'target'} = $env{'form.ltitools_target_'.$i}; |
|
} else { |
|
$ltitools{$itemid}{'display'}{'target'} = 'iframe'; |
|
} |
|
if (ref($values->{$itemid}{'display'}) eq 'HASH') { |
|
if ($values->{$itemid}{'display'}{'target'} ne $ltitools{$itemid}{'display'}{'target'}) { |
|
$haschanges{$itemid} = 1; |
|
} |
|
} else { |
|
$haschanges{$itemid} = 1; |
|
} |
|
foreach my $extra ('passback','roster') { |
|
if ($env{'form.ltitools_'.$extra.'_'.$i}) { |
|
$ltitools{$itemid}{$extra} = 1; |
|
if ($env{'form.ltitools_'.$extra.'valid_'.$i} ne '') { |
|
my $lifetime = $env{'form.ltitools_'.$extra.'valid_'.$i}; |
|
$lifetime =~ s/^\s+|\s+$//g; |
|
if ($lifetime =~ /^\d+\.?\d*$/) { |
|
$ltitools{$itemid}{$extra.'valid'} = $lifetime; |
|
} |
|
} |
|
} |
|
if ($values->{$itemid}{$extra} ne $ltitools{$itemid}{$extra}) { |
|
$haschanges{$itemid} = 1; |
|
} |
|
if ($values->{$itemid}{$extra.'valid'} ne $ltitools{$itemid}{$extra.'valid'}) { |
|
$haschanges{$itemid} = 1; |
|
} |
|
} |
|
my @courseconfig = &Apache::loncommon::get_env_multiple('form.ltitools_courseconfig_'.$i); |
|
foreach my $item ('label','title','target','linktext','explanation','append') { |
|
if (grep(/^\Q$item\E$/,@courseconfig)) { |
|
$ltitools{$itemid}{'crsconf'}{$item} = 1; |
|
if (ref($values->{$itemid}{'crsconf'}) eq 'HASH') { |
|
if ($values->{$itemid}{'crsconf'}{$item} ne $ltitools{$itemid}{'crsconf'}{$item}) { |
|
$haschanges{$itemid} = 1; |
|
} |
|
} else { |
|
$haschanges{$itemid} = 1; |
|
} |
|
} |
|
} |
|
my @fields = &Apache::loncommon::get_env_multiple('form.ltitools_fields_'.$i); |
|
foreach my $field (@fields) { |
|
if ($possfield{$field}) { |
|
if ($field eq 'roles') { |
|
foreach my $role (@courseroles) { |
|
my $choice = $env{'form.ltitools_roles_'.$role.'_'.$i}; |
|
if (($choice ne '') && ($posslti{$choice})) { |
|
$ltitools{$itemid}{'roles'}{$role} = $choice; |
|
if ($role eq 'cc') { |
|
$ltitools{$itemid}{'roles'}{'co'} = $choice; |
|
} |
|
} |
|
if (ref($values->{$itemid}{'roles'}) eq 'HASH') { |
|
if ($values->{$itemid}{'roles'}{$role} ne $ltitools{$itemid}{'roles'}{$role}) { |
|
$haschanges{$itemid} = 1; |
|
} |
|
} elsif ($ltitools{$itemid}{'roles'}{$role}) { |
|
$haschanges{$itemid} = 1; |
|
} |
|
} |
|
} else { |
|
$ltitools{$itemid}{'fields'}{$field} = 1; |
|
if (ref($values->{$itemid}{'fields'}) eq 'HASH') { |
|
if ($values->{$itemid}{'fields'}{$field} ne $ltitools{$itemid}{'fields'}{$field}) { |
|
$haschanges{$itemid} = 1; |
|
} |
|
} else { |
|
$haschanges{$itemid} = 1; |
|
} |
|
} |
|
} |
|
} |
|
if (ref($ltitools{$itemid}{'fields'}) eq 'HASH') { |
|
if ($ltitools{$itemid}{'fields'}{'user'}) { |
|
if ($env{'form.ltitools_userincdom_'.$i}) { |
|
$ltitools{$itemid}{'incdom'} = 1; |
|
} |
|
if ($values->{$itemid}{'incdom'} ne $ltitools{$itemid}{'incdom'}) { |
|
$haschanges{$itemid} = 1; |
|
} |
|
} |
|
} |
|
$allpos[$newpos] = $itemid; |
|
} |
|
if ($imgdeletions{$itemid}) { |
|
$haschanges{$itemid} = 1; |
|
if ($context eq 'course') { |
|
my $currimgurl = $values->{$itemid}{'image'}; |
|
if ($currimgurl =~ m{^(\Q/uploaded/$cdom/$cnum/toollogo/$itemid\E)/([^/]+)$}) { |
|
my ($path,$imagefile) = ($1,$2); |
|
if ($imagefile =~ /^tn\-(.+)$/) { |
|
my $origimg = $1; |
|
&Apache::lonnet::removeuploadedurl("$path/$origimg"); |
|
} |
|
&Apache::lonnet::removeuploadedurl($currimgurl); |
|
} |
|
} |
|
#FIXME need to obsolete item in RES space |
|
} elsif ($env{'form.ltitools_image_'.$i.'.filename'}) { |
|
my $currimgurl = $values->{$itemid}{'image'}; |
|
my ($imgurl,$error) = &process_ltitools_image($r,$context,$cdom,$cnum,$confname,'ltitools_image_'.$i, |
|
$itemid,$configuserok,$lonhost,$author_ok,$currimgurl); |
|
if ($imgurl) { |
|
$ltitools{$itemid}{'image'} = $imgurl; |
|
$haschanges{$itemid} = 1; |
|
} |
|
if ($error) { |
|
&Apache::lonnet::logthis($error); |
|
$errors .= '<li><span class="LC_error">'.$error.'</span></li>'; |
|
} |
|
} elsif ($values->{$itemid}{'image'}) { |
|
$ltitools{$itemid}{'image'} = $values->{$itemid}{'image'}; |
|
} |
|
if ($customadds{$i}) { |
|
my $name = $env{'form.ltitools_custom_name_'.$i}; |
|
$name =~ s/(`)/'/g; |
|
$name =~ s/^\s+//; |
|
$name =~ s/\s+$//; |
|
my $value = $env{'form.ltitools_custom_value_'.$i}; |
|
$value =~ s/(`)/'/g; |
|
$value =~ s/^\s+//; |
|
$value =~ s/\s+$//; |
|
if ($name ne '') { |
|
$ltitools{$itemid}{'custom'}{$name} = $value; |
|
$haschanges{$itemid} = 1; |
|
} |
|
} |
|
my %customdels; |
|
my @customdeletions = &Apache::loncommon::get_env_multiple('form.ltitools_customdel_'.$i); |
|
if (@customdeletions) { |
|
$haschanges{$itemid} = 1; |
|
} |
|
map { $customdels{$_} = 1; } @customdeletions; |
|
if (ref($values->{$itemid}{'custom'}) eq 'HASH') { |
|
foreach my $key (keys(%{$values->{$itemid}{'custom'}})) { |
|
unless ($customdels{$key}) { |
|
if ($env{'form.ltitools_customval_'.$key.'_'.$i} ne '') { |
|
$ltitools{$itemid}{'custom'}{$key} = $env{'form.ltitools_customval_'.$key.'_'.$i}; |
|
} |
|
if ($values->{$itemid}{'custom'}{$key} ne $env{'form.ltitools_customval_'.$key.'_'.$i}) { |
|
$haschanges{$itemid} = 1; |
|
} |
|
} |
|
} |
|
} |
|
unless ($switchserver) { |
|
my $keyitem = 'form.ltitools_key_'.$i; |
|
$env{$keyitem} =~ s/(`)/'/g; |
|
if ($values->{$itemid}{'key'} ne $env{$keyitem}) { |
|
$haschanges{$itemid} = 1; |
|
} |
|
if ($env{$keyitem} ne '') { |
|
$ltitools{$itemid}{'key'} = $env{$keyitem}; |
|
} |
|
my $secretitem = 'form.ltitools_secret_'.$i; |
|
$env{$secretitem} =~ s/(`)/'/g; |
|
if ($values->{$itemid}{'usable'}) { |
|
if ($env{'form.ltitools_changesecret_'.$i}) { |
|
if ($env{$secretitem} ne '') { |
|
if ($privnum && $cipher) { |
|
$ltitools{$itemid}{'secret'} = $cipher->encrypt_hex($env{$secretitem}); |
|
$ltitools{$itemid}{'cipher'} = $privnum; |
|
} else { |
|
$ltitools{$itemid}{'secret'} = $env{$secretitem}; |
|
} |
|
$haschanges{$itemid} = 1; |
|
} |
|
} else { |
|
$ltitools{$itemid}{'secret'} = $values->{$itemid}{'secret'}; |
|
$ltitools{$itemid}{'cipher'} = $values->{$itemid}{'cipher'}; |
|
} |
|
} elsif ($env{$secretitem} ne '') { |
|
if ($privnum && $cipher) { |
|
$ltitools{$itemid}{'secret'} = $cipher->encrypt_hex($env{$secretitem}); |
|
$ltitools{$itemid}{'cipher'} = $privnum; |
|
} else { |
|
$ltitools{$itemid}{'secret'} = $env{$secretitem}; |
|
} |
|
$haschanges{$itemid} = 1; |
|
} |
|
} |
|
unless ($haschanges{$itemid}) { |
|
foreach my $key (keys(%{$values->{$itemid}})) { |
|
if (ref($values->{$itemid}{$key}) eq 'HASH') { |
|
if (ref($ltitools{$itemid}{$key}) eq 'HASH') { |
|
foreach my $innerkey (keys(%{$values->{$itemid}{$key}})) { |
|
unless (exists($ltitools{$itemid}{$key}{$innerkey})) { |
|
$haschanges{$itemid} = 1; |
|
last; |
|
} |
|
} |
|
} elsif (keys(%{$values->{$itemid}{$key}}) > 0) { |
|
$haschanges{$itemid} = 1; |
|
} |
|
} |
|
last if ($haschanges{$itemid}); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
if (@allpos > 0) { |
|
my $idx = 0; |
|
foreach my $itemid (@allpos) { |
|
if ($itemid ne '') { |
|
$ltitools{$itemid}{'order'} = $idx; |
|
if (ref($values) eq 'HASH') { |
|
if (ref($values->{$itemid}) eq 'HASH') { |
|
if ($values->{$itemid}{'order'} ne $idx) { |
|
$haschanges{$itemid} = 1; |
|
} |
|
} |
|
} |
|
$idx ++; |
|
} |
|
} |
|
} |
|
if (keys(%haschanges)) { |
|
foreach my $entry (keys(%haschanges)) { |
|
$changes->{$entry} = $ltitools{$entry}; |
|
} |
|
if (ref($lastactref) eq 'HASH') { |
|
$lastactref->{'courseltitools'} = 1; |
|
} |
|
} |
|
return $errors; |
|
} |
|
|
|
sub process_ltitools_image { |
|
my ($r,$context,$dom,$cnum,$confname,$caller,$itemid,$configuserok,$switch,$author_ok,$currimg) = @_; |
|
my $filename = $env{'form.'.$caller.'.filename'}; |
|
my ($error,$url); |
|
my ($width,$height) = (21,21); |
|
if ($configuserok eq 'ok') { |
|
if ($switch) { |
|
$error = &mt('Upload of Tool Provider (LTI) icon is not permitted to this server: [_1]', |
|
$switch); |
|
} elsif ($author_ok eq 'ok') { |
|
my ($result,$imageurl,$madethumb); |
|
if ($context eq 'domain') { |
|
($result,$imageurl,$madethumb) = |
|
&Apache::lonconfigsettings::publishlogo($r,'upload',$caller,$dom,$confname, |
|
"ltitools/$itemid/icon",$width,$height); |
|
} else { |
|
($result,$imageurl,$madethumb) = &processlogo($dom,$cnum,$caller,$currimg,$itemid,$width,$height); |
|
} |
|
if ($result eq 'ok') { |
|
if ($madethumb) { |
|
my ($path,$imagefile) = ($imageurl =~ m{^(.+)/([^/]+)$}); |
|
my $imagethumb = "$path/tn-".$imagefile; |
|
$url = $imagethumb; |
|
} else { |
|
$url = $imageurl; |
|
} |
|
} else { |
|
if ($context eq 'domain') { |
|
$error = &mt("Upload of [_1] failed because an error occurred publishing the file in RES space. Error was: [_2].",$filename,$result); |
|
} else { |
|
$error = &mt("Upload of [_1] failed because an error occurred. Error was: [_2].",$filename,$result); |
|
} |
|
} |
|
} else { |
|
$error = &mt("Upload of [_1] failed because an author role could not be assigned to a Domain Configuration user ([_2]) in domain: [_3]. Error was: [_4].",$filename,$confname,$dom,$author_ok); |
|
} |
|
} else { |
|
$error = &mt("Upload of [_1] failed because a Domain Configuration user ([_2]) could not be created in domain: [_3]. Error was: [_4].",$filename,$confname,$dom,$configuserok); |
|
} |
|
return ($url,$error); |
|
} |
|
|
|
sub processlogo { |
|
my ($dom,$cnum,$caller,$currimg,$itemid,$width,$height) = @_; |
|
my ($result,$imageurl,$madethumb); |
|
if ($env{"form.$caller.filename"} ne '') { |
|
unless ($caller eq 'ltitools_add_image') { |
|
if ($currimg =~ m{^(\Q/uploaded/$dom/$cnum/toollogo/$itemid\E)/([^/]+)$}) { |
|
my ($path,$imagefile) = ($1,$2); |
|
if ($imagefile =~ /^tn\-(.+)$/) { |
|
my $origimg = $1; |
|
&Apache::lonnet::removeuploadedurl("$path/$origimg"); |
|
} |
|
&Apache::lonnet::removeuploadedurl($currimg); |
|
} |
|
} |
|
$imageurl = &Apache::lonnet::userfileupload($caller,'toollogo',"toollogo/$itemid", |
|
'','','',$cnum,$dom,$width,$height); |
|
if ($imageurl =~ m{^(\Q/uploaded/$dom/$cnum/toollogo/$itemid\E)/([^/]+)$}) { |
|
my ($path,$imagefile) = ($1,$2); |
|
$result = 'ok'; |
|
my $thumburl = "$path/tn-".$imagefile; |
|
my ($rtncode,$info); |
|
my $res = &Apache::lonnet::getuploaded('HEAD',$thumburl,$dom,$cnum,\$info,\$rtncode); |
|
if ($res eq 'ok') { |
|
$madethumb = 1; |
|
} |
|
} elsif ($imageurl eq '/adm/notfound.html') { |
|
undef($imageurl); |
|
$result = 'store failed'; |
|
} elsif ($imageurl =~ /^error: (.+)$/) { |
|
$result = $1; |
|
} |
|
} |
|
return ($result,$imageurl,$madethumb); |
|
} |
|
|
|
sub get_sec_str { |
sub get_sec_str { |
my ($entry,$num) = @_; |
my ($entry,$num) = @_; |
my @secs = &Apache::loncommon::get_env_multiple('form.'.$entry.'_sections_'.$num); |
my @secs = &Apache::loncommon::get_env_multiple('form.'.$entry.'_sections_'.$num); |
Line 2465 sub check_clone {
|
Line 1787 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,%oldlinkprot,%oldltitools); |
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->{'linkprot'}) eq 'HASH') { |
if (ref($values->{'linkprot'}) eq 'HASH') { |
%oldlinkprot = %{$values->{'linkprot'}}; |
%oldlinkprot = %{$values->{'linkprot'}}; |
} |
} |
delete($values->{'linkprot'}); |
delete($values->{'linkprot'}); |
if (ref($values->{'ltitools'}) eq 'HASH') { |
|
%oldltitools = %{$values->{'ltitools'}}; |
|
} |
|
%storehash = %{$values}; |
%storehash = %{$values}; |
} else { |
} else { |
if ($crstype eq 'Community') { |
if ($crstype eq 'Community') { |
Line 2488 sub store_changes {
|
Line 1807 sub store_changes {
|
$numchanges = scalar(keys(%{$changes})); |
$numchanges = scalar(keys(%{$changes})); |
if (($numchanges == 1) && (exists($changes->{'linkprot'}))) { |
if (($numchanges == 1) && (exists($changes->{'linkprot'}))) { |
$skipstore = 1; |
$skipstore = 1; |
} elsif (($numchanges == 1) && (exists($changes->{'ltitools'}))) { |
|
$skipstore = 1; |
|
} elsif (!$numchanges) { |
} elsif (!$numchanges) { |
if ($crstype eq 'Community') { |
if ($crstype eq 'Community') { |
$output = &mt('No changes made to community settings.'); |
$output = &mt('No changes made to community settings.'); |
Line 2526 sub store_changes {
|
Line 1843 sub store_changes {
|
} |
} |
} elsif ($item eq 'linkprot') { |
} elsif ($item eq 'linkprot') { |
$output .= &store_linkprot($cdom,$cnum,'course',$changes->{$item},\%oldlinkprot); |
$output .= &store_linkprot($cdom,$cnum,'course',$changes->{$item},\%oldlinkprot); |
} elsif ($item eq 'ltitools') { |
|
$output .= &store_ltitools($cdom,$cnum,'course',$changes->{$item},\%oldltitools); |
|
} 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 2559 sub store_changes {
|
Line 1874 sub store_changes {
|
if ($msg ne '') { |
if ($msg ne '') { |
$output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt($displayname)).'<ul class="LC_success">'.$msg.'</ul></li>'; |
$output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt($displayname)).'<ul class="LC_success">'.$msg.'</ul></li>'; |
} |
} |
} elsif ($key eq 'timezone') { |
|
next unless ((exists($changes->{$item}{$key})) || (exists($changes->{$item}{'tzover'}))); |
|
my ($displayname,$text); |
|
$text = $prefs->{$item}->{'itemtext'}{$key}; |
|
my $displayval; |
|
if (exists($changes->{$item}{$key})) { |
|
$displayname = &mt($text); |
|
$storehash{$key} = $changes->{$item}{$key}; |
|
if ($changes->{$item}{$key} ne '') { |
|
$displayval = '<b>'.$changes->{$item}{$key}.'</b>'; |
|
} else { |
|
push(@delkeys,$key); |
|
if (exists($values->{'tzover'})) { |
|
push(@delkeys,'tzover'); |
|
} |
|
$output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt('Deleted setting for [_1]', |
|
'<i>'.$displayname.'</i>')).'</li>'; |
|
} |
|
} |
|
unless (grep(/^\Q$key\E$/,@delkeys)) { |
|
if (exists($changes->{$item}{'tzover'})) { |
|
$storehash{'tzover'} = $changes->{$item}{'tzover'}; |
|
my $tzovertext; |
|
if ($changes->{$item}{'tzover'} ne '') { |
|
$tzovertext = &mt('Course Time Zone overrides individual user preference'); |
|
} else { |
|
push(@delkeys,'tzover'); |
|
$tzovertext = &mt('Course Time Zone does not override individual user preference'); |
|
} |
|
if ($displayval eq '') { |
|
$output .= '<li>'.&Apache::lonhtmlcommon::confirm_success($tzovertext).'</li>'; |
|
} else { |
|
$displayval .= '<br />'.(' 'x5).$tzovertext; |
|
} |
|
} |
|
if ($displayval ne '') { |
|
$output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt('[_1] set to [_2]', |
|
'<i>'.$displayname.'</i>',$displayval)).'</li>'; |
|
} |
|
} |
|
} else { |
} else { |
next if (!exists($changes->{$item}{$key})); |
next if (!exists($changes->{$item}{$key})); |
my ($displayname,$text); |
my ($displayname,$text); |
$text = $prefs->{$item}->{'itemtext'}{$key}; |
$text = $prefs->{$item}->{'itemtext'}{$key}; |
my $displayval; |
my $displayval; |
unless (($key eq 'co-owners') || ($key eq 'discussion_post_fonts') || ($key eq 'extresource')) { |
unless (($key eq 'co-owners') || ($key eq 'discussion_post_fonts')) { |
$displayval = $changes->{$item}{$key}; |
$displayval = $changes->{$item}{$key}; |
} |
} |
if (($item eq 'grading') && ($key eq 'grading')) { |
|
if ($displayval eq 'standard') { |
|
my $hidetotals; |
|
if (exists($changes->{$item}{'hidetotals'})) { |
|
if ($changes->{$item}{'hidetotals'} eq '') { |
|
if (exists($values->{'hidetotals'})) { |
|
push(@delkeys,'hidetotals'); |
|
} |
|
} else { |
|
$hidetotals = $changes->{$item}{'hidetotals'}; |
|
} |
|
} elsif (exists($values->{'hidetotals'})) { |
|
$hidetotals = $values->{'hidetotals'}; |
|
} |
|
if ($hidetotals eq '') { |
|
$displayval = &mt('standard with "hide course totals" set to "No"'); |
|
if (exists($values->{'hidetotals'})) { |
|
push(@delkeys,'hidetotals'); |
|
} |
|
} elsif ($hidetotals =~ /^([\w,]+)$/) { |
|
my $secstr = $1; |
|
my @secs = split(/,/,$secstr); |
|
if (grep(/^all$/,@secs)) { |
|
$displayval = &mt('standard with "hide course totals" set to "Yes" for all users'); |
|
$hidetotals = 'all'; |
|
} else { |
|
$displayval = &mt('standard with "hide course totals" set to "Yes" for users in section(s): [_1]',join(', ',@secs)); |
|
} |
|
$storehash{'hidetotals'} = $hidetotals; |
|
} |
|
} elsif (exists($values->{'hidetotals'})) { |
|
push(@delkeys,'hidetotals'); |
|
} |
|
} |
|
if ($item eq 'feedback') { |
if ($item eq 'feedback') { |
if ($key =~ /^(question|policy|comment)(\.email)\.text$/) { |
if ($key =~ /^(question|policy|comment)(\.email)\.text$/) { |
$text = $prefs->{$item}->{'itemtext'}{$1.$2}; |
$text = $prefs->{$item}->{'itemtext'}{$1.$2}; |
Line 2718 sub store_changes {
|
Line 1959 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') { |
} elsif ($item eq 'menuitems') { |
unless ($changes->{$item}{$key} eq '') { |
unless ($changes->{$item}{$key} eq '') { |
if ($key eq 'menudefault') { |
if ($key eq 'menudefault') { |
Line 2747 sub store_changes {
|
Line 2004 sub store_changes {
|
} elsif ($changes->{$item}{$key} eq '0') { |
} elsif ($changes->{$item}{$key} eq '0') { |
$displayval = &mt('No'); |
$displayval = &mt('No'); |
} |
} |
} elsif ($key eq 'extresource') { |
|
if ($changes->{$item}{$key} eq 'iframe') { |
|
$displayval = &mt('In iframe'); |
|
} else { |
|
my ($selected,$reuse,$width,$height) = split(/:/,$changes->{$item}{$key}); |
|
if ($selected eq 'tab') { |
|
if ($reuse) { |
|
$displayval = &mt('[_1]In tab[_2],[_3] and tab re-used for different external resources in course', |
|
"'<b>","</b>'",'<br />'); |
|
} else { |
|
$displayval = &mt('[_1]In tab[_2],[_3] with new tab for each external resource in course', |
|
"'<b>","</b>'",'<br />'); |
|
} |
|
} elsif ($selected eq 'window') { |
|
if ($reuse) { |
|
$displayval = &mt('[_1]In pop-up window[_2],[_3] and window re-used for different external resources in course', |
|
"'<b>","</b>'",'<br />'); |
|
} else { |
|
$displayval = &mt('[_1]In pop-up window[_2],[_3] with new window for each external resource in course', |
|
"'<b>","</b>'",'<br />'); |
|
} |
|
if (($width ne '') || ($height ne '')) { |
|
if ($width ne '') { |
|
$displayval .= '<br />'.&mt('Window width: [_1]px',$width); |
|
} |
|
if ($height ne '') { |
|
$displayval .= '<br />'.&mt('Window height: [_1]px',$height); |
|
} |
|
} |
|
} |
|
} |
|
} |
} |
if ($key eq 'co-owners') { |
if ($key eq 'co-owners') { |
if (ref($changes->{$item}{$key}) eq 'HASH') { |
if (ref($changes->{$item}{$key}) eq 'HASH') { |
Line 2822 sub store_changes {
|
Line 2048 sub store_changes {
|
} |
} |
} elsif ($changes->{$item}{$key} eq '') { |
} elsif ($changes->{$item}{$key} eq '') { |
push(@delkeys,$key); |
push(@delkeys,$key); |
if ($item eq 'menuitems') { |
if ($item eq 'lti') { |
|
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') { |
if ($key eq 'menudefault') { |
$output .= '<li>'.&mt("Default collection of menu items set to: 'Standard' (all menus shown)").'</li>'; |
$output .= '<li>'.&mt("Default collection of menu items set to: 'Standard' (all menus shown)").'</li>'; |
} elsif ($key eq 'menucollections') { |
} elsif ($key eq 'menucollections') { |
Line 2836 sub store_changes {
|
Line 2075 sub store_changes {
|
$output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt('Numbered menu collections:')).'<br />'. |
$output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt('Numbered menu collections:')).'<br />'. |
$displayval.'</li>'; |
$displayval.'</li>'; |
} else { |
} else { |
unless (($key eq 'extresource') && ($changes->{$item}{$key} ne 'iframe')) { |
|
$displayval = "'<b>$displayval</b>'"; |
|
} |
|
$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>',$displayval)); |
'<i>'.$displayname.'</i>', |
|
"'<b>$displayval</b>'")); |
if ($key eq 'url') { |
if ($key eq 'url') { |
my $bkuptime=time; |
my $bkuptime=time; |
$output .= (' 'x2).&mt('(Previous URL backed up)').': '. |
$output .= (' 'x2).&mt('(Previous URL backed up)').': '. |
Line 2875 sub store_changes {
|
Line 2112 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 2966 sub store_linkprot {
|
Line 2205 sub store_linkprot {
|
if (exists($oldlinkprot->{$id}{'usable'})) { |
if (exists($oldlinkprot->{$id}{'usable'})) { |
$changes->{$id}->{'usable'} = 1; |
$changes->{$id}->{'usable'} = 1; |
} |
} |
if (exists($oldlinkprot->{$id}{'cipher'})) { |
|
$changes->{$id}->{'cipher'} = $oldlinkprot->{$id}{'cipher'}; |
|
} |
|
} |
} |
} |
} |
} |
} |
Line 3019 sub store_linkprot {
|
Line 2255 sub store_linkprot {
|
my %values = %{$changes->{$id}}; |
my %values = %{$changes->{$id}}; |
my %desc = &linkprot_names(); |
my %desc = &linkprot_names(); |
my $display; |
my $display; |
foreach my $title ('name','lifetime','version','key','secret','returnurl','passbackformat') { |
foreach my $title ('name','lifetime','version','key','secret') { |
if (($title eq 'key') || ($title eq 'secret')) { |
if (($title eq 'key') || ($title eq 'secret')) { |
if (ref($ltienc{$id}) eq 'HASH') { |
if (ref($ltienc{$id}) eq 'HASH') { |
if (exists($ltienc{$id}{$title})) { |
if (exists($ltienc{$id}{$title})) { |
Line 3035 sub store_linkprot {
|
Line 2271 sub store_linkprot {
|
if ($values{$title} eq 'LTI-1p0') { |
if ($values{$title} eq 'LTI-1p0') { |
$display .= $desc{$title}.': 1.1, '; |
$display .= $desc{$title}.': 1.1, '; |
} |
} |
} elsif ($title eq 'returnurl') { |
|
if ($values{$title}) { |
|
$display .= &mt('Return URL parameter').': '.$values{$title}.', '; |
|
} |
|
} elsif ($title eq 'passbackformat') { |
|
if ($values{$title} eq '1.0') { |
|
$display .= &mt('Can return grades to Launcher with Outcomes Service 1.0 format').', '; |
|
} elsif ($values{$title} eq '1.1') { |
|
$display .= &mt('Can return grades to Launcher with Outcomes Service 1.1 format').', '; |
|
} |
|
} else { |
} else { |
$display .= $desc{$title}.': '.$values{$title}.', '; |
$display .= $desc{$title}.': '.$values{$title}.', '; |
} |
} |
Line 3101 sub store_linkprot {
|
Line 2327 sub store_linkprot {
|
return $output; |
return $output; |
} |
} |
|
|
sub store_ltitools { |
|
my ($cdom,$cnum,$context,$changes,$oldltitools) = @_; |
|
my ($home,$ltitools_save_error,$output,$error,%toolsenc,@deletions); |
|
my %lt = <itools_names(); |
|
my @courseroles = ('cc','in','ta','ep','st'); |
|
my @allfields = ('fullname','firstname','lastname','email','user','roles'); |
|
if ($context eq 'domain') { |
|
$home = &Apache::lonnet::domain($cdom,'primary'); |
|
} else { |
|
$home = &Apache::lonnet::homeserver($cnum,$cdom); |
|
} |
|
if (ref($changes) eq 'HASH') { |
|
foreach my $id (sort { $a <=> $b } keys(%{$changes})) { |
|
if (ref($changes->{$id}) eq 'HASH') { |
|
if (exists($changes->{$id}->{'key'})) { |
|
$toolsenc{$id}{'key'} = $changes->{$id}->{'key'}; |
|
delete($changes->{$id}->{'key'}); |
|
} |
|
if (exists($changes->{$id}->{'secret'})) { |
|
$toolsenc{$id}{'secret'} = $changes->{$id}->{'secret'}; |
|
delete($changes->{$id}->{'secret'}); |
|
} elsif (ref($oldltitools->{$id}) eq 'HASH') { |
|
if (exists($oldltitools->{$id}{'usable'})) { |
|
$changes->{$id}->{'usable'} = 1; |
|
} |
|
if (exists($oldltitools->{$id}{'cipher'})) { |
|
$changes->{$id}->{'cipher'} = $oldltitools->{$id}{'cipher'}; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
my @ids=&Apache::lonnet::current_machine_ids(); |
|
if (keys(%toolsenc) > 0) { |
|
unless (($home eq 'no_host') || ($home eq '')) { |
|
my $allowed; |
|
foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } } |
|
if ($allowed) { |
|
if (($context eq 'domain') || |
|
(($context eq 'course') && |
|
(&Apache::lonnet::put('nohist_toolsenc',\%toolsenc,$cdom,$cnum,1) eq 'ok'))) { |
|
foreach my $id (keys(%toolsenc)) { |
|
if (exists($toolsenc{$id}{'secret'})) { |
|
$changes->{$id}->{'usable'} = 1; |
|
} |
|
} |
|
} else { |
|
$ltitools_save_error = 1; |
|
} |
|
} |
|
} |
|
} |
|
unless ($ltitools_save_error) { |
|
if ($context eq 'course') { |
|
if (&Apache::lonnet::put('ltitools',$changes,$cdom,$cnum,1) eq 'ok') { |
|
my $hashid=$cdom.'_'.$cnum; |
|
&Apache::lonnet::devalidate_cache_new('courseltitools',$hashid); |
|
unless (($home eq 'no_host') || ($home eq '')) { |
|
if (grep(/^\Q$home\E$/,@ids)) { |
|
&Apache::lonnet::devalidate_cache_new('crsltitoolsenc',$hashid); |
|
} |
|
} |
|
} else { |
|
$ltitools_save_error = 1; |
|
} |
|
} |
|
unless ($ltitools_save_error) { |
|
my %bynum; |
|
foreach my $itemid (sort(keys(%{$changes}))) { |
|
my $position = $changes->{$itemid}{'order'}; |
|
$bynum{$position} = $itemid; |
|
} |
|
foreach my $pos (sort { $a <=> $b } keys(%bynum)) { |
|
my $itemid = $bynum{$pos}; |
|
if (ref($changes->{$itemid}) ne 'HASH') { |
|
$output .= '<li>'.&mt('Deleted: [_1]',$changes->{$itemid}).'</li>'; |
|
} else { |
|
$output .= '<li><b>'.$changes->{$itemid}{'title'}.'</b>'; |
|
if ($changes->{$itemid}{'image'}) { |
|
$output .= ' '. |
|
'<img src="'.$changes->{$itemid}{'image'}.'"'. |
|
' alt="'.&mt('Tool Provider icon').'" />'; |
|
} |
|
$output .= '</li><ul>'; |
|
my $position = $pos + 1; |
|
$output .= '<li>'.&mt('Order: [_1]',$position).'</li>'; |
|
foreach my $item ('version','msgtype','sigmethod','url','lifetime') { |
|
if ($changes->{$itemid}{$item} ne '') { |
|
$output .= '<li>'.$lt{$item}.': '.$changes->{$itemid}{$item}.'</li>'; |
|
} |
|
} |
|
if (ref($toolsenc{$itemid}) eq 'HASH') { |
|
foreach my $item ('key','secret') { |
|
if (exists($toolsenc{$itemid}{$item})) { |
|
if ($item eq 'secret') { |
|
$output .= '<li>'.$lt{$item}.': ['.&mt('not shown').']</li>'; |
|
} else { |
|
$output .= '<li>'.$lt{$item}.': '.$toolsenc{$itemid}{$item}.'</li>'; |
|
} |
|
} |
|
} |
|
} |
|
$output .= '<li>'.&mt('Configurable in course:'); |
|
my @possconfig = ('label','title','target','linktext','explanation','append'); |
|
my $numconfig = 0; |
|
if (ref($changes->{$itemid}{'crsconf'}) eq 'HASH') { |
|
foreach my $item (@possconfig) { |
|
if ($changes->{$itemid}{'crsconf'}{$item}) { |
|
$numconfig ++; |
|
$output .= ' "'.$lt{'crs'.$item}.'"'; |
|
} |
|
} |
|
} |
|
if (!$numconfig) { |
|
$output .= ' '.&mt('None'); |
|
} |
|
$output .= '</li>'; |
|
foreach my $item ('passback','roster') { |
|
$output .= '<li>'.$lt{$item}.' '; |
|
if ($changes->{$itemid}{$item}) { |
|
$output .= &mt('Yes'); |
|
if ($changes->{$itemid}{$item.'valid'}) { |
|
if ($item eq 'passback') { |
|
$output .= ' '.&mt('valid for at least [quant,_1,day] after launch', |
|
$changes->{$itemid}{$item.'valid'}); |
|
} else { |
|
$output .= ' '.&mt('valid for at least [quant,_1,second] after launch', |
|
$changes->{$itemid}{$item.'valid'}); |
|
} |
|
} |
|
} else { |
|
$output .= &mt('No'); |
|
} |
|
$output .= '</li>'; |
|
} |
|
if (ref($changes->{$itemid}{'display'}) eq 'HASH') { |
|
my $displaylist; |
|
if ($changes->{$itemid}{'display'}{'target'}) { |
|
$displaylist = &mt('Display target').': '. |
|
$changes->{$itemid}{'display'}{'target'}.','; |
|
} |
|
foreach my $size ('width','height') { |
|
if ($changes->{$itemid}{'display'}{$size}) { |
|
$displaylist .= (' 'x2).$lt{$size}.': '. |
|
$changes->{$itemid}{'display'}{$size}.','; |
|
} |
|
} |
|
if ($displaylist) { |
|
$displaylist =~ s/,$//; |
|
$output .= '<li>'.$displaylist.'</li>'; |
|
} |
|
foreach my $item ('linktext','explanation') { |
|
if ($changes->{$itemid}{'display'}{$item}) { |
|
$output .= '<li>'.$lt{$item}.': '.$changes->{$itemid}{'display'}{$item}.'</li>'; |
|
} |
|
} |
|
} |
|
if (ref($changes->{$itemid}{'fields'}) eq 'HASH') { |
|
my $fieldlist; |
|
foreach my $field (@allfields) { |
|
if ($changes->{$itemid}{'fields'}{$field}) { |
|
$fieldlist .= (' 'x2).$lt{$field}.','; |
|
} |
|
} |
|
if ($fieldlist) { |
|
$fieldlist =~ s/,$//; |
|
if ($changes->{$itemid}{'fields'}{'user'}) { |
|
if ($changes->{$itemid}{'incdom'}) { |
|
$fieldlist .= ' ('.&mt('username:domain').')'; |
|
} else { |
|
$fieldlist .= ' ('.&mt('username').')'; |
|
} |
|
} |
|
$output .= '<li>'.&mt('Data sent').':'.$fieldlist.'</li>'; |
|
} |
|
} |
|
if (ref($changes->{$itemid}{'roles'}) eq 'HASH') { |
|
my $rolemaps; |
|
foreach my $role (@courseroles) { |
|
if ($changes->{$itemid}{'roles'}{$role}) { |
|
$rolemaps .= (' 'x2).&Apache::lonnet::plaintext($role,'Course').'='. |
|
$changes->{$itemid}{'roles'}{$role}.','; |
|
} |
|
} |
|
if ($rolemaps) { |
|
$rolemaps =~ s/,$//; |
|
$output .= '<li>'.&mt('Role mapping:').$rolemaps.'</li>'; |
|
} |
|
} |
|
if (ref($changes->{$itemid}{'custom'}) eq 'HASH') { |
|
my $customlist; |
|
if (keys(%{$changes->{$itemid}{'custom'}})) { |
|
foreach my $key (sort(keys(%{$changes->{$itemid}{'custom'}}))) { |
|
$customlist .= $key.':'.$changes->{$itemid}{'custom'}{$key}.(' 'x2); |
|
} |
|
} |
|
if ($customlist) { |
|
$output .= '<li>'.&mt('Custom items').': '.$customlist.'</li>'; |
|
} |
|
} |
|
$output .= '</ul></li>'; |
|
} |
|
} |
|
} |
|
} |
|
return $output; |
|
} |
|
|
|
sub update_env { |
sub update_env { |
my ($cnum,$cdom,$chome,$need_env_update,$storehash) = @_; |
my ($cnum,$cdom,$chome,$need_env_update,$storehash) = @_; |
my $count = 0; |
my $count = 0; |
Line 3334 sub update_env {
|
Line 2352 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 3439 sub get_course {
|
Line 2459 sub get_course {
|
sub get_jscript { |
sub get_jscript { |
my ($cid,$cdom,$phase,$crstype,$settings,$noedit) = @_; |
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,$extresource_js,$localization_js); |
my ($jscript,$categorize_js,$loncaparev_js,$instcode_js); |
my $stubrowse_js = &Apache::loncommon::studentbrowser_javascript(); |
my $stubrowse_js = &Apache::loncommon::studentbrowser_javascript(); |
my $browse_js = &Apache::loncommon::browser_and_searcher_javascript('parmset'); |
my $browse_js = &Apache::loncommon::browser_and_searcher_javascript('parmset'); |
my $cloners_js = &cloners_javascript($phase); |
my $cloners_js = &cloners_javascript($phase); |
my $currltitools; |
|
if (ref($settings) eq 'HASH') { |
|
$currltitools = $settings->{'ltitools'}; |
|
} |
|
my $ltitools_js = &Apache::lonconfigsettings::ltitools_javascript($currltitools); |
|
my @code_order; |
my @code_order; |
if ($crstype ne 'Community') { |
if ($crstype ne 'Community') { |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
Line 3467 sub get_jscript {
|
Line 2482 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 3568 function syllabusinfo() {
|
Line 2583 function syllabusinfo() {
|
} |
} |
} |
} |
ENDSCRIPT |
ENDSCRIPT |
my ($menuitems_js,$grading_js); |
my $menuitems_js; |
unless ($noedit) { |
unless ($noedit) { |
my $collections; |
my $collections; |
my $next = 1; |
my $next = 1; |
Line 3650 function toggleAddmenucoll() {
|
Line 2665 function toggleAddmenucoll() {
|
} |
} |
} |
} |
ENDSCRIPT |
ENDSCRIPT |
$grading_js = <<"ENDSCRIPT"; |
|
function toggleGrading(form) { |
|
if (document.getElementById('hidetotalsdiv')) { |
|
var totalsdivid = document.getElementById('hidetotalsdiv'); |
|
var selname = form.elements['grading']; |
|
if (selname) { |
|
var current = selname.options[selname.selectedIndex].value |
|
if (current == 'standard') { |
|
totalsdivid.style.display = 'inline-block'; |
|
} else { |
|
totalsdivid.style.display = 'none'; |
|
} |
|
} |
|
} |
} |
return; |
|
} |
|
|
|
function toggleHiddenTotalsSec(form) { |
|
if (document.getElementById('sectotalsdiv')) { |
|
var sectotalsdivid = document.getElementById('sectotalsdiv'); |
|
var radioname = form.elements['hidetotals']; |
|
if (radioname) { |
|
if (radioname.length > 0) { |
|
var setvis; |
|
for (var i=0; i<radioname.length; i++) { |
|
if (radioname[i].checked == true) { |
|
if (radioname[i].value == 1) { |
|
sectotalsdivid.style.display = 'inline-block'; |
|
setvis = 1; |
|
} |
|
break; |
|
} |
|
} |
|
if (!setvis) { |
|
sectotalsdivid.style.display = 'none'; |
|
} |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
ENDSCRIPT |
|
} |
|
$extresource_js = <<"ENDSCRIPT"; |
|
function toggleExtRes() { |
|
if (document.getElementById('LC_extresource')) { |
|
var extressel = document.getElementById('LC_extresource').value; |
|
if (document.getElementById('LC_extresreusediv')) { |
|
var extresreuse = document.getElementById('LC_extresreusediv'); |
|
if (document.getElementById('LC_extressize')) { |
|
var extressize = document.getElementById('LC_extressize'); |
|
var setvis; |
|
if ((extressel == 'tab') || (extressel == 'window')) { |
|
extresreuse.style.display = 'inline-block'; |
|
setvis = 1; |
|
if (extressel == 'window') { |
|
extressize.style.display = 'inline-block'; |
|
} else { |
|
extressize.style.display = 'none'; |
|
} |
|
} |
|
if (!setvis) { |
|
extresreuse.style.display = 'none'; |
|
extressize.style.display = 'none'; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
ENDSCRIPT |
|
$localization_js = <<"ENDSCRIPT"; |
|
function toggleTimeZone() { |
|
if (document.getElementById('LC_set_timezone')) { |
|
var timezonesel = document.getElementById('LC_set_timezone').value; |
|
if (document.getElementById('LC_tzoverdiv')) { |
|
var tzoverdiv = document.getElementById('LC_tzoverdiv'); |
|
if (timezonesel == '') { |
|
tzoverdiv.style.display = 'none'; |
|
} else { |
|
tzoverdiv.style.display = 'block'; |
|
} |
|
} |
|
} |
|
} |
|
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."\n".$localization_js."\n". |
$cloners_js."\n".$instcode_js. |
$syllabus_js."\n".$menuitems_js."\n".$extresource_js."\n". |
$syllabus_js."\n".$menuitems_js."\n". |
$grading_js."\n".&linkprot_javascript()."\n".'//]]>'."\n". |
&linkprot_javascript()."\n".'//]]>'."\n". |
'</script>'."\n".$stubrowse_js."\n".$ltitools_js."\n"; |
'</script>'."\n".$stubrowse_js."\n"; |
return $jscript; |
return $jscript; |
} |
} |
|
|
Line 3828 ENDSCRIPT
|
Line 2759 ENDSCRIPT
|
|
|
sub linkprot_javascript { |
sub linkprot_javascript { |
return <<"ENDSCRIPT"; |
return <<"ENDSCRIPT"; |
function toggleLinkProtExtra(form,item,extra,valon,styleon,num) { |
function toggleLinkProt(form,num,item) { |
|
var radioname = ''; |
|
var currdivid = ''; |
|
var newdivid = ''; |
|
if ((document.getElementById('linkprot_divcurr'+item+'_'+num)) && |
|
(document.getElementById('linkprot_divchg'+item+'_'+num))) { |
|
currdivid = document.getElementById('linkprot_divcurr'+item+'_'+num); |
|
newdivid = document.getElementById('linkprot_divchg'+item+'_'+num); |
|
radioname = form.elements['linkprot_change'+item+'_'+num]; |
|
if (radioname) { |
|
if (radioname.length > 0) { |
|
var setvis; |
|
for (var i=0; i<radioname.length; i++) { |
|
if (radioname[i].checked == true) { |
|
if (radioname[i].value == 1) { |
|
newdivid.style.display = 'inline-block'; |
|
currdivid.style.display = 'none'; |
|
setvis = 1; |
|
} |
|
break; |
|
} |
|
} |
|
if (!setvis) { |
|
newdivid.style.display = 'none'; |
|
currdivid.style.display = 'inline-block'; |
|
} |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
|
|
function toggleLinkProtReqUser(form,item,extra,valon,styleon,num) { |
if (document.getElementById('linkprot_'+extra+'_'+num)) { |
if (document.getElementById('linkprot_'+extra+'_'+num)) { |
var extraid = document.getElementById('linkprot_'+extra+'_'+num); |
var extraid = document.getElementById('linkprot_'+extra+'_'+num); |
var itemname = form.elements['linkprot_'+item+'_'+num]; |
var itemname = form.elements['linkprot_'+item+'_'+num]; |
Line 3852 function toggleLinkProtExtra(form,item,e
|
Line 2815 function toggleLinkProtExtra(form,item,e
|
} |
} |
return; |
return; |
} |
} |
|
|
ENDSCRIPT |
ENDSCRIPT |
|
|
} |
} |
|
|
|
|
sub print_courseinfo { |
sub print_courseinfo { |
my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$crstype,$noedit) = @_; |
my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$crstype,$noedit) = @_; |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) { |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) { |
Line 3950 sub print_courseinfo {
|
Line 2913 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 4031 sub print_courseinfo {
|
Line 2994 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 4214 sub print_courseinfo {
|
Line 3177 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 4266 sub print_courseinfo {
|
Line 3229 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 4296 sub new_cloners_dom_row {
|
Line 3259 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 4447 ENDSCRIPT
|
Line 3410 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 4464 sub display_loncaparev_constraints {
|
Line 3427 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 4673 sub display_loncaparev_constraints {
|
Line 3680 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 4691 sub display_loncaparev_constraints {
|
Line 3698 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 4753 sub display_loncaparev_constraints {
|
Line 3767 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 4790 sub display_loncaparev_constraints {
|
Line 3804 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 4804 sub display_loncaparev_constraints {
|
Line 3822 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 4824 sub display_loncaparev_constraints {
|
Line 3842 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 4890 sub show_contents_view {
|
Line 3916 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 4954 sub show_contents_view {
|
Line 3983 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 4966 sub show_contents_view {
|
Line 4022 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 5003 sub releases_by_map {
|
Line 4059 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; |
|
} |
} |
} |
foreach my $possibilities (@{$paramstrings}) { |
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 (@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 5209 sub print_localization {
|
Line 4314 sub print_localization {
|
if ($item eq 'timezone') { |
if ($item eq 'timezone') { |
my $includeempty = 1; |
my $includeempty = 1; |
my $timezone = &Apache::lonlocal::gettimezone(); |
my $timezone = &Apache::lonlocal::gettimezone(); |
my $onchange; |
|
unless ($noedit) { |
|
$onchange = ' onchange="javascript:toggleTimeZone();"'; |
|
} |
|
my $id = ' id="LC_set_timezone"'; |
|
$datatable .= |
$datatable .= |
&Apache::loncommon::select_timezone($item,$timezone,$onchange, |
&Apache::loncommon::select_timezone($item,$timezone,undef, |
$includeempty,$id,$disabled); |
$includeempty,$disabled); |
my $tzsty = 'none'; |
|
if ($timezone ne '') { |
|
$tzsty = 'block'; |
|
} |
|
$datatable .= '<div id="LC_tzoverdiv" style="display:'.$tzsty.';">'. |
|
'<span class="LC_nobreak">'. |
|
&mt('Override individual user preference?'). |
|
&yesno_radio('tzover',$settings,undef,1,'',$noedit). |
|
'</span></div>'; |
|
} elsif ($item eq 'datelocale') { |
} elsif ($item eq 'datelocale') { |
my $includeempty = 1; |
my $includeempty = 1; |
my $locale_obj = &Apache::lonlocal::getdatelocale(); |
my $locale_obj = &Apache::lonlocal::getdatelocale(); |
Line 5238 sub print_localization {
|
Line 4329 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 5275 sub print_localization {
|
Line 4366 sub print_localization {
|
&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 5450 sub select_recipient {
|
Line 4541 sub select_recipient {
|
} |
} |
|
|
sub select_sections { |
sub select_sections { |
my ($item,$num,$sections,$selected,$noedit,$allval) = @_; |
my ($item,$num,$sections,$selected,$noedit) = @_; |
my ($output,@currsecs,$allsec,$disabled); |
my ($output,@currsecs,$allsec,$disabled); |
if (ref($selected) eq 'ARRAY') { |
if (ref($selected) eq 'ARRAY') { |
@currsecs = @{$selected}; |
@currsecs = @{$selected}; |
Line 5466 sub select_sections {
|
Line 4557 sub select_sections {
|
my $mult; |
my $mult; |
if (@{$sections} > 1) { |
if (@{$sections} > 1) { |
$mult = ' multiple="multiple"'; |
$mult = ' multiple="multiple"'; |
my $size; |
|
if (@{$sections} > 3) { |
if (@{$sections} > 3) { |
$size = 4; |
$mult .= ' size="4"'; |
} else { |
|
$size = 1 + scalar(@{$sections}); |
|
} |
} |
$mult .= ' size="'.$size.'"'; |
|
} |
} |
my $name = $item.'_sections'; |
$output = '<select name="'.$item.'_sections_'.$num.'"'.$mult.$disabled.'>'. |
unless ($item eq 'hidetotals') { |
' <option value=""'.$allsec.'>'.&mt('All').'</option>'; |
$name .= '_'.$num; |
|
} |
|
$output = '<select name="'.$name.'"'.$mult.$disabled.'>'. |
|
' <option value="'.$allval.'"'.$allsec.'>'.&mt('All').'</option>'; |
|
foreach my $sec (@{$sections}) { |
foreach my $sec (@{$sections}) { |
my $is_sel; |
my $is_sel; |
if ((@currsecs) && (grep(/^\Q$sec\E$/,@currsecs))) { |
if ((@currsecs) && (grep(/^\Q$sec\E$/,@currsecs))) { |
$is_sel = ' selected="selected"'; |
$is_sel = 'selected="selected"'; |
} |
} |
$output .= '<option value="'.$sec.'"'.$is_sel.'>'.$sec.'</option>'; |
$output .= '<option value="'.$sec.'"'.$is_sel.'>'.$sec.'</option>'; |
} |
} |
Line 5524 sub print_discussion {
|
Line 4607 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 5556 sub print_discussion {
|
Line 4653 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 5574 sub print_discussion {
|
Line 4671 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 5593 sub print_discussion {
|
Line 4698 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 5645 sub role_checkboxes {
|
Line 4750 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 5773 sub set_discussion_fonts {
|
Line 4878 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 5839 sub print_classlists {
|
Line 4944 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 5930 sub print_appearance {
|
Line 5035 sub print_appearance {
|
text => '<b>'.&mt($itemtext->{'inline_chem'}).'</b>', |
text => '<b>'.&mt($itemtext->{'inline_chem'}).'</b>', |
input => 'radio', |
input => 'radio', |
}, |
}, |
'extresource' => { |
|
text => '<b>'.&mt($itemtext->{'extresource'}).'</b>', |
|
input => 'selectbox', |
|
options => { |
|
iframe => 'In iframe', |
|
tab => 'In new tab', |
|
window => 'In pop-up window', |
|
}, |
|
order => ['iframe','tab','window'], |
|
}, |
|
); |
); |
return &make_item_rows($cdom,\%items,$ordered,$settings,$rowtotal,$crstype,'appearance',$noedit); |
return &make_item_rows($cdom,\%items,$ordered,$settings,$rowtotal,$crstype,'appearance',$noedit); |
} |
} |
|
|
sub print_grading { |
sub print_grading { |
my ($cdom,$cnum,$settings,$ordered,$itemtext,$rowtotal,$crstype,$noedit) = @_; |
my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$crstype,$noedit) = @_; |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) { |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) { |
return; |
return; |
} |
} |
Line 5956 sub print_grading {
|
Line 5051 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>'. |
'<br /><span class="LC_warning LC_nobreak">'.'<br />'. |
'<span class="LC_warning">'.'<br />'. |
&mt('Modifying this will make problems have different numbers and answers!'). |
&mt('Modifying this will make problems have different numbers and answers!'). |
'</span>', |
'</span>', |
input => 'selectbox', |
input => 'selectbox', |
Line 5996 sub print_grading {
|
Line 5092 sub print_grading {
|
input => 'radio', |
input => 'radio', |
}, |
}, |
); |
); |
return &make_item_rows($cdom,\%items,$ordered,$settings,$rowtotal,$crstype,'grading',$noedit,$cnum); |
return &make_item_rows($cdom,\%items,$ordered,$settings,$rowtotal,$crstype,'grading',$noedit); |
} |
} |
|
|
sub print_printouts { |
sub print_printouts { |
Line 6130 sub print_bridgetasks {
|
Line 5226 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_ltitools { |
sub print_lti { |
my ($cdom,$cnum,$settings,$rowtotal,$crstype,$noedit,$context) = @_; |
my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$crstype,$noedit) = @_; |
my ($datatable,$disabled,$css_class,$dest); |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) { |
if ($noedit) { |
return; |
$disabled = ' disabled="disabled"'; |
|
} |
} |
my $itemcount = 1; |
my @menuitems = ('fullname','coursetitle','role','logout','grades'); |
unless ($context eq 'domain') { |
my %menutitles = <imenu_titles(); |
my %tooltypes = &Apache::loncommon::usable_exttools(); |
my ($domdefs,$displaydefs); |
unless ($tooltypes{'crs'}) { |
if ($env{'request.lti.login'}) { |
my $showtype = 'course'; |
my %lti = &Apache::lonnet::get_domain_lti($cdom,'provider'); |
if ($crstype eq 'Community') { |
my @domdefsmenu; |
$showtype = lc($crstype); |
if (ref($lti{$env{'request.lti.login'}}) eq 'HASH') { |
} |
if ($lti{$env{'request.lti.login'}}{'topmenu'}) { |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$domdefs = &mt('Header shown').', '; |
$datatable = '<tr '.$css_class.'><td colspan="2">'. |
} |
&mt("Definition of external tools is not enabled for this $showtype.").'<br />'; |
if ($lti{$env{'request.lti.login'}}{'inlinemenu'}) { |
if ($tooltypes{'dom'}) { |
$domdefs .= &mt('Inline menu shown'); |
$datatable .= &mt("Contact an administrator for the $showtype domain ([_1]) to request this feature be enabled.", |
} |
'<i>'.$cdom.'</i>'). |
$domdefs =~ s/,\s$//; |
'<br /><br />'. |
if (!$domdefs) { |
&mt("Use of external tools defined at a domain level is enabled, so the $showtype editor can be used to add tool(s), if any have been defined."); |
$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 { |
} else { |
$datatable .= &mt("Use of external tools defined at a domain level is not enabled, either, for this $showtype."). |
$displaydefs .= ': '.&mt('All shown'); |
'<br /><br />'. |
} |
&mt("Contact an administrator for the $showtype domain ([_1]) to request changes.", |
} else { |
'<i>'.$cdom.'</i>'); |
$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'}}; |
} |
} |
$datatable .= '</tr>'; |
|
$itemcount ++; |
|
return $datatable; |
|
} |
} |
} |
} |
my %lt = <itools_names(); |
|
my $maxnum = 0; |
|
my %ordered; |
|
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
foreach my $item (keys(%{$settings})) { |
if ($settings->{'lti.lcmenu'}) { |
if (ref($settings->{$item}) eq 'HASH') { |
unless ($settings->{'lti.lcmenu'} eq 'none') { |
my $num = $settings->{$item}{'order'}; |
@current = split(',',$settings->{'lti.lcmenu'}); |
$ordered{$num} = $item; |
|
} |
} |
|
} else { |
|
@current = @domdefs; |
} |
} |
} |
|
|
|
if ($context eq 'domain') { |
|
$dest = '/adm/domainprefs'; |
|
} else { |
} else { |
$dest = '/adm/courseprefs'; |
@current = @domdefs; |
} |
} |
my ($switchserver,$switchmessage); |
my $numinrow = 3; |
$switchserver = &check_switchserver($cdom,$cnum,$context,$dest); |
my $count = 0; |
if ($switchserver) { |
my $disabled; |
if ($context eq 'domain') { |
if ($noedit) { |
$switchmessage = &mt("submit from domain's primary library server: [_1].",$switchserver); |
$disabled = ' disabled="disabled"'; |
} elsif ($crstype eq 'Community') { |
|
$switchmessage = &mt("submit from community's home server: [_1].",$switchserver); |
|
} else { |
|
$switchmessage = &mt("submit from course's home server: [_1].",$switchserver); |
|
} |
|
} |
} |
my $maxnum = scalar(keys(%ordered)); |
my $output = '<table>'; |
my @courseroles = ('cc','in','ta','ep','st'); |
foreach my $item (@menuitems) { |
my @ltiroles = qw(Instructor ContentDeveloper TeachingAssistant Learner); |
my $checked = ''; |
my @fields = ('fullname','firstname','lastname','email','roles','user'); |
if (grep(/^\Q$item\E$/,@current)) { |
if (keys(%ordered)) { |
$checked = ' checked="checked" '; |
my @items = sort { $a <=> $b } keys(%ordered); |
|
for (my $i=0; $i<@items; $i++) { |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
my $item = $ordered{$items[$i]}; |
|
my ($title,$key,$url,$usable,$lifetime,$imgsrc,%sigsel); |
|
if (ref($settings->{$item}) eq 'HASH') { |
|
$title = $settings->{$item}->{'title'}; |
|
$url = $settings->{$item}->{'url'}; |
|
$key = $settings->{$item}->{'key'}; |
|
$usable = $settings->{$item}->{'usable'}; |
|
$lifetime = $settings->{$item}->{'lifetime'}; |
|
my $image = $settings->{$item}->{'image'}; |
|
if ($image ne '') { |
|
$imgsrc = '<img src="'.$image.'" alt="'.&mt('Tool Provider icon').'" />'; |
|
} |
|
if ($settings->{$item}->{'sigmethod'} eq 'HMAC-256') { |
|
$sigsel{'HMAC-256'} = ' selected="selected"'; |
|
} else { |
|
$sigsel{'HMAC-SHA1'} = ' selected="selected"'; |
|
} |
|
} |
|
my $chgstr = ' onchange="javascript:reorderLTITools(this.form,'."'ltitools_".$item."'".');"'; |
|
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">' |
|
.'<select name="ltitools_'.$item.'"'.$chgstr.'>'; |
|
for (my $k=0; $k<=$maxnum; $k++) { |
|
my $vpos = $k+1; |
|
my $selstr; |
|
if ($k == $i) { |
|
$selstr = ' selected="selected" '; |
|
} |
|
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
|
} |
|
$datatable .= '</select>'.(' 'x2). |
|
'<label><input type="checkbox" name="ltitools_del" value="'.$item.'" />'. |
|
&mt('Delete?').'</label></span></td>'. |
|
'<td colspan="2">'. |
|
'<fieldset><legend>'.&mt('Required settings').'</legend>'. |
|
'<span class="LC_nobreak">'.$lt{'title'}.':<input type="text" size="20" name="ltitools_title_'.$i.'" value="'.$title.'" /></span> '. |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'version'}.':<select name="ltitools_version_'.$i.'">'. |
|
'<option value="LTI-1p0" selected="selected">1.1</option></select></span> '. |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'msgtype'}.':<select name="ltitools_msgtype_'.$i.'">'. |
|
'<option value="basic-lti-launch-request" selected="selected">Launch</option></select></span> '. |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'sigmethod'}.':<select name="ltitools_sigmethod_'.$i.'">'. |
|
'<option value="HMAC-SHA1"'.$sigsel{'HMAC-SHA1'}.'>HMAC-SHA1</option>'. |
|
'<option value="HMAC-SHA256"'.$sigsel{'HMAC-SHA256'}.'>HMAC-SHA256</option></select></span>'. |
|
'<br /><br />'. |
|
'<span class="LC_nobreak">'.$lt{'url'}.':<input type="text" size="60" name="ltitools_url_'.$i.'"'. |
|
' value="'.$url.'" /></span>'. |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'lifetime'}.':'. |
|
'<input type="text" size="5" name="ltitools_lifetime_'.$i.'" value="'.$lifetime.'" /></span><br /><br />'; |
|
if ($key ne '') { |
|
$datatable .= '<span class="LC_nobreak">'.$lt{'key'}; |
|
if ($noedit) { |
|
$datatable .= ': ['.&mt('not shown').']'; |
|
} elsif ($switchserver) { |
|
$datatable .= ': ['.&mt('[_1] to view/edit',$switchserver).']'; |
|
} else { |
|
$datatable .= ':<input type="text" size="25" name="ltitools_key_'.$i.'" value="'.$key.'" autocomplete="off"'.$disabled.' />'; |
|
} |
|
$datatable .= '</span> '.(' 'x2); |
|
} elsif (!$switchserver) { |
|
$datatable .= '<span class="LC_nobreak">'.$lt{'key'}.':'. |
|
'<input type="text" size="25" name="ltitools_key_'.$i.'" value="'.$key.'" autocomplete="off"'.$disabled.' />'. |
|
'</span> '.(' 'x2); |
|
} |
|
if ($switchserver) { |
|
if ($usable ne '') { |
|
$datatable .= '<div id="ltitools_divcurrsecret_'.$i.'" style="display:inline-block" /><span class="LC_nobreak">'. |
|
$lt{'secret'}.': ['.&mt('not shown').'] '.(' 'x2).'</span></div>'. |
|
'<span class="LC_nobreak">'.&mt('Change secret?'). |
|
'<label><input type="radio" value="0" name="ltitools_changesecret_'.$i.'" onclick="javascript:toggleChgSecret(this.form,'."'$i','secret','ltitools'".');" checked="checked"'.$disabled.' />'.&mt('No').'</label>'. |
|
(' 'x2). |
|
'<label><input type="radio" value="1" name="ltitools_changesecret_'.$i.'" onclick="javascript:toggleChgSecret(this.form,'."'$i','secret','ltitools'".');" '.$disabled.' />'.&mt('Yes').'</label>'.(' 'x2). |
|
'</span><div id="ltitools_divchgsecret_'.$i.'" style="display:none" />'. |
|
'<span class="LC_nobreak"> - '.$switchmessage.'</span>'. |
|
'</div>'; |
|
} elsif ($key eq '') { |
|
$datatable .= '<span class="LC_nobreak">'.&mt('Key and Secret are required').' - '.$switchmessage.'</span>'."\n"; |
|
} else { |
|
$datatable .= '<span class="LC_nobreak">'.&mt('Secret required').' - '.$switchmessage.'</span>'."\n"; |
|
} |
|
$datatable .= '<input type="hidden" name="ltitools_id_'.$i.'" value="'.$item.'" />'; |
|
} else { |
|
if ($usable ne '') { |
|
$datatable .= '<div id="ltitools_divcurrsecret_'.$i.'" style="display:inline-block" /><span class="LC_nobreak">'. |
|
$lt{'secret'}.': ['.&mt('not shown').'] '.(' 'x2).'</span></div>'. |
|
'<span class="LC_nobreak">'.&mt('Change?'). |
|
'<label><input type="radio" value="0" name="ltitools_changesecret_'.$i.'" onclick="javascript:toggleChgSecret(this.form,'."'$i','secret','ltitools'".');" checked="checked"'.$disabled.' />'.&mt('No').'</label>'. |
|
(' 'x2). |
|
'<label><input type="radio" value="1" name="ltitools_changesecret_'.$i.'" onclick="javascript:toggleChgSecret(this.form,'."'$i','secret','ltitools'".');"'.$disabled.' />'.&mt('Yes'). |
|
'</label> </span><div id="ltitools_divchgsecret_'.$i.'" style="display:none" />'. |
|
'<span class="LC_nobreak">'.&mt('New Secret').':'. |
|
'<input type="password" size="20" name="ltitools_secret_'.$i.'" value="" autocomplete="new-password"'.$disabled.' />'. |
|
'<label><input type="checkbox" name="ltitools_visible_'.$i.'" id="ltitools_visible_'.$i.'" onclick="if (this.checked) { this.form.ltitools_secret_'.$i.'.type='."'text'".' } else { this.form.ltitools_secret_'.$i.'.type='."'password'".' }"'.$disabled.' />'.&mt('Visible input').'</label>'. |
|
'<input type="hidden" name="ltitools_id_'.$i.'" value="'.$item.'" /></span></div>'; |
|
} else { |
|
$datatable .= |
|
'<span class="LC_nobreak">'.$lt{'secret'}.':'. |
|
'<input type="password" size="20" name="ltitools_secret_'.$i.'" value="" autocomplete="new-password"'.$disabled.' />'. |
|
'<label><input type="checkbox" name="ltitools_visible_'.$i.'" id="ltitools_visible_'.$i.'" onclick="if (this.checked) { this.form.ltitools_secret_'.$i.'.type='."'text'".' } else { this.form.ltitools_secret_'.$i.'.type='."'password'".' }"'.$disabled.' />'.&mt('Visible input').'</label>'. |
|
'<input type="hidden" name="ltitools_id_'.$i.'" value="'.$item.'" /></span>'; |
|
} |
|
} |
|
$datatable .= '</fieldset>'. |
|
'<fieldset><legend>'.&mt('Optional settings').'</legend>'. |
|
'<span class="LC_nobreak">'.&mt('Display target:'); |
|
my %currdisp; |
|
if (ref($settings->{$item}->{'display'}) eq 'HASH') { |
|
if ($settings->{$item}->{'display'}->{'target'} eq 'window') { |
|
$currdisp{'window'} = ' checked="checked"'; |
|
} elsif ($settings->{$item}->{'display'}->{'target'} eq 'tab') { |
|
$currdisp{'tab'} = ' checked="checked"'; |
|
} else { |
|
$currdisp{'iframe'} = ' checked="checked"'; |
|
} |
|
if ($settings->{$item}->{'display'}->{'width'} =~ /^(\d+)$/) { |
|
$currdisp{'width'} = $1; |
|
} |
|
if ($settings->{$item}->{'display'}->{'height'} =~ /^(\d+)$/) { |
|
$currdisp{'height'} = $1; |
|
} |
|
$currdisp{'linktext'} = $settings->{$item}->{'display'}->{'linktext'}; |
|
$currdisp{'explanation'} = $settings->{$item}->{'display'}->{'explanation'}; |
|
} else { |
|
$currdisp{'iframe'} = ' checked="checked"'; |
|
} |
|
foreach my $disp ('iframe','tab','window') { |
|
$datatable .= '<label><input type="radio" name="ltitools_target_'.$i.'" value="'.$disp.'"'.$currdisp{$disp}.' />'. |
|
$lt{$disp}.'</label>'.(' 'x2); |
|
} |
|
$datatable .= (' 'x4); |
|
foreach my $dimen ('width','height') { |
|
$datatable .= '<label>'.$lt{$dimen}.' '. |
|
'<input type="text" name="ltitools_'.$dimen.'_'.$i.'" size="5" value="'.$currdisp{$dimen}.'" /></label>'. |
|
(' 'x2); |
|
} |
|
$datatable .= '</span><br />'. |
|
'<div class="LC_left_float">'.$lt{'linktext'}.'<br />'. |
|
'<input type="text" name="ltitools_linktext_'.$i.'" size="25" value="'.$currdisp{'linktext'}.'" /></div>'. |
|
'<div class="LC_left_float">'.$lt{'explanation'}.'<br />'. |
|
'<textarea name="ltitools_explanation_'.$i.'" rows="5" cols="40">'.$currdisp{'explanation'}. |
|
'</textarea></div><div style=""></div><br />'; |
|
my %units = ( |
|
'passback' => 'days', |
|
'roster' => 'seconds', |
|
); |
|
foreach my $extra ('passback','roster') { |
|
my $validsty = 'none'; |
|
my $currvalid; |
|
my $checkedon = ''; |
|
my $checkedoff = ' checked="checked"'; |
|
if ($settings->{$item}->{$extra}) { |
|
$checkedon = $checkedoff; |
|
$checkedoff = ''; |
|
$validsty = 'inline-block'; |
|
if ($settings->{$item}->{$extra.'valid'} =~ /^\d+\.?\d*$/) { |
|
$currvalid = $settings->{$item}->{$extra.'valid'}; |
|
} |
|
} |
|
my $onclick = ' onclick="toggleLTITools(this.form,'."'$extra','$i'".');"'; |
|
$datatable .= '<div class="LC_floatleft"><span class="LC_nobreak">'.$lt{$extra}.' '. |
|
'<label><input type="radio" name="ltitools_'.$extra.'_'.$i.'" value="0"'.$checkedoff.$onclick.' />'. |
|
&mt('No').'</label>'.(' 'x2). |
|
'<label><input type="radio" name="ltitools_'.$extra.'_'.$i.'" value="1"'.$checkedon.$onclick.' />'. |
|
&mt('Yes').'</label></span></div>'. |
|
'<div class="LC_floatleft" style="display:'.$validsty.';" id="ltitools_'.$extra.'time_'.$i.'">'. |
|
'<span class="LC_nobreak">'. |
|
&mt("until at least [_1] $units{$extra} after launch", |
|
'<input type="text" name="ltitools_'.$extra.'valid_'.$i.'" value="'.$currvalid.'" />'). |
|
'</span></div><div style="padding:0;clear:both;margin:0;border:0"></div>'; |
|
} |
|
$datatable .= '<span class="LC_nobreak">'.$lt{'icon'}.': '; |
|
if ($imgsrc) { |
|
$datatable .= $imgsrc. |
|
'<label><input type="checkbox" name="ltitools_image_del"'. |
|
' value="'.$item.'" />'.&mt('Delete?').'</label></span> '. |
|
'<span class="LC_nobreak"> '.&mt('Replace:').' '; |
|
} else { |
|
$datatable .= '('.&mt('if larger than 21x21 pixels, image will be scaled').') '; |
|
} |
|
if ($switchserver) { |
|
$datatable .= &mt('Upload to library server: [_1]',$switchserver); |
|
} else { |
|
$datatable .= '<input type="file" name="ltitools_image_'.$i.'" value="" />'; |
|
} |
|
$datatable .= '</span></fieldset>'; |
|
my (%checkedfields,%rolemaps,$userincdom); |
|
if (ref($settings->{$item}) eq 'HASH') { |
|
if (ref($settings->{$item}->{'fields'}) eq 'HASH') { |
|
%checkedfields = %{$settings->{$item}->{'fields'}}; |
|
} |
|
$userincdom = $settings->{$item}->{'incdom'}; |
|
if (ref($settings->{$item}->{'roles'}) eq 'HASH') { |
|
%rolemaps = %{$settings->{$item}->{'roles'}}; |
|
$checkedfields{'roles'} = 1; |
|
} |
|
} |
|
$datatable .= '<fieldset><legend>'.&mt('User data sent on launch').'</legend>'. |
|
'<span class="LC_nobreak">'; |
|
my $userfieldstyle = 'display:none;'; |
|
my $seluserdom = ''; |
|
my $unseluserdom = ' selected="selected"'; |
|
foreach my $field (@fields) { |
|
my ($checked,$onclick,$id,$spacer); |
|
if ($checkedfields{$field}) { |
|
$checked = ' checked="checked"'; |
|
} |
|
if ($field eq 'user') { |
|
$id = ' id="ltitools_user_field_'.$i.'"'; |
|
$onclick = ' onclick="toggleLTITools(this.form,'."'$field','$i'".')"'; |
|
if ($checked) { |
|
$userfieldstyle = 'display:inline-block'; |
|
if ($userincdom) { |
|
$seluserdom = $unseluserdom; |
|
$unseluserdom = ''; |
|
} |
|
} |
|
} else { |
|
$spacer = (' ' x2); |
|
} |
|
$datatable .= '<label>'. |
|
'<input type="checkbox" name="ltitools_fields_'.$i.'" value="'.$field.'"'.$id.$checked.$onclick.' />'. |
|
$lt{$field}.'</label>'.$spacer; |
|
} |
|
$datatable .= '</span>'; |
|
$datatable .= '<div style="'.$userfieldstyle.'" id="ltitools_user_div_'.$i.'">'. |
|
'<span class="LC_nobreak"> : '. |
|
'<select name="ltitools_userincdom_'.$i.'">'. |
|
'<option value="">'.&mt('Select').'</option>'. |
|
'<option value="0"'.$unseluserdom.'>'.&mt('username').'</option>'. |
|
'<option value="1"'.$seluserdom.'>'.&mt('username:domain').'</option>'. |
|
'</select></span></div>'; |
|
$datatable .= '</fieldset>'. |
|
'<fieldset><legend>'.&mt('Role mapping').'</legend><table><tr>'; |
|
foreach my $role (@courseroles) { |
|
my ($selected,$selectnone); |
|
if (!$rolemaps{$role}) { |
|
$selectnone = ' selected="selected"'; |
|
} |
|
$datatable .= '<td style="text-align: center">'. |
|
&Apache::lonnet::plaintext($role,'Course').'<br />'. |
|
'<select name="ltitools_roles_'.$role.'_'.$i.'">'. |
|
'<option value=""'.$selectnone.'>'.&mt('Select').'</option>'; |
|
foreach my $ltirole (@ltiroles) { |
|
unless ($selectnone) { |
|
if ($rolemaps{$role} eq $ltirole) { |
|
$selected = ' selected="selected"'; |
|
} else { |
|
$selected = ''; |
|
} |
|
} |
|
$datatable .= '<option value="'.$ltirole.'"'.$selected.'>'.$ltirole.'</option>'; |
|
} |
|
$datatable .= '</select></td>'; |
|
} |
|
$datatable .= '</tr></table></fieldset>'; |
|
my %courseconfig; |
|
if (ref($settings->{$item}) eq 'HASH') { |
|
if (ref($settings->{$item}->{'crsconf'}) eq 'HASH') { |
|
%courseconfig = %{$settings->{$item}->{'crsconf'}}; |
|
} |
|
} |
|
$datatable .= '<fieldset><legend>'.&mt('Configurable in course').'</legend><span class="LC_nobreak">'; |
|
foreach my $item ('label','title','target','linktext','explanation','append') { |
|
my $checked; |
|
if ($courseconfig{$item}) { |
|
$checked = ' checked="checked"'; |
|
} |
|
$datatable .= '<label>'. |
|
'<input type="checkbox" name="ltitools_courseconfig_'.$i.'" value="'.$item.'"'.$checked.' />'. |
|
$lt{'crs'.$item}.'</label> '."\n"; |
|
} |
|
$datatable .= '</span></fieldset>'. |
|
'<fieldset><legend>'.&mt('Custom items sent on launch').'</legend>'. |
|
'<table><tr><th>'.&mt('Action').'</th><th>'.&mt('Name').'</th><th>'.&mt('Value').'</th></tr>'; |
|
if (ref($settings->{$item}->{'custom'}) eq 'HASH') { |
|
my %custom = %{$settings->{$item}->{'custom'}}; |
|
if (keys(%custom) > 0) { |
|
foreach my $key (sort(keys(%custom))) { |
|
$datatable .= '<tr><td><span class="LC_nobreak">'. |
|
'<label><input type="checkbox" name="ltitools_customdel_'.$i.'" value="'. |
|
$key.'" />'.&mt('Delete').'</label></span></td><td>'.$key.'</td>'. |
|
'<td><input type="text" name="ltitools_customval_'.$key.'_'.$i.'"'. |
|
' value="'.$custom{$key}.'" /></td></tr>'; |
|
} |
|
} |
|
} |
|
$datatable .= '<tr><td><span class="LC_nobreak">'. |
|
'<label><input type="checkbox" name="ltitools_customadd" value="'.$i.'" />'. |
|
&mt('Add').'</label></span></td><td><input type="text" name="ltitools_custom_name_'.$i.'" />'. |
|
'</td><td><input type="text" name="ltitools_custom_value_'.$i.'" /></td></tr>'; |
|
$datatable .= '</table></fieldset></td></tr>'."\n"; |
|
$itemcount ++; |
|
} |
} |
|
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 ++; |
} |
} |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
my $rem = $count%($numinrow); |
my $chgstr = ' onchange="javascript:reorderLTITools(this.form,'."'ltitools_add_pos'".');"'; |
my $colsleft = $numinrow - $rem; |
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">'."\n". |
if ($colsleft > 1 ) { |
'<input type="hidden" name="ltitools_maxnum" value="'.$maxnum.'" />'."\n". |
$output .= '<td colspan="'.$colsleft.'" class="LC_left_item">'. |
'<select name="ltitools_add_pos"'.$chgstr.'>'; |
' </td>'; |
for (my $k=0; $k<$maxnum+1; $k++) { |
} elsif ($colsleft == 1) { |
my $vpos = $k+1; |
$output .= '<td class="LC_left_item"> </td>'; |
my $selstr; |
|
if ($k == $maxnum) { |
|
$selstr = ' selected="selected" '; |
|
} |
|
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
|
} |
|
$datatable .= '</select> '."\n". |
|
'<input type="checkbox" name="ltitools_add" value="1" />'.&mt('Add').'</span></td>'."\n". |
|
'<td colspan="2">'. |
|
'<fieldset><legend>'.&mt('Required settings').'</legend>'. |
|
'<span class="LC_nobreak">'.$lt{'title'}.':<input type="text" size="20" name="ltitools_add_title" value="" /></span> '."\n". |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'version'}.':<select name="ltitools_add_version">'. |
|
'<option value="LTI-1p0" selected="selected">1.1</option></select></span> '."\n". |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'msgtype'}.':<select name="ltitools_add_msgtype">'. |
|
'<option value="basic-lti-launch-request" selected="selected">Launch</option></select></span> '. |
|
'<span class="LC_nobreak">'.$lt{'sigmethod'}.':<select name="ltitools_add_sigmethod">'. |
|
'<option value="HMAC-SHA1" selected="selected">HMAC-SHA1</option>'. |
|
'<option value="HMAC-SHA256">HMAC-SHA256</option></select></span>'. |
|
'<br />'. |
|
'<span class="LC_nobreak">'.$lt{'url'}.':<input type="text" size="60" name="ltitools_add_url" value="" /></span> '."\n". |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'lifetime'}.':<input type="text" size="5" name="ltitools_add_lifetime" value="300" /></span><br />'; |
|
if ($switchserver) { |
|
$datatable .= '<span class="LC_nobreak">'.&mt('Key and Secret are required').' - '.$switchmessage.'</span>'."\n"; |
|
} else { |
|
$datatable .= '<span class="LC_nobreak">'.$lt{'key'}.':<input type="text" size="25" name="ltitools_add_key" value="" autocomplete="off"'.$disabled.' /></span> '."\n". |
|
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'secret'}.':<input type="password" size="20" name="ltitools_secret_add" value="" autocomplete="new-password"'.$disabled.' />'. |
|
'<label><input type="checkbox" name="ltitools_add_visible" id="ltitools_add_visible" onclick="if (this.checked) { this.form.ltitools_secret_add.type='."'text'".' } else { this.form.ltitools_secret_add.type='."'password'".' }"'.$disabled.' />'.&mt('Visible input').'</label></span> '."\n"; |
|
} |
|
$datatable .= '<br /><br />'. |
|
'</fieldset>'. |
|
'<fieldset><legend>'.&mt('Optional settings').'</legend>'. |
|
'<span class="LC_nobreak">'.&mt('Display target:'); |
|
my %defaultdisp; |
|
$defaultdisp{'iframe'} = ' checked="checked"'; |
|
foreach my $disp ('iframe','tab','window') { |
|
$datatable .= '<label><input type="radio" name="ltitools_add_target" value="'.$disp.'"'.$defaultdisp{$disp}.' />'. |
|
$lt{$disp}.'</label>'.(' 'x2); |
|
} |
|
$datatable .= (' 'x4); |
|
foreach my $dimen ('width','height') { |
|
$datatable .= '<label>'.$lt{$dimen}.' '. |
|
'<input type="text" name="ltitools_add_'.$dimen.'" size="5" /></label>'. |
|
(' 'x2); |
|
} |
|
$datatable .= '</span><br />'. |
|
'<div class="LC_left_float">'.$lt{'linktext'}.'<br />'. |
|
'<input type="text" name="ltitools_add_linktext" size="5" /></div>'. |
|
'<div class="LC_left_float">'.$lt{'explanation'}.'<br />'. |
|
'<textarea name="ltitools_add_explanation" rows="5" cols="40"></textarea>'. |
|
'</div><div style=""></div><br />'; |
|
my %units = ( |
|
'passback' => 'days', |
|
'roster' => 'seconds', |
|
); |
|
my %defaulttimes = ( |
|
'passback' => '7', |
|
'roster' => '300', |
|
); |
|
foreach my $extra ('passback','roster') { |
|
my $onclick = ' onclick="toggleLTITools(this.form,'."'$extra','add'".');"'; |
|
$datatable .= '<div class="LC_floatleft"><span class="LC_nobreak">'.$lt{$extra}.' '. |
|
'<label><input type="radio" name="ltitools_'.$extra.'_add" value="0" checked="checked"'.$onclick.' />'. |
|
&mt('No').'</label></span>'.(' 'x2).'<span class="LC_nobreak">'. |
|
'<label><input type="radio" name="ltitools_'.$extra.'_add" value="1"'.$onclick.' />'. |
|
&mt('Yes').'</label></span></div>'. |
|
'<div class="LC_floatleft" style="display:none;" id="ltitools_'.$extra.'time_add">'. |
|
'<span class="LC_nobreak">'. |
|
&mt("until at least [_1] $units{$extra} after launch", |
|
'<input type="text" name="ltitools_'.$extra.'valid_add" value="'.$defaulttimes{$extra}.'" />'). |
|
'</span></div><div style="padding:0;clear:both;margin:0;border:0"></div>'; |
|
} |
|
$datatable .= '<span class="LC_nobreak">'.$lt{'icon'}.': '. |
|
'('.&mt('if larger than 21x21 pixels, image will be scaled').') '; |
|
if ($switchserver) { |
|
$datatable .= &mt('Upload to library server: [_1]',$switchserver); |
|
} else { |
|
$datatable .= '<input type="file" name="ltitools_add_image" value="" />'; |
|
} |
} |
$datatable .= '</span></fieldset>'. |
$output .= '</tr></table>'; |
'<fieldset><legend>'.&mt('User data sent on launch').'</legend>'. |
|
'<span class="LC_nobreak">'; |
|
foreach my $field (@fields) { |
|
my ($id,$onclick,$spacer); |
|
if ($field eq 'user') { |
|
$id = ' id="ltitools_user_field_add"'; |
|
$onclick = ' onclick="toggleLTITools(this.form,'."'$field','add'".')"'; |
|
} else { |
|
$spacer = (' ' x2); |
|
} |
|
$datatable .= '<label>'. |
|
'<input type="checkbox" name="ltitools_add_fields" value="'.$field.'"'.$id.$onclick.' />'. |
|
$lt{$field}.'</label>'.$spacer; |
|
} |
|
$datatable .= '</span>'. |
|
'<div style="display:none;" id="ltitools_user_div_add">'. |
|
'<span class="LC_nobreak"> : '. |
|
'<select name="ltitools_add_userincdom">'. |
|
'<option value="" selected="selected">'.&mt('Select').'</option>'. |
|
'<option value="0">'.&mt('username').'</option>'. |
|
'<option value="1">'.&mt('username:domain').'</option>'. |
|
'</select></span></div></fieldset>'; |
|
$datatable .= '<fieldset><legend>'.&mt('Role mapping').'</legend><table><tr>'; |
|
foreach my $role (@courseroles) { |
|
my ($checked,$checkednone); |
|
$datatable .= '<td style="text-align: center">'. |
|
&Apache::lonnet::plaintext($role,'Course').'<br />'. |
|
'<select name="ltitools_add_roles_'.$role.'">'. |
|
'<option value="" selected="selected">'.&mt('Select').'</option>'; |
|
foreach my $ltirole (@ltiroles) { |
|
$datatable .= '<option value="'.$ltirole.'">'.$ltirole.'</option>'; |
|
} |
|
$datatable .= '</select></td>'; |
|
} |
|
$datatable .= '</tr></table></fieldset>'. |
|
'<fieldset><legend>'.&mt('Configurable in course').'</legend><span class="LC_nobreak">'; |
|
foreach my $item ('label','title','target','linktext','explanation','append') { |
|
$datatable .= '<label>'. |
|
'<input type="checkbox" name="ltitools_add_courseconfig" value="'.$item.'" checked="checked" />'. |
|
$lt{'crs'.$item}.'</label>'.(' ' x2)."\n"; |
|
} |
|
$datatable .= '</span></fieldset>'. |
|
'<fieldset><legend>'.&mt('Custom items sent on launch').'</legend>'. |
|
'<table><tr><th>'.&mt('Action').'</th><th>'.&mt('Name').'</th><th>'.&mt('Value').'</th></tr>'. |
|
'<tr><td><span class="LC_nobreak">'. |
|
'<label><input type="checkbox" name="ltitools_add_custom" value="1" />'. |
|
&mt('Add').'</label></span></td><td><input type="text" name="ltitools_add_custom_name" />'. |
|
'</td><td><input type="text" name="ltitools_add_custom_value" /></td></tr>'. |
|
'</table></fieldset>'."\n". |
|
'</td>'."\n". |
|
'</tr>'."\n"; |
|
$itemcount ++; |
|
return $datatable; |
|
} |
|
|
|
sub ltitools_names { |
|
my %lt = &Apache::lonlocal::texthash( |
|
'title' => 'Title', |
|
'version' => 'Version', |
|
'msgtype' => 'Message Type', |
|
'sigmethod' => 'Signature Method', |
|
'url' => 'URL', |
|
'key' => 'Key', |
|
'lifetime' => 'Nonce lifetime (s)', |
|
'secret' => 'Secret', |
|
'icon' => 'Icon', |
|
'user' => 'User', |
|
'fullname' => 'Full Name', |
|
'firstname' => 'First Name', |
|
'lastname' => 'Last Name', |
|
'email' => 'E-mail', |
|
'roles' => 'Role', |
|
'window' => 'Window', |
|
'tab' => 'Tab', |
|
'iframe' => 'iFrame', |
|
'height' => 'Height', |
|
'width' => 'Width', |
|
'linktext' => 'Default Link Text', |
|
'explanation' => 'Default Explanation', |
|
'passback' => 'Tool can return grades:', |
|
'roster' => 'Tool can retrieve roster:', |
|
'crstarget' => 'Display target', |
|
'crslabel' => 'Course label', |
|
'crstitle' => 'Course title', |
|
'crslinktext' => 'Link Text', |
|
'crsexplanation' => 'Explanation', |
|
'crsappend' => 'Provider URL', |
|
); |
|
return %lt; |
|
} |
} |
|
|
sub ltimenu_titles { |
sub ltimenu_titles { |
Line 6826 sub menuitems_categories {
|
Line 5503 sub menuitems_categories {
|
my %categories = ( |
my %categories = ( |
shown => ['top','inline','foot','main'], |
shown => ['top','inline','foot','main'], |
text => ['name','role','crs','disc','fdbk'], |
text => ['name','role','crs','disc','fdbk'], |
links => ['pers','logo','comm','roles','help','logout'], |
links => ['pers','logo','menu','comm','roles','help','logout'], |
list => ['about','prefs','port','wish','anno','rss'], |
list => ['about','prefs','port','wish','anno','rss'], |
inline => ['cont','grades','chat','people','groups','resv','syll','feeds'], |
inline => ['cont','grades','chat','people','groups','resv','syll','feeds'], |
); |
); |
Line 6851 sub menuitems_fields {
|
Line 5528 sub menuitems_fields {
|
main => 'Access to main menu', |
main => 'Access to main menu', |
pers => 'Personal', |
pers => 'Personal', |
logo => 'LON-CAPA', |
logo => 'LON-CAPA', |
|
menu => 'Home', |
comm => 'Messages', |
comm => 'Messages', |
roles => 'Roles/Courses', |
roles => 'Roles/Courses', |
help => 'Help', |
help => 'Help', |
Line 6921 sub menucollections_display {
|
Line 5599 sub menucollections_display {
|
'<legend>'.$menutitles{$category}.'</legend>'."\n"; |
'<legend>'.$menutitles{$category}.'</legend>'."\n"; |
if ($category eq 'text') { |
if ($category eq 'text') { |
$output .= '<b>'.&mt('Header Text').'</b><br /><br />'; |
$output .= '<b>'.&mt('Header Text').'</b><br /><br />'; |
} |
} |
foreach my $field (@{$categories{$category}}) { |
foreach my $field (@{$categories{$category}}) { |
if ($field eq 'disc') { |
if ($field eq 'disc') { |
$output .= '<br /><b>'.&mt('Footer Text').'</b><br /><br />'; |
$output .= '<br /><b>'.&mt('Footer Text').'</b><br /><br />'; |
Line 6945 sub menucollections_display {
|
Line 5623 sub menucollections_display {
|
|
|
sub print_linkprotection { |
sub print_linkprotection { |
my ($cdom,$cnum,$settings,$rowtotal,$crstype,$noedit,$context) = @_; |
my ($cdom,$cnum,$settings,$rowtotal,$crstype,$noedit,$context) = @_; |
|
unless (ref($settings) eq 'HASH') { |
|
return; |
|
} |
|
|
my %linkprotection; |
my %linkprotection; |
my $count = 0; |
my $count = 0; |
Line 6976 sub print_linkprotection {
|
Line 5657 sub print_linkprotection {
|
} else { |
} else { |
$dest = '/adm/courseprefs'; |
$dest = '/adm/courseprefs'; |
} |
} |
|
|
my ($switchserver,$switchmessage); |
my ($switchserver,$switchmessage); |
$switchserver = &check_switchserver($cdom,$cnum,$context,$dest); |
$switchserver = &check_switchserver($cdom,$cnum,$context,$dest); |
if ($switchserver) { |
if ($switchserver) { |
if ($context eq 'domain') { |
if ($context eq 'domain') { |
$switchmessage = &mt("submit from domain's primary library server: [_1].",$switchserver); |
$switchmessage = &mt("submit from domain's primary library server: [_1].",$switchserver); |
} elsif ($crstype eq 'Community') { |
} elsif ($crstype eq 'Community') { |
$switchmessage = &mt("submit from community's home server: [_1].",$switchserver); |
$switchmessage = &mt("submit from community's home server: [_1].",$switchserver); |
} else { |
} else { |
Line 6989 sub print_linkprotection {
|
Line 5670 sub print_linkprotection {
|
} |
} |
} |
} |
|
|
if ((ref($settings) eq 'HASH') && (ref($settings->{'linkprot'}) eq 'HASH')) { |
if (ref($settings->{'linkprot'}) eq 'HASH') { |
if (keys(%{$settings->{'linkprot'}})) { |
if (keys(%{$settings->{'linkprot'}})) { |
my @current = sort { $a <=> $b } keys(%{$settings->{'linkprot'}}); |
my @current = sort { $a <=> $b } keys(%{$settings->{'linkprot'}}); |
$next += $current[-1]; |
$next += $current[-1]; |
Line 7010 sub print_linkprotection {
|
Line 5691 sub print_linkprotection {
|
'<tr '.$css_class.'><td><span class="LC_nobreak">'. |
'<tr '.$css_class.'><td><span class="LC_nobreak">'. |
'<label><input type="checkbox" name="linkprot_del" value="'.$i.'"'.$disabled.' />'. |
'<label><input type="checkbox" name="linkprot_del" value="'.$i.'"'.$disabled.' />'. |
&mt('Delete?').'</label></span></td><td>'; |
&mt('Delete?').'</label></span></td><td>'; |
my ($usersty,$onclickrequser,%checkedrequser,$onclickreturnurl,%checkedreturnurl, |
my ($usersty,$onclickrequser,%checkedrequser); |
$onclickpassback,%checkedpassback,$passbacksty,%checkedpassbackfmt); |
|
$passbacksty = 'none'; |
|
$onclickpassback = ' onclick="toggleLinkProtExtra(this.form,'."'passback','passbackparam','1','inline-block','$i'".');"'; |
|
%checkedpassback = ( |
|
'no' => ' checked="checked"', |
|
'yes' => '', |
|
); |
|
%checkedpassbackfmt = ( |
|
'1p1' => ' checked="checked"', |
|
'1p0' => '', |
|
); |
|
if ($values{'passback'} ne '') { |
|
$passbacksty = 'inline-block'; |
|
$checkedpassback{'yes'} = ' checked="checked"'; |
|
$checkedpassback{'no'} = ''; |
|
if ($values{'passbackformat'} eq '1.0') { |
|
$checkedpassbackfmt{'1p0'} = ' checked="checked"'; |
|
$checkedpassbackfmt{'1p1'} = ''; |
|
} |
|
} |
|
if ($ltiauth) { |
if ($ltiauth) { |
$usersty = 'display:none'; |
$usersty = 'display:none'; |
$onclickrequser = ' onclick="toggleLinkProtExtra(this.form,'."'requser','optional','1','block','$i'".');"'; |
$onclickrequser = ' onclick="toggleLinkProtReqUser(this.form,'."'requser','optional','1','block','$i'".');"'; |
%checkedrequser = ( |
%checkedrequser = ( |
no => ' checked="checked"', |
no => ' checked="checked"', |
yes => '', |
yes => '', |
Line 7043 sub print_linkprotection {
|
Line 5704 sub print_linkprotection {
|
$checkedrequser{'no'} = ''; |
$checkedrequser{'no'} = ''; |
} |
} |
$datatable .= '<fieldset><legend>'.$lt{'requ'}.'</legend>'; |
$datatable .= '<fieldset><legend>'.$lt{'requ'}.'</legend>'; |
if ($values{'requser'}) { |
if ($values{'requser'}) { |
$usersty = 'display:inline-block'; |
$usersty = 'display:inline-block'; |
} |
} |
} |
} |
$onclickreturnurl = ' onclick="toggleLinkProtExtra(this.form,'."'returnurl','divurlparam','1','inline-block','$i'".');"'; |
|
%checkedreturnurl = ( |
|
no => ' checked="checked"', |
|
yes => '', |
|
); |
|
if ($values{'returnurl'} ne '') { |
|
$checkedreturnurl{'yes'} = $checkedreturnurl{'no'}; |
|
$checkedreturnurl{'no'} = ''; |
|
} |
|
$datatable .= |
$datatable .= |
'<span class="LC_nobreak">'.$desc{'name'}. |
'<span class="LC_nobreak">'.$desc{'name'}. |
':<input type="text" size="15" name="linkprot_name_'.$i.'" value="'.$values{'name'}.'" autocomplete="off"'.$disabled.' /></span> '. |
':<input type="text" size="15" name="linkprot_name_'.$i.'" value="'.$values{'name'}.'" autocomplete="off"'.$disabled.' /></span> '. |
Line 7064 sub print_linkprotection {
|
Line 5716 sub print_linkprotection {
|
'<option value="LTI-1p0" '.$selected.'>1.1</option></select></span> '."\n". |
'<option value="LTI-1p0" '.$selected.'>1.1</option></select></span> '."\n". |
(' 'x2). |
(' 'x2). |
'<span class="LC_nobreak">'.$desc{'lifetime'}.':<input type="text" name="linkprot_lifetime_'.$i.'"'. |
'<span class="LC_nobreak">'.$desc{'lifetime'}.':<input type="text" name="linkprot_lifetime_'.$i.'"'. |
' value="'.$values{'lifetime'}.'" size="3"'.$disabled.' /></span><br /><br />'; |
' value="'.$values{'lifetime'}.'" size="3"'.$disabled.' /></span>'; |
|
if ($ltiauth) { |
|
$datatable .= (' 'x2).'<span class="LC_nobreak">'.$desc{'requser'}.'?'. |
|
'<label><input type="radio" name="linkprot_requser_'.$i.'" value="0"'. |
|
$onclickrequser.$checkedrequser{'no'}.$disabled.' />'.&mt('No').'</label> '. |
|
'<label><input type="radio" name="linkprot_requser_'.$i.'" value="1"'. |
|
$onclickrequser.$checkedrequser{'yes'}.$disabled.' />'.&mt('Yes').'</label></span>'; |
|
} |
|
$datatable .= '<br /><br />'; |
if ($values{'key'} ne '') { |
if ($values{'key'} ne '') { |
$datatable .= '<span class="LC_nobreak">'.$desc{'key'}; |
$datatable .= '<span class="LC_nobreak">'.$desc{'key'}; |
if ($noedit) { |
if ($noedit) { |
Line 7085 sub print_linkprotection {
|
Line 5745 sub print_linkprotection {
|
$datatable .= '<div id="linkprot_divcurrsecret_'.$i.'" style="display:inline-block" /><span class="LC_nobreak">'. |
$datatable .= '<div id="linkprot_divcurrsecret_'.$i.'" style="display:inline-block" /><span class="LC_nobreak">'. |
$desc{'secret'}.': ['.&mt('not shown').'] '.(' 'x2).'</span></div>'. |
$desc{'secret'}.': ['.&mt('not shown').'] '.(' 'x2).'</span></div>'. |
'<span class="LC_nobreak">'.&mt('Change secret?'). |
'<span class="LC_nobreak">'.&mt('Change secret?'). |
'<label><input type="radio" value="0" name="linkprot_changesecret_'.$i.'" onclick="javascript:toggleChgSecret(this.form,'."'$i','secret','linkprot'".');" checked="checked"'.$disabled.' />'.&mt('No').'</label>'. |
'<label><input type="radio" value="0" name="linkprot_changesecret_'.$i.'" onclick="javascript:toggleLinkProt(this.form,'."'$i','secret'".');" checked="checked"'.$disabled.' />'.&mt('No').'</label>'. |
(' 'x2). |
(' 'x2). |
'<label><input type="radio" value="1" name="linkprot_changesecret_'.$i.'" onclick="javascript:toggleChgSecret(this.form,'."'$i','secret','linkprot'".');" '.$disabled.' />'.&mt('Yes').'</label>'.(' 'x2). |
'<label><input type="radio" value="1" name="linkprot_changesecret_'.$i.'" onclick="javascript:toggleLinkProt(this.form,'."'$i','secret'".');" '.$disabled.' />'.&mt('Yes').'</label>'.(' 'x2). |
'</span><div id="linkprot_divchgsecret_'.$i.'" style="display:none" />'. |
'</span><div id="linkprot_divchgsecret_'.$i.'" style="display:none" />'. |
'<span class="LC_nobreak"> - '.$switchmessage.'</span>'. |
'<span class="LC_nobreak"> - '.$switchmessage.'</span>'. |
'</div>'; |
'</div>'; |
Line 7096 sub print_linkprotection {
|
Line 5756 sub print_linkprotection {
|
} else { |
} else { |
$datatable .= '<span class="LC_nobreak">'.&mt('Secret required').' - '.$switchmessage.'</span>'."\n"; |
$datatable .= '<span class="LC_nobreak">'.&mt('Secret required').' - '.$switchmessage.'</span>'."\n"; |
} |
} |
$datatable .= '<input type="hidden" name="linkprot_id_'.$i.'" value="'.$num.'" />'; |
|
} else { |
} else { |
if ($values{'usable'} ne '') { |
if ($values{'usable'} ne '') { |
$datatable .= '<div id="linkprot_divcurrsecret_'.$i.'" style="display:inline-block" /><span class="LC_nobreak">'. |
$datatable .= '<div id="linkprot_divcurrsecret_'.$i.'" style="display:inline-block" /><span class="LC_nobreak">'. |
$desc{'secret'}.': ['.&mt('not shown').'] '.(' 'x2).'</span></div>'. |
$desc{'secret'}.': ['.&mt('not shown').'] '.(' 'x2).'</span></div>'. |
'<span class="LC_nobreak">'.&mt('Change?'). |
'<span class="LC_nobreak">'.&mt('Change?'). |
'<label><input type="radio" value="0" name="linkprot_changesecret_'.$i.'" onclick="javascript:toggleChgSecret(this.form,'."'$i','secret','linkprot'".');" checked="checked"'.$disabled.' />'.&mt('No').'</label>'. |
'<label><input type="radio" value="0" name="linkprot_changesecret_'.$i.'" onclick="javascript:toggleLinkProt(this.form,'."'$i','secret'".');" checked="checked"'.$disabled.' />'.&mt('No').'</label>'. |
(' 'x2). |
(' 'x2). |
'<label><input type="radio" value="1" name="linkprot_changesecret_'.$i.'" onclick="javascript:toggleChgSecret(this.form,'."'$i','secret','linkprot'".');"'.$disabled.' />'.&mt('Yes'). |
'<label><input type="radio" value="1" name="linkprot_changesecret_'.$i.'" onclick="javascript:toggleLinkProt(this.form,'."'$i','secret'".');"'.$disabled.' />'.&mt('Yes'). |
'</label> </span><div id="linkprot_divchgsecret_'.$i.'" style="display:none" />'. |
'</label> </span><div id="linkprot_divchgsecret_'.$i.'" style="display:none" />'. |
'<span class="LC_nobreak">'.&mt('New Secret').':'. |
'<span class="LC_nobreak">'.&mt('New Secret').':'. |
'<input type="password" size="20" name="linkprot_secret_'.$i.'" value="" autocomplete="new-password"'.$disabled.' />'. |
'<input type="password" size="20" name="linkprot_secret_'.$i.'" value="" autocomplete="off"'.$disabled.' />'. |
'<label><input type="checkbox" name="linkprot_visible_'.$i.'" id="linkprot_visible_'.$i.'" onclick="if (this.checked) { this.form.linkprot_secret_'.$i.'.type='."'text'".' } else { this.form.linkprot_secret_'.$i.'.type='."'password'".' }"'.$disabled.' />'.&mt('Visible input').'</label>'. |
'<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'".' }"'.$disabled.' />'.&mt('Visible input').'</label>'. |
'<input type="hidden" name="linkprot_id_'.$i.'" value="'.$num.'" /></span></div>'; |
'<input type="hidden" name="linkprot_id_'.$i.'" value="'.$num.'" /></span></div>'; |
} else { |
} else { |
$datatable .= |
$datatable .= |
'<span class="LC_nobreak">'.$desc{'secret'}.':'. |
'<span class="LC_nobreak">'.$desc{'secret'}.':'. |
'<input type="password" size="20" name="linkprot_secret_'.$i.'" value="" autocomplete="new-password"'.$disabled.' />'. |
'<input type="password" size="20" name="linkprot_secret_'.$i.'" value="" autocomplete="off"'.$disabled.' />'. |
'<label><input type="checkbox" name="linkprot_visible_'.$i.'" id="linkprot_visible_'.$i.'" onclick="if (this.checked) { this.form.linkprot_secret_'.$i.'.type='."'text'".' } else { this.form.linkprot_secret_'.$i.'.type='."'password'".' }"'.$disabled.' />'.&mt('Visible input').'</label>'. |
'<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'".' }"'.$disabled.' />'.&mt('Visible input').'</label>'. |
'<input type="hidden" name="linkprot_id_'.$i.'" value="'.$num.'" /></span>'; |
'<input type="hidden" name="linkprot_id_'.$i.'" value="'.$num.'" /></span>'; |
} |
} |
} |
} |
$datatable .= '<br /><br />'. |
|
'<span class="LC_nobreak">'.$desc{'passback'}.'?'. |
|
'<label><input type="radio" name="linkprot_passback_'.$i.'" value="0"'. |
|
$onclickpassback.$checkedpassback{'no'}.$disabled.' />'.&mt('No').'</label> '. |
|
'<label><input type="radio" name="linkprot_passback_'.$i.'" value="1"'. |
|
$onclickpassback.$checkedpassback{'yes'}.$disabled.' />'.&mt('Yes').'</label></span><br />'. |
|
'<div id="linkprot_passbackparam_'.$i.'" class="LC_floatleft" style="display:'.$passbacksty.'" />'. |
|
'<span class="LC_nobreak">'.&mt('Grade format'). |
|
'<label><input type="radio" name="linkprot_passbackformat_'.$i.'" value="1.1"'.$checkedpassbackfmt{'1p1'}.' />'. |
|
&mt('Outcomes Service (1.1)').'</label>'.(' 'x2). |
|
'<label><input type="radio" name="linkprot_passbackformat_'.$i.'" value="1.0"'.$checkedpassbackfmt{'1p0'}.'/>'. |
|
&mt('Outcomes Extension (1.0)').'</label></span></div>'. |
|
'<div style="padding:0;clear:both;margin:0;border:0"></div>'. |
|
'<br />'. |
|
'<span class="LC_nobreak">'.$desc{'returnurl'}.'?'. |
|
'<label><input type="radio" name="linkprot_returnurl_'.$i.'" value="0"'. |
|
$onclickreturnurl.$checkedreturnurl{'no'}.$disabled.' />'.&mt('No').'</label> '. |
|
'<label><input type="radio" name="linkprot_returnurl_'.$i.'" value="1"'. |
|
$onclickreturnurl.$checkedreturnurl{'yes'}.$disabled.' />'.&mt('Yes').'</label></span>'. |
|
' </span><div id="linkprot_divurlparam_'.$i.'" style="display:none" />'. |
|
'<span class="LC_nobreak">'.&mt('Parameter name').':'. |
|
'<input type="text" size="15" name="linkprot_urlparam_'.$i.'" value="'.$values{'returnurl'}.'" autocomplete="off"'.$disabled.' />'. |
|
'</span></div> '; |
|
if ($ltiauth) { |
if ($ltiauth) { |
$datatable .= (' 'x2).'<span class="LC_nobreak">'.$desc{'requser'}.'?'. |
$datatable .= |
'<label><input type="radio" name="linkprot_requser_'.$i.'" value="0"'. |
|
$onclickrequser.$checkedrequser{'no'}.$disabled.' />'.&mt('No').'</label> '. |
|
'<label><input type="radio" name="linkprot_requser_'.$i.'" value="1"'. |
|
$onclickrequser.$checkedrequser{'yes'}.$disabled.' />'.&mt('Yes').'</label></span>'. |
|
'</fieldset>'. |
'</fieldset>'. |
'<fieldset id="linkprot_optional_'.$i.'" style="'.$usersty.'"><legend>'.$lt{'opti'}.'</legend>'. |
'<fieldset id="linkprot_optional_'.$i.'" style="'.$usersty.'"><legend>'.$lt{'opti'}.'</legend>'. |
&linkprot_options($i,$itemcount,$disabled,\%values,\%desc). |
&linkprot_options($i,$itemcount,$disabled,\%values,\%desc). |
Line 7161 sub print_linkprotection {
|
Line 5793 sub print_linkprotection {
|
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">'."\n". |
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">'."\n". |
'<input type="hidden" name="linkprot_maxnum" value="'.$next.'" />'."\n". |
'<input type="hidden" name="linkprot_maxnum" value="'.$next.'" />'."\n". |
'<input type="checkbox" name="linkprot_add" value="1"'.$disabled.' />'.&mt('Add').'</span></td>'."\n". |
'<input type="checkbox" name="linkprot_add" value="1"'.$disabled.' />'.&mt('Add').'</span></td>'."\n". |
'<td width="100%">'; |
'<td>'; |
my ($usersty,$onclickrequser,%checkedrequser,$onclickreturnurl,%checkedreturnurl, |
my ($usersty,$onclickrequser,%checkedrequser); |
$onclickpassback,%checkedpassback,%checkedpassbackfmt); |
|
if ($ltiauth) { |
if ($ltiauth) { |
$usersty = 'display:none'; |
$usersty = 'display:none'; |
$onclickrequser = ' onclick="toggleLinkProtExtra(this.form,'."'requser','optional','1','block','add'".');"'; |
$onclickrequser = ' onclick="toggleLinkProtReqUser(this.form,'."'requser','optional','1','block','add'".');"'; |
%checkedrequser = ( |
%checkedrequser = ( |
no => ' checked="checked"', |
no => ' checked="checked"', |
yes => '', |
yes => '', |
); |
); |
$datatable .= '<fieldset><legend>'.$lt{'requ'}.'</legend>'; |
$datatable .= '<fieldset><legend>'.$lt{'requ'}.'</legend>'; |
} |
} |
$onclickpassback = ' onclick="toggleLinkProtExtra(this.form,'."'passback','passbackparam','1','inline-block','add'".');"'; |
|
%checkedpassback = ( |
|
'no' => ' checked="checked"', |
|
'yes' => '', |
|
); |
|
%checkedpassbackfmt = ( |
|
'1p1' => ' checked="checked"', |
|
'1p0' => '', |
|
); |
|
$onclickreturnurl = ' onclick="toggleLinkProtExtra(this.form,'."'returnurl','divurlparam','1','inline-block','add'".');"'; |
|
%checkedreturnurl = ( |
|
no => ' checked="checked"', |
|
yes => '', |
|
); |
|
$datatable .= '<span class="LC_nobreak">'.$desc{'name'}. |
$datatable .= '<span class="LC_nobreak">'.$desc{'name'}. |
':<input type="text" size="15" name="linkprot_name_add" value="" autocomplete="off"'.$disabled.' /></span> '."\n". |
':<input type="text" size="15" name="linkprot_name_add" value="" autocomplete="off"'.$disabled.' /></span> '."\n". |
(' 'x2). |
(' 'x2). |
'<span class="LC_nobreak">'.$desc{'version'}.':<select name="linkprot_version_add"'.$disabled.'>'. |
'<span class="LC_nobreak">'.$desc{'version'}.':<select name="linkprot_version_add"'.$disabled.'>'. |
'<option value="LTI-1p0" selected="selected">1.1</option></select></span> '."\n". |
'<option value="LTI-1p0" selected="selected">1.1</option></select></span> '."\n". |
(' 'x2). |
(' 'x2). |
'<span class="LC_nobreak">'.$desc{'lifetime'}.':<input type="text" size="3" name="linkprot_lifetime_add" value="300"'.$disabled.' /></span> '."\n". |
'<span class="LC_nobreak">'.$desc{'lifetime'}.':<input type="text" size="3" name="linkprot_lifetime_add" value="300"'.$disabled.' /></span> '."\n"; |
'<br /><br />'; |
if ($ltiauth) { |
|
$datatable .= (' 'x2).'<span class="LC_nobreak">'.$desc{'requser'}.'?'. |
|
'<label><input type="radio" name="linkprot_requser_add" value="0"'. |
|
$onclickrequser.$checkedrequser{'no'}.$disabled.' />'.&mt('No').'</label> '. |
|
'<label><input type="radio" name="linkprot_requser_add" value="1"'. |
|
$onclickrequser.$checkedrequser{'yes'}.$disabled.' />'.&mt('Yes').'</label></span>'; |
|
} |
|
$datatable .= '<br /><br />'; |
if ($switchserver) { |
if ($switchserver) { |
$datatable .= '<span class="LC_nobreak">'.&mt('Key and Secret are required').' - '.$switchmessage.'</span>'."\n"; |
$datatable .= '<span class="LC_nobreak">'.&mt('Key and Secret are required').' - '.$switchmessage.'</span>'."\n"; |
} else { |
} else { |
$datatable .= '<span class="LC_nobreak">'.$desc{'key'}.':<input type="text" size="25" name="linkprot_key_add" value="" autocomplete="off"'.$disabled.' /></span> '."\n". |
$datatable .= '<span class="LC_nobreak">'.$desc{'key'}.':<input type="text" size="25" name="linkprot_key_add" value="" autocomplete="off"'.$disabled.' /></span> '."\n". |
(' 'x2). |
(' 'x2). |
'<span class="LC_nobreak">'.$desc{'secret'}.':<input type="password" size="20" name="linkprot_secret_add" value="" autocomplete="new-password"'.$disabled.' />'. |
'<span class="LC_nobreak">'.$desc{'secret'}.':<input type="password" size="20" name="linkprot_secret_add" value="" autocomplete="off"'.$disabled.' />'. |
'<label><input type="checkbox" name="linkprot_visible_add" id="linkprot_visible_add" onclick="if (this.checked) { this.form.linkprot_secret_add.type='."'text'".' } else { this.form.linkprot_secret_add.type='."'password'".' }"'.$disabled.' />'.&mt('Visible input').'</label></span> '."\n"; |
'<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'".' }"'.$disabled.' />'.&mt('Visible input').'</label></span> '."\n"; |
} |
} |
$datatable .= '<br /><br />'. |
|
'<span class="LC_nobreak">'.$desc{'passback'}.'?'. |
|
'<label><input type="radio" name="linkprot_passback_add" value="0"'. |
|
$onclickpassback.$checkedpassback{'no'}.$disabled.' />'.&mt('No').'</label> '. |
|
'<label><input type="radio" name="linkprot_passback_add" value="1"'. |
|
$onclickpassback.$checkedpassback{'yes'}.$disabled.' />'.&mt('Yes').'</label></span>'. |
|
'<br /><div id="linkprot_passbackparam_add" class="LC_floatleft" style="display:none" />'. |
|
'<span class="LC_nobreak">'.&mt('Grade format'). |
|
'<label><input type="radio" name="linkprot_passbackformat_add" value="1.1"'.$checkedpassbackfmt{'1p1'}.$disabled.' />'. |
|
&mt('Outcomes Service (1.1)').'</label>'.(' 'x2). |
|
'<label><input type="radio" name="linkprot_passbackformat_add" value="1.0"'.$checkedpassbackfmt{'1p0'}.$disabled.' />'. |
|
&mt('Outcomes Extension (1.0)').'</label></span></div>'. |
|
'<div style="padding:0;clear:both;margin:0;border:0"></div>'. |
|
'<br />'. |
|
'<span class="LC_nobreak">'.$desc{'returnurl'}.'?'. |
|
'<label><input type="radio" name="linkprot_returnurl_add" value="0"'. |
|
$onclickreturnurl.$checkedreturnurl{'no'}.$disabled.' />'.&mt('No').'</label> '. |
|
'<label><input type="radio" name="linkprot_returnurl_add" value="1"'. |
|
$onclickreturnurl.$checkedreturnurl{'yes'}.$disabled.' />'.&mt('Yes').'</label></span>'. |
|
' </span><div id="linkprot_divurlparam_add" style="display:none" />'. |
|
'<span class="LC_nobreak">'.&mt('Parameter name').':'. |
|
'<input type="text" size="15" name="linkprot_urlparam_add" value="" autocomplete="off"'.$disabled.' />'. |
|
'</span></div> '; |
|
if ($ltiauth) { |
if ($ltiauth) { |
$datatable .= (' 'x2).'<span class="LC_nobreak">'.$desc{'requser'}.'?'. |
$datatable .= '</fieldset>'. |
'<label><input type="radio" name="linkprot_requser_add" value="0"'. |
|
$onclickrequser.$checkedrequser{'no'}.$disabled.' />'.&mt('No').'</label> '. |
|
'<label><input type="radio" name="linkprot_requser_add" value="1"'. |
|
$onclickrequser.$checkedrequser{'yes'}.$disabled.' />'.&mt('Yes').'</label></span>'. |
|
'</fieldset>'. |
|
'<fieldset id="linkprot_optional_add" style="'.$usersty.'"><legend>'.$lt{'opti'}.'</legend>'. |
'<fieldset id="linkprot_optional_add" style="'.$usersty.'"><legend>'.$lt{'opti'}.'</legend>'. |
&linkprot_options('add',$itemcount,$disabled,{},\%desc). |
&linkprot_options('add',$itemcount,$disabled,{},\%desc). |
'</fieldset>'; |
'</fieldset>'; |
Line 7249 sub linkprot_names {
|
Line 5845 sub linkprot_names {
|
'lifetime' => 'Nonce lifetime (s)', |
'lifetime' => 'Nonce lifetime (s)', |
'name' => 'Launcher Application', |
'name' => 'Launcher Application', |
'secret' => 'Secret', |
'secret' => 'Secret', |
'passback' => 'Can return grades to Launcher', |
|
'returnurl' => 'Launcher return URL', |
|
'requser' => 'Use identity', |
'requser' => 'Use identity', |
'email' => 'Email address', |
'email' => 'Email address', |
'sourcedid' => 'User ID', |
'sourcedid' => 'User ID', |
Line 7306 sub linkprot_options {
|
Line 5900 sub linkprot_options {
|
$checked{'auth'} = ' checked="checked"'; |
$checked{'auth'} = ' checked="checked"'; |
} |
} |
} |
} |
my $onclickuser = ' onclick="toggleLinkProtExtra(this.form,'."'mapuser','userfield','other','inline-block','$num'".');"'; |
my $onclickuser = ' onclick="toggleLinkProtReqUser(this.form,'."'mapuser','userfield','other','inline-block','$num'".');"'; |
my $output = '<div class="LC_floatleft"><span class="LC_nobreak">'. |
my $output = '<div class="LC_floatleft"><span class="LC_nobreak">'. |
&mt('Source of LON-CAPA username in LTI request').': '; |
&mt('Source of LON-CAPA username in LTI request').': '; |
foreach my $option ('sourcedid','email','other') { |
foreach my $option ('sourcedid','email','other') { |
Line 7330 sub linkprot_options {
|
Line 5924 sub linkprot_options {
|
return $output; |
return $output; |
} |
} |
|
|
sub print_extresource_row { |
|
my ($item,$config,$curr,$noedit) = @_; |
|
my $onchange; |
|
unless ($noedit) { |
|
$onchange = ' onchange="javascript:toggleExtRes();"'; |
|
} |
|
my $id = 'LC_'.$item; |
|
my ($selected,$reuse,$width,$height) = split(/:/,$curr); |
|
my $output = &select_from_options($item,$config->{'order'}, |
|
$config->{'options'},$selected, |
|
$config->{'nullval'}, |
|
undef,undef,$onchange,$noedit,$id); |
|
my ($checked,$reusesty,$sizesty); |
|
if ($reuse) { |
|
$checked = ' checked="checked"'; |
|
} |
|
$reusesty = 'none'; |
|
$sizesty = 'none'; |
|
if (($selected eq 'window') || ($selected eq 'tab')) { |
|
$reusesty = 'inline-block'; |
|
if ($selected eq 'window') { |
|
$sizesty = 'inline-block'; |
|
} |
|
} |
|
$output .= '<div id="LC_extresreusediv" style="display:'.$reusesty.';">'. |
|
'<span class="LC_nobreak">'. |
|
'<label><input type="checkbox" name="extwintabreuse" value="1"'.$checked.'>'. |
|
&mt('Re-use tab/window').'</label>'. |
|
'</span></div>'. |
|
'<fieldset id="LC_extressize" style="display:'.$sizesty.';">'. |
|
'<legend>'.&mt('Window size (optional)').'</legend>'. |
|
'<span class="LC_nobreak">'. |
|
&mt('width').':<input type="text" name="extreswinwidth" value="'.$width.'" size="3" />px'. |
|
(' ' x 3). |
|
&mt('height').':<input type="text" name="extreswinheight" value="'.$height.'" size="3" />px'. |
|
'</span></fieldset>'; |
|
return $output; |
|
} |
|
|
|
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 7446 sub item_table_row_end {
|
Line 6001 sub item_table_row_end {
|
} |
} |
|
|
sub yesno_radio { |
sub yesno_radio { |
my ($item,$settings,$unsetdefault,$valueyes,$valueno,$noedit,$onclick,$reverse) = @_; |
my ($item,$settings,$unsetdefault,$valueyes,$valueno,$noedit) = @_; |
my $itemon = ' '; |
my $itemon = ' '; |
my $itemoff = ' checked="checked" '; |
my $itemoff = ' checked="checked" '; |
if (($valueyes eq '') && ($valueno eq '')) { |
if (($valueyes eq '') && ($valueno eq '')) { |
Line 7468 sub yesno_radio {
|
Line 6023 sub yesno_radio {
|
my $disabled; |
my $disabled; |
if ($noedit) { |
if ($noedit) { |
$disabled = ' disabled="disabled"'; |
$disabled = ' disabled="disabled"'; |
} elsif ($onclick) { |
|
$onclick = ' onclick="'.$onclick.'"'; |
|
} |
|
if ($reverse) { |
|
return '<span class="LC_nobreak"><label>'. |
|
'<input type="radio" name="'.$item.'"'. |
|
$itemoff.' value="'.$valueno.'"'.$disabled.$onclick.' />'.&mt('No').'</label> '. |
|
'<label><input type="radio" name="'.$item.'"'. |
|
$itemon.' value="'.$valueyes.'"'.$disabled.$onclick.' />'.&mt('Yes').'</label></span>'; |
|
} else { |
|
return '<span class="LC_nobreak"><label>'. |
|
'<input type="radio" name="'.$item.'"'. |
|
$itemon.' value="'.$valueyes.'"'.$disabled.$onclick.' />'.&mt('Yes').'</label> '. |
|
'<label><input type="radio" name="'.$item.'"'. |
|
$itemoff.' value="'.$valueno.'"'.$disabled.$onclick.' />'.&mt('No').'</label></span>'; |
|
} |
} |
|
return '<span class="LC_nobreak"><label>'. |
|
'<input type="radio" name="'.$item.'"'. |
|
$itemon.' value="'.$valueyes.'"'.$disabled.' />'.&mt('Yes').'</label> '. |
|
'<label><input type="radio" name="'.$item.'"'. |
|
$itemoff.' value="'.$valueno.'"'.$disabled.' />'.&mt('No').'</label></span>'; |
} |
} |
|
|
sub select_from_options { |
sub select_from_options { |
Line 7539 sub select_from_options {
|
Line 6084 sub select_from_options {
|
} |
} |
|
|
sub make_item_rows { |
sub make_item_rows { |
my ($cdom,$items,$ordered,$settings,$rowtotal,$crstype,$caller,$noedit,$cnum) = @_; |
my ($cdom,$items,$ordered,$settings,$rowtotal,$crstype,$caller,$noedit) = @_; |
my $datatable; |
my $datatable; |
if ((ref($items) eq 'HASH') && (ref($ordered) eq 'ARRAY')) { |
if ((ref($items) eq 'HASH') && (ref($ordered) eq 'ARRAY')) { |
my $count = 0; |
my $count = 0; |
Line 7550 sub make_item_rows {
|
Line 6095 sub make_item_rows {
|
(($caller eq 'printouts') && ($item ne 'print_header_format'))) { |
(($caller eq 'printouts') && ($item ne 'print_header_format'))) { |
$colspan = 2; |
$colspan = 2; |
} |
} |
my $rowdesc; |
|
if ($caller eq 'appearance') { |
|
$rowdesc = '<span class="LC_nobreak">'.$items->{$item}{text}.'</span>'; |
|
} else { |
|
$rowdesc = $items->{$item}{text}; |
|
} |
|
if (exists $items->{$item}{advanced} && $items->{$item}{advanced} == 1) { |
if (exists $items->{$item}{advanced} && $items->{$item}{advanced} == 1) { |
$datatable .= &item_table_row_start($rowdesc,$count,"advanced",$colspan); |
$datatable .= &item_table_row_start($items->{$item}{text},$count,"advanced",$colspan); |
} else { |
} else { |
$datatable .= &item_table_row_start($rowdesc,$count,undef,$colspan); |
$datatable .= &item_table_row_start($items->{$item}{text},$count,undef,$colspan); |
} |
} |
if ($item eq 'defaultcredits') { |
if ($item eq 'defaultcredits') { |
my $defaultcredits = $env{'course.'.$env{'request.course.id'}.'.internal.defaultcredits'}; |
my $defaultcredits = $env{'course.'.$env{'request.course.id'}.'.internal.defaultcredits'}; |
Line 7576 sub make_item_rows {
|
Line 6115 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 'extresource') { |
} elsif ($item eq 'lti.lcmenu') { |
$datatable .= &print_extresource_row($item,$items->{$item},$settings->{$item},$noedit); |
$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 7595 sub make_item_rows {
|
Line 6134 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,$onchange); |
my $id; |
if ($caller eq 'menuitems') { |
if ($caller eq 'menuitems') { |
$id = $item; |
$id = $item; |
} elsif ($caller eq 'grading') { |
|
if ($item eq 'grading') { |
|
$onchange = ' onchange="javascript:toggleGrading(this.form);"'; |
|
$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,$onchange,$noedit,$id); |
undef,undef,undef,$noedit,$id); |
if ($item eq 'grading') { |
|
my ($unsetdefault,$valueyes,$valueno,$sectionbox); |
|
my $gradingsty = 'none'; |
|
my $gradingsecsty = 'none'; |
|
$unsetdefault = 0; |
|
my (@selsec,@sections,%current); |
|
if ($curr eq 'standard') { |
|
$gradingsty = 'inline-block'; |
|
if (ref($settings) eq 'HASH') { |
|
$current{'hidetotals'} = $settings->{'hidetotals'}; |
|
if ($settings->{'hidetotals'} =~ /^([\w,]+)$/) { |
|
my $secstr = $1; |
|
unless ($secstr eq 'all') { |
|
@selsec = split(/,/,$secstr); |
|
} |
|
$current{'hidetotals'} = 1; |
|
} |
|
} |
|
} |
|
$valueyes = "1"; |
|
$valueno = "0"; |
|
my %sections = &Apache::loncommon::get_sections($cdom,$cnum); |
|
if (keys(%sections)) { |
|
@sections = sort( { $a <=> $b } keys(%sections)); |
|
} |
|
my $onclick = 'javascript:toggleHiddenTotalsSec(this.form);'; |
|
my $sectionbox = '<div id="sectotalsdiv" style="display:'.$gradingsecsty.'; float:right">'; |
|
my $reverse = 1; |
|
if (@sections) { |
|
$sectionbox .= ' ... '.&mt('hidden in sections').': '. |
|
'<div style="position: relative; top: 0%;">'. |
|
&select_sections('hidetotals','',\@sections,\@selsec,$noedit,'all'). |
|
'</div>'; |
|
} |
|
$sectionbox .= '</div>'; |
|
$datatable .= '<fieldset id="hidetotalsdiv" style="display:'.$gradingsty.';">'. |
|
'<legend style="font-weight: normal;">'. |
|
&mt('Hide Course Points Totals').'</legend>'. |
|
'<div style="position: relative; top: 0%; float:left">'. |
|
&yesno_radio('hidetotals',\%current,$unsetdefault,$valueyes,$valueno,$noedit, |
|
$onclick,$reverse).'</div>'. |
|
$sectionbox. |
|
'</fieldset><div style="padding:0;clear:both;margin:0;border:0"></div>'; |
|
} |
|
} elsif ($items->{$item}{input} eq 'textbox') { |
} elsif ($items->{$item}{input} eq 'textbox') { |
my $disabled; |
my $disabled; |
if ($noedit) { |
if ($noedit) { |
Line 7691 sub nothidepriv_row {
|
Line 6183 sub nothidepriv_row {
|
} |
} |
} |
} |
if ($settings->{'checkforpriv'}) { |
if ($settings->{'checkforpriv'}) { |
@checkdoms = split(/,/,$settings->{'checkforpriv'}); |
@checkdoms = split(/,/,$settings->{'checkforpriv'}); |
} |
} |
} |
} |
push(@checkdoms,$cdom); |
push(@checkdoms,$cdom); |
Line 7705 sub nothidepriv_row {
|
Line 6197 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 7781 sub checkforpriv_row {
|
Line 6273 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 7793 sub checkforpriv_row {
|
Line 6285 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 7913 ENDJS
|
Line 6405 ENDJS
|
} |
} |
} |
} |
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">'. |
Line 8051 sub change_clone {
|
Line 6543 sub change_clone {
|
} |
} |
} |
} |
} |
} |
return; |
|
} |
|
|
|
sub devalidate_remote_courseprefs { |
|
my ($cdom,$cnum,$cachekeys) = @_; |
|
return unless (ref($cachekeys) eq 'HASH'); |
|
my %servers = &Apache::lonnet::internet_dom_servers($cdom); |
|
my %thismachine; |
|
map { $thismachine{$_} = 1; } &Apache::lonnet::current_machine_ids(); |
|
my @posscached = ('courselti','courseltitools'); |
|
if (keys(%servers)) { |
|
foreach my $server (keys(%servers)) { |
|
next if ($thismachine{$server}); |
|
my @cached; |
|
foreach my $name (@posscached) { |
|
if ($cachekeys->{$name}) { |
|
push(@cached,&escape($name).':'.&escape($cdom.'_'.$cnum)); |
|
} |
|
} |
|
if (@cached) { |
|
&Apache::lonnet::remote_devalidate_cache($server,\@cached); |
|
} |
|
} |
|
} |
|
return; |
return; |
} |
} |
|
|