File:  [LON-CAPA] / loncom / interface / lonconfigsettings.pm
Revision 1.21.4.13: download - view: text, annotated - select for diffs
Tue Dec 28 02:32:31 2021 UTC (2 years, 5 months ago) by raeburn
Branches: version_2_11_X
CVS tags: version_2_11_4_uiuc, version_2_11_4_msu, version_2_11_4
Diff to branchpoint 1.21: preferred, unified
- For 2.11
  Backport 1.54, 1.55

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

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