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

raeburn raeburn@source.lon-capa.org
Sat, 22 Aug 2009 18:09:17 -0000


This is a MIME encoded message

--raeburn1250964557
Content-Type: text/plain

raeburn		Sat Aug 22 18:09:17 2009 EDT

  Modified files:              
    /loncom/interface	domainprefs.pm 
  Log:
  - Change setting name where DC approval is required from approve to approval for consistency with lonrequestcourse.pm
  - Additional radio button for "LON-CAPA Advanced Users" - No override set (this is the default), i.e., no specific course request settng applied for LON-CAPA Advanced Users. [Setting based on affiliation is used].
  - (blank for unlimited) text added for default and LC_adv.
  
  
--raeburn1250964557
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20090822180917.txt"

Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.103 loncom/interface/domainprefs.pm:1.104
--- loncom/interface/domainprefs.pm:1.103	Thu Aug 20 20:13:06 2009
+++ loncom/interface/domainprefs.pm	Sat Aug 22 18:09:17 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.103 2009/08/20 20:13:06 raeburn Exp $
+# $Id: domainprefs.pm,v 1.104 2009/08/22 18:09:17 raeburn 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 
 
@@ -1149,7 +1149,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 {
@@ -1331,6 +1331,9 @@
                                        'value="'.$currlimit.'" />';
                 }
                 $defcell{$item} .= '</span>&nbsp; ';
+                if ($option eq 'autolimit') {
+                    $defcell{$item} .= $titles{'unlimited'}
+                }
             }
         } else {
             my $checked = 'checked="checked" ';
@@ -1366,9 +1369,13 @@
     $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>'.&mt('LON-CAPA Advanced Users').' ';
+    if ($context eq 'requestcourses') {
+        $datatable .= &mt('overrides affiliation, if set');
+    } else {
+        $datatable .= &mt('overrides affiliation, if checked');
+    }
+    $datatable .= '</td>'.
                   '<td class="LC_left_item" colspan="2">';
     if ($context eq 'requestcourses') {
         $datatable .= '<table><tr>';
@@ -1387,10 +1394,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') {
@@ -1406,7 +1418,7 @@
                     next if (!$canvalidate);
                 }
                 my $checked = '';
-                if ($option eq $curroption) {
+                if ($val eq $curroption) {
                     $checked = ' checked="checked"';
                 } elsif ($option eq 'autolimit') {
                     if ($curroption =~ /^autolimit/) {
@@ -1423,6 +1435,9 @@
                                        'value="'.$currlimit.'" />';
                 }
                 $advcell{$item} .= '</span>&nbsp; ';
+                if ($option eq 'autolimit') {
+                    $advcell{$item} .= $titles{'unlimited'}
+                }
             }
         } else {
             my $checked = 'checked="checked" ';
@@ -1455,7 +1470,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);
@@ -1470,12 +1485,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);
             }
@@ -1501,7 +1516,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]);
@@ -1872,7 +1887,7 @@
                                    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)',
@@ -1882,7 +1897,7 @@
 
 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;
@@ -3773,7 +3788,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);
@@ -3828,7 +3843,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/) {
@@ -3849,7 +3869,7 @@
                     }
                 } else {
                     if ($context eq 'requestcourses') {
-                        if ($confhash{$item}{$type} ne 'norequest') {
+                        if ($confhash{$item}{$type} ne $unset) {
                             $changes{$item}{$type} = 1;
                         }
                     } else {
@@ -3860,7 +3880,7 @@
                 }
             } else {
                 if ($context eq 'requestcourses') {
-                    if ($confhash{$item}{$type} eq 'norequest') {
+                    if ($confhash{$item}{$type} ne $unset) {
                         $changes{$item}{$type} = 1;
                     }
                 } else {
@@ -3986,7 +4006,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>';
+                                }
                             }
                         }
                     }

--raeburn1250964557--