File:  [LON-CAPA] / loncom / interface / lonconfigsettings.pm
Revision 1.21.4.13.2.1: download - view: text, annotated - select for diffs
Thu Dec 30 23:55:35 2021 UTC (2 years, 5 months ago) by raeburn
Branches: version_2_11_4_msu
Diff to branchpoint 1.21.4.13: preferred, unified
- For 2.11.4 (modified)
  Include changes in 1.39, 1.51

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

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