version 1.108, 2022/04/05 12:27:39
|
version 1.123, 2023/06/03 03:32:16
|
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 yes_no_radio() |
=item yesno_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 293 sub handler {
|
Line 294 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 => 'Timezone where the community is located', |
time => 'Time Zone 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 322 sub handler {
|
Line 323 sub handler {
|
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 => 'Timezone in which the course takes place', |
time => 'Time Zone 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 372 sub handler {
|
Line 373 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 389 sub handler {
|
Line 392 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','linkprot','spreadsheet','bridgetasks', |
'menuitems','ltitools','linkprot','spreadsheet', |
'lti','other'); |
'bridgetasks','lti','other'); |
|
|
my %prefs = ( |
my %prefs = ( |
'courseinfo' => |
'courseinfo' => |
{ text => $lt{'gens'}, |
{ text => $lt{'gens'}, |
Line 492 sub handler {
|
Line 511 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','inline_chem'], |
'tthoptions','uselcmath','usejsme', |
|
'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 502 sub handler {
|
Line 522 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 591 sub handler {
|
Line 612 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 798 sub print_config_box {
|
Line 827 sub print_config_box {
|
$output .= &print_spreadsheet($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype,$noedit); |
$output .= &print_spreadsheet($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype,$noedit); |
} elsif ($action eq 'bridgetasks') { |
} elsif ($action eq 'bridgetasks') { |
$output .= &print_bridgetasks($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype,$noedit); |
$output .= &print_bridgetasks($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype,$noedit); |
|
} elsif ($action eq 'ltitools') { |
|
my $currtools = {}; |
|
if ((ref($settings) eq 'HASH') && (ref($settings->{'ltitools'}))) { |
|
$currtools = $settings->{'ltitools'}; |
|
} |
|
$output .= &print_ltitools($cdom,$cnum,$currtools,\$rowtotal,$crstype,$noedit,'course'); |
} elsif ($action eq 'lti') { |
} elsif ($action eq 'lti') { |
$output .= &print_lti($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype,$noedit); |
$output .= &print_lti($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype,$noedit); |
} elsif ($action eq 'menuitems') { |
} elsif ($action eq 'menuitems') { |
Line 834 sub process_changes {
|
Line 869 sub process_changes {
|
} |
} |
} |
} |
} |
} |
} elsif ($action eq 'linkprot') { |
} elsif (($action eq 'linkprot') || ($action eq 'ltitools')) { |
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 843 sub process_changes {
|
Line 878 sub process_changes {
|
} |
} |
} |
} |
@ordered = sort { $a <=> $b } @ordered; |
@ordered = sort { $a <=> $b } @ordered; |
if (($env{'form.linkprot_add'}) && ($env{'form.linkprot_maxnum'} =~ /^\d+$/)) { |
if (($env{'form.'.$action.'_add'}) && ($env{'form.'.$action.'_maxnum'} =~ /^\d+$/)) { |
push(@ordered,$env{'form.linkprot_maxnum'}); |
push(@ordered,$env{'form.'.$action.'_maxnum'}); |
} |
} |
} elsif (ref($item->{'ordered'}) eq 'ARRAY') { |
} elsif (ref($item->{'ordered'}) eq 'ARRAY') { |
if ($action eq 'courseinfo') { |
if ($action eq 'courseinfo') { |
Line 987 sub process_changes {
|
Line 1022 sub process_changes {
|
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',$lastactref); |
} |
} |
|
} 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) { |
if ($entry eq 'cloners') { |
if ($entry eq 'cloners') { |
Line 1464 sub process_changes {
|
Line 1505 sub process_changes {
|
$newvalues{$entry} = ''; |
$newvalues{$entry} = ''; |
} |
} |
} |
} |
|
} elsif ($entry eq 'extresource') { |
|
if ($env{'form.'.$entry} =~ /^iframe|tab|window$/) { |
|
$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}; |
|
if ($newvalues{$entry} ne $values->{$entry}) { |
|
$changes->{$entry} = $newvalues{$entry}; |
|
} |
|
if ($env{'form.tzover'}) { |
|
$newvalues{'tzover'} = $env{'form.tzover'}; |
|
if ($newvalues{'tzover'} ne $values->{'tzover'}) { |
|
$changes->{'tzover'} = $newvalues{'tzover'}; |
|
} |
|
} elsif ($values->{'tzover'}) { |
|
$changes->{'tzover'} = ''; |
|
} |
|
} elsif ($values->{$entry}) { |
|
$changes->{$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 1482 sub process_changes {
|
Line 1567 sub process_changes {
|
|
|
sub process_linkprot { |
sub process_linkprot { |
my ($cdom,$cnum,$values,$changes,$context,$lastactref) = @_; |
my ($cdom,$cnum,$values,$changes,$context,$lastactref) = @_; |
my ($home,$dest,$ltiauth,$privkey,$privnum,$cipher,$errors,%linkprot); |
my ($dest,$ltiauth,$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 1492 sub process_linkprot {
|
Line 1577 sub process_linkprot {
|
} |
} |
} |
} |
} |
} |
my %domdefs = &Apache::lonnet::get_domain_defaults($cdom); |
($cipher,$privnum) = &get_credentials($cdom,$cnum,'lti',$context); |
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 1548 sub process_linkprot {
|
Line 1609 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 1593 sub process_linkprot {
|
Line 1654 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 1678 sub process_linkprot {
|
Line 1772 sub process_linkprot {
|
$changes->{$entry} = $linkprot{$entry}; |
$changes->{$entry} = $linkprot{$entry}; |
} |
} |
if (ref($lastactref) eq 'HASH') { |
if (ref($lastactref) eq 'HASH') { |
$lastactref->{'courselti'} = 1'; |
$lastactref->{'courselti'} = 1; |
} |
} |
} |
} |
return $errors; |
return $errors; |
Line 1753 sub get_linkprot_id {
|
Line 1847 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) = &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 get_ltitools_id { |
|
my ($context,$cdom,$cnum,$title) = @_; |
|
my ($lockhash,$tries,$gotlock,$id,$error); |
|
|
|
# get lock on ltitools db |
|
$lockhash = { |
|
lock => $env{'user.name'}. |
|
':'.$env{'user.domain'}, |
|
}; |
|
$tries = 0; |
|
if ($context eq 'domain') { |
|
$gotlock = &Apache::lonnet::newput_dom('ltitools',$lockhash,$cdom); |
|
} else { |
|
$gotlock = &Apache::lonnet::newput('ltitools',$lockhash,$cdom,$cnum); |
|
} |
|
while (($gotlock ne 'ok') && ($tries<10)) { |
|
$tries ++; |
|
sleep (0.1); |
|
if ($context eq 'domain') { |
|
$gotlock = &Apache::lonnet::newput_dom('ltitools',$lockhash,$cdom); |
|
} else { |
|
$gotlock = &Apache::lonnet::newput('ltitools',$lockhash,$cdom,$cnum); |
|
} |
|
} |
|
if ($gotlock eq 'ok') { |
|
my %currids; |
|
if ($context eq 'domain') { |
|
%currids = &Apache::lonnet::dump_dom('ltitools',$cdom); |
|
} else { |
|
%currids = &Apache::lonnet::dump('ltitools',$cdom,$cnum); |
|
} |
|
if ($currids{'lock'}) { |
|
delete($currids{'lock'}); |
|
if (keys(%currids)) { |
|
my @curr = sort { $a <=> $b } keys(%currids); |
|
if ($curr[-1] =~ /^\d+$/) { |
|
$id = 1 + $curr[-1]; |
|
} |
|
} else { |
|
$id = 1; |
|
} |
|
if ($id) { |
|
if ($context eq 'domain') { |
|
unless (&Apache::lonnet::newput_dom('ltitools',{ $id => $title },$cdom) eq 'ok') { |
|
$error = 'nostore'; |
|
} |
|
} else { |
|
unless (&Apache::lonnet::newput('ltitools',{ $id => $title },$cdom,$cnum) eq 'ok') { |
|
$error = 'nostore'; |
|
} |
|
} |
|
} else { |
|
$error = 'nonumber'; |
|
} |
|
} |
|
my $dellockoutcome; |
|
if ($context eq 'domain') { |
|
$dellockoutcome = &Apache::lonnet::del_dom('ltitools',['lock'],$cdom); |
|
} else { |
|
$dellockoutcome = &Apache::lonnet::del('ltitools',['lock'],$cdom,$cnum); |
|
} |
|
} else { |
|
$error = 'nolock'; |
|
} |
|
return ($id,$error); |
|
} |
|
|
|
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 1795 sub check_clone {
|
Line 2554 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); |
my (%storehash,@delkeys,@need_env_update,@oldcloner,%oldlinkprot,%oldltitools); |
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 1815 sub store_changes {
|
Line 2577 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 1851 sub store_changes {
|
Line 2615 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 1882 sub store_changes {
|
Line 2648 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')) { |
unless (($key eq 'co-owners') || ($key eq 'discussion_post_fonts') || ($key eq 'extresource')) { |
$displayval = $changes->{$item}{$key}; |
$displayval = $changes->{$item}{$key}; |
} |
} |
if ($item eq 'feedback') { |
if ($item eq 'feedback') { |
Line 2012 sub store_changes {
|
Line 2818 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 2083 sub store_changes {
|
Line 2920 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>', |
'<i>'.$displayname.'</i>',$displayval)); |
"'<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 2213 sub store_linkprot {
|
Line 3052 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 2263 sub store_linkprot {
|
Line 3105 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') { |
foreach my $title ('name','lifetime','version','key','secret','returnurl','passbackformat') { |
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 2279 sub store_linkprot {
|
Line 3121 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 2335 sub store_linkprot {
|
Line 3187 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 2467 sub get_course {
|
Line 3527 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); |
my ($jscript,$categorize_js,$loncaparev_js,$instcode_js,$extresource_js,$localization_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 2674 function toggleAddmenucoll() {
|
Line 3739 function toggleAddmenucoll() {
|
} |
} |
ENDSCRIPT |
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. |
$cloners_js."\n".$instcode_js."\n".$localization_js."\n". |
$syllabus_js."\n".$menuitems_js."\n". |
$syllabus_js."\n".$menuitems_js."\n".$extresource_js."\n". |
&linkprot_javascript()."\n".'//]]>'."\n". |
&linkprot_javascript()."\n".'//]]>'."\n". |
'</script>'."\n".$stubrowse_js."\n"; |
'</script>'."\n".$stubrowse_js."\n".$ltitools_js."\n"; |
return $jscript; |
return $jscript; |
} |
} |
|
|
Line 2767 ENDSCRIPT
|
Line 3874 ENDSCRIPT
|
|
|
sub linkprot_javascript { |
sub linkprot_javascript { |
return <<"ENDSCRIPT"; |
return <<"ENDSCRIPT"; |
function toggleLinkProt(form,num,item) { |
function toggleLinkProtExtra(form,item,extra,valon,styleon,num) { |
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 2824 function toggleLinkProtReqUser(form,item
|
Line 3899 function toggleLinkProtReqUser(form,item
|
return; |
return; |
} |
} |
|
|
function uncheckLinkProtMakeVis(item,num) { |
|
if (document.getElementById('linkprot_'+item+'_'+num)) { |
|
var currtype = document.getElementById('linkprot_'+item+'_'+num).type; |
|
if (currtype.toLowerCase() == 'checkbox') { |
|
document.getElementById('linkprot_'+item+'_'+num).checked = false; |
|
} |
|
} |
|
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 3822 sub display_loncaparev_constraints {
|
Line 4887 sub display_loncaparev_constraints {
|
} |
} |
} |
} |
} |
} |
my $suppmap = 'supplemental.sequence'; |
my $supptools = &Apache::lonnet::count_supptools($cnum,$cdom,1,1); |
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 4332 sub print_localization {
|
Line 5394 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,undef, |
&Apache::loncommon::select_timezone($item,$timezone,$onchange, |
$includeempty,$disabled); |
$includeempty,$id,$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 5053 sub print_appearance {
|
Line 6129 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); |
} |
} |
Line 5244 sub print_bridgetasks {
|
Line 6330 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 { |
|
my ($cdom,$cnum,$settings,$rowtotal,$crstype,$noedit,$context) = @_; |
|
my ($datatable,$disabled,$css_class,$dest); |
|
if ($noedit) { |
|
$disabled = ' disabled="disabled"'; |
|
} |
|
my $itemcount = 1; |
|
unless ($context eq 'domain') { |
|
my %tooltypes = &Apache::loncommon::usable_exttools(); |
|
unless ($tooltypes{'crs'}) { |
|
my $showtype = 'course'; |
|
if ($crstype eq 'Community') { |
|
$showtype = lc($crstype); |
|
} |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
$datatable = '<tr '.$css_class.'><td colspan="2">'. |
|
&mt("Definition of external tools is not enabled for this $showtype.").'<br />'; |
|
if ($tooltypes{'dom'}) { |
|
$datatable .= &mt("Contact an administrator for the $showtype domain ([_1]) to request this feature be enabled.", |
|
'<i>'.$cdom.'</i>'). |
|
'<br /><br />'. |
|
&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."); |
|
} else { |
|
$datatable .= &mt("Use of external tools defined at a domain level is not enabled, either, for this $showtype."). |
|
'<br /><br />'. |
|
&mt("Contact an administrator for the $showtype domain ([_1]) to request changes.", |
|
'<i>'.$cdom.'</i>'); |
|
|
|
} |
|
$datatable .= '</tr>'; |
|
$itemcount ++; |
|
return $datatable; |
|
} |
|
} |
|
my %lt = <itools_names(); |
|
my $maxnum = 0; |
|
my %ordered; |
|
if (ref($settings) eq 'HASH') { |
|
foreach my $item (keys(%{$settings})) { |
|
if (ref($settings->{$item}) eq 'HASH') { |
|
my $num = $settings->{$item}{'order'}; |
|
$ordered{$num} = $item; |
|
} |
|
} |
|
} |
|
|
|
if ($context eq 'domain') { |
|
$dest = '/adm/domainprefs'; |
|
} else { |
|
$dest = '/adm/courseprefs'; |
|
} |
|
my ($switchserver,$switchmessage); |
|
$switchserver = &check_switchserver($cdom,$cnum,$context,$dest); |
|
if ($switchserver) { |
|
if ($context eq 'domain') { |
|
$switchmessage = &mt("submit from domain's primary library server: [_1].",$switchserver); |
|
} 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 @courseroles = ('cc','in','ta','ep','st'); |
|
my @ltiroles = qw(Instructor ContentDeveloper TeachingAssistant Learner); |
|
my @fields = ('fullname','firstname','lastname','email','roles','user'); |
|
if (keys(%ordered)) { |
|
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 ++; |
|
} |
|
} |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
my $chgstr = ' onchange="javascript:reorderLTITools(this.form,'."'ltitools_add_pos'".');"'; |
|
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">'."\n". |
|
'<input type="hidden" name="ltitools_maxnum" value="'.$maxnum.'" />'."\n". |
|
'<select name="ltitools_add_pos"'.$chgstr.'>'; |
|
for (my $k=0; $k<$maxnum+1; $k++) { |
|
my $vpos = $k+1; |
|
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>'. |
|
'<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 print_lti { |
sub print_lti { |
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 5706 sub print_linkprotection {
|
Line 7339 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); |
my ($usersty,$onclickrequser,%checkedrequser,$onclickreturnurl,%checkedreturnurl, |
|
$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="toggleLinkProtReqUser(this.form,'."'requser','optional','1','block','$i'".');"'; |
$onclickrequser = ' onclick="toggleLinkProtExtra(this.form,'."'requser','optional','1','block','$i'".');"'; |
%checkedrequser = ( |
%checkedrequser = ( |
no => ' checked="checked"', |
no => ' checked="checked"', |
yes => '', |
yes => '', |
Line 5723 sub print_linkprotection {
|
Line 7376 sub print_linkprotection {
|
$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 5731 sub print_linkprotection {
|
Line 7393 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>'; |
' value="'.$values{'lifetime'}.'" size="3"'.$disabled.' /></span><br /><br />'; |
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 5760 sub print_linkprotection {
|
Line 7414 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:toggleLinkProt(this.form,'."'$i','secret'".');" checked="checked"'.$disabled.' />'.&mt('No').'</label>'. |
'<label><input type="radio" value="0" name="linkprot_changesecret_'.$i.'" onclick="javascript:toggleChgSecret(this.form,'."'$i','secret','linkprot'".');" checked="checked"'.$disabled.' />'.&mt('No').'</label>'. |
(' 'x2). |
(' 'x2). |
'<label><input type="radio" value="1" name="linkprot_changesecret_'.$i.'" onclick="javascript:toggleLinkProt(this.form,'."'$i','secret'".');" '.$disabled.' />'.&mt('Yes').'</label>'.(' 'x2). |
'<label><input type="radio" value="1" name="linkprot_changesecret_'.$i.'" onclick="javascript:toggleChgSecret(this.form,'."'$i','secret','linkprot'".');" '.$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 5771 sub print_linkprotection {
|
Line 7425 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:toggleLinkProt(this.form,'."'$i','secret'".');" checked="checked"'.$disabled.' />'.&mt('No').'</label>'. |
'<label><input type="radio" value="0" name="linkprot_changesecret_'.$i.'" onclick="javascript:toggleChgSecret(this.form,'."'$i','secret','linkprot'".');" checked="checked"'.$disabled.' />'.&mt('No').'</label>'. |
(' 'x2). |
(' 'x2). |
'<label><input type="radio" value="1" name="linkprot_changesecret_'.$i.'" onclick="javascript:toggleLinkProt(this.form,'."'$i','secret'".');"'.$disabled.' />'.&mt('Yes'). |
'<label><input type="radio" value="1" name="linkprot_changesecret_'.$i.'" onclick="javascript:toggleChgSecret(this.form,'."'$i','secret','linkprot'".');"'.$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="off"'.$disabled.' />'. |
'<input type="password" size="20" name="linkprot_secret_'.$i.'" value="" autocomplete="new-password"'.$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="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>'. |
'<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="off"'.$disabled.' />'. |
'<input type="password" size="20" name="linkprot_secret_'.$i.'" value="" autocomplete="new-password"'.$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="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>'. |
'<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 .= |
$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>'. |
'</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 5809 sub print_linkprotection {
|
Line 7491 sub print_linkprotection {
|
'<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 width="100%">'; |
my ($usersty,$onclickrequser,%checkedrequser); |
my ($usersty,$onclickrequser,%checkedrequser,$onclickreturnurl,%checkedreturnurl, |
|
$onclickpassback,%checkedpassback,%checkedpassbackfmt); |
if ($ltiauth) { |
if ($ltiauth) { |
$usersty = 'display:none'; |
$usersty = 'display:none'; |
$onclickrequser = ' onclick="toggleLinkProtReqUser(this.form,'."'requser','optional','1','block','add'".');"'; |
$onclickrequser = ' onclick="toggleLinkProtExtra(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". |
if ($ltiauth) { |
'<br /><br />'; |
$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="off"'.$disabled.' />'. |
'<span class="LC_nobreak">'.$desc{'secret'}.':<input type="password" size="20" name="linkprot_secret_add" value="" autocomplete="new-password"'.$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="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"; |
} |
} |
|
$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 .= '</fieldset>'. |
$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>'. |
|
'</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 5860 sub linkprot_names {
|
Line 7578 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 5915 sub linkprot_options {
|
Line 7635 sub linkprot_options {
|
$checked{'auth'} = ' checked="checked"'; |
$checked{'auth'} = ' checked="checked"'; |
} |
} |
} |
} |
my $onclickuser = ' onclick="toggleLinkProtReqUser(this.form,'."'mapuser','userfield','other','inline-block','$num'".');"'; |
my $onclickuser = ' onclick="toggleLinkProtExtra(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 5939 sub linkprot_options {
|
Line 7659 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 6110 sub make_item_rows {
|
Line 7869 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($items->{$item}{text},$count,"advanced",$colspan); |
$datatable .= &item_table_row_start($rowdesc,$count,"advanced",$colspan); |
} else { |
} else { |
$datatable .= &item_table_row_start($items->{$item}{text},$count,undef,$colspan); |
$datatable .= &item_table_row_start($rowdesc,$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 6132 sub make_item_rows {
|
Line 7897 sub make_item_rows {
|
$datatable .= &print_hdrfmt_row($item,$settings,$noedit); |
$datatable .= &print_hdrfmt_row($item,$settings,$noedit); |
} elsif ($item eq 'lti.lcmenu') { |
} elsif ($item eq 'lti.lcmenu') { |
$datatable .= &lcmenu_checkboxes($cdom,$item,$settings,$crstype,$noedit); |
$datatable .= &lcmenu_checkboxes($cdom,$item,$settings,$crstype,$noedit); |
|
} elsif ($item eq 'extresource') { |
|
$datatable .= &print_extresource_row($item,$items->{$item},$settings->{$item},$noedit); |
} elsif ($items->{$item}{input} eq 'dates') { |
} elsif ($items->{$item}{input} eq 'dates') { |
my $disabled; |
my $disabled; |
if ($noedit) { |
if ($noedit) { |
Line 6567 sub devalidate_remote_courseprefs {
|
Line 8334 sub devalidate_remote_courseprefs {
|
my %servers = &Apache::lonnet::internet_dom_servers($cdom); |
my %servers = &Apache::lonnet::internet_dom_servers($cdom); |
my %thismachine; |
my %thismachine; |
map { $thismachine{$_} = 1; } &Apache::lonnet::current_machine_ids(); |
map { $thismachine{$_} = 1; } &Apache::lonnet::current_machine_ids(); |
my @posscached = ('courselti'); |
my @posscached = ('courselti','courseltitools'); |
if (keys(%servers)) { |
if (keys(%servers)) { |
foreach my $server (keys(%servers)) { |
foreach my $server (keys(%servers)) { |
next if ($thismachine{$server}); |
next if ($thismachine{$server}); |