File:  [LON-CAPA] / loncom / interface / lonconfigsettings.pm
Revision 1.43: download - view: text, annotated - select for diffs
Tue May 8 01:48:18 2018 UTC (6 years, 1 month ago) by raeburn
Branches: MAIN
CVS tags: HEAD
- Bug 6754 LON-CAPA as LTI Provider
  - Domain defaults for each Consumer
    - display standard LON-CAPA menus? (top line and/or second line)
    - menu include: fullname, role, context, logout, and/or grades?
  - Course Coordinator can override in course via "Course Settings".

    1: # The LearningOnline Network with CAPA
    2: # Handler to set domain-wide configuration settings
    3: #
    4: # $Id: lonconfigsettings.pm,v 1.43 2018/05/08 01:48:18 raeburn Exp $
    5: #
    6: # Copyright Michigan State University Board of Trustees
    7: #
    8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
    9: #
   10: # LON-CAPA is free software; you can redistribute it and/or modify
   11: # it under the terms of the GNU General Public License as published by
   12: # the Free Software Foundation; either version 2 of the License, or
   13: # (at your option) any later version.
   14: #
   15: # LON-CAPA is distributed in the hope that it will be useful,
   16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
   17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   18: # GNU General Public License for more details.
   19: #
   20: # You should have received a copy of the GNU General Public License
   21: # along with LON-CAPA; if not, write to the Free Software
   22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA#
   23: # /home/httpd/html/adm/gpl.txt
   24: #
   25: # http://www.lon-capa.org/
   26: #
   27: #
   28: ###############################################################
   29: ##############################################################
   30: 
   31: package Apache::lonconfigsettings;
   32: 
   33: use strict;
   34: use Apache::lonnet;
   35: use Apache::loncommon();
   36: use Apache::lonhtmlcommon();
   37: use Apache::lonlocal;
   38: use Apache::lonparmset();
   39: use Apache::courseclassifier();
   40: use LONCAPA qw(:DEFAULT :match); 
   41: 
   42: sub print_header {
   43:     my ($r,$phase,$context,$jscript,$container,$instcode,$dom,$values) = @_;
   44:     my ($pagetitle,$brcrumtitle,$action,$call_category_check,$instcode_check,
   45:         $crstype,@actions,@code_order);
   46:     if ($phase eq 'display') {
   47:         @actions = &Apache::loncommon::get_env_multiple('form.actions');
   48:     }
   49:     if ($context eq 'domain') {
   50:         ($pagetitle, $brcrumtitle) = ('View/Modify Domain Settings','View/Modify Domain Settings');
   51:         $action = '/adm/domainprefs';
   52:         if ($phase eq 'display') {
   53:             if (grep(/^coursecategories$/,@actions)) {
   54:                 $call_category_check = qq|
   55:     if (formname == document.display) {
   56:         if (!categoryCheck(formname)) {
   57:             return;
   58:         }
   59:     }
   60: |;
   61:             }
   62:         }
   63:     } else {
   64:         $crstype = &Apache::loncommon::course_type();
   65:         if ($crstype eq 'Community') {
   66:             ($pagetitle,$brcrumtitle) = ('Community Configuration','Community Configuration');
   67:         } else {
   68:             ($pagetitle,$brcrumtitle) = ('Course Configuration','Course Configuration');
   69:         }
   70:         $action = '/adm/courseprefs';
   71:         if ($phase eq 'display') {
   72:             if (grep(/^courseinfo$/,@actions)) {
   73:                 my %codedefaults;
   74:                 &Apache::lonnet::auto_instcode_defaults($env{'request.role.domain'},\%codedefaults,
   75:                                                         \@code_order);
   76:                 if (@code_order) {
   77:                    my $noinstcodestr = &mt('You indicated cloning based on category, but did not select any categories.');
   78:                    &js_escape(\$noinstcodestr);
   79:                    $instcode_check = <<"ENDSCRIPT";
   80:     if (formname == document.display) {
   81:         if (formname.cloners_instcode.length) {
   82:             for (var j=0; j<formname.cloners_instcode.length; j++) {
   83:                 if (formname.cloners_instcode[j].checked) {
   84:                     if (formname.cloners_instcode[j].value == 1) {
   85:                         var codes;
   86:                         if (document.getElementsByClassName) {
   87:                             codes = document.getElementsByClassName('LC_cloners_instcodes');
   88:                         } else {
   89:                             codes = getElementsByClassName(document.body,'LC_cloners_instcodes');
   90:                         }
   91:                         if (codes.length) {
   92:                             var gotcode = 0;
   93:                             for (var i=0; i<codes.length; i++) {
   94:                                 if (codes[i].selectedIndex != 0) {
   95:                                      gotcode = 1; 
   96:                                      break;
   97:                                 }
   98:                             }
   99:                             if (!gotcode) {
  100:                                 for (var k=0; k<formname.cloners_instcode.length; k++) {
  101:                                     if (formname.cloners_instcode[k].value == 0) {
  102:                                         formname.cloners_instcode[k].checked = true;
  103:                                     }
  104:                                 }
  105:                                 toggleCloners(document.display.cloners_instcode);
  106:                                 alert('$noinstcodestr');
  107:                                 return false;
  108:                             }
  109:                         }
  110:                     }
  111:                 }
  112:             }
  113:         }
  114:     }
  115: 
  116: ENDSCRIPT
  117:                 }
  118:             }
  119:         }
  120:     }
  121:     my $alert = &mt('You must select at least one functionality type to display.');
  122:     &js_escape(\$alert);
  123:     my $js = '
  124: <script type="text/javascript">
  125: // <![CDATA[
  126: 
  127: function changePage(formname,newphase) {
  128:     formname.phase.value = newphase;
  129:     numchecked = 0;
  130:     if (formname == document.pickactions) {
  131:         if (formname.actions.length > 0) {
  132:             for (var i = 0; i<formname.actions.length; i++) {
  133:                 if (formname.actions[i].checked) {
  134:                     numchecked ++;
  135:                 }
  136:             }
  137:         } else {
  138:             if (formname.actions.checked) {
  139:                 numchecked ++;
  140:             }
  141:         }
  142:         if (numchecked > 0) {
  143:             formname.submit();
  144:         } else {
  145:             alert("'.$alert.'");
  146:             return;
  147:         }
  148:     }
  149:     '.$instcode_check.$call_category_check.'
  150:     formname.submit();
  151: }'."\n";
  152:     if ($phase eq 'pickactions') {
  153: 	$js .= &Apache::lonhtmlcommon::color_picker();
  154:         $js .=
  155:             &Apache::lonhtmlcommon::set_form_elements({actions => 'checkbox'})."\n";
  156:     } elsif ($phase eq 'display') {
  157: 	$js .= &Apache::lonhtmlcommon::color_picker();
  158:         $js .= &color_pick_js()."\n";
  159:     }
  160:     $js .= &Apache::loncommon::viewport_size_js().'
  161: 
  162: // ]]>
  163: </script>
  164: ';
  165:     if ($jscript) {
  166:         $js .= "
  167: 
  168: $jscript
  169: 
  170: ";
  171:     }
  172:     my $additem;
  173:     if ($phase eq 'pickactions') {
  174:         my %loaditems = (
  175:                     'onload' => "setFormElements(document.pickactions);",
  176:                         );
  177:         $additem = {'add_entries' => \%loaditems,};
  178:     } elsif ($phase eq 'display') {
  179:         if ($context eq 'domain') {
  180:             my $onload;
  181:             if (grep(/^coursedefaults$/,@actions)) {
  182:                 $onload = "toggleDisplay(document.display,'cloneinstcode');".
  183:                           "toggleDisplay(document.display,'credits');".
  184:                           "toggleDisplay(document.display,'studentsubmission');";
  185:             }
  186:             if (grep(/^selfcreation$/,@actions)) {
  187:                 my $prefix = 'cancreate_emailverified';
  188:                 my $customclass = 'LC_selfcreate_email';
  189:                 my $classprefix = 'LC_canmodify_emailusername_';
  190:                 my $optionsprefix = 'LC_options_emailusername_';
  191:                 $onload .= "toggleRows(document.display,'cancreate_email','selfassign','$customclass','$classprefix','$optionsprefix');";
  192:                 my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
  193:                 my $hascustom;
  194:                 my ($emailrules,$emailruleorder) = &Apache::lonnet::inst_userrules($dom,'email');
  195:                 if (ref($emailrules) eq 'HASH') {
  196:                     if (keys(%{$emailrules}) > 0) {
  197:                         $hascustom = 'cancreate_emailrule';
  198:                     }
  199:                 }
  200:                 my @posstypes;
  201:                 if (ref($types) eq 'ARRAY') {
  202:                     @posstypes = @{$types};
  203:                     push(@posstypes,'default');
  204:                     foreach my $type (@posstypes) {
  205:                         $onload .= "toggleEmailOptions(document.display,'cancreate_emailoptions','$hascustom',".
  206:                                                                "'cancreate_emaildomain','$type');";
  207:                     }
  208:                 } else {
  209:                     $onload .= "toggleEmailOptions(document.display,'cancreate_emailoptions','$hascustom',".
  210:                                                        "'cancreate_emaildomain','default');";
  211:                 }
  212:             } 
  213:             if (grep(/^contacts$/,@actions)) {
  214:                 my $customclass = 'LC_helpdesk_override';
  215:                 my $optionsprefix = 'LC_options_helpdesk_';
  216:                 $onload .= "toggleHelpdeskRow(document.display,'overrides','$customclass','$optionsprefix');";
  217:             }
  218:             if (grep(/^lti$/,@actions)) {
  219:                 $onload .= "toggleLTI(document.display,'user','add');".
  220:                            "toggleLTI(document.display,'crs','add');".
  221:                            "toggleLTI(document.display,'sec','add');".
  222:                            "toggleLTI(document.display,'lcauth','add');".
  223:                            "toggleLTI(document.display,'lcmenu','add');";
  224:                 if (ref($values) eq 'HASH') {
  225:                     if (ref($values->{'lti'}) eq 'HASH') {
  226:                         my $numlti = scalar(keys(%{$values->{'lti'}}));
  227:                         for (my $i=0; $i<$numlti; $i++) {
  228:                             $onload .= "toggleLTI(document.display,'user','$i');".
  229:                                        "toggleLTI(document.display,'crs','$i');".
  230:                                        "toggleLTI(document.display,'sec','$i');".
  231:                                        "toggleLTI(document.display,'lcauth','$i');".
  232:                                        "toggleLTI(document.display,'lcmenu','$i');";
  233:                         }
  234:                     }
  235:                 }
  236:             }
  237:             if (grep(/^ltitools$/,@actions)) {
  238:                 $onload .= "toggleLTITools(document.display,'passback','add');".
  239:                            "toggleLTITools(document.display,'roster','add');".
  240:                            "toggleLTITools(document.display,'user','add');";
  241:                 if (ref($values) eq 'HASH') {
  242:                     if (ref($values->{'ltitools'}) eq 'HASH') {
  243:                         my $numltitools = scalar(keys(%{$values->{'ltitools'}}));
  244:                         for (my $i=0; $i<$numltitools; $i++) {
  245:                             $onload .= "toggleLTITools(document.display,'passback','$i');".
  246:                                        "toggleLTITools(document.display,'roster','$i');".
  247:                                        "toggleLTITools(document.display,'user','$i');";
  248:                         }
  249:                     }
  250:                 }
  251:             }
  252:             if ($onload) {
  253:                 my %loaditems = (
  254:                                   'onload' => $onload,
  255:                                 );
  256:                 $additem = {'add_entries' => \%loaditems,};
  257:             }
  258:         } elsif ($context eq 'course') {
  259:             if (grep(/^courseinfo$/,@actions)) {
  260:                 if (@code_order) { 
  261:                     $additem = {
  262:                                    add_entries => {'onload' => "courseSet('','load');toggleCloners(document.display.cloners_instcode);"},
  263:                                };
  264:                 }
  265:             }
  266:         }
  267:     }
  268:     $r->print(&Apache::loncommon::start_page($pagetitle,$js,$additem));
  269:     $r->print(&Apache::lonhtmlcommon::breadcrumbs($brcrumtitle));
  270:     $r->print('
  271: <form name="parmform" action="">
  272: <input type="hidden" name="pres_marker" />
  273: <input type="hidden" name="pres_type" />
  274: <input type="hidden" name="pres_value" />
  275: </form>
  276: ');
  277:     if ($container) {
  278:        &Apache::lonparmset::startSettingsScreen($r,$container,$crstype);
  279:     }
  280:     $r->print('<form method="post" name="'.$phase.'" action="'.$action.'"'.
  281:               ' enctype="multipart/form-data">');
  282:     return;
  283: }
  284: 
  285: sub print_footer {
  286:     my ($r,$phase,$newphase,$button_text,$actions,$container,$parm_permission) = @_;
  287:     $button_text = &mt($button_text);
  288:     $r->print('<input type="hidden" name="phase" value="" />');
  289:     if (defined($env{'form.origin'})) {
  290:         $r->print('<input type="hidden" name="origin" value="'.$env{'form.origin'}.'" />'."\n");
  291:     }
  292:     if (($phase eq 'display') || ($phase eq 'process')) {
  293:         if (ref($actions) eq 'ARRAY') {
  294:             foreach my $item (@{$actions}) {
  295:                 $r->print('<input type="hidden" name="actions" value="'.$item.'" />'."\n");
  296:             }
  297:         }
  298:     }
  299:     my $dest='"javascript:changePage(document.'.$phase.','."'$newphase'".')"';
  300:     if ($phase eq 'process') {
  301:         $r->print(
  302:             &Apache::lonhtmlcommon::actionbox(
  303:                 ['<a href='.$dest.'>'.$button_text.'</a>']));
  304:     } else {
  305:         my $onclick;
  306:         if ($phase eq 'display') {
  307:             $onclick = '"javascript:changePage(document.'.$phase.','."'$newphase'".')"';
  308:         } else {
  309:             $onclick = '"javascript:changePage(document.'.$phase.','."'$newphase'".')"';
  310:         }
  311:         my $showbutton = 1;
  312:         if (ref($parm_permission) eq 'HASH') {
  313:             unless (($parm_permission->{'process'}) || ($newphase eq 'display')) {
  314:                 $showbutton = 0;
  315:             }
  316:         }
  317:         if ($showbutton) {
  318:             $r->print('<p><input type="button" name="store" value="'.
  319:                       $button_text.'" onclick='.$onclick.' /></p>');
  320:         } 
  321:     }
  322:     if ($phase eq 'process') {
  323:         $r->print('</form>');
  324:         if ($container) {
  325:            &Apache::lonparmset::endSettingsScreen($r);
  326:         }
  327:         $r->print(&Apache::loncommon::end_page());
  328:     }
  329:     return;
  330: }
  331: 
  332: sub make_changes {
  333:     my ($r,$dom,$phase,$context,$prefs_order,$prefs,$values,$confname,$roles,
  334:         $allitems,$container,$parm_permission) = @_;
  335:     my %brcrumtext = &get_crumb_text();
  336:     my @actions = &Apache::loncommon::get_env_multiple('form.actions');
  337:     my ($numchanged,%changes,%disallowed);
  338:     &Apache::lonhtmlcommon::add_breadcrumb
  339:       ({href=>"javascript:changePage(document.$phase,'display')",
  340:         text=>$brcrumtext{$context}},
  341:        {href=>"javascript:changePage(document.$phase,'$phase')",
  342:         text=>"Updated"});
  343:     &print_header($r,$phase,$context,undef,$container);
  344:     my ($crstype,%lastact);
  345:     if ($context eq 'course') {
  346:         $crstype = &Apache::loncommon::course_type();
  347:     }
  348:     if ((ref($prefs_order) eq 'ARRAY') && (ref($prefs) eq 'HASH') && 
  349:         (ref($prefs) eq 'HASH')) {
  350:         foreach my $item (@{$prefs_order}) {
  351:             if (grep(/^\Q$item\E$/,@actions)) {
  352:                 if ($context eq 'domain') {
  353:                     $r->print('<h3>'.&mt($prefs->{$item}{'text'}).'</h3>'.
  354:                               &Apache::domainprefs::process_changes($r,$dom,
  355:                                           $confname,$item,$roles,$values,\%lastact));
  356:                 } else {
  357:                     $changes{$item} = {};
  358:                     &Apache::courseprefs::process_changes($dom,$item,$values,
  359:                                                           $prefs->{$item},$changes{$item},
  360:                                                           $allitems,\%disallowed,$crstype);
  361:                     if (keys(%{$changes{$item}}) > 0) {
  362:                         $numchanged ++;
  363:                     }
  364:                 }
  365:             }
  366:         }
  367:     }
  368:     if ($context eq 'course') {
  369:         if ($numchanged) {
  370:             my $message = &Apache::courseprefs::store_changes($dom,$confname,$prefs_order,\@actions,
  371:                                                           $prefs,$values,\%changes,$crstype);
  372:             $r->print(&Apache::loncommon::confirmwrapper($message));
  373:         } else {
  374:             if ($crstype eq 'Community') {
  375:                 $r->print(&Apache::loncommon::confirmwrapper(&mt("No changes made to community configuration.")));
  376:             } else {
  377:                 $r->print(&Apache::loncommon::confirmwrapper(&mt("No changes made to course configuration.")));
  378:             }
  379:         }
  380:         if (keys(%disallowed) > 0) {
  381:             $r->print('<p>');
  382:             foreach my $item ('cloners','rolenames','feedback','discussion','localization') {
  383:                 if (ref($disallowed{$item}) eq 'HASH') {
  384:                     if (keys(%{$disallowed{$item}}) > 0) {
  385:                         $r->print(&Apache::courseprefs::display_disallowed($item,$disallowed{$item},
  386:                                                                            $prefs,$crstype));
  387:                     }
  388:                 }
  389:             }
  390:             $r->print('</p>');
  391:         }
  392:     }
  393:     $r->print('<p>');
  394:     my $footer_text = 'Back to configuration display';
  395:     if ($context eq 'course') {
  396:         $footer_text = 'Back to display/edit settings'; 
  397:     }
  398:     &print_footer($r,$phase,'display',$footer_text,\@actions,$container,$parm_permission);
  399:     $r->print('</p>');
  400:     return \%lastact;
  401: }
  402: 
  403: sub display_settings {
  404:     my ($r,$dom,$phase,$context,$prefs_order,$prefs,$values,$confname,$jscript,
  405:         $allitems,$crstype,$container,$parm_permission) = @_;
  406:     my %brcrumtext = &get_crumb_text();
  407:     my @actions = &Apache::loncommon::get_env_multiple('form.actions');
  408:     &Apache::lonhtmlcommon::add_breadcrumb
  409:         ({href=>"javascript:changePage(document.$phase,'display')",
  410:           text=>"Display/Edit Settings"});
  411:     my $instcode;
  412:     if (ref($values) eq 'HASH') {
  413:         $instcode = $values->{'internal.coursecode'};
  414:     }
  415:     &print_header($r,$phase,$context,$jscript,$container,$instcode,$dom,$values);
  416:     my $divwidth = 900;
  417:     if ((ref($prefs_order) eq 'ARRAY') && (ref($prefs) eq 'HASH') && (ref($values) eq 'HASH')) { 
  418:         if (@actions > 0) {
  419:             my $rowsum = 0;
  420:             my (%output,%rowtotal,@items,$got_check_uncheck);
  421:             foreach my $item (@{$prefs_order}) {
  422:                 if (grep(/^\Q$item\E$/,@actions)) {
  423:                     push(@items,$item);
  424:                     if ($context eq 'domain') {
  425:                         my $settings;
  426:                         if (ref($values) eq 'HASH') { 
  427:                             $settings = $values->{$item};
  428:                         }
  429:                         if (($item eq 'usersessions') || ($item eq 'ssl')) {
  430:                             unless ($got_check_uncheck) {
  431:                                 $r->print('<script type="text/javascript">'."\n".
  432:                                           '// <![CDATA['."\n".
  433:                                           &Apache::loncommon::check_uncheck_jscript()."\n".
  434:                                           '// ]]>'."\n".
  435:                                           '</script>'."\n");
  436:                                 $got_check_uncheck = 1;
  437:                             }
  438:                         } elsif ($item eq 'selfcreation') {
  439:                             if (ref($values) eq 'HASH') {
  440:                                 $settings = $values->{'usercreation'};
  441:                             }
  442:                         } elsif ($item eq 'defaults') {
  443:                             if (ref($values->{'inststatus'}) eq 'HASH') {
  444:                                 if (ref($values->{'defaults'}) eq 'HASH') {
  445:                                     $settings = {%{$values->{'inststatus'}},%{$values->{'defaults'}}};
  446:                                 } else {
  447:                                     $settings = $values->{'inststatus'};
  448:                                 }
  449:                             } else {
  450:                                 my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
  451:                                 my $inststatus = {
  452:                                                    inststatustypes => $usertypes,
  453:                                                    inststatusorder => $types,
  454:                                                    inststatusguest => [], 
  455:                                                  };
  456:                                 if (ref($values->{defaults}) eq 'HASH') {
  457:                                     $settings = {%{$inststatus},%{$values->{'defaults'}}};
  458:                                 } else {
  459:                                     $settings = $inststatus;
  460:                                 }
  461:                             }
  462:                         }
  463:                         ($output{$item},$rowtotal{$item}) =
  464:                             &Apache::domainprefs::print_config_box($r,$dom,$confname,
  465:                                 $phase,$item,$prefs->{$item},$settings);
  466:                     } else {
  467:                         ($output{$item},$rowtotal{$item}) =
  468:                             &Apache::courseprefs::print_config_box($r,$dom,$phase,
  469:                                 $item,$prefs->{$item},$values,$allitems,$crstype,$parm_permission);
  470:                     }
  471:                     $rowsum += $rowtotal{$item};
  472:                 }
  473:             }
  474:             $r->print('<div id="prefs" style="max-width:'.$divwidth.'px;margin: 10px auto 10px auto;">');
  475:             for (my $i=0; $i<@items; $i++) {
  476:                 $r->print($output{$items[$i]});
  477:             }
  478:             $r->print('</div>');
  479:             $r->print(&print_footer($r,$phase,'process','Save Changes',\@actions,$container,$parm_permission));
  480:         } else {
  481:             $r->print('<input type="hidden" name="phase" value="" />'.
  482:                       '<span class="LC_error">'.&mt('No settings chosen').
  483:                       '</span>');
  484:         }
  485:         $r->print('</form>');
  486:     }
  487:     if ($container) {
  488:         &Apache::lonparmset::endSettingsScreen($r);
  489:     }
  490:     $r->print(&Apache::loncommon::end_page());
  491:     return;
  492: }
  493: 
  494: sub display_choices {
  495:     my ($r,$phase,$context,$prefs_order,$prefs,$container,$parm_permission) = @_;
  496:     if ($phase eq '') {
  497:         $phase = 'pickactions';
  498:     }
  499:     my %helphash;
  500:     &print_header($r,$phase,$context,undef,$container);
  501:     $r->print('<script type="text/javascript">'."\n".
  502:               '// <![CDATA['."\n".
  503:               &Apache::loncommon::check_uncheck_jscript()."\n".
  504:               '// ]]>'."\n".
  505:               '</script>'."\n");
  506:     my $heading = &mt('Settings to display/modify');
  507:     if (ref($parm_permission) eq 'HASH') {
  508:         unless ($parm_permission->{'process'}) {
  509:             $heading = &mt('Settings to display');
  510:         }
  511:     }
  512:     $r->print('<h3>'.$heading.'</h3>'.
  513:               '<div><input type="button" value="'.&mt('check all').'" '.
  514:               'onclick="javascript:checkAll(document.pickactions.actions)"'.
  515:               ' />'.('&nbsp;'x2).
  516:               '<input type="button" value="'.&mt('uncheck all').'" '.
  517:               'onclick="javascript:uncheckAll(document.pickactions.actions)" />'.
  518:               "\n".
  519:               '</div><div class="LC_left_float">');
  520:     my ($numitems,$maxincol,$firstthird,$secondthird,$seconddiv,$thirddiv,$count);
  521:     if (ref($prefs_order) eq 'ARRAY') {
  522:         $numitems = @{$prefs_order};
  523:     }
  524:     my $numcols = 3;
  525:     $maxincol = int($numitems/$numcols);
  526:     if ($numitems%$numcols) {
  527:         $maxincol ++;
  528:     }
  529:     $firstthird = $maxincol;
  530:     $secondthird = $firstthird + $maxincol;
  531:     $count = 0;
  532:     if ((ref($prefs_order) eq 'ARRAY') && (ref($prefs) eq 'HASH')) {
  533:         foreach my $item (@{$prefs_order}) {
  534:             $r->print('<h4>'.
  535:                       &Apache::loncommon::help_open_topic($prefs->{$item}->{'help'}).
  536:                       '<label><input type="checkbox" name="actions" value="'.$item.
  537:                       '" />&nbsp;'.&mt($prefs->{$item}->{'text'}).'</label></h4>');
  538:             $count ++;
  539:             if ((!$seconddiv) && ($count >= $firstthird)) {
  540:                 $r->print('</div>'."\n".'<div class="LC_left_float">'."\n");
  541:                 $seconddiv = 1;
  542:             }
  543:             if ((!$thirddiv) && ($count >= $secondthird)) {
  544:                 $r->print('</div>'."\n".'<div class="LC_left_float">'."\n");
  545:                 $thirddiv = 1;
  546:             }
  547:         }
  548:         $r->print('</div><br clear="all" />');
  549:     }
  550:     $r->print(&print_footer($r,$phase,'display','Display',undef,$container,$parm_permission));
  551:     $r->print('</form>');
  552:     if ($container) {
  553:         &Apache::lonparmset::endSettingsScreen($r);
  554:     }
  555:     $r->print(&Apache::loncommon::end_page());
  556:     return;
  557: }
  558: 
  559: sub color_pick_js {
  560:     my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();
  561:     my $output = <<"ENDCOL";
  562: 
  563:     $pjump_def
  564: 
  565:     function psub() {
  566:         modalWindow.close();
  567:         if (document.parmform.pres_marker.value!='') {
  568:             if (document.parmform.pres_type.value!='') {
  569:                 eval('document.display.'+
  570:                      document.parmform.pres_marker.value+
  571:                      '.value=document.parmform.pres_value.value;');
  572:             }
  573:         } else {
  574:             document.parmform.pres_value.value='';
  575:             document.parmform.pres_marker.value='';
  576:         }
  577:     }
  578: 
  579:     function get_id (span_id) {
  580:         if (document.getElementById) {
  581:             return document.getElementById(span_id);
  582:         }
  583:         if (document.all) {
  584:             return document.all[span_id];
  585:         }
  586:         return false;
  587:     }
  588: 
  589:     function colchg_span (span_id_str,new_color_item) {
  590:         var span_ref = get_id(span_id_str);
  591:         if (span_ref.style) { span_ref = span_ref.style; }
  592:         span_ref.background = new_color_item.value;
  593:         span_ref.backgroundColor = new_color_item.value;
  594:         span_ref.bgColor = new_color_item.value;
  595:     }
  596: 
  597: ENDCOL
  598:     return $output;
  599: }
  600: 
  601: sub get_crumb_text {
  602:     my %brcrumbtext = (
  603:                        domain => 'Domain Settings',
  604:                        course => 'Display/Edit Settings',
  605:                      );
  606:     return %brcrumbtext;
  607: }
  608: 
  609: 1;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>