'.$domservers{$lonhost}.' | '.
' | '.
''.
- ''.&mt('SSO').' | '.
- ''.&mt('Non-SSO').' | '.
+ ' '.
+ ''.
' | ';
@@ -2370,7 +2411,7 @@ sub print_quotas {
@options = ('norequest','approval','automatic');
%titles = &authorrequest_titles();
} else {
- @usertools = ('aboutme','blog','webdav','portfolio');
+ @usertools = ('aboutme','blog','webdav','portfolio','timezone');
%titles = &tool_titles();
}
if (ref($types) eq 'ARRAY') {
@@ -2474,9 +2515,12 @@ sub print_quotas {
}
} else {
my $checked = 'checked="checked" ';
+ if ($item eq 'timezone') {
+ $checked = '';
+ }
if (ref($settings) eq 'HASH') {
if (ref($settings->{$item}) eq 'HASH') {
- if ($settings->{$item}->{$type} == 0) {
+ if (!$settings->{$item}->{$type}) {
$checked = '';
} elsif ($settings->{$item}->{$type} == 1) {
$checked = 'checked="checked" ';
@@ -3415,8 +3459,17 @@ ENDSCRIPT
sub lti_javascript {
my ($dom,$settings) = @_;
my $togglejs = <i_toggle_js($dom);
+ my $linkprot_js = &Apache::courseprefs::linkprot_javascript();
unless (ref($settings) eq 'HASH') {
- return $togglejs;
+ return $togglejs.'
+
+';
}
my (%ordered,$total,%jstext);
$total = scalar(keys(%{$settings}));
@@ -3434,7 +3487,6 @@ sub lti_javascript {
push(@jsarray,$ordered{$item});
}
my $jstext = ' var lti = Array('."'".join("','",@jsarray)."'".');'."\n";
- my $linkprot_js = &Apache::courseprefs::linkprot_javascript();
return <<"ENDSCRIPT";
@@ -3903,16 +3836,16 @@ sub saml_javascript {
return <<"ENDSCRIPT";
@@ -5374,421 +5305,50 @@ sub radiobutton_prefs {
}
sub print_ltitools {
- my ($dom,$settings,$rowtotal) = @_;
- my $rownum = 0;
- my $css_class;
- my $itemcount = 1;
- my $maxnum = 0;
- my %ordered;
+ my ($position,$dom,$settings,$rowtotal) = @_;
+ my (%rules,%encrypt,%privkeys,%linkprot);
if (ref($settings) eq 'HASH') {
- foreach my $item (keys(%{$settings})) {
- if (ref($settings->{$item}) eq 'HASH') {
- my $num = $settings->{$item}{'order'};
- $ordered{$num} = $item;
- }
- }
- }
- my $confname = $dom.'-domainconfig';
- my $switchserver = &check_switchserver($dom,$confname);
- my $maxnum = scalar(keys(%ordered));
- my $datatable;
- my %lt = <itools_names();
- 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,$secret,$url,$lifetime,$imgsrc,%sigsel);
- if (ref($settings->{$item}) eq 'HASH') {
- $title = $settings->{$item}->{'title'};
- $url = $settings->{$item}->{'url'};
- $key = $settings->{$item}->{'key'};
- $secret = $settings->{$item}->{'secret'};
- $lifetime = $settings->{$item}->{'lifetime'};
- my $image = $settings->{$item}->{'image'};
- if ($image ne '') {
- $imgsrc = '';
- }
- 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 .= ''
- .''.(' 'x2).
- ' | '.
- ''.
- ''.
- '';
- 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 .= ''.
- '';
- my %courseconfig;
- if (ref($settings->{$item}) eq 'HASH') {
- if (ref($settings->{$item}->{'crsconf'}) eq 'HASH') {
- %courseconfig = %{$settings->{$item}->{'crsconf'}};
}
}
- $datatable .= ''.
- ' | '."\n";
- $itemcount ++;
}
}
- $css_class = $itemcount%2?' class="LC_odd_row"':'';
- my $chgstr = ' onchange="javascript:reorderLTITools(this.form,'."'ltitools_add_pos'".');"';
- $datatable .= ''."\n".
- ''."\n".
- ' '."\n".
- ''.&mt('Add').' | '."\n".
- ''.
- ''.
- ''.
- '';
- $datatable .= ''.
- ''.
- ''."\n".
- ' | '."\n".
- ' '."\n";
- $itemcount ++;
return $datatable;
}
@@ -5802,7 +5362,7 @@ sub ltitools_names {
'key' => 'Key',
'lifetime' => 'Nonce lifetime (s)',
'secret' => 'Secret',
- 'icon' => 'Icon',
+ 'icon' => 'Icon',
'user' => 'User',
'fullname' => 'Full Name',
'firstname' => 'First Name',
@@ -5820,7 +5380,7 @@ sub ltitools_names {
'roster' => 'Tool can retrieve roster:',
'crstarget' => 'Display target',
'crslabel' => 'Course label',
- 'crstitle' => 'Course title',
+ 'crstitle' => 'Course title',
'crslinktext' => 'Link Text',
'crsexplanation' => 'Explanation',
'crsappend' => 'Provider URL',
@@ -5828,6 +5388,123 @@ sub ltitools_names {
return %lt;
}
+sub secrets_form {
+ my ($dom,$context,$encrypt,$privkeys,$rowtotal) = @_;
+ my @ids=&Apache::lonnet::current_machine_ids();
+ my %servers = &Apache::lonnet::get_servers($dom,'library');
+ my $primary = &Apache::lonnet::domain($dom,'primary');
+ my ($css_class,$extra,$numshown,$itemcount,$output);
+ $itemcount = 0;
+ foreach my $hostid (sort(keys(%servers))) {
+ my ($showextra,$divsty,$switch);
+ if ($hostid eq $primary) {
+ if ($context eq 'ltisec') {
+ if (($encrypt->{'ltisec_consumers'}) || ($encrypt->{'ltisec_domlinkprot'})) {
+ $showextra = 1;
+ }
+ if ($encrypt->{'ltisec_crslinkprot'}) {
+ $showextra = 1;
+ }
+ } else {
+ if (($encrypt->{'toolsec_crs'}) || ($encrypt->{'toolsec_dom'})) {
+ $showextra = 1;
+ }
+ }
+ unless (grep(/^\Q$hostid\E$/,@ids)) {
+ $switch = 1;
+ }
+ if ($showextra) {
+ $numshown ++;
+ $divsty = 'display:inline-block';
+ } else {
+ $divsty = 'display:none';
+ }
+ $extra .= '';
+ }
+ }
+ my (%choices,@toggles,%defaultchecked);
+ if ($context eq 'ltisec') {
+ %choices = &Apache::lonlocal::texthash (
+ ltisec_crslinkprot => 'Encrypt stored link protection secrets defined in courses',
+ ltisec_domlinkprot => 'Encrypt stored link protection secrets defined in domain',
+ ltisec_consumers => 'Encrypt stored consumer secrets defined in domain',
+ );
+ @toggles = qw(ltisec_crslinkprot ltisec_domlinkprot ltisec_consumers);
+ %defaultchecked = (
+ 'ltisec_crslinkprot' => 'off',
+ 'ltisec_domlinkprot' => 'off',
+ 'ltisec_consumers' => 'off',
+ );
+ } else {
+ %choices = &Apache::lonlocal::texthash (
+ toolsec_crs => 'Encrypt stored external tool secrets defined in courses',
+ toolsec_dom => 'Encrypt stored external tool secrets defined in domain',
+ );
+ @toggles = qw(toolsec_crs toolsec_dom);
+ %defaultchecked = (
+ 'toolsec_crs' => 'off',
+ 'toolsec_dom' => 'off',
+ );
+ }
+ my ($onclick,$itemcount);
+ $onclick = 'javascript:toggleLTIEncKey(this.form,'."'$context'".');';
+ ($output,$itemcount) = &radiobutton_prefs($encrypt,\@toggles,\%defaultchecked,
+ \%choices,$itemcount,$onclick,'','left','no');
+
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ my $noprivkeysty = 'display:inline-block';
+ if ($numshown) {
+ $noprivkeysty = 'display:none';
+ }
+ $output .= ''.&mt('Encryption Key(s)').' | '.
+ ''.
+ ''.&mt('Not in use').' '.
+ $extra.
+ ' | ';
+ $itemcount ++;
+ $$rowtotal += $itemcount;
+ return $output;
+}
+
sub print_proctoring {
my ($dom,$settings,$rowtotal) = @_;
my $itemcount = 1;
@@ -6513,104 +6190,16 @@ sub print_lti {
}
}
if ($position eq 'top') {
- my @ids=&Apache::lonnet::current_machine_ids();
- my %servers = &Apache::lonnet::get_servers($dom,'library');
- my $primary = &Apache::lonnet::domain($dom,'primary');
- my ($extra,$numshown);
- foreach my $hostid (sort(keys(%servers))) {
- my ($showextra,$divsty,$switch);
- if ($hostid eq $primary) {
- if (($encrypt{'ltisec_consumers'}) || ($encrypt{'ltisec_domlinkprot'})) {
- $showextra = 1;
- }
- }
- if ($encrypt{'ltisec_crslinkprot'}) {
- $showextra = 1;
- }
- unless (grep(/^\Q$hostid\E$/,@ids)) {
- $switch = 1;
- }
- if ($showextra) {
- $numshown ++;
- $divsty = 'display:inline-block';
- } else {
- $divsty = 'display:none';
- }
- $extra .= '';
- }
- my %choices = &Apache::lonlocal::texthash (
- ltisec_crslinkprot => 'Encrypt stored link protection secrets defined in courses',
- ltisec_domlinkprot => 'Encrypt stored link protection secrets defined in domain',
- ltisec_consumers => 'Encrypt stored consumer secrets defined in domain',
- );
- my @toggles = qw(ltisec_crslinkprot ltisec_domlinkprot ltisec_consumers);
- my %defaultchecked = (
- 'ltisec_crslinkprot' => 'off',
- 'ltisec_domlinkprot' => 'off',
- 'ltisec_consumers' => 'off',
- );
- my ($onclick,$itemcount);
- $onclick = 'javascript:toggleLTIEncKey(this.form);';
- ($datatable,$itemcount) = &radiobutton_prefs(\%encrypt,\@toggles,\%defaultchecked,
- \%choices,$itemcount,$onclick,'','left','no');
-
- $css_class = $itemcount%2?' class="LC_odd_row"':'';
- my $noprivkeysty = 'display:inline-block';
- if ($numshown) {
- $noprivkeysty = 'display:none';
- }
- $datatable .= ''.&mt('Encryption Key(s)').' | '.
- ''.
- ''.&mt('Not in use').' '.
- $extra.
- ' | ';
- $itemcount ++;
- $$rowtotal += $itemcount;
+ $datatable = &secrets_form($dom,'ltisec',\%encrypt,\%privkeys,$rowtotal);
} elsif ($position eq 'middle') {
- $datatable = &password_rules('secrets',\$itemcount,\%rules);
+ $datatable = &password_rules('ltisecrets',\$itemcount,\%rules);
$$rowtotal += $itemcount;
} elsif ($position eq 'lower') {
$datatable .= &Apache::courseprefs::print_linkprotection($dom,'',$settings,$rowtotal,'','','domain');
} else {
+ my ($switchserver,$switchmessage);
+ $switchserver = &check_switchserver($dom);
+ $switchmessage = &mt("submit from domain's primary library server: [_1].",$switchserver);
my $maxnum = 0;
my %ordered;
if (ref($settings) eq 'HASH') {
@@ -6631,10 +6220,10 @@ sub print_lti {
for (my $i=0; $i<@items; $i++) {
$css_class = $itemcount%2?' class="LC_odd_row"':'';
my $item = $ordered{$items[$i]};
- my ($key,$secret,$lifetime,$consumer,$requser,$crsinc,$current);
+ my ($key,$secret,$usable,$lifetime,$consumer,$requser,$crsinc,$current);
if (ref($settings->{$item}) eq 'HASH') {
$key = $settings->{$item}->{'key'};
- $secret = $settings->{$item}->{'secret'};
+ $usable = $settings->{$item}->{'usable'};
$lifetime = $settings->{$item}->{'lifetime'};
$consumer = $settings->{$item}->{'consumer'};
$requser = $settings->{$item}->{'requser'};
@@ -6682,8 +6271,56 @@ sub print_lti {
' '.
(' 'x2).
''.$lt{'lifetime'}.':'.
- (' 'x2).
+ 'value="'.$lifetime.'" size="3" />
';
+ if ($key ne '') {
+ $datatable .= ''.$lt{'key'};
+ if ($switchserver) {
+ $datatable .= ': ['.&mt('[_1] to view/edit',$switchserver).']';
+ } else {
+ $datatable .= ':';
+ }
+ $datatable .= ' '.(' 'x2);
+ } elsif (!$switchserver) {
+ $datatable .= ''.$lt{'key'}.':'.
+ ''.
+ ' '.(' 'x2);
+ }
+ if ($switchserver) {
+ if ($usable ne '') {
+ $datatable .= ''.
+ $lt{'secret'}.': ['.&mt('not shown').'] '.(' 'x2).''.
+ ''.&mt('Change secret?').
+ ''.
+ (' 'x2).
+ ''.(' 'x2).
+ ''.
+ ' - '.$switchmessage.''.
+ '';
+ } elsif ($key eq '') {
+ $datatable .= ''.&mt('Key and Secret are required').' - '.$switchmessage.''."\n";
+ } else {
+ $datatable .= ''.&mt('Secret required').' - '.$switchmessage.''."\n";
+ }
+ } else {
+ if ($usable ne '') {
+ $datatable .= ''.
+ $lt{'secret'}.': ['.&mt('not shown').'] '.(' 'x2).''.
+ ''.&mt('Change?').
+ ''.
+ (' 'x2).
+ ' '.
+ ''.&mt('New Secret').':'.
+ ''.
+ '';
+ } else {
+ $datatable .=
+ ''.$lt{'secret'}.':'.
+ ''.
+ '';
+ }
+ }
+ $datatable .= '
'.
''.$lt{'requser'}.':'.
' '."\n".
''."\n".
@@ -6692,12 +6329,6 @@ sub print_lti {
' '."\n".
''."\n".
(' 'x4).
- ''.$lt{'key'}.
- ': '.
- (' 'x2).
- ''.$lt{'secret'}.':'.
- ''.
- ''.
''.
''.<i_options($i,$current,$itemcount,%lt).'';
$itemcount ++;
@@ -6726,8 +6357,16 @@ sub print_lti {
''.$lt{'version'}.': '."\n".
(' 'x2).
- ''.$lt{'lifetime'}.': '."\n".
- (' 'x2).
+ ''.$lt{'lifetime'}.':
'."\n";
+ if ($switchserver) {
+ $datatable .= ''.&mt('Key and Secret are required').' - '.$switchmessage.''."\n";
+ } else {
+ $datatable .= ''.$lt{'key'}.': '."\n".
+ (' 'x2).
+ ''.$lt{'secret'}.':'.
+ ' '."\n";
+ }
+ $datatable .= '
'.
''.$lt{'requser'}.':'.
' '."\n".
''."\n".
@@ -6735,11 +6374,6 @@ sub print_lti {
''.$lt{'crsinc'}.':'.
' '."\n".
''."\n".
- (' 'x4).
- ''.$lt{'key'}.': '."\n".
- (' 'x2).
- ''.$lt{'secret'}.':'.
- ' '."\n".
''.<i_options('add',undef,$itemcount,%lt).
''."\n".
''."\n";
@@ -6812,7 +6446,7 @@ sub lti_options {
if (($current->{'mapuser'} ne '') && ($current->{'mapuser'} ne 'lis_person_sourcedid')) {
$checked{'mapuser'}{'sourcedid'} = '';
if ($current->{'mapuser'} eq 'lis_person_contact_email_primary') {
- $checked{'mapuser'}{'email'} = ' checked="checked"';
+ $checked{'mapuser'}{'email'} = ' checked="checked"';
} else {
$checked{'mapuser'}{'other'} = ' checked="checked"';
$userfield = $current->{'mapuser'};
@@ -6822,7 +6456,7 @@ sub lti_options {
if (($current->{'mapcrs'} ne '') && ($current->{'mapcrs'} ne 'course_offering_sourcedid')) {
$checked{'mapcrs'}{'course_offering_sourcedid'} = '';
if ($current->{'mapcrs'} eq 'context_id') {
- $checked{'mapcrs'}{'context_id'} = ' checked="checked"';
+ $checked{'mapcrs'}{'context_id'} = ' checked="checked"';
} else {
$checked{'mapcrs'}{'other'} = ' checked="checked"';
$cidfield = $current->{'mapcrs'};
@@ -6850,7 +6484,7 @@ sub lti_options {
$checked{'lcauth'}{$1} = ' checked="checked"';
unless (($current->{'lcauth'} eq 'lti') || ($current->{'lcauth'} eq 'internal')) {
$lcauthparm = $current->{'lcauthparm'};
- $lcauthparmstyle = 'display:table-row';
+ $lcauthparmstyle = 'display:table-row';
if ($current->{'lcauth'} eq 'localauth') {
$lcauthparmtext = &mt('Local auth argument');
} else {
@@ -6867,7 +6501,7 @@ sub lti_options {
%rolemaps = %{$current->{'maproles'}};
}
if ($current->{'section'} ne '') {
- $checked{'crssec'}{'Y'} = ' checked="checked"';
+ $checked{'crssec'}{'Y'} = ' checked="checked"';
$crssecfieldsty = 'inline-block';
if ($current->{'section'} eq 'course_section_sourcedid') {
$checked{'crssecsrc'}{'sourcedid'} = ' checked="checked"';
@@ -6913,9 +6547,9 @@ sub lti_options {
$checked{'crssec'}{'N'} = ' checked="checked"';
$checked{'callback'}{'N'} = ' checked="checked"';
$checked{'topmenu'}{'N'} = ' checked="checked"';
- $checked{'inlinemenu'}{'Y'} = ' checked="checked"';
+ $checked{'inlinemenu'}{'Y'} = ' checked="checked"';
$checked{'menuitem'}{'grades'} = ' checked="checked"';
- $menusty = 'inline-block';
+ $menusty = 'inline-block';
}
my @coursetypes = ('official','unofficial','community','textbook','placement','lti');
my %coursetypetitles = &Apache::lonlocal::texthash (
@@ -6968,7 +6602,7 @@ sub lti_options {
''.
'
|