--- loncom/interface/domainprefs.pm 2018/07/06 04:03:31 1.328 +++ loncom/interface/domainprefs.pm 2018/07/25 20:23:31 1.335 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.328 2018/07/06 04:03:31 raeburn Exp $ +# $Id: domainprefs.pm,v 1.335 2018/07/25 20:23:31 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -781,6 +781,10 @@ sub print_config_box { $output = &Apache::lonuserutils::custom_roledefs_js($context,$crstype,$formname,\%full, \@templateroles); + } elsif ($action eq 'ltitools') { + $output .= <itools_javascript($settings); + } elsif ($action eq 'lti') { + $output .= <i_javascript($settings); } $output .= ' @@ -1436,7 +1440,7 @@ sub print_login { } else { $datatable .= ''; } - $datatable .= ''; + $datatable .= ''; } $datatable .= '
'; } @@ -1596,7 +1600,7 @@ sub display_color_options { my $datatable = ''. ''.$choices->{'font'}.''; if (!$is_custom->{'font'}) { - $datatable .= ''.&mt('Default in use:').' '.$defaults->{'font'}.''; + $datatable .= ''.&mt('Default in use:').' '.$defaults->{'font'}.''; } else { $datatable .= ' '; } @@ -1605,12 +1609,12 @@ sub display_color_options { $datatable .= ''. ' '. - ' '; + ' '; unless ($role eq 'login') { $datatable .= ''. ''.$choices->{'fontmenu'}.''; if (!$is_custom->{'fontmenu'}) { - $datatable .= ''.&mt('Default in use:').' '.$defaults->{'fontmenu'}.''; + $datatable .= ''.&mt('Default in use:').' '.$defaults->{'fontmenu'}.''; } else { $datatable .= ' '; } @@ -1620,7 +1624,7 @@ sub display_color_options { ' '. - ' '; + ' '; } my $switchserver = &check_switchserver($dom,$confname); foreach my $img (@{$images}) { @@ -1738,7 +1742,7 @@ sub display_color_options { my $bgs_def; foreach my $item (@{$bgs}) { if (!$is_custom->{$item}) { - $bgs_def .= ''.$choices->{$item}.'    
'.$defaults->{'bgs'}{$item}.''; + $bgs_def .= ''.$choices->{$item}.'    
'.$defaults->{'bgs'}{$item}.''; } } if ($bgs_def) { @@ -1766,7 +1770,7 @@ sub display_color_options { my $links_def; foreach my $item (@{$links}) { if (!$is_custom->{$item}) { - $links_def .= ''.$choices->{$item}.'
'.$defaults->{'links'}{$item}.''; + $links_def .= ''.$choices->{$item}.'
'.$defaults->{'links'}{$item}.''; } } if ($links_def) { @@ -1852,17 +1856,15 @@ sub image_changes { my ($is_custom,$alt_text,$img_import,$showfile,$fullsize,$role,$img,$imgfile,$logincolors) = @_; my $output; if ($img eq 'login') { - # suppress image for Log-in header + $output = ''.$logincolors; # suppress image for Log-in header } elsif (!$is_custom) { if ($img ne 'domlogo') { - $output .= &mt('Default image:').'
'; + $output = &mt('Default image:').'
'; } else { - $output .= &mt('Default in use:').'
'; + $output = &mt('Default in use:').'
'; } } - if ($img eq 'login') { # suppress image for Log-in header - $output .= ''.$logincolors; - } else { + if ($img ne 'login') { if ($img_import) { $output .= ''; } @@ -2484,7 +2486,7 @@ sub print_textbookcourses { $datatable .= ''; } $datatable .= ' '."\n". - ''.&mt('Add').''."\n". + ''.&mt('Add').''."\n". ''. ''.&mt('Subject:').' '."\n". (' 'x2). @@ -2501,13 +2503,13 @@ sub print_textbookcourses { } else { $datatable .= ''; } + $datatable .= ''."\n"; } - $datatable .= ''."\n". - ''.&mt('LON-CAPA course:').' '. + $datatable .= ''.&mt('LON-CAPA course:').' '. &Apache::loncommon::select_dom_form($env{'request.role.domain'},$type.'_addbook_cdom'). ''. &Apache::loncommon::selectcourse_link - ('display',$type.'_addbook_cnum',$type.'_addbook_cdom',undef,undef,undef,'Course'); + ('display',$type.'_addbook_cnum',$type.'_addbook_cdom',undef,undef,undef,'Course'). ''."\n". ''."\n"; $itemcount ++; @@ -3026,7 +3028,7 @@ sub print_autoenroll { ''.&mt('Failsafe for no drops when institutional data missing').''. ''. ''; + ' value="'.$failsafe.'" size="4" />'; $$rowtotal += 4; return $datatable; } @@ -3456,7 +3458,7 @@ sub print_contacts { if ($currfield{$field} eq 'no') { $display = ' style="display:none"'; } - $datatable .= ''. + $datatable .= ''. ''.&mt('Maximum size for upload (MB)').''. ''; } @@ -3501,7 +3503,7 @@ sub print_contacts { 'value="'.$bccemails{$type}.'" />'. '
'.&mt('Optional added text').''. &mt('Text automatically added to e-mail:').' '. - '
'. + '
'. ''.&mt('Location:').' '. ''. (' 'x2). @@ -3649,7 +3651,7 @@ sub overridden_helpdesk { 'value="'.$bccemails.'" />
'. '
'.&mt('Optional added text').''. &mt('Text automatically added to e-mail:').' '. - '
'. + '
'. ''.&mt('Location:').' '. ''. (' 'x2). @@ -3778,7 +3780,6 @@ sub print_helpsettings { push(@jsarray,('notinc','notexc')); } my $hiddenstr = join("','",@jsarray); - $datatable .= &helpsettings_javascript(\@roles_by_num,$maxnum,$hiddenstr,$formname); my $context = 'domprefs'; my $crstype = 'Course'; my $prefix = 'helproles_'; @@ -3881,7 +3882,9 @@ sub print_helpsettings { \@templateroles,$newcust). &Apache::lonuserutils::custom_role_table('Course',\%full,\%levels, \%levelscurrent,$newcust). - '
'; + ''. + &helpsettings_javascript(\@roles_by_num,$maxnum,$hiddenstr,$formname). + ''; $count ++; $$rowtotal += $count; } @@ -4170,7 +4173,7 @@ sub print_ltitools { my $confname = $dom.'-domainconfig'; my $switchserver = &check_switchserver($dom,$confname); my $maxnum = scalar(keys(%ordered)); - my $datatable = <itools_javascript($settings); + my $datatable; my %lt = <itools_names(); my @courseroles = ('cc','in','ta','ep','st'); my @ltiroles = qw(Instructor ContentDeveloper TeachingAssistant Learner); @@ -4271,9 +4274,9 @@ sub print_ltitools { ''. (' 'x2); } - $datatable .= '
'. + $datatable .= '

'. '
'.$lt{'linktext'}.'
'. - '
'. + ''. '
'.$lt{'explanation'}.'
'. '

'; @@ -4444,7 +4447,7 @@ sub print_ltitools { $datatable .= ''; } $datatable .= ' '."\n". - ''.&mt('Add').''."\n". + ''.&mt('Add').''."\n". ''. '
'.&mt('Required settings').''. ''.$lt{'title'}.': '."\n". @@ -4481,11 +4484,11 @@ sub print_ltitools { ''. (' 'x2); } - $datatable .= '
'. + $datatable .= '
'. '
'.$lt{'linktext'}.'
'. - '
'. + ''. '
'.$lt{'explanation'}.'
'. - ''. + ''. '

'; my %units = ( 'passback' => 'days', @@ -4564,7 +4567,7 @@ sub print_ltitools { ''. ''. - '
'."\n". + ''."\n". ''."\n". ''."\n"; $itemcount ++; @@ -4622,7 +4625,7 @@ sub print_lti { } } my $maxnum = scalar(keys(%ordered)); - my $datatable = <i_javascript($settings); + my $datatable; my %lt = <i_names(); if (keys(%ordered)) { my @items = sort { $a <=> $b } keys(%ordered); @@ -4687,7 +4690,7 @@ sub print_lti { $datatable .= ''; } $datatable .= ' '."\n". - ''.&mt('Add').''."\n". + ''.&mt('Add').''."\n". ''. '
'.&mt('Required settings').''. ''.$lt{'consumer'}. @@ -4950,7 +4953,7 @@ sub lti_options { $checked{'mapcrs'}{$option}.$onclickcrs.' />'.$option.''. ($option eq 'other' ? '' : (' 'x2) ); } - $output .= '
'. + $output .= '
'. ''. '
'. ''.&mt('LON-CAPA course type(s)').': '; @@ -4978,7 +4981,7 @@ sub lti_options { ''.(' 'x2). ''. + $checked{'crssec'}{'Y'}.$onclicksec.' />'.&mt('Yes').''. '
'. ''.&mt('From').':
'. + '
'. ''. '
'; foreach my $extra ('passback','roster') { @@ -5004,19 +5007,19 @@ sub lti_options { '
'; } - $output .= '
'. + $output .= ''. '
'.&mt('Course defaults (Course Coordinator can override)').''. '
'.$lt{'topmenu'}.': '. ''.(' 'x2). '
'. + $checked{'topmenu'}{'Y'}.$onclickmenu.' />'.&mt('Yes').''. '
'. '
'.$lt{'inlinemenu'}.': '. ''.(' 'x2). '
'; + $checked{'inlinemenu'}{'Y'}.$onclickmenu.' />'.&mt('Yes').''; $output .='
'. '
'. ''.&mt('Menu items').': '; @@ -5025,7 +5028,7 @@ sub lti_options { $checked{'menuitem'}{$type}.' />'.$menutitles{$type}.''. (' 'x2); } - $output .= '
'; + $output .= ''; # '
'.&mt('Assigning author roles').''; # # $output .= '
'. @@ -5521,7 +5524,7 @@ sub print_validation_rows { ' '; } } elsif ($item eq 'markup') { - $datatable .= ''; } @@ -5543,7 +5546,7 @@ sub print_validation_rows { my ($numdc,$dctable,$rows) = &active_dc_picker($dom,$numinrow,'radio', 'validationdc',%currhash); my $css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; - $datatable .= ''; + $datatable .= ''; if ($numdc > 1) { $datatable .= &mt('Course creation processed as: (choose Dom. Coord.)'); } else { @@ -6846,7 +6849,7 @@ sub print_selfcreation { $datatable .= ''. ''.&mt('Mapping of Shibboleth environment variable names to user data fields (SSO auth)').''. ''."\n". - '
'."\n"; + ''."\n"; for (my $i=0; $i<@fields; $i++) { $rem = $i%($numperrow); if ($rem == 0) { @@ -7632,7 +7635,7 @@ sub print_defaults { 1 => 'Yes, allow login then update passwd file using default cost (if higher)', 2 => 'Yes, disallow login if stored cost is less than domain default', ); - $datatable .= '
'; + $datatable .= '
'; foreach my $option (@options) { my $checked = ' '; my $onclick; @@ -8253,7 +8256,7 @@ sub print_serverstatuses { ''. ''. - ''."\n"; + ''."\n"; } $$rowtotal += $rownum; return $datatable; @@ -8571,7 +8574,7 @@ sub build_category_rows { pop(@{$path}); } } else { - $text .= &mt('Add subcategory:').' '.&mt('Add subcategory:').''; + $text .= ''; } } } @@ -8846,7 +8849,7 @@ sub insttypes_row { } $output .= ' '; } else { - if (($rem == 0) && (@{$types} > 0)) { + if ($rem == 0) { $output .= ''; } if ($colsleft > 1) { @@ -16360,12 +16363,17 @@ sub modify_ssl { if ($env{'form.'.$prefix.'_'.$type} =~ /^(no|req)$/) { $value = $env{'form.'.$prefix.'_'.$type}; } - if (ref($domconfig{$action}{$prefix}) eq 'HASH') { - if ($domconfig{$action}{$prefix}{$type} ne '') { - if ($value ne $domconfig{$action}{$prefix}{$type}) { + if (ref($domconfig{$action}) eq 'HASH') { + if (ref($domconfig{$action}{$prefix}) eq 'HASH') { + if ($domconfig{$action}{$prefix}{$type} ne '') { + if ($value ne $domconfig{$action}{$prefix}{$type}) { + $changes{$prefix}{$type} = 1; + } + $defaultshash{$action}{$prefix}{$type} = $value; + } else { + $defaultshash{$action}{$prefix}{$type} = $value; $changes{$prefix}{$type} = 1; } - $defaultshash{$action}{$prefix}{$type} = $value; } else { $defaultshash{$action}{$prefix}{$type} = $value; $changes{$prefix}{$type} = 1; @@ -16445,10 +16453,10 @@ sub modify_ssl { $domdefaults{'replication'} = $defaultshash{$action}{'replication'}; } if (ref($defaultshash{$action}{'connto'}) eq 'HASH') { - $domdefaults{'connto'} = $domconfig{$action}{'connto'}; + $domdefaults{'connto'} = $defaultshash{$action}{'connto'}; } if (ref($defaultshash{$action}{'connfrom'}) eq 'HASH') { - $domdefaults{'connfrom'} = $domconfig{$action}{'connfrom'}; + $domdefaults{'connfrom'} = $defaultshash{$action}{'connfrom'}; } } my $cachetime = 24*60*60;
'.&mt('Add subcategory:').'