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

raeburn raeburn@source.lon-capa.org
Wed, 18 Nov 2009 23:46:28 -0000


raeburn		Wed Nov 18 23:46:28 2009 EDT

  Modified files:              
    /loncom/interface	lonuserutils.pm 
  Log:
  - Accommodate Communities
   - Eliminate duplicate "Update Display" button (domain context, roletype: community).
   - Domain context: don't inherit course filter when roletype is changed: 
       Course <-> Community     
  
  
Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.105 loncom/interface/lonuserutils.pm:1.106
--- loncom/interface/lonuserutils.pm:1.105	Wed Nov 18 21:32:41 2009
+++ loncom/interface/lonuserutils.pm	Wed Nov 18 23:46:28 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utility functions for managing LON-CAPA user accounts
 #
-# $Id: lonuserutils.pm,v 1.105 2009/11/18 21:32:41 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.106 2009/11/18 23:46:28 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1446,12 +1446,13 @@
                   '<input type="hidden" name="phase" value="" /></form>');
         return;
     }
-    if (!(($context eq 'domain') && ($env{'form.roletype'} eq 'course'))) {
+    if (!(($context eq 'domain') && 
+          (($env{'form.roletype'} eq 'course') || ($env{'form.roletype'} eq 'community')))) {
         $r->print('&nbsp;'.&list_submit_button(&mt('Update Display')).
                   "\n</p>\n");
     }
     my ($indexhash,$keylist) = &make_keylist_array();
-    my (%userlist,%userinfo);
+    my (%userlist,%userinfo,$clearcoursepick);
     if (($context eq 'domain') && 
         ($env{'form.roletype'} eq 'course') || 
         ($env{'form.roletype'} eq 'community')) {
@@ -1476,9 +1477,15 @@
                   $courseform."\n".
                   &Apache::lonhtmlcommon::row_closure(1).
                   &Apache::lonhtmlcommon::end_pick_box().'</p>'.
-                  '<p>'.&list_submit_button(&mt('Update Display')).
+                  '<p><input type="hidden" name="origroletype" value="'.$env{'form.roletype'}.'" />'.
+                  &list_submit_button(&mt('Update Display')).
                   "\n".'</p><span class="LC_warning">'.$warning.'</span>'."\n");
-        if ($env{'form.coursepick'}) {
+        $clearcoursepick = 0;
+        if (($env{'form.origroletype'} ne '') &&
+            ($env{'form.origroletype'} ne $env{'form.roletype'})) {
+            $clearcoursepick = 1;
+        }
+        if (($env{'form.coursepick'}) && (!$clearcoursepick)) {
             $r->print('<hr />'.&mt('Searching').' ...<br />&nbsp;<br />');
         }
     } else {
@@ -1553,7 +1560,7 @@
                 }
             } elsif (($env{'form.roletype'} eq 'course') ||
                      ($env{'form.roletype'} eq 'community')) {
-                if ($env{'form.coursepick'}) {
+                if (($env{'form.coursepick'}) && (!$clearcoursepick)) {
                     my %courses = &process_coursepick();
                     my %allusers;
                     my $hidepriv = 1;