version 1.296, 2017/04/25 22:18:59
|
version 1.297, 2017/05/09 03:04:26
|
Line 27
|
Line 27
|
# |
# |
# |
# |
############################################################### |
############################################################### |
############################################################## |
############################################################### |
|
|
=pod |
=pod |
|
|
Line 220 sub handler {
|
Line 220 sub handler {
|
'coursedefaults','usersessions','loadbalancing', |
'coursedefaults','usersessions','loadbalancing', |
'requestauthor','selfenrollment','inststatus', |
'requestauthor','selfenrollment','inststatus', |
'ltitools','ssl','trust'],$dom); |
'ltitools','ssl','trust'],$dom); |
|
if (ref($domconfig{'ltitools'}) eq 'HASH') { |
|
my %encconfig = |
|
&Apache::lonnet::get_dom('encconfig',['ltitools'],$dom); |
|
if (ref($encconfig{'ltitools'}) eq 'HASH') { |
|
foreach my $id (keys(%{$domconfig{'ltitools'}})) { |
|
if (ref($domconfig{'ltitools'}{$id}) eq 'HASH') { |
|
foreach my $item ('key','secret') { |
|
$domconfig{'ltitools'}{$id}{$item} = $encconfig{'ltitools'}{$id}{$item}; |
|
} |
|
} |
|
} |
|
} |
|
} |
my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll', |
my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll', |
'autoupdate','autocreate','directorysrch','contacts', |
'autoupdate','autocreate','directorysrch','contacts', |
'usercreation','selfcreation','usermodification','scantron', |
'usercreation','selfcreation','usermodification','scantron', |
Line 9466 sub process_textbook_image {
|
Line 9479 sub process_textbook_image {
|
sub modify_ltitools { |
sub modify_ltitools { |
my ($r,$dom,$action,$lastactref,%domconfig) = @_; |
my ($r,$dom,$action,$lastactref,%domconfig) = @_; |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1); |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1); |
my ($newid,@allpos,%changes,%confhash,$errors,$resulttext); |
my ($newid,@allpos,%changes,%confhash,%encconfig,$errors,$resulttext); |
my $confname = $dom.'-domainconfig'; |
my $confname = $dom.'-domainconfig'; |
my $servadm = $r->dir_config('lonAdmEMail'); |
my $servadm = $r->dir_config('lonAdmEMail'); |
my ($configuserok,$author_ok,$switchserver) = &config_check($dom,$confname,$servadm); |
my ($configuserok,$author_ok,$switchserver) = &config_check($dom,$confname,$servadm); |
Line 9491 sub modify_ltitools {
|
Line 9504 sub modify_ltitools {
|
foreach my $item ('title','url','key','secret') { |
foreach my $item ('title','url','key','secret') { |
$env{'form.ltitools_add_'.$item} =~ s/(`)/'/g; |
$env{'form.ltitools_add_'.$item} =~ s/(`)/'/g; |
if ($env{'form.ltitools_add_'.$item}) { |
if ($env{'form.ltitools_add_'.$item}) { |
$confhash{$newid}{$item} = $env{'form.ltitools_add_'.$item}; |
if (($item eq 'key') || ($item eq 'secret')) { |
|
$encconfig{$newid}{$item} = $env{'form.ltitools_add_'.$item}; |
|
} else { |
|
$confhash{$newid}{$item} = $env{'form.ltitools_add_'.$item}; |
|
} |
} |
} |
} |
} |
if ($env{'form.ltitools_add_version'} eq 'LTI-1p0') { |
if ($env{'form.ltitools_add_version'} eq 'LTI-1p0') { |
Line 9598 sub modify_ltitools {
|
Line 9615 sub modify_ltitools {
|
} else { |
} else { |
my $newpos = $env{'form.ltitools_'.$itemid}; |
my $newpos = $env{'form.ltitools_'.$itemid}; |
$newpos =~ s/\D+//g; |
$newpos =~ s/\D+//g; |
foreach my $item ('title','url','key','secret') { |
foreach my $item ('title','url') { |
$confhash{$itemid}{$item} = $env{'form.ltitools_'.$item.'_'.$i}; |
$confhash{$itemid}{$item} = $env{'form.ltitools_'.$item.'_'.$i}; |
if ($domconfig{$action}{$itemid}{$item} ne $confhash{$itemid}{$item}) { |
if ($domconfig{$action}{$itemid}{$item} ne $confhash{$itemid}{$item}) { |
$changes{$itemid} = 1; |
$changes{$itemid} = 1; |
} |
} |
} |
} |
|
foreach my $item ('key','secret') { |
|
$encconfig{$itemid}{$item} = $env{'form.ltitools_'.$item.'_'.$i}; |
|
if ($domconfig{$action}{$itemid}{$item} ne $encconfig{$itemid}{$item}) { |
|
$changes{$itemid} = 1; |
|
} |
|
} |
if ($env{'form.ltitools_version_'.$i} eq 'LTI-1p0') { |
if ($env{'form.ltitools_version_'.$i} eq 'LTI-1p0') { |
$confhash{$itemid}{'version'} = $env{'form.ltitools_version_'.$i}; |
$confhash{$itemid}{'version'} = $env{'form.ltitools_version_'.$i}; |
} |
} |
Line 9806 sub modify_ltitools {
|
Line 9829 sub modify_ltitools {
|
my $putresult = &Apache::lonnet::put_dom('configuration',\%ltitoolshash, |
my $putresult = &Apache::lonnet::put_dom('configuration',\%ltitoolshash, |
$dom); |
$dom); |
if ($putresult eq 'ok') { |
if ($putresult eq 'ok') { |
|
my %ltienchash = ( |
|
$action => { %encconfig } |
|
); |
|
&Apache::lonnet::put_dom('encconfig',\%ltienchash,$dom); |
if (keys(%changes) > 0) { |
if (keys(%changes) > 0) { |
my $cachetime = 24*60*60; |
my $cachetime = 24*60*60; |
&Apache::lonnet::do_cache_new('ltitools',$dom,\%confhash,$cachetime); |
my %ltiall = %confhash; |
|
foreach my $id (keys(%ltiall)) { |
|
if (ref($encconfig{$id}) eq 'HASH') { |
|
foreach my $item ('key','secret') { |
|
$ltiall{$id}{$item} = $encconfig{$id}{$item}; |
|
} |
|
} |
|
} |
|
&Apache::lonnet::do_cache_new('ltitools',$dom,\%ltiall,$cachetime); |
if (ref($lastactref) eq 'HASH') { |
if (ref($lastactref) eq 'HASH') { |
$lastactref->{'ltitools'} = 1; |
$lastactref->{'ltitools'} = 1; |
} |
} |
Line 9832 sub modify_ltitools {
|
Line 9867 sub modify_ltitools {
|
$resulttext .= '</li><ul>'; |
$resulttext .= '</li><ul>'; |
my $position = $pos + 1; |
my $position = $pos + 1; |
$resulttext .= '<li>'.&mt('Order: [_1]',$position).'</li>'; |
$resulttext .= '<li>'.&mt('Order: [_1]',$position).'</li>'; |
foreach my $item ('version','msgtype','url','key') { |
foreach my $item ('version','msgtype','url') { |
if ($confhash{$itemid}{$item} ne '') { |
if ($confhash{$itemid}{$item} ne '') { |
$resulttext .= '<li>'.$lt{$item}.': '.$confhash{$itemid}{$item}.'</li>'; |
$resulttext .= '<li>'.$lt{$item}.': '.$confhash{$itemid}{$item}.'</li>'; |
} |
} |
} |
} |
if ($confhash{$itemid}{'secret'} ne '') { |
if ($encconfig{$itemid}{'key'} ne '') { |
|
$resulttext .= '<li>'.$lt{'key'}.': '.$encconfig{$itemid}{'key'}.'</li>'; |
|
} |
|
if ($encconfig{$itemid}{'secret'} ne '') { |
$resulttext .= '<li>'.$lt{'secret'}.': '; |
$resulttext .= '<li>'.$lt{'secret'}.': '; |
my $num = length($confhash{$itemid}{'secret'}); |
my $num = length($encconfig{$itemid}{'secret'}); |
$resulttext .= ('*'x$num).'</li>'; |
$resulttext .= ('*'x$num).'</li>'; |
} |
} |
$resulttext .= '<li>'.&mt('Configurable in course:'); |
$resulttext .= '<li>'.&mt('Configurable in course:'); |