--- loncom/interface/domainprefs.pm 2009/08/22 21:10:32 1.108 +++ loncom/interface/domainprefs.pm 2009/12/04 14:33:52 1.123 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.108 2009/08/22 21:10:32 raeburn Exp $ +# $Id: domainprefs.pm,v 1.123 2009/12/04 14:33:52 jms Exp $ # # Copyright Michigan State University Board of Trustees # @@ -202,11 +202,12 @@ sub handler { 'quotas','autoenroll','autoupdate','directorysrch', 'usercreation','usermodification','contacts','defaults', 'scantron','coursecategories','serverstatuses', - 'requestcourses'],$dom); + 'requestcourses','helpsettings','coursedefaults'],$dom); my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll', 'autoupdate','directorysrch','contacts', 'usercreation','usermodification','scantron', - 'requestcourses','coursecategories','serverstatuses'); + 'requestcourses','coursecategories','serverstatuses','helpsettings', + 'coursedefaults'); my %prefs = ( 'rolecolors' => { text => 'Default color schemes', @@ -220,12 +221,13 @@ sub handler { {col1 => 'Administrator Settings', col2 => '',}], }, - 'login' => + 'login' => { text => 'Log-in page options', help => 'Domain_Configuration_Login_Page', header => [{col1 => 'Item', col2 => '',}], }, + 'defaults' => { text => 'Default authentication/language/timezone', help => 'Domain_Configuration_LangTZAuth', @@ -302,7 +304,7 @@ sub handler { col2 => 'Value'}], }, 'coursecategories' => - { text => 'Cataloging of courses', + { text => 'Cataloging of courses/communities', help => 'Domain_Configuration_Cataloging_Courses', header => [{col1 => 'Category settings', col2 => '',}, @@ -318,7 +320,37 @@ sub handler { col3 => 'Specific IPs', }], }, + 'helpsettings' => + {text => 'Help page settings', + help => 'Domain_Configuration_Help_Settings', + header => [{col1 => 'Authenticated Help Settings', + col2 => ''}, + {col1 => 'Unauthenticated Help Settings', + col2 => ''}], + }, + 'coursedefaults' => + {text => 'Course/Community defaults', + help => 'Domain_Configuration_Course_Defaults', + header => [{col1 => 'Setting', + col2 => 'Value',}], + }, + 'privacy' => + {text => 'User Privacy', + help => 'Domain_Configuration_User_Privacy', + header => [{col1 => 'Setting', + col2 => 'Value',}], + }, ); + my %servers = &dom_servers($dom); + if (keys(%servers) > 1) { + $prefs{'login'} = { text => 'Log-in page options', + help => 'Domain_Configuration_Login_Page', + header => [{col1 => 'Log-in Service', + col2 => 'Server Setting',}, + {col1 => 'Log-in Page Items', + col2 => ''}], + }; + } my @roles = ('student','coordinator','author','admin'); my @actions = &Apache::loncommon::get_env_multiple('form.actions'); &Apache::lonhtmlcommon::add_breadcrumb @@ -404,6 +436,10 @@ sub process_changes { $output = &modify_serverstatuses($dom,%domconfig); } elsif ($action eq 'requestcourses') { $output = &modify_quotas($dom,$action,%domconfig); + } elsif ($action eq 'helpsettings') { + $output = &modify_helpsettings($r,$dom,$confname,%domconfig); + } elsif ($action eq 'coursedefaults') { + $output = &modify_coursedefaults($dom,%domconfig); } return $output; } @@ -423,11 +459,13 @@ sub print_config_box { &Apache::loncommon::help_open_topic($item->{'help'}).''."\n". ''; $rowtotal ++; - if (($action eq 'autoupdate') || ($action eq 'rolecolors') || - ($action eq 'usercreation') || ($action eq 'usermodification') || - ($action eq 'coursecategories') || ($action eq 'requestcourses')) { + my $numheaders = 1; + if (ref($item->{'header'}) eq 'ARRAY') { + $numheaders = scalar(@{$item->{'header'}}); + } + if ($numheaders > 1) { my $colspan = ''; - if (($action eq 'rolecolors') || ($action eq 'coursecategories')) { + if (($action eq 'rolecolors') || ($action eq 'coursecategories') || ($action eq 'helpsettings')) { $colspan = ' colspan="2"'; } $output .= ' @@ -447,9 +485,14 @@ sub print_config_box { $output .= &print_usermodification('top',$dom,$settings,\$rowtotal); } elsif ($action eq 'coursecategories') { $output .= &print_coursecategories('top',$dom,$item,$settings,\$rowtotal); + } elsif ($action eq 'login') { + $output .= &print_login('top',$dom,$confname,$phase,$settings,\$rowtotal); + $colspan = ' colspan="2"'; } elsif ($action eq 'requestcourses') { $output .= &print_quotas($dom,$settings,\$rowtotal,$action); - } else { + } elsif ($action eq 'helpsettings') { + $output .= &print_helpsettings('top',$dom,$confname,$settings,\$rowtotal); + } elsif ($action eq 'rolecolors') { $output .= &print_rolecolors($phase,'student',$dom,$confname,$settings,\$rowtotal); } $output .= ' @@ -496,9 +539,13 @@ sub print_config_box { $rowtotal ++; } elsif ($action eq 'coursecategories') { $output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal); + } elsif ($action eq 'login') { + $output .= &print_login('bottom',$dom,$confname,$phase,$settings,\$rowtotal); } elsif ($action eq 'requestcourses') { $output .= &print_courserequestmail($dom,$settings,\$rowtotal); - } else { + } elsif ($action eq 'helpsettings') { + $output .= &print_helpsettings('bottom',$dom,$confname,$settings,\$rowtotal); + } elsif ($action eq 'rolecolors') { $output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).' @@ -566,7 +613,8 @@ sub print_config_box { $output .= ''; $rowtotal ++; if ($action eq 'login') { - $output .= &print_login($dom,$confname,$phase,$settings,\$rowtotal); + $output .= &print_login('bottom',$dom,$confname,$phase,$settings, + \$rowtotal); } elsif ($action eq 'quotas') { $output .= &print_quotas($dom,$settings,\$rowtotal,$action); } elsif ($action eq 'autoenroll') { @@ -581,6 +629,10 @@ sub print_config_box { $output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal); } elsif ($action eq 'serverstatuses') { $output .= &print_serverstatuses($dom,$settings,\$rowtotal); + } elsif ($action eq 'helpsettings') { + $output .= &print_helpsettings('top',$dom,$confname,$settings,\$rowtotal); + } elsif ($action eq 'coursedefaults') { + $output .= &print_coursedefaults($dom,$settings,\$rowtotal); } } $output .= ' @@ -592,8 +644,48 @@ sub print_config_box { } sub print_login { - my ($dom,$confname,$phase,$settings,$rowtotal) = @_; + my ($position,$dom,$confname,$phase,$settings,$rowtotal) = @_; + my ($css_class,$datatable); my %choices = &login_choices(); + my $itemcount = 1; + + if ($position eq 'top') { + my %servers = &dom_servers($dom); + my $choice = $choices{'disallowlogin'}; + $css_class = ' class="LC_odd_row"'; + $datatable .= ''.$choices{'disallowlogin'}.''. + ''. + ''."\n"; + my %disallowed; + if (ref($settings) eq 'HASH') { + if (ref($settings->{'loginvia'}) eq 'HASH') { + %disallowed = %{$settings->{'loginvia'}}; + } + } + foreach my $lonhost (sort(keys(%servers))) { + my $direct = 'selected="selected"'; + if ($disallowed{$lonhost} eq '') { + $direct = ''; + } + $datatable .= ''. + ''; + } + $datatable .= '
'.$choices{'hostid'}.''.$choices{'serverurl'}.'
'.$servers{$lonhost}.'
'; + return $datatable; + } + my %defaultchecked = ( 'coursecatalog' => 'on', 'adminmail' => 'off', @@ -728,24 +820,28 @@ sub print_login { sub login_choices { my %choices = &Apache::lonlocal::texthash ( - coursecatalog => 'Display Course Catalog link?', - adminmail => "Display Administrator's E-mail Address?", - newuser => "Link to create a user account", - img => "Header", - logo => "Main Logo", - domlogo => "Domain Logo", - login => "Log-in Header", - textcol => "Text color", - bgcol => "Box color", - bgs => "Background colors", - links => "Link colors", - font => "Font color", - pgbg => "Header", - mainbg => "Page", - sidebg => "Login box", - link => "Link", - alink => "Active link", - vlink => "Visited link", + coursecatalog => 'Display Course/Community Catalog link?', + adminmail => "Display Administrator's E-mail Address?", + disallowlogin => "Login page requests redirected", + hostid => "Server", + serverurl => "Redirect to log-in via:", + directlogin => "No redirect", + newuser => "Link to create a user account", + img => "Header", + logo => "Main Logo", + domlogo => "Domain Logo", + login => "Log-in Header", + textcol => "Text color", + bgcol => "Box color", + bgs => "Background colors", + links => "Link colors", + font => "Font color", + pgbg => "Header", + mainbg => "Page", + sidebg => "Login box", + link => "Link", + alink => "Active link", + vlink => "Visited link", ); return %choices; } @@ -1373,16 +1469,15 @@ sub print_quotas { $datatable .= ''. ''.&mt('LON-CAPA Advanced Users').' '; if ($context eq 'requestcourses') { - $datatable .= &mt('(overrides affiliation, if set)'); - } else { - $datatable .= &mt('(overrides affiliation, if checked)'); - } - $datatable .= ''. - ''; - if ($context eq 'requestcourses') { - $datatable .= ''; + $datatable .= &mt('(overrides affiliation, if set)'). + ''. + ''; } else { $datatable .= $parent .' '."\n"; $itemcount ++; - if ((!grep(/^instcode$/,@{$cats[0]})) || ($cathash->{'instcode::0'} eq '')) { - $css_class = $itemcount%2?' class="LC_odd_row"':''; - my $chgstr = ' onchange="javascript:reorderCats(this.form,'."'','instcode_pos','$lastidx'".');"'; - $datatable .= ''. + '' + .''; } - $datatable .= '' - .''; } } } else { @@ -2659,7 +2973,7 @@ sub print_serverstatuses { sub serverstatus_pages { return ('userstatus','lonstatus','loncron','server-status','codeversions', 'clusterstatus','metadata_keywords','metadata_harvest', - 'takeoffline','takeonline','showenv'); + 'takeoffline','takeonline','showenv','toggledebug'); } sub coursecategories_javascript { @@ -2684,8 +2998,12 @@ sub coursecategories_javascript { $jstext = ' var categories = Array(1);'."\n". ' categories[0] = Array("instcode_pos");'."\n"; } + my $instcode_reserved = &mt('The name: "instcode" is a reserved category'); + my $communities_reserved = &mt('The name: "communities" is a reserved category'); + my $choose_again = '\\n'.&mt('Please use a different name for the new top level category'); $output = <<"ENDSCRIPT"; ENDSCRIPT @@ -2750,25 +3082,40 @@ ENDSCRIPT sub initialize_categories { my ($itemcount) = @_; - my $datatable; - my $css_class = $itemcount%2?' class="LC_odd_row"':''; - my $chgstr = ' onchange="javascript:reorderCats(this.form,'."'','instcode_pos','0'".');"'; - - $datatable = ''; - $itemcount ++; + $itemcount ++; + } $css_class = $itemcount%2?' class="LC_odd_row"':''; $chgstr = ' onchange="javascript:reorderCats(this.form,'."'','addcategory_pos','0'".');"'; $datatable .= ''; return $datatable; @@ -3075,6 +3422,14 @@ sub modify_login { newuser => 'Link for visitors to create a user account', loginheader => 'Log-in box header'); my @offon = ('off','on'); + my %curr_loginvia; + if (ref($domconfig{login}) eq 'HASH') { + if (ref($domconfig{login}{loginvia}) eq 'HASH') { + foreach my $lonhost (keys(%{$domconfig{login}{loginvia}})) { + $curr_loginvia{$lonhost} = $domconfig{login}{loginvia}{$lonhost}; + } + } + } my %loginhash; ($errors,%colchanges) = &modify_colors($r,$dom,$confname,['login'], \%domconfig,\%loginhash); @@ -3087,6 +3442,26 @@ sub modify_login { $colchgtext = &display_colorchgs($dom,\%colchanges,['login'], \%loginhash); } + + my %servers = &dom_servers($dom); + if (keys(%servers) > 1) { + foreach my $lonhost (keys(%servers)) { + next if ($env{'form.'.$lonhost.'_serverurl'} eq $lonhost); + if ($env{'form.'.$lonhost.'_serverurl'} eq $curr_loginvia{$lonhost}) { + $loginhash{login}{loginvia}{$lonhost} = $curr_loginvia{$lonhost}; next; + } + if ($curr_loginvia{$lonhost} ne '') { + $loginhash{login}{loginvia}{$lonhost} = $env{'form.'.$lonhost.'_serverurl'}; + $changes{'loginvia'}{$lonhost} = 1; + } else { + if (defined($servers{$env{'form.'.$lonhost.'_serverurl'}})) { + $loginhash{login}{loginvia}{$lonhost} = $env{'form.'.$lonhost.'_serverurl'}; + $changes{'loginvia'}{$lonhost} = 1; + } + } + } + } + my $putresult = &Apache::lonnet::put_dom('configuration',\%loginhash, $dom); if ($putresult eq 'ok') { @@ -3133,6 +3508,18 @@ sub modify_login { foreach my $item (sort(keys(%changes))) { if ($item eq 'loginheader') { $resulttext .= '
  • '.&mt("$title{$item} set to $env{'form.loginheader'}").'
  • '; + } elsif ($item eq 'loginvia') { + if (ref($changes{$item}) eq 'HASH') { + $resulttext .= '
  • '.&mt('Log-in page availability:').'
      '; + foreach my $lonhost (sort(keys(%{$changes{$item}}))) { + if ($servers{$env{'form.'.$lonhost.'_serverurl'}} ne '') { + $resulttext .= '
    • '.&mt('Server: [_1] log-in page now redirects to [_2]',$lonhost,$servers{$env{'form.'.$lonhost.'_serverurl'}}).'
    • '; + } else { + $resulttext .= '
    • '.&mt('Server: [_1] now has standard log-in page.',$lonhost).'
    • '; + } + } + $resulttext .= '
  • '; + } } else { $resulttext .= '
  • '.&mt("$title{$item} set to $offon[$env{'form.'.$item}]").'
  • '; } @@ -5226,6 +5613,14 @@ sub modify_coursecategories { $changes{'categorize'} = 1; $domconfig{'coursecategories'}{'categorize'} = $env{'form.categorize'}; } + if ($domconfig{'coursecategories'}{'togglecatscomm'} ne $env{'form.togglecatscomm'}) { + $changes{'togglecatscomm'} = 1; + $domconfig{'coursecategories'}{'togglecatscomm'} = $env{'form.togglecatscomm'}; + } + if ($domconfig{'coursecategories'}{'categorizecomm'} ne $env{'form.categorizecomm'}) { + $changes{'categorizecomm'} = 1; + $domconfig{'coursecategories'}{'categorizecomm'} = $env{'form.categorizecomm'}; + } } else { $changes{'togglecats'} = 1; $changes{'categorize'} = 1; @@ -5233,11 +5628,20 @@ sub modify_coursecategories { togglecats => $env{'form.togglecats'}, categorize => $env{'form.categorize'}, }; + $changes{'togglecatscomm'} = 1; + $changes{'categorizecomm'} = 1; + $domconfig{'coursecategories'} = { + togglecats => $env{'form.togglecatscomm'}, + categorize => $env{'form.categorizecomm'}, + }; } if (ref($cathash) eq 'HASH') { if (($domconfig{'coursecategories'}{'cats'}{'instcode::0'} ne '') && ($env{'form.instcode'} == 0)) { push (@deletecategory,'instcode::0'); } + if (($domconfig{'coursecategories'}{'cats'}{'communities::0'} ne '') && ($env{'form.communities'} == 0)) { + push(@deletecategory,'communities::0'); + } } my (@predelcats,@predeltrails,%predelallitems,%sort_by_deltrail); if (ref($cathash) eq 'HASH') { @@ -5287,10 +5691,26 @@ sub modify_coursecategories { $adds{$newitem} = 1; } } + if ($env{'form.communities'} eq '1') { + if (ref($cathash) eq 'HASH') { + my $newitem = 'communities::0'; + if ($cathash->{$newitem} eq '') { + $domconfig{'coursecategories'}{'cats'}{$newitem} = $env{'form.communities_pos'}; + $adds{$newitem} = 1; + } + } else { + my $newitem = 'communities::0'; + $domconfig{'coursecategories'}{'cats'}{$newitem} = $env{'form.communities_pos'}; + $adds{$newitem} = 1; + } + } if ($env{'form.addcategory_name'} ne '') { - my $newitem = &escape($env{'form.addcategory_name'}).'::0'; - $domconfig{'coursecategories'}{'cats'}{$newitem} = $env{'form.addcategory_pos'}; - $adds{$newitem} = 1; + if (($env{'form.addcategory_name'} ne 'instcode') && + ($env{'form.addcategory_name'} ne 'communities')) { + my $newitem = &escape($env{'form.addcategory_name'}).'::0'; + $domconfig{'coursecategories'}{'cats'}{$newitem} = $env{'form.addcategory_pos'}; + $adds{$newitem} = 1; + } } my $putresult; if ((keys(%deletions) > 0) || (keys(%reorderings) > 0) || (keys(%adds) > 0)) { @@ -5327,12 +5747,15 @@ sub modify_coursecategories { $putresult = &Apache::lonnet::put_dom('configuration',\%domconfig,$dom); if ($putresult eq 'ok') { my %title = ( - togglecats => 'Show/Hide a course in the catalog', - categorize => 'Category assigned to course', + togglecats => 'Show/Hide a course in catalog', + categorize => 'Assign a category to a course', + togglecatscomm => 'Show/Hide a community in catalog', + categorizecomm => 'Assign a category to a community', ); my %level = ( - dom => 'set from "Modify Course" (Domain)', - crs => 'set from "Parameters" (Course)', + dom => 'set in Domain ("Modify Course/Community")', + crs => 'set in Course ("Course Configuration")', + comm => 'set in Community ("Community Configuration")', ); $resulttext = &mt('Changes made:').'
    '. + ''; } else { - $datatable .= '
    '; + $datatable .= &mt('(overrides affiliation, if checked)'). + ''. + ' + + '. + ''; + $itemcount ++; + } + + } else { + + $css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; + + $datatable .= ''; + + if (ref($settings) eq 'HASH') { + if ($settings->{'loginhelpurl'} ne '') { + my($directory, $filename) = $settings->{'loginhelpurl'} =~ m/(.*\/)(.*)$/; + $datatable .= ''; + $datatable .= '' + } else { + $datatable .= ''; + $datatable .= ''; + } + } else { + $datatable .= ''; + $datatable .= ''; + } + + $datatable .= ''; + + } + + return $datatable; + +} + + +sub radiobutton_prefs { + my ($settings,$toggles,$defaultchecked,$choices,$itemcount) = @_; + return unless ((ref($toggles) eq 'ARRAY') && (ref($defaultchecked) eq 'HASH') && + (ref($choices) eq 'HASH')); + + my (%checkedon,%checkedoff,$datatable,$css_class); + + foreach my $item (@{$toggles}) { + if ($defaultchecked->{$item} eq 'on') { + $checkedon{$item} = ' checked="checked" '; + $checkedoff{$item} = ' '; + } elsif ($defaultchecked->{$item} eq 'off') { + $checkedoff{$item} = ' checked="checked" '; + $checkedon{$item} = ' '; + } + } + if (ref($settings) eq 'HASH') { + foreach my $item (@{$toggles}) { + if ($settings->{$item} eq '1') { + $checkedon{$item} = ' checked="checked" '; + $checkedoff{$item} = ' '; + } elsif ($settings->{$item} eq '0') { + $checkedoff{$item} = ' checked="checked" '; + $checkedon{$item} = ' '; + } + } + } + foreach my $item (@{$toggles}) { + $css_class = $itemcount%2?' class="LC_odd_row"':''; + $datatable .= + ''. + ''. + ''; + $itemcount ++; + } + return ($datatable,$itemcount); +} + +sub print_coursedefaults { + my ($dom,$settings,$rowtotal) = @_; + my ($css_class,$datatable); + my $itemcount = 1; + my (%checkedon,%checkedoff,%choices,%defaultchecked,@toggles); + %choices = + &Apache::lonlocal::texthash ( + canuse_pdfforms => 'Course/Community users can create/upload PDF forms', + ); + %defaultchecked = ('canuse_pdfforms' => 'off'); + @toggles = ('canuse_pdfforms',); + ($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked, + \%choices,$itemcount); + $$rowtotal += $itemcount; + return $datatable; +} + sub contact_titles { my %titles = &Apache::lonlocal::texthash ( 'supportemail' => 'Support E-mail address', @@ -2465,6 +2715,11 @@ sub print_coursecategories { my $toggle_cats_dom = ' checked="checked" '; my $can_cat_crs = ' '; my $can_cat_dom = ' checked="checked" '; + my $toggle_catscomm_comm = ' '; + my $toggle_catscomm_dom = ' checked="checked" '; + my $can_catcomm_comm = ' '; + my $can_catcomm_dom = ' checked="checked" '; + if (ref($settings) eq 'HASH') { if ($settings->{'togglecats'} eq 'crs') { $toggle_cats_crs = $toggle_cats_dom; @@ -2474,14 +2729,25 @@ sub print_coursecategories { $can_cat_crs = $can_cat_dom; $can_cat_dom = ' '; } + if ($settings->{'togglecatscomm'} eq 'comm') { + $toggle_catscomm_comm = $toggle_catscomm_dom; + $toggle_catscomm_dom = ' '; + } + if ($settings->{'categorizecomm'} eq 'comm') { + $can_catcomm_comm = $can_catcomm_dom; + $can_catcomm_dom = ' '; + } } my %title = &Apache::lonlocal::texthash ( - togglecats => 'Show/Hide a course in the catalog', - categorize => 'Assign a category to a course', + togglecats => 'Show/Hide a course in catalog', + togglecatscomm => 'Show/Hide a community in catalog', + categorize => 'Assign a category to a course', + categorizecomm => 'Assign a category to a community', ); my %level = &Apache::lonlocal::texthash ( - dom => 'Set in "Modify Course" (Domain)', - crs => 'Set in "Modify Parameters" (Course)', + dom => 'Set in Domain', + crs => 'Set in Course', + comm => 'Set in Community', ); $datatable = ''. ''. @@ -2497,8 +2763,22 @@ sub print_coursecategories { $can_cat_dom.' value="dom" />'.$level{'dom'}.' '. ''. + ''. + ''. + ''. + ''. + ''. + ''. ''; - $$rowtotal += 2; + $$rowtotal += 4; } else { my $css_class; my $itemcount = 1; @@ -2520,7 +2800,15 @@ sub print_coursecategories { if (ref($cats[0]) eq 'ARRAY') { my $numtop = @{$cats[0]}; my $maxnum = $numtop; - if ((!grep(/^instcode$/,@{$cats[0]})) || ($cathash->{'instcode::0'} eq '')) { + my %default_names = ( + instcode => &mt('Official courses'), + communities => &mt('Communities'), + ); + + if ((!grep(/^instcode$/,@{$cats[0]})) || + ($cathash->{'instcode::0'} eq '') || + (!grep(/^communities$/,@{$cats[0]})) || + ($cathash->{'communities::0'} eq '')) { $maxnum ++; } my $lastidx; @@ -2541,14 +2829,33 @@ sub print_coursecategories { $datatable .= ''; } $datatable .= '' - .' ' - .''; + if ($parent eq 'instcode' || $parent eq 'communities') { + $datatable .= '' + .$default_names{$parent}.''; + if ($parent eq 'instcode') { + $datatable .= '
    (' + .&mt('with institutional codes') + .')'; + } else { + $datatable .= '
    '. + '
    '; } my %advcell; foreach my $item (@usertools) { @@ -1854,6 +1949,161 @@ sub print_contacts { return $datatable; } +sub print_helpsettings { + + my ($position,$dom,$confname,$settings,$rowtotal) = @_; + my ($css_class,$datatable); + + my $switchserver = &check_switchserver($dom,$confname); + + my $itemcount = 1; + + if ($position eq 'top') { + + my (%checkedon,%checkedoff,%choices,%defaultchecked,@toggles); + + %choices = + &Apache::lonlocal::texthash ( + submitbugs => 'Display "Submit a bug" link?', + ); + + %defaultchecked = ('submitbugs' => 'on'); + + @toggles = ('submitbugs',); + + foreach my $item (@toggles) { + if ($defaultchecked{$item} eq 'on') { + $checkedon{$item} = ' checked="checked" '; + $checkedoff{$item} = ' '; + } elsif ($defaultchecked{$item} eq 'off') { + $checkedoff{$item} = ' checked="checked" '; + $checkedon{$item} = ' '; + } + } + + if (ref($settings) eq 'HASH') { + foreach my $item (@toggles) { + if ($settings->{$item} eq '1') { + $checkedon{$item} = ' checked="checked" '; + $checkedoff{$item} = ' '; + } elsif ($settings->{$item} eq '0') { + $checkedoff{$item} = ' checked="checked" '; + $checkedon{$item} = ' '; + } + } + } + + foreach my $item (@toggles) { + $css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; + $datatable .= + ' +
    '.$choices{$item}.'  +   + '. + '
       '; + if ($switchserver) { + $datatable .= &mt('Upload to library server: [_1]',$switchserver); + } else { + $datatable .= &mt('Upload Custom Login Page Help File:'); + $datatable .=''; + } + $datatable .= '
    '.$choices->{$item}. + ''. + ' '. + '
    '.$title{'togglecats'}.'
    '.$title{'togglecatscomm'}.' '. + '
    '.$title{'categorizecomm'}.''. + ' '. + '
    '; - if ($parent eq 'instcode') { - $datatable .= ''.&mt('Official courses') - .'
    (' - .&mt('with institutional codes').')
    '; + } + $datatable .= '' + .''; + if ($parent eq 'instcode') { + $datatable .= ' '; + } else { + $datatable .= '
    ' + .''; + } + $datatable .= ''; + if ($parent eq 'communities') { + $datatable .= '
    '; + } + $datatable .= '
    '. - '
    '. + ''. + $default_names{$default}.''; + if ($default eq 'instcode') { + $datatable .= '
    (' + .&mt('with institutional codes').')'; + } + $datatable .= '
     ' + .'
    ' - .&mt('Official courses').''.'
    (' - .&mt('with institutional codes').')
     ' - .'
    ' - .' ' - .&mt('Official courses (with institutional codes)') - .'' - .' 
    ' + .' ' + .$default_names{$default} + .'' + .' 
    ' - .' ' + .' ' .&mt('Add category').''.&mt('Name:') .'