version 1.160.6.102.2.4, 2020/07/18 20:28:24
|
version 1.160.6.102.2.5, 2020/10/25 18:40:38
|
Line 726 sub print_config_box {
|
Line 726 sub print_config_box {
|
$output = |
$output = |
&Apache::lonuserutils::custom_roledefs_js($context,$crstype,$formname,\%full, |
&Apache::lonuserutils::custom_roledefs_js($context,$crstype,$formname,\%full, |
\@templateroles); |
\@templateroles); |
|
} elsif ($action eq 'ltitools') { |
|
$output .= <itools_javascript($settings); |
} |
} |
$output .= |
$output .= |
'<table class="LC_nested_outer"> |
'<table class="LC_nested_outer"> |
Line 2525 ENDSCRIPT
|
Line 2527 ENDSCRIPT
|
|
|
sub ltitools_javascript { |
sub ltitools_javascript { |
my ($settings) = @_; |
my ($settings) = @_; |
return unless(ref($settings) eq 'HASH'); |
my $togglejs = <itools_toggle_js(); |
|
unless (ref($settings) eq 'HASH') { |
|
return $togglejs; |
|
} |
my (%ordered,$total,%jstext); |
my (%ordered,$total,%jstext); |
$total = 0; |
$total = 0; |
foreach my $item (keys(%{$settings})) { |
foreach my $item (keys(%{$settings})) { |
Line 2543 sub ltitools_javascript {
|
Line 2548 sub ltitools_javascript {
|
return <<"ENDSCRIPT"; |
return <<"ENDSCRIPT"; |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA[ |
function reorderLTI(form,item) { |
function reorderLTITools(form,item) { |
var changedVal; |
var changedVal; |
$jstext |
$jstext |
var newpos = 'ltitools_add_pos'; |
var newpos = 'ltitools_add_pos'; |
Line 2588 $jstext
|
Line 2593 $jstext
|
// ]]> |
// ]]> |
</script> |
</script> |
|
|
|
$togglejs |
|
|
|
ENDSCRIPT |
|
} |
|
|
|
sub ltitools_toggle_js { |
|
return <<"ENDSCRIPT"; |
|
<script type="text/javascript"> |
|
// <![CDATA[ |
|
|
|
function toggleLTITools(form,setting,item) { |
|
var radioname = ''; |
|
var divid = ''; |
|
if (setting == 'user') { |
|
divid = 'ltitools_'+setting+'_div_'+item; |
|
var checkid = 'ltitools_'+setting+'_field_'+item; |
|
if (document.getElementById(divid)) { |
|
if (document.getElementById(checkid)) { |
|
if (document.getElementById(checkid).checked) { |
|
document.getElementById(divid).style.display = 'inline-block'; |
|
} else { |
|
document.getElementById(divid).style.display = 'none'; |
|
} |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
// ]]> |
|
</script> |
|
|
ENDSCRIPT |
ENDSCRIPT |
} |
} |
|
|
Line 3816 sub print_ltitools {
|
Line 3852 sub print_ltitools {
|
my $confname = $dom.'-domainconfig'; |
my $confname = $dom.'-domainconfig'; |
my $switchserver = &check_switchserver($dom,$confname); |
my $switchserver = &check_switchserver($dom,$confname); |
my $maxnum = scalar(keys(%ordered)); |
my $maxnum = scalar(keys(%ordered)); |
my $datatable = <itools_javascript($settings); |
my $datatable; |
my %lt = <itools_names(); |
my %lt = <itools_names(); |
my @courseroles = ('cc','in','ta','ep','st'); |
my @courseroles = ('cc','in','ta','ep','st'); |
my @ltiroles = qw(Instructor ContentDeveloper TeachingAssistant Learner); |
my @ltiroles = qw(Instructor ContentDeveloper TeachingAssistant Learner); |
my @fields = ('fullname','firstname','lastname','email','user','roles'); |
my @fields = ('fullname','firstname','lastname','email','roles','user'); |
if (keys(%ordered)) { |
if (keys(%ordered)) { |
my @items = sort { $a <=> $b } keys(%ordered); |
my @items = sort { $a <=> $b } keys(%ordered); |
for (my $i=0; $i<@items; $i++) { |
for (my $i=0; $i<@items; $i++) { |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
my $item = $ordered{$items[$i]}; |
my $item = $ordered{$items[$i]}; |
my ($title,$key,$secret,$url,$imgsrc,$version); |
my ($title,$key,$secret,$url,$lifetime,$imgsrc,%sigsel); |
if (ref($settings->{$item}) eq 'HASH') { |
if (ref($settings->{$item}) eq 'HASH') { |
$title = $settings->{$item}->{'title'}; |
$title = $settings->{$item}->{'title'}; |
$url = $settings->{$item}->{'url'}; |
$url = $settings->{$item}->{'url'}; |
$key = $settings->{$item}->{'key'}; |
$key = $settings->{$item}->{'key'}; |
$secret = $settings->{$item}->{'secret'}; |
$secret = $settings->{$item}->{'secret'}; |
|
$lifetime = $settings->{$item}->{'lifetime'}; |
my $image = $settings->{$item}->{'image'}; |
my $image = $settings->{$item}->{'image'}; |
if ($image ne '') { |
if ($image ne '') { |
$imgsrc = '<img src="'.$image.'" alt="'.&mt('Tool Provider icon').'" />'; |
$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:reorderLTI(this.form,'."'ltitools_".$item."'".');"'; |
my $chgstr = ' onchange="javascript:reorderLTITools(this.form,'."'ltitools_".$item."'".');"'; |
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">' |
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">' |
.'<select name="ltitools_'.$item.'"'.$chgstr.'>'; |
.'<select name="ltitools_'.$item.'"'.$chgstr.'>'; |
for (my $k=0; $k<=$maxnum; $k++) { |
for (my $k=0; $k<=$maxnum; $k++) { |
Line 3853 sub print_ltitools {
|
Line 3895 sub print_ltitools {
|
&mt('Delete?').'</label></span></td>'. |
&mt('Delete?').'</label></span></td>'. |
'<td colspan="2">'. |
'<td colspan="2">'. |
'<fieldset><legend>'.&mt('Required settings').'</legend>'. |
'<fieldset><legend>'.&mt('Required settings').'</legend>'. |
'<span class="LC_nobreak">'.$lt{'title'}.':<input type="text" size="30" name="ltitools_title_'.$i.'" value="'.$title.'" /></span> '. |
'<span class="LC_nobreak">'.$lt{'title'}.':<input type="text" size="20" name="ltitools_title_'.$i.'" value="'.$title.'" /></span> '. |
(' 'x2). |
(' 'x2). |
'<span class="LC_nobreak">'.$lt{'version'}.':<select name="ltitools_version_'.$i.'">'. |
'<span class="LC_nobreak">'.$lt{'version'}.':<select name="ltitools_version_'.$i.'">'. |
'<option value="LTI-1p0" selected="selected">1.1</option></select></span> '. |
'<option value="LTI-1p0" selected="selected">1.1</option></select></span> '. |
(' 'x2). |
(' 'x2). |
'<span class="LC_nobreak">'.$lt{'msgtype'}.':<select name="ltitools_msgtype_'.$i.'">'. |
'<span class="LC_nobreak">'.$lt{'msgtype'}.':<select name="ltitools_msgtype_'.$i.'">'. |
'<option value="basic-lti-launch-request" selected="selected">Launch</option></select></span> '. |
'<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 />'. |
'<br /><br />'. |
'<span class="LC_nobreak">'.$lt{'url'}.':<input type="text" size="30" name="ltitools_url_'.$i.'"'. |
'<span class="LC_nobreak">'.$lt{'url'}.':<input type="text" size="40" name="ltitools_url_'.$i.'"'. |
' value="'.$url.'" /></span>'. |
' value="'.$url.'" /></span>'. |
(' 'x2). |
(' 'x2). |
'<span class="LC_nobreak">'.$lt{'key'}. |
'<span class="LC_nobreak">'.$lt{'key'}.':'. |
'<input type="text" size="25" name="ltitools_key_'.$i.'" value="'.$key.'" /></span> '. |
'<input type="text" size="25" name="ltitools_key_'.$i.'" value="'.$key.'" /></span> '. |
(' 'x2). |
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'lifetime'}.':'. |
|
'<input type="text" size="5" name="ltitools_lifetime_'.$i.'" value="'.$lifetime.'" /></span> '. |
|
(' 'x2). |
'<span class="LC_nobreak">'.$lt{'secret'}.':'. |
'<span class="LC_nobreak">'.$lt{'secret'}.':'. |
'<input type="password" size="20" name="ltitools_secret_'.$i.'" value="'.$secret.'" />'. |
'<input type="password" size="20" name="ltitools_secret_'.$i.'" value="'.$secret.'" />'. |
'<label><input type="checkbox" name="visible" onclick="if (this.checked) { this.form.ltitools_secret_'.$i.'.type='."'text'".' } else { this.form.ltitools_secret_'.$i.'.type='."'password'".' }" />'.&mt('Visible input').'</label>'. |
'<label><input type="checkbox" name="visible" onclick="if (this.checked) { this.form.ltitools_secret_'.$i.'.type='."'text'".' } else { this.form.ltitools_secret_'.$i.'.type='."'password'".' }" />'.&mt('Visible input').'</label>'. |
Line 3904 sub print_ltitools {
|
Line 3953 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 />'. |
$datatable .= '</span><br />'. |
'<div class="LC_left_float">'.$lt{'linktext'}.'<br />'. |
'<div class="LC_left_float">'.$lt{'linktext'}.'<br />'. |
'<input type="text" name="ltitools_linktext_'.$i.'" size="25" value="'.$currdisp{'linktext'}.'" /></label></div>'. |
'<input type="text" name="ltitools_linktext_'.$i.'" size="25" value="'.$currdisp{'linktext'}.'" /></div>'. |
'<div class="LC_left_float">'.$lt{'explanation'}.'<br />'. |
'<div class="LC_left_float">'.$lt{'explanation'}.'<br />'. |
'<textarea name="ltitools_explanation_'.$i.'" rows="5" cols="40">'.$currdisp{'explanation'}. |
'<textarea name="ltitools_explanation_'.$i.'" rows="5" cols="40">'.$currdisp{'explanation'}. |
'</textarea></div><div style=""></div><br />'; |
'</textarea></div><div style=""></div>'. |
$datatable .= '<br />'; |
'<div style="padding:0;clear:both;margin:0;border:0"></div>'; |
foreach my $extra ('passback','roster') { |
$datatable .= '<span class="LC_nobreak">'.$lt{'icon'}.': '; |
my $checkedon = ''; |
|
my $checkedoff = ' checked="checked"'; |
|
if ($settings->{$item}->{$extra}) { |
|
$checkedon = $checkedoff; |
|
$checkedoff = ''; |
|
} |
|
$datatable .= $lt{$extra}.' '. |
|
'<label><input type="radio" name="ltitools_'.$extra.'_'.$i.'" value="1"'.$checkedon.' />'. |
|
&mt('Yes').'</label>'.(' 'x2). |
|
'<label><input type="radio" name="ltitools_'.$extra.'_'.$i.'" value="0"'.$checkedoff.' />'. |
|
&mt('No').'</label>'.(' 'x4); |
|
} |
|
$datatable .= '<br /><br /><span class="LC_nobreak">'.$lt{'icon'}.': '; |
|
if ($imgsrc) { |
if ($imgsrc) { |
$datatable .= $imgsrc. |
$datatable .= $imgsrc. |
'<label><input type="checkbox" name="ltitools_image_del"'. |
'<label><input type="checkbox" name="ltitools_image_del"'. |
Line 3939 sub print_ltitools {
|
Line 3975 sub print_ltitools {
|
$datatable .= '<input type="file" name="ltitools_image_'.$i.'" value="" />'; |
$datatable .= '<input type="file" name="ltitools_image_'.$i.'" value="" />'; |
} |
} |
$datatable .= '</span></fieldset>'; |
$datatable .= '</span></fieldset>'; |
my (%checkedfields,%rolemaps); |
my (%checkedfields,%rolemaps,$userincdom); |
if (ref($settings->{$item}) eq 'HASH') { |
if (ref($settings->{$item}) eq 'HASH') { |
if (ref($settings->{$item}->{'fields'}) eq 'HASH') { |
if (ref($settings->{$item}->{'fields'}) eq 'HASH') { |
%checkedfields = %{$settings->{$item}->{'fields'}}; |
%checkedfields = %{$settings->{$item}->{'fields'}}; |
} |
} |
|
$userincdom = $settings->{$item}->{'incdom'}; |
if (ref($settings->{$item}->{'roles'}) eq 'HASH') { |
if (ref($settings->{$item}->{'roles'}) eq 'HASH') { |
%rolemaps = %{$settings->{$item}->{'roles'}}; |
%rolemaps = %{$settings->{$item}->{'roles'}}; |
$checkedfields{'roles'} = 1; |
$checkedfields{'roles'} = 1; |
Line 3951 sub print_ltitools {
|
Line 3988 sub print_ltitools {
|
} |
} |
$datatable .= '<fieldset><legend>'.&mt('User data sent on launch').'</legend>'. |
$datatable .= '<fieldset><legend>'.&mt('User data sent on launch').'</legend>'. |
'<span class="LC_nobreak">'; |
'<span class="LC_nobreak">'; |
|
my $userfieldstyle = 'display:none;'; |
|
my $seluserdom = ''; |
|
my $unseluserdom = ' selected="selected"'; |
foreach my $field (@fields) { |
foreach my $field (@fields) { |
my $checked; |
my ($checked,$onclick,$id,$spacer); |
if ($checkedfields{$field}) { |
if ($checkedfields{$field}) { |
$checked = ' checked="checked"'; |
$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>'. |
$datatable .= '<label>'. |
'<input type="checkbox" name="ltitools_fields_'.$i.'" value="'.$field.'"'.$checked.' />'. |
'<input type="checkbox" name="ltitools_fields_'.$i.'" value="'.$field.'"'.$id.$checked.$onclick.' />'. |
$lt{$field}.'</label>'.(' ' x2); |
$lt{$field}.'</label>'.$spacer; |
} |
} |
$datatable .= '</span></fieldset>'. |
$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>'; |
'<fieldset><legend>'.&mt('Role mapping').'</legend><table><tr>'; |
foreach my $role (@courseroles) { |
foreach my $role (@courseroles) { |
my ($selected,$selectnone); |
my ($selected,$selectnone); |
Line 3991 sub print_ltitools {
|
Line 4052 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','linktext','explanation') { |
foreach my $item ('label','title','target','linktext','explanation','append') { |
my $checked; |
my $checked; |
if ($courseconfig{$item}) { |
if ($courseconfig{$item}) { |
$checked = ' checked="checked"'; |
$checked = ' checked="checked"'; |
Line 4024 sub print_ltitools {
|
Line 4085 sub print_ltitools {
|
} |
} |
} |
} |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
my $chgstr = ' onchange="javascript:reorderLTI(this.form,'."'ltitools_add_pos'".');"'; |
my $chgstr = ' onchange="javascript:reorderLTITools(this.form,'."'ltitools_add_pos'".');"'; |
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">'."\n". |
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">'."\n". |
'<input type="hidden" name="ltitools_maxnum" value="'.$maxnum.'" />'."\n". |
'<input type="hidden" name="ltitools_maxnum" value="'.$maxnum.'" />'."\n". |
'<select name="ltitools_add_pos"'.$chgstr.'>'; |
'<select name="ltitools_add_pos"'.$chgstr.'>'; |
Line 4037 sub print_ltitools {
|
Line 4098 sub print_ltitools {
|
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
} |
} |
$datatable .= '</select> '."\n". |
$datatable .= '</select> '."\n". |
'<input type="checkbox" name="ltitools_add" value="1" />'.&mt('Add').'</td>'."\n". |
'<input type="checkbox" name="ltitools_add" value="1" />'.&mt('Add').'</span></td>'."\n". |
'<td colspan="2">'. |
'<td colspan="2">'. |
'<fieldset><legend>'.&mt('Required settings').'</legend>'. |
'<fieldset><legend>'.&mt('Required settings').'</legend>'. |
'<span class="LC_nobreak">'.$lt{'title'}.':<input type="text" size="30" name="ltitools_add_title" value="" /></span> '."\n". |
'<span class="LC_nobreak">'.$lt{'title'}.':<input type="text" size="20" name="ltitools_add_title" value="" /></span> '."\n". |
(' 'x2). |
(' 'x2). |
'<span class="LC_nobreak">'.$lt{'version'}.':<select name="ltitools_add_version">'. |
'<span class="LC_nobreak">'.$lt{'version'}.':<select name="ltitools_add_version">'. |
'<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">'.$lt{'msgtype'}.':<select name="ltitools_add_msgtype">'. |
'<span class="LC_nobreak">'.$lt{'msgtype'}.':<select name="ltitools_add_msgtype">'. |
'<option value="basic-lti-launch-request" selected="selected">Launch</option></select></span> '. |
'<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 />'. |
'<br />'. |
'<span class="LC_nobreak">'.$lt{'url'}.':<input type="text" size="30" name="ltitools_add_url" value="" /></span> '."\n". |
'<span class="LC_nobreak">'.$lt{'url'}.':<input type="text" size="40" name="ltitools_add_url" value="" /></span> '."\n". |
(' 'x2). |
(' 'x2). |
'<span class="LC_nobreak">'.$lt{'key'}.':<input type="text" size="25" name="ltitools_add_key" value="" /></span> '."\n". |
'<span class="LC_nobreak">'.$lt{'key'}.':<input type="text" size="25" name="ltitools_add_key" value="" /></span> '."\n". |
(' 'x2). |
(' 'x2). |
|
'<span class="LC_nobreak">'.$lt{'lifetime'}.':<input type="text" size="5" name="ltitools_add_lifetime" value="300" /></span> '."\n". |
|
(' 'x2). |
'<span class="LC_nobreak">'.$lt{'secret'}.':<input type="password" size="20" name="ltitools_add_secret" value="" />'. |
'<span class="LC_nobreak">'.$lt{'secret'}.':<input type="password" size="20" name="ltitools_add_secret" value="" />'. |
'<label><input type="checkbox" name="visible" onclick="if (this.checked) { this.form.ltitools_add_secret.type='."'text'".' } else { this.form.ltitools_add_secret.type='."'password'".' }" />'.&mt('Visible input').'</label></span> '."\n". |
'<label><input type="checkbox" name="visible" onclick="if (this.checked) { this.form.ltitools_add_secret.type='."'text'".' } else { this.form.ltitools_add_secret.type='."'password'".' }" />'.&mt('Visible input').'</label></span> '."\n". |
'</fieldset>'. |
'</fieldset>'. |
Line 4069 sub print_ltitools {
|
Line 4135 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 .= '</span><br />'. |
'<div class="LC_left_float">'.$lt{'linktext'}.'<br />'. |
'<div class="LC_left_float">'.$lt{'linktext'}.'<br />'. |
'<input type="text" name="ltitools_add_linktext" size="5" /></label></div>'. |
'<input type="text" name="ltitools_add_linktext" size="5" /></div>'. |
'<div class="LC_left_float">'.$lt{'explanation'}.'<br />'. |
'<div class="LC_left_float">'.$lt{'explanation'}.'<br />'. |
'<textarea name=ltitools_add_explanation" rows="5" cols="40"></textarea>'. |
'<textarea name="ltitools_add_explanation" rows="5" cols="40"></textarea>'. |
'</div><div style=""></div><br />'; |
'</div><div style=""></div>'. |
foreach my $extra ('passback','roster') { |
'<div style="padding:0;clear:both;margin:0;border:0"></div>'; |
$datatable .= $lt{$extra}.' '. |
$datatable .= '<span class="LC_nobreak">'.$lt{'icon'}.': '. |
'<label><input type="radio" name="ltitools_add_'.$extra.'" value="1" />'. |
|
&mt('Yes').'</label>'.(' 'x2). |
|
'<label><input type="radio" name="ltitools_add_'.$extra.'" value="0" checked="checked" />'. |
|
&mt('No').'</label>'.(' 'x4); |
|
} |
|
$datatable .= '<br /><br /><span class="LC_nobreak">'.$lt{'icon'}.': '. |
|
'('.&mt('if larger than 21x21 pixels, image will be scaled').') '; |
'('.&mt('if larger than 21x21 pixels, image will be scaled').') '; |
if ($switchserver) { |
if ($switchserver) { |
$datatable .= &mt('Upload to library server: [_1]',$switchserver); |
$datatable .= &mt('Upload to library server: [_1]',$switchserver); |
Line 4093 sub print_ltitools {
|
Line 4153 sub print_ltitools {
|
'<fieldset><legend>'.&mt('User data sent on launch').'</legend>'. |
'<fieldset><legend>'.&mt('User data sent on launch').'</legend>'. |
'<span class="LC_nobreak">'; |
'<span class="LC_nobreak">'; |
foreach my $field (@fields) { |
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>'. |
$datatable .= '<label>'. |
'<input type="checkbox" name="ltitools_add_fields" value="'.$field.'" />'. |
'<input type="checkbox" name="ltitools_add_fields" value="'.$field.'"'.$id.$onclick.' />'. |
$lt{$field}.'</label>'.(' ' x2); |
$lt{$field}.'</label>'.$spacer; |
} |
} |
$datatable .= '</span></fieldset>'. |
$datatable .= '</span>'. |
'<fieldset><legend>'.&mt('Role mapping').'</legend><table><tr>'; |
'<div style="display:none;" id="ltitools_user_div_add">'. |
|
'<span class="LC_nobreak"> : '. |
|
'<select name="ltitools_userincdom_add">'. |
|
'<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) { |
foreach my $role (@courseroles) { |
my ($checked,$checkednone); |
my ($checked,$checkednone); |
$datatable .= '<td align="center">'. |
$datatable .= '<td align="center">'. |
Line 4112 sub print_ltitools {
|
Line 4186 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','linktext','explanation') { |
foreach my $item ('label','title','target','linktext','explanation','append') { |
$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"; |
Line 4124 sub print_ltitools {
|
Line 4198 sub print_ltitools {
|
'<label><input type="checkbox" name="ltitools_add_custom" value="1" />'. |
'<label><input type="checkbox" name="ltitools_add_custom" value="1" />'. |
&mt('Add').'</label></span></td><td><input type="text" name="ltitools_add_custom_name" />'. |
&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>'. |
'</td><td><input type="text" name="ltitools_add_custom_value" /></td></tr>'. |
'</table></fieldset></td></tr>'."\n". |
'</table></fieldset>'."\n". |
'</td>'."\n". |
'</td>'."\n". |
'</tr>'."\n"; |
'</tr>'."\n"; |
$itemcount ++; |
$itemcount ++; |
Line 4136 sub ltitools_names {
|
Line 4210 sub ltitools_names {
|
'title' => 'Title', |
'title' => 'Title', |
'version' => 'Version', |
'version' => 'Version', |
'msgtype' => 'Message Type', |
'msgtype' => 'Message Type', |
|
'sigmethod' => 'Signature Method', |
'url' => 'URL', |
'url' => 'URL', |
'key' => 'Key', |
'key' => 'Key', |
|
'lifetime' => 'Nonce lifetime (s)', |
'secret' => 'Secret', |
'secret' => 'Secret', |
'icon' => 'Icon', |
'icon' => 'Icon', |
'user' => 'Username:domain', |
'user' => 'User', |
'fullname' => 'Full Name', |
'fullname' => 'Full Name', |
'firstname' => 'First Name', |
'firstname' => 'First Name', |
'lastname' => 'Last Name', |
'lastname' => 'Last Name', |
Line 4153 sub ltitools_names {
|
Line 4229 sub ltitools_names {
|
'width' => 'Width', |
'width' => 'Width', |
'linktext' => 'Default Link Text', |
'linktext' => 'Default Link Text', |
'explanation' => 'Default Explanation', |
'explanation' => 'Default Explanation', |
'passback' => 'Tool can return grades:', |
|
'roster' => 'Tool can retrieve roster:', |
|
'crstarget' => 'Display target', |
'crstarget' => 'Display target', |
'crslabel' => 'Course label', |
'crslabel' => 'Course label', |
'crstitle' => 'Course title', |
'crstitle' => 'Course title', |
'crslinktext' => 'Link Text', |
'crslinktext' => 'Link Text', |
'crsexplanation' => 'Explanation', |
'crsexplanation' => 'Explanation', |
|
'crsappend' => 'Provider URL', |
); |
); |
|
|
return %lt; |
return %lt; |
Line 10386 sub modify_ltitools {
|
Line 10461 sub modify_ltitools {
|
$allpos[$position] = $newid; |
$allpos[$position] = $newid; |
} |
} |
$changes{$newid} = 1; |
$changes{$newid} = 1; |
foreach my $item ('title','url','key','secret') { |
foreach my $item ('title','url','key','secret','lifetime') { |
$env{'form.ltitools_add_'.$item} =~ s/(`)/'/g; |
$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}) { |
if ($env{'form.ltitools_add_'.$item}) { |
if (($item eq 'key') || ($item eq 'secret')) { |
if (($item eq 'key') || ($item eq 'secret')) { |
$encconfig{$newid}{$item} = $env{'form.ltitools_add_'.$item}; |
$encconfig{$newid}{$item} = $env{'form.ltitools_add_'.$item}; |
Line 10402 sub modify_ltitools {
|
Line 10480 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'}; |
} |
} |
|
if ($env{'form.ltitools_add_sigmethod'} eq 'HMAC-SHA256') { |
|
$confhash{$newid}{'sigmethod'} = $env{'form.ltitools_add_sigmethod'}; |
|
} else { |
|
$confhash{$newid}{'sigmethod'} = 'HMAC-SHA1'; |
|
} |
foreach my $item ('width','height','linktext','explanation') { |
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+$//; |
Line 10422 sub modify_ltitools {
|
Line 10505 sub modify_ltitools {
|
} else { |
} else { |
$confhash{$newid}{'display'}{'target'} = 'iframe'; |
$confhash{$newid}{'display'}{'target'} = 'iframe'; |
} |
} |
foreach my $item ('passback','roster') { |
|
if ($env{'form.ltitools_add_'.$item}) { |
|
$confhash{$newid}{$item} = 1; |
|
} |
|
} |
|
if ($env{'form.ltitools_add_image.filename'} ne '') { |
if ($env{'form.ltitools_add_image.filename'} ne '') { |
my ($imageurl,$error) = |
my ($imageurl,$error) = |
&process_ltitools_image($r,$dom,$confname,'ltitools_add_image',$newid, |
&process_ltitools_image($r,$dom,$confname,'ltitools_add_image',$newid, |
Line 10457 sub modify_ltitools {
|
Line 10535 sub modify_ltitools {
|
} |
} |
} |
} |
} |
} |
|
if (ref($confhash{$newid}{'fields'}) eq 'HASH') { |
|
if ($confhash{$newid}{'fields'}{'user'}) { |
|
if ($env{'form.ltitools_userincdom_add'}) { |
|
$confhash{$newid}{'incdom'} = 1; |
|
} |
|
} |
|
} |
my @courseconfig = &Apache::loncommon::get_env_multiple('form.ltitools_courseconfig'); |
my @courseconfig = &Apache::loncommon::get_env_multiple('form.ltitools_courseconfig'); |
foreach my $item (@courseconfig) { |
foreach my $item (@courseconfig) { |
$confhash{$newid}{'crsconf'}{$item} = 1; |
$confhash{$newid}{'crsconf'}{$item} = 1; |
Line 10503 sub modify_ltitools {
|
Line 10588 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') { |
foreach my $item ('title','url','lifetime') { |
$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; |
Line 10521 sub modify_ltitools {
|
Line 10606 sub modify_ltitools {
|
if ($env{'form.ltitools_msgtype_'.$i} eq 'basic-lti-launch-request') { |
if ($env{'form.ltitools_msgtype_'.$i} eq 'basic-lti-launch-request') { |
$confhash{$itemid}{'msgtype'} = $env{'form.ltitools_msgtype_'.$i}; |
$confhash{$itemid}{'msgtype'} = $env{'form.ltitools_msgtype_'.$i}; |
} |
} |
|
if ($env{'form.ltitools_sigmethod_'.$i} eq 'HMAC-SHA256') { |
|
$confhash{$itemid}{'sigmethod'} = $env{'form.ltitools_sigmethod_'.$i}; |
|
} else { |
|
$confhash{$itemid}{'sigmethod'} = 'HMAC-SHA1'; |
|
} |
|
if ($domconfig{$action}{$itemid}{'sigmethod'} eq '') { |
|
if ($confhash{$itemid}{'sigmethod'} ne 'HMAC-SHA1') { |
|
$changes{$itemid} = 1; |
|
} |
|
} elsif ($domconfig{$action}{$itemid}{'sigmethod'} ne $confhash{$itemid}{'sigmethod'}) { |
|
$changes{$itemid} = 1; |
|
} |
foreach my $size ('width','height') { |
foreach my $size ('width','height') { |
$env{'form.ltitools_'.$size.'_'.$i} =~ s/^\s+//; |
$env{'form.ltitools_'.$size.'_'.$i} =~ s/^\s+//; |
$env{'form.ltitools_'.$size.'_'.$i} =~ s/\s+$//; |
$env{'form.ltitools_'.$size.'_'.$i} =~ s/\s+$//; |
Line 10571 sub modify_ltitools {
|
Line 10668 sub modify_ltitools {
|
} else { |
} else { |
$changes{$itemid} = 1; |
$changes{$itemid} = 1; |
} |
} |
foreach my $extra ('passback','roster') { |
|
if ($env{'form.ltitools_'.$extra.'_'.$i}) { |
|
$confhash{$itemid}{$extra} = 1; |
|
} |
|
if ($domconfig{$action}{$itemid}{$extra} ne $confhash{$itemid}{$extra}) { |
|
$changes{$itemid} = 1; |
|
} |
|
} |
|
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','linktext','explanation') { |
foreach my $item ('label','title','target','linktext','explanation','append') { |
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 10624 sub modify_ltitools {
|
Line 10713 sub modify_ltitools {
|
} |
} |
} |
} |
} |
} |
|
if (ref($confhash{$itemid}{'fields'}) eq 'HASH') { |
|
if ($confhash{$itemid}{'fields'}{'user'}) { |
|
if ($env{'form.ltitools_userincdom_'.$i}) { |
|
$confhash{$itemid}{'incdom'} = 1; |
|
} |
|
if ($domconfig{$action}{$itemid}{'incdom'} ne $confhash{$itemid}{'incdom'}) { |
|
$changes{$itemid} = 1; |
|
} |
|
} |
|
} |
$allpos[$newpos] = $itemid; |
$allpos[$newpos] = $itemid; |
} |
} |
if ($imgdeletions{$itemid}) { |
if ($imgdeletions{$itemid}) { |
Line 10757 sub modify_ltitools {
|
Line 10856 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') { |
foreach my $item ('version','msgtype','sigmethod','url','lifetime') { |
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>'; |
} |
} |
Line 10771 sub modify_ltitools {
|
Line 10870 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','linktext','explanation'); |
my @possconfig = ('label','title','target','linktext','explanation','append'); |
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) { |
Line 10785 sub modify_ltitools {
|
Line 10884 sub modify_ltitools {
|
$resulttext .= &mt('None'); |
$resulttext .= &mt('None'); |
} |
} |
$resulttext .= '</li>'; |
$resulttext .= '</li>'; |
foreach my $item ('passback','roster') { |
|
$resulttext .= '<li>'.$lt{$item}.' '; |
|
if ($confhash{$itemid}{$item}) { |
|
$resulttext .= &mt('Yes'); |
|
} else { |
|
$resulttext .= &mt('No'); |
|
} |
|
$resulttext .= '</li>'; |
|
} |
|
if (ref($confhash{$itemid}{'display'}) eq 'HASH') { |
if (ref($confhash{$itemid}{'display'}) eq 'HASH') { |
my $displaylist; |
my $displaylist; |
if ($confhash{$itemid}{'display'}{'target'}) { |
if ($confhash{$itemid}{'display'}{'target'}) { |
Line 10825 sub modify_ltitools {
|
Line 10915 sub modify_ltitools {
|
} |
} |
if ($fieldlist) { |
if ($fieldlist) { |
$fieldlist =~ s/,$//; |
$fieldlist =~ s/,$//; |
|
if ($confhash{$itemid}{'fields'}{'user'}) { |
|
if ($confhash{$itemid}{'incdom'}) { |
|
$fieldlist .= ' ('.&mt('username:domain').')'; |
|
} else { |
|
$fieldlist .= ' ('.&mt('username').')'; |
|
} |
|
} |
$resulttext .= '<li>'.&mt('Data sent').':'.$fieldlist.'</li>'; |
$resulttext .= '<li>'.&mt('Data sent').':'.$fieldlist.'</li>'; |
} |
} |
} |
} |
Line 10849 sub modify_ltitools {
|
Line 10946 sub modify_ltitools {
|
} |
} |
} |
} |
if ($customlist) { |
if ($customlist) { |
$resulttext .= '<li>'.&mt('Custom items').':'.$customlist.'</li>'; |
$resulttext .= '<li>'.&mt('Custom items').': '.$customlist.'</li>'; |
} |
} |
} |
} |
$resulttext .= '</ul></li>'; |
$resulttext .= '</ul></li>'; |