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

raeburn raeburn@source.lon-capa.org
Thu, 20 Aug 2009 20:13:06 -0000


raeburn		Thu Aug 20 20:13:06 2009 EDT

  Modified files:              
    /loncom/interface	domainprefs.pm 
  Log:
  - "limit" type for course requests - use blank for umlimited.
  - suppress errors if default language set to x_chef - for testing :)
  - sanity checking for array ref.
  
  
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.102 loncom/interface/domainprefs.pm:1.103
--- loncom/interface/domainprefs.pm:1.102	Tue Aug 11 23:24:29 2009
+++ loncom/interface/domainprefs.pm	Thu Aug 20 20:13:06 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.103 2009/08/20 20:13:06 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1222,9 +1222,12 @@
                             if ($option eq 'autolimit') {
                                 $cell{$item} .= '<input type="text" name="crsreq_'.
                                                 $item.'_limit_'.$type.'" size="1" '.
-                                                'value="'.$currlimit.'" />'; 
+                                                'value="'.$currlimit.'" />';
                             }
                             $cell{$item} .= '</span>&nbsp; ';
+                            if ($option eq 'autolimit') {
+                                $cell{$item} .= $titles{'unlimited'}
+                            }
                         }
                     } else {
                         my $checked = 'checked="checked" ';
@@ -1872,6 +1875,7 @@
                                    approve    => 'Approval by Dom. Coord.',
                                    validate   => 'With validation',
                                    autolimit  => 'Numerical limit',
+                                   unlimited  => '(blank for unlimited)',
                  );
     return %titles;
 }
@@ -4530,6 +4534,8 @@
         if (@{$types} > 0) {
             @{$cancreate{'statustocreate'}} = 
                 &Apache::loncommon::get_env_multiple('form.statustocreate');
+        } else {
+            @{$cancreate{'statustocreate'}} = ();
         }
         push(@contexts,'statustocreate');
     }
@@ -4538,9 +4544,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 +5017,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);