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

gci gci@source.lon-capa.org
Wed, 23 Sep 2009 02:40:13 -0000


This is a MIME encoded message

--gci1253673613
Content-Type: text/plain

gci		Wed Sep 23 02:40:13 2009 EDT

  Modified files:              (Branch: GCI_2)
    /loncom/interface	domainprefs.pm 
  Log:
  - domainprefs.pm for GCI_2 updated to 2.9.X
  - Eliminate changes included in 1.97 (not part of 2.9.X).
  - Backport 1.103, 1.104, 1.105, 1.106, 1.108, 1.109.
  
  
--gci1253673613
Content-Type: text/plain
Content-Disposition: attachment; filename="gci-20090923024013.txt"

Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.102 loncom/interface/domainprefs.pm:1.102.4.1
--- loncom/interface/domainprefs.pm:1.102	Tue Aug 11 23:24:29 2009
+++ loncom/interface/domainprefs.pm	Wed Sep 23 02:40:13 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.102 2009/08/11 23:24:29 raeburn Exp $
+# $Id: domainprefs.pm,v 1.102.4.1 2009/09/23 02:40:13 gci Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -105,7 +105,7 @@
 (official, unofficial and community).  In each case the radio buttons allow the 
 selection of one of four values:
 
-0, approve, validate, autolimit=N (where N is blank, or a positive integer).
+0, approval, validate, autolimit=N (where N is blank, or a positive integer).
 which have the following effects:
 
 0
@@ -116,7 +116,7 @@
 
 =back
 
-approve 
+approval 
 
 =over 
 
@@ -763,7 +763,6 @@
     my %defaults = (
                    img => $defaultdesign{$role.'.img'},
                    font => $defaultdesign{$role.'.font'},
-		   fontmenu => $defaultdesign{$role.'.fontmenu'},
                    );
     foreach my $item (@bgs) {
         $defaults{'bgs'}{$item} = $defaultdesign{$role.'.'.$item};
@@ -781,10 +780,6 @@
                 $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};
@@ -803,10 +798,6 @@
             $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;
@@ -835,7 +826,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>'.
+    my $datatable = '<tr'.$css_class.'>'.
         '<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>';
@@ -849,20 +840,6 @@
                   '&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 ++;
@@ -1149,7 +1126,7 @@
     my ($css_class,%titles);
     if ($context eq 'requestcourses') {
         @usertools = ('official','unofficial','community');
-        @options =('norequest','approve','autolimit','validate');
+        @options =('norequest','approval','autolimit','validate');
         %validations = &Apache::lonnet::auto_courserequest_checks($dom);
         %titles = &courserequest_titles();
     } else {
@@ -1222,7 +1199,10 @@
                             if ($option eq 'autolimit') {
                                 $cell{$item} .= '<input type="text" name="crsreq_'.
                                                 $item.'_limit_'.$type.'" size="1" '.
-                                                'value="'.$currlimit.'" />'; 
+                                                'value="'.$currlimit.'" />';
+                            }
+                            if ($option eq 'autolimit') {
+                                $cell{$item} .= $titles{'unlimited'};
                             }
                             $cell{$item} .= '</span>&nbsp; ';
                         }
@@ -1246,7 +1226,7 @@
                 if ($context eq 'requestcourses') {
                     $datatable .= '</tr><tr>';
                     foreach my $item (@usertools) {
-                        $datatable .= '<td>'.$cell{$item}.'</td>';  
+                        $datatable .= '<td style="vertical-align: top;">'.$cell{$item}.'</td>';  
                     }
                     $datatable .= '</tr></table>';
                 }
@@ -1328,6 +1308,9 @@
                                        'value="'.$currlimit.'" />';
                 }
                 $defcell{$item} .= '</span>&nbsp; ';
+                if ($option eq 'autolimit') {
+                    $defcell{$item} .= $titles{'unlimited'};
+                }
             }
         } else {
             my $checked = 'checked="checked" ';
@@ -1349,7 +1332,7 @@
     if ($context eq 'requestcourses') {
         $datatable .= '</tr><tr>';
         foreach my $item (@usertools) {
-            $datatable .= '<td>'.$defcell{$item}.'</td>';
+            $datatable .= '<td style="vertical-align: top;">'.$defcell{$item}.'</td>';
         }
         $datatable .= '</tr></table>';
     }
@@ -1363,14 +1346,17 @@
     $typecount ++;
     $css_class = $typecount%2?' class="LC_odd_row"':'';
     $datatable .= '<tr'.$css_class.'>'.
-                  '<td>'.&mt('LON-CAPA Advanced Users').
-                  ' <span class="LC_nobreak">('.
-                  &mt('overrides affiliation').')</span></td>'.
-                  '<td class="LC_left_item" colspan="2">';
+                  '<td>'.&mt('LON-CAPA Advanced Users').' ';
     if ($context eq 'requestcourses') {
-        $datatable .= '<table><tr>';
+        $datatable .= &mt('(overrides affiliation, if set)').
+                      '</td>'.
+                      '<td class="LC_left_item">'.
+                      '<table><tr>';
     } else {
-        $datatable .= '<br />';
+        $datatable .= &mt('(overrides affiliation, if checked)').
+                      '</td>'.
+                      '<td class="LC_left_item" colspan="2">'.
+                      '<br />';
     }
     my %advcell;
     foreach my $item (@usertools) {
@@ -1384,10 +1370,15 @@
                     }
                 }
             }
-            if (!$curroption) {
-                $curroption = 'norequest';
-            }
             $datatable .= '<th>'.$titles{$item}.'</th>';
+            my $checked = '';
+            if ($curroption eq '') {
+                $checked = ' checked="checked"';
+            }
+            $advcell{$item} .= '<span class="LC_nobreak"><label>'.
+                               '<input type="radio" name="crsreq_'.$item.
+                               '__LC_adv" value=""'.$checked.' />'.
+                               &mt('No override set').'</label></span>&nbsp; ';
             foreach my $option (@options) {
                 my $val = $option;
                 if ($option eq 'norequest') {
@@ -1403,7 +1394,7 @@
                     next if (!$canvalidate);
                 }
                 my $checked = '';
-                if ($option eq $curroption) {
+                if ($val eq $curroption) {
                     $checked = ' checked="checked"';
                 } elsif ($option eq 'autolimit') {
                     if ($curroption =~ /^autolimit/) {
@@ -1420,6 +1411,9 @@
                                        'value="'.$currlimit.'" />';
                 }
                 $advcell{$item} .= '</span>&nbsp; ';
+                if ($option eq 'autolimit') {
+                    $advcell{$item} .= $titles{'unlimited'};
+                }
             }
         } else {
             my $checked = 'checked="checked" ';
@@ -1441,7 +1435,7 @@
     if ($context eq 'requestcourses') {
         $datatable .= '</tr><tr>';
         foreach my $item (@usertools) {
-            $datatable .= '<td>'.$advcell{$item}.'</td>';
+            $datatable .= '<td style="vertical-align: top;">'.$advcell{$item}.'</td>';
         }
         $datatable .= '</tr></table>';
     }
@@ -1452,7 +1446,7 @@
 
 sub print_courserequestmail {
     my ($dom,$settings,$rowtotal) = @_;
-    my ($now,$datatable,%dompersonnel,@domcoord,@currapprove,$rows);
+    my ($now,$datatable,%dompersonnel,@domcoord,@currapproval,$rows);
     $now = time;
     $rows = 0;
     %dompersonnel = &Apache::lonnet::get_domain_roles($dom,['dc'],$now,$now);
@@ -1467,12 +1461,12 @@
     if (ref($settings) eq 'HASH') {
         if (ref($settings->{'notify'}) eq 'HASH') {
             if ($settings->{'notify'}{'approval'} ne '') {
-               @currapprove = split(',',$settings->{'notify'}{'approval'});
+               @currapproval = split(',',$settings->{'notify'}{'approval'});
             }
         }
     }
-    if (@currapprove) {
-        foreach my $dc (@currapprove) {
+    if (@currapproval) {
+        foreach my $dc (@currapproval) {
             unless (grep(/^\Q$dc\E$/,@domcoord)) {
                 push(@domcoord,$dc);
             }
@@ -1498,7 +1492,7 @@
                 $rows ++;
             }
             my $check = ' ';
-            if (grep(/^\Q$domcoord[$i]\E$/,@currapprove)) {
+            if (grep(/^\Q$domcoord[$i]\E$/,@currapproval)) {
                 $check = ' checked="checked" ';
             }
             my ($uname,$udom) = split(':',$domcoord[$i]);
@@ -1869,16 +1863,17 @@
                                    unofficial => 'Unofficial',
                                    community  => 'Communities',
                                    norequest  => 'Not allowed',
-                                   approve    => 'Approval by Dom. Coord.',
+                                   approval   => 'Approval by Dom. Coord.',
                                    validate   => 'With validation',
                                    autolimit  => 'Numerical limit',
+                                   unlimited  => '(blank for unlimited)',
                  );
     return %titles;
 }
 
 sub courserequest_conditions {
     my %conditions = &Apache::lonlocal::texthash (
-       approve    => '(Processing of request subject to approval by Domain Coordinator).',
+       approval   => '(Processing of request subject to approval by Domain Coordinator).',
        validate   => '(Processing of request subject to instittutional validation).',
                  );
     return %conditions;
@@ -2665,6 +2660,7 @@
     }
     $output = <<"ENDSCRIPT";
 <script type="text/javascript">
+// <![CDATA[
 function reorderCats(form,parent,item,idx) {
     var changedVal;
 $jstext
@@ -2721,6 +2717,7 @@
     }
     return;
 }
+// ]]>
 </script>
 
 ENDSCRIPT
@@ -3139,7 +3136,6 @@
             links => "Link colors",
             images => "Images",
             font => "Font color",
-            fontmenu => "Font Menu",
             pgbg => "Page",
             tabbg => "Header",
             sidebg => "Border",
@@ -3206,7 +3202,6 @@
             @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};
         }
@@ -3320,15 +3315,6 @@
                         $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}) {
@@ -3769,7 +3755,7 @@
     }
     if ($context eq 'requestcourses') {
         @usertools = ('official','unofficial','community');
-        @options =('norequest','approve','autolimit','validate');
+        @options =('norequest','approval','autolimit','validate');
         %validations = &Apache::lonnet::auto_courserequest_checks($dom);
         %titles = &courserequest_titles();
         $toolregexp = join('|',@usertools);
@@ -3824,7 +3810,12 @@
     }
     foreach my $item (@usertools) {
         foreach my $type (@{$types},'default','_LC_adv') {
+            my $unset;
             if ($context eq 'requestcourses') {
+                $unset = '0';
+                if ($type eq '_LC_adv') {
+                    $unset = '';
+                }
                 if ($confhash{$item}{$type} eq 'autolimit') {
                     $confhash{$item}{$type} .= '=';
                     unless ($limithash{$item}{$type} =~ /\D/) {
@@ -3845,7 +3836,7 @@
                     }
                 } else {
                     if ($context eq 'requestcourses') {
-                        if ($confhash{$item}{$type} ne 'norequest') {
+                        if ($confhash{$item}{$type} ne $unset) {
                             $changes{$item}{$type} = 1;
                         }
                     } else {
@@ -3856,7 +3847,7 @@
                 }
             } else {
                 if ($context eq 'requestcourses') {
-                    if ($confhash{$item}{$type} eq 'norequest') {
+                    if ($confhash{$item}{$type} ne $unset) {
                         $changes{$item}{$type} = 1;
                     }
                 } else {
@@ -3948,8 +3939,8 @@
                                                           $env{'user.domain'},
                                                           $item,'reload',$context);
                     if ($context eq 'requestcourses') {
-                        if ($env{'environment.crsrequest.'.$item} ne $newacc) {
-                            $newenv{'environment.crsrequest.'.$item} = $newacc;
+                        if ($env{'environment.canrequest.'.$item} ne $newacc) {
+                            $newenv{'environment.canrequest.'.$item} = $newacc;
                         }
                     } else {
                         if ($env{'environment.availabletools.'.$item} ne $newacc) { 
@@ -3982,7 +3973,15 @@
                                     $resulttext .= '<li>'.&mt('Set to be available to [_1]',$typetitle).'</li>';
                                 }
                             } else {
-                                $resulttext .= '<li>'.&mt('Set to be unavailable to [_1]',$typetitle).'</li>';
+                                if ($type eq '_LC_adv') {
+                                    if ($confhash{$item}{$type} eq '0') {
+                                        $resulttext .= '<li>'.&mt('Set to be unavailable to [_1]',$typetitle).'</li>';
+                                    } else { 
+                                        $resulttext .= '<li>'.&mt('No override set for [_1]',$typetitle).'</li>';
+                                    }
+                                } else {
+                                    $resulttext .= '<li>'.&mt('Set to be unavailable to [_1]',$typetitle).'</li>';
+                                }
                             }
                         }
                     }
@@ -4530,6 +4529,8 @@
         if (@{$types} > 0) {
             @{$cancreate{'statustocreate'}} = 
                 &Apache::loncommon::get_env_multiple('form.statustocreate');
+        } else {
+            @{$cancreate{'statustocreate'}} = ();
         }
         push(@contexts,'statustocreate');
     }
@@ -4538,9 +4539,11 @@
             if (($item eq 'selfcreate') || ($item eq 'statustocreate')) {
                 if (ref($curr_usercreation{'cancreate'}{$item}) eq 'ARRAY') {
                     foreach my $curr (@{$curr_usercreation{'cancreate'}{$item}}) {
-                        if (!grep(/^$curr$/,@{$cancreate{$item}})) {
-                            if (!grep(/^$item$/,@{$changes{'cancreate'}})) {
-                                push(@{$changes{'cancreate'}},$item);
+                        if (ref($cancreate{$item}) eq 'ARRAY') {
+                            if (!grep(/^$curr$/,@{$cancreate{$item}})) {
+                                if (!grep(/^$item$/,@{$changes{'cancreate'}})) {
+                                    push(@{$changes{'cancreate'}},$item);
+                                }
                             }
                         }
                     }
@@ -5009,8 +5012,10 @@
             if ($newvalues{$item} ne '') {
                 if ($newvalues{$item} =~ /^(\w+)/) {
                     my $langcode = $1;
-                    if (code2language($langcode) eq '') {
-                        push(@errors,$item);
+                    if ($langcode ne 'x_chef') {
+                        if (code2language($langcode) eq '') {
+                            push(@errors,$item);
+                        }
                     }
                 } else {
                     push(@errors,$item);

--gci1253673613--