version 1.325, 2018/03/23 01:01:20
|
version 1.326, 2018/05/08 01:48:18
|
Line 2909 function toggleLTI(form,setting,item) {
|
Line 2909 function toggleLTI(form,setting,item) {
|
} |
} |
} |
} |
} |
} |
|
} else if (setting == 'lcmenu') { |
|
var menus = new Array('lti_topmenu_'+item,'lti_inlinemenu_'+item); |
|
var divid = 'lti_menufield_'+item; |
|
var setvis = ''; |
|
for (var i=0; i<menus.length; i++) { |
|
var radioname = menus[i]; |
|
var num = form.elements[radioname].length; |
|
if (num) { |
|
for (var j=0; j<num; j++) { |
|
if (form.elements[radioname][j].checked) { |
|
if (form.elements[radioname][j].value == '1') { |
|
if (document.getElementById(divid)) { |
|
document.getElementById(divid).style.display = 'inline-block'; |
|
} |
|
setvis = 1; |
|
break; |
|
} |
|
} |
|
} |
|
} |
|
if (setvis == 1) { |
|
break; |
|
} |
|
} |
|
if (!setvis) { |
|
if (document.getElementById(divid)) { |
|
document.getElementById(divid).style.display = 'none'; |
|
} |
|
} |
} |
} |
return; |
return; |
} |
} |
Line 4693 sub lti_names {
|
Line 4722 sub lti_names {
|
'other' => 'Other', |
'other' => 'Other', |
'passback' => 'Can return grades to Consumer:', |
'passback' => 'Can return grades to Consumer:', |
'roster' => 'Can retrieve roster from Consumer:', |
'roster' => 'Can retrieve roster from Consumer:', |
|
'topmenu' => 'Display LON-CAPA page header', |
|
'inlinemenu'=> 'Display LON-CAPA inline menu', |
); |
); |
return %lt; |
return %lt; |
} |
} |
Line 4709 sub lti_options {
|
Line 4740 sub lti_options {
|
$checked{'crssec'} = {}; |
$checked{'crssec'} = {}; |
$checked{'crssecsrc'} = {}; |
$checked{'crssecsrc'} = {}; |
$checked{'lcauth'} = {}; |
$checked{'lcauth'} = {}; |
|
$checked{'menuitem'} = {}; |
if ($num eq 'add') { |
if ($num eq 'add') { |
$checked{'lcauth'}{'lti'} = ' checked="checked"'; |
$checked{'lcauth'}{'lti'} = ' checked="checked"'; |
} |
} |
Line 4719 sub lti_options {
|
Line 4751 sub lti_options {
|
my $lcauthparm; |
my $lcauthparm; |
my $lcauthparmstyle = 'display:none'; |
my $lcauthparmstyle = 'display:none'; |
my $lcauthparmtext; |
my $lcauthparmtext; |
|
my $menusty; |
my $numinrow = 4; |
my $numinrow = 4; |
|
my %menutitles = <imenu_titles(); |
|
|
if (ref($current) eq 'HASH') { |
if (ref($current) eq 'HASH') { |
if (($current->{'mapuser'} ne '') && ($current->{'mapuser'} ne 'lis_person_sourcedid')) { |
if (($current->{'mapuser'} ne '') && ($current->{'mapuser'} ne 'lis_person_sourcedid')) { |
Line 4749 sub lti_options {
|
Line 4783 sub lti_options {
|
} |
} |
if ($current->{'makecrs'}) { |
if ($current->{'makecrs'}) { |
$checked{'makecrs'}{'Y'} = ' checked="checked"'; |
$checked{'makecrs'}{'Y'} = ' checked="checked"'; |
} |
} |
if (ref($current->{'makeuser'}) eq 'ARRAY') { |
if (ref($current->{'makeuser'}) eq 'ARRAY') { |
foreach my $role (@{$current->{'makeuser'}}) { |
foreach my $role (@{$current->{'makeuser'}}) { |
$checked{'makeuser'}{$role} = ' checked="checked"'; |
$checked{'makeuser'}{$role} = ' checked="checked"'; |
Line 4788 sub lti_options {
|
Line 4822 sub lti_options {
|
} else { |
} else { |
$checked{'crssec'}{'N'} = ' checked="checked"'; |
$checked{'crssec'}{'N'} = ' checked="checked"'; |
} |
} |
|
if ($current->{'topmenu'}) { |
|
$checked{'topmenu'}{'Y'} = ' checked="checked"'; |
|
} else { |
|
$checked{'topmenu'}{'N'} = ' checked="checked"'; |
|
} |
|
if ($current->{'inlinemenu'}) { |
|
$checked{'inlinemenu'}{'Y'} = ' checked="checked"'; |
|
} else { |
|
$checked{'inlinemenu'}{'N'} = ' checked="checked"'; |
|
} |
|
if (($current->{'topmenu'}) || ($current->{'inlinemenu'})) { |
|
$menusty = 'inline-block'; |
|
if (ref($current->{'lcmenu'}) eq 'ARRAY') { |
|
foreach my $item (@{$current->{'lcmenu'}}) { |
|
if (exists($menutitles{$item})) { |
|
$checked{'menuitem'}{$item} = ' checked="checked"'; |
|
} |
|
} |
|
} |
|
} else { |
|
$menusty = 'none'; |
|
} |
} else { |
} else { |
$checked{'makecrs'}{'N'} = ' checked="checked"'; |
$checked{'makecrs'}{'N'} = ' checked="checked"'; |
$checked{'crssec'}{'N'} = ' checked="checked"'; |
$checked{'crssec'}{'N'} = ' checked="checked"'; |
#FIXME |
$checked{'topmenu'}{'N'} = ' checked="checked"'; |
|
$checked{'inlinemenu'}{'Y'} = ' checked="checked"'; |
|
$checked{'menuitem'}{'grades'} = ' checked="checked"'; |
|
$menusty = 'inline-block'; |
} |
} |
my @coursetypes = ('official','unofficial','community','textbook','placement','lti'); |
my @coursetypes = ('official','unofficial','community','textbook','placement','lti'); |
my %coursetypetitles = &Apache::lonlocal::texthash ( |
my %coursetypetitles = &Apache::lonlocal::texthash ( |
Line 4818 sub lti_options {
|
Line 4877 sub lti_options {
|
my $onclicksec = ' onclick="toggleLTI(this.form,'."'sec','$num'".');"'; |
my $onclicksec = ' onclick="toggleLTI(this.form,'."'sec','$num'".');"'; |
my $onclicksecsrc = ' onclick="toggleLTI(this.form,'."'secsrc','$num'".')"'; |
my $onclicksecsrc = ' onclick="toggleLTI(this.form,'."'secsrc','$num'".')"'; |
my $onclicklcauth = ' onclick="toggleLTI(this.form,'."'lcauth','$num'".')"'; |
my $onclicklcauth = ' onclick="toggleLTI(this.form,'."'lcauth','$num'".')"'; |
|
my $onclickmenu = ' onclick="toggleLTI(this.form,'."'lcmenu','$num'".');"'; |
my $output = '<fieldset><legend>'.&mt('Mapping users').'</legend>'. |
my $output = '<fieldset><legend>'.&mt('Mapping users').'</legend>'. |
'<div class="LC_floatleft"><span class="LC_nobreak">'.&mt('LON-CAPA username').': '; |
'<div class="LC_floatleft"><span class="LC_nobreak">'.&mt('LON-CAPA username').': '; |
foreach my $option ('sourcedid','email','other') { |
foreach my $option ('sourcedid','email','other') { |
Line 4944 sub lti_options {
|
Line 5004 sub lti_options {
|
'<label><input type="radio" name="lti_'.$extra.'_'.$num.'" value="1"'.$checkedon.' />'. |
'<label><input type="radio" name="lti_'.$extra.'_'.$num.'" value="1"'.$checkedon.' />'. |
&mt('Yes').'</label><br />'; |
&mt('Yes').'</label><br />'; |
} |
} |
|
$output .= '</span></fieldset>'. |
|
'<fieldset><legend>'.&mt('Course defaults (Course Coordinator can override)').'</legend>'. |
|
'<div class="LC_floatleft"><span class="LC_nobreak">'.$lt{'topmenu'}.': '. |
|
'<label><input type="radio" name="lti_topmenu_'.$num.'" value="0"'. |
|
$checked{'topmenu'}{'N'}.$onclickmenu.' />'.&mt('No').'</label>'.(' 'x2). |
|
'<label><input type="radio" name="lti_topmenu_'.$num.'" value="1"'. |
|
$checked{'topmenu'}{'Y'}.$onclickmenu.' />'.&mt('Yes').'</label><span></div>'. |
|
'<div style="padding:0;clear:both;margin:0;border:0"></div>'. |
|
'<div class="LC_floatleft"><span class="LC_nobreak">'.$lt{'inlinemenu'}.': '. |
|
'<label><input type="radio" name="lti_inlinemenu_'.$num.'" value="0"'. |
|
$checked{'inlinemenu'}{'N'}.$onclickmenu.' />'.&mt('No').'</label>'.(' 'x2). |
|
'<label><input type="radio" name="lti_inlinemenu_'.$num.'" value="1"'. |
|
$checked{'inlinemenu'}{'Y'}.$onclickmenu.' />'.&mt('Yes').'</label><span></div>'; |
|
$output .='<div style="padding:0;clear:both;margin:0;border:0"></div>'. |
|
'<div class="LC_floatleft" style="display:'.$menusty.';" id="lti_menufield_'.$num.'">'. |
|
'<span class="LC_nobreak">'.&mt('Menu items').': '; |
|
foreach my $type ('fullname','coursetitle','role','logout','grades') { |
|
$output .= '<label><input type="checkbox" name="lti_menuitem_'.$num.'" value="'.$type.'"'. |
|
$checked{'menuitem'}{$type}.' />'.$menutitles{$type}.'</label>'. |
|
(' 'x2); |
|
} |
$output .= '</span></fieldset>'; |
$output .= '</span></fieldset>'; |
# '<fieldset><legend>'.&mt('Assigning author roles').'</legend>'; |
# '<fieldset><legend>'.&mt('Assigning author roles').'</legend>'; |
# |
# |
Line 4952 sub lti_options {
|
Line 5033 sub lti_options {
|
return $output; |
return $output; |
} |
} |
|
|
|
sub ltimenu_titles { |
|
return &Apache::lonlocal::texthash( |
|
fullname => 'Full name', |
|
coursetitle => 'Course title', |
|
role => 'Role', |
|
logout => 'Logout', |
|
grades => 'Grades', |
|
); |
|
} |
|
|
sub print_coursedefaults { |
sub print_coursedefaults { |
my ($position,$dom,$settings,$rowtotal) = @_; |
my ($position,$dom,$settings,$rowtotal) = @_; |
my ($css_class,$datatable,%checkedon,%checkedoff,%defaultchecked,@toggles); |
my ($css_class,$datatable,%checkedon,%checkedoff,%defaultchecked,@toggles); |
Line 11457 sub modify_lti {
|
Line 11548 sub modify_lti {
|
map { $posslticrs{$_} = 1; } @lticourseroles; |
map { $posslticrs{$_} = 1; } @lticourseroles; |
map { $posscrstype{$_} = 1; } @coursetypes; |
map { $posscrstype{$_} = 1; } @coursetypes; |
|
|
#FIXME |
my %menutitles = <imenu_titles(); |
|
|
my (@items,%deletions,%itemids); |
my (@items,%deletions,%itemids); |
if ($env{'form.lti_add'}) { |
if ($env{'form.lti_add'}) { |
my $consumer = $env{'form.lti_consumer_add'}; |
my $consumer = $env{'form.lti_consumer_add'}; |
Line 11610 sub modify_lti {
|
Line 11701 sub modify_lti {
|
} |
} |
} |
} |
} |
} |
foreach my $field ('passback','roster') { |
foreach my $field ('passback','roster','topmenu','inlinemenu') { |
if ($env{'form.lti_'.$field.'_'.$idx}) { |
if ($env{'form.lti_'.$field.'_'.$idx}) { |
$confhash{$itemid}{$field} = 1; |
$confhash{$itemid}{$field} = 1; |
} |
} |
} |
} |
|
|
|
if ($env{'form.lti_topmenu_'.$idx} || $env{'form.lti_inlinemenu_'.$idx}) { |
|
$confhash{$itemid}{lcmenu} = []; |
|
my @possmenu = &Apache::loncommon::get_env_multiple('form.lti_menuitem_'.$idx); |
|
foreach my $field (@possmenu) { |
|
if (exists($menutitles{$field})) { |
|
if ($field eq 'grades') { |
|
next unless ($env{'form.lti_inlinemenu_'.$idx}); |
|
} |
|
push(@{$confhash{$itemid}{lcmenu}},$field); |
|
} |
|
} |
|
} |
unless (($idx eq 'add') || ($changes{$itemid})) { |
unless (($idx eq 'add') || ($changes{$itemid})) { |
foreach my $field ('mapuser','mapcrs','makecrs','section','passback','roster','lcauth','lcauthparm') { |
foreach my $field ('mapuser','mapcrs','makecrs','section','passback','roster','lcauth','lcauthparm','topmenu','inlinemenu') { |
if ($domconfig{$action}{$itemid}{$field} ne $confhash{$itemid}{$field}) { |
if ($domconfig{$action}{$itemid}{$field} ne $confhash{$itemid}{$field}) { |
$changes{$itemid} = 1; |
$changes{$itemid} = 1; |
} |
} |
} |
} |
foreach my $field ('makeuser','mapcrstype','selfenroll','instdata') { |
foreach my $field ('makeuser','mapcrstype','selfenroll','instdata','lcmenu') { |
unless ($changes{$itemid}) { |
unless ($changes{$itemid}) { |
if (ref($domconfig{$action}{$itemid}{$field}) eq 'ARRAY') { |
if (ref($domconfig{$action}{$itemid}{$field}) eq 'ARRAY') { |
if (ref($confhash{$itemid}{$field}) eq 'ARRAY') { |
if (ref($confhash{$itemid}{$field}) eq 'ARRAY') { |
Line 11833 sub modify_lti {
|
Line 11937 sub modify_lti {
|
} else { |
} else { |
$resulttext .= '<li>'.&mt('No section assignment').'</li>'; |
$resulttext .= '<li>'.&mt('No section assignment').'</li>'; |
} |
} |
foreach my $item ('passback','roster') { |
foreach my $item ('passback','roster','topmenu','inlinemenu') { |
$resulttext .= '<li>'.$lt{$item}.' '; |
$resulttext .= '<li>'.$lt{$item}.': '; |
if ($confhash{$itemid}{$item}) { |
if ($confhash{$itemid}{$item}) { |
$resulttext .= &mt('Yes'); |
$resulttext .= &mt('Yes'); |
} else { |
} else { |
Line 11842 sub modify_lti {
|
Line 11946 sub modify_lti {
|
} |
} |
$resulttext .= '</li>'; |
$resulttext .= '</li>'; |
} |
} |
|
if (ref($confhash{$itemid}{'lcmenu'}) eq 'ARRAY') { |
|
if (@{$confhash{$itemid}{'lcmenu'}} > 0) { |
|
$resulttext .= '<li>'.&mt('Menu items:').' '. |
|
join(', ', map { $menutitles{$_}; } (@{$confhash{$itemid}{'lcmenu'}})).'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('No menu items displayed in header or online menu').'</li>'; |
|
} |
|
} |
$resulttext .= '</ul></li>'; |
$resulttext .= '</ul></li>'; |
} |
} |
} |
} |