[LON-CAPA-cvs] cvs: loncom /interface domainprefs.pm lonconfigsettings.pm

raeburn raeburn@source.lon-capa.org
Wed, 22 Apr 2009 12:42:16 -0000


raeburn		Wed Apr 22 12:42:16 2009 EDT

  Modified files:              
    /loncom/interface	domainprefs.pm lonconfigsettings.pm 
  Log:
  - domainprefs.pm 
   - Current values are passed to &process_changes() as a reference to a hash.
  
  - lonconfigsettings
   - &print_header() takes an additional (optional) fourth arg - $jscript.
   - in course context: courseprefs::process_changes() used to process changes.
                        courseprefs::print_config_box(): sixth arg: $values hash ref.
  
  
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.91 loncom/interface/domainprefs.pm:1.92
--- loncom/interface/domainprefs.pm:1.91	Tue Mar 31 16:59:01 2009
+++ loncom/interface/domainprefs.pm	Wed Apr 22 12:42:16 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.91 2009/03/31 16:59:01 raeburn Exp $
+# $Id: domainprefs.pm,v 1.92 2009/04/22 12:42:16 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -242,7 +242,11 @@
 }
 
 sub process_changes {
-    my ($r,$dom,$confname,$action,$roles,%domconfig) = @_;
+    my ($r,$dom,$confname,$action,$roles,$values) = @_;
+    my %domconfig;
+    if (ref($values) eq 'HASH') {
+        %domconfig = %{$values};
+    }
     my $output;
     if ($action eq 'login') {
         $output = &modify_login($r,$dom,$confname,%domconfig);
Index: loncom/interface/lonconfigsettings.pm
diff -u loncom/interface/lonconfigsettings.pm:1.1 loncom/interface/lonconfigsettings.pm:1.2
--- loncom/interface/lonconfigsettings.pm:1.1	Tue Mar 31 16:59:01 2009
+++ loncom/interface/lonconfigsettings.pm	Wed Apr 22 12:42:16 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: lonconfigsettings.pm,v 1.1 2009/03/31 16:59:01 raeburn Exp $
+# $Id: lonconfigsettings.pm,v 1.2 2009/04/22 12:42:16 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -37,7 +37,7 @@
 use Apache::lonlocal;
 
 sub print_header {
-    my ($r,$phase,$context) = @_;
+    my ($r,$phase,$context,$jscript) = @_;
     my ($pagetitle,$brcrumtitle,$action);
     if ($context eq 'domain') {
         ($pagetitle, $brcrumtitle) = ('View/Modify Domain Settings','Domain Settings');
@@ -83,6 +83,13 @@
     $js .= &Apache::loncommon::viewport_size_js().'
 </script>
 ';
+    if ($jscript) {
+        $js .= "
+
+$jscript
+
+";
+    }
     my $additem;
     if ($phase eq 'pickactions') {
         my %loaditems = (
@@ -162,7 +169,7 @@
                 if ($context eq 'domain') {
                     $r->print(&Apache::domainprefs::process_changes($r,$dom,$confname,$item,$roles,$values));
                 } else {
-                    $r->print(&Apache::domainprefs::process_changes($r,$dom,$item,$values));
+                    $r->print(&Apache::courseprefs::process_changes($r,$dom,$item,$values));
                 }
             }
         }
@@ -173,13 +180,13 @@
 }
 
 sub display_settings {
-    my ($r,$dom,$phase,$context,$prefs_order,$prefs,$values,$confname) = @_;
+    my ($r,$dom,$phase,$context,$prefs_order,$prefs,$values,$confname,$jscript) = @_;
     my %brcrumtext = &get_crumb_text();
     my @actions = &Apache::loncommon::get_env_multiple('form.actions');
     &Apache::lonhtmlcommon::add_breadcrumb
         ({href=>"javascript:changePage(document.$phase,'display')",
           text=>"Course Settings"});
-    &print_header($r,$phase,$context);
+    &print_header($r,$phase,$context,$jscript);
     if ((ref($prefs_order) eq 'ARRAY') && (ref($prefs) eq 'HASH') && (ref($values) eq 'HASH')) { 
         if (@actions > 0) {
             my $rowsum = 0;
@@ -195,7 +202,7 @@
                     } else {
                         ($output{$item},$rowtotal{$item}) =
                             &Apache::courseprefs::print_config_box($r,$dom,$phase,
-                                $item,$prefs->{$item},$values->{$item});
+                                $item,$prefs->{$item},$values);
                     }
                     $rowsum += $rowtotal{$item};
                 }