Diff for /loncom/interface/lonconfigsettings.pm between versions 1.6 and 1.8.2.1

version 1.6, 2009/08/23 17:21:22 version 1.8.2.1, 2010/02/13 19:32:51
Line 38  use Apache::lonlocal; Line 38  use Apache::lonlocal;
   
 sub print_header {  sub print_header {
     my ($r,$phase,$context,$jscript) = @_;      my ($r,$phase,$context,$jscript) = @_;
     my ($pagetitle,$brcrumtitle,$action);      my ($pagetitle,$brcrumtitle,$action,$call_category_check);
     if ($context eq 'domain') {      if ($context eq 'domain') {
         ($pagetitle, $brcrumtitle) = ('View/Modify Domain Settings','Domain Settings');          ($pagetitle, $brcrumtitle) = ('View/Modify Domain Settings','Domain Settings');
         $action = '/adm/domainprefs';          $action = '/adm/domainprefs';
           if ($phase eq 'display') {
               my @actions = &Apache::loncommon::get_env_multiple('form.actions');
               if (grep(/^coursecategories$/,@actions)) {
                   $call_category_check = qq|
       if (formname == document.display) {
           if (!categoryCheck(formname)) {
               return;
           }
       }
   |;
               }
           }
     } else {      } else {
         ($pagetitle, $brcrumtitle) = ('Course Configuration','Course Configuration');          if (&Apache::loncommon::course_type() eq 'Community') {
               ($pagetitle,$brcrumtitle) = ('Community Configuration','Community Configuration');
           } else {
               ($pagetitle,$brcrumtitle) = ('Course Configuration','Course Configuration');
           }
         $action = '/adm/courseprefs';          $action = '/adm/courseprefs';
     }      }
     my $alert = &mt('You must select at least one functionality type to display.');      my $alert = &mt('You must select at least one functionality type to display.');
Line 73  function changePage(formname,newphase) { Line 89  function changePage(formname,newphase) {
             return;              return;
         }          }
     }      }
       '.$call_category_check.'
     formname.submit();      formname.submit();
 }'."\n";  }'."\n";
     if ($phase eq 'pickactions') {      if ($phase eq 'pickactions') {
Line 169  sub make_changes { Line 186  sub make_changes {
        {href=>"javascript:changePage(document.$phase,'$phase')",         {href=>"javascript:changePage(document.$phase,'$phase')",
         text=>"Updated"});          text=>"Updated"});
     &print_header($r,$phase,$context);      &print_header($r,$phase,$context);
       my $crstype;
       if ($context eq 'course') {
           $crstype = &Apache::loncommon::course_type();
       }
     if ((ref($prefs_order) eq 'ARRAY') && (ref($prefs) eq 'HASH') &&       if ((ref($prefs_order) eq 'ARRAY') && (ref($prefs) eq 'HASH') && 
         (ref($prefs) eq 'HASH')) {          (ref($prefs) eq 'HASH')) {
         foreach my $item (@{$prefs_order}) {          foreach my $item (@{$prefs_order}) {
Line 176  sub make_changes { Line 197  sub make_changes {
                 if ($context eq 'domain') {                  if ($context eq 'domain') {
                     $r->print('<h3>'.&mt($prefs->{$item}{'text'}).'</h3>'.                      $r->print('<h3>'.&mt($prefs->{$item}{'text'}).'</h3>'.
                               &Apache::domainprefs::process_changes($r,$dom,                                &Apache::domainprefs::process_changes($r,$dom,
                                           $confname,$item,$roles,$values,));                                            $confname,$item,$roles,$values));
                 } else {                  } else {
                     $changes{$item} = {};                      $changes{$item} = {};
                     &Apache::courseprefs::process_changes($dom,$item,$values,                      &Apache::courseprefs::process_changes($dom,$item,$values,
                                                           $prefs->{$item},$changes{$item},                                                            $prefs->{$item},$changes{$item},
                                                           $allitems,\%disallowed);                                                            $allitems,\%disallowed,$crstype);
                     if (keys(%{$changes{$item}}) > 0) {                      if (keys(%{$changes{$item}}) > 0) {
                         $numchanged ++;                          $numchanged ++;
                     }                      }
Line 191  sub make_changes { Line 212  sub make_changes {
     }      }
     if ($context eq 'course') {      if ($context eq 'course') {
         if ($numchanged) {          if ($numchanged) {
             $r->print(&Apache::courseprefs::store_changes($dom,$confname,$prefs_order,\@actions,              my $message = &Apache::courseprefs::store_changes($dom,$confname,$prefs_order,\@actions,
                                                           $prefs,$values,\%changes));                                                            $prefs,$values,\%changes,$crstype);
               $r->print(&Apache::loncommon::confirmwrapper($message));
         } else {          } else {
             $r->print(&mt('No changes made to course configuration.'));              if ($crstype eq 'Community') {
                   $r->print(&Apache::loncommon::confirmwrapper(&mt("No changes made to community configuration.")));
               } else {
                   $r->print(&Apache::loncommon::confirmwrapper(&mt("No changes made to course configuration.")));
               }
         }          }
         if (keys(%disallowed) > 0) {          if (keys(%disallowed) > 0) {
             $r->print('<p>');              $r->print('<p>');
Line 202  sub make_changes { Line 228  sub make_changes {
                 if (ref($disallowed{$item}) eq 'HASH') {                  if (ref($disallowed{$item}) eq 'HASH') {
                     if (keys(%{$disallowed{$item}}) > 0) {                      if (keys(%{$disallowed{$item}}) > 0) {
                         $r->print(&Apache::courseprefs::display_disallowed($item,$disallowed{$item},                          $r->print(&Apache::courseprefs::display_disallowed($item,$disallowed{$item},
                                                                            $prefs));                                                                             $prefs,$crstype));
                     }                      }
                 }                  }
             }              }
Line 220  sub make_changes { Line 246  sub make_changes {
   
 sub display_settings {  sub display_settings {
     my ($r,$dom,$phase,$context,$prefs_order,$prefs,$values,$confname,$jscript,      my ($r,$dom,$phase,$context,$prefs_order,$prefs,$values,$confname,$jscript,
         $allitems) = @_;          $allitems,$crstype) = @_;
     my %brcrumtext = &get_crumb_text();      my %brcrumtext = &get_crumb_text();
     my @actions = &Apache::loncommon::get_env_multiple('form.actions');      my @actions = &Apache::loncommon::get_env_multiple('form.actions');
     &Apache::lonhtmlcommon::add_breadcrumb      &Apache::lonhtmlcommon::add_breadcrumb
Line 242  sub display_settings { Line 268  sub display_settings {
                     } else {                      } else {
                         ($output{$item},$rowtotal{$item}) =                          ($output{$item},$rowtotal{$item}) =
                             &Apache::courseprefs::print_config_box($r,$dom,$phase,                              &Apache::courseprefs::print_config_box($r,$dom,$phase,
                                 $item,$prefs->{$item},$values,$allitems);                                  $item,$prefs->{$item},$values,$allitems,$crstype);
                     }                      }
                     $rowsum += $rowtotal{$item};                      $rowsum += $rowtotal{$item};
                 }                  }

Removed from v.1.6  
changed lines
  Added in v.1.8.2.1


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