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

raeburn raeburn@source.lon-capa.org
Thu, 11 Mar 2010 02:51:44 -0000


raeburn		Thu Mar 11 02:51:44 2010 EDT

  Modified files:              (Branch: version_2_9_X)
    /loncom/interface	domainprefs.pm 
  Log:
  - Backport 1.129.
  
  
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.102.2.10 loncom/interface/domainprefs.pm:1.102.2.11
--- loncom/interface/domainprefs.pm:1.102.2.10	Wed Mar 10 17:26:05 2010
+++ loncom/interface/domainprefs.pm	Thu Mar 11 02:51:44 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.102.2.10 2010/03/10 17:26:05 raeburn Exp $
+# $Id: domainprefs.pm,v 1.102.2.11 2010/03/11 02:51:44 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1642,7 +1642,7 @@
 sub print_autoenroll {
     my ($dom,$settings,$rowtotal) = @_;
     my $autorun = &Apache::lonnet::auto_run(undef,$dom),
-    my ($defdom,$runon,$runoff);
+    my ($defdom,$runon,$runoff,$coownerson,$coownersoff);
     if (ref($settings) eq 'HASH') {
         if (exists($settings->{'run'})) {
             if ($settings->{'run'} eq '0') {
@@ -1661,6 +1661,18 @@
                 $runon = ' ';
             }
         }
+        if (exists($settings->{'co-owners'})) {
+            if ($settings->{'co-owners'} eq '0') {
+                $coownersoff = ' checked="checked" ';
+                $coownerson = ' ';
+            } else {
+                $coownerson = ' checked="checked" ';
+                $coownersoff = ' ';
+            }
+        } else {
+            $coownersoff = ' checked="checked" ';
+            $coownerson = ' ';
+        }
         if (exists($settings->{'sender_domain'})) {
             $defdom = $settings->{'sender_domain'};
         }
@@ -1691,8 +1703,16 @@
                   &mt('username').': '.
                   '<input type="text" name="sender_uname" value="'.
                   $notif_sender.'" size="10" />&nbsp;&nbsp;'.&mt('domain').
-                  ':&nbsp;'.$domform.'</span></td></tr>';
-    $$rowtotal += 2;
+                  ':&nbsp;'.$domform.'</span></td></tr>'.
+                  '<tr class="LC_odd_row">'.
+                  '<td>'.&mt('Automatically assign co-ownership').'</td>'.
+                  '<td class="LC_right_item"><span class="LC_nobreak"><label>'.
+                  '<input type="radio" name="autoassign_coowners"'.
+                  $coownerson.' value="1" />'.&mt('Yes').'</label>&nbsp;'.
+                  '<label><input type="radio" name="autoassign_coowners"'.
+                  $coownersoff.' value="0" />'.&mt('No').'</label></span></td>'.
+                  '</tr>';
+    $$rowtotal += 3;
     return $datatable;
 }
 
@@ -4478,7 +4498,8 @@
     }
     my $autorun = &Apache::lonnet::auto_run(undef,$dom),
     my %title = ( run => 'Auto-enrollment active',
-                  sender => 'Sender for notification messages');
+                  sender => 'Sender for notification messages',
+                  coowners => 'Automatic assignment of co-ownership to instructors of record (institutional data)');
     my @offon = ('off','on');
     my $sender_uname = $env{'form.sender_uname'};
     my $sender_domain = $env{'form.sender_domain'};
@@ -4487,11 +4508,12 @@
     } elsif ($sender_uname eq '') {
         $sender_domain = '';
     }
+    my $coowners = $env{'form.autoassign_coowners'};
     my %autoenrollhash =  (
                        autoenroll => { run => $env{'form.autoenroll_run'},
                                        sender_uname => $sender_uname,
                                        sender_domain => $sender_domain,
-
+                                       'co-owners' => $coowners,
                                 }
                      );
     my $putresult = &Apache::lonnet::put_dom('configuration',\%autoenrollhash,
@@ -4512,6 +4534,13 @@
         if ($currautoenroll{'sender_domain'} ne $sender_domain) {
             $changes{'sender'} = 1;
         }
+        if ($currautoenroll{'co-owners'} ne '') {
+            if ($currautoenroll{'co-owners'} ne $coowners) {
+                $changes{'coowners'} = 1;
+            }
+        } elsif ($coowners) {
+            $changes{'coowners'} = 1;
+        }
         if (keys(%changes) > 0) {
             $resulttext = &mt('Changes made:').'<ul>';
             if ($changes{'run'}) {
@@ -4524,6 +4553,10 @@
                     $resulttext .= '<li>'.&mt("$title{'sender'} set to [_1]",$sender_uname.':'.$sender_domain).'</li>';
                 }
             }
+            if ($changes{'coowners'}) {
+                $resulttext .= '<li>'.&mt("$title{'coowners'} set to $offon[$env{'form.autoassign_coowners'}]").'</li>';
+                &Apache::loncommon::devalidate_domconfig_cache($dom);
+            }
             $resulttext .= '</ul>';
         } else {
             $resulttext = &mt('No changes made to auto-enrollment settings');