File:  [LON-CAPA] / loncom / interface / lonconfigsettings.pm
Revision 1.41: download - view: text, annotated - select for diffs
Mon Jan 1 01:29:38 2018 UTC (6 years, 5 months ago) by raeburn
Branches: MAIN
CVS tags: HEAD
- Bug 6754 LON-CAPA as LTI Consumer
  Domain configuration for information sent to Tool Provider on launch
  includes choice of: username, or username:domain in LON-CAPA,
  when "User" is included in the data to be sent (as lis_person_sourcedid).

    1: # The LearningOnline Network with CAPA
    2: # Handler to set domain-wide configuration settings
    3: #
    4: # $Id: lonconfigsettings.pm,v 1.41 2018/01/01 01:29:38 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:                 if (ref($values) eq 'HASH') {
  223:                     if (ref($values->{'lti'}) eq 'HASH') {
  224:                         my $numlti = scalar(keys(%{$values->{'lti'}}));
  225:                         for (my $i=0; $i<$numlti; $i++) {
  226:                             $onload .= "toggleLTI(document.display,'user','$i');".
  227:                                        "toggleLTI(document.display,'crs','$i');".
  228:                                        "toggleLTI(document.display,'sec','$i');";
  229:                         }
  230:                     }
  231:                 }
  232:             }
  233:             if (grep(/^ltitools$/,@actions)) {
  234:                 $onload .= "toggleLTITools(document.display,'passback','add');".
  235:                            "toggleLTITools(document.display,'roster','add');".
  236:                            "toggleLTITools(document.display,'user','add');";
  237:                 if (ref($values) eq 'HASH') {
  238:                     if (ref($values->{'ltitools'}) eq 'HASH') {
  239:                         my $numltitools = scalar(keys(%{$values->{'ltitools'}}));
  240:                         for (my $i=0; $i<$numltitools; $i++) {
  241:                             $onload .= "toggleLTITools(document.display,'passback','$i');".
  242:                                        "toggleLTITools(document.display,'roster','$i');".
  243:                                        "toggleLTITools(document.display,'user','$i');";
  244:                         }
  245:                     }
  246:                 }
  247:             }
  248:             if ($onload) {
  249:                 my %loaditems = (
  250:                                   'onload' => $onload,
  251:                                 );
  252:                 $additem = {'add_entries' => \%loaditems,};
  253:             }
  254:         } elsif ($context eq 'course') {
  255:             if (grep(/^courseinfo$/,@actions)) {
  256:                 if (@code_order) { 
  257:                     $additem = {
  258:                                    add_entries => {'onload' => "courseSet('','load');toggleCloners(document.display.cloners_instcode);"},
  259:                                };
  260:                 }
  261:             }
  262:         }
  263:     }
  264:     $r->print(&Apache::loncommon::start_page($pagetitle,$js,$additem));
  265:     $r->print(&Apache::lonhtmlcommon::breadcrumbs($brcrumtitle));
  266:     $r->print('
  267: <form name="parmform" action="">
  268: <input type="hidden" name="pres_marker" />
  269: <input type="hidden" name="pres_type" />
  270: <input type="hidden" name="pres_value" />
  271: </form>
  272: ');
  273:     if ($container) {
  274:        &Apache::lonparmset::startSettingsScreen($r,$container,$crstype);
  275:     }
  276:     $r->print('<form method="post" name="'.$phase.'" action="'.$action.'"'.
  277:               ' enctype="multipart/form-data">');
  278:     return;
  279: }
  280: 
  281: sub print_footer {
  282:     my ($r,$phase,$newphase,$button_text,$actions,$container,$parm_permission) = @_;
  283:     $button_text = &mt($button_text);
  284:     $r->print('<input type="hidden" name="phase" value="" />');
  285:     if (defined($env{'form.origin'})) {
  286:         $r->print('<input type="hidden" name="origin" value="'.$env{'form.origin'}.'" />'."\n");
  287:     }
  288:     if (($phase eq 'display') || ($phase eq 'process')) {
  289:         if (ref($actions) eq 'ARRAY') {
  290:             foreach my $item (@{$actions}) {
  291:                 $r->print('<input type="hidden" name="actions" value="'.$item.'" />'."\n");
  292:             }
  293:         }
  294:     }
  295:     my $dest='"javascript:changePage(document.'.$phase.','."'$newphase'".')"';
  296:     if ($phase eq 'process') {
  297:         $r->print(
  298:             &Apache::lonhtmlcommon::actionbox(
  299:                 ['<a href='.$dest.'>'.$button_text.'</a>']));
  300:     } else {
  301:         my $onclick;
  302:         if ($phase eq 'display') {
  303:             $onclick = '"javascript:changePage(document.'.$phase.','."'$newphase'".')"';
  304:         } else {
  305:             $onclick = '"javascript:changePage(document.'.$phase.','."'$newphase'".')"';
  306:         }
  307:         my $showbutton = 1;
  308:         if (ref($parm_permission) eq 'HASH') {
  309:             unless (($parm_permission->{'process'}) || ($newphase eq 'display')) {
  310:                 $showbutton = 0;
  311:             }
  312:         }
  313:         if ($showbutton) {
  314:             $r->print('<p><input type="button" name="store" value="'.
  315:                       $button_text.'" onclick='.$onclick.' /></p>');
  316:         } 
  317:     }
  318:     if ($phase eq 'process') {
  319:         $r->print('</form>');
  320:         if ($container) {
  321:            &Apache::lonparmset::endSettingsScreen($r);
  322:         }
  323:         $r->print(&Apache::loncommon::end_page());
  324:     }
  325:     return;
  326: }
  327: 
  328: sub make_changes {
  329:     my ($r,$dom,$phase,$context,$prefs_order,$prefs,$values,$confname,$roles,
  330:         $allitems,$container,$parm_permission) = @_;
  331:     my %brcrumtext = &get_crumb_text();
  332:     my @actions = &Apache::loncommon::get_env_multiple('form.actions');
  333:     my ($numchanged,%changes,%disallowed);
  334:     &Apache::lonhtmlcommon::add_breadcrumb
  335:       ({href=>"javascript:changePage(document.$phase,'display')",
  336:         text=>$brcrumtext{$context}},
  337:        {href=>"javascript:changePage(document.$phase,'$phase')",
  338:         text=>"Updated"});
  339:     &print_header($r,$phase,$context,undef,$container);
  340:     my ($crstype,%lastact);
  341:     if ($context eq 'course') {
  342:         $crstype = &Apache::loncommon::course_type();
  343:     }
  344:     if ((ref($prefs_order) eq 'ARRAY') && (ref($prefs) eq 'HASH') && 
  345:         (ref($prefs) eq 'HASH')) {
  346:         foreach my $item (@{$prefs_order}) {
  347:             if (grep(/^\Q$item\E$/,@actions)) {
  348:                 if ($context eq 'domain') {
  349:                     $r->print('<h3>'.&mt($prefs->{$item}{'text'}).'</h3>'.
  350:                               &Apache::domainprefs::process_changes($r,$dom,
  351:                                           $confname,$item,$roles,$values,\%lastact));
  352:                 } else {
  353:                     $changes{$item} = {};
  354:                     &Apache::courseprefs::process_changes($dom,$item,$values,
  355:                                                           $prefs->{$item},$changes{$item},
  356:                                                           $allitems,\%disallowed,$crstype);
  357:                     if (keys(%{$changes{$item}}) > 0) {
  358:                         $numchanged ++;
  359:                     }
  360:                 }
  361:             }
  362:         }
  363:     }
  364:     if ($context eq 'course') {
  365:         if ($numchanged) {
  366:             my $message = &Apache::courseprefs::store_changes($dom,$confname,$prefs_order,\@actions,
  367:                                                           $prefs,$values,\%changes,$crstype);
  368:             $r->print(&Apache::loncommon::confirmwrapper($message));
  369:         } else {
  370:             if ($crstype eq 'Community') {
  371:                 $r->print(&Apache::loncommon::confirmwrapper(&mt("No changes made to community configuration.")));
  372:             } else {
  373:                 $r->print(&Apache::loncommon::confirmwrapper(&mt("No changes made to course configuration.")));
  374:             }
  375:         }
  376:         if (keys(%disallowed) > 0) {
  377:             $r->print('<p>');
  378:             foreach my $item ('cloners','rolenames','feedback','discussion','localization') {
  379:                 if (ref($disallowed{$item}) eq 'HASH') {
  380:                     if (keys(%{$disallowed{$item}}) > 0) {
  381:                         $r->print(&Apache::courseprefs::display_disallowed($item,$disallowed{$item},
  382:                                                                            $prefs,$crstype));
  383:                     }
  384:                 }
  385:             }
  386:             $r->print('</p>');
  387:         }
  388:     }
  389:     $r->print('<p>');
  390:     my $footer_text = 'Back to configuration display';
  391:     if ($context eq 'course') {
  392:         $footer_text = 'Back to display/edit settings'; 
  393:     }
  394:     &print_footer($r,$phase,'display',$footer_text,\@actions,$container,$parm_permission);
  395:     $r->print('</p>');
  396:     return \%lastact;
  397: }
  398: 
  399: sub display_settings {
  400:     my ($r,$dom,$phase,$context,$prefs_order,$prefs,$values,$confname,$jscript,
  401:         $allitems,$crstype,$container,$parm_permission) = @_;
  402:     my %brcrumtext = &get_crumb_text();
  403:     my @actions = &Apache::loncommon::get_env_multiple('form.actions');
  404:     &Apache::lonhtmlcommon::add_breadcrumb
  405:         ({href=>"javascript:changePage(document.$phase,'display')",
  406:           text=>"Display/Edit Settings"});
  407:     my $instcode;
  408:     if (ref($values) eq 'HASH') {
  409:         $instcode = $values->{'internal.coursecode'};
  410:     }
  411:     &print_header($r,$phase,$context,$jscript,$container,$instcode,$dom,$values);
  412:     my $divwidth = 900;
  413:     if ((ref($prefs_order) eq 'ARRAY') && (ref($prefs) eq 'HASH') && (ref($values) eq 'HASH')) { 
  414:         if (@actions > 0) {
  415:             my $rowsum = 0;
  416:             my (%output,%rowtotal,@items,$got_check_uncheck);
  417:             foreach my $item (@{$prefs_order}) {
  418:                 if (grep(/^\Q$item\E$/,@actions)) {
  419:                     push(@items,$item);
  420:                     if ($context eq 'domain') {
  421:                         my $settings;
  422:                         if (ref($values) eq 'HASH') { 
  423:                             $settings = $values->{$item};
  424:                         }
  425:                         if (($item eq 'usersessions') || ($item eq 'ssl')) {
  426:                             unless ($got_check_uncheck) {
  427:                                 $r->print('<script type="text/javascript">'."\n".
  428:                                           '// <![CDATA['."\n".
  429:                                           &Apache::loncommon::check_uncheck_jscript()."\n".
  430:                                           '// ]]>'."\n".
  431:                                           '</script>'."\n");
  432:                                 $got_check_uncheck = 1;
  433:                             }
  434:                         } elsif ($item eq 'selfcreation') {
  435:                             if (ref($values) eq 'HASH') {
  436:                                 $settings = $values->{'usercreation'};
  437:                             }
  438:                         } elsif ($item eq 'defaults') {
  439:                             if (ref($values->{'inststatus'}) eq 'HASH') {
  440:                                 if (ref($values->{'defaults'}) eq 'HASH') {
  441:                                     $settings = {%{$values->{'inststatus'}},%{$values->{'defaults'}}};
  442:                                 } else {
  443:                                     $settings = $values->{'inststatus'};
  444:                                 }
  445:                             } else {
  446:                                 my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
  447:                                 my $inststatus = {
  448:                                                    inststatustypes => $usertypes,
  449:                                                    inststatusorder => $types,
  450:                                                    inststatusguest => [], 
  451:                                                  };
  452:                                 if (ref($values->{defaults}) eq 'HASH') {
  453:                                     $settings = {%{$inststatus},%{$values->{'defaults'}}};
  454:                                 } else {
  455:                                     $settings = $inststatus;
  456:                                 }
  457:                             }
  458:                         }
  459:                         ($output{$item},$rowtotal{$item}) =
  460:                             &Apache::domainprefs::print_config_box($r,$dom,$confname,
  461:                                 $phase,$item,$prefs->{$item},$settings);
  462:                     } else {
  463:                         ($output{$item},$rowtotal{$item}) =
  464:                             &Apache::courseprefs::print_config_box($r,$dom,$phase,
  465:                                 $item,$prefs->{$item},$values,$allitems,$crstype,$parm_permission);
  466:                     }
  467:                     $rowsum += $rowtotal{$item};
  468:                 }
  469:             }
  470:             $r->print('<div id="prefs" style="max-width:'.$divwidth.'px;margin: 10px auto 10px auto;">');
  471:             for (my $i=0; $i<@items; $i++) {
  472:                 $r->print($output{$items[$i]});
  473:             }
  474:             $r->print('</div>');
  475:             $r->print(&print_footer($r,$phase,'process','Save Changes',\@actions,$container,$parm_permission));
  476:         } else {
  477:             $r->print('<input type="hidden" name="phase" value="" />'.
  478:                       '<span class="LC_error">'.&mt('No settings chosen').
  479:                       '</span>');
  480:         }
  481:         $r->print('</form>');
  482:     }
  483:     if ($container) {
  484:         &Apache::lonparmset::endSettingsScreen($r);
  485:     }
  486:     $r->print(&Apache::loncommon::end_page());
  487:     return;
  488: }
  489: 
  490: sub display_choices {
  491:     my ($r,$phase,$context,$prefs_order,$prefs,$container,$parm_permission) = @_;
  492:     if ($phase eq '') {
  493:         $phase = 'pickactions';
  494:     }
  495:     my %helphash;
  496:     &print_header($r,$phase,$context,undef,$container);
  497:     $r->print('<script type="text/javascript">'."\n".
  498:               '// <![CDATA['."\n".
  499:               &Apache::loncommon::check_uncheck_jscript()."\n".
  500:               '// ]]>'."\n".
  501:               '</script>'."\n");
  502:     my $heading = &mt('Settings to display/modify');
  503:     if (ref($parm_permission) eq 'HASH') {
  504:         unless ($parm_permission->{'process'}) {
  505:             $heading = &mt('Settings to display');
  506:         }
  507:     }
  508:     $r->print('<h3>'.$heading.'</h3>'.
  509:               '<div><input type="button" value="'.&mt('check all').'" '.
  510:               'onclick="javascript:checkAll(document.pickactions.actions)"'.
  511:               ' />'.('&nbsp;'x2).
  512:               '<input type="button" value="'.&mt('uncheck all').'" '.
  513:               'onclick="javascript:uncheckAll(document.pickactions.actions)" />'.
  514:               "\n".
  515:               '</div><div class="LC_left_float">');
  516:     my ($numitems,$maxincol,$firstthird,$secondthird,$seconddiv,$thirddiv,$count);
  517:     if (ref($prefs_order) eq 'ARRAY') {
  518:         $numitems = @{$prefs_order};
  519:     }
  520:     my $numcols = 3;
  521:     $maxincol = int($numitems/$numcols);
  522:     if ($numitems%$numcols) {
  523:         $maxincol ++;
  524:     }
  525:     $firstthird = $maxincol;
  526:     $secondthird = $firstthird + $maxincol;
  527:     $count = 0;
  528:     if ((ref($prefs_order) eq 'ARRAY') && (ref($prefs) eq 'HASH')) {
  529:         foreach my $item (@{$prefs_order}) {
  530:             $r->print('<h4>'.
  531:                       &Apache::loncommon::help_open_topic($prefs->{$item}->{'help'}).
  532:                       '<label><input type="checkbox" name="actions" value="'.$item.
  533:                       '" />&nbsp;'.&mt($prefs->{$item}->{'text'}).'</label></h4>');
  534:             $count ++;
  535:             if ((!$seconddiv) && ($count >= $firstthird)) {
  536:                 $r->print('</div>'."\n".'<div class="LC_left_float">'."\n");
  537:                 $seconddiv = 1;
  538:             }
  539:             if ((!$thirddiv) && ($count >= $secondthird)) {
  540:                 $r->print('</div>'."\n".'<div class="LC_left_float">'."\n");
  541:                 $thirddiv = 1;
  542:             }
  543:         }
  544:         $r->print('</div><br clear="all" />');
  545:     }
  546:     $r->print(&print_footer($r,$phase,'display','Display',undef,$container,$parm_permission));
  547:     $r->print('</form>');
  548:     if ($container) {
  549:         &Apache::lonparmset::endSettingsScreen($r);
  550:     }
  551:     $r->print(&Apache::loncommon::end_page());
  552:     return;
  553: }
  554: 
  555: sub color_pick_js {
  556:     my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();
  557:     my $output = <<"ENDCOL";
  558: 
  559:     $pjump_def
  560: 
  561:     function psub() {
  562:         modalWindow.close();
  563:         if (document.parmform.pres_marker.value!='') {
  564:             if (document.parmform.pres_type.value!='') {
  565:                 eval('document.display.'+
  566:                      document.parmform.pres_marker.value+
  567:                      '.value=document.parmform.pres_value.value;');
  568:             }
  569:         } else {
  570:             document.parmform.pres_value.value='';
  571:             document.parmform.pres_marker.value='';
  572:         }
  573:     }
  574: 
  575:     function get_id (span_id) {
  576:         if (document.getElementById) {
  577:             return document.getElementById(span_id);
  578:         }
  579:         if (document.all) {
  580:             return document.all[span_id];
  581:         }
  582:         return false;
  583:     }
  584: 
  585:     function colchg_span (span_id_str,new_color_item) {
  586:         var span_ref = get_id(span_id_str);
  587:         if (span_ref.style) { span_ref = span_ref.style; }
  588:         span_ref.background = new_color_item.value;
  589:         span_ref.backgroundColor = new_color_item.value;
  590:         span_ref.bgColor = new_color_item.value;
  591:     }
  592: 
  593: ENDCOL
  594:     return $output;
  595: }
  596: 
  597: sub get_crumb_text {
  598:     my %brcrumbtext = (
  599:                        domain => 'Domain Settings',
  600:                        course => 'Display/Edit Settings',
  601:                      );
  602:     return %brcrumbtext;
  603: }
  604: 
  605: 1;

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