version 1.295, 2017/03/20 03:19:43
|
version 1.296, 2017/04/25 22:18:59
|
Line 488 sub handler {
|
Line 488 sub handler {
|
}, |
}, |
'ltitools' => |
'ltitools' => |
{text => 'External Tools (LTI)', |
{text => 'External Tools (LTI)', |
help => 'Domain_configuration_LTI_Tools', |
help => 'Domain_Configuration_LTI_Tools', |
header => [{col1 => 'Setting', |
header => [{col1 => 'Setting', |
col2 => 'Value',}], |
col2 => 'Value',}], |
print => \&print_ltitools, |
print => \&print_ltitools, |
Line 3754 sub print_ltitools {
|
Line 3754 sub print_ltitools {
|
if ($settings->{$item}->{'display'}->{'height'} =~ /^(\d+)$/) { |
if ($settings->{$item}->{'display'}->{'height'} =~ /^(\d+)$/) { |
$currdisp{'height'} = $1; |
$currdisp{'height'} = $1; |
} |
} |
|
$currdisp{'linktext'} = $settings->{$item}->{'display'}->{'linktext'}; |
|
$currdisp{'explanation'} = $settings->{$item}->{'display'}->{'explanation'}; |
} else { |
} else { |
$currdisp{'iframe'} = ' checked="checked"'; |
$currdisp{'iframe'} = ' checked="checked"'; |
} |
} |
Line 3767 sub print_ltitools {
|
Line 3769 sub print_ltitools {
|
'<input type="text" name="ltitools_'.$dimen.'_'.$i.'" size="5" value="'.$currdisp{$dimen}.'" /></label>'. |
'<input type="text" name="ltitools_'.$dimen.'_'.$i.'" size="5" value="'.$currdisp{$dimen}.'" /></label>'. |
(' 'x2); |
(' 'x2); |
} |
} |
|
$datatable .= '<br />'. |
|
'<div class="LC_left_float">'.$lt{'linktext'}.'<br />'. |
|
'<input type="text" name="ltitools_linktext_'.$i.'" size="25" value="'.$currdisp{'linktext'}.'" /></label></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 />'; |
$datatable .= '<br />'; |
$datatable .= '<br />'; |
foreach my $extra ('passback','roster') { |
foreach my $extra ('passback','roster') { |
my $checkedon = ''; |
my $checkedon = ''; |
Line 3848 sub print_ltitools {
|
Line 3856 sub print_ltitools {
|
} |
} |
} |
} |
$datatable .= '<fieldset><legend>'.&mt('Configurable in course').'</legend><span class="LC_nobreak">'; |
$datatable .= '<fieldset><legend>'.&mt('Configurable in course').'</legend><span class="LC_nobreak">'; |
foreach my $item ('label','title','target') { |
foreach my $item ('label','title','target','linktext','explanation') { |
my $checked; |
my $checked; |
if ($courseconfig{$item}) { |
if ($courseconfig{$item}) { |
$checked = ' checked="checked"'; |
$checked = ' checked="checked"'; |
Line 3926 sub print_ltitools {
|
Line 3934 sub print_ltitools {
|
'<input type="text" name="ltitools_add_'.$dimen.'" size="5" /></label>'. |
'<input type="text" name="ltitools_add_'.$dimen.'" size="5" /></label>'. |
(' 'x2); |
(' 'x2); |
} |
} |
$datatable .= '<br />'; |
$datatable .= '<br />'. |
|
'<div class="LC_left_float">'.$lt{'linktext'}.'<br />'. |
|
'<input type="text" name="ltitools_add_linktext" size="5" /></label></div>'. |
|
'<div class="LC_left_float">'.$lt{'explanation'}.'<br />'. |
|
'<textarea name=ltitools_add_explanation" rows="5" cols="40"></textarea>'. |
|
'</div><div style=""></div><br />'; |
foreach my $extra ('passback','roster') { |
foreach my $extra ('passback','roster') { |
$datatable .= $lt{$extra}.' '. |
$datatable .= $lt{$extra}.' '. |
'<label><input type="radio" name="ltitools_add_'.$extra.'" value="1" />'. |
'<label><input type="radio" name="ltitools_add_'.$extra.'" value="1" />'. |
Line 3964 sub print_ltitools {
|
Line 3977 sub print_ltitools {
|
} |
} |
$datatable .= '</tr></table></fieldset>'. |
$datatable .= '</tr></table></fieldset>'. |
'<fieldset><legend>'.&mt('Configurable in course').'</legend><span class="LC_nobreak">'; |
'<fieldset><legend>'.&mt('Configurable in course').'</legend><span class="LC_nobreak">'; |
foreach my $item ('label','title','target') { |
foreach my $item ('label','title','target','linktext','explanation') { |
$datatable .= '<label>'. |
$datatable .= '<label>'. |
'<input type="checkbox" name="ltitools_courseconfig" value="'.$item.'" checked="checked" />'. |
'<input type="checkbox" name="ltitools_courseconfig" value="'.$item.'" checked="checked" />'. |
$lt{'crs'.$item}.'</label>'.(' ' x2)."\n"; |
$lt{'crs'.$item}.'</label>'.(' ' x2)."\n"; |
} |
} |
$datatable .= '</span></fieldset>'. |
$datatable .= '</span></fieldset>'. |
'<fieldset><legend>'.&mt('Custom items sent on launch').'</legend>'. |
'<fieldset><legend>'.&mt('Custom items sent on launch').'</legend>'. |
Line 3985 sub print_ltitools {
|
Line 3998 sub print_ltitools {
|
|
|
sub ltitools_names { |
sub ltitools_names { |
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
'title' => 'Title', |
'title' => 'Title', |
'version' => 'Version', |
'version' => 'Version', |
'msgtype' => 'Message Type', |
'msgtype' => 'Message Type', |
'url' => 'URL', |
'url' => 'URL', |
'key' => 'Key', |
'key' => 'Key', |
'secret' => 'Secret', |
'secret' => 'Secret', |
'icon' => 'Icon', |
'icon' => 'Icon', |
'user' => 'Username:domain', |
'user' => 'Username:domain', |
'fullname' => 'Full Name', |
'fullname' => 'Full Name', |
'firstname' => 'First Name', |
'firstname' => 'First Name', |
'lastname' => 'Last Name', |
'lastname' => 'Last Name', |
'email' => 'E-mail', |
'email' => 'E-mail', |
'roles' => 'Role', |
'roles' => 'Role', |
'window' => 'Window/Tab', |
'window' => 'Window/Tab', |
'iframe' => 'iFrame', |
'iframe' => 'iFrame', |
'height' => 'Height', |
'height' => 'Height', |
'width' => 'Width', |
'width' => 'Width', |
'passback' => 'Tool can return grades:', |
'linktext' => 'Default Link Text', |
'roster' => 'Tool can retrieve roster:', |
'explanation' => 'Default Explanation', |
'crstarget' => 'Display target', |
'passback' => 'Tool can return grades:', |
'crslabel' => 'Course label', |
'roster' => 'Tool can retrieve roster:', |
'crstitle' => 'Course title', |
'crstarget' => 'Display target', |
|
'crslabel' => 'Course label', |
|
'crstitle' => 'Course title', |
|
'crslinktext' => 'Link Text', |
|
'crsexplanation' => 'Explanation', |
); |
); |
return %lt; |
return %lt; |
} |
} |
Line 9483 sub modify_ltitools {
|
Line 9500 sub modify_ltitools {
|
if ($env{'form.ltitools_add_msgtype'} eq 'basic-lti-launch-request') { |
if ($env{'form.ltitools_add_msgtype'} eq 'basic-lti-launch-request') { |
$confhash{$newid}{'msgtype'} = $env{'form.ltitools_add_msgtype'}; |
$confhash{$newid}{'msgtype'} = $env{'form.ltitools_add_msgtype'}; |
} |
} |
foreach my $item ('width','height') { |
foreach my $item ('width','height','linktext','explanation') { |
$env{'form.ltitools_add_'.$item} =~ s/^\s+//; |
$env{'form.ltitools_add_'.$item} =~ s/^\s+//; |
$env{'form.ltitools_add_'.$item} =~ s/\s+$//; |
$env{'form.ltitools_add_'.$item} =~ s/\s+$//; |
if ($env{'form.ltitools_add_'.$item} =~ /^\d+$/) { |
if (($item eq 'width') || ($item eq 'height')) { |
$confhash{$newid}{'display'}{$item} = $env{'form.ltitools_add_'.$item}; |
if ($env{'form.ltitools_add_'.$item} =~ /^\d+$/) { |
|
$confhash{$newid}{'display'}{$item} = $env{'form.ltitools_add_'.$item}; |
|
} |
|
} else { |
|
if ($env{'form.ltitools_add_'.$item} ne '') { |
|
$confhash{$newid}{'display'}{$item} = $env{'form.ltitools_add_'.$item}; |
|
} |
} |
} |
} |
} |
if ($env{'form.ltitools_add_target'} eq 'window') { |
if ($env{'form.ltitools_add_target'} eq 'window') { |
Line 9599 sub modify_ltitools {
|
Line 9622 sub modify_ltitools {
|
} else { |
} else { |
$changes{$itemid} = 1; |
$changes{$itemid} = 1; |
} |
} |
|
} elsif (ref($domconfig{$action}{$itemid}{'display'}) eq 'HASH') { |
|
if ($domconfig{$action}{$itemid}{'display'}{$size} ne '') { |
|
$changes{$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 '') { |
|
$confhash{$itemid}{'display'}{$item} = $env{'form.ltitools_'.$item.'_'.$i}; |
|
if (ref($domconfig{$action}{$itemid}{'display'}) eq 'HASH') { |
|
if ($domconfig{$action}{$itemid}{'display'}{$item} ne $confhash{$itemid}{'display'}{$item}) { |
|
$changes{$itemid} = 1; |
|
} |
|
} else { |
|
$changes{$itemid} = 1; |
|
} |
|
} elsif (ref($domconfig{$action}{$itemid}{'display'}) eq 'HASH') { |
|
if ($domconfig{$action}{$itemid}{'display'}{$item} ne '') { |
|
$changes{$itemid} = 1; |
|
} |
} |
} |
} |
} |
if ($env{'form.ltitools_target_'.$i} eq 'window') { |
if ($env{'form.ltitools_target_'.$i} eq 'window') { |
Line 9622 sub modify_ltitools {
|
Line 9667 sub modify_ltitools {
|
} |
} |
} |
} |
my @courseconfig = &Apache::loncommon::get_env_multiple('form.ltitools_courseconfig_'.$i); |
my @courseconfig = &Apache::loncommon::get_env_multiple('form.ltitools_courseconfig_'.$i); |
foreach my $item ('label','title','target') { |
foreach my $item ('label','title','target','linktext','explanation') { |
if (grep(/^\Q$item\E$/,@courseconfig)) { |
if (grep(/^\Q$item\E$/,@courseconfig)) { |
$confhash{$itemid}{'crsconf'}{$item} = 1; |
$confhash{$itemid}{'crsconf'}{$item} = 1; |
if (ref($domconfig{$action}{$itemid}{'crsconf'}) eq 'HASH') { |
if (ref($domconfig{$action}{$itemid}{'crsconf'}) eq 'HASH') { |
Line 9798 sub modify_ltitools {
|
Line 9843 sub modify_ltitools {
|
$resulttext .= ('*'x$num).'</li>'; |
$resulttext .= ('*'x$num).'</li>'; |
} |
} |
$resulttext .= '<li>'.&mt('Configurable in course:'); |
$resulttext .= '<li>'.&mt('Configurable in course:'); |
my @possconfig = ('label','title','target'); |
my @possconfig = ('label','title','target','linktext','explanation'); |
my $numconfig = 0; |
my $numconfig = 0; |
if (ref($confhash{$itemid}{'crsconf'}) eq 'HASH') { |
if (ref($confhash{$itemid}{'crsconf'}) eq 'HASH') { |
foreach my $item (@possconfig) { |
foreach my $item (@possconfig) { |
if ($confhash{$itemid}{'crsconf'}{$item}) { |
if ($confhash{$itemid}{'crsconf'}{$item}) { |
$numconfig ++; |
$numconfig ++; |
$resulttext .= ' '.$lt{'crs'.$item}; |
$resulttext .= ' "'.$lt{'crs'.$item}.'"'; |
} |
} |
} |
} |
} |
} |
Line 9837 sub modify_ltitools {
|
Line 9882 sub modify_ltitools {
|
$displaylist =~ s/,$//; |
$displaylist =~ s/,$//; |
$resulttext .= '<li>'.$displaylist.'</li>'; |
$resulttext .= '<li>'.$displaylist.'</li>'; |
} |
} |
} |
foreach my $item ('linktext','explanation') { |
|
if ($confhash{$itemid}{'display'}{$item}) { |
|
$resulttext .= '<li>'.$lt{$item}.': '.$confhash{$itemid}{'display'}{$item}.'</li>'; |
|
} |
|
} |
|
} |
if (ref($confhash{$itemid}{'fields'}) eq 'HASH') { |
if (ref($confhash{$itemid}{'fields'}) eq 'HASH') { |
my $fieldlist; |
my $fieldlist; |
foreach my $field (@allfields) { |
foreach my $field (@allfields) { |