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

tempelho tempelho@source.lon-capa.org
Tue, 26 May 2009 20:39:22 -0000


tempelho		Tue May 26 20:39:22 2009 EDT

  Modified files:              
    /loncom/interface	domainprefs.pm 
  Log:
  Insert the ability to change the top level menu font color as the default domain prefrences.
  
  
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.96 loncom/interface/domainprefs.pm:1.97
--- loncom/interface/domainprefs.pm:1.96	Tue May 19 20:00:24 2009
+++ loncom/interface/domainprefs.pm	Tue May 26 20:39:22 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.96 2009/05/19 20:00:24 raeburn Exp $
+# $Id: domainprefs.pm,v 1.97 2009/05/26 20:39:22 tempelho Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -634,6 +634,7 @@
     my %defaults = (
                    img => $defaultdesign{$role.'.img'},
                    font => $defaultdesign{$role.'.font'},
+		   fontmenu => $defaultdesign{$role.'.fontmenu'},
                    );
     foreach my $item (@bgs) {
         $defaults{'bgs'}{$item} = $defaultdesign{$role.'.'.$item};
@@ -651,6 +652,10 @@
                 $designs{'font'} = $settings->{$role}->{'font'};
                 $is_custom{'font'} = 1;
             }
+            if ($settings->{$role}->{'fontmenu'} ne '') {
+                $designs{'fontmenu'} = $settings->{$role}->{'fontmenu'};
+                $is_custom{'fontmenu'} = 1;
+            }
             foreach my $item (@bgs) {
                 if ($settings->{$role}->{$item} ne '') {
                     $designs{'bgs'}{$item} = $settings->{$role}->{$item};
@@ -669,6 +674,10 @@
             $designs{img} = $designhash{$dom.'.'.$role.'.img'};
             $is_custom{'img'} = 1;
         }
+        if ($designhash{$dom.'.'.$role.'.fontmenu'} ne '') {
+            $designs{fontmenu} = $designhash{$dom.'.'.$role.'.fontmenu'};
+            $is_custom{'fontmenu'} = 1; 
+        }
         if ($designhash{$dom.'.'.$role.'.font'} ne '') {
             $designs{font} = $designhash{$dom.'.'.$role.'.font'};
             $is_custom{'font'} = 1;
@@ -697,7 +706,7 @@
     my ($dom,$confname,$phase,$role,$itemcount,$choices,$is_custom,$defaults,$designs,
         $images,$bgs,$links,$alt_text,$rowtotal,$logintext,$loginheader) = @_;
     my $css_class = $itemcount%2?' class="LC_odd_row"':'';
-    my $datatable = '<tr'.$css_class.'>'.
+    my $datatable = '<tr>'.
         '<td>'.$choices->{'font'}.'</td>';
     if (!$is_custom->{'font'}) {
         $datatable .=  '<td>'.&mt('Default in use:').'&nbsp;<span id="css_default_'.$role.'_font" style="color: '.$defaults->{'font'}.';">'.$defaults->{'font'}.'</span></td>';
@@ -711,6 +720,20 @@
                   '&nbsp;<span id="css_'.$role.'_font" style="background-color: '.
                   $designs->{'font'}.';">&nbsp;&nbsp;&nbsp;</span>'.
                   '</span></td></tr>';
+    $datatable .= '<tr'.$css_class.'>'.
+        '<td>'.$choices->{'fontmenu'}.'</td>';
+    if (!$is_custom->{'fontmenu'}) {
+        $datatable .=  '<td>'.&mt('Default in use:').'&nbsp;<span id="css_default_'.$role.'_font" style="color: '.$defaults->{'fontmenu'}.';">'.$defaults->{'fontmenu'}.'</span></td>';
+    } else {
+        $datatable .= '<td>&nbsp;</td>';
+    }
+    $fontlink = &color_pick($phase,$role,'fontmenu',$choices->{'fontmenu'},$designs->{'fontmenu'});
+    $datatable .= '<td><span class="LC_nobreak">'.
+                  '<input type="text" size="10" name="'.$role.'_fontmenu"'.
+                  ' value="'.$designs->{'fontmenu'}.'" />&nbsp;'.$fontlink.
+                  '&nbsp;<span id="css_'.$role.'_fontmenu" style="background-color: '.
+                  $designs->{'fontmenu'}.';">&nbsp;&nbsp;&nbsp;</span>'.
+                  '</span></td></tr>';
     my $switchserver = &check_switchserver($dom,$confname);
     foreach my $img (@{$images}) {
 	$itemcount ++;
@@ -2697,6 +2720,7 @@
             links => "Link colors",
             images => "Images",
             font => "Font color",
+            fontmenu => "Font Menu",
             pgbg => "Page",
             tabbg => "Header",
             sidebg => "Border",
@@ -2763,6 +2787,7 @@
             @bgs = ('pgbg','tabbg','sidebg'); 
         }
         $confhash->{$role}{'font'} = $env{'form.'.$role.'_font'};
+	$confhash->{$role}{'fontmenu'} = $env{'form.'.$role.'_fontmenu'};
         foreach my $item (@bgs,@links,@logintext) {
             $confhash->{$role}{$item} = $env{'form.'.$role.'_'.$item};
         }
@@ -2876,6 +2901,15 @@
                         $changes{$role}{'font'} = 1;
                     }
                 }
+                if ($domconfig->{$role}{'fontmenu'} ne '') {
+                    if ($confhash->{$role}{'fontmenu'} ne $domconfig->{$role}{'fontmenu'}) {
+                        $changes{$role}{'fontmenu'} = 1;
+                    }
+                } else {
+                    if ($confhash->{$role}{'fontmenu'}) {
+                        $changes{$role}{'fontmenu'} = 1;
+                    }
+                }
                 foreach my $item (@bgs) {
                     if ($domconfig->{$role}{$item} ne '') {
                         if ($confhash->{$role}{$item} ne $domconfig->{$role}{$item}) {