Diff for /loncom/interface/lonconfigsettings.pm between versions 1.33 and 1.52

version 1.33, 2016/10/11 22:58:55 version 1.52, 2021/09/01 00:21:52
Line 40  use Apache::courseclassifier(); Line 40  use Apache::courseclassifier();
 use LONCAPA qw(:DEFAULT :match);   use LONCAPA qw(:DEFAULT :match); 
   
 sub print_header {  sub print_header {
     my ($r,$phase,$context,$jscript,$container) = @_;      my ($r,$phase,$context,$jscript,$container,$instcode,$dom,$values) = @_;
     my ($pagetitle,$brcrumtitle,$action,$call_category_check,$instcode_check,      my ($pagetitle,$brcrumtitle,$action,$call_category_check,$instcode_check,
         $crstype,@actions,@code_order);          $crstype,@actions,@code_order);
     if ($phase eq 'display') {      if ($phase eq 'display') {
Line 177  $jscript Line 177  $jscript
         $additem = {'add_entries' => \%loaditems,};          $additem = {'add_entries' => \%loaditems,};
     } elsif ($phase eq 'display') {      } elsif ($phase eq 'display') {
         if ($context eq 'domain') {          if ($context eq 'domain') {
               my $onload;
             if (grep(/^coursedefaults$/,@actions)) {              if (grep(/^coursedefaults$/,@actions)) {
                   $onload = "toggleDisplay(document.display,'cloneinstcode');".
                             "toggleDisplay(document.display,'credits');".
                             "toggleDisplay(document.display,'studentsubmission');";
               }
               if (grep(/^selfcreation$/,@actions)) {
                   my $prefix = 'cancreate_emailverified';
                   my $customclass = 'LC_selfcreate_email';
                   my $classprefix = 'LC_canmodify_emailusername_';
                   my $optionsprefix = 'LC_options_emailusername_';
                   $onload .= "toggleRows(document.display,'cancreate_email','selfassign','$customclass','$classprefix','$optionsprefix');";
                   my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
                   my $hascustom;
                   my ($emailrules,$emailruleorder) = &Apache::lonnet::inst_userrules($dom,'email');
                   if (ref($emailrules) eq 'HASH') {
                       if (keys(%{$emailrules}) > 0) {
                           $hascustom = 'cancreate_emailrule';
                       }
                   }
                   my @posstypes;
                   if (ref($types) eq 'ARRAY') {
                       @posstypes = @{$types};
                       push(@posstypes,'default');
                       foreach my $type (@posstypes) {
                           $onload .= "toggleEmailOptions(document.display,'cancreate_emailoptions','$hascustom',".
                                                                  "'cancreate_emaildomain','$type');";
                       }
                   } else {
                       $onload .= "toggleEmailOptions(document.display,'cancreate_emailoptions','$hascustom',".
                                                          "'cancreate_emaildomain','default');";
                   }
               } 
               if (grep(/^contacts$/,@actions)) {
                   my $customclass = 'LC_helpdesk_override';
                   my $optionsprefix = 'LC_options_helpdesk_';
                   $onload .= "toggleHelpdeskRow(document.display,'overrides','$customclass','$optionsprefix');";
               }
               if (grep(/^lti$/,@actions)) {
                   $onload .= "toggleLTI(document.display,'user','add');".
                              "toggleLTI(document.display,'crs','add');".
                              "toggleLTI(document.display,'sec','add');".
                              "toggleLTI(document.display,'lcauth','add');".
                              "toggleLTI(document.display,'lcmenu','add');".
                              "toggleLTI(document.display,'passback','add');".
                              "toggleLTI(document.display,'callback','add');";
                   if (ref($values) eq 'HASH') {
                       if (ref($values->{'lti'}) eq 'HASH') {
                           my $numlti = scalar(keys(%{$values->{'lti'}}));
                           for (my $i=0; $i<$numlti; $i++) {
                               $onload .= "toggleLTI(document.display,'user','$i');".
                                          "toggleLTI(document.display,'crs','$i');".
                                          "toggleLTI(document.display,'sec','$i');".
                                          "toggleLTI(document.display,'lcauth','$i');".
                                          "toggleLTI(document.display,'lcmenu','$i');".
                                          "toggleLTI(document.display,'passback','$i');".
                                          "toggleLTI(document.display,'callback','$i');";
                           }
                       }
                   }
               }
               if (grep(/^ltitools$/,@actions)) {
                   $onload .= "toggleLTITools(document.display,'passback','add');".
                              "toggleLTITools(document.display,'roster','add');".
                              "toggleLTITools(document.display,'user','add');";
                   if (ref($values) eq 'HASH') {
                       if (ref($values->{'ltitools'}) eq 'HASH') {
                           my $numltitools = scalar(keys(%{$values->{'ltitools'}}));
                           for (my $i=0; $i<$numltitools; $i++) {
                               $onload .= "toggleLTITools(document.display,'passback','$i');".
                                          "toggleLTITools(document.display,'roster','$i');".
                                          "toggleLTITools(document.display,'user','$i');";
                           }
                       }
                   }
               }
               if (grep(/^wafproxy$/,@actions)) {
                   $onload .= "toggleWAF();checkWAF();updateWAF();";
               }
               if (grep(/^proctoring$/,@actions)) {
                   $onload .= "toggleProctoring(document.display,'proctorio');".
                              "toggleProctoring(document.display,'examity');";
               }
               if (grep(/^scantron$/,@actions)) {
                   $onload .= "toggleScantron('document.display');";
               }
               if (grep(/^autoupdate$/,@actions)) {
                   $onload .= "toggleLastActiveDays('document.display');";
               }
               if ($onload) {
                 my %loaditems = (                  my %loaditems = (
                     '             onload' => "toggleDisplay(document.display,'cloneinstcode');".                                    'onload' => $onload,
                                              "toggleDisplay(document.display,'credits');".  
                                              "toggleDisplay(document.display,'studentsubmission');",  
                                 );                                  );
                 $additem = {'add_entries' => \%loaditems,};                  $additem = {'add_entries' => \%loaditems,};
             }              }
Line 271  sub make_changes { Line 358  sub make_changes {
        {href=>"javascript:changePage(document.$phase,'$phase')",         {href=>"javascript:changePage(document.$phase,'$phase')",
         text=>"Updated"});          text=>"Updated"});
     &print_header($r,$phase,$context,undef,$container);      &print_header($r,$phase,$context,undef,$container);
     my ($crstype,%lastact);      my ($crstype,%lastact,$errors);
     if ($context eq 'course') {      if ($context eq 'course') {
         $crstype = &Apache::loncommon::course_type();          $crstype = &Apache::loncommon::course_type();
     }      }
Line 285  sub make_changes { Line 372  sub make_changes {
                                           $confname,$item,$roles,$values,\%lastact));                                            $confname,$item,$roles,$values,\%lastact));
                 } else {                  } else {
                     $changes{$item} = {};                      $changes{$item} = {};
                     &Apache::courseprefs::process_changes($dom,$item,$values,                      $errors =
                                                           $prefs->{$item},$changes{$item},                          &Apache::courseprefs::process_changes($dom,$confname,$item,$values,
                                                           $allitems,\%disallowed,$crstype);                                                                $prefs->{$item},$changes{$item},
                                                                 $allitems,\%disallowed,$crstype);
                     if (keys(%{$changes{$item}}) > 0) {                      if (keys(%{$changes{$item}}) > 0) {
                         $numchanged ++;                          $numchanged ++;
                     }                      }
Line 319  sub make_changes { Line 407  sub make_changes {
             }              }
             $r->print('</p>');              $r->print('</p>');
         }          }
           if ($errors) {
               $r->print('<p>'.$errors.'</p>');
           }
     }      }
     $r->print('<p>');      $r->print('<p>');
     my $footer_text = 'Back to configuration display';      my $footer_text = 'Back to configuration display';
Line 342  sub display_settings { Line 433  sub display_settings {
     if (ref($values) eq 'HASH') {      if (ref($values) eq 'HASH') {
         $instcode = $values->{'internal.coursecode'};          $instcode = $values->{'internal.coursecode'};
     }      }
     &print_header($r,$phase,$context,$jscript,$container,$instcode);      &print_header($r,$phase,$context,$jscript,$container,$instcode,$dom,$values);
     my $divwidth = 900;      my $divwidth = 900;
     if ((ref($prefs_order) eq 'ARRAY') && (ref($prefs) eq 'HASH') && (ref($values) eq 'HASH')) {       if ((ref($prefs_order) eq 'ARRAY') && (ref($prefs) eq 'HASH') && (ref($values) eq 'HASH')) { 
         if (@actions > 0) {          if (@actions > 0) {
Line 475  sub display_choices { Line 566  sub display_choices {
                 $thirddiv = 1;                  $thirddiv = 1;
             }              }
         }          }
         $r->print('</div><br clear="all" />');  
     }      }
       $r->print('</div><div style="padding:0;clear:both;margin:0;border:0"></div>');
     $r->print(&print_footer($r,$phase,'display','Display',undef,$container,$parm_permission));      $r->print(&print_footer($r,$phase,'display','Display',undef,$container,$parm_permission));
     $r->print('</form>');      $r->print('</form>');
     if ($container) {      if ($container) {

Removed from v.1.33  
changed lines
  Added in v.1.52


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